:root {
  --red: #b3202a; --red2: #7a1418; --gold: #e8b64a; --gold2: #c8902a; --ink: #2a1a12; --paper: #f8eedb; --paper2: #efe0c2;
  --jade: #2f9e7a; --sky: #3a8fd0; --zh: 'Noto Serif SC', 'Songti SC', 'SimSun', 'PingFang SC', 'Microsoft YaHei', serif;
  --brush: 'Ma Shan Zheng', 'Noto Serif SC', 'KaiTi', serif; --ui: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #0d1a26; font-family: var(--ui); color: #fff; user-select: none; -webkit-user-select: none; touch-action: none; }
canvas#game { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
.hidden { display: none !important; }
button { font-family: var(--ui); cursor: pointer; }
.zh { font-family: var(--zh); }

/* ---------- title ---------- */
#title { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; transition: opacity 1s; }
#title.gone { opacity: 0; pointer-events: none; }
.title-bg { position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 30%, rgba(255,190,110,.35), transparent 60%), linear-gradient(180deg, rgba(20,10,10,.25), rgba(20,8,8,.85)); }
.title-inner { position: relative; text-align: center; padding: 20px; max-width: 640px; }
.title-zh { font-family: var(--brush); font-size: clamp(90px, 22vw, 190px); line-height: .95; color: #ffdf8a; text-shadow: 0 4px 0 #7a1418, 0 0 40px rgba(255,120,40,.6), 0 10px 30px rgba(0,0,0,.6); letter-spacing: .05em; }
.title-py { font-size: 22px; color: #ffe9bf; letter-spacing: .3em; margin-top: 4px; }
.title-en { font-family: 'Cinzel', serif; font-size: clamp(22px, 5vw, 38px); letter-spacing: .35em; color: #fff; margin-top: 6px; text-shadow: 0 2px 10px #000; }
.title-sub { margin: 14px 0 22px; color: #f5e2c0; font-size: 16px; text-shadow: 0 1px 4px #000; }
#loadbar { width: min(360px, 80vw); height: 8px; margin: 0 auto; background: rgba(0,0,0,.45); border-radius: 5px; overflow: hidden; border: 1px solid rgba(232,182,74,.5); }
#loadfill { height: 100%; width: 0; background: linear-gradient(90deg, var(--red), var(--gold)); transition: width .3s; }
#loadmsg { margin-top: 8px; font-size: 13px; color: #e9d3ad; }
#titlebtns { display: flex; flex-direction: column; gap: 12px; align-items: center; }
.qualrow { font-size: 13px; color: #f0dcb8; margin-top: 4px; }
.qualrow select { background: rgba(0,0,0,.5); color: #fff; border: 1px solid var(--gold2); border-radius: 6px; padding: 3px 6px; }
.title-foot { margin-top: 22px; font-size: 12px; color: #cdb592; }
.btn { border: 0; border-radius: 12px; padding: 13px 34px; font-size: 18px; font-weight: 800; color: #fff; min-width: 240px; box-shadow: 0 4px 0 rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.3); transition: transform .1s, filter .15s; }
.btn:hover { filter: brightness(1.1); transform: translateY(-1px); }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(0,0,0,.35); }
.btn.red { background: linear-gradient(180deg, #d63a3a, #9a1c22); }
.btn.gold { background: linear-gradient(180deg, #f2c75c, #c08a22); color: #3a2208; }
.btn.jade { background: linear-gradient(180deg, #3fbf94, #237a5c); }
.btn.ghost { background: rgba(0,0,0,.08); color: var(--ink); box-shadow: none; border: 2px solid rgba(122,20,24,.35); }
.btn.small { min-width: 0; padding: 9px 18px; font-size: 15px; }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 10; }
#topleft { position: absolute; left: 14px; top: 12px; width: min(330px, 60vw); }
.bar { position: relative; height: 18px; background: rgba(0,0,0,.55); border-radius: 9px; overflow: hidden; border: 1px solid rgba(255,220,150,.45); }
.bar.hp #hpfill { height: 100%; width: 100%; background: linear-gradient(90deg, #c4252e, #f05a4a); transition: width .2s; }
.bar span { position: absolute; inset: 0; text-align: center; font-size: 12px; line-height: 17px; font-weight: 800; text-shadow: 0 1px 2px #000; }
#stats { display: flex; gap: 12px; margin-top: 6px; font-size: 14px; text-shadow: 0 1px 3px #000, 0 0 6px rgba(0,0,0,.6); flex-wrap: wrap; }
#stats b { color: #ffe08a; }
#objective { margin-top: 8px; font-size: 13.5px; background: linear-gradient(90deg, rgba(20,10,8,.7), rgba(20,10,8,0)); padding: 6px 10px; border-left: 3px solid var(--gold); border-radius: 4px; line-height: 1.45; }
#objective .zh { color: #ffd98a; font-size: 15px; }
#objective .ok { color: #8fe3b4; }
#zonebanner { position: absolute; top: 15%; left: 50%; transform: translateX(-50%); text-align: center; opacity: 0; transition: opacity 1.2s; text-shadow: 0 3px 12px #000, 0 0 3px #000; }
#zonebanner.on { opacity: 1; }
.zb-zh { font-family: var(--brush); font-size: 74px; color: #ffe2a0; line-height: 1; }
.zb-py { font-size: 20px; letter-spacing: .25em; color: #fff; }
.zb-en { font-family: 'Cinzel', serif; font-size: 17px; letter-spacing: .3em; color: #f4dcb0; margin-top: 2px; }
#minimap { position: absolute; right: 14px; top: 12px; width: 150px; height: 150px; border-radius: 50%; border: 3px solid rgba(232,182,74,.85); box-shadow: 0 4px 16px rgba(0,0,0,.5); background: #134; }
#menubtns { position: absolute; right: 14px; top: 172px; display: flex; gap: 6px; pointer-events: auto; }
#menubtns button { width: 40px; height: 40px; border-radius: 10px; border: 1px solid rgba(232,182,74,.6); background: rgba(30,12,10,.7); font-size: 19px; color: #fff; }
#strikebox { position: absolute; left: 50%; bottom: 22px; transform: translateX(-50%); width: 64px; height: 64px; border-radius: 50%; background: radial-gradient(circle at 40% 35%, #e64a3c, #8c1219); border: 3px solid var(--gold); font-family: var(--brush); font-size: 34px; text-align: center; line-height: 58px; box-shadow: 0 0 18px rgba(255,120,60,.5); overflow: hidden; }
#strikebox span { position: absolute; left: 0; right: 0; bottom: -2px; font-family: var(--ui); font-size: 10px; line-height: 12px; font-weight: 800; color: #ffe5a6; }
#strikecd { position: absolute; left: 0; right: 0; bottom: 0; height: 0; background: rgba(0,0,0,.6); }
#strikebox.ready { animation: pulse 1.6s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 30px rgba(255,200,80,.95); } }
#prompt { position: absolute; left: 50%; bottom: 104px; transform: translateX(-50%); background: rgba(25,10,8,.78); border: 1px solid var(--gold); padding: 8px 16px; border-radius: 10px; font-size: 15px; white-space: nowrap; }
#prompt kbd { background: var(--gold); color: #3a2208; border-radius: 4px; padding: 1px 7px; font-weight: 800; margin-right: 6px; font-family: var(--ui); }
#bossbar { position: absolute; left: 50%; top: 14px; transform: translateX(-50%); width: min(560px, 56vw); text-align: center; }
.bb-name { font-family: var(--zh); font-size: 20px; color: #ffd98a; text-shadow: 0 2px 6px #000; margin-bottom: 3px; }
.bar.boss { height: 14px; }
#bossfill { height: 100%; width: 100%; background: linear-gradient(90deg, #8f1b2a, #e0473a); transition: width .2s; }
#bossshield { position: absolute; inset: 0; background: repeating-linear-gradient(45deg, rgba(90,220,255,.75) 0 8px, rgba(40,140,255,.55) 8px 16px); display: none; }
#bossshield.on { display: block; }
.bb-hint { font-size: 13px; margin-top: 4px; color: #bfefff; text-shadow: 0 1px 4px #000; min-height: 16px; }
#toasts { position: absolute; left: 50%; top: 24%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 6px; align-items: center; }
.toast { background: rgba(25,10,8,.85); border: 1px solid rgba(232,182,74,.7); padding: 8px 16px; border-radius: 10px; font-size: 15px; animation: tin .3s ease-out, tout .5s ease-in forwards; animation-delay: 0s, var(--d, 2.6s); max-width: 80vw; text-align: center; }
.toast.gold { border-color: var(--gold); color: #ffe08a; }
.toast.good { border-color: #4fd39a; }
.toast.bad { border-color: #e65050; }
.toast .zh { font-size: 18px; color: #ffd98a; }
@keyframes tin { from { opacity: 0; transform: translateY(10px); } }
@keyframes tout { to { opacity: 0; transform: translateY(-10px); } }
#hurt { position: absolute; inset: 0; box-shadow: inset 0 0 120px rgba(200,0,0,.75); opacity: 0; transition: opacity .35s; }
#fade { position: fixed; inset: 0; background: #000; opacity: 0; pointer-events: none; transition: opacity .6s; z-index: 40; }
#fade.on { opacity: 1; }

/* touch */
#joy, #touchbtns { display: none; }
body.touch #joy { display: block; position: absolute; left: 30px; bottom: 40px; width: 120px; height: 120px; border-radius: 50%; background: rgba(255,255,255,.08); border: 2px solid rgba(255,255,255,.22); pointer-events: none; }
body.touch #joy.on { background: rgba(255,255,255,.14); }
#knob { position: absolute; left: 35px; top: 35px; width: 50px; height: 50px; border-radius: 50%; background: rgba(255,230,180,.45); }
body.touch #touchbtns { display: block; position: absolute; right: 18px; bottom: 26px; width: 230px; height: 220px; pointer-events: none; }
.tb { position: absolute; pointer-events: auto; width: 58px; height: 58px; border-radius: 50%; border: 2px solid rgba(232,182,74,.7); background: rgba(40,14,10,.55); color: #fff; font-size: 24px; }
.tb.big { width: 84px; height: 84px; right: 0; bottom: 0; font-size: 36px; }
#tRoll { right: 96px; bottom: 0; } #tStrike { right: 6px; bottom: 96px; font-family: var(--brush); font-size: 30px; background: rgba(160,25,25,.75); }
#tUse { right: 92px; bottom: 74px; } #tEat { right: 160px; bottom: 30px; width: 48px; height: 48px; font-size: 20px; } #tJump { right: 74px; bottom: 150px; width: 48px; height: 48px; font-size: 20px; }
body.touch #strikebox { display: none; }
body.touch #prompt { bottom: 250px; }
body.touch #minimap { width: 110px; height: 110px; }
body.touch #menubtns { top: 130px; }

/* ---------- modal / paper panels ---------- */
#modal { position: fixed; inset: 0; z-index: 30; display: flex; align-items: center; justify-content: center; background: rgba(10,5,3,.45); backdrop-filter: blur(2px); pointer-events: auto; }
#modalbox { position: relative; width: min(680px, 94vw); max-height: 92vh; overflow-y: auto; background: var(--paper); color: var(--ink); border-radius: 14px; padding: 22px 24px 20px; box-shadow: 0 20px 60px rgba(0,0,0,.6), inset 0 0 0 3px #f8eedb, inset 0 0 0 5px var(--red), inset 0 0 50px rgba(160,110,40,.18); background-image: radial-gradient(circle at 20% 10%, rgba(255,255,255,.5), transparent 40%), radial-gradient(circle at 80% 90%, rgba(200,150,80,.15), transparent 50%); animation: pop .22s ease-out; user-select: text; -webkit-user-select: text; }
#modalbox.wide { width: min(940px, 96vw); }
@keyframes pop { from { transform: scale(.94); opacity: 0; } }
#modalbox h2 { margin: 0 0 6px; font-family: var(--brush); font-weight: 400; font-size: 34px; color: var(--red2); }
#modalbox h2 small { font-family: var(--ui); font-size: 15px; color: #8a6a4a; font-weight: 700; margin-left: 8px; }
#modalbox h3 { margin: 14px 0 6px; color: var(--red2); }
#modalbox p { line-height: 1.55; margin: 6px 0; }
.mclose { position: absolute; right: 12px; top: 10px; width: 34px; height: 34px; border-radius: 50%; border: 0; background: rgba(122,20,24,.1); color: var(--red2); font-size: 20px; font-weight: 800; }
.row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 14px; }
.speak { border: 0; background: var(--red); color: #fff; border-radius: 50%; width: 36px; height: 36px; font-size: 17px; vertical-align: middle; box-shadow: 0 2px 0 var(--red2); }
.speak.sm { width: 28px; height: 28px; font-size: 13px; }
.tag { display: inline-block; font-size: 11px; font-weight: 800; padding: 2px 8px; border-radius: 10px; background: var(--red); color: #fff; vertical-align: middle; letter-spacing: .05em; }
.tag.jade { background: var(--jade); } .tag.gold { background: var(--gold2); }

/* artifact card */
.art { text-align: center; }
.art .kind { font-size: 13px; color: #8a6a4a; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.art .big { font-family: var(--zh); font-size: clamp(64px, 16vw, 104px); line-height: 1.1; color: var(--ink); margin: 6px 0 0; }
.art .py { font-size: 26px; color: var(--red); font-weight: 800; }
.art .en { font-size: 22px; font-weight: 800; margin: 4px 0; }
.art .lit { font-size: 14px; color: #7a5a3a; font-style: italic; }
.art .tip { background: rgba(232,182,74,.18); border-left: 4px solid var(--gold2); text-align: left; padding: 9px 12px; border-radius: 6px; margin: 12px 0 8px; font-size: 15px; line-height: 1.5; }
.art .ex { text-align: left; background: #fff8ea; border: 1px dashed rgba(122,20,24,.3); padding: 9px 12px; border-radius: 8px; }
.ex .exh { font-family: var(--zh); font-size: 21px; }
.ex .exp { color: var(--red); font-size: 14px; font-weight: 700; }
.ex .exe { color: #6a5040; font-size: 14px; }
.powerup { margin-top: 10px; font-weight: 800; color: #1f7a56; }

/* dialogue */
#dialog { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); width: min(780px, 96vw); z-index: 31; background: var(--paper); color: var(--ink); border-radius: 14px; padding: 14px 18px 14px; box-shadow: 0 14px 40px rgba(0,0,0,.6), inset 0 0 0 3px var(--paper), inset 0 0 0 5px var(--red); pointer-events: auto; animation: pop .2s; }
#dialog .who { display: flex; align-items: baseline; gap: 10px; margin-bottom: 6px; }
#dialog .who .n { font-family: var(--zh); font-size: 22px; font-weight: 700; color: var(--red2); }
#dialog .who .np { color: var(--red); font-weight: 700; } #dialog .who .ne { color: #8a6a4a; font-size: 14px; }
.toks { display: flex; flex-wrap: wrap; gap: 4px 2px; align-items: flex-end; }
.tok { display: inline-flex; flex-direction: column; align-items: center; padding: 3px 5px 4px; border-radius: 7px; cursor: pointer; transition: background .15s; min-width: 18px; }
.tok:hover { background: rgba(232,182,74,.25); }
.tok .tp { font-size: 13px; color: var(--red); font-weight: 700; min-height: 16px; }
.tok .th { font-family: var(--zh); font-size: 28px; line-height: 1.15; }
.tok .te { font-size: 11.5px; color: #6f5a48; max-width: 110px; text-align: center; line-height: 1.15; min-height: 13px; }
.tok.punct .th { font-size: 26px; } .tok.punct { padding: 3px 1px; cursor: default; }
.tok.known .th { color: #135e45; }
.tok.hl { background: rgba(232,182,74,.4); }
.toks.small .th { font-size: 22px; } .toks.small .tp { font-size: 12px; }
.hidegloss .tok .te { visibility: hidden; } .hidepy .tok .tp { visibility: hidden; }
.trans { margin-top: 6px; color: #5c4535; font-size: 15px; font-style: italic; }
.trans.blur { filter: blur(5px); cursor: pointer; }
.dlg-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; gap: 8px; flex-wrap: wrap; }
.dlg-actions .hintt { font-size: 12.5px; color: #8a6a4a; }
.opts { display: grid; gap: 8px; margin-top: 10px; }
.opt { text-align: left; background: #fff8ea; border: 2px solid rgba(122,20,24,.25); border-radius: 10px; padding: 7px 10px; color: var(--ink); font-size: 15px; transition: border-color .15s, background .15s; }
.opt:hover { border-color: var(--red); background: #fff2d6; }
.opt.right { border-color: #2a9d6a; background: #dcf6e8; } .opt.wrong { border-color: #d43a3a; background: #fde2e0; }
.opt .oe { font-size: 13px; color: #6f5a48; margin-top: 2px; }

/* quiz */
.quiz { text-align: center; }
.quiz .qhead { display: flex; justify-content: space-between; align-items: center; font-size: 13px; font-weight: 800; color: #8a6a4a; letter-spacing: .05em; }
.quiz .qtimer { height: 6px; background: rgba(0,0,0,.08); border-radius: 3px; overflow: hidden; margin: 6px 0 10px; }
.quiz .qtimer div { height: 100%; background: linear-gradient(90deg, var(--gold), var(--red)); width: 100%; }
.quiz .qprompt { font-size: 18px; font-weight: 700; margin: 4px 0 8px; }
.quiz .qbig { font-family: var(--zh); font-size: clamp(54px, 13vw, 84px); line-height: 1.15; }
.quiz .qpy { color: var(--red); font-size: 22px; font-weight: 800; min-height: 26px; }
.quiz .qsent { font-family: var(--zh); font-size: 26px; margin: 8px 0; }
.quiz .grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.qa { background: #fff8ea; border: 2px solid rgba(122,20,24,.25); border-radius: 12px; padding: 12px 8px; font-size: 18px; font-weight: 700; color: var(--ink); min-height: 58px; transition: all .15s; }
.qa.zh { font-family: var(--zh); font-size: 30px; font-weight: 500; }
.qa:hover { border-color: var(--red); transform: translateY(-1px); }
.qa.right { border-color: #2a9d6a; background: #c9f2dc; } .qa.wrong { border-color: #d43a3a; background: #fbd3cf; } .qa:disabled { cursor: default; transform: none; }
.qfb { margin-top: 12px; padding: 10px 12px; border-radius: 10px; text-align: left; font-size: 15px; line-height: 1.5; }
.qfb.good { background: #dcf6e8; border: 1px solid #2a9d6a; } .qfb.bad { background: #fde8e4; border: 1px solid #d43a3a; }
.qfb .zh { font-size: 20px; }
.qkey { display: inline-block; min-width: 18px; font-size: 11px; color: #a08060; margin-right: 6px; }

/* sentence builder */
.slots { min-height: 64px; border-bottom: 3px solid var(--red); display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; padding: 6px; margin: 10px 0; }
.pool { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.chip { background: #fff8ea; border: 2px solid rgba(122,20,24,.3); border-radius: 10px; padding: 4px 10px; font-family: var(--zh); font-size: 26px; color: var(--ink); display: flex; flex-direction: column; align-items: center; }
.chip small { font-family: var(--ui); font-size: 12px; color: var(--red); font-weight: 700; }
.chip.used { opacity: .25; pointer-events: none; }

/* codex */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0 10px; }
.tabs button { border: 2px solid rgba(122,20,24,.25); background: #fff8ea; border-radius: 20px; padding: 5px 12px; font-weight: 800; color: var(--ink); font-size: 13px; }
.tabs button.on { background: var(--red); color: #fff; border-color: var(--red); }
.cgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; }
.cw { background: #fff8ea; border: 2px solid rgba(122,20,24,.18); border-radius: 10px; padding: 8px 4px; text-align: center; cursor: pointer; position: relative; }
.cw .h { font-family: var(--zh); font-size: 28px; }
.cw .p { font-size: 13px; color: var(--red); font-weight: 700; } .cw .e { font-size: 12px; color: #6f5a48; }
.cw.locked { background: rgba(0,0,0,.05); border-style: dashed; cursor: default; }
.cw.locked .h { color: transparent; text-shadow: 0 0 12px rgba(0,0,0,.35); }
.cw .star { position: absolute; right: 5px; top: 3px; color: var(--gold2); font-size: 13px; }
.prog { height: 8px; background: rgba(0,0,0,.08); border-radius: 4px; overflow: hidden; margin: 4px 0 10px; }
.prog div { height: 100%; background: linear-gradient(90deg, var(--jade), #6fdcb0); }

/* lesson cards */
.lesson .lbody { font-size: 16.5px; line-height: 1.6; }
.lesson .lex { display: grid; gap: 6px; margin-top: 10px; }
.lesson .lexi { display: flex; gap: 10px; align-items: center; background: #fff8ea; border-radius: 8px; padding: 6px 10px; }
.lesson .lexi .h { font-family: var(--zh); font-size: 26px; min-width: 60px; text-align: center; }
.lesson .lexi .p { color: var(--red); font-weight: 800; min-width: 80px; }
.dots { display: flex; gap: 6px; justify-content: center; margin-top: 10px; }
.dots i { width: 8px; height: 8px; border-radius: 50%; background: rgba(122,20,24,.2); } .dots i.on { background: var(--red); }

/* minigames */
.mg { text-align: center; }
.mg .score { font-weight: 800; color: var(--red2); }
.drums { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 14px; }
.drum { border: 0; border-radius: 50%; aspect-ratio: 1; background: radial-gradient(circle at 50% 40%, #f6e2b8 0 46%, #b3202a 47% 60%, #7a1418 61%); color: var(--ink); font-size: 28px; font-weight: 800; box-shadow: 0 6px 0 #4a0c0e; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1; }
.drum small { font-size: 11px; font-weight: 700; margin-top: 4px; }
.drum:active, .drum.hit { transform: translateY(4px); box-shadow: 0 2px 0 #4a0c0e; }
.drum.right { filter: drop-shadow(0 0 10px #2a9d6a) brightness(1.1); } .drum.wrong { filter: grayscale(.6); }
.memgrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 12px; }
.mcard { aspect-ratio: 1.15; border-radius: 10px; border: 0; background: linear-gradient(135deg, #b3202a, #7a1418); color: transparent; font-size: 15px; font-weight: 800; position: relative; transition: transform .25s; padding: 4px; }
.mcard::after { content: '福'; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-family: var(--brush); color: #e8b64a; font-size: 34px; }
.mcard.open, .mcard.done { background: #fff8ea; color: var(--ink); border: 2px solid var(--gold2); }
.mcard.open::after, .mcard.done::after { display: none; }
.mcard.zh { font-family: var(--zh); font-size: 28px; font-weight: 500; }
.mcard.done { opacity: .55; border-color: #2a9d6a; }
.lanterns { position: relative; height: 340px; background: linear-gradient(180deg, #1a1030, #3a1a3a 70%, #5a2a2a); border-radius: 12px; overflow: hidden; margin-top: 10px; }
.lantern { position: absolute; width: 74px; height: 92px; border: 0; border-radius: 40% 40% 36% 36%; background: radial-gradient(circle at 50% 40%, #ffcf6a, #e2362b 60%, #8a1414); color: #fff6d8; font-family: var(--zh); font-size: 30px; box-shadow: 0 0 26px rgba(255,120,50,.8); display: flex; align-items: center; justify-content: center; }
.lantern::before { content: ''; position: absolute; top: -8px; left: 28px; width: 18px; height: 8px; background: #e8b64a; border-radius: 3px; }
.lantern.bad { background: radial-gradient(circle at 50% 40%, #aaa, #555); box-shadow: none; }
.lantern.good { background: radial-gradient(circle at 50% 40%, #b9ffd9, #2a9d6a); }
.shop { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.item { background: #fff8ea; border: 2px solid rgba(122,20,24,.25); border-radius: 12px; padding: 8px; font-size: 34px; }
.item div { font-family: var(--zh); font-size: 18px; } .item small { display: block; font-size: 12px; color: var(--red); font-weight: 700; }
.item.sel { border-color: var(--red); background: #ffe9c6; }
.qty { display: flex; gap: 6px; justify-content: center; margin-top: 10px; flex-wrap: wrap; }
.qty button { width: 46px; height: 46px; border-radius: 10px; border: 2px solid rgba(122,20,24,.3); background: #fff8ea; font-size: 20px; font-weight: 800; color: var(--ink); }
.qty button.sel { background: var(--red); color: #fff; }

/* map */
.mapwrap { position: relative; width: 100%; aspect-ratio: 1; max-height: 70vh; margin: 0 auto; }
.mapwrap canvas { width: 100%; height: 100%; border-radius: 12px; }
.legend { display: flex; flex-wrap: wrap; gap: 10px; font-size: 12.5px; justify-content: center; margin-top: 8px; }

.settings label { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid rgba(122,20,24,.12); font-weight: 700; }
.keys { font-size: 14px; line-height: 1.7; columns: 2; }
.keys kbd { background: #fff; border: 1px solid #c9b48f; border-radius: 4px; padding: 0 6px; font-family: var(--ui); font-weight: 800; }
@media (max-width: 600px) { .keys { columns: 1; } .quiz .grid { grid-template-columns: 1fr; } .qa { min-height: 48px; padding: 8px; } #modalbox { padding: 18px 14px 14px; } .zb-zh { font-size: 54px; } }
.credits { text-align: center; }
.credits .big { font-family: var(--brush); font-size: 60px; color: var(--red); }

/* ---------- v2: spells, qi, training ---------- */
#spellbar { position: absolute; left: 50%; bottom: 96px; transform: translateX(-50%); display: flex; gap: 8px; pointer-events: auto; }
.spell { position: relative; width: 58px; height: 58px; border-radius: 14px; border: 2px solid rgba(232,182,74,.75); background: linear-gradient(180deg, rgba(60,20,16,.85), rgba(25,8,6,.85)); color: #fff; overflow: hidden; padding: 0; box-shadow: 0 4px 14px rgba(0,0,0,.45); }
.spell .si { font-size: 24px; display: block; line-height: 34px; } .spell .sn { font-size: 11px; display: block; color: #ffe2a0; line-height: 12px; }
.spell .sk { position: absolute; left: 4px; top: 2px; font-size: 10px; font-weight: 800; color: #e8b64a; }
.spell .slv { position: absolute; right: 4px; top: 2px; font-size: 10px; font-weight: 800; color: #7dffc8; }
.spell .scd { position: absolute; left: 0; right: 0; bottom: 0; height: 0; background: rgba(0,0,0,.65); pointer-events: none; }
.spell.ready { border-color: #ffd36a; box-shadow: 0 0 12px rgba(255,200,90,.5); }
#strikebox { isolation: isolate; background: conic-gradient(#ffd36a var(--qi, 0%), rgba(0,0,0,.35) 0); }
#strikebox::before { content: ''; position: absolute; inset: 4px; border-radius: 50%; background: radial-gradient(circle at 40% 35%, #e64a3c, #8c1219); z-index: -1; }
#strikebox.ult, #tStrike.ult { animation: ultp .8s infinite; }
@keyframes ultp { 50% { box-shadow: 0 0 34px #ffd36a, 0 0 60px rgba(255,120,40,.8); } }
body.touch #spellbar { left: auto; right: 250px; bottom: 30px; transform: none; flex-wrap: wrap; width: 200px; justify-content: flex-end; }
body.touch .spell { width: 50px; height: 50px; }
.setgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }
.setcard { background: #fff8ea; border: 2px solid rgba(122,20,24,.18); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; }
.setcard.on { border-color: #2a9d6a; box-shadow: 0 0 0 2px rgba(42,157,106,.15); }
.sc-top { display: flex; gap: 10px; align-items: center; } .sc-ic { font-size: 30px; } .sc-e { color: #6f5a48; font-size: 14px; } .sc-w { font-size: 12px; color: #8a6a4a; }
.sc-r { font-size: 14px; } .sc-d { font-size: 12.5px; color: #5c4535; margin-top: 2px; } .sc-goal { font-size: 12px; color: #8a6a4a; font-style: italic; }
.quests { display: grid; gap: 6px; } .quest { background: #fff8ea; border-left: 4px solid var(--gold2); border-radius: 6px; padding: 7px 10px; font-size: 14.5px; display: flex; gap: 8px; align-items: center; }
.quest .qp { margin-left: auto; font-weight: 800; color: var(--red2); } .quest .qr { font-size: 13px; }
.tipbox { position: absolute; left: 50%; top: 36%; transform: translateX(-50%); max-width: min(520px, 90vw); background: rgba(20,10,8,.88); border: 1px solid var(--gold); border-radius: 12px; padding: 10px 16px; font-size: 15px; line-height: 1.45; text-align: center; pointer-events: auto; animation: tin .3s; z-index: 5; }
.tipbox b { color: #ffd98a; } .tipbox button { margin-top: 6px; background: var(--gold); border: 0; border-radius: 8px; padding: 4px 14px; font-weight: 800; color: #3a2208; }
