/* Dormant TRN Checker — mobile-first, no framework, light + dark. */

:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #16202e;
  --muted: #5b6878;
  --border: #dde2e9;
  --accent: #1d4ed8;
  --accent-text: #ffffff;
  --hit-bg: #fff4ed;
  --hit-border: #f0915a;
  --hit-text: #9a3d0a;
  --miss-bg: #edfaf1;
  --miss-border: #6fbf8b;
  --miss-text: #17603a;
  --warn-bg: #fdf6e3;
  --warn-border: #e0c063;
  --warn-text: #6b5310;
  --radius: 10px;
  --shadow: 0 1px 2px rgb(16 24 40 / 6%), 0 1px 3px rgb(16 24 40 / 5%);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f151d;
    --surface: #18202b;
    --text: #e8edf3;
    --muted: #98a5b5;
    --border: #2b3644;
    --accent: #5b8cf7;
    --accent-text: #0b111a;
    --hit-bg: #2e1d12;
    --hit-border: #a45f2c;
    --hit-text: #ffbe93;
    --miss-bg: #10281c;
    --miss-border: #3d7a56;
    --miss-text: #8fe0b1;
    --warn-bg: #2a2413;
    --warn-border: #7a6a2c;
    --warn-text: #e6d193;
    --shadow: 0 1px 2px rgb(0 0 0 / 30%);
  }
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  -webkit-text-size-adjust: 100%;
}

.wrap {
  width: 100%;
  max-width: 46rem;
  margin-inline: auto;
  padding-inline: 1rem;
}

/* ---------- header ---------- */

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding-block: 1.5rem 1.25rem;
  padding-top: max(1.5rem, env(safe-area-inset-top));
}

.eyebrow {
  margin: 0 0 .3rem;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--muted);
}

h1 { margin: 0 0 .5rem; font-size: 1.6rem; line-height: 1.2; letter-spacing: -.02em; }

.lede { margin: 0; color: var(--muted); font-size: .95rem; max-width: 38rem; }

/* ---------- tabs ---------- */

.tabs {
  display: flex;
  gap: .25rem;
  margin-top: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .25rem;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }

.tab {
  flex: 1 1 auto;
  min-height: 44px;
  white-space: nowrap;
  padding: .5rem .8rem;
  border: 0;
  border-radius: calc(var(--radius) - 3px);
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
}
.tab[aria-selected="true"] { background: var(--accent); color: var(--accent-text); }
.tab:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- panels & fields ---------- */

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.1rem;
  margin-top: .75rem;
}

.field-label { display: block; font-weight: 600; font-size: .95rem; }
.hint { margin: .2rem 0 .75rem; font-size: .85rem; color: var(--muted); }

.field-row { display: flex; gap: .5rem; flex-wrap: wrap; }

input[type="text"], textarea {
  flex: 1 1 12rem;
  min-width: 0;
  min-height: 46px;
  padding: .6rem .75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 16px; /* keeps iOS from zooming the page on focus */
  letter-spacing: .04em;
}
textarea { width: 100%; resize: vertical; line-height: 1.5; letter-spacing: .03em; }
input:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}

.btn-primary, .btn-secondary {
  min-height: 46px;
  padding: .6rem 1.15rem;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font: inherit;
  font-weight: 600;
  font-size: .95rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn-primary { background: var(--accent); color: var(--accent-text); flex: 0 0 auto; }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-primary:disabled { opacity: .5; cursor: progress; }
.btn-primary:focus-visible, .btn-secondary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.bulk-actions { margin-top: .6rem; }
.file-btn { cursor: pointer; }

/* ---------- results ---------- */

.result:empty { display: none; }
.result { margin-top: 1rem; }

.verdict {
  border: 1px solid var(--border);
  border-left-width: 5px;
  border-radius: var(--radius);
  padding: .9rem 1rem;
}
.verdict h3 { margin: 0 0 .3rem; font-size: 1.05rem; letter-spacing: -.01em; }
.verdict p { margin: .3rem 0 0; font-size: .9rem; }
.verdict .trn {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: .06em;
  word-break: break-all;
}

.verdict.hit  { background: var(--hit-bg);  border-color: var(--hit-border);  color: var(--hit-text); }
.verdict.miss { background: var(--miss-bg); border-color: var(--miss-border); color: var(--miss-text); }
.verdict.warn { background: var(--warn-bg); border-color: var(--warn-border); color: var(--warn-text); }
.verdict a { color: inherit; }

.result-meta { margin: 0 0 .6rem; font-size: .88rem; color: var(--muted); }

/* match lists */

.matches {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-height: 22rem;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.matches li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .75rem;
  padding: .55rem .75rem;
  border-bottom: 1px solid var(--border);
  font-size: .92rem;
}
.matches li:last-child { border-bottom: 0; }
.matches .code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: .05em;
  word-break: break-all;
}
.matches .page { color: var(--muted); font-size: .82rem; white-space: nowrap; }

.tag {
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: .15rem .45rem;
  border-radius: 999px;
  white-space: nowrap;
}
.tag.hit  { background: var(--hit-border);  color: #fff; }
.tag.miss { background: var(--miss-border); color: #fff; }
.tag.warn { background: var(--warn-border); color: #3b2f06; }

.summary-row { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: .75rem; }
.pill {
  border: 1px solid var(--border);
  background: var(--bg);
  border-radius: 999px;
  padding: .3rem .75rem;
  font-size: .85rem;
  font-weight: 600;
}
.pill strong { font-variant-numeric: tabular-nums; }

/* ---------- status, guidance, footer ---------- */

.status {
  margin-top: .9rem;
  font-size: .85rem;
  color: var(--muted);
  text-align: center;
  min-height: 1.3em;
}
.status.error { color: var(--hit-text); font-weight: 600; }
.status .retry {
  margin-left: .5rem;
  font: inherit;
  font-weight: 600;
  background: none;
  border: 0;
  color: var(--accent);
  text-decoration: underline;
  cursor: pointer;
}
.status:empty { display: none; }

.guidance {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem;
  margin-block: 1.75rem;
}
.guidance h2 { margin: 0 0 .6rem; font-size: 1.15rem; }
.guidance p { margin: 0 0 .75rem; font-size: .92rem; }

blockquote {
  margin: 0 0 .9rem;
  padding: .7rem .9rem;
  border-left: 4px solid var(--accent);
  background: var(--bg);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: .92rem;
}

.steps { margin: 0 0 1rem; padding-left: 1.2rem; font-size: .92rem; }
.steps li { margin-bottom: .4rem; }

.callout {
  background: var(--warn-bg);
  border: 1px solid var(--warn-border);
  color: var(--warn-text);
  border-radius: var(--radius);
  padding: .8rem .9rem;
  font-size: .85rem !important;
  margin: 0 !important;
}

.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding-block: 1.25rem;
  padding-bottom: max(1.25rem, env(safe-area-inset-bottom));
  font-size: .85rem;
}
.site-footer p { margin: 0 0 .4rem; }
.site-footer p:last-child { margin-bottom: 0; }

.muted { color: var(--muted); }
a { color: var(--accent); }

@media (min-width: 40rem) {
  h1 { font-size: 1.95rem; }
  .site-header { padding-block: 2.25rem 1.75rem; }
  .panel, .guidance { padding: 1.4rem; }
}

@media (prefers-reduced-motion: no-preference) {
  .tab, .btn-primary, .btn-secondary { transition: background-color .15s ease, color .15s ease; }
}

.row-end { display: flex; gap: .5rem; align-items: center; }
.result-actions { margin-bottom: .75rem; }
