:root {
  /* Always dark: a fight-night arena. Red and blue corners, belt gold, AI cyan. */
  color-scheme: dark;
  --bg: #0a0b0e;
  --card: #13151a;
  --card-2: #1a1d24;
  --text: #eef0f4;
  --muted: #8e94a3;
  --border: rgba(255, 255, 255, .08);
  --border-strong: rgba(255, 255, 255, .16);
  --red: #ff4d4f;
  --red-deep: #b3161b;
  --blue: #3d8bff;
  --blue-deep: #1747a6;
  --gold: #f5c84b;
  --gold-deep: #c9971c;
  --ai: #3ee0ff;
  --accent: var(--gold);
  --accent-text: #15120a;
  --warn: #ffb547;
  --display: "Oswald", "Pretendard Variable", Pretendard, sans-serif;
  --body: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font: 15px/1.6 var(--body);
  letter-spacing: -0.01em;
  /* Corner lights: red corner on the left, blue on the right, over a dark canvas */
  background:
    radial-gradient(900px 520px at -10% -10%, rgba(255, 77, 79, .13), transparent 60%),
    radial-gradient(900px 520px at 110% -10%, rgba(61, 139, 255, .13), transparent 60%),
    radial-gradient(1200px 600px at 50% 120%, rgba(62, 224, 255, .05), transparent 60%),
    var(--bg);
  background-attachment: fixed;
}
::selection { background: rgba(245, 200, 75, .35); }
a { color: var(--ai); }
main { max-width: 880px; margin: 0 auto; padding: 32px 16px 48px; }
h1 { margin: 0 0 4px; font-size: 28px; }
.h1-sub { margin-left: 6px; font-size: 16px; font-weight: 600; color: var(--muted); }
h2 { margin: 0 0 12px; font-size: 17px; }
.sub { margin: 0 0 20px; color: var(--muted); }
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px;
  margin-bottom: 16px;
}
label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 12px; }
.hint { font-weight: 400; color: var(--muted); }
input, select {
  display: block; width: 100%; margin-top: 6px; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--bg); color: var(--text); font: inherit;
}
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
button {
  padding: 11px 20px; border: 0; border-radius: 8px; cursor: pointer;
  background: var(--accent); color: var(--accent-text); font: inherit; font-weight: 600;
}
button:disabled { opacity: .5; cursor: wait; }
.status { margin: 12px 0 0; color: var(--muted); }
.status.error { color: var(--red); }

.verdict { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; }
.fighter { font-size: 18px; font-weight: 700; border-left: 4px solid var(--red); padding-left: 10px; }
.fighter.right { text-align: right; border-left: 0; border-right: 4px solid var(--blue); padding: 0 10px 0 0; }
.fighter small { display: block; font-weight: 400; font-size: 13px; color: var(--muted); }
.fighter.winner::after { content: " 🏆"; }
.center { text-align: center; }
.total { font-size: 34px; font-weight: 800; font-variant-numeric: tabular-nums; }
.verdict-text { color: var(--muted); font-weight: 600; }

.video { padding: 0; overflow: hidden; }
.video iframe { display: block; width: 100%; aspect-ratio: 16 / 9; border: 0; }

