:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #eef1f4;
  --ink: #1e232a;
  --muted: #5b6571;
  --subtle: #6c7480;
  --line: #e3e7ec;
  --accent: #405f82;
  --accent-soft: #eaf0f6;
  --good: #42785c;
  --warn: #9a6b23;
  --danger: #bd533f;
  --shadow: 0 14px 34px -22px rgba(30, 40, 60, 0.32);
  --radius: 12px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
}

:root[data-theme="dark"] {
  --bg: #16171a;
  --surface: #1d1f23;
  --surface-2: #25282e;
  --ink: #e7e8ec;
  --muted: #9aa0aa;
  --subtle: #9197a0;
  --line: #2c2f36;
  --accent: #9fb5cc;
  --accent-soft: #232a33;
  --good: #7ab391;
  --warn: #d7ad64;
  --danger: #e08a78;
  --shadow: 0 22px 50px -28px rgba(0, 0, 0, 0.72);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #16171a;
    --surface: #1d1f23;
    --surface-2: #25282e;
    --ink: #e7e8ec;
    --muted: #9aa0aa;
    --subtle: #9197a0;
    --line: #2c2f36;
    --accent: #9fb5cc;
    --accent-soft: #232a33;
    --good: #7ab391;
    --warn: #d7ad64;
    --danger: #e08a78;
    --shadow: 0 22px 50px -28px rgba(0, 0, 0, 0.72);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
code { color: var(--accent); font-family: var(--mono); font-size: 0.92em; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

.scan-shell {
  width: min(1320px, 100%);
  margin: 0 auto;
  padding: clamp(16px, 3vw, 34px);
}

.scan-board {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 14px;
  align-items: stretch;
}

.scan-form,
.status-panel,
.results-panel,
.info-grid article {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.scan-form {
  display: grid;
  gap: 16px;
  padding: clamp(18px, 3vw, 26px);
}

.form-head {
  display: grid;
  gap: 8px;
  max-width: 760px;
}

.eyebrow {
  margin: 0;
  color: var(--accent);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

h1,
h2,
p { margin-top: 0; }

h1 {
  margin: 0;
  color: var(--ink);
  font-size: clamp(30px, 4.8vw, 56px);
  font-weight: 850;
  letter-spacing: 0;
  line-height: 1.02;
}

h2 {
  margin: 0;
  color: var(--ink);
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0;
}

.lede {
  margin: 0;
  max-width: 68ch;
  color: var(--muted);
  font-size: 15px;
}

.control-grid {
  display: grid;
  grid-template-columns: 1.4fr 1.3fr 0.9fr 1fr;
  gap: 12px;
}

.field {
  display: grid;
  gap: 7px;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.domain-field { grid-column: span 2; }
.wordlist-field textarea { min-height: 174px; }

input,
select,
textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  outline: none;
  padding: 11px 12px;
}

input,
select { min-height: 44px; }

textarea {
  resize: vertical;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.45;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 15%, transparent);
}

input[type="range"] {
  padding: 0;
  accent-color: var(--accent);
}

.value {
  color: var(--accent);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 850;
}

.consent-box {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid color-mix(in srgb, var(--warn) 45%, var(--line));
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--warn) 9%, var(--surface));
}

.consent-box > svg {
  flex: none;
  width: 22px;
  height: 22px;
  margin-top: 1px;
  fill: none;
  stroke: var(--warn);
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.consent-text { display: grid; gap: 8px; min-width: 0; }
.consent-text strong { color: var(--ink); font-size: 13px; font-weight: 850; }
.consent-text p { margin: 0; color: var(--muted); font-size: 12.5px; }

.consent-check {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
}

.consent-check input {
  flex: none;
  width: 18px;
  height: 18px;
  min-height: 0;
  margin: 1px 0 0;
  padding: 0;
  accent-color: var(--warn);
  cursor: pointer;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.primary-btn,
.ghost-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  border-radius: 10px;
  padding: 0 16px;
  cursor: pointer;
  font-weight: 850;
  transition: border-color 0.14s ease, color 0.14s ease, background 0.14s ease, opacity 0.14s ease;
}

.primary-btn {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
}

.ghost-btn {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
}

.primary-btn:hover,
.ghost-btn:hover {
  opacity: 0.9;
  border-color: var(--accent);
}

.primary-btn:disabled,
.ghost-btn:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.primary-btn svg,
.ghost-btn svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.primary-btn svg:first-child { fill: currentColor; stroke: none; }

:root[data-theme="dark"] .primary-btn { color: #17191d; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .primary-btn { color: #17191d; }
}

.status-panel {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  align-content: start;
  padding: 16px;
}

.metric {
  min-height: 88px;
  display: grid;
  align-content: space-between;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
}

.metric span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.metric strong {
  color: var(--ink);
  font-family: var(--mono);
  font-size: 22px;
  line-height: 1;
}

.progress-wrap,
.log {
  grid-column: 1 / -1;
}

.progress-wrap {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

progress {
  width: 100%;
  height: 12px;
  overflow: hidden;
  border: 0;
  border-radius: 999px;
  background: var(--surface-2);
}

progress::-webkit-progress-bar { background: var(--surface-2); }
progress::-webkit-progress-value { background: var(--accent); }
progress::-moz-progress-bar { background: var(--accent); }

.log {
  min-height: 188px;
  max-height: 258px;
  overflow: auto;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #101216;
  color: #d8dde7;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
}

.results-panel {
  margin-top: 14px;
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.panel-head > div {
  display: grid;
  gap: 4px;
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

th,
td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--muted);
  background: var(--surface-2);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

td {
  color: var(--ink);
  font-family: var(--mono);
  font-size: 12.5px;
}

tbody tr.is-found td { background: color-mix(in srgb, var(--good) 12%, transparent); }
tbody tr.is-timeout td { color: var(--warn); }
tbody tr.is-error td { color: var(--danger); }
.empty-row td {
  color: var(--subtle);
  font-family: var(--font);
  text-align: center;
}

.signal {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 0 10px;
  background: var(--surface-2);
  color: var(--muted);
  font-family: var(--font);
  font-size: 12px;
  font-weight: 800;
}

.signal.found {
  background: color-mix(in srgb, var(--good) 16%, transparent);
  color: var(--good);
}

.signal.timeout { color: var(--warn); }
.signal.error { color: var(--danger); }

.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 14px;
}

.info-grid article {
  padding: 18px;
}

.info-grid p:last-child {
  margin-bottom: 0;
  color: var(--muted);
}

@media (max-width: 980px) {
  .scan-board,
  .info-grid {
    grid-template-columns: 1fr;
  }
  .control-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 640px) {
  .scan-shell {
    padding: 12px;
  }
  .scan-form,
  .status-panel {
    padding: 14px;
  }
  .control-grid,
  .status-panel {
    grid-template-columns: 1fr;
  }
  .domain-field,
  .progress-wrap,
  .log {
    grid-column: auto;
  }
  .panel-head {
    align-items: flex-start;
    flex-direction: column;
  }
  .actions > * {
    flex: 1 1 130px;
  }
}
