:root {
  --bg: #f4f8f7;
  --surface: #ffffff;
  --surface-2: #f7fbfa;
  --ink: #1d2b2e;
  --muted: #6d7f7c;
  --line: #dde8e5;
  --accent: #0d9488;
  --accent-soft: #e3f4f0;
  --kiro: #7c5cff;
  --kiro-soft: #efebff;
  --claude: #d97757;
  --claude-soft: #fbece6;
  --pass: #15803d;
  --pass-soft: #e5f6eb;
  --fail: #c2410c;
  --fail-soft: #fdeee4;
  --review: #a16207;
  --review-soft: #fdf5dc;
  --shadow: 0 1px 2px rgba(16, 40, 36, .04), 0 6px 20px rgba(16, 40, 36, .05);
  color-scheme: light;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}
:root.dark {
  --bg: #0f1918;
  --surface: #172322;
  --surface-2: #1b2a28;
  --ink: #e4eeeb;
  --muted: #93a7a2;
  --line: #2a3b38;
  --accent: #4fd1b5;
  --accent-soft: #16352f;
  --kiro: #a693ff;
  --kiro-soft: #272149;
  --claude: #f0a07f;
  --claude-soft: #3a2620;
  --pass: #5ad38a;
  --pass-soft: #163323;
  --fail: #ff9a6b;
  --fail-soft: #3a2117;
  --review: #f1c75a;
  --review-soft: #352c13;
  --shadow: none;
  color-scheme: dark;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); }
button, select, input { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .45; cursor: not-allowed; }
[hidden] { display: none !important; }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

main { max-width: 1280px; margin: 0 auto; padding: 22px 20px 48px; display: flex; flex-direction: column; gap: 16px; }

.hero { display: flex; gap: 20px; align-items: stretch; justify-content: space-between; flex-wrap: wrap; }
.hero-text { flex: 1 1 420px; min-width: 0; }
.eyebrow { margin: 0 0 6px; font-size: 12px; letter-spacing: .08em; color: var(--accent); font-weight: 600; }
.hero h1 { margin: 0; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 24px; letter-spacing: -.3px; }
.tag { padding: 3px 12px; border-radius: 999px; font-weight: 700; }
.tag.kiro { background: var(--kiro-soft); color: var(--kiro); }
.tag.claude { background: var(--claude-soft); color: var(--claude); }
.vs { font-size: 14px; color: var(--muted); font-weight: 500; }
.lead { margin: 10px 0 0; font-size: 14px; line-height: 1.7; color: var(--muted); max-width: 640px; }

.scoreboard { flex: 0 1 460px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.score { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; box-shadow: var(--shadow); border-top: 3px solid var(--line); }
.score.kiro { border-top-color: var(--kiro); }
.score.claude { border-top-color: var(--claude); }
.score h3 { margin: 0 0 8px; font-size: 13px; color: var(--muted); font-weight: 600; }
.score .big { font-size: 28px; font-weight: 750; letter-spacing: -.5px; font-variant-numeric: tabular-nums; }
.score .big small { font-size: 14px; color: var(--muted); font-weight: 500; }
.score .line { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-top: 6px; gap: 8px; }
.score .line b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }

.tabs { display: flex; gap: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 4px; width: max-content; max-width: 100%; overflow-x: auto; }
.tabs button { border: 0; background: transparent; padding: 8px 18px; border-radius: 9px; font-size: 14px; color: var(--muted); white-space: nowrap; }
.tabs button[aria-selected="true"] { background: var(--accent-soft); color: var(--accent); font-weight: 650; }

