*{box-sizing:border-box;-webkit-tap-highlight-color:transparent}
html,body{margin:0;height:100%;overflow:hidden;background:#0d1b26;color:#eef4f7;
  font-family:-apple-system,BlinkMacSystemFont,"PingFang SC","Microsoft YaHei",sans-serif;user-select:none;-webkit-user-select:none}
canvas#world{position:fixed;inset:0;width:100vw;height:100vh;display:block;touch-action:none}
button{font:inherit;color:inherit;cursor:pointer;border:0;border-radius:12px;min-height:44px;min-width:44px;
  transition:transform .08s ease, filter .08s ease}
button:active{transform:scale(.94);filter:brightness(1.15)}
button:disabled{opacity:.45;cursor:default}
.hidden{display:none!important}

#hud{position:fixed;top:0;left:0;right:0;display:flex;justify-content:space-between;align-items:flex-start;padding:10px;gap:8px;pointer-events:none}
#goal{pointer-events:auto;background:rgba(10,25,36,.82);border:1px solid #2f5f73;border-radius:12px;padding:8px 12px;max-width:68vw;font-size:15px;line-height:1.4}
#goal .tag{background:#f39c3d;color:#1b1206;border-radius:6px;padding:1px 6px;margin-right:6px;font-weight:700;font-size:12px}
.hud-btns{display:flex;gap:6px;align-items:center;pointer-events:auto}
.hud-btns button{background:rgba(10,25,36,.82);border:1px solid #2f5f73;font-size:20px}
#saveState{font-size:12px;color:#8fd3b6;background:rgba(10,25,36,.7);padding:4px 8px;border-radius:8px}
#demoBadge{position:fixed;left:10px;bottom:6px;font-size:11px;color:#8aa5b3;pointer-events:none}

#joy{position:fixed;left:24px;bottom:28px;width:130px;height:130px;border-radius:50%;background:rgba(255,255,255,.08);border:2px solid rgba(255,255,255,.25);display:none;touch-action:none}
#joyKnob{position:absolute;left:40px;top:40px;width:50px;height:50px;border-radius:50%;background:rgba(243,156,61,.85);box-shadow:0 2px 8px rgba(0,0,0,.4)}
body.touch #joy{display:block}
#act{position:fixed;right:24px;bottom:36px;width:96px;height:96px;border-radius:50%;background:#f39c3d;color:#1b1206;font-weight:800;font-size:18px;box-shadow:0 0 0 6px rgba(243,156,61,.25);animation:pulse 1.4s infinite}
@keyframes pulse{50%{box-shadow:0 0 0 12px rgba(243,156,61,.08)}}

#panelWrap{position:fixed;inset:0;background:rgba(4,10,16,.55);display:flex;align-items:center;justify-content:center;padding:12px;z-index:10}
#panel{background:#13293a;border:1px solid #2f5f73;border-radius:18px;width:min(640px,100%);max-height:94vh;overflow:auto;padding:18px;box-shadow:0 10px 40px rgba(0,0,0,.5)}
#panel h2{margin:0 0 8px;font-size:20px}
#panel p{line-height:1.6;margin:8px 0}
.row{display:flex;gap:8px;flex-wrap:wrap;align-items:center;margin-top:12px}
.btn{background:#24506a;padding:10px 16px}
.btn.primary{background:#f39c3d;color:#1b1206;font-weight:700}
.btn.ghost{background:transparent;border:1px solid #3d6f85}
.small{font-size:12px;color:#8aa5b3}
.speaker{display:flex;align-items:center;gap:10px;background:#0f2230;border-radius:12px;padding:10px 12px;margin:8px 0}
.speaker .who{font-weight:700;color:#f3c37a;white-space:nowrap}
.en{font-size:20px;font-weight:600;letter-spacing:.3px}
.zh{color:#9fc0cf;font-size:14px}

.wordcard{text-align:center;background:#0f2230;border-radius:16px;padding:16px}
.wordcard .pic{font-size:64px}
.wordcard .word{font-size:44px;font-weight:800;letter-spacing:2px}
.videoph{width:100%;aspect-ratio:16/9;max-height:180px;background:linear-gradient(135deg,#1e3d52,#0f2230);border-radius:12px;display:flex;align-items:center;justify-content:center;flex-direction:column;color:#9fc0cf;font-size:13px;margin-bottom:10px}
.videoph .face{font-size:46px}

.slots{display:flex;gap:8px;justify-content:center;margin:12px 0}
.slot{width:48px;height:56px;border-radius:10px;background:#0b1a24;border:2px dashed #3d6f85;display:flex;align-items:center;justify-content:center;font-size:26px;font-weight:800}
.slot.bad{border-color:#ff7a7a;border-style:solid}
.slot.good{border-color:#5fd39a;border-style:solid}
.tiles{display:flex;gap:8px;justify-content:center;flex-wrap:wrap}
.tile{width:52px;height:56px;background:#2d6a87;font-size:24px;font-weight:800;border-radius:10px}
.tile.used{opacity:.3}

.feedback{border-radius:12px;padding:10px 12px;margin-top:10px;font-weight:600}
.feedback.ok{background:#173d2c;border:1px solid #5fd39a}
.feedback.no{background:#3d2121;border:1px solid #ff9a7a}
.feedback.info{background:#1c3546;border:1px solid #3d6f85}

/* in/on 特写 */
.closeup{position:relative;height:230px;background:radial-gradient(ellipse at 50% 80%,#2a4a5c,#13293a 70%);border-radius:14px;margin:10px 0;overflow:hidden;touch-action:none}
.boxbody{position:absolute;left:50%;top:110px;width:170px;height:96px;transform:translateX(-50%);background:#b07a3c;border-radius:6px;border:3px solid #6e4a22}
.boxlid{position:absolute;left:50%;top:92px;width:182px;height:22px;transform:translateX(-50%);background:#c98d4a;border-radius:5px;border:3px solid #6e4a22}
.dropzone{position:absolute;border:3px dashed rgba(255,255,255,.5);border-radius:12px;display:flex;align-items:flex-end;justify-content:center;font-size:12px;color:#dfeaf0;padding-bottom:2px}
.dropzone.hover{border-color:#f3c37a;background:rgba(243,195,122,.15)}
.dropzone.armed{animation:armed 1s infinite}
@keyframes armed{50%{border-color:#f3c37a}}
#zIn{left:calc(50% - 70px);top:125px;width:140px;height:72px}
#zOn{left:calc(50% - 70px);top:28px;width:140px;height:60px}
#zBeside{left:calc(50% + 105px);top:120px;width:90px;height:86px}
.item{position:absolute;font-size:40px;width:56px;height:56px;display:flex;align-items:center;justify-content:center;border-radius:12px;cursor:grab;touch-action:none;z-index:3;transition:left .18s,top .18s,transform .1s}
.item.lift{transform:translateY(-8px) scale(1.12);filter:drop-shadow(0 8px 6px rgba(0,0,0,.5));transition:none}
.item.sel{outline:3px solid #f3c37a}
.rulecard{background:#2a2410;border:1px solid #8a7330;border-radius:12px;padding:10px 12px;font-size:14px}

/* 战斗 */
.arena{position:relative;height:200px;background:linear-gradient(#1b3445,#0f2230);border-radius:14px;overflow:hidden;margin:8px 0}
.fighter{position:absolute;bottom:26px;font-size:64px;transition:transform .2s}
#hero{left:14%}
#foe{right:14%}
.hp{position:absolute;top:10px;right:12px;font-size:18px}
.intent{position:absolute;top:12px;left:50%;transform:translateX(-50%);background:#40204a;border:1px solid #c07ad6;border-radius:12px;padding:6px 10px;white-space:nowrap;font-weight:700}
.dmg{position:absolute;font-weight:900;font-size:30px;color:#ffd36b;text-shadow:0 2px 0 #000;animation:float 0.9s forwards;pointer-events:none}
.dmg.crit{font-size:42px;color:#ff8a3d}
@keyframes float{to{transform:translateY(-50px);opacity:0}}
.dodge{transform:translateX(60px)}
.lunge{transform:translateX(120px)}
.hurt{animation:hurt .3s}
@keyframes hurt{25%{transform:translateX(10px)}75%{transform:translateX(-10px)}}
.cards{display:grid;grid-template-columns:repeat(3,1fr);gap:8px}
.card{background:#2b4f68;padding:10px 6px;border-radius:12px;min-height:72px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px}
.card .k{font-size:11px;color:#9fc0cf}
.card b{font-size:16px}
body.shake #world,body.shake #panel{animation:shake .25s}
@keyframes shake{25%{transform:translate(4px,-3px)}50%{transform:translate(-4px,3px)}75%{transform:translate(3px,2px)}}

.choices{display:grid;grid-template-columns:repeat(auto-fit,minmax(140px,1fr));gap:8px;margin-top:8px}
.choice{background:#24506a;padding:12px;border-radius:12px;font-size:16px}
.choice .pic{font-size:34px;display:block}
.choice.pick{outline:3px solid #f3c37a}

table{width:100%;border-collapse:collapse;font-size:12px}
th,td{border-bottom:1px solid #2a4556;padding:4px;text-align:left}
.meter{height:8px;background:#0b1a24;border-radius:4px;overflow:hidden;margin:6px 0}
.meter i{display:block;height:100%;width:0;background:#5fd39a;transition:width .08s}
.rec-dot{display:inline-block;width:10px;height:10px;border-radius:50%;background:#ff5a5a;margin-right:6px;animation:pulse 1s infinite}

#toast{position:fixed;left:50%;top:70px;max-width:90vw;transform:translateX(-50%);background:#173d2c;border:1px solid #5fd39a;padding:10px 16px;border-radius:12px;z-index:20;font-weight:600}
@media (max-width:520px){#panel{padding:14px}.wordcard .word{font-size:36px}.en{font-size:18px}}
body.panel-open #toast{top:auto;bottom:16px}
.kbd{display:grid;grid-template-columns:repeat(10,1fr);gap:4px;margin:8px 0}
.kb{min-width:0;min-height:44px;background:#2d6a87;font-size:18px;font-weight:700;padding:0}
.kb.wide{grid-column:span 2}
.form{display:flex;flex-direction:column;gap:8px}
.form label{display:flex;flex-direction:column;gap:4px;font-size:14px}
.form label.chk{flex-direction:row;align-items:center;gap:8px}
.form input{font:inherit;padding:10px;border-radius:10px;border:1px solid #3d6f85;background:#0b1a24;color:#eef4f7}
.form input[type=checkbox]{width:22px;height:22px}
a{color:#f3c37a}
