:root{color-scheme:light;--ink:#385367;--muted:#748895;--blue:#548eb0;--green:#78a98a;--cream:#fffdf5;--line:#e0e9df;--gold:#ecbc60;--orange:#d9876c;font-family:'Segoe UI','Microsoft JhengHei',sans-serif;color:var(--ink);background:#eef5ec}
*{box-sizing:border-box}body{margin:0;background:radial-gradient(ellipse at top left,#fff8e7,transparent 65%),#eef5ec}button,a{-webkit-tap-highlight-color:transparent}button{font:inherit;cursor:pointer;touch-action:manipulation}button:disabled{cursor:default}button:focus-visible,a:focus-visible{outline:3px solid #e8b34b;outline-offset:3px}button{transition:background .16s,transform .16s,box-shadow .16s}button:active:not(:disabled){transform:translateY(2px)}[hidden]{display:none!important}a{color:inherit}.app{max-width:1160px;margin:auto;padding:0 24px}.appbar{height:76px;display:flex;align-items:center;justify-content:space-between;gap:12px}.brand{text-decoration:none;font-size:20px;font-weight:900;letter-spacing:2px}.brand span{color:#81a18a}.brand small{display:block;font-size:10px;font-weight:500;letter-spacing:1px;color:var(--muted);margin-top:3px}.button-icon{min-height:44px;border:1px solid #d8e3d6;background:#fffdf7;border-radius:14px;padding:8px 14px;color:var(--ink);font-size:13px;font-weight:600}.sound{background:#fffdf7b5}.eyebrow{font-size:11px;letter-spacing:1.4px;font-weight:700;color:#719486}.paper{background:var(--cream);border:1px solid #fff;border-radius:24px;box-shadow:0 10px 35px #37575a0c}h1,h2,p{margin:0}h1{font-size:clamp(38px,5vw,60px);line-height:1.2;letter-spacing:2px;margin:14px 0}h1 span{display:block;color:#779e7c}h2{font-size:23px;letter-spacing:.3px}.intro{font-size:17px;color:#6a818c;line-height:1.8}.menu{display:grid;grid-template-columns:1.2fr 1fr;gap:54px;align-items:center;padding:40px 0 42px}.welcome>.eyebrow{color:#ab8f60}.hero-art{position:relative;margin:26px 0 18px}.hero-art svg{display:block;width:100%;filter:drop-shadow(0 6px 0 #dee9d9)}.hero-badge{position:absolute;left:40%;top:18%;padding:10px 13px;background:#fffdf6ed;border:1px solid #fff;border-radius:14px;box-shadow:0 4px 10px #40685f0c;font-weight:700;color:#608498;transform:rotate(-4deg);font-size:18px}.hero-badge strong{color:#b58735}.hero-badge span{display:block;font-weight:500;font-size:10px;margin-top:4px}.howto{display:flex;justify-content:space-around;gap:8px;font-size:12px;color:#789080}.howto b{color:#d0ad64;font-size:11px;display:inline-block;margin-right:5px}.selection{padding:32px}.section-title{display:flex;justify-content:space-between;align-items:center;gap:6px}.section-title h2{font-size:21px;margin-top:6px}.muted{color:var(--muted);font-size:13px;margin:12px 0 22px;line-height:1.7}.text-button{border:0;background:#eef5eb;color:#5f8867;padding:10px 14px;border-radius:12px;font-size:13px;min-height:44px;white-space:nowrap}.tables{display:grid;grid-template-columns:repeat(3,1fr);gap:11px}.table-button{background:#f8f8f0;border:2px solid #e4e9dd;border-radius:15px;min-height:77px;position:relative;color:#849086;font-size:12px}.table-button strong{display:block;font-size:25px;margin-bottom:3px}.table-button .tick{position:absolute;right:7px;top:4px;font-size:11px;opacity:0}.table-button[aria-pressed=true]{background:#eaf4e7;border-color:#a5c69b;color:#54765a;box-shadow:0 3px 0 #dfeadb}.table-button[aria-pressed=true] .tick{opacity:1}.selection-note{min-height:22px;color:#8b9989;font-size:12px;margin:17px 0 12px}.primary{background:#e9bc65;color:#5e4b2b;border:1px solid #e0ae4d;box-shadow:0 4px 0 #d5a64f;border-radius:15px;min-height:52px;padding:12px 24px;font-weight:800}.primary:hover{background:#f0c774}.start-button{width:100%;display:flex;justify-content:space-between;align-items:center;font-size:17px}.menu-tip{text-align:center;color:#92a090;font-size:11px;margin-top:18px;line-height:1.6}.menu-tip+.menu-tip{margin-top:9px}kbd{font:inherit;padding:1px 4px;border:1px solid #dce5d8;border-radius:4px;background:white}.site-footer{text-align:center;font-size:10px;letter-spacing:1.4px;color:#98a898;padding:16px}.hud{padding:16px 20px;display:grid;grid-template-columns:1.15fr 1fr auto auto;gap:24px;align-items:center;margin-bottom:16px}.level-heading{display:flex;align-items:center;gap:13px}.level-icon{display:grid;place-items:center;background:#f5e9c8;border-radius:14px;width:44px;height:44px;color:#b89142;font-size:24px}.level-heading h2{font-size:19px;margin-top:3px}.health{font-size:12px}.health>span{display:flex;justify-content:space-between;gap:10px}.health b{color:#698c72}.health-track{height:9px;border-radius:8px;background:#e9eddf;margin-top:8px;overflow:hidden}#health-fill{width:100%;height:100%;background:#8cbc8b;border-radius:8px;transition:width .2s}.wave{display:flex;flex-direction:column;gap:4px;font-size:11px;color:#8a9889}.wave b{font-size:17px;color:var(--ink)}.play-layout{display:grid;grid-template-columns:minmax(0,1fr) 320px;gap:18px}.field-panel{display:flex;flex-direction:column;overflow:hidden;min-height:0}.field-labels,.field-footer{display:flex;justify-content:space-between;align-items:center;gap:8px;padding:12px 16px;font-size:11px;color:#789184}.ally-label{color:#5589af}.enemy-label{color:#c78471}.field-labels b{margin-left:4px;font-size:14px}.canvas-wrap{position:relative;flex:1;min-height:0;background:#ddecce;border-top:1px solid #dbe7ce;border-bottom:1px solid #dbe7ce;display:grid;place-items:center;overflow:hidden}canvas{position:absolute;inset:0;width:100%;height:100%;object-fit:contain;display:block;touch-action:none;max-height:none}.field-footer{font-size:10px;background:#f9faf1}.question-panel{padding:25px 20px;display:flex;flex-direction:column;align-self:stretch}.question-heading{display:flex;justify-content:space-between;align-items:center;gap:5px}.question-heading>span:last-child{font-size:10px;color:#8a9b8e}.question{text-align:center;font-size:36px;line-height:1.4;letter-spacing:2px;margin:28px 0 6px;font-weight:900}.feedback{text-align:center;min-height:48px;line-height:1.6;font-size:12px;color:#879688;padding:4px 0}.feedback.good{color:#507d57}.feedback.wrong{color:#a98067}.answers{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;margin-top:10px}.answer{position:relative;border:2px solid #d7e4dd;border-radius:16px;min-height:88px;background:#fff;color:#496a7f;box-shadow:0 4px 0 #e3eae0;font-size:30px;font-weight:800}.answer kbd{position:absolute;top:6px;left:7px;font-size:10px;font-weight:400;color:#9fafa5;border:0;background:#f1f5ef}.answer:hover:not(:disabled){background:#f2f8ef;border-color:#abc99f}.answer.correct{background:#e1f1d9;color:#4b7e4d;border-color:#91b880;box-shadow:0 4px 0 #c5dcb6}.answer.wrong{background:#e8e9e3;color:#a1a69b;border-color:#d4d8cd;box-shadow:none}.answer:disabled:not(.wrong):not(.correct){opacity:.7}.hint-button{align-self:center;margin-top:12px}.question-footer{display:flex;justify-content:space-between;padding-top:22px;font-size:11px;color:#859486}.question-footer b{color:#68866d}.encouragement{display:flex;align-items:center;justify-content:center;gap:14px;color:#91a88d;border-top:1px dashed #dce7d6;margin-top:auto;padding-top:24px;font-size:11px;line-height:1.8}.encouragement>span{font-size:32px;color:#d9c382}.countdown{position:absolute;inset:0;background:#eef6e266;backdrop-filter:blur(2px);display:flex;flex-direction:column;align-items:center;justify-content:center;color:#557366}.countdown>span{font-size:14px;letter-spacing:4px}.countdown strong{font-size:90px;line-height:1.4;color:#527f82;text-shadow:0 3px 0 #fff}.countdown p{font-size:12px}.formation{position:absolute;bottom:14%;left:50%;transform:translateX(-50%);background:#fff9e7ed;border:1px solid #eed7a9;color:#87713d;font-size:12px;padding:7px 13px;border-radius:12px;white-space:nowrap;pointer-events:none}.dialog-backdrop{position:fixed;inset:0;z-index:10;display:flex;align-items:center;justify-content:center;background:#53746566;backdrop-filter:blur(6px);padding:20px}.dialog{width:490px;max-width:100%;max-height:calc(100dvh - 40px);overflow:auto;padding:32px;text-align:center;border:3px solid #fff;outline:none}.dialog-art{font-size:43px;letter-spacing:9px;margin-bottom:12px;color:#ddba62}.dialog h2{font-size:27px;margin:10px 0}.dialog>p{color:#849184;font-size:13px;line-height:1.8}.dialog-actions{display:flex;flex-wrap:wrap;gap:10px;justify-content:center;margin-top:24px}.dialog-actions button{flex:1;min-width:120px;min-height:48px}.secondary{border:1px solid #d3e1ce;background:#edf4e8;border-radius:13px;color:#6d8769;padding:10px 16px}.stats-grid{display:grid;grid-template-columns:1fr 1fr;gap:12px;text-align:left;margin-top:20px}.stat{background:#f2f5eb;border-radius:13px;padding:12px 15px;color:#899585;font-size:11px}.stat strong{display:block;font-size:24px;color:#5c7b6a;margin-top:5px}.hint-groups{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;margin:18px 0}.hint-group{padding:8px;background:#edf5e8;border:1px solid #d4e4ce;border-radius:12px;color:#6a946c;font-size:13px;line-height:1.7}.hint-group small{display:block;font-size:10px;color:#91a389}.addition{font-size:21px;line-height:1.8;word-break:break-word;color:#608291}.totals-title{font-size:12px;color:#91a080;margin-top:14px}
body.playing{overflow:hidden;overscroll-behavior:none}body.playing .app{height:100dvh;display:flex;flex-direction:column}body.playing .appbar{flex-shrink:0;height:62px}body.playing .game{flex:1;min-height:0;display:flex;flex-direction:column}body.playing .play-layout{flex:1;min-height:0}body.playing .site-footer{padding:8px;flex-shrink:0}
@media(max-width:800px){.app{padding:0 14px}.appbar{height:62px}.menu{grid-template-columns:1fr;gap:26px;max-width:520px;margin:auto;padding:20px 0}.welcome{text-align:center}h1 span{display:inline;margin-left:5px}h1{font-size:38px}.hero-art{max-width:400px;margin:20px auto}.selection{padding:24px}.hud{gap:10px;padding:10px 12px;margin-bottom:10px;grid-template-columns:1fr 1fr auto}.level-heading{gap:8px}.level-icon{display:none}.level-heading h2{font-size:15px}.hud .eyebrow{font-size:9px}.wave{grid-column:2;grid-row:2;flex-direction:row;justify-content:space-between;align-items:center}.wave b{font-size:12px}.health{grid-column:2;grid-row:1;font-size:10px}.hud #pause{grid-column:3;grid-row:1/3;padding:6px 10px}.play-layout{grid-template-columns:1fr;grid-template-rows:minmax(0,1fr) auto;gap:10px}.question-panel{padding:10px 14px;border-radius:20px}.question{font-size:28px;margin:4px 0 0;line-height:1.3}.feedback{min-height:26px;font-size:11px;padding:2px 0}.answers{gap:8px;margin:4px 0 0}.answer{min-height:52px;font-size:25px;border-radius:12px}.question-heading .eyebrow{font-size:9px}.question-footer{padding-top:10px;font-size:10px}.encouragement{display:none}.field-panel{border-radius:20px}.field-labels,.field-footer{padding:6px 11px;font-size:9px}.field-labels b{font-size:12px}.field-footer{padding:4px 10px}canvas{max-height:none}.hint-button{position:static;align-self:center;padding:4px 12px;font-size:11px;min-height:44px;margin:8px 0 0;background:#f6ebce}.question-panel{position:relative}.countdown strong{font-size:65px}.countdown p{font-size:10px}.dialog{padding:24px 18px}.dialog h2{font-size:24px}.site-footer{font-size:9px}.formation{font-size:10px}.health-track{height:7px;margin-top:4px}body.playing .appbar{height:48px}.brand{font-size:15px}.brand small{display:none}.sound{font-size:11px;padding:5px 10px}.question-heading>span:last-child{font-size:9px}.field-labels #wave-info{font-size:8px}}
@media(max-width:800px) and (max-height:650px){body.playing .site-footer{display:none}.question-footer{display:none}.question-panel{padding:6px 12px}.answer{min-height:46px}.question{font-size:24px}.hud{padding:7px 10px;margin-bottom:6px}.play-layout{gap:6px}.field-footer{display:none}.app{padding:0 8px}}
@media(max-height:520px) and (min-width:600px){body.playing .appbar{height:44px}.hud{grid-template-columns:1fr 1fr auto auto;gap:12px;padding:7px 14px;margin-bottom:8px}.hud .wave{grid-column:auto;grid-row:auto}.hud .health{grid-column:auto;grid-row:auto}.hud #pause{grid-column:auto;grid-row:auto}.play-layout{grid-template-columns:minmax(0,1fr) 290px;grid-template-rows:minmax(0,1fr)}.question-panel{padding:8px 12px}.question{font-size:25px;margin:2px 0}.answer{min-height:46px;font-size:23px}.feedback{min-height:25px}.question-footer{padding-top:8px}.encouragement,.site-footer{display:none}.hint-button{margin-top:6px}.field-footer{display:none}}
@media(prefers-reduced-motion:reduce){button,#health-fill{transition:none}}

/* A single compact status bar gives the battlefield the recovered header space. */
body.playing .appbar,
body.playing .site-footer { display:none; }
body.playing .app { padding-top:max(6px,env(safe-area-inset-top)); padding-bottom:env(safe-area-inset-bottom); }
body.playing .hud { flex-shrink:0; grid-template-columns:minmax(0,1fr) auto auto 44px 44px; gap:12px; padding:6px 12px; margin-bottom:8px; border-radius:17px; }
body.playing .level-icon { display:none; }
body.playing .level-heading { min-width:0; gap:0; }
body.playing .level-heading h2 { font-size:14px; margin-top:2px; white-space:nowrap; }
body.playing .level-heading .eyebrow { font-size:10px; letter-spacing:0; }
body.playing .health { grid-column:auto; grid-row:auto; min-width:64px; font-size:11px; }
body.playing .health>span { gap:6px; }
body.playing .health-track { height:5px; margin-top:5px; }
body.playing .wave { grid-column:auto; grid-row:auto; flex-direction:column; gap:2px; font-size:9px; }
body.playing .wave b { font-size:12px; }
body.playing .hud #pause { grid-column:auto; grid-row:auto; }
body.playing .hud .button-icon { width:44px; height:44px; min-height:44px; padding:0; border-radius:12px; font-size:18px; }
body.playing #pause span { display:none; }
@media(max-width:800px) {
  body.playing .hud { gap:6px; padding:4px 8px; margin-bottom:6px; }
  body.playing .level-heading h2 { font-size:12px; }
  body.playing .level-heading .eyebrow { font-size:9px; }
  body.playing .health { min-width:58px; font-size:10px; }
  body.playing .wave { font-size:8px; }
  body.playing .wave b { font-size:11px; }
}

@media(max-width:600px) and (orientation:portrait) {
  body.playing canvas { object-fit:fill; }
}