.notice { margin: 0; padding: 10px 14px; border-radius: 10px; background: var(--accent-soft); font-size: 13px; }
#preview-banner { background: var(--review-soft); color: var(--review); }
#preview-banner a { margin-left: 8px; }
.notice.error { background: var(--fail-soft); color: var(--fail); }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 18px; box-shadow: var(--shadow); }
.panel-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; flex-wrap: wrap; margin-bottom: 16px; }
.panel-head > div:first-child { flex: 1 1 360px; min-width: 0; }
h2 { margin: 0; font-size: 17px; }
.sub { margin: 6px 0 0; font-size: 13px; line-height: 1.65; color: var(--muted); }
.fine { margin: 12px 0 0; font-size: 12px; line-height: 1.6; color: var(--muted); }
.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.primary, .quiet { min-height: 36px; padding: 7px 16px; border-radius: 9px; font-size: 13px; border: 1px solid var(--line); background: var(--surface); transition: background .15s, border-color .15s; }
.quiet:hover:not(:disabled) { border-color: var(--accent); background: var(--accent-soft); }
.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
:root.dark .primary { color: #08201b; }
.primary:hover:not(:disabled) { filter: brightness(.95); }
.inline { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.inline select { min-width: 130px; }
.switch { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); cursor: pointer; }
.switch input { accent-color: var(--accent); width: 16px; height: 16px; }

.duo { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.side-card { border: 1px solid var(--line); border-radius: 14px; padding: 16px; background: var(--surface-2); min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.side-card.kiro { border-left: 4px solid var(--kiro); }
.side-card.claude { border-left: 4px solid var(--claude); }
.side-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.side-name { font-weight: 700; font-size: 15px; }
.side-model { font-size: 12px; color: var(--muted); font-family: ui-monospace, Consolas, monospace; }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 650; white-space: nowrap; }
.badge.pass { background: var(--pass-soft); color: var(--pass); }
.badge.fail { background: var(--fail-soft); color: var(--fail); }
.badge.review { background: var(--review-soft); color: var(--review); }
.badge.wait { background: var(--accent-soft); color: var(--accent); }
.badge.none { background: var(--line); color: var(--muted); }

.verdict { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.verdict .model { font-size: 22px; font-weight: 750; letter-spacing: -.3px; }
.verdict .pct { font-size: 15px; color: var(--muted); font-variant-numeric: tabular-nums; }
.bars { display: flex; flex-direction: column; gap: 7px; }
.bar-row { display: grid; grid-template-columns: minmax(0, 150px) 1fr 58px; gap: 10px; align-items: center; font-size: 12px; }
.bar-row .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-row .pct { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
.bar { height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent); border-radius: 4px; transform-origin: left; }
.samples { display: flex; flex-direction: column; gap: 6px; }
.sample { font-size: 11px; color: var(--muted); font-family: ui-monospace, Consolas, monospace; padding: 6px 8px; border-radius: 8px; background: var(--surface); border: 1px solid var(--line); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meta-row { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.meta-row b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.empty { padding: 26px 10px; text-align: center; color: var(--muted); font-size: 13px; }
.spinner { display: inline-block; width: 12px; height: 12px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .8s linear infinite; vertical-align: -1px; }

.history { margin-top: 14px; }
.history summary { cursor: pointer; font-size: 13px; color: var(--accent); width: max-content; }
.table-wrap { overflow-x: auto; margin-top: 10px; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-weight: 600; }
td.num { font-variant-numeric: tabular-nums; }

.filters { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.chip { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 5px 12px; font-size: 12px; color: var(--muted); }
.chip[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }

.quiz-list { display: flex; flex-direction: column; gap: 10px; }
.q { border: 1px solid var(--line); border-radius: 14px; background: var(--surface-2); overflow: hidden; }
.q-head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 12px; align-items: center; padding: 12px 14px; }
.q-head input { accent-color: var(--accent); width: 16px; height: 16px; }
.q-title { min-width: 0; }
.q-title strong { font-size: 14px; }
.q-cat { font-size: 11px; color: var(--muted); margin-left: 8px; padding: 1px 8px; border: 1px solid var(--line); border-radius: 999px; }
.q-note { margin: 4px 0 0; font-size: 12px; color: var(--muted); line-height: 1.55; }
.q-badges { display: flex; gap: 6px; }
.q-badges .badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .9; }
.q-badges .who { font-weight: 500; opacity: .8; }
.q-toggle { border: 0; background: transparent; color: var(--accent); font-size: 12px; padding: 4px 6px; }
.q-body { border-top: 1px solid var(--line); padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.q-prompt { font-size: 12px; color: var(--muted); white-space: pre-wrap; line-height: 1.6; background: var(--surface); border: 1px dashed var(--line); border-radius: 10px; padding: 10px 12px; margin: 0; }
.answer { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); min-width: 0; display: flex; flex-direction: column; }
.answer.kiro { border-top: 3px solid var(--kiro); }
.answer.claude { border-top: 3px solid var(--claude); }
.answer-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 12px 6px; flex-wrap: wrap; }
.answer-head .final { font-size: 13px; }
.answer-head .final b { font-weight: 700; }
.answer pre { margin: 0; padding: 4px 12px 12px; white-space: pre-wrap; overflow-wrap: anywhere; font: 13px/1.65 inherit; font-family: inherit; max-height: 360px; overflow: auto; }
.answer .reason { font-size: 12px; color: var(--fail); padding: 0 12px; margin: 0 0 6px; }
.answer .meta-row { padding: 8px 12px; border-top: 1px solid var(--line); margin-top: auto; }

.stage { position: relative; aspect-ratio: 4 / 3; border-radius: 12px; overflow: hidden; background: #fff; border: 1px solid var(--line); }
.stage iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; pointer-events: none; }
.stage .open { position: absolute; inset: 0; border: 0; background: transparent; display: flex; align-items: flex-end; justify-content: flex-end; padding: 10px; }
.stage .open span { font-size: 12px; padding: 4px 10px; border-radius: 6px; background: rgba(0, 0, 0, .65); color: #fff; opacity: 0; transition: opacity .15s; }
.stage .open:hover span, .stage .open:focus-visible span { opacity: 1; }
.stage .empty { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: var(--surface); }

.side-pickers { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin: 14px 0; }
.picker { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px 14px; margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; min-width: 0; }
.picker.kiro { border-left: 4px solid var(--kiro); }
.picker.claude { border-left: 4px solid var(--claude); }
.picker legend { font-size: 13px; font-weight: 650; padding: 0 6px; }
.picker label { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--muted); min-width: 0; }
.picker select, .picker input { width: 100%; min-width: 0; height: 36px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); padding: 0 10px; }
.acct-tag { font-size: 11px; color: var(--muted); font-family: ui-monospace, Consolas, monospace; }
@media (max-width: 860px) { .side-pickers { grid-template-columns: 1fr; } }
@media (max-width: 520px) { .picker { grid-template-columns: 1fr; } }
.schedule .sched-row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; margin-top: 12px; }
.schedule label:not(.switch) { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--muted); }
select { height: 36px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); padding: 0 10px; min-width: 150px; }

dialog { width: min(1100px, 95vw); max-height: 94dvh; padding: 0; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--ink); }
dialog::backdrop { background: rgba(8, 24, 21, .72); backdrop-filter: blur(3px); }
.viewer-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
#viewer-body { height: min(78dvh, 780px); background: #fff; }
#viewer-body iframe { width: 100%; height: 100%; border: 0; }

@media (max-width: 860px) {
  .duo { grid-template-columns: 1fr; }
  .scoreboard { flex-basis: 100%; }
  .q-head { grid-template-columns: auto minmax(0, 1fr) auto; }
  .q-head .q-toggle { grid-column: 1 / -1; justify-self: start; padding-left: 0; }
}
@media (max-width: 520px) {
  main { padding: 14px 12px 32px; }
  .hero h1 { font-size: 20px; }
  .panel { padding: 14px; }
  .q-head { grid-template-columns: auto minmax(0, 1fr); }
  .q-badges { grid-column: 1 / -1; }
  .bar-row { grid-template-columns: minmax(0, 110px) 1fr 50px; }
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
