:root {
  --bg: #e9ecef;
  --surface: #ffffff;
  --ink: #15191e;
  --muted: #535c66;
  --line: #d3d8de;
  --sub: #ffd23f;       /* subtitle yellow — the one accent */
  --sub-ink: #1d1a0a;
  --use: #17703f;
  --use-bg: #e3f3e9;
  --cut: #b42318;
  --cut-bg: #fde8e6;
  --focus: #1d5fd1;
  --radius: 14px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101317;
    --surface: #1a1f25;
    --ink: #eef1f4;
    --muted: #a3adb8;
    --line: #2d343c;
    --use: #5fd08f;
    --use-bg: #12301f;
    --cut: #ff8a7f;
    --cut-bg: #3a1714;
    --focus: #7fb0ff;
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { transition: none !important; } }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 18px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
button, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---- top ---- */
.top-in, .bar > *, main, .foot { max-width: 1180px; margin-inline: auto; padding-inline: 16px; }
.top-in { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-block: 16px 8px; }
h1 { margin: 0; font-size: 1.6rem; line-height: 1.2; letter-spacing: -0.01em; }
h1 span { display: block; font-size: 0.95rem; font-weight: 400; color: var(--muted); letter-spacing: 0; }
.btn-csv {
  min-height: 48px; padding: 0 20px; border-radius: 999px; border: 2px solid var(--ink);
  background: var(--ink); color: var(--bg); font-weight: 700; cursor: pointer; white-space: nowrap;
}

/* ---- sticky nav ---- */
.bar {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  padding-block: 8px;
}
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-block: 2px 8px; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; min-height: 44px; padding: 0 16px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); font-weight: 600; cursor: pointer;
}
.chip[aria-current="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip[hidden] { display: none; }
.bar-row { display: flex; gap: 8px; }
#jump {
  flex: 1; min-width: 0; min-height: 48px; padding: 0 12px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface);
}
.filter {
  flex: none; display: inline-flex; align-items: center; gap: 8px; min-height: 48px; padding: 0 14px;
  border-radius: 12px; border: 1px solid var(--line); background: var(--surface); font-weight: 600; cursor: pointer;
}
.filter .dot { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--muted); }
.filter b { font-weight: 700; color: var(--muted); }
.filter[aria-pressed="true"] { background: var(--sub); color: var(--sub-ink); border-color: var(--sub); }
.filter[aria-pressed="true"] .dot { background: var(--sub-ink); border-color: var(--sub-ink); }
.filter[aria-pressed="true"] b { color: var(--sub-ink); }

/* ---- board ---- */
main { padding-block: 8px 40px; }
.seg { scroll-margin-top: 130px; }
.seg-title {
  margin: 40px 0 0; font-size: 2rem; line-height: 1.15; letter-spacing: -0.02em;
}
.seg-title small { display: block; font-size: 1rem; font-weight: 400; color: var(--muted); letter-spacing: 0; margin-top: 4px; }
.cau { scroll-margin-top: 130px; margin-top: 28px; }
.cau-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px; margin-bottom: 10px; }
.cau-name { font-weight: 700; color: var(--muted); font-size: 1rem; }
.count { font-size: 0.95rem; font-weight: 700; padding: 2px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); color: var(--muted); }
.count.over { background: var(--sub); border-color: var(--sub); color: var(--sub-ink); }
.count.fixed { background: var(--use-bg); border-color: var(--use-bg); color: var(--use); }

/* the narration line, set like a subtitle on a dark frame */
.line {
  margin: 0 0 14px; padding: 14px 18px; border-radius: var(--radius);
  background: #15191e; color: #fff; font-size: clamp(1.25rem, 1rem + 1.2vw, 1.6rem); line-height: 1.35; font-weight: 600;
  text-wrap: pretty;
}
.cau.is-over .line { box-shadow: inset 6px 0 0 var(--sub); }

.shots { display: grid; gap: 16px; grid-template-columns: 1fr; list-style: none; padding: 0; margin: 0; }
@media (min-width: 680px) { .shots { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1000px) { .shots { grid-template-columns: repeat(3, 1fr); } }

.shot { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; }
.frame { position: relative; aspect-ratio: 720 / 406; background: #000; }
.frame img { display: block; width: 100%; height: 100%; object-fit: cover; transition: opacity .15s, filter .15s; }
.num {
  position: absolute; left: 10px; top: 10px; min-width: 48px; padding: 2px 10px; border-radius: 10px;
  background: rgba(0,0,0,.72); color: #fff; font-size: 1.35rem; font-weight: 800; text-align: center; font-variant-numeric: tabular-nums;
}
.shot.is-bo .frame img { opacity: .35; filter: grayscale(1); }
.shot.is-bo .frame::after {
  content: "Bỏ"; position: absolute; right: 10px; top: 10px; padding: 2px 12px; border-radius: 10px;
  background: #b42318; color: #fff; font-weight: 800; font-size: 1.1rem;
}
.shot.is-dung { border-color: var(--use); box-shadow: 0 0 0 2px var(--use) inset; }

.body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.pic { margin: 0; font-size: 1.15rem; line-height: 1.4; font-weight: 600; }
.tc { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; font-size: 0.95rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.tc dt { font-weight: 600; }
.tc dd { margin: 0; color: var(--ink); }
.snd { margin: 0; font-size: 0.95rem; color: var(--muted); font-style: italic; }

.mark { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: auto; }
.mark button {
  min-height: 52px; border-radius: 12px; border: 2px solid var(--line); background: transparent;
  font-size: 1.1rem; font-weight: 700; cursor: pointer;
}
.mark .b-dung[aria-pressed="true"] { background: var(--use); border-color: var(--use); color: #fff; }
.mark .b-bo[aria-pressed="true"] { background: var(--cut); border-color: var(--cut); color: #fff; }
@media (prefers-color-scheme: dark) {
  .mark .b-dung[aria-pressed="true"], .mark .b-bo[aria-pressed="true"] { color: #101317; }
}
.note {
  width: 100%; min-height: 52px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--bg); resize: vertical; line-height: 1.4; field-sizing: content;
}
.note::placeholder { color: var(--muted); }

body.only-over .cau:not(.is-over), body.only-over .seg:not(.has-over) { display: none; }

.foot { padding-block: 24px 48px; color: var(--muted); font-size: 0.95rem; border-top: 1px solid var(--line); }
.foot p { margin: 0 0 12px; max-width: 60ch; }
.supercat-credit { color: var(--muted); font-size: 0.85rem; text-decoration: none; }
.supercat-credit:hover { text-decoration: underline; }

@media (max-width: 420px) {
  .filter { padding: 0 10px; font-size: 0.95rem; }
  h1 { font-size: 1.4rem; }
}
