:root{--bg:#0f1a24;--panel:#1a2a3a;--text:#f0f6fc;--muted:#b6c7d8;--warn:#fbbf24;--good:#6ee7b7;--bad:#fca5a5;--touch:72px;--idiom-ch:clamp(1.8rem, min(7.6vw, 5.6dvh), 2.75rem)}
*{box-sizing:border-box;margin:0;padding:0;-webkit-tap-highlight-color:transparent}
body{min-height:100dvh;font-family:"PingFang TC","Noto Sans TC",system-ui,sans-serif;background:radial-gradient(ellipse at 70% 0%,#3b2a1a,transparent 50%),radial-gradient(ellipse at 20% 100%,#1a3d2e,transparent 45%),var(--bg);color:var(--text);padding:max(.5rem,env(safe-area-inset-top)) .7rem max(.5rem,env(safe-area-inset-bottom));user-select:none}
button{font:inherit;border:none;cursor:pointer;color:inherit;touch-action:manipulation}
button:active{transform:scale(.98)}
.app{max-width:560px;margin:0 auto;min-height:0;height:auto;flex:1;display:flex;flex-direction:column}
.screen{display:flex;flex-direction:column;gap:.55rem;flex:1;min-height:0}
.hidden{display:none!important}
h1{text-align:center;font-size:clamp(1.15rem,4vw,1.45rem);color:#fcd34d;font-weight:900;letter-spacing:.12em}
.gentle{text-align:center;color:var(--muted);font-weight:700;font-size:1.02rem}
.panel{background:var(--panel);border-radius:16px;padding:.9rem;border:1px solid rgba(251,191,36,.25)}
.label{color:var(--warn);font-weight:800;margin:.35rem 0}
.chips{display:flex;flex-wrap:wrap;gap:.4rem}
.chip,.chips button{min-height:var(--touch);padding:.55rem .9rem;border-radius:16px;background:rgba(0,0,0,.34);border:3px solid rgba(182,199,216,.4);font-weight:900;font-size:1.05rem}
.chip.active,.chips button.active{border-color:var(--warn);background:rgba(251,191,36,.28);color:#fde68a;box-shadow:0 0 0 3px rgba(251,191,36,.35)}
.cur{font-weight:800;margin:.4rem 0}.cur span{color:var(--warn)}
.btn-go{width:100%;min-height:76px;margin-top:.6rem;border-radius:16px;font-weight:900;font-size:1.22rem;background:linear-gradient(180deg,#fcd34d,#f59e0b);color:#451a03}
.btn{min-height:56px;border-radius:14px;font-weight:900;padding:0 .9rem;background:rgba(255,255,255,.12);flex:1;font-size:1.02rem}
.btn.ghost{background:rgba(0,0,0,.22)}
.bar{flex-shrink:0;display:flex;flex-wrap:wrap;gap:.5rem;justify-content:space-between;font-weight:800;background:var(--panel);padding:.55rem .7rem;border-radius:14px}
.bar b{color:var(--warn)}
#game.qcard,
#game .qcard{
  background:var(--panel);
  border-radius:18px;
  padding:1rem .9rem 1.1rem;
  border:1px solid rgba(251,191,36,.2);
  overflow:hidden;
  display:flex;
  flex-direction:column;
  min-height:0;
  flex:1;
}
.hint,.qtext,.feedback{flex-shrink:0}
.hint{text-align:center;color:var(--muted);font-weight:800;margin-bottom:.25rem}
.qtext,.ans{
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  width:100%;
  box-sizing:border-box;
  padding-left:1rem;
  padding-right:1rem;
  border:3px solid transparent;
  font-size:var(--idiom-ch);
  font-weight:900;
  line-height:1.15;
}
.qtext{
  margin:.15rem 0 .4rem;
  padding-top:.15rem;
  padding-bottom:.15rem;
  color:#fef3c7;
}
.answers{
  flex:1;
  min-height:0;
  display:flex;
  flex-direction:column;
  gap:.4rem;
  overflow:hidden;
}
.ans{
  flex:1 1 0;
  min-height:0;
  padding-top:0;
  padding-bottom:0;
  align-items:center;
  border-radius:18px;
  background:rgba(0,0,0,.34);
  border:4px solid rgba(255,255,255,.22);
  color:#f8fafc;
  box-shadow:0 3px 0 rgba(0,0,0,.25);
}
.qtext .slot,.ans .slot{
  text-align:center;
  font-size:inherit !important;
  font-weight:900;
  line-height:1.15;
  min-width:0;
}
.ans .slot.empty{visibility:hidden}
.qtext .slot.empty{visibility:visible}
.ans.correct{border-color:var(--good);background:rgba(110,231,183,.18);color:var(--good)}
.ans.wrong{border-color:var(--bad);background:rgba(252,165,165,.15);color:var(--bad)}
.ans:disabled{opacity:1}
.feedback{text-align:center;margin-top:.45rem;font-weight:800;min-height:1.5em;font-size:1.08rem;color:var(--muted)}
.feedback.ok{color:var(--good)}.feedback.no{color:var(--bad)}
.row{display:flex;gap:.4rem;flex-shrink:0}

/* Compact play chrome so 4 answers fit one iPad page */
#game .bar{
  padding:.35rem .6rem;
  gap:.35rem;
  font-size:.95rem;
}
#game .row{gap:.35rem}
#game .row .btn{min-height:52px}

/* Beat elder.css 72px buttons + overflow:auto qcard — this game only */
html.elder-mode #game .ans,
html.elder-mode #game button.ans{
  min-height:0 !important;
  font-size:var(--idiom-ch) !important;
}
body.fit-viewport #game .qcard{
  overflow:hidden !important;
  min-height:0 !important;
}
body.fit-viewport #game .answers{
  overflow:hidden;
}
body.fit-viewport #game .ans{
  min-height:0 !important;
}

@media (max-height:820px){
  #game .bar{
    padding:.28rem .5rem;
    font-size:.9rem;
  }
  #game .qcard{
    padding:.55rem .7rem .6rem;
  }
  #game .hint{
    margin-bottom:.1rem;
    font-size:.95rem;
  }
  #game .feedback{
    margin-top:.25rem;
    min-height:1.2em;
    font-size:1rem;
  }
  #game .answers{gap:.28rem}
  #game .row .btn{min-height:48px}
  html.elder-mode #game .row .btn{
    min-height:52px !important;
    font-size:1rem !important;
  }
}

.overlay{position:fixed;inset:0;background:rgba(5,12,20,.75);display:flex;align-items:center;justify-content:center;padding:1rem;z-index:20}
.card{background:var(--panel);border-radius:18px;padding:1.1rem;width:min(420px,100%);border:1px solid rgba(251,191,36,.3)}
.card h2{text-align:center;color:var(--warn);margin-bottom:.5rem}
.card p{text-align:center;font-weight:800;margin-bottom:.85rem;font-size:1.15rem}
#lb-table table{width:100%;border-collapse:collapse;font-size:.9rem}
#lb-table th,#lb-table td{padding:.4rem;border-bottom:1px solid rgba(255,255,255,.08);font-weight:700}
#lb-table tr.me td{color:var(--warn)}
html.elder-mode{--idiom-ch:clamp(1.95rem, min(8vw, 6dvh), 2.95rem)}
html.elder-mode .btn-go{min-height:84px;font-size:1.3rem}
html.elder-mode .ans{border-width:5px}
@media (prefers-reduced-motion:reduce){
  button:active{transform:none}
}
