@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Noto+Sans+TC:wght@500;700;900&display=swap');
:root{color-scheme:dark;font-family:'DM Sans','Noto Sans TC',sans-serif;color:#f8f0de;background:#102c2b}*{box-sizing:border-box}body{margin:0;background:radial-gradient(ellipse at 20% 40%,#20504a 0,transparent 65%),#102c2b}button,a{-webkit-tap-highlight-color:transparent}button{font:inherit;color:inherit;cursor:pointer;border:1px solid #ffffff30;border-radius:12px;padding:12px;background:#ffffff08;min-height:44px}button:hover{background:#ffffff18}button:disabled{opacity:.4;cursor:default}button:focus-visible,a:focus-visible{outline:3px solid #ffd57c;outline-offset:3px}header{max-width:1180px;margin:auto;padding:22px 24px;display:flex;align-items:center;gap:20px}header a{color:#f8f0de;font-weight:800;letter-spacing:2px;text-decoration:none;font-size:13px}header a span{display:block;color:#f0b25e;font-size:10px;margin-top:3px}.preview{font-size:10px;color:#a7bcb6;letter-spacing:1.5px}header button{margin-left:auto}main{max-width:1120px;margin:auto;padding:0 24px}.intro{margin:18px 0 25px}.eyebrow{font-size:10px;letter-spacing:2px;color:#eac486;font-weight:700}h1{font-size:37px;letter-spacing:2px;margin:9px 0}h1 span{font-size:20px;letter-spacing:-.5px;margin-left:20px;font-weight:500}.intro p{margin:0;color:#b4c9c2;font-size:14px}.arcade{display:grid;grid-template-columns:minmax(0,1.65fr) minmax(270px,1fr);gap:32px;align-items:start}.cabinet{border:8px solid #e8b883;border-radius:23px;background:#cb6658;box-shadow:0 22px 60px #0006;overflow:hidden}.marquee{display:flex;justify-content:space-between;align-items:center;padding:12px 22px;color:#fff2ce;background:linear-gradient(110deg,#bd4f4a,#e77d64);font-weight:900;font-size:26px;border-bottom:5px solid #713f37}.marquee small{display:block;font-size:9px;letter-spacing:2px;font-weight:600;margin-top:3px}.marquee>div{font-size:17px;text-align:right}#viewport{height:390px;position:relative;background:#153337;touch-action:none}canvas{width:100%;height:100%;display:block}.loader{position:absolute;inset:40% 0;text-align:center}.cabinet-bottom{display:flex;justify-content:space-between;padding:14px 18px;background:#873c3a;font-size:10px;letter-spacing:1px}aside{display:grid;gap:15px}.guarantee{border:1px solid #9ac7b533;padding:18px;border-radius:16px;background:#ffffff05}.guarantee>div{display:flex;justify-content:space-between;align-items:center}.guarantee strong{font-size:20px}.guarantee strong span{font-size:11px;color:#adc7bf}.guarantee b{font-size:15px;color:#ffcf80}progress{appearance:none;width:100%;height:9px;border:0;border-radius:8px;margin:14px 0 3px;overflow:hidden}progress::-webkit-progress-bar{background:#ffffff14}progress::-webkit-progress-value{background:#f2b563;border-radius:8px}.guarantee p{color:#bed0c8;font-size:13px;line-height:1.6;margin:8px 0 0}.wallet>span{font-size:11px;color:#a7c2b8}.wallet strong{display:block;font-size:18px;margin:6px 0 10px}.wallet small{font-size:11px;color:#afc6bd;margin-left:12px}.wallet button{font-size:12px;width:100%}.primary{background:#f3bd75;color:#183c34;border:0;font-weight:800}.primary:hover{background:#ffcf91}#start{width:100%;font-size:16px}.dpad{display:grid;grid-template-columns:1fr 1.35fr 1fr;gap:7px;margin-top:12px;touch-action:none;user-select:none}.dpad button:first-child{grid-column:2}.dpad button:nth-child(2){grid-row:2;grid-column:1}.dpad #drop{grid-row:2;grid-column:2}.dpad button:nth-child(4){grid-row:2;grid-column:3}.dpad button:last-child{grid-row:3;grid-column:2}.dpad button{padding:8px;font-size:21px}#drop small{display:block;font-size:9px;letter-spacing:2px}.controls p{font-size:10px;color:#96b5ac;line-height:1.8;text-align:center;margin:9px 0 0}#status{font-size:13px;line-height:1.6;color:#ffdaa2;min-height:42px}#sound{justify-self:start;font-size:11px;padding:6px 12px}footer{padding:24px 0 32px;font-size:11px;line-height:1.8;color:#92afa7}footer span{display:block}dialog{background:#f5edda;color:#23433b;border:0;border-radius:22px;padding:28px;width:min(580px,92vw);max-height:85vh;overflow:auto}dialog::backdrop{background:#041c21bb;backdrop-filter:blur(5px)}dialog .eyebrow{color:#997039}dialog button{color:#23433b;border-color:#23433b30;float:right}dialog h2{clear:both;padding-top:20px}#prizes{display:grid;grid-template-columns:repeat(3,1fr);gap:10px}.prize{background:#fff9ed;padding:16px 8px;border-radius:12px;text-align:center;font-size:12px}.prize i{font-style:normal;font-size:38px;display:block;margin-bottom:10px}#words{font-size:13px;line-height:2}dialog p{font-size:11px;color:#61776c}@media(max-width:680px){header{padding:14px 16px;gap:10px}main{padding:0 14px}.intro{margin:8px 0 16px}h1{font-size:25px}h1 span{font-size:15px;margin-left:10px}.intro p{font-size:12px}.arcade{grid-template-columns:1fr;gap:18px}#viewport{height:310px}.marquee{padding:9px 16px}.guarantee{padding:12px}.controls{order:-1}.dpad{grid-template-columns:1fr 1.3fr 1fr;max-width:350px;margin:10px auto}.wallet{padding:0 4px}aside{gap:12px}.preview{font-size:8px}.cabinet-bottom{padding:10px}.controls p{font-size:11px}}@media(prefers-reduced-motion:reduce){*{scroll-behavior:auto}}

#chinese-choices{display:grid;gap:10px}#chinese-choices button{font-size:22px;color:#173638;background:#fff4dc}#chinese-feedback{min-height:2em;color:#7b4025}
#chinese button{float:none}#chinese #listen{display:block;margin:0 0 16px}#chinese #listen[hidden]{display:none}#chinese-cancel{display:block;margin-left:auto}

#chinese{position:relative}#show-pinyin{font-size:12px;padding:5px 10px;min-height:32px;margin-bottom:6px}#question-pinyin{font-size:17px;color:#315d50;margin:4px 0 14px}#correct-screen{position:absolute;inset:0;z-index:2;background:#edf5df;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:14px;color:#265d42;border-radius:22px}#correct-screen[hidden]{display:none}#correct-screen strong{font-size:36px}#correct-screen span{font-size:25px}

.touch-help{display:none}#chinese-choices button{min-height:52px;line-height:1.4}#chinese{overscroll-behavior:contain}#question-pinyin{overflow-wrap:anywhere}
@media(pointer:coarse),(max-width:680px){.desktop-help{display:none}.touch-help{display:block}.dpad button{min-height:52px;touch-action:none}#viewport{height:clamp(240px,36svh,360px)}dialog{padding:22px;max-height:90svh}#chinese h2{padding-top:8px;font-size:25px}#chinese-context{font-size:14px;line-height:1.5}#chinese-feedback{font-size:14px}#show-pinyin{min-height:44px}#chinese-cancel{min-height:44px}}
/* Compact play surface: keep the machine, wallet and drop controls together. */
@media(max-width:680px){
 header{padding:8px 12px;height:52px}header button{padding:5px 10px}.intro{margin:0 0 8px}h1{font-size:20px;margin:3px 0}.intro p{font-size:11px}main{padding:0 10px}.arcade{gap:8px}.cabinet{border-width:5px;border-radius:16px}.marquee{padding:5px 12px;font-size:20px}.marquee small{font-size:8px}.cabinet-bottom{padding:6px 10px}#viewport{height:clamp(180px,34svh,280px)}
 aside{grid-template-columns:1fr 1fr;gap:6px}.guarantee{padding:7px;grid-column:1}.guarantee strong{font-size:16px}.guarantee p{display:none}progress{margin:7px 0 0}.wallet{grid-column:2;grid-row:1}.wallet>span{display:none}.wallet strong{font-size:13px;margin:0 0 3px}.wallet small{font-size:9px;margin-left:3px}.wallet button{font-size:10px;padding:4px;min-height:36px}.controls{grid-column:1/-1;order:initial;display:grid;grid-template-columns:1fr 2fr;gap:6px;align-items:center}.controls p{grid-column:1/-1;margin:0;font-size:10px;line-height:1.3}#start{font-size:12px;padding:8px}.dpad{display:flex;flex-wrap:wrap;gap:4px;margin:0;max-width:none}.dpad button{min-height:44px;padding:3px;flex:1;font-size:19px}.dpad #drop{flex:1.5}#drop small{font-size:8px}#status{grid-column:1/-1;min-height:0;font-size:12px;line-height:1.35}#sound{padding:3px 9px;min-height:32px}footer{padding:12px 0;font-size:10px}
}
@media(max-height:500px) and (orientation:landscape){
 header{height:40px;padding:3px 14px}header button{min-height:32px;padding:3px 10px}.intro{display:none}.arcade{grid-template-columns:minmax(0,1.4fr) minmax(250px,1fr);gap:12px}#viewport{height:calc(100svh - 125px)}.marquee{padding:4px 12px;font-size:18px}.cabinet-bottom{padding:5px 10px}aside{display:grid;grid-template-columns:1fr 1fr;gap:5px}.guarantee{padding:6px}.guarantee p,.wallet>span{display:none}.wallet strong{font-size:12px;margin:0}.wallet small{font-size:9px;margin-left:3px}.wallet button{font-size:10px;padding:3px;min-height:34px}.controls{grid-column:1/-1;order:initial}.dpad{display:flex;margin:5px 0;gap:4px}.dpad button{flex:1;min-height:44px;padding:4px}.controls p{margin:0;font-size:9px}#start{font-size:13px;padding:6px}#status{grid-column:1/-1;font-size:11px;min-height:0;line-height:1.3}#sound{min-height:30px;padding:3px 8px}progress{margin:5px 0}.guarantee strong{font-size:15px}footer{padding:8px 0}
}

#world-link{grid-column:1/-1;color:#ffcf80;font-size:13px;padding:8px 0}#world-link[hidden]{display:none}

/* Direction pad remains spatial on touch screens. */
@media(max-width:680px),(max-height:500px) and (orientation:landscape){
 .controls{display:grid;grid-template-columns:minmax(85px,1fr) minmax(180px,2fr);align-items:center;gap:6px}
 .dpad{display:grid;grid-template-columns:1fr 1.3fr 1fr;grid-template-rows:44px 44px 44px;gap:3px;margin:0;width:100%}
 .dpad button{min-height:44px;padding:3px}.dpad button:first-child{grid-column:2;grid-row:1}.dpad button:nth-child(2){grid-column:1;grid-row:2}.dpad #drop{grid-column:2;grid-row:2}.dpad button:nth-child(4){grid-column:3;grid-row:2}.dpad button:last-child{grid-column:2;grid-row:3}
 .controls p{grid-column:1/-1}#viewport{height:clamp(155px,27svh,260px)}
}
@media(max-height:500px) and (orientation:landscape){#viewport{height:calc(100svh - 125px)}.controls{gap:3px}.dpad{grid-template-rows:40px 44px 40px}.dpad button{min-height:40px}}

#sound{min-height:48px;min-width:130px;touch-action:manipulation;position:relative;z-index:2;padding:10px 16px}
.qq-result{position:absolute;left:50%;top:38%;transform:translate(-50%,-50%);background:#173638ed;color:#ffdfb4;border:2px solid #e8b883;border-radius:22px;padding:12px 30px;font-weight:900;font-size:48px;pointer-events:none;box-shadow:0 6px 24px #0005}

/* Phone-first cabinet: prioritize the play area over headings and framing. */
@media(max-width:680px) and (orientation:portrait){
 header{height:44px;padding:4px 10px}header a{font-size:10px}header a span{font-size:8px}.preview{font-size:7px}header button{min-height:36px;padding:4px 9px}
 main{padding:0 5px}.intro{margin:2px 5px 7px}h1{font-size:17px;letter-spacing:0;margin:0}h1 span{font-size:12px;margin-left:7px}.intro p{display:none}
 .cabinet{border-width:3px;border-radius:13px}.marquee{font-size:18px;padding:5px 10px;border-bottom-width:3px}.marquee>div{font-size:14px}.marquee small{font-size:7px;letter-spacing:1px}
 #viewport{height:clamp(290px,46svh,440px)}.cabinet-bottom{padding:5px 9px;font-size:9px}.arcade{gap:7px}
 aside{padding:0 5px}.controls{grid-template-columns:minmax(95px,1fr) minmax(180px,1.6fr)}.controls p{font-size:9px}#status{font-size:11px}
}

.qq-result{white-space:nowrap;width:max-content;max-width:calc(100% - 20px);font-size:clamp(32px,10vw,48px);padding:12px 22px}

html,body{overflow-y:auto}#viewport{touch-action:pan-y}.dpad{touch-action:pan-y}.dpad button:disabled{touch-action:pan-y}

/* Separate secondary information from the active play controls. */
@media(max-width:680px),(max-height:500px) and (orientation:landscape){#status{margin-top:28px}.controls p{margin-bottom:0}}
