:root {
  color-scheme: dark;
  --bg: #111414;
  --fg: #e5ebe8;
  --muted: #a2afaa;
  --card: #1a1e1d;
  --line: #35413c;
  --accent: #5acbb3;
  --hit: #f498b1;
  --hit-bg: #35222a;
  --miss: #80cdb4;
  --miss-bg: #1c312a;
  --nam: #5acbb3;
  --ir: #f1a0bf;
  font-family: "Bahnschrift", "Avenir Next", "Segoe UI", sans-serif;
  line-height: 1.5;
  letter-spacing: 0;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--fg); }
a { color: var(--accent); }
.wrap { max-width: 1280px; margin: 0 auto; padding: 0 32px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
[hidden] { display: none !important; }

/* header */
.top { background: var(--card); border-bottom: 1px solid var(--line); }
.top > .wrap:first-child { display: flex; gap: 24px; align-items: center; justify-content: space-between; padding-top: 24px; padding-bottom: 20px; }
.brand { display: flex; gap: .75rem; align-items: center; }
.logo { display: grid; place-items: center; width: 44px; height: 44px; background: var(--accent); color: #fff; border-radius: 8px; font-size: 2rem; line-height: 1; flex: none; }
.logo img { filter: none; }
h1 { margin: 0; font-size: 1.6rem; }
.tagline { margin: .1rem 0 0; color: var(--muted); font-size: .92rem; }
.chips { list-style: none; display: flex; flex-direction: column; gap: 12px; margin: 0; padding: 0; }
.chip { font-size: .85rem; overflow-wrap: anywhere; }
.chip.nam { border-color: var(--nam); color: var(--nam); }
.chip.ir { border-color: var(--ir); color: var(--ir); }
.chip.sub { font-size: .75rem; color: var(--muted); padding-left: 12px; border-left: 2px solid var(--line); }
.chip.bad { border-color: var(--hit); color: var(--hit); }
.tabs { display: flex; gap: 24px; }
.tabs button { border: 0; border-radius: 0; background: none; color: var(--muted); padding: 12px 0; font: inherit; cursor: pointer; border-bottom: 3px solid transparent; }
.tabs button[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }

main.wrap { width: 100%; min-width: 0; padding: 32px 40px 40px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 24px; }

/* upload */
form { display: grid; gap: 20px; }
.drop { min-height: 268px; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 10px; text-align: center; padding: 28px; border: 1px dashed #52675f; border-radius: 8px; background: repeating-linear-gradient(90deg, transparent, transparent 39px, #5acbb307 39px, #5acbb307 40px), var(--card); cursor: pointer; transition: border-color .15s, background-color .15s; }
.drop:hover, .drop.over, .drop:focus-within { border-color: var(--accent); }
.drop.over { background: color-mix(in srgb, var(--accent) 8%, var(--card)); }
.drop input { position: absolute; width: 1px; height: 1px; min-height: 0; opacity: 0; }
.drop-icon { font-size: 2.5rem; color: var(--accent); line-height: 1; margin-bottom: 8px; filter: invert(.9); }
.drop strong { font-size: 1.15rem; font-weight: 600; }
.file { display: grid; gap: .6rem; }
.file-head { display: flex; justify-content: space-between; align-items: start; gap: 1rem; }
.file-head strong { word-break: break-all; }
#wave { width: 100%; height: 96px; color: var(--accent); background: #152b24; border-radius: 4px; }
audio { width: 100%; }
.warn { color: var(--ir); margin: 0; }

.options { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 4px 0; }
.options summary { cursor: pointer; font-weight: 600; padding: 12px 0; font-size: .9rem; }
.options .grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-top: 12px; }
.options label { display: grid; gap: .25rem; font-size: .9rem; }
input[type="number"], input[type="search"], select { font: inherit; width: 100%; min-width: 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--card); color: var(--fg); }

button { font: inherit; cursor: pointer; border-radius: .4rem; }
button:disabled { opacity: .5; cursor: not-allowed; }
.primary { min-width: 168px; background: var(--accent); color: #101815; border: 1px solid var(--accent); padding: 12px 24px; font-weight: 600; }
.ghost { background: none; border: 1px solid var(--line); color: var(--fg); padding: .3rem .7rem; }
.actions { display: flex; align-items: center; gap: .75rem; }
.spinner { width: 1.2rem; height: 1.2rem; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.error { color: var(--hit); background: var(--hit-bg); padding: .6rem .8rem; border-radius: .4rem; }

/* results */
#result { margin-top: 1.5rem; }
.verdict { display: flex; gap: 1rem; align-items: center; padding: 20px; border-left: 3px solid; }
.verdict h2 { margin: 0 0 .2rem; font-size: 1.2rem; }
.verdict p { margin: 0; }
.verdict-icon { flex: none; width: 2.6rem; height: 2.6rem; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 1.3rem; color: #101815; }
.verdict.hit { background: var(--hit-bg); border-color: var(--hit); }
.verdict.hit .verdict-icon { background: var(--hit); }
.verdict.miss { background: var(--miss-bg); border-color: var(--miss); }
.verdict.miss .verdict-icon { background: var(--miss); }
.results-head { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: center; margin-top: 1.25rem; }
.results-head h3 { margin: .5rem 0; }

.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: 6px; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: .5rem .7rem; border-bottom: 1px solid var(--line); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
th { font-size: .75rem; color: var(--muted); font-weight: 600; background: #202724; white-space: nowrap; }
tr.hit td { background: var(--hit-bg); }
td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.badge { display: inline-block; font-size: .72rem; font-weight: 600; padding: .05rem .45rem; border-radius: .3rem; border: 1px solid currentColor; white-space: nowrap; }
.badge.nam { color: var(--nam); }
.badge.ir { color: var(--ir); }
.bar { width: 7rem; height: .5rem; background: var(--line); border-radius: 999px; overflow: hidden; margin-top: .4rem; }
.bar span { display: block; height: 100%; background: var(--muted); }
.bar span.close { background: var(--hit); }

/* browse */
.filters { display: grid; grid-template-columns: minmax(160px, 1fr) 150px 170px; gap: 12px; margin-bottom: 20px; }
.pager { display: flex; justify-content: space-between; align-items: center; margin-top: .75rem; }

.prose h2 { margin-top: 0; }
.prose pre { background: var(--bg); padding: .6rem .8rem; border-radius: .4rem; overflow-x: auto; }

footer.wrap { display: flex; align-items: center; justify-content: space-between; gap: 24px; border-top: 1px solid var(--line); padding-top: 20px; padding-bottom: 24px; }
footer p { max-width: 760px; margin: 0; }
footer > a { flex: none; }
button, input, select, summary { min-height: 44px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; }
a { text-underline-offset: 3px; }
.skip-link { position: fixed; top: -100px; left: 16px; padding: 12px; background: var(--card); z-index: 10; }
.skip-link:focus { top: 12px; }
.source-label { font-size: .8rem; color: var(--muted); }
.app-shell { display: grid; grid-template-columns: 224px minmax(0, 1fr); max-width: 1280px; margin: auto; min-height: 620px; }
.index-status { border-right: 1px solid var(--line); padding: 36px 24px 32px 32px; }
.index-status h2 { font-size: .8rem; color: var(--muted); margin: 0 0 20px; }
.index-status > a { display: block; font-size: .8rem; margin-top: 24px; }
.chip.nam, .chip.ir { font-weight: 600; font-size: .95rem; }
.workspace-heading { display: flex; justify-content: space-between; gap: 16px; align-items: center; margin-bottom: 24px; }
.workspace-heading h2 { font-size: 1.65rem; line-height: 1.25; margin: 0; }
.eyebrow { margin: 0 0 6px; color: var(--muted); font-size: .8rem; }
.format-label { border: 1px solid var(--line); border-radius: 4px; padding: 4px 8px; font-size: .75rem; color: var(--muted); }
.file-head > div { min-width: 0; }
#clear { width: 44px; flex: none; }
.options .ghost { margin-bottom: 12px; }
.primary:hover:not(:disabled) { background: #7ddcc6; }
.ghost:hover:not(:disabled) { background: #2a3530; }
.error, .verdict p { overflow-wrap: anywhere; }
#result { scroll-margin-top: 24px; }
.results-head h3 { font-size: 1rem; }
th, td { padding: 14px 12px; }
td { overflow-wrap: anywhere; min-width: 64px; }
tbody tr:hover { background: #25322c; }
.prose { max-width: 720px; }
.prose h3 { font-size: 1rem; margin-top: 28px; }
.prose li { margin-bottom: 12px; }
@media (max-width: 1000px) {
  .app-shell { grid-template-columns: 190px minmax(0, 1fr); }
  main.wrap { padding: 28px 24px; }
  .index-status { padding-left: 24px; padding-right: 16px; }
  .filters { grid-template-columns: 1fr 1fr; }
  .filters input { grid-column: 1 / -1; }
}
@media (max-width: 700px) {
  .wrap { padding-left: 20px; padding-right: 20px; }
  .top > .wrap:first-child { padding-top: 20px; gap: 12px; }
  .source-label { display: none; }
  .tabs { gap: 24px; font-size: .9rem; }
  .app-shell { display: flex; flex-direction: column; }
  .index-status { order: 2; border-right: 0; border-top: 1px solid var(--line); padding: 24px 20px; }
  .index-status h2 { margin-bottom: 12px; }
  .chips { flex-direction: row; flex-wrap: wrap; gap: 10px 20px; }
  .chip.sub { display: none; }
  .index-status > a { margin-top: 16px; }
  main.wrap { padding: 28px 20px; }
  .workspace-heading h2 { font-size: 1.4rem; }
  .drop { min-height: 260px; padding: 24px 16px; }
  .options .grid { grid-template-columns: 1fr; }
  .file { padding: 16px; }
  .primary { width: 100%; }
  .actions { position: relative; }
  .spinner { position: absolute; right: 16px; border-color: #10181550; border-top-color: #101815; }
  .pager { font-size: .8rem; gap: 8px; }
  .pager button { padding: 8px; }
  footer.wrap { flex-direction: column; align-items: start; gap: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