.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
th, td { border-bottom: 1px solid var(--border); padding: 8px 6px; text-align: center; white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
td.win { font-weight: 800; }
tr.a td:first-child { color: var(--red); font-weight: 600; }
tr.b td:first-child { color: var(--blue); font-weight: 600; }
.summary { margin: 14px 0 0; }
.cost { margin: 10px 0 0; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.total-cost { font-size: 13px; font-weight: 400; }
.warnings { margin: 8px 0 0; padding-left: 18px; color: var(--warn); font-size: 13px; }

.round { border-top: 1px solid var(--border); padding: 16px 0; scroll-margin-top: 16px; }
.round:first-child { border-top: 0; padding-top: 0; }
.round-head { display: flex; justify-content: space-between; gap: 8px; font-weight: 700; font-size: 16px; }
.round-meta { color: var(--muted); font-size: 13px; margin: 2px 0 8px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.round p { margin: 0 0 8px; }
.rationale { line-height: 1.65; }
.muted { color: var(--muted); font-size: 14px; }
button.ghost {
  padding: 3px 10px; font-size: 12px; font-weight: 600;
  background: transparent; color: var(--text); border: 1px solid var(--border); border-radius: 999px;
}
.badge-warn { color: var(--warn); font-size: 13px; font-weight: 600; }
.factors { margin: 0 0 10px; padding-left: 18px; font-weight: 600; font-size: 14px; }

.timeline-wrap { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px; margin: 6px 0 10px; }
.tl-label { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.timeline { position: relative; height: 22px; border-radius: 6px; background: var(--bg); border: 1px solid var(--border); }
.dot {
  position: absolute; top: 50%; transform: translate(-50%, -50%);
  width: 10px; height: 10px; padding: 0; border-radius: 50%; border: 2px solid var(--card); cursor: pointer;
}
.dot.a { background: var(--red); }
.dot.b { background: var(--blue); }
.dot.w2 { width: 13px; height: 13px; }
.dot.w3 { width: 16px; height: 16px; }
.dot.kd { outline: 2px solid var(--warn); }
.dot:hover { z-index: 2; transform: translate(-50%, -50%) scale(1.3); }

.ev-row { display: grid; grid-template-columns: 2.2em 1fr 2.2em; align-items: center; gap: 6px; margin-bottom: 10px; }
.ev-num { font-weight: 700; font-variant-numeric: tabular-nums; font-size: 13px; }
.ev-num.a { color: var(--red); text-align: right; }
.ev-num.b { color: var(--blue); }
.ev-bar { display: flex; height: 8px; border-radius: 4px; overflow: hidden; background: var(--border); }
.ev-a { background: var(--red); }
.ev-b { background: var(--blue); }
.ev-caption { grid-column: 1 / -1; text-align: center; font-size: 11px; color: var(--muted); }

.evidence { list-style: none; margin: 0; padding: 0; font-size: 14px; }
.evidence li {
  display: grid; grid-template-columns: auto auto auto 1fr auto; align-items: baseline; gap: 8px;
  padding: 6px 0 6px 10px; border-left: 3px solid var(--red); border-bottom: 1px solid var(--border);
}
.evidence li.b { border-left-color: var(--blue); }
.evidence .ts {
  padding: 2px 8px; font-size: 12px; font-variant-numeric: tabular-nums;
  background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: 6px;
}
.tag { font-size: 12px; font-weight: 700; padding: 1px 6px; border-radius: 4px; background: var(--bg); }
.tag.knockdown, .tag.hurt_opponent { color: var(--warn); }
.tag.foul { color: var(--red); }
.who { font-weight: 600; font-size: 13px; white-space: nowrap; }
.weight { color: var(--muted); font-size: 10px; letter-spacing: 1px; }

.history-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.history-head h2 { margin: 0; }
.history { list-style: none; margin: 0; padding: 0; max-height: 360px; overflow-y: auto; }
.history li { display: flex; align-items: center; gap: 8px; border-bottom: 1px solid var(--border); }
.history li:last-child { border-bottom: 0; }
.history li.active { background: var(--bg); }
.h-open {
  flex: 1; display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; text-align: left;
  padding: 10px 8px; background: transparent; color: var(--text); font-weight: 400; border-radius: 0;
}
.h-names { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.h-verdict { font-size: 13px; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.h-date { grid-column: 1 / -1; font-size: 12px; color: var(--muted); }
.h-del { flex: none; margin-right: 8px; }
button.danger { color: var(--red); border-color: var(--red); }
.result-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
#close-result { white-space: nowrap; flex: none; }

header { display: grid; grid-template-columns: 1fr auto; align-items: center; column-gap: 12px; }
header > :not(h1):not(.account) { grid-column: 1 / -1; }
.account { display: flex; align-items: center; justify-content: flex-end; gap: 8px; min-height: 32px; font-size: 12px; }
.account button.ghost, .account a.button { padding: 4px 10px; font-size: 12px; }
.account .lang-select { width: auto; margin: 0; padding: 4px 26px 4px 10px; font-size: 12px; font-weight: 700; border-radius: 999px; background-color: rgba(255,255,255,.04); cursor: pointer; }
a.button { display: inline-block; text-decoration: none; border-radius: 8px; font-weight: 600; }
a.button.ghost { border: 1px solid var(--border); border-radius: 999px; color: var(--text); }
.jobs { list-style: none; margin: 0; padding: 0; }
.job { display: grid; grid-template-columns: 22px 1fr auto; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.job:last-child { border-bottom: 0; }
.j-title { font-weight: 700; }
.j-detail { font-size: 13px; color: var(--muted); }
.job.error .j-detail { color: var(--red); }
.j-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.j-ok { color: #2e9d5b; font-weight: 800; text-align: center; }
.j-err { color: var(--red); font-weight: 800; text-align: center; }
.spinner {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid var(--border); border-top-color: var(--text);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.tabs { display: flex; gap: 4px; margin: 0 0 16px; border-bottom: 1px solid var(--border); }
.tab { padding: 8px 14px; color: var(--muted); text-decoration: none; font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab.active { color: var(--text); border-bottom-color: var(--text); }
.options { display: flex; flex-wrap: wrap; gap: 4px 20px; }
.small { font-size: 13px; }
.admin-tools { padding: 12px 18px; font-size: 14px; }
.rescore { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; }
.publish { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); }
.publish input { flex: 1 1 200px; width: auto; margin: 0; padding: 6px 10px; font-size: 13px; }
.pub-state { font-weight: 600; color: var(--muted); }
.pub-state.on { color: var(--text); }
.pub-state.on::before { content: "● "; color: #2f9e57; }
.pub-actions { display: flex; gap: 6px; }

.live-toggles { display: flex; gap: 16px; flex-wrap: wrap; justify-content: flex-end; }
.watch-options { margin: -4px 0 16px; padding: 0 4px; }
.voice-admin { margin-top: 8px; }

/* Fan vote, verdicts compared, comments */
.vote-buttons { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; }
button.vote-btn {
  padding: 14px 12px; font-family: var(--display); font-size: 17px; font-weight: 600; letter-spacing: .02em; text-transform: uppercase;
  color: var(--text) !important; background: rgba(0,0,0,.35) !important; box-shadow: none !important; border: 1px solid var(--border-strong);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
button.vote-btn.a { border-left: 5px solid var(--red); }
button.vote-btn.b { border-right: 5px solid var(--blue); }
button.vote-btn.draw { font-family: var(--body); font-size: 14px; text-transform: none; }
button.vote-btn:hover { border-color: var(--gold); }
button.vote-btn.chosen { background: linear-gradient(180deg, rgba(245,200,75,.22), rgba(245,200,75,.08)) !important; border-color: var(--gold); color: var(--gold) !important; }
#vote-note { margin: 10px 0 0; }
.compare { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.cmp { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; border-radius: 12px; background: rgba(0,0,0,.3); border: 1px solid var(--border); }
.cmp.ai { border-color: rgba(62, 224, 255, .35); }
.cmp.official { border-color: rgba(245, 200, 75, .35); }
.cmp-label { font: 600 12px/1.4 var(--display); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.cmp b { font-size: 16px; line-height: 1.35; }
.cmp b.muted { font-weight: 600; }
.fan-bar { display: flex; height: 8px; border-radius: 4px; overflow: hidden; background: rgba(255,255,255,.08); margin: 4px 0 2px; }
.fan-bar .fb-a { background: var(--red); }
.fan-bar .fb-draw { background: var(--muted); }
.fan-bar .fb-b { background: var(--blue); }
.cmp-agree { margin: 12px 0 0; font-weight: 700; color: var(--warn); }
.cmp-agree.same { color: #3ddc84; }
.comment-form { display: grid; gap: 8px; margin-bottom: 14px; }
.comment-form input, .comment-form textarea { margin: 0; }
.comment-form textarea { font: inherit; font-size: 14px; }
.comment-form button { justify-self: start; }
.comments-fold { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; background: rgba(0,0,0,.3); }
.comments { list-style: none; margin: 0; padding: 0; }
.comment { padding: 12px 0; border-bottom: 1px solid var(--border); }
.comment:last-child { border-bottom: 0; }
.comment.hidden-comment { opacity: .5; }
.cm-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; }
.cm-text { margin: 4px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.6; }
.cm-actions { display: flex; gap: 6px; margin-top: 6px; }
.cm-hidden { background: var(--warn); }
.official-admin .off-fields { display: flex; flex-wrap: wrap; gap: 6px; flex: 1 1 100%; }
.official-admin select, .official-admin input { width: auto; margin: 0; padding: 6px 8px; font-size: 13px; }
.official-admin #off-round { width: 64px; }
.official-admin #off-cards { flex: 1 1 200px; }
@media (max-width: 600px) {
  .compare { grid-template-columns: 1fr; }
  button.vote-btn { font-size: 14px; padding: 12px 6px; }
  .official-admin select, .official-admin input { font-size: 16px; }
}

/* Scoring requests */
#req-reason { font: inherit; font-size: 14px; }
.requests { list-style: none; margin: 0; padding: 0; max-height: 520px; overflow-y: auto; }
.rq { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.rq:last-child { border-bottom: 0; }
.rq.done, .rq.rejected { opacity: .7; }
.rq-thumb img { display: block; width: 128px; height: 72px; object-fit: cover; border-radius: 6px; background: var(--bg); }
.rq-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.rq-head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: 13px; }
.rq-head a { font-weight: 700; color: var(--blue); }
.rq-state { font-weight: 700; font-size: 12px; padding: 1px 8px; border-radius: 99px; border: 1px solid var(--border); }
.rq-state.pending { color: var(--text); border-color: var(--text); }
.rq-reasons { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.rq-reasons li { padding: 2px 0 2px 10px; border-left: 2px solid var(--border); margin-bottom: 4px; overflow-wrap: anywhere; }
.rq-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.rq-actions button { padding: 5px 12px; font-size: 13px; }
.rq-link { font-size: 13px; color: var(--blue); margin-right: 4px; }

/* Gallery */
.gallery { list-style: none; margin: 12px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.g-card { display: flex; flex-direction: column; gap: 4px; color: inherit; text-decoration: none; border-radius: 10px; }
.g-card img { width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 8px; background: var(--bg); }
.g-card:hover .g-title { text-decoration: underline; }
.g-title { font-weight: 700; line-height: 1.35; }
.g-meta { font-size: 12px; }
.gallery li.active .g-card img { outline: 3px solid var(--blue); outline-offset: 2px; }
.rescore-controls { display: flex; gap: 6px; align-items: center; }
.rescore-controls select { margin: 0; width: auto; padding: 5px 8px; font-size: 13px; }
.version-tag { font-weight: 700; color: var(--blue); text-decoration: none; }
.versions { list-style: none; margin: 8px 0 0; padding: 0; }
.versions li button {
  width: 100%; display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: baseline; text-align: left;
  padding: 10px 8px; background: transparent; color: var(--text); font-weight: 400; border-radius: 0; border-bottom: 1px solid var(--border);
}
.versions li.active button { background: var(--bg); }
.v-id { font-weight: 800; }
.v-note { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.v-meta { font-size: 12px; color: var(--muted); white-space: nowrap; }
.badge { font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 4px; background: var(--text); color: var(--card); margin-left: 6px; }
.vd-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; }
.vd-head h2 { margin-bottom: 2px; }
.vd-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: flex-start; }
h3 { font-size: 14px; margin: 16px 0 6px; }
pre.prompt {
  margin: 0; padding: 12px; max-height: 420px; overflow: auto; white-space: pre-wrap; word-break: break-word;
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px; font: 12.5px/1.55 ui-monospace, "D2Coding", Menlo, monospace;
}
.diff .add { display: block; background: rgba(46, 157, 91, .16); }
.diff .del { display: block; background: rgba(200, 48, 46, .14); text-decoration: line-through; opacity: .8; }
.diff .same { display: block; color: var(--muted); }
textarea {
  display: block; width: 100%; margin-top: 6px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--bg); color: var(--text); font: 12.5px/1.55 ui-monospace, "D2Coding", Menlo, monospace; resize: vertical;
}
label.check { display: flex; align-items: center; gap: 8px; font-weight: 400; }
label.check input { width: auto; margin: 0; }
.vf-actions { display: flex; gap: 8px; }
code { font-size: 12px; background: var(--bg); padding: 0 4px; border-radius: 4px; }

.round-wins { margin: 12px 0 0; font-weight: 700; font-size: 14px; }
.explain { margin-top: 14px; border-top: 1px solid var(--border); padding-top: 10px; font-size: 14px; }
.explain summary { cursor: pointer; font-weight: 600; color: var(--blue); }
.explain p { margin: 8px 0; line-height: 1.6; }
.explain-table { width: auto; margin: 8px 0; font-size: 13px; }
.explain-table th, .explain-table td { white-space: normal; text-align: left; padding: 6px 10px 6px 0; }
#rules-explain .explain { margin-top: 12px; }

footer { color: var(--muted); font-size: 13px; text-align: center; margin-top: 24px; }

th a { color: inherit; text-decoration: none; }
th a:hover { text-decoration: underline; }
label.inline select { width: auto; display: inline-block; margin: 0 0 0 8px; }

/* ---- Synced viewing ------------------------------------------------------ */
/* The YouTube API creates <iframe height="360">: height auto lets aspect-ratio size it */
.video #player { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; border: 0; }
.watch { margin-bottom: 16px; }
.watch .card { margin-bottom: 0; }
.watch .video { margin-bottom: 12px; }
.live { display: flex; flex-direction: column; gap: 10px; padding: 14px; }
.live-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.live-status { font-weight: 700; font-size: 14px; font-variant-numeric: tabular-nums; }
.spoiler-toggle { margin: 0; font-size: 13px; color: var(--muted); white-space: nowrap; }
.live-score { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; }
.ls-name { font-weight: 700; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ls-name.a { border-left: 4px solid var(--red); padding-left: 8px; }
.ls-name.b { border-right: 4px solid var(--blue); padding-right: 8px; text-align: right; }
.ls-total { font-size: 26px; font-weight: 800; font-variant-numeric: tabular-nums; }
.live-round { display: flex; align-items: baseline; gap: 6px; font-size: 13px; font-variant-numeric: tabular-nums; }
.live-round:empty { display: none; }
.lr-label { color: var(--muted); }
.lr-a, .lr-b { font-weight: 800; font-size: 15px; }
.lr-a { color: var(--red); }
.lr-b { color: var(--blue); }
.lr-lead { margin-left: auto; }
.live-chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.live-chips:empty { display: none; }
.chip { padding: 3px 8px; font-size: 12px; font-weight: 700; border-radius: 6px; background: var(--bg); color: var(--text); border: 1px solid var(--border); font-variant-numeric: tabular-nums; }
.chip.a { border-color: var(--red); }
.chip.b { border-color: var(--blue); }
.live-feed { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; overflow-y: auto; min-height: 0; flex: 1; font-size: 13px; }
.live-feed li {
  display: grid; grid-template-columns: auto auto 1fr; gap: 2px 6px; align-items: center;
  border-left: 3px solid var(--red); padding: 4px 0 4px 8px; border-radius: 2px;
}
.live-feed li.b { border-left-color: var(--blue); }
.live-feed li.e, .live-feed li.end.e { border-left-color: var(--muted); }
.live-feed li.end { background: var(--bg); font-weight: 600; }
.live-feed li.empty { display: block; border: 0; padding: 0; }
.live-feed li.fresh { background: color-mix(in srgb, var(--warn) 14%, transparent); animation: pop .4s ease-out; }
.live-feed .ts { padding: 1px 6px; font-size: 12px; background: var(--bg); color: var(--text); border: 1px solid var(--border); font-variant-numeric: tabular-nums; }
.live-feed .who { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.live-feed .desc { grid-column: 1 / -1; line-height: 1.45; }
@keyframes pop { from { transform: translateX(-6px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .live-feed li.fresh { animation: none; } }

/* Spoiler mode: hide the final result until the video gets there */
.spoiler-note { margin: 0 0 12px; font-size: 13px; }
#result.spoiler .verdict, #result.spoiler #score-card, #result.spoiler #rounds-card, #result.spoiler #compare-card { display: none; }
.pane-spoiler { display: none; margin: 0 0 16px; padding: 14px 16px; border: 1px dashed var(--border); border-radius: 12px; font-size: 14px; }
#result.spoiler .pane-spoiler { display: block; }

/* Fight detail tabs: verdict & vote / round by round / comments */
.detail-tabs { display: flex; gap: 4px; padding: 4px; margin: 0 0 16px; border: 1px solid var(--border); border-radius: 12px; background: rgba(255,255,255,.03); }
.dtab { flex: 1 1 0; min-width: 0; padding: 10px 8px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font: inherit; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; box-shadow: none; transition: background .15s, color .15s; }
.dtab:hover { color: var(--text); background: rgba(255,255,255,.04); }
.dtab.active { color: var(--accent-text); background: linear-gradient(180deg, #ffd968, var(--gold)); box-shadow: 0 4px 18px rgba(245, 200, 75, .25); }
.dtab-count:not(:empty) { margin-left: 6px; padding: 0 7px; border-radius: 999px; font-size: 12px; background: rgba(0,0,0,.25); }
.dtab:not(.active) .dtab-count:not(:empty) { background: rgba(255,255,255,.1); color: var(--text); }

/* Wide screens: player and live panel side by side */
@media (min-width: 1000px) {
  main:has(#result:not([hidden])) { max-width: 1240px; }
  .watch { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: stretch; }
  .watch .video { margin-bottom: 0; }
  /* Panel height follows the video; the feed scrolls inside it */
  .watch .live { height: 0; min-height: 100%; box-sizing: border-box; }
}


/* ==== Fight-night theme ================================================== */

/* Header: logo, ring ropes, tabs */
.brand { display: flex; align-items: baseline; flex-wrap: wrap; gap: 0; margin: 0 0 6px; font-family: var(--display); font-size: 40px; line-height: 1; letter-spacing: .02em; text-transform: uppercase; }
.brand-box { color: var(--text); }
.brand-ai {
  background: linear-gradient(100deg, var(--gold) 0%, #ffe9a3 45%, var(--ai) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 14px rgba(62, 224, 255, .25));
}
.brand .h1-sub {
  align-self: center; margin-left: 14px; padding: 4px 10px; font-family: var(--body); font-size: 13px; font-weight: 700;
  letter-spacing: .04em; text-transform: none; color: var(--text);
  border: 1px solid var(--border-strong); border-radius: 999px; background: rgba(255, 255, 255, .04);
}
.sub { color: var(--muted); max-width: 640px; }
.ropes { display: grid; gap: 4px; margin: 4px 0 18px; }
.ropes i { display: block; height: 3px; border-radius: 3px; }
.ropes i:nth-child(1) { background: linear-gradient(90deg, var(--red-deep), var(--red) 40%, transparent); }
.ropes i:nth-child(2) { background: linear-gradient(90deg, rgba(255,255,255,.55), rgba(255,255,255,.25) 50%, transparent); }
.ropes i:nth-child(3) { background: linear-gradient(90deg, var(--blue-deep), var(--blue) 40%, transparent); }

.tabs { gap: 6px; padding: 4px; margin: 0 0 20px; border: 1px solid var(--border); border-radius: 12px; background: rgba(255,255,255,.03); width: fit-content; }
.tab { padding: 8px 18px; border: 0; margin: 0; border-radius: 9px; font-weight: 700; color: var(--muted); transition: background .15s, color .15s; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent-text); background: linear-gradient(180deg, #ffd968, var(--gold)); box-shadow: 0 4px 18px rgba(245, 200, 75, .25); }

/* Surfaces */
.card {
  background: linear-gradient(180deg, var(--card-2), var(--card));
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 1px 0 rgba(255,255,255,.05) inset, 0 18px 40px rgba(0,0,0,.35);
}
h2 { display: flex; align-items: center; gap: 10px; font-size: 16px; font-weight: 800; letter-spacing: .01em; }
h2::before { content: ""; width: 4px; height: 16px; border-radius: 2px; background: linear-gradient(180deg, var(--gold), var(--gold-deep)); flex: none; }
.history-head h2, .vd-head h2 { margin-bottom: 0; }

/* Controls */
input, select, textarea { background: rgba(0,0,0,.35); border: 1px solid var(--border-strong); border-radius: 10px; transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(245, 200, 75, .18); }
button { border-radius: 10px; font-weight: 800; letter-spacing: .01em; transition: transform .08s, box-shadow .15s, filter .15s; }
button:not(.ghost):not(.chip):not(.dot):not(.ts):not(.h-open):not(.v-btn):not(.dtab) {
  background: linear-gradient(180deg, #ffd968, var(--gold) 55%, var(--gold-deep));
  color: var(--accent-text);
  box-shadow: 0 6px 20px rgba(245, 200, 75, .22), 0 1px 0 rgba(255,255,255,.4) inset;
}
button:not(.ghost):not(.chip):not(.dot):not(.ts):not(.h-open):not(.v-btn):not(.dtab):hover { filter: brightness(1.06); }
button:active { transform: translateY(1px); }
button.ghost, a.button.ghost { background: rgba(255,255,255,.04); border: 1px solid var(--border-strong); color: var(--text); }
button.ghost:hover, a.button.ghost:hover { border-color: var(--gold); color: var(--gold); }
#submit, #req-submit { padding: 12px 26px; font-size: 15px; }

/* Scoreboard verdict: red corner vs blue corner */
.verdict {
  position: relative; overflow: hidden; padding: 22px 20px;
  background:
    linear-gradient(90deg, rgba(255, 77, 79, .22), transparent 38%, transparent 62%, rgba(61, 139, 255, .22)),
    linear-gradient(180deg, var(--card-2), var(--card));
}
.fighter { font-family: var(--display); font-size: 24px; font-weight: 600; text-transform: uppercase; letter-spacing: .02em; border-left-width: 5px; }
.fighter.right { border-right-width: 5px; }
.fighter small { font-family: var(--body); text-transform: none; letter-spacing: 0; }
.fighter.winner::after {
  content: "WINNER"; display: inline-block; margin-top: 6px; padding: 1px 8px; border-radius: 4px;
  font: 600 11px/1.6 var(--display); letter-spacing: .14em; color: var(--accent-text);
  background: linear-gradient(180deg, #ffd968, var(--gold)); box-shadow: 0 0 14px rgba(245, 200, 75, .35);
}
.total { font-family: var(--display); font-size: 52px; font-weight: 700; line-height: 1; letter-spacing: .02em; text-shadow: 0 0 24px rgba(245, 200, 75, .25); }
.verdict-text { margin-top: 6px; font-weight: 700; color: var(--gold); letter-spacing: .02em; }

/* Live panel: broadcast graphics */
.live { background: linear-gradient(180deg, #161a22, #0f1116); border-color: rgba(62, 224, 255, .18); box-shadow: 0 0 0 1px rgba(62,224,255,.05) inset, 0 18px 40px rgba(0,0,0,.4); }
.live-head { flex-wrap: wrap; row-gap: 6px; }
button.voice-unlock { width: 100%; padding: 9px 12px; font-size: 14px; animation: livepulse 1.6s ease-in-out infinite; }
.live-status { display: flex; align-items: center; gap: 8px; white-space: nowrap; font-family: var(--display); font-weight: 600; font-size: 15px; letter-spacing: .03em; }
.live-status::before { content: "LIVE"; padding: 1px 7px; border-radius: 4px; font-size: 11px; letter-spacing: .12em; color: #fff; background: var(--red); box-shadow: 0 0 12px rgba(255, 77, 79, .6); animation: livepulse 1.6s ease-in-out infinite; }
@keyframes livepulse { 50% { opacity: .55; } }
.live-score { padding: 10px 12px; border-radius: 12px; background: rgba(0,0,0,.35); border: 1px solid var(--border); }
.ls-name { font-family: var(--display); font-weight: 600; font-size: 16px; text-transform: uppercase; letter-spacing: .02em; }
.ls-total { font-family: var(--display); font-size: 34px; font-weight: 700; color: var(--text); text-shadow: 0 0 18px rgba(62, 224, 255, .3); }
.lr-a, .lr-b { font-family: var(--display); font-size: 18px; }
.chip { font-family: var(--display); letter-spacing: .03em; background: rgba(0,0,0,.35); }
.chip.a { box-shadow: inset 3px 0 0 var(--red); }
.chip.b { box-shadow: inset 3px 0 0 var(--blue); }
.live-feed li { border-radius: 8px; background: rgba(255,255,255,.025); padding: 6px 8px 6px 10px; }
.live-feed li.fresh { background: linear-gradient(90deg, rgba(62, 224, 255, .16), rgba(62, 224, 255, .02)); box-shadow: 0 0 0 1px rgba(62,224,255,.25) inset; }
.live-feed li.end { background: linear-gradient(90deg, rgba(245, 200, 75, .16), rgba(245, 200, 75, .02)); border-left-color: var(--gold); }
.voice-pending { margin: 4px 0 6px; }
.live-feed li.banter:not(.fresh) { background: transparent; }
.live-feed li.banter .desc { color: var(--muted); font-style: italic; }
.live-feed li.banter.fresh .desc { color: var(--text); }
.live-feed .ts, .evidence .ts { font-family: var(--display); letter-spacing: .04em; background: rgba(0,0,0,.4); border-color: var(--border-strong); border-radius: 6px; }
.live-feed .ts:hover, .evidence .ts:hover { border-color: var(--ai); color: var(--ai); }
.spoiler-toggle input, label.check input { accent-color: var(--gold); }
.video { border-color: rgba(255,255,255,.1); box-shadow: 0 24px 60px rgba(0,0,0,.55); }

/* Tables and rounds */
th { font-family: var(--display); font-weight: 600; letter-spacing: .05em; color: var(--muted); text-transform: uppercase; }
td { font-variant-numeric: tabular-nums; }
td.win { color: var(--gold); }
.round-head { font-family: var(--display); font-size: 18px; font-weight: 600; letter-spacing: .03em; }
.timeline { background: rgba(0,0,0,.4); border-color: var(--border-strong); }
.dot { border-color: var(--bg); box-shadow: 0 0 8px currentColor; }
.dot.a { color: var(--red); }
.dot.b { color: var(--blue); }
.ev-bar { background: rgba(255,255,255,.08); height: 10px; }
.ev-a { background: linear-gradient(90deg, var(--red-deep), var(--red)); }
.ev-b { background: linear-gradient(90deg, var(--blue), var(--blue-deep)); }
.tag { background: rgba(255,255,255,.06); }
.badge { background: var(--gold); color: var(--accent-text); }
.explain summary { color: var(--ai); }

/* Gallery: fight cards */
.gallery { gap: 18px; }
.g-card { position: relative; padding: 0 0 10px; border-radius: 14px; background: rgba(0,0,0,.25); border: 1px solid var(--border); overflow: hidden; transition: transform .15s, border-color .15s, box-shadow .15s; }
.g-card img { border-radius: 0; filter: saturate(1.05) contrast(1.05); }
.g-card::before {
  content: "AI JUDGED"; position: absolute; top: 10px; left: 10px; z-index: 1; padding: 2px 8px; border-radius: 5px;
  font: 600 11px/1.6 var(--display); letter-spacing: .12em; color: #001218; background: var(--ai); box-shadow: 0 0 14px rgba(62,224,255,.5);
}
.g-card::after { content: ""; position: absolute; inset: 0 0 auto 0; aspect-ratio: 16 / 9; background: linear-gradient(180deg, transparent 55%, rgba(10,11,14,.85)); pointer-events: none; }
.g-card:hover { transform: translateY(-3px); border-color: rgba(245, 200, 75, .5); box-shadow: 0 16px 36px rgba(0,0,0,.5), 0 0 0 1px rgba(245,200,75,.2); }
.g-card:hover .g-title { text-decoration: none; color: var(--gold); }
.g-title, .g-meta { padding: 0 12px; }
.g-title { font-weight: 800; font-size: 15px; }
.gallery li.active .g-card { border-color: var(--gold); }
.gallery li.active .g-card img { outline: 0; }

/* Lists */
.history li.active, .versions li.active button { background: rgba(245, 200, 75, .08); }
.h-open:hover, .versions li button:hover { background: rgba(255,255,255,.03); }
.rq-state.pending { color: var(--gold); border-color: var(--gold); }
.pub-state.on::before { color: #3ddc84; }
.j-ok { color: #3ddc84; }
.spinner { border-color: rgba(255,255,255,.12); border-top-color: var(--ai); }
footer { max-width: 720px; margin: 28px auto 0; padding: 14px 16px; border-top: 1px solid var(--border); line-height: 1.65; }
footer p { margin: 0 0 6px; }
footer b { color: var(--text); }
.beta {
  display: inline-block; margin-right: 6px; padding: 0 7px; border-radius: 4px; vertical-align: 1px;
  font: 600 11px/1.6 var(--display); letter-spacing: .12em; color: var(--warn);
  border: 1px solid color-mix(in srgb, var(--warn) 60%, transparent); background: color-mix(in srgb, var(--warn) 10%, transparent);
}
.brand .beta { align-self: center; margin: 0 0 0 8px; font-size: 11px; letter-spacing: .12em; }

@media (prefers-reduced-motion: reduce) {
  .live-status::before { animation: none; }
  .g-card, button { transition: none; }
}

/* ---- Mobile ------------------------------------------------------------- */
@media (max-width: 600px) {
  main { padding: 20px 12px 40px; }
  h1 { font-size: 23px; }
  .brand { font-size: 32px; }
  .brand .h1-sub { margin-left: 10px; font-size: 12px; }
  .tabs { width: 100%; }
  .tab { flex: 1; text-align: center; padding: 8px 10px; }
  .total { font-size: 34px; }
  .fighter { font-size: 17px; }
  #close-result { white-space: nowrap; flex: none; }
  .g-card::before { top: 6px; left: 6px; padding: 0 6px; font-size: 9px; }
  .g-title { font-size: 13px; }
  .g-title, .g-meta { padding: 0 8px; }
  .watch { background: var(--bg); }
  .watch .video { padding: 0; border-radius: 0; box-shadow: none; }
  .watch .live { background: linear-gradient(180deg, #161a22, #0f1116); }
  /* Sticky strip under the player: status + score on one row, the latest line below.
     Per-round points and round chips are in the scorecard; the toggles sit below. */
  .watch .live { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 4px 10px; padding: 6px 12px 8px; box-shadow: none; }
  .watch .live-head { grid-column: 1; min-width: 0; }
  .watch .live-status { font-size: 13px; overflow: hidden; text-overflow: ellipsis; }
  .watch .live-score { grid-column: 2; padding: 2px 10px; border-radius: 8px; gap: 0; }
  .watch .ls-name { display: none; }
  .watch .ls-total { font-size: 20px; }
  #live-totalA { color: var(--red); }
  #live-totalB { color: var(--blue); }
  .watch .live-round, .watch .live-chips { display: none; }
  .watch .voice-unlock, .watch .voice-pending, .watch .live-feed { grid-column: 1 / -1; }
  /* Latest line only, on one row: [time] commentary */
  .watch .live-feed li { grid-template-columns: auto minmax(0, 1fr); padding: 4px 8px; }
  .watch .live-feed .tag, .watch .live-feed .who { display: none; }
  .watch .live-feed .desc { grid-column: auto; -webkit-line-clamp: 1; }
  .watch-options { justify-content: space-between; margin: 0 0 12px; padding: 0 2px; }
  .sub { font-size: 13px; margin-bottom: 14px; }
  .card { padding: 14px; border-radius: 10px; margin-bottom: 12px; }

  /* iOS zooms into inputs smaller than 16px */
  input, select, textarea { font-size: 16px; }
  textarea { font-size: 14px; }

  /* Form: full-width controls */
  .row { grid-template-columns: 1fr; gap: 0; }
  .options { flex-direction: column; gap: 0; }
  label.inline { display: block; }
  label.inline select { display: block; width: 100%; margin: 6px 0 0; }
  #submit { width: 100%; padding: 13px; }

  /* Verdict: keep names beside the score, just smaller */
  .verdict { grid-template-columns: 1fr auto 1fr; gap: 8px; padding: 12px; }
  .fighter { font-size: 14px; padding-left: 8px; overflow-wrap: anywhere; }
  .fighter.right { padding-right: 8px; }
  .fighter small { font-size: 11px; }
  .total { font-size: 24px; }
  .verdict-text { font-size: 12px; }

  /* Player stays on screen so evidence clips play without scrolling back up */
  .video { position: sticky; top: 0; z-index: 5; border-radius: 0; margin: 0 -12px 12px; border-left: 0; border-right: 0; }

  /* Rescore: stacked */
  .admin-tools { padding: 12px 14px; }
  .rescore { flex-direction: column; align-items: stretch; }
  .publish input { flex-basis: 100%; font-size: 16px; }
  .pub-actions { width: 100%; }
  .pub-actions button { flex: 1; padding: 9px; font-size: 14px; }
  .gallery { grid-template-columns: 1fr 1fr; gap: 10px; }
  .g-title { font-size: 14px; }
  header { grid-template-columns: 1fr; }
  .account { justify-content: flex-start; min-height: 0; margin-bottom: 6px; }
  .account .lang-select { font-size: 16px; }
  .rescore-controls { flex-direction: column; align-items: stretch; }
  .rescore-controls select { width: 100%; padding: 9px 10px; font-size: 16px; }
  .rescore-controls button { padding: 9px; font-size: 14px; }

  /* History: names on their own line */
  .h-open { grid-template-columns: 1fr; padding: 10px 4px; }
  .h-names { white-space: normal; }
  .h-verdict { text-align: left; }
  .history { max-height: none; }

  /* Jobs: actions under the text */
  .job { grid-template-columns: 22px 1fr; }
  .j-actions { grid-column: 2; justify-content: flex-start; }

  /* Evidence */
  .evidence li { grid-template-columns: auto 1fr auto; gap: 4px 8px; padding-left: 8px; }
  .evidence .ts { padding: 6px 10px; font-size: 13px; }
  .evidence .tag { justify-self: start; }
  .evidence .who { display: none; }
  .evidence .desc { grid-column: 1 / -1; }
  .evidence .weight { grid-row: 1; grid-column: 3; }
  .round-head { font-size: 15px; }
  button.ghost { padding: 6px 12px; font-size: 13px; }

  /* Timeline: bigger tap targets */
  .timeline { height: 30px; }
  .dot { width: 14px; height: 14px; }
  .dot.w2 { width: 17px; height: 17px; }
  .dot.w3 { width: 20px; height: 20px; }
  .dot::after { content: ""; position: absolute; inset: -10px; }

  /* Score table scrolls sideways inside its card */
  .table-wrap { margin: 0 -14px; padding: 0 14px; }

  /* Rules */
  .versions li button { grid-template-columns: auto 1fr; gap: 2px 10px; }
  .v-note { white-space: normal; }
  .v-meta { grid-column: 1 / -1; }
  .vd-actions { width: 100%; }
  .vd-actions button { flex: 1 1 auto; }
  pre.prompt { font-size: 12px; max-height: 60vh; }
  .vf-actions button { flex: 1; }
  .explain-table { font-size: 12px; }

  /* Synced viewing: player and a compact live strip stay on screen together */
  .watch { position: sticky; top: 0; z-index: 5; margin: 0 -12px 12px; background: var(--card); border-bottom: 1px solid var(--border); }
  .watch .video { position: static; margin: 0; border: 0; }
  .watch .live { border: 0; border-radius: 0; padding: 8px 12px; gap: 6px; }
  .ls-total { font-size: 20px; }
  .ls-name { font-size: 13px; }
  .live-chips { flex-wrap: nowrap; overflow-x: auto; }
  .chip { white-space: nowrap; }
  .live-feed li:not(:first-child) { display: none; }
  .live-feed .desc { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
}
