:root {
  --black: black;
  --white: white;
  color: var(--white);
  background: var(--black);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--black);
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(1280px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 28px 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.brand-mark {
  width: 74px;
  height: 74px;
  flex: 0 0 auto;
}

.brand-mark img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--white);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  color: var(--white);
  font-size: 3.1rem;
  line-height: 1;
}

.runtime-card {
  display: grid;
  gap: 5px;
  min-width: 160px;
  padding: 12px 14px;
  border: 2px solid var(--white);
  background: var(--black);
}

.runtime-card span,
.metric-strip span,
.field > span,
.field label {
  color: inherit;
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

#status {
  color: var(--white);
  font-size: 1rem;
  font-weight: 900;
}

.metric-strip {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin: -4px 0 14px;
  color: var(--white);
}

.metric-strip article {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  color: inherit;
}

.metric-strip strong {
  color: inherit;
  font: 900 0.9rem/1 ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-variant-numeric: tabular-nums;
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(240px, 0.62fr) minmax(320px, 1fr) minmax(360px, 1fr);
  gap: 14px;
  align-items: stretch;
}

.panel {
  min-width: 0;
  border: 2px solid var(--white);
  background: var(--white);
  color: var(--black);
}

.dictionary-panel,
.input-panel,
.result-panel {
  display: grid;
  align-content: start;
  gap: 18px;
  padding: 16px;
}

.field {
  display: grid;
  gap: 9px;
}

.blacklist-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

input,
textarea {
  width: 100%;
  border: 2px solid var(--black);
  background: var(--white);
  color: var(--black);
  font: 0.98rem ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
}

input {
  min-height: 44px;
  padding: 0 12px;
}

textarea {
  min-height: 320px;
  padding: 14px;
  line-height: 1.55;
  resize: vertical;
}

input:focus,
textarea:focus {
  outline: 3px solid var(--black);
  outline-offset: 2px;
}

.blacklist-form button {
  min-height: 44px;
  padding: 0 16px;
  border: 2px solid var(--black);
  background: var(--black);
  color: var(--white);
  font-weight: 900;
}

.blacklist-form button:hover {
  background: var(--white);
  color: var(--black);
}

.blacklist-list {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 6px;
  min-height: 124px;
  margin: 0;
  padding: 8px;
  border: 2px solid var(--black);
  background: var(--white);
  list-style: none;
}

.blacklist-list li {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  height: 28px;
  border: 2px solid var(--black);
  background: var(--white);
  color: var(--black);
  overflow: hidden;
}

.blacklist-list li span {
  max-width: 190px;
  padding: 0 8px;
  color: var(--black);
  font-size: 0.78rem;
  font-weight: 900;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.blacklist-list button {
  width: 28px;
  min-height: 28px;
  padding: 0;
  border: 0;
  border-left: 2px solid var(--black);
  background: var(--white);
  color: var(--black);
  font-size: 1rem;
  font-weight: 900;
  line-height: 1;
}

.blacklist-list button:hover {
  background: var(--black);
  color: var(--white);
}

.input-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: -8px;
  color: var(--black);
}

#analysis-time {
  font: 900 0.78rem/1 ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-variant-numeric: tabular-nums;
}

#copy-result,
#copy-debug {
  min-height: 32px;
  padding: 0 10px;
  border: 2px solid var(--black);
  background: var(--white);
  color: var(--black);
  font-size: 0.78rem;
  font-weight: 900;
}

#copy-result:hover,
#copy-result:focus-visible,
#copy-debug:hover,
#copy-debug:focus-visible {
  background: var(--black);
  color: var(--white);
}

