/* 全站視覺規則：紙張、海藍、橙黃；不依賴外部字型。 */
:root {
  --paper: #fff9ee;
  --ink: #173b56;
  --blue: #246f9e;
  --blue-dark: #18577f;
  --sky: #eaf3f8;
  --yellow: #f9bd45;
  --yellow-soft: #fff0cb;
  --mint: #dcefe5;
  --green: #226148;
  --coral: #f4c5b6;
  --red: #973d32;
  --line: #d4dfdf;
  --muted: #52697a;
  --radius: 22px;
  font-size: 16px;
}
* { box-sizing: border-box; }
body { margin: 0; padding: 24px; background: var(--paper); color: var(--ink); font-family: 'Noto Sans TC', 'PingFang TC', 'Microsoft JhengHei', sans-serif; line-height: 1.65; min-height: 100vh; min-height: 100dvh; }
h1, h2, h3, h4, p { margin-top: 0; }
h1, h2, h3 { text-wrap: balance; }
h1 { font-size: clamp(1.9rem, 4vw, 2.8rem); line-height: 1.3; letter-spacing: -.035em; }
h2 { font-size: clamp(1.35rem, 3vw, 1.8rem); line-height: 1.4; }
h3 { font-size: 1.2rem; }
p { margin-bottom: 16px; }
a { color: var(--blue-dark); }
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea, summary { -webkit-tap-highlight-color: transparent; }
button, summary { cursor: pointer; touch-action: manipulation; }
button, .btn, .control-btn, .card-button { min-width: 44px; min-height: 48px; padding: 11px 20px; border: 2px solid var(--line); border-radius: 12px; background: #fff; color: var(--ink); font-weight: 700; font-size: 1rem; line-height: 1.5; text-align: center; text-decoration: none; transition: background .15s, border-color .15s, transform .15s; }
button:active, .card-button:active { transform: translateY(2px); }
button:disabled { cursor: default; background: #edf0ef; color: #526574; }
.btn-primary, .control-btn, .card-button { background: var(--blue); color: #fff; border-color: var(--blue); }
.btn-secondary, .btn-info, .voice-test-btn { background: var(--sky); color: var(--blue-dark); border-color: #b5d1e2; }
:focus-visible { outline: 3px solid var(--blue-dark); outline-offset: 4px; }
input:not([type=radio]), select, textarea { max-width: 100%; min-width: 0; min-height: 48px; padding: 10px 14px; border: 2px solid #9eb8c7; border-radius: 12px; color: var(--ink); background: #fff; font-size: 1rem; }
textarea { width: 100%; resize: vertical; line-height: 1.75; }
input::placeholder, textarea::placeholder { color: #607280; opacity: 1; }
[hidden] { display: none !important; }
.container { max-width: 1060px; margin: 0 auto; }
.header { position: relative; padding: 0 0 26px; border-bottom: 2px solid var(--line); margin-bottom: 24px; }
.back-home-btn { display: inline-flex; gap: 8px; align-items: center; min-height: 48px; padding: 9px 0; text-decoration: none; font-size: .95rem; font-weight: 700; margin-bottom: 20px; }
.back-home-btn::before { content: '←'; font-size: 1.4rem; }
.header h1 { margin: 0 0 10px; }
.header h1 span { display: block; font-size: .55em; font-weight: 500; letter-spacing: 0; margin-top: 10px; }
.header p { color: var(--muted); margin: 0; font-size: 1.05rem; }
.module-label { display: flex; align-items: center; gap: 9px; margin: 0 0 12px; font-size: .875rem; color: var(--blue-dark); font-weight: 700; letter-spacing: .08em; }
.module-label::before { content: ''; display: block; width: 12px; height: 12px; border-radius: 3px; background: var(--yellow); transform: rotate(-10deg); }
.game-area, .setup-form, .confirm-card, .content-preview, .practice-main { background: #fffdf8; border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; }
.controls { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 12px; margin: 20px 0; }
.instruction { padding: 14px 18px; background: var(--sky); border-radius: 12px; color: var(--blue-dark); margin-bottom: 24px; }
.score-board { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 22px; }
.score { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: center; gap: 5px; padding: 12px; border-radius: 12px; font-size: 1.65rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.score-label, .score-unit { font-size: .9rem; font-weight: 600; }
.correct-score { background: var(--mint); color: var(--green); }
.wrong-score { background: #fbe8e1; color: var(--red); }
.total-score { background: var(--sky); color: var(--blue-dark); }
.feedback { font-size: 1.1rem; font-weight: 600; padding: 16px 20px; border-left: 4px solid var(--blue); border-radius: 12px; background: var(--sky); color: var(--blue-dark); overflow-wrap: anywhere; }
.feedback.correct { color: var(--green); background: var(--mint); border-color: var(--green); }
.feedback.wrong { color: var(--red); background: #fbe8e1; border-color: var(--red); }
.feedback.correct::before { content: '✓ 答對了　'; font-weight: 700; }
.feedback.wrong::before { content: '再試一次　'; font-weight: 700; }
.feedback.encouraging { background: var(--yellow-soft); color: #725015; border-color: #a66b14; }
.feedback:empty { display: none; }
.skip-link { position: absolute; top: 8px; left: 16px; z-index: 5; padding: 12px 18px; background: var(--ink); color: #fff; border-radius: 8px; transform: translateY(-150%); }
.skip-link:focus { transform: none; }
.steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); list-style: none; padding: 0; gap: 10px; margin: 0 0 24px; }
.steps li { display: flex; gap: 8px; align-items: center; padding: 12px 16px; background: #efece4; border-radius: 12px; color: var(--muted); font-size: .95rem; }
.steps span { display: grid; place-items: center; width: 28px; height: 28px; flex: 0 0 28px; border-radius: 50%; background: #fff; font-variant-numeric: tabular-nums; font-weight: 700; }
.steps [aria-current=step] { background: var(--yellow-soft); color: var(--ink); font-weight: 700; outline: 2px solid #b37a20; outline-offset: -2px; }
.steps [aria-current=step] span { background: var(--yellow); }
.floating-elements, .floating-numbers, .success-celebration, .celebration-area, .celebration { display: none; }
@media (hover: hover) {
  button:not(:disabled):hover { border-color: var(--blue); background: var(--sky); color: var(--blue-dark); }
  .btn-primary:not(:disabled):hover, .control-btn:not(:disabled):hover, .card-button:hover { background: var(--blue-dark); color: #fff; }
  .back-home-btn:hover { text-decoration: underline; text-underline-offset: 5px; }
}
@media (max-width: 600px) {
  body { padding: 16px 12px; }
  .header { padding-bottom: 20px; margin-bottom: 20px; }
  .back-home-btn { margin-bottom: 16px; }
  .game-area, .setup-form, .confirm-card, .content-preview, .practice-main { padding: 20px 16px; border-radius: 18px; }
  .score-board { gap: 6px; }
  .score { padding: 10px 5px; font-size: 1.45rem; }
  .score-label, .score-unit { font-size: .8rem; }
  button { padding: 10px 14px; }
  .steps { gap: 6px; }
  .steps li { padding: 10px 6px; flex-direction: column; gap: 5px; font-size: .85rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  button:active, .card-button:active, .option-btn, .answer-input { transform: none !important; }
}
