:root {
  --ink: #14352a;
  --muted: #6d7d75;
  --paper: #f5f3ee;
  --card: #fffdf8;
  --line: #deded5;
  --green: #1d6b4f;
  --green-dark: #0d2f25;
  --green-soft: #dcebe1;
  --orange: #e36f3d;
  --orange-soft: #fae3d6;
  --shadow: 0 14px 30px rgba(18, 46, 35, 0.08);
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--paper); }
body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif;
}
button, input { font: inherit; }
button { cursor: pointer; }
.app-shell { min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  height: 76px; padding: 0 clamp(20px, 5vw, 72px); display: flex; align-items: center; justify-content: space-between;
  background: var(--green-dark); color: #f7f6ef;
}
.brand { color: inherit; text-decoration: none; display: inline-flex; align-items: center; gap: 11px; }
.brand-mark { width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid #a9c9b5; color: #c9e6d1; font-weight: 800; letter-spacing: 0; }
.brand strong { display: block; font-size: 20px; line-height: 1.05; letter-spacing: 0; }
.brand small { display: block; margin-top: 3px; color: #a6c5b2; font-size: 9px; letter-spacing: 1.6px; }
.topbar-actions { display: flex; align-items: center; gap: 18px; }
.ghost-button { border: 0; background: transparent; color: #d5e7dc; padding: 9px 0; font-size: 13px; }
.ghost-button span { margin-right: 5px; font-size: 19px; vertical-align: -1px; }
.ghost-button:hover { color: #fff; }
.live-dot { color: #9bc8ab; font-size: 11px; letter-spacing: .5px; white-space: nowrap; }
.live-dot i { display: inline-block; width: 6px; height: 6px; margin-right: 5px; background: #75c995; border-radius: 50%; vertical-align: 1px; }
.intro-band { padding: clamp(40px, 7vw, 78px) clamp(20px, 8vw, 120px) 62px; display: flex; align-items: flex-end; justify-content: space-between; gap: 28px; background: #e3ece4; border-bottom: 1px solid #cedacf; }
.intro-copy { max-width: 710px; }
.eyebrow { margin: 0 0 13px; color: var(--orange); font-size: 11px; font-weight: 800; letter-spacing: 2.3px; }
.intro-copy h1 { margin: 0; max-width: 680px; font-size: clamp(30px, 4.6vw, 55px); line-height: 1.12; letter-spacing: 0; font-weight: 800; }
.intro-text { max-width: 530px; margin: 20px 0 0; color: #4d6458; font-size: 15px; line-height: 1.8; }
.score-stamp { flex: 0 0 136px; width: 136px; height: 136px; border: 2px solid var(--green); display: flex; flex-direction: column; align-items: center; justify-content: center; transform: rotate(5deg); color: var(--green); }
.score-stamp span { font-size: 13px; letter-spacing: 2px; }
.score-stamp strong { margin-top: 2px; font-size: 32px; letter-spacing: 1px; }
.workspace { width: min(1280px, calc(100% - 40px)); margin: 0 auto; padding: 54px 0 72px; display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: clamp(34px, 5vw, 72px); align-items: start; }
.control-panel { padding-top: 7px; }
.panel-kicker { color: var(--orange); font-size: 10px; font-weight: 800; letter-spacing: 1.8px; }
.panel-heading h2 { margin: 8px 0 28px; font-size: 22px; letter-spacing: 0; }
.filter-label { display: block; margin-bottom: 10px; font-size: 12px; color: var(--muted); }
.filter-group + .filter-group { margin-top: 24px; }
.filter-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.filter-heading .filter-label { margin-bottom: 10px; }
.filter-actions { display: flex; gap: 10px; }
.filter-actions button { padding: 0; border: 0; background: transparent; color: var(--green); font-size: 10px; }
.filter-actions button:hover { text-decoration: underline; }
.segmented { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--line); background: #eeeDE6; }
.segment { min-height: 38px; border: 0; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: transparent; color: #637168; font-size: 12px; }
.segment:nth-child(2n) { border-right: 0; }
.segment:nth-last-child(-n+2) { border-bottom: 0; }
.segment.is-active { background: var(--green); color: #fff; font-weight: 700; }
.category-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.category-option { min-width: 0; }
.category-option input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.category-option span { min-height: 34px; padding: 7px 8px; border: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 5px; background: #f0efe9; color: #64736b; font-size: 11px; line-height: 1.2; }
.category-option span::after { content: ''; flex: 0 0 12px; width: 12px; height: 12px; border: 1px solid #aab5ae; background: #fff; }
.category-option input:checked + span { border-color: #83a997; background: var(--green-soft); color: var(--green-dark); font-weight: 700; }
.category-option input:checked + span::after { border-color: var(--green); background: var(--green); box-shadow: inset 0 0 0 3px var(--green-soft); }
.category-option input:focus-visible + span { outline: 2px solid var(--orange); outline-offset: 1px; }
.play-settings { margin-top: 25px; padding: 16px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.toggle-row { min-height: 30px; display: flex; align-items: center; justify-content: space-between; gap: 10px; color: var(--ink); font-size: 12px; cursor: pointer; }
.toggle-row input { position: absolute; opacity: 0; pointer-events: none; }
.toggle-track { position: relative; flex: 0 0 36px; width: 36px; height: 20px; border: 1px solid #aeb9b2; background: #e4e5df; }
.toggle-track::after { content: ''; position: absolute; top: 3px; left: 3px; width: 12px; height: 12px; background: #75847c; transition: transform .18s, background .18s; }
.toggle-row input:checked + .toggle-track { border-color: var(--green); background: var(--green-soft); }
.toggle-row input:checked + .toggle-track::after { transform: translateX(16px); background: var(--green); }
.toggle-row input:focus-visible + .toggle-track { outline: 2px solid var(--orange); outline-offset: 2px; }
.jump-form { margin-top: 15px; }
.jump-form > label { display: block; margin-bottom: 7px; color: var(--muted); font-size: 11px; }
.jump-form > div { display: grid; grid-template-columns: minmax(0, 1fr) 62px; }
.jump-form input { min-width: 0; height: 36px; padding: 0 10px; border: 1px solid var(--line); border-right: 0; background: #fff; color: var(--ink); outline: 0; }
.jump-form input:focus { border-color: var(--green); box-shadow: inset 0 0 0 1px var(--green); }
.jump-form button { border: 1px solid var(--green); background: var(--green); color: #fff; font-size: 11px; font-weight: 700; }
.jump-form button:hover { background: var(--green-dark); }
.resume-status { margin: 10px 0 0; color: #7c8881; font-size: 10px; line-height: 1.5; }
.stats-block { margin-top: 22px; border-top: 1px solid var(--line); }
.stat-row { min-height: 40px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 12px; }
.stat-row strong { color: var(--ink); font-size: 14px; }
.tip-box { margin-top: 34px; padding: 15px 14px; display: flex; gap: 10px; background: var(--orange-soft); color: #74452e; }
.tip-icon { color: var(--orange); font-size: 17px; line-height: 1.2; }
.tip-box p { margin: 0; font-size: 11px; line-height: 1.65; }
.tip-box b { color: #5e3927; }
.game-column { min-width: 0; }
.progress-line { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: 1.3px; }
.progress-line span:last-child { color: var(--green); letter-spacing: .3px; text-transform: none; }
.question-card { min-height: 430px; margin-top: 13px; padding: clamp(26px, 5vw, 53px); border: 1px solid var(--line); background: var(--card); box-shadow: var(--shadow); display: flex; flex-direction: column; }
.question-card-top { display: flex; align-items: center; justify-content: space-between; }
.type-badge { padding: 6px 10px; background: var(--green-soft); color: var(--green); font-size: 11px; font-weight: 800; letter-spacing: .4px; }
.icon-button { width: 34px; height: 34px; border: 1px solid var(--line); background: transparent; color: var(--green); font-size: 20px; line-height: 1; }
.icon-button:hover { border-color: var(--green); background: var(--green-soft); }
.question-card h2 { margin: clamp(28px, 4vw, 43px) 0 10px; max-width: 780px; font-size: clamp(25px, 3.7vw, 43px); line-height: 1.28; letter-spacing: 0; }
.question-note { margin: 0 0 26px; color: var(--muted); font-size: 13px; }
#answerArea { margin-top: auto; }
.options-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.options-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.option-button { min-height: 70px; padding: 15px 18px; border: 1px solid #cfd5ce; background: #f8f7f2; color: var(--ink); text-align: left; font-size: 15px; font-weight: 700; }
.option-index { display: block; margin-bottom: 5px; color: var(--orange); font-size: 10px; letter-spacing: 1px; }
.fill-wrap { display: flex; flex-direction: column; gap: 9px; }
.fill-input { width: 100%; min-height: 66px; padding: 0 18px; border: 1px solid #cfd5ce; background: #f8f7f2; color: var(--ink); font-size: 16px; outline: 0; }
.fill-input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(29, 107, 79, .12); }
.fill-hint { color: var(--muted); font-size: 11px; }
.suggestions { display: flex; flex-wrap: wrap; gap: 8px; }
.suggestion { padding: 7px 10px; border: 1px solid var(--line); background: #f2f1eb; color: #627068; font-size: 11px; }
.suggestion:hover { border-color: var(--green); color: var(--green); }
.game-actions { display: flex; justify-content: flex-end; gap: 11px; margin-top: 17px; }
.secondary-button, .primary-button { min-height: 43px; padding: 0 17px; border: 1px solid var(--line); font-size: 12px; font-weight: 700; }
.secondary-button { background: transparent; color: var(--muted); }
.secondary-button:hover { border-color: var(--green); color: var(--green); }
.primary-button { border-color: var(--green); background: var(--green); color: #fff; }
.primary-button:hover { background: var(--green-dark); }
.primary-button span { margin-left: 6px; font-size: 16px; vertical-align: -1px; }
.answer-reveal { margin-top: 13px; padding: 13px 16px; border-left: 3px solid var(--orange); background: var(--orange-soft); color: #754b37; }
.answer-reveal p { margin: 3px 0 0; font-size: 12px; line-height: 1.5; }
.reveal-label { color: var(--orange); font-size: 10px; font-weight: 800; letter-spacing: 1px; }
.footer { width: min(1220px, calc(100% - 40px)); margin: auto auto 0; padding: 18px 0 24px; border-top: 1px solid var(--line); display: flex; gap: 24px; color: #89938c; font-size: 11px; }
.csv-link { color: var(--green); text-decoration: none; font-weight: 700; }
.csv-link:hover { text-decoration: underline; }
@media (max-width: 780px) {
  .topbar { height: 68px; }
  .topbar-actions { gap: 10px; }
  .live-dot { display: none; }
  .intro-band { padding-top: 42px; padding-bottom: 44px; align-items: flex-start; }
  .score-stamp { flex-basis: 90px; width: 90px; height: 90px; }
  .score-stamp strong { font-size: 23px; }
  .score-stamp span { font-size: 9px; }
  .workspace { grid-template-columns: 1fr; gap: 28px; padding-top: 34px; }
  .control-panel { padding: 0; }
  .panel-heading h2 { margin-bottom: 17px; }
  .category-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .play-settings { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); column-gap: 24px; align-items: end; }
  .jump-form { margin-top: 0; }
  .resume-status { grid-column: 1 / -1; }
  .stats-block { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; border-top: 0; }
  .stat-row { display: block; min-height: 0; padding: 10px 0 0; border-bottom: 0; border-top: 1px solid var(--line); }
  .stat-row strong { display: block; margin-top: 5px; }
  .tip-box { margin-top: 17px; }
  .question-card { min-height: 400px; }
  .options-grid.three { grid-template-columns: 1fr; }
  .option-button { min-height: 62px; }
  .footer { flex-wrap: wrap; gap: 8px 18px; }
}
@media (max-width: 500px) {
  .intro-band { display: block; }
  .score-stamp { margin-top: 25px; }
  .workspace { width: min(100% - 28px, 600px); }
  .category-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .play-settings { display: block; }
  .jump-form { margin-top: 15px; }
  .question-card { padding: 23px 19px; }
  .game-actions { justify-content: stretch; }
  .secondary-button, .primary-button { flex: 1; padding: 0 10px; }
  .footer { width: calc(100% - 28px); }
}