.highlighted-text {
  min-height: 320px;
  max-height: 520px;
  padding: 14px;
  border: 2px solid var(--black);
  background: var(--white);
  color: var(--black);
  font: 0.98rem/1.55 ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  letter-spacing: 0;
  overflow: auto;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.highlighted-text mark {
  --highlight-color: rgb(255 235 89 / 82%);
  --highlight-edge: rgb(250 180 0 / 60%);
  --highlight-ink: rgb(255 218 32 / 86%);
  padding: 0;
  background-image:
    linear-gradient(92deg, transparent 0 0.1em, var(--highlight-edge) 0.1em 0.22em, transparent 0.22em),
    linear-gradient(88deg, transparent calc(100% - 0.2em), var(--highlight-edge) calc(100% - 0.2em) calc(100% - 0.08em), transparent calc(100% - 0.08em)),
    linear-gradient(96deg, transparent 0 0.08em, var(--highlight-color) 0.08em calc(100% - 0.14em), transparent calc(100% - 0.14em)),
    linear-gradient(89deg, transparent 0 0.18em, var(--highlight-ink) 0.18em calc(100% - 0.24em), transparent calc(100% - 0.24em));
  background-position:
    left 54%,
    right 60%,
    0 54%,
    0 67%;
  background-repeat: no-repeat;
  background-size:
    0.7em 58%,
    0.8em 50%,
    100% 66%,
    100% 34%;
  color: inherit;
  cursor: help;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

.highlighted-text mark:hover,
.highlighted-text mark.is-hovered,
.highlighted-text mark:focus,
.highlighted-text mark:focus-visible {
  outline: 2px solid var(--black);
  outline-offset: 2px;
  filter: saturate(1.45) contrast(1.12);
  text-decoration-line: underline;
  text-decoration-color: var(--black);
  text-decoration-thickness: 2px;
  box-shadow:
    0 0 0 3px rgb(255 255 255 / 88%),
    0 0 0 5px rgb(0 0 0 / 42%);
}

.highlighted-text mark.severity-medium {
  --highlight-color: rgb(137 255 111 / 78%);
  --highlight-edge: rgb(35 195 62 / 56%);
  --highlight-ink: rgb(116 230 83 / 84%);
}

.highlighted-text mark.severity-high {
  --highlight-color: rgb(255 80 128 / 78%);
  --highlight-edge: rgb(220 0 80 / 56%);
  --highlight-ink: rgb(255 100 145 / 84%);
}

.detection-tooltip {
  position: fixed;
  z-index: 1000;
  width: min(360px, calc(100vw - 16px));
  max-height: calc(100vh - 16px);
  padding: 12px;
  border: 2px solid var(--black);
  background: var(--white);
  color: var(--black);
  box-shadow: 6px 6px 0 var(--black);
  font: 0.78rem/1.4 ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  overflow: hidden;
  pointer-events: none;
}

.detection-tooltip::before {
  content: "";
  position: absolute;
  top: -10px;
  left: 22px;
  width: 16px;
  height: 16px;
  border-top: 2px solid var(--black);
  border-left: 2px solid var(--black);
  background: var(--white);
  transform: rotate(45deg);
}

.detection-tooltip[hidden] {
  display: none;
}

.detection-tooltip-title {
  margin-bottom: 8px;
  font-weight: 900;
}

.detection-tooltip-row {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 8px;
  padding: 4px 0;
  border-top: 1px solid rgb(0 0 0 / 18%);
}

.detection-tooltip-row span {
  color: rgb(0 0 0 / 62%);
  font-weight: 900;
}

.detection-tooltip-row strong {
  min-width: 0;
  color: var(--black);
  font-weight: 800;
  overflow-wrap: anywhere;
}

@media (max-width: 1060px) {
  .workspace-grid {
    grid-template-columns: minmax(260px, 0.75fr) minmax(0, 1.25fr);
  }

  .result-panel {
    grid-column: 1 / -1;
  }
}

@media (max-width: 720px) {
  .app-shell {
    width: min(100vw - 24px, 1280px);
    padding: 22px 0;
  }

  .topbar {
    display: grid;
    grid-template-columns: 1fr;
  }

  .brand-mark {
    width: 58px;
    height: 58px;
  }

  h1 {
    font-size: 2.2rem;
  }

  .runtime-card,
  .workspace-grid,
  .blacklist-form {
    grid-template-columns: 1fr;
  }

  .workspace-grid {
    display: grid;
  }
}
