:root {
  --ink: #2b1d0e;
  --ink-2: #5a4325;
  --paper: #f6ecd6;
  --paper-2: #ead9b4;
  --gold: #f2c14e;
  --gold-d: #b9821f;
  --sea: #1f5f86;
  --sea-d: #123c58;
  --red: #d64541;
  --green: #2fae66;
  --blue: #3f8de0;
  --purple: #9b59d0;
  --glass: rgba(18, 12, 6, .78);
  --glass-2: rgba(255, 248, 230, .92);
  --r: 18px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --font: "PingFang TC", "Microsoft JhengHei", "Noto Sans TC", "Heiti TC", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #120c06; color: var(--ink); font-family: var(--font); -webkit-user-select: none; user-select: none; }
button { font-family: inherit; cursor: pointer; border: 0; }
img { -webkit-user-drag: none; }

.screen { position: fixed; inset: 0; display: none; }
.screen.active { display: block; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 26px; border-radius: 999px; font-size: 20px; font-weight: 900; letter-spacing: 1px;
  color: #3a2208; background: linear-gradient(180deg, #ffe08a, var(--gold) 55%, var(--gold-d));
  box-shadow: 0 4px 0 #7a520f, 0 8px 18px rgba(0, 0, 0, .35); transition: transform .08s, filter .15s;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #7a520f, 0 4px 10px rgba(0, 0, 0, .3); }
.btn.big { font-size: 28px; padding: 16px 44px; }
.btn.ghost { background: rgba(255, 255, 255, .14); color: #fff; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .45); }
.btn.red { background: linear-gradient(180deg, #ff8a7a, var(--red) 60%, #8e2320); color: #fff; box-shadow: 0 4px 0 #5e1513; }
.btn.green { background: linear-gradient(180deg, #8ff0b0, var(--green) 60%, #1b6e40); color: #fff; box-shadow: 0 4px 0 #11492a; }
.btn[disabled] { filter: grayscale(1) brightness(.8); cursor: not-allowed; }
.icon-btn {
  width: 46px; height: 46px; border-radius: 50%; font-size: 22px; background: var(--glass); color: #fff;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .25);
}

/* ---------- title ---------- */
#s-title { background: #000 url(../assets/bg_menu.jpg) center / cover no-repeat; }
#s-title::after { content: ""; position: absolute; inset: 0; background: radial-gradient(ellipse at center, transparent 30%, rgba(0, 0, 0, .55)); pointer-events: none; }
.title-box { position: absolute; left: 50%; top: 52%; transform: translate(-50%, -50%); text-align: center; z-index: 2; }
.logo {
  font-size: clamp(54px, calc(var(--vw, 1vw) * 9), 120px); font-weight: 900; letter-spacing: 8px; margin: 0;
  color: #fff6d8; text-shadow: 0 0 2px #7a4b00, 0 4px 0 #a86a00, 0 10px 30px rgba(0, 0, 0, .7), 0 0 60px rgba(255, 200, 80, .55);
}
.logo-sub { margin: 6px 0 34px; font-size: 24px; font-weight: 700; color: #ffe9b0; letter-spacing: 6px; text-shadow: 0 2px 8px #000; }
.title-foot { position: absolute; right: 18px; bottom: 16px; z-index: 2; display: flex; gap: 10px; }

/* ---------- world (選科目) ---------- */
#s-world { background: #2a4d6e url(../assets/bg_world.jpg) center / cover no-repeat; overflow: auto; }
#s-world::before { content: ""; position: fixed; inset: 0; background: radial-gradient(ellipse at center, rgba(0, 0, 0, .05), rgba(0, 0, 0, .35)); pointer-events: none; }
.world-head { position: relative; text-align: center; margin: 86px 0 18px; color: #fff; text-shadow: 0 3px 10px rgba(0, 0, 0, .6); }
.world-head h1 { margin: 0; font-size: clamp(40px, calc(var(--vw, 1vw) * 5), 64px); font-weight: 900; letter-spacing: 6px; }
.world-head p { margin: 4px 0 0; font-size: 20px; font-weight: 700; letter-spacing: 3px; }
.world-grid { position: relative; display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 18px; width: min(1180px, calc(var(--vw, 1vw) * 92)); margin: 0 auto 40px; }
.world-tile {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 20px 14px 16px; border-radius: 22px;
  background: linear-gradient(180deg, #fffaf0, #f3e2bb); box-shadow: 0 6px 0 color-mix(in srgb, var(--c) 70%, #000), 0 14px 26px rgba(0, 0, 0, .35), inset 0 0 0 4px var(--c);
  color: var(--ink); transition: transform .12s;
}
.world-tile:hover { transform: translateY(-4px) scale(1.02); }
.world-tile:active { transform: translateY(3px); }
.wt-ic { font-size: 56px; line-height: 1.15; }
.wt-name { font-size: 30px; font-weight: 900; color: var(--c); }
.wt-desc { font-size: 15px; font-weight: 700; color: var(--ink-2); }
.wt-prog { width: 86%; height: 10px; border-radius: 999px; background: rgba(0, 0, 0, .12); overflow: hidden; margin-top: 6px; }
.wt-prog i { display: block; height: 100%; background: var(--c); border-radius: 999px; }
.wt-stars { font-size: 15px; font-weight: 900; color: var(--ink-2); }
.world-tile .badge, .chap-card2 .badge { top: -10px; right: -8px; background: #7b1fa2; }

/* ---------- chapters (選章節) ---------- */
#s-chapters { background: radial-gradient(ellipse at 50% 0%, color-mix(in srgb, var(--c, #b9821f) 55%, #1d1309), #120c06 75%); overflow: auto; }
.chap-head { display: flex; align-items: center; gap: 14px; width: min(1180px, calc(var(--vw, 1vw) * 92)); margin: 82px auto 10px; }
.chap-head .ch-title { flex: 1; color: #fff; font-size: 36px; font-weight: 900; text-shadow: 0 3px 8px rgba(0, 0, 0, .5); }
.sem-tabs { display: flex; gap: 10px; width: min(1180px, calc(var(--vw, 1vw) * 92)); margin: 0 auto 16px; }
.sem-tabs button { padding: 10px 26px; border-radius: 999px; font-size: 20px; font-weight: 900; background: rgba(255, 255, 255, .15); color: #fff; }
.sem-tabs button.on { background: #fff; color: var(--ink); }
.chap-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; width: min(1180px, calc(var(--vw, 1vw) * 92)); margin: 0 auto 40px; }
.chap-card2 {
  position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; min-height: 128px; padding: 16px 18px; border-radius: 18px; text-align: left;
  background: linear-gradient(180deg, #fffaf0, #f0dcae); box-shadow: 0 5px 0 #b98d3c, 0 10px 20px rgba(0, 0, 0, .35); color: var(--ink); transition: transform .12s;
}
.chap-card2:hover { transform: translateY(-3px); }
.chap-card2 .cc-num { font-size: 14px; font-weight: 900; color: #fff; background: var(--c, #7a4b12); padding: 2px 10px; border-radius: 999px; }
.chap-card2 .cc-title { font-size: 21px; font-weight: 900; line-height: 1.35; }
.chap-card2 .cc-stars { margin-top: auto; font-size: 16px; font-weight: 900; color: #b37400; }
.chap-card2.todo { background: linear-gradient(180deg, #d9d2c3, #b9ae98); box-shadow: 0 5px 0 #8a7d63; opacity: .7; cursor: not-allowed; }
.chap-card2.todo .cc-stars { color: #6b5d45; }
.chap-sep { grid-column: 1 / -1; display: flex; align-items: center; gap: 12px; margin-top: 10px; color: #ffe6a8; font-size: 20px; font-weight: 900; text-shadow: 0 2px 6px rgba(0, 0, 0, .5); }
.chap-sep::after { content: ""; flex: 1; height: 2px; background: linear-gradient(90deg, rgba(255, 230, 168, .6), transparent); }
.chap-card2 .cc-medal { position: absolute; top: 10px; right: 12px; font-size: 30px; line-height: 1; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .35)); }
.ver-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-top: 12px; }
.ver-card { display: flex; flex-direction: column; gap: 4px; padding: 22px 12px; border-radius: 18px; background: #fff; box-shadow: 0 4px 0 #c9a96b, inset 0 0 0 3px #e3c88a; font-size: 16px; font-weight: 700; color: var(--ink-2); }
.ver-card b { font-size: 30px; font-weight: 900; color: var(--ink); }
.ver-card.on { box-shadow: 0 4px 0 #8a5b10, inset 0 0 0 4px var(--gold-d); background: #fff7dc; }

/* ---------- map ---------- */
#s-map { background: radial-gradient(ellipse at 40% 50%, #2a7aa8, var(--sea-d) 75%); }
#s-map .sea-tex { position: absolute; inset: 0; opacity: .25; background-image: repeating-radial-gradient(circle at 30% 40%, transparent 0 22px, rgba(255, 255, 255, .25) 23px 24px, transparent 25px 48px); pointer-events: none; }
.hud { position: absolute; top: 14px; left: 18px; right: 18px; display: flex; align-items: center; gap: 12px; z-index: 5; pointer-events: none; }
.hud > * { pointer-events: auto; }
.pill {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 16px 8px 10px; border-radius: 999px;
  background: var(--glass); color: #fff; font-weight: 900; font-size: 20px; box-shadow: inset 0 0 0 2px rgba(255, 216, 120, .35);
}
.pill .ic { font-size: 22px; }
.hud .spacer { flex: 1; }
/* 手機直拿（各科直式版面在 html 加 hp）：上方一排排不下，音效按鈕被擠出畫面（2026-11-10 地科回報）。間距、內距縮小，商店鈕只寫「🎁 商店」，稱號藏起來（登入後帳號旁看得到）。
   各科 *_portrait.py 也寫了 html.hp .hud，這裡用 .hud.hud 讓這幾條一定蓋過去 */
html.hp .hud.hud { gap: 4px; }
html.hp .hud.hud .pill { padding: 6px 8px 6px 6px; }
html.hp .hud.hud .btn { padding: 8px 9px; }
html.hp .hud.hud .hud-long, html.hp .hud.hud .title-pill { display: none; }

#map-svg { position: absolute; left: 0; top: 0; height: 100%; width: 64%; }
#s-map.generic #map-svg { width: 100%; } /* 一般章節：主題背景鋪滿全螢幕，關卡排在左側 */
.map-side {
  position: absolute; right: 22px; top: 82px; bottom: 22px; width: 34%; max-width: 470px; z-index: 4;
  display: flex; flex-direction: column; gap: 14px;
}
.parch {
  background: linear-gradient(180deg, #fbf3df, var(--paper) 40%, var(--paper-2)); border-radius: var(--r);
  box-shadow: var(--shadow), inset 0 0 0 3px #d9bf86, inset 0 0 40px rgba(160, 110, 30, .18); padding: 18px 22px;
}
.chap-card h2 { margin: 0; font-size: 28px; font-weight: 900; }
.chap-card .sub { color: var(--ink-2); font-weight: 700; margin-top: 2px; }
.chap-card .era { display: inline-block; margin-top: 8px; padding: 2px 12px; border-radius: 999px; background: #7a4b12; color: #ffe7b0; font-weight: 900; }
.progress { margin-top: 12px; height: 14px; border-radius: 999px; background: rgba(0, 0, 0, .15); overflow: hidden; }
.progress > i { display: block; height: 100%; background: linear-gradient(90deg, #ffd56b, #f39c12); border-radius: 999px; transition: width .6s; }
/* 抽卡、卡冊、獎勵商店三個並排；有攻略本的章，攻略本自己占上面一整排 */
.side-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
#btn-guide { grid-column: 1 / -1; }
.side-btn {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 14px 8px 12px; border-radius: 16px;
  background: linear-gradient(180deg, #fff7e2, #f0dcac); box-shadow: 0 4px 0 #b98d3c, 0 8px 18px rgba(0, 0, 0, .25);
  font-weight: 900; font-size: 18px; color: var(--ink); transition: transform .08s;
}
.side-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #b98d3c; }
.side-btn .big-ic { font-size: 38px; line-height: 1.1; }
.side-btn small { font-weight: 700; color: var(--ink-2); font-size: 13px; }
.badge {
  position: absolute; top: -8px; right: -6px; min-width: 28px; height: 28px; padding: 0 8px; border-radius: 999px;
  background: var(--red); color: #fff; font-weight: 900; font-size: 15px; display: grid; place-items: center; box-shadow: 0 2px 6px rgba(0, 0, 0, .4);
}
.glow { animation: glow 1.6s ease-in-out infinite; }
@keyframes glow { 0%, 100% { box-shadow: 0 4px 0 #b98d3c, 0 0 0 0 rgba(255, 210, 90, .0); } 50% { box-shadow: 0 4px 0 #b98d3c, 0 0 22px 6px rgba(255, 210, 90, .85); } }
.daily { font-size: 15px; line-height: 1.6; }
.daily b { font-size: 17px; }

/* svg map pieces */
.node { cursor: pointer; }
.node .ring { transition: transform .2s; transform-box: fill-box; transform-origin: center; }
.node:hover .ring { transform: scale(1.12); }
.node.locked { cursor: not-allowed; }
.node.next .pulse { animation: pulse 1.5s ease-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes pulse { 0% { opacity: .9; transform: scale(1); } 100% { opacity: 0; transform: scale(1.9); } }
.monster-bob { animation: bob 1.2s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
.ship { animation: sail 9s ease-in-out infinite alternate; }
@keyframes sail { from { transform: translate(0, 0); } to { transform: translate(18px, -8px); } }
.dash-move { animation: dash 1.2s linear infinite; }
@keyframes dash { to { stroke-dashoffset: -28; } }

/* ---------- overlays / modal ---------- */
.overlay { position: fixed; inset: 0; z-index: 50; display: none; place-items: center; background: rgba(8, 5, 2, .62); backdrop-filter: blur(3px); }
.overlay.on { display: grid; animation: fadein .2s; }
@keyframes fadein { from { opacity: 0; } }
.modal { position: relative; width: min(760px, calc(var(--vw, 1vw) * 92)); max-height: calc(var(--vh, 1vh) * 90); overflow: auto; animation: pop .28s cubic-bezier(.2, 1.4, .4, 1); }
.modal.wide { width: min(1180px, calc(var(--vw, 1vw) * 95)); }
@keyframes pop { from { transform: scale(.85); opacity: 0; } }
.modal .x { position: absolute; top: 12px; right: 12px; width: 40px; height: 40px; border-radius: 50%; background: rgba(0, 0, 0, .12); font-size: 22px; font-weight: 900; color: var(--ink); }
.modal h2 { margin: 0 0 8px; font-size: 30px; font-weight: 900; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.center { text-align: center; }
.muted { color: var(--ink-2); }
.tag { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 14px; font-weight: 900; color: #fff; background: #7a4b12; }

.node-panel .head { display: flex; gap: 16px; align-items: center; }
.node-panel .head .ic { font-size: 64px; width: 96px; height: 96px; border-radius: 24px; display: grid; place-items: center; background: radial-gradient(circle at 35% 30%, #fff6d6, #e9c97c); box-shadow: inset 0 0 0 3px #c79a3c; }
.stars { font-size: 26px; letter-spacing: 2px; color: #d4b27a; }
.stars .on { color: #ffb400; text-shadow: 0 0 8px rgba(255, 180, 0, .7); }
.node-panel .acts { margin-top: 18px; display: flex; gap: 12px; flex-wrap: wrap; }

/* ---------- dialog ---------- */
#dialog { position: fixed; inset: 0; z-index: 80; display: none; }
#dialog.on { display: block; }
#dialog .shade { position: absolute; inset: 0; background: linear-gradient(0deg, rgba(0, 0, 0, .6), transparent 55%); }
#dialog img.portrait { position: absolute; left: calc(var(--vw, 1vw) * 3); bottom: 0; height: calc(var(--vh, 1vh) * 74); filter: drop-shadow(0 10px 30px rgba(0, 0, 0, .6)); animation: rise .4s ease-out; }
#dialog img.portrait.speaker { left: calc(var(--vw, 1vw) * 6); bottom: calc(var(--vh, 1vh) * 8); height: calc(var(--vh, 1vh) * 56); }
@keyframes rise { from { transform: translateY(40px); opacity: 0; } }
#dialog .box {
  position: absolute; left: calc(var(--vw, 1vw) * 24); right: calc(var(--vw, 1vw) * 4); bottom: calc(var(--vh, 1vh) * 4); min-height: 150px; padding: 22px 30px 26px;
  border-radius: 22px; background: var(--glass-2); box-shadow: var(--shadow), inset 0 0 0 4px #d9b45e; font-size: 26px; font-weight: 700; line-height: 1.6; cursor: pointer;
}
#dialog .who { position: absolute; top: -20px; left: 26px; padding: 4px 18px; border-radius: 999px; background: linear-gradient(180deg, #ffe08a, var(--gold-d)); font-weight: 900; font-size: 20px; }
#dialog .next { position: absolute; right: 22px; bottom: 12px; font-size: 18px; color: var(--gold-d); animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .2; } }

/* ---------- toast ---------- */
#toast { position: fixed; left: 50%; top: 18px; transform: translateX(-50%); z-index: 99; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { padding: 10px 22px; border-radius: 999px; background: var(--glass); color: #fff; font-weight: 900; font-size: 18px; box-shadow: var(--shadow); animation: toast 2.6s forwards; }
@keyframes toast { 0% { opacity: 0; transform: translateY(-12px); } 10%, 85% { opacity: 1; transform: none; } 100% { opacity: 0; } }

/* ---------- play ---------- */
#s-play { background: #0d0905; }
.play-top { position: absolute; top: 0; left: 0; right: 0; z-index: 20; display: flex; align-items: center; gap: 14px; padding: 12px 18px; pointer-events: none; }
.play-top > * { pointer-events: auto; }
.play-top .ttl { color: #fff; font-weight: 900; font-size: 22px; text-shadow: 0 2px 6px #000; }
.hearts { font-size: 30px; letter-spacing: 2px; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .6)); }
.hearts .lost { opacity: .22; filter: grayscale(1); }
.shield-ic { font-size: 26px; }
#play-stage { position: absolute; inset: 0; }
.shoot-cv { position: absolute; inset: 0; width: 100%; height: 100%; cursor: none; touch-action: manipulation; } /* iPad 連點不要放大畫面（2026-11-07） */
.shoot-ui { position: absolute; inset: 0; pointer-events: none; }
.q-banner {
  position: absolute; left: 50%; top: 70px; transform: translateX(-50%); width: min(1000px, calc(var(--vw, 1vw) * 86)); text-align: center;
  padding: 16px 28px; border-radius: 20px; background: rgba(255, 248, 228, .95); box-shadow: var(--shadow), inset 0 0 0 4px #e3bb5c;
  font-size: clamp(22px, calc(var(--vw, 1vw) * 2.4), 34px); font-weight: 900; line-height: 1.35; transition: transform .25s;
}
.q-banner.flash { animation: qflash .4s; }
@keyframes qflash { from { transform: translateX(-50%) scale(.9); opacity: 0; } }
.frag {
  position: absolute; left: 50%; bottom: 36px; transform: translateX(-50%); width: min(900px, calc(var(--vw, 1vw) * 86));
  padding: 12px 22px 12px 60px; border-radius: 16px; color: #fff; font-size: 21px; font-weight: 700; line-height: 1.5;
  background: rgba(20, 60, 40, .92); box-shadow: var(--shadow); animation: fragin .3s ease-out;
}
.frag.bad { background: rgba(110, 24, 22, .93); }
.frag::before { content: "💎"; position: absolute; left: 18px; top: 10px; font-size: 26px; }
.frag.bad::before { content: "💡"; }
@keyframes fragin { from { transform: translate(-50%, 20px); opacity: 0; } }

/* 射擊後的解說：停在中央，點一下才繼續 */
.explain-veil { position: absolute; inset: 0; z-index: 5; display: grid; place-items: center; background: rgba(10, 6, 2, .32); pointer-events: auto; cursor: pointer; animation: fadein .2s; }
.explain-card {
  width: min(780px, calc(var(--vw, 1vw) * 86)); max-height: calc(var(--vh, 1vh) * 70); overflow: auto; padding: 22px 30px 16px; border-radius: 24px;
  background: rgba(255, 250, 236, .98); box-shadow: var(--shadow), inset 0 0 0 5px #e3bb5c;
  font-size: clamp(20px, calc(var(--vw, 1vw) * 1.9), 26px); font-weight: 700; line-height: 1.65; color: var(--ink); animation: pop .28s cubic-bezier(.2, 1.4, .4, 1);
}
.explain-card.good, .explain-card.info { box-shadow: var(--shadow), inset 0 0 0 5px #4cc982; }
.explain-card.bad { box-shadow: var(--shadow), inset 0 0 0 5px #e5675f; }
.explain-card .hd { font-size: clamp(24px, calc(var(--vw, 1vw) * 2.3), 32px); font-weight: 900; margin-bottom: 8px; }
.explain-card.good .hd, .explain-card.info .hd { color: #1d8a4c; }
.explain-card.bad .hd { color: #c0392b; }
.explain-card .go { margin-top: 14px; text-align: center; font-size: 20px; font-weight: 900; color: var(--gold-d); opacity: 0; transition: opacity .2s; }
.explain-card.ready .go { opacity: 1; animation: blink 1.2s infinite; }
/* 答錯的解說：倒數那幾秒顯示「5 秒後可以繼續」，不閃 */
.explain-card .go.wait { opacity: .85; animation: none; transition: opacity .15s, transform .15s, color .15s; }
.explain-card .go.nudge { opacity: 1; transform: scale(1.15); color: #b3261e; }
.explain-card .wait-bar { height: 10px; margin-top: 14px; border-radius: 5px; background: rgba(0, 0, 0, .1); overflow: hidden; }
.explain-card .wait-bar i { display: block; height: 100%; width: 100%; border-radius: 5px; background: linear-gradient(90deg, #e5675f, #f2c14e); animation: waitbar linear forwards; }
.explain-card.good .wait-bar i { background: linear-gradient(90deg, #4cc982, #a8e06a); }
/* 過場卡帶圖（scenes.js exPic，歷史 h1_qz 沈劉地圖 2026-11-15）：卡片放到最寬、圖盡量大；直拿換直的那張；點圖放大成原尺寸、可以拖著看 */
/* 卡片從上方那條（回報、關卡名、愛心）下面開始，不要被蓋住 */
.explain-veil:has(.ex-pic) { box-sizing: border-box; padding-top: 80px; }
.explain-card:has(.ex-pic) { width: min(1500px, calc(var(--vw, 1vw) * 97)); max-height: calc(calc(var(--vh, 1vh) * 100) - 90px); padding-top: 12px; padding-bottom: 8px; }
.explain-card:has(.ex-pic) .go { margin-top: 6px; }
.ex-pic { position: relative; width: fit-content; max-width: 100%; margin: 0 auto; cursor: zoom-in; }
.ex-pic img { display: block; width: auto; height: auto; max-width: 100%; max-height: calc(calc(var(--vh, 1vh) * 100) - 260px); border-radius: 14px; }
.ex-pic .port, html.hp .ex-pic.has-p .land { display: none; }
html.hp .ex-pic.has-p .port { display: block; }
.ex-pic .zoom-tip, .ex-pic-big .zoom-tip { position: absolute; right: 10px; bottom: 10px; padding: 4px 14px; border-radius: 999px; background: rgba(43, 29, 14, .8); color: #fff; font-size: 22px; font-weight: 900; line-height: 1.5; pointer-events: none; }
/* 放大那層（掛在 body）：原尺寸、超出畫面就拖著看 */
.ex-pic-big { position: fixed; inset: 0; z-index: 9999; overflow: auto; background: rgba(10, 6, 2, .94); cursor: zoom-out; -webkit-overflow-scrolling: touch; animation: fadein .15s; }
.ex-pic-big img { display: block; margin: 0 auto; max-width: none; }
.ex-pic-big .zoom-tip { position: fixed; right: 14px; bottom: 14px; font-size: 28px; }
/* 手機橫拿畫面矮：卡片的標題和那行說明收起來，讓圖大一點（圖最上面那條已經寫了重點） */
@media (max-height: 520px) { .explain-card:has(.ex-pic) > :is(.hd, p) { display: none; } .ex-pic img { max-height: calc(calc(var(--vh, 1vh) * 100) - 160px); } }
@keyframes waitbar { from { width: 100%; } to { width: 0; } }

/* boss panel */
.boss-panel {
  position: absolute; left: 18px; top: 74px; bottom: 18px; width: 46%; pointer-events: auto; overflow: auto;
  padding: 16px 18px; border-radius: 20px; background: rgba(255, 248, 228, .96); box-shadow: var(--shadow), inset 0 0 0 4px #e3bb5c;
}
.boss-panel img { width: 100%; border-radius: 10px; background: #fff; display: block; }
.boss-panel .opts { margin-top: 12px; display: grid; gap: 8px; }
.boss-panel .opt { display: flex; gap: 10px; align-items: flex-start; padding: 8px 12px; border-radius: 12px; background: #fff; font-size: 20px; font-weight: 700; line-height: 1.4; box-shadow: inset 0 0 0 2px #ead39a; }
.boss-panel .opt b { flex: 0 0 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-size: 18px; }
.boss-panel .opt.ok { box-shadow: inset 0 0 0 3px var(--green); background: #e9fbef; }
.boss-panel .opt.no { box-shadow: inset 0 0 0 3px var(--red); background: #fdeceb; }
.boss-panel .qmeta { font-size: 14px; color: var(--ink-2); font-weight: 700; margin-bottom: 6px; }
.boss-panel .passage-tog { margin: 0 0 8px; font-size: 15px; padding: 6px 14px; }

/* ---------- puzzles ---------- */
.puz { position: absolute; inset: 0; padding: 78px 28px 28px; background: radial-gradient(ellipse at 50% 30%, #4b3418, #1d1309 75%); overflow: hidden; }
.puz .timebar { position: absolute; left: 50%; top: 70px; transform: translateX(-50%); width: min(720px, calc(var(--vw, 1vw) * 70)); height: 12px; border-radius: 999px; background: rgba(255, 255, 255, .15); overflow: hidden; }
.puz .timebar > i { display: block; height: 100%; background: linear-gradient(90deg, #ff6b5a, #ffd56b); transform-origin: left; }
.puz .hint { text-align: center; color: #ffe7b0; font-weight: 900; font-size: 22px; margin: 22px 0 10px; text-shadow: 0 2px 4px #000; }

/* match */
.match { display: grid; grid-template-columns: 1fr 1.6fr; gap: 26px 90px; width: min(1100px, calc(var(--vw, 1vw) * 94)); margin: 0 auto; position: relative; }
.match .col { display: grid; gap: 12px; }
.mcard {
  padding: 14px 18px; border-radius: 16px; background: linear-gradient(180deg, #fff9ea, #f0dcae); font-weight: 900; font-size: 22px; text-align: center;
  box-shadow: 0 4px 0 #b98d3c, 0 8px 14px rgba(0, 0, 0, .35); cursor: pointer; transition: transform .12s, box-shadow .12s, opacity .3s;
}
.mcard.def { font-size: 19px; font-weight: 700; text-align: left; }
.mcard.sel { transform: scale(1.04); box-shadow: 0 0 0 4px var(--gold), 0 8px 20px rgba(255, 200, 80, .6); }
.mcard.done { background: linear-gradient(180deg, #d8f8e3, #9fe0b8); box-shadow: 0 2px 0 #3a8f5d; cursor: default; opacity: .85; }
.mcard.bad { animation: shake .4s; box-shadow: 0 0 0 4px var(--red); }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
.match svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }

/* sort */
.sort-wrap { position: absolute; inset: 0; }
.sbin {
  position: absolute; width: 230px; padding: 16px; border-radius: 22px; text-align: center; color: #fff; font-weight: 900; font-size: 26px;
  box-shadow: 0 6px 0 rgba(0, 0, 0, .35), 0 12px 24px rgba(0, 0, 0, .4); cursor: pointer; transition: transform .12s;
}
.sbin .flag { font-size: 54px; display: block; }
.sbin .key { display: inline-block; margin-top: 6px; padding: 2px 12px; border-radius: 8px; background: rgba(0, 0, 0, .25); font-size: 18px; }
.sbin .cnt { display: block; font-size: 16px; opacity: .85; }
.sbin.bump { transform: scale(1.12); }
.sbin.badflash { animation: shake .4s; filter: brightness(.6) sepia(1) hue-rotate(-50deg) saturate(4); }
.sbin.hintflash { box-shadow: 0 0 0 6px #fff, 0 0 40px 10px rgba(255, 255, 255, .7); }
.scard {
  position: absolute; left: 50%; top: 58%; width: 420px; min-height: 170px; transform: translate(-50%, -50%); padding: 26px 30px; border-radius: 24px;
  background: linear-gradient(180deg, #fffaf0, #f3e0b6); box-shadow: 0 10px 0 #b98d3c, 0 20px 40px rgba(0, 0, 0, .5);
  font-size: 30px; font-weight: 900; text-align: center; display: grid; place-items: center; line-height: 1.4; cursor: grab; touch-action: none;
}
.scard .sbar { position: absolute; left: 20px; right: 20px; bottom: 12px; height: 8px; border-radius: 999px; background: rgba(0, 0, 0, .12); overflow: hidden; }
.scard .sbar i { display: block; height: 100%; background: var(--gold-d); }
.scard.fly { transition: transform .35s cubic-bezier(.5, -.3, .8, .6), opacity .35s; opacity: 0; }
.scard.bad { animation: shake .4s; box-shadow: 0 0 0 5px var(--red), 0 20px 40px rgba(0, 0, 0, .5); }
.combo-big { position: absolute; left: 50%; top: 30%; transform: translate(-50%, -50%); font-size: 60px; font-weight: 900; color: #ffd56b; text-shadow: 0 4px 0 #8a4b00, 0 0 30px rgba(255, 180, 0, .8); pointer-events: none; animation: comboPop .7s forwards; }
@keyframes comboPop { from { transform: translate(-50%, -50%) scale(.4); opacity: 1; } 60% { transform: translate(-50%, -50%) scale(1.15); } to { transform: translate(-50%, -80%) scale(1); opacity: 0; } }

/* timeline */
.tl { position: relative; width: min(1240px, calc(var(--vw, 1vw) * 96)); margin: 34px auto 0; height: 300px; }
.tl .band { position: absolute; top: 0; height: 230px; border-radius: 18px; opacity: .9; }
.tl .band span { position: absolute; top: 8px; left: 14px; color: #fff; font-weight: 900; font-size: 20px; text-shadow: 0 2px 4px rgba(0, 0, 0, .5); }
.tl .axis { position: absolute; left: 0; right: 0; top: 230px; height: 8px; border-radius: 999px; background: linear-gradient(90deg, #f6d27a, #fff3c8, #f6d27a); box-shadow: 0 2px 8px rgba(0, 0, 0, .5); }
.tl .slot {
  position: absolute; top: 46px; width: 150px; height: 150px; transform: translateX(-50%); border-radius: 16px; border: 3px dashed rgba(255, 255, 255, .7);
  background: rgba(0, 0, 0, .18); display: grid; place-items: center; text-align: center; color: #fff; font-weight: 900; font-size: 18px; padding: 8px; transition: background .2s, transform .15s;
}
.tl .slot.hover { background: rgba(255, 255, 255, .3); transform: translateX(-50%) scale(1.05); }
.tl .slot.filled { border: 3px solid #fff; background: linear-gradient(180deg, #fffaf0, #f3e0b6); color: var(--ink); box-shadow: 0 0 24px rgba(255, 230, 140, .9); }
.tl .slot.bad { animation: shake .4s; background: rgba(214, 69, 65, .6); }
.tl .year { position: absolute; top: 246px; transform: translateX(-50%); color: #ffe7b0; font-weight: 900; font-size: 22px; text-shadow: 0 2px 4px #000; }
.tl .tick { position: absolute; top: 196px; width: 4px; height: 36px; transform: translateX(-50%); background: #fff3c8; border-radius: 2px; }
.tray { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; width: min(1200px, calc(var(--vw, 1vw) * 96)); margin: 18px auto 0; min-height: 90px; }
.tcard {
  width: 160px; min-height: 84px; padding: 10px 12px; border-radius: 14px; background: linear-gradient(180deg, #fffaf0, #f0dcae);
  box-shadow: 0 4px 0 #b98d3c, 0 8px 16px rgba(0, 0, 0, .4); font-weight: 900; font-size: 18px; text-align: center; display: grid; place-items: center;
  cursor: grab; touch-action: none; transition: transform .12s;
}
.tcard.sel { box-shadow: 0 0 0 4px var(--gold), 0 8px 20px rgba(255, 200, 80, .6); transform: translateY(-4px); }
.tcard.dragging { position: fixed; z-index: 60; pointer-events: none; transform: rotate(-3deg) scale(1.06); }

/* ---------- result ---------- */
.result .big-title { font-size: 46px; font-weight: 900; margin: 0; text-align: center; }
.result .big-title.win { color: #c27a00; text-shadow: 0 3px 0 #ffe7a0; }
.result .big-title.lose { color: #8d2a24; }
.result .rstars { font-size: 64px; text-align: center; letter-spacing: 8px; margin: 6px 0; }
.result .rstars span { display: inline-block; color: #d9c49c; transform: scale(.6); transition: transform .3s cubic-bezier(.2, 1.6, .4, 1), color .2s; }
.result .rstars span.on { color: #ffb400; transform: scale(1); text-shadow: 0 0 18px rgba(255, 180, 0, .9); }
.result .stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 12px 0; }
.result .stat { text-align: center; padding: 10px; border-radius: 14px; background: rgba(0, 0, 0, .06); font-weight: 900; }
.result .stat b { display: block; font-size: 30px; }
.loot { display: flex; justify-content: center; gap: 18px; margin: 10px 0 4px; }
.loot .pill { font-size: 24px; }
.wrong-list { margin-top: 12px; border-radius: 14px; background: rgba(214, 69, 65, .08); padding: 10px 14px; }
.wrong-list summary { cursor: pointer; font-weight: 900; color: #8d2a24; font-size: 18px; }
.wrong-item { padding: 8px 0; border-top: 1px dashed rgba(0, 0, 0, .15); font-size: 16px; line-height: 1.5; }
.wrong-item .ans { color: #1d7a45; font-weight: 900; }

/* ---------- gacha & cards ---------- */
.gacha { text-align: center; }
.orb-stage { position: relative; height: 380px; display: grid; place-items: center; }
.orb {
  width: 190px; height: 190px; border-radius: 50%; display: grid; place-items: center; font-size: 86px;
  background: radial-gradient(circle at 35% 30%, #fff, #ffe39a 30%, #e3a52d 70%, #8a5b10); box-shadow: 0 0 40px rgba(255, 210, 90, .8), inset 0 -10px 30px rgba(0, 0, 0, .25);
  animation: float 2.4s ease-in-out infinite;
}
@keyframes float { 50% { transform: translateY(-12px); } }
.orb.shake { animation: orbshake .12s linear infinite; }
@keyframes orbshake { 25% { transform: translate(-6px, 2px) rotate(-6deg); } 75% { transform: translate(6px, -2px) rotate(6deg); } }
.beam { position: absolute; inset: 0; pointer-events: none; opacity: 0; background: conic-gradient(from 0deg, transparent 0 10deg, var(--bc, #fff) 12deg 16deg, transparent 18deg 40deg, var(--bc, #fff) 42deg 46deg, transparent 48deg 70deg, var(--bc, #fff) 72deg 76deg, transparent 78deg); mask: radial-gradient(circle, #000 20%, transparent 70%); -webkit-mask: radial-gradient(circle, #000 20%, transparent 70%); }
.beam.on { animation: beam 1.4s ease-out forwards; }
@keyframes beam { 0% { opacity: 0; transform: rotate(0) scale(.4); } 30% { opacity: 1; } 100% { opacity: 0; transform: rotate(90deg) scale(1.6); } }

.card3d { width: 230px; height: 320px; perspective: 1000px; cursor: pointer; display: inline-block; }
.card3d .inner { position: relative; width: 100%; height: 100%; transition: transform .7s; transform-style: preserve-3d; }
.card3d.flipped .inner { transform: rotateY(180deg); }
.card3d .face { position: absolute; inset: 0; border-radius: 18px; backface-visibility: hidden; -webkit-backface-visibility: hidden; overflow: hidden; }
.card3d .back { transform: rotateY(180deg); }
.cface { display: flex; flex-direction: column; align-items: center; padding: 14px; color: #fff; text-align: center; }
.cface .r { align-self: flex-start; font-weight: 900; font-size: 18px; padding: 2px 10px; border-radius: 8px; background: rgba(0, 0, 0, .3); }
.cface .ic { font-size: 96px; line-height: 1.2; margin-top: 8px; filter: drop-shadow(0 6px 10px rgba(0, 0, 0, .4)); }
.cface .nm { font-size: 28px; font-weight: 900; margin-top: 4px; text-shadow: 0 2px 4px rgba(0, 0, 0, .5); }
.cface .tt { font-size: 15px; font-weight: 700; opacity: .92; }
.cface .bf { margin-top: auto; font-size: 14px; font-weight: 900; padding: 4px 10px; border-radius: 10px; background: rgba(0, 0, 0, .3); }
.cback { padding: 18px 16px; text-align: left; color: var(--ink); background: linear-gradient(180deg, #fffaf0, #f0dcae); }
.cback h4 { margin: 0 0 8px; font-size: 22px; }
.cback ul { margin: 0; padding-left: 20px; font-size: 16px; font-weight: 700; line-height: 1.6; }
.rar-N { background: linear-gradient(160deg, #9aa3ad, #59626b); box-shadow: inset 0 0 0 5px #c8ced4; }
.rar-R { background: linear-gradient(160deg, #5aa9f0, #1f5fa8); box-shadow: inset 0 0 0 5px #9fd0ff; }
.rar-SR { background: linear-gradient(160deg, #c27cf2, #6a2ea0); box-shadow: inset 0 0 0 5px #e3b8ff; }
.rar-SSR { background: linear-gradient(160deg, #ffe27a, #f39c12 45%, #c0392b); box-shadow: inset 0 0 0 5px #fff1b8, 0 0 30px rgba(255, 190, 60, .9); animation: ssr 2.5s linear infinite; }
@keyframes ssr { 50% { filter: brightness(1.15) saturate(1.2); } }
.newtag { position: absolute; top: 10px; right: 10px; z-index: 3; padding: 2px 10px; border-radius: 8px; background: #ff3b6b; color: #fff; font-weight: 900; transform: rotate(8deg); }

.coll-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; margin-top: 12px; }
.mini { position: relative; height: 200px; border-radius: 14px; display: flex; flex-direction: column; align-items: center; justify-content: center; color: #fff; cursor: pointer; text-align: center; padding: 8px; }
.mini .ic { font-size: 58px; }
.mini .nm { font-weight: 900; font-size: 18px; }
.mini .cnt { position: absolute; bottom: 6px; right: 10px; font-weight: 900; font-size: 14px; opacity: .9; }
.mini.unknown { background: repeating-linear-gradient(45deg, #3b2c1a, #3b2c1a 10px, #2f2314 10px, #2f2314 20px); color: #8c7653; box-shadow: inset 0 0 0 3px #5a4325; cursor: default; }
.mini.unknown .ic { filter: brightness(0) opacity(.35); }

/* 卡圖：插畫滿版，上面疊稀有度外框（::after）和閃卡光澤（::before，SR、SSR） */
.cface.art, .mini.art { --rc: #c8ced4; padding: 0; justify-content: flex-end; }
.cface.art.rar-R, .mini.art.rar-R { --rc: #9fd0ff; }
.cface.art.rar-SR, .mini.art.rar-SR { --rc: #e3b8ff; }
.cface.art.rar-SSR, .mini.art.rar-SSR { --rc: #ffe08a; }
.cface.art .pic, .mini.art .pic { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cface.art::after, .mini.art::after { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: 2;
  box-shadow: inset 0 0 0 5px var(--rc), inset 0 0 0 7px rgba(0, 0, 0, .45), inset 0 0 24px rgba(0, 0, 0, .35); }
.cface.art.rar-SSR::after, .mini.art.rar-SSR::after { box-shadow: inset 0 0 0 6px var(--rc), inset 0 0 0 8px #b86b00, inset 0 0 0 10px rgba(255, 240, 190, .7), inset 0 0 30px rgba(255, 190, 60, .45); }
.cface.art.rar-SR::before, .cface.art.rar-SSR::before, .mini.art.rar-SR:not(.unknown)::before, .mini.art.rar-SSR:not(.unknown)::before {
  content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: linear-gradient(115deg, transparent 38%, rgba(255, 230, 255, .22) 45%, rgba(255, 255, 255, .42) 50%, rgba(230, 200, 255, .22) 55%, transparent 62%) 0 0 / 300% 100%;
  animation: foil 3.2s ease-in-out infinite; }
/* 不用 mix-blend-mode：翻面時會讓正面的 backface-visibility 失效 */
.cface.art.rar-SSR::before, .mini.art.rar-SSR:not(.unknown)::before { animation-duration: 2.4s;
  background-image: linear-gradient(115deg, transparent 34%, rgba(255, 236, 160, .3) 43%, rgba(255, 255, 230, .55) 49%, rgba(255, 200, 120, .3) 55%, transparent 64%); }
@keyframes foil { 0% { background-position: 100% 0; } 60%, 100% { background-position: 0 0; } }
.cface.art .r { position: absolute; top: 12px; left: 12px; z-index: 3; background: rgba(0, 0, 0, .55); box-shadow: 0 0 0 2px var(--rc); }
.cface.art .plate { position: relative; z-index: 3; align-self: stretch; padding: 46px 14px 14px; display: flex; flex-direction: column; align-items: center; gap: 2px;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, .62) 38%, rgba(0, 0, 0, .86)); border-radius: 0 0 18px 18px; }
.cface.art .nm { margin: 0; font-size: 26px; text-shadow: 0 2px 6px rgba(0, 0, 0, .9); }
.cface.art .tt { color: var(--rc); text-shadow: 0 1px 3px #000; }
.cface.art .bf { margin-top: 6px; background: rgba(255, 255, 255, .16); }
.cback.art { background-position: center; background-size: cover; }
.mini.art { overflow: hidden; }
.mini.art .r { position: absolute; top: 8px; left: 8px; z-index: 3; padding: 0 7px; border-radius: 6px; font-size: 12px; font-weight: 900; background: rgba(0, 0, 0, .6); box-shadow: 0 0 0 1.5px var(--rc); }
.mini.art .cnt { top: 8px; bottom: auto; right: 9px; z-index: 3; padding: 0 6px; border-radius: 6px; background: rgba(0, 0, 0, .6); opacity: 1; }
.mini.art .nm { position: relative; z-index: 3; align-self: stretch; padding: 26px 6px 10px; font-size: 16px; line-height: 1.2; text-shadow: 0 1px 4px #000;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, .8)); border-radius: 0 0 14px 14px; }
.mini.art.unknown { background: #1d1610; box-shadow: none; cursor: default; }
.mini.art.unknown .pic { filter: grayscale(.85) brightness(.5) blur(4px); transform: scale(1.1); }
.mini.art.unknown::after { box-shadow: inset 0 0 0 3px color-mix(in srgb, var(--rc) 45%, #000), inset 0 0 30px rgba(0, 0, 0, .6); }
.mini.art.unknown .nm { color: #c9b48a; font-size: 22px; }
.mini.art:not(.unknown):hover { transform: translateY(-3px); transition: transform .15s; }

/* ---------- shop / parent ---------- */
.shop-item { display: flex; align-items: center; gap: 16px; padding: 14px 16px; border-radius: 16px; background: rgba(255, 255, 255, .6); box-shadow: inset 0 0 0 2px #e3c88a; margin-top: 10px; }
.shop-item .nm { flex: 1; font-size: 22px; font-weight: 900; }
.shop-item .cost { font-weight: 900; font-size: 20px; }
.voucher { margin: 14px auto 0; padding: 18px; max-width: 460px; border-radius: 16px; border: 3px dashed #b9821f; background: #fffdf4; text-align: center; font-weight: 900; font-size: 22px; }
.st { display: inline-block; padding: 1px 10px; border-radius: 999px; font-size: 13px; font-weight: 900; color: #fff; }
.st.pending { background: #e67e22; } .st.ok { background: var(--green); } .st.no { background: #999; }
.pinpad { display: grid; grid-template-columns: repeat(3, 76px); gap: 12px; justify-content: center; margin-top: 12px; }
.pinpad button { height: 64px; border-radius: 16px; font-size: 28px; font-weight: 900; background: #fff; box-shadow: 0 3px 0 #c9a96b; }
.pindots { text-align: center; font-size: 34px; letter-spacing: 12px; margin-top: 8px; }
.tabs { display: flex; gap: 8px; margin: 8px 0 14px; flex-wrap: wrap; }
.tabs button { padding: 8px 16px; border-radius: 999px; font-weight: 900; font-size: 16px; background: rgba(0, 0, 0, .08); color: var(--ink); }
.tabs button.on { background: var(--ink); color: #fff; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 16px; }
table.tbl td, table.tbl th { padding: 8px; border-bottom: 1px solid rgba(0, 0, 0, .1); text-align: left; }
input.inp { font: inherit; font-size: 18px; padding: 8px 12px; border-radius: 10px; border: 2px solid #d6b878; background: #fff; }

/* ---------- guide ---------- */
.guide .slide { position: relative; background: #000; border-radius: 14px; overflow: hidden; }
.guide .slide img { display: block; width: 100%; }
.guide .nav { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 10px; font-weight: 900; }
.guide .kx img { width: 100%; border-radius: 8px; margin-bottom: 10px; box-shadow: 0 2px 10px rgba(0, 0, 0, .2); }
.guide .sum { white-space: pre-wrap; font-size: 17px; line-height: 1.7; background: rgba(255, 255, 255, .5); padding: 12px 16px; border-radius: 12px; margin-bottom: 12px; }
.buffbar { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 12px; background: #fff3c4; font-weight: 900; }

/* ---------- 攻城戰 ---------- */
.war { position: absolute; inset: 0; overflow: hidden; background: #245d80; }
.war-svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.war-banner {
  position: absolute; left: 50%; top: 64px; transform: translateX(-50%); width: min(900px, calc(var(--vw, 1vw) * 78)); text-align: center; pointer-events: none;
  padding: 10px 22px; border-radius: 18px; background: rgba(255, 248, 228, .95); box-shadow: var(--shadow), inset 0 0 0 4px #e3bb5c;
}
.wb-t { font-size: clamp(20px, calc(var(--vw, 1vw) * 2.2), 30px); font-weight: 900; line-height: 1.3; }
.wb-s { font-size: 16px; font-weight: 800; color: var(--ink-2); margin-top: 2px; }
/* 公民虛構地圖（.fiction）在手機上：橫拿時題目框移到最上面、地圖用滿；直拿時提醒橫過來 */
@media (max-height: 500px) {
  .war.fiction .war-banner { top: 5px; left: calc(50% + 95px); width: calc(calc(var(--vw, 1vw) * 100) - 210px); padding: 5px 14px; border-radius: 12px; }
  .war.fiction .wb-t { font-size: 15px; line-height: 1.25; }
  .war.fiction .wb-s { font-size: 12px; margin-top: 0; }
  .war.fiction .war-name { font-size: 19px; }
  #s-play:has(.war.fiction) #play-title { display: none; }
}
@media (orientation: portrait) and (max-width: 600px) {
  .war.fiction::after { content: "把手機橫過來，地圖會比較大"; position: absolute; left: 50%; bottom: 14%; transform: translateX(-50%); white-space: nowrap; padding: 8px 16px; border-radius: 999px; background: rgba(255, 248, 228, .95); font-weight: 900; font-size: 16px; color: #3a2208; pointer-events: none; }
}
.war-panel {
  position: absolute; left: 50%; bottom: 16px; transform: translate(-50%, 140%); width: min(1000px, calc(var(--vw, 1vw) * 92)); max-height: calc(var(--vh, 1vh) * 42); overflow: auto;
  padding: 14px 20px 16px; border-radius: 22px; background: rgba(255, 248, 228, .97); box-shadow: var(--shadow), inset 0 0 0 4px #e3bb5c;
  transition: transform .35s cubic-bezier(.2, 1.2, .4, 1);
}
.war-panel:not(.on) { opacity: 0; pointer-events: none; }
.war-panel.on { transform: translate(-50%, 0); }
.wp-n { font-size: 15px; font-weight: 900; color: var(--gold-d); }
.wp-q { font-size: clamp(20px, calc(var(--vw, 1vw) * 2.1), 28px); font-weight: 900; margin: 4px 0 10px; line-height: 1.4; }
.wp-o { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.war-opt-btn {
  display: flex; align-items: center; gap: 10px; text-align: left; padding: 10px 14px; border-radius: 14px; background: #fff;
  box-shadow: 0 4px 0 #c9a96b, inset 0 0 0 3px #e3c88a; font-size: clamp(17px, calc(var(--vw, 1vw) * 1.7), 22px); font-weight: 800; color: var(--ink); transition: transform .1s;
}
.war-opt-btn b { flex: none; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--gold); color: #3a2208; }
.war-opt-btn:hover:not(:disabled) { transform: translateY(-2px); }
.war-opt-btn.right { background: #dff6e7; box-shadow: 0 4px 0 #3c9c64, inset 0 0 0 3px #4cc982; }
.war-opt-btn.wrong { background: #fde3e1; box-shadow: 0 4px 0 #b03a32, inset 0 0 0 3px #e5675f; }
.war-name { font-weight: 900; fill: #2b1d0e; paint-order: stroke; stroke: #fff8e6; stroke-width: 4px; stroke-linejoin: round; pointer-events: none; }
.war-river { fill: #1d5f86; font-weight: 900; font-style: italic; paint-order: stroke; stroke: #e9f6ff; stroke-width: 3px; opacity: .85; pointer-events: none; }
.war-city .castle { stroke: #2b1d0e; stroke-width: 2; }
.siege .war-city:not(.focus) { opacity: .25; }
.siege .war-city:not(.focus) .war-name { display: none; }
.war-city .dot { stroke: #fff; stroke-width: 3; }
.war-city .flip, .war-city .big, .war-pop, .war-army, .war-opt .ring { transform-box: fill-box; transform-origin: center; }
.war-city .flip { animation: wflip .8s; }
.war-city .big { transform: scale(2.3); transition: transform .4s; }
@keyframes wflip { 40% { transform: scale(1.9); } }
.war-pop { animation: wpop .9s ease-out forwards; pointer-events: none; }
@keyframes wpop { from { transform: scale(.4); opacity: 0; } 30% { transform: scale(1.15); opacity: 1; } to { transform: translateY(-14px); opacity: 0; } }
.war-army { transform-origin: center bottom; }
.war-army.fall { animation: wfall .6s forwards; }
@keyframes wfall { to { transform: rotate(80deg) translateY(6px); opacity: 0; } }
.war-army.flee { animation: wflee .8s forwards; }
@keyframes wflee { to { transform: translateY(-20px) scale(.6); opacity: 0; } }
.war-opt { cursor: pointer; }
.war-opt .ring { fill: rgba(255, 213, 107, .28); stroke: #ffd56b; stroke-width: 5; animation: wring 1.1s ease-in-out infinite; }
.war-opt.hint .ring { stroke: #4cc982; fill: rgba(76, 201, 130, .35); }
.war-opt.no { opacity: .6; cursor: default; }
.war-opt.no .ring { animation: none; stroke: #e5675f; fill: rgba(229, 103, 95, .2); }
@keyframes wring { 50% { transform: scale(1.25); } }
/* 光圈底下深色的邊（跟著光圈一起放大縮小）＋點到別的地方時光圈閃一下（地理 🚩12，2026-11-17） */
.war-opt .ring-edge { fill: none; stroke: rgba(58, 34, 8, .72); stroke-width: 9; pointer-events: none; transform-box: fill-box; transform-origin: center; animation: wring 1.1s ease-in-out infinite; }
.war-opt.no .ring-edge { animation: none; stroke: rgba(58, 34, 8, .45); }
.flash .war-opt:not(.no) .ring { stroke-width: 8; fill: rgba(255, 190, 40, .5); animation-duration: .42s; }
.flash .war-opt:not(.no) .ring-edge { stroke: rgba(58, 34, 8, .95); stroke-width: 14; animation-duration: .42s; }
/* 地圖題的提示泡泡（直拿時用）：畫在地圖畫面裡，高度由 siege.js 算，避開光圈和選項的名字（歷史 🚩33，2026-11-17）。--k 把整頁的縮放抵回來，字才不會變小 */
.war-tip {
  position: absolute; left: 0; right: 0; top: 42%; width: fit-content; max-width: 92%; margin: 0 auto; box-sizing: border-box; text-align: center; pointer-events: none;
  padding: calc(10px * var(--k, 1)) calc(22px * var(--k, 1)); border-radius: 999px; background: var(--glass); color: #fff; font-weight: 900;
  font-size: calc(18px * var(--k, 1)); box-shadow: var(--shadow); animation: toast 2.6s forwards;
}

/* ---------- 新玩法：議事廳、比較表、時空博物館、時空偵探、謊言怪 ---------- */
.scene { position: absolute; inset: 0; overflow: hidden; background: #1d1309 center / cover no-repeat; }
.scene::before { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0, 0, 0, .45), rgba(0, 0, 0, .1) 30%, rgba(0, 0, 0, .55)); pointer-events: none; }
.scene button:disabled { color: var(--ink); cursor: default; }
.explain-card p { margin: 0 0 8px; }
.explain-card p.impact { padding: 8px 12px; border-radius: 12px; background: #fff3d6; font-size: .92em; }
@keyframes hintGlow { 50% { box-shadow: 0 5px 0 #b9821f, inset 0 0 0 3px #e3bb5c, 0 0 0 7px rgba(255, 214, 107, .9); } }

/* 議事廳 */
.cn-ruler { position: absolute; left: 1.5%; bottom: 0; width: 24%; display: flex; flex-direction: column; align-items: center; }
.cn-ruler img { height: min(calc(var(--vh, 1vh) * 56), 460px); max-width: 100%; object-fit: contain; filter: drop-shadow(0 10px 18px rgba(0, 0, 0, .5)); }
.cn-ruler .nm { position: absolute; bottom: 14px; padding: 6px 18px; border-radius: 999px; background: var(--paper); box-shadow: inset 0 0 0 3px var(--gold-d); font-weight: 900; font-size: 20px; }
.cn-bubble { position: absolute; left: 27%; right: 272px; top: 76px; padding: 14px 22px; border-radius: 22px; background: rgba(255, 250, 236, .97); box-shadow: var(--shadow), inset 0 0 0 4px #e3bb5c; }
.cn-bubble::before { content: ""; position: absolute; left: -24px; bottom: 22px; border-top: 14px solid transparent; border-bottom: 14px solid transparent; border-right: 26px solid rgba(255, 250, 236, .97); }
.cn-bubble.pop { animation: pop .28s cubic-bezier(.2, 1.4, .4, 1); }
.cn-bubble .yr { display: inline-block; padding: 2px 12px; border-radius: 999px; background: var(--ink); color: var(--gold); font-weight: 900; font-size: 15px; }
.cn-bubble .t { font-size: clamp(22px, calc(var(--vw, 1vw) * 2.3), 32px); font-weight: 900; line-height: 1.4; margin-top: 6px; }
.cn-bubble .sub { margin-top: 6px; font-size: 16px; font-weight: 900; color: var(--ink-2); }
/* 議事廳／會診：這一步有自己的問句（scenes.js 在泡泡加 hasq）時，上面那段是處境（.t）、下面那行才是真正要問的（.sub）。
   問句要是泡泡裡最醒目的一行：比處境大、深色字、淡黃底、前面加 ❓；處境小一點、淡一點。沒有 hasq 時上面那段本身就是題目（例如英文的填空句），照原樣。
   家長 2026-11-14：「真正的問題只用深紅色小字寫在說明下方，導致學生不知道題目在問什麼」「主要問題用深紅色小字的都調整一下」。原本問句 16px 金褐色（手機 26px 咖啡色，國文、地科自己設成紅褐色），處境 32px。
   手機橫拿的字級在 tools/build_share.py，各科直拿在 tools/*_portrait.py；各科不要再把 .sub 改小或改成紅褐色 */
.cn-bubble.hasq .t { font-size: clamp(18px, calc(var(--vw, 1vw) * 1.8), 24px); font-weight: 800; color: #5a4630; }
.cn-bubble.hasq .sub { margin-top: 8px; padding: 6px 12px; border-radius: 10px; background: #fff1c2; box-shadow: inset 5px 0 0 #e3a21a; color: var(--ink); font-size: clamp(22px, calc(var(--vw, 1vw) * 2.3), 32px); line-height: 1.35; }
.cn-bubble.hasq .sub::before { content: "❓ "; }
.cn-advisors { position: absolute; left: 27%; right: 272px; bottom: 18px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; align-items: end; }
.cn-adv { display: flex; flex-direction: column; align-items: center; background: none; padding: 0; text-align: left; transition: transform .15s; }
.cn-adv img { position: relative; z-index: 1; height: min(calc(var(--vh, 1vh) * 19), 150px); max-width: 100%; object-fit: contain; filter: drop-shadow(0 6px 10px rgba(0, 0, 0, .5)); margin-bottom: -8px; }
.cn-adv .who { position: relative; z-index: 2; padding: 2px 12px; border-radius: 999px; background: var(--ink); color: #fff; font-weight: 900; font-size: 15px; margin-bottom: -10px; }
.cn-adv .say { width: 100%; min-height: 6.4em; display: flex; gap: 8px; padding: 18px 14px 12px; border-radius: 16px; background: #fffaf0; box-shadow: 0 5px 0 #b9821f, inset 0 0 0 3px #e3bb5c; font-size: clamp(16px, calc(var(--vw, 1vw) * 1.45), 21px); font-weight: 800; line-height: 1.45; color: var(--ink); }
.cn-adv.plain .say { min-height: 5em; padding-top: 14px; }
.cn-adv .say b { flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--gold); font-size: 15px; }
.cn-adv:hover:not(:disabled) { transform: translateY(-4px); }
.cn-adv.wrong .say { background: #fdeceb; box-shadow: 0 5px 0 #8e2320, inset 0 0 0 3px #e5675f; opacity: .7; }
.cn-adv.right .say { background: #e9fbef; box-shadow: 0 5px 0 #1b6e40, inset 0 0 0 3px #4cc982; }
.cn-adv.hint .say { animation: hintGlow 1s infinite; }
.cn-notes { position: absolute; right: 16px; top: 76px; bottom: 18px; width: 240px; padding: 12px 14px; border-radius: 16px; background: rgba(246, 236, 214, .96); box-shadow: var(--shadow), inset 0 0 0 3px #b9821f; overflow: auto; }
.cn-notes .hd { font-weight: 900; font-size: 18px; margin-bottom: 8px; }
.cn-notes ol { margin: 0; padding-left: 1.3em; display: grid; gap: 8px; }
.cn-notes li { font-size: 16px; font-weight: 800; line-height: 1.45; border-radius: 8px; }
.cn-notes li.new { animation: noteIn .9s; background: #fff1b8; }
@keyframes noteIn { from { transform: translateX(30px); opacity: 0; } 40% { transform: none; opacity: 1; } }

/* 比較表 */
.cmp-head { position: absolute; left: 0; right: 0; top: 72px; text-align: center; color: #ffe7b0; font-weight: 900; font-size: 22px; text-shadow: 0 2px 4px #000; }
.cmp-table { position: absolute; left: 0; right: 0; top: 112px; margin: 0 auto; width: min(1100px, calc(var(--vw, 1vw) * 94)); display: grid; gap: 6px; padding: 10px; border-radius: 18px; background: rgba(246, 236, 214, .97); box-shadow: var(--shadow); }
.cmp-table .colh { text-align: center; font-weight: 900; font-size: 22px; padding: 6px; border-radius: 10px; background: var(--ink); color: var(--gold); }
.cmp-table .rowh { display: grid; place-items: center; text-align: center; font-weight: 900; font-size: 17px; padding: 6px; border-radius: 10px; background: #ead9b4; }
.cmp-table .cell { min-height: 50px; display: grid; place-items: center; padding: 6px 10px; border-radius: 10px; border: 3px dashed #c9a86a; background: rgba(255, 255, 255, .55); font-size: 16px; font-weight: 800; text-align: center; cursor: pointer; }
.cmp-table .cell.filled { border-style: solid; border-color: #4cc982; background: #e9fbef; cursor: default; animation: pop .25s; }
.cmp-table .cell.shake { animation: shake .4s; border-color: #e5675f; }
.cmp-table.done { box-shadow: var(--shadow), 0 0 0 6px #ffd56b; }
.cmp-tray { position: absolute; left: 0; right: 0; bottom: 14px; margin: 0 auto; width: min(1100px, calc(var(--vw, 1vw) * 94)); display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.cmp-card { padding: 8px 14px; border-radius: 12px; background: #fffaf0; box-shadow: 0 4px 0 #b9821f; font-size: 16px; font-weight: 800; color: var(--ink); transition: transform .12s; }
.cmp-card.sel { background: #ffd56b; transform: translateY(-4px); box-shadow: 0 4px 0 #8a5a10, 0 0 0 4px #fff; }
/* 比較表卡片太多、會把表格擠到要捲時：放不下的卡片先排隊不顯示，放對一張補一張；標題那一行寫還有幾張（scenes.js compare 的 deal，2026-11-12） */
.cmp-card.wait { display: none; }

/* 時空博物館 */
.mu-prog { position: absolute; left: 0; right: 0; top: 72px; margin: 0 auto; width: max-content; max-width: calc(var(--vw, 1vw) * 94); padding: 8px 22px; border-radius: 999px; background: rgba(43, 29, 14, .86); color: #ffe7b0; font-weight: 900; font-size: 20px; }
.mu-ped { position: absolute; left: 0; right: 0; top: 118px; display: flex; flex-direction: column; align-items: center; }
.mu-ped img { height: min(calc(var(--vh, 1vh) * 36), 320px); max-width: calc(var(--vw, 1vw) * 60); object-fit: contain; filter: drop-shadow(0 14px 18px rgba(0, 0, 0, .45)); }
.mu-ped .plate { margin-top: 6px; padding: 6px 26px; border-radius: 10px; background: linear-gradient(180deg, #f6d77a, #c9952f); color: #3b2508; font-weight: 900; font-size: clamp(22px, calc(var(--vw, 1vw) * 2.2), 30px); box-shadow: 0 4px 0 #7a4b12; }
.mu-ped.in { animation: pop .35s cubic-bezier(.2, 1.4, .4, 1); }
.mu-ped.fly { animation: muFly .5s forwards; }
@keyframes muFly { to { transform: translateY(80px) scale(.3); opacity: 0; } }
.mu-doors { position: absolute; left: 4%; right: 4%; bottom: 18px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.mu-door { position: relative; padding: 12px 10px; border-radius: 22px 22px 12px 12px; background: linear-gradient(180deg, color-mix(in srgb, var(--c) 45%, #fff), var(--c)); color: #fff; box-shadow: 0 6px 0 rgba(0, 0, 0, .35), inset 0 0 0 3px rgba(255, 255, 255, .55); text-shadow: 0 2px 3px rgba(0, 0, 0, .45); transition: transform .15s; }
.mu-door:hover { transform: translateY(-4px); }
.mu-door .ic { font-size: 38px; line-height: 1.1; }
.mu-door .lb { font-size: clamp(22px, calc(var(--vw, 1vw) * 2.2), 30px); font-weight: 900; }
.mu-door .era { font-size: 16px; font-weight: 800; }
.mu-door .k { position: absolute; left: 12px; top: 10px; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: rgba(0, 0, 0, .3); font-size: 15px; }
.mu-door.wrong { animation: shake .4s; }
.mu-door.tried { opacity: .42; filter: grayscale(.7); cursor: not-allowed; transform: none; }
.mu-door.hint { animation: hintDoor 1s infinite; }
@keyframes hintDoor { 50% { box-shadow: 0 6px 0 rgba(0, 0, 0, .35), inset 0 0 0 3px rgba(255, 255, 255, .55), 0 0 0 7px rgba(255, 214, 107, .95); } }
.mu-placard { display: grid; grid-template-columns: 110px 1fr auto; gap: 14px; align-items: center; }
.mu-placard > img { width: 110px; height: 110px; object-fit: contain; }
.mu-placard .when { font-weight: 900; color: var(--gold-d); font-size: .9em; margin-bottom: 4px; }
.mini-tw { width: 110px; height: auto; }
.mu-hall { position: absolute; left: 3%; right: 3%; top: 118px; bottom: 18px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.mu-hall .room { padding: 10px; border-radius: 18px; background: rgba(255, 250, 236, .96); box-shadow: var(--shadow), inset 0 0 0 4px var(--c); overflow: auto; }
.mu-hall .hd { display: flex; flex-direction: column; align-items: center; font-weight: 900; font-size: 22px; color: var(--c); }
.mu-hall .hd span { font-size: 14px; color: var(--ink-2); }
.mu-hall .row { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 6px; }
.mu-hall figure { margin: 0; width: 46%; text-align: center; }
.mu-hall figure img { width: 100%; height: 86px; object-fit: contain; }
.mu-hall figcaption { font-weight: 900; font-size: 15px; }

/* 時空偵探 */
.dt-top { position: absolute; left: 3%; right: 3%; top: 70px; display: flex; justify-content: space-between; color: #ffe7b0; font-weight: 900; font-size: 22px; text-shadow: 0 2px 4px #000; }
.dt-file { position: absolute; left: 3%; top: 110px; bottom: 18px; width: 52%; padding: 18px 22px; border-radius: 6px 18px 18px 6px; background: #f8efd8; box-shadow: var(--shadow), inset 0 0 0 2px #d8c08a; overflow: auto; }
.dt-file .kind { font-weight: 900; font-size: 22px; color: #7a4b12; }
.dt-file .doc { margin-top: 10px; font-family: "Kaiti TC", "BiauKai", "STKaiti", "DFKai-SB", var(--font); font-size: clamp(21px, calc(var(--vw, 1vw) * 2), 28px); line-height: 1.75; color: #3b2508; }
.dt-file .note { margin-top: 4px; font-size: 14px; color: var(--ink-2); }
/* 地理讀圖題的小圖（等高線、剖面圖）：劇本裡的 SVG */
.dt-fig { margin: 10px 0 2px; padding: 8px; border-radius: 12px; background: #fffaf0; box-shadow: inset 0 0 0 2px #e3cf9c; }
.dt-fig svg { display: block; width: 100%; max-height: 220px; }
/* 偵探關的附圖點一下放大（2026-11-13）：手機橫拿時小圖上的字看不清楚 */
.dt-fig { cursor: zoom-in; }
.dt-zoom { position: absolute; inset: 0; z-index: 6; display: grid; place-items: center; align-content: center; gap: 10px; background: rgba(10, 6, 2, .82); cursor: zoom-out; animation: fadein .15s; }
.dt-zoom-in { width: min(96%, 1240px); padding: 12px; border-radius: 16px; background: #fffaf0; box-shadow: var(--shadow); }
.dt-zoom-in svg { display: block; width: 100%; height: auto; max-height: calc(var(--vh, calc(var(--vh, 1vh) * 1)) * 78); }
.dt-zoom-x { color: #ffe7b0; font-weight: 900; font-size: 20px; text-shadow: 0 2px 4px #000; }
.war-range { fill: #6b4521; font-weight: 900; paint-order: stroke; stroke: #fff6e0; stroke-width: 3px; opacity: .8; pointer-events: none; letter-spacing: 2px; }
.dt-clues { display: grid; gap: 8px; margin-top: 14px; }
.dt-clue { text-align: left; padding: 10px 14px; border-radius: 12px; background: #3b2508; color: #ffe7b0; font-weight: 900; font-size: 18px; box-shadow: 0 4px 0 #1d1309; }
.dt-clue .face { display: none; }
.dt-clue.open { background: #fff6dc; color: var(--ink); box-shadow: inset 0 0 0 3px #e3bb5c; cursor: default; }
.dt-clue.open .back { display: none; }
.dt-clue.open .face { display: block; font-weight: 800; line-height: 1.45; animation: fadein .3s; }
.dt-ask { position: absolute; right: 3%; top: 110px; bottom: 18px; width: 40%; display: flex; flex-direction: column; gap: 10px; padding: 16px 18px; border-radius: 18px; background: rgba(255, 250, 236, .97); box-shadow: var(--shadow), inset 0 0 0 4px #e3bb5c; overflow: auto; }
.dt-ask .q { font-size: clamp(20px, calc(var(--vw, 1vw) * 1.9), 26px); font-weight: 900; line-height: 1.4; }
.dt-ask .opts { display: grid; gap: 8px; }
.dt-opt { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 12px; background: #fff; box-shadow: 0 4px 0 #c9a86a, inset 0 0 0 2px #ead39a; text-align: left; font-size: clamp(16px, calc(var(--vw, 1vw) * 1.5), 20px); font-weight: 800; line-height: 1.4; color: var(--ink); }
.dt-opt b { flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--gold); font-size: 15px; }
.dt-opt:hover:not(:disabled) { transform: translateY(-2px); }
.dt-opt.right { background: #e9fbef; box-shadow: 0 4px 0 #1b6e40, inset 0 0 0 3px #4cc982; }
.dt-opt.wrong { background: #fdeceb; box-shadow: 0 4px 0 #8e2320, inset 0 0 0 3px #e5675f; opacity: .75; }
.dt-worth { margin-top: auto; font-weight: 900; color: var(--gold-d); font-size: 16px; }

/* 謊言怪擂台 */
.db-boss { position: absolute; right: 3%; top: 66px; width: 34%; display: flex; flex-direction: column; align-items: center; }
.db-boss .nm { color: #fff; font-weight: 900; font-size: 22px; text-shadow: 0 2px 4px #000; }
.db-boss .hp { width: 80%; height: 16px; margin: 6px 0; border-radius: 999px; background: rgba(0, 0, 0, .45); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .5); overflow: hidden; }
.db-boss .hp i { display: block; height: 100%; background: linear-gradient(90deg, #ff6b5a, #ffb36b); transition: width .4s; }
.db-boss img { height: min(calc(var(--vh, 1vh) * 40), 340px); max-width: 100%; object-fit: contain; filter: drop-shadow(0 12px 20px rgba(0, 0, 0, .6)); animation: float 2.4s ease-in-out infinite; }
.db-boss.hurt img { animation: dbHurt .5s; }
.db-boss.laugh img { animation: dbLaugh .6s; }
.db-boss.dead img { animation: dbDead .9s forwards; }
@keyframes dbHurt { 20% { transform: translateX(-16px) rotate(-7deg); filter: brightness(2.2) drop-shadow(0 0 20px #fff); } 60% { transform: translateX(12px) rotate(5deg); } }
@keyframes dbLaugh { 30% { transform: scale(1.12) rotate(-3deg); } 60% { transform: scale(1.05) rotate(3deg); } }
@keyframes dbDead { to { transform: scale(.2) rotate(40deg); opacity: 0; } }
.db-lie { position: absolute; left: 3%; top: 84px; width: 58%; padding: 16px 24px; border-radius: 24px; background: linear-gradient(180deg, #5b2a86, #3b1659); color: #fff; box-shadow: var(--shadow), inset 0 0 0 4px #c39bff; }
.db-lie::after { content: ""; position: absolute; right: -26px; top: 34px; border-top: 14px solid transparent; border-bottom: 14px solid transparent; border-left: 28px solid #4b2070; }
.db-lie.pop { animation: pop .3s cubic-bezier(.2, 1.4, .4, 1); }
.db-lie .who { font-weight: 900; color: #e7d3ff; font-size: 18px; }
.db-lie .t { margin-top: 6px; font-size: clamp(24px, calc(var(--vw, 1vw) * 2.6), 36px); font-weight: 900; line-height: 1.4; }
.db-hand { position: absolute; left: 3%; right: 3%; bottom: 18px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.db-card { min-height: 9em; padding: 12px 16px; border-radius: 18px; background: linear-gradient(180deg, #fffaf0, #f3e2b8); box-shadow: 0 6px 0 #8a5a10, inset 0 0 0 3px #e3bb5c; text-align: left; color: var(--ink); transition: transform .15s; }
.db-card .top { font-weight: 900; font-size: 16px; color: #7a4b12; }
.db-card .t { margin-top: 8px; font-size: clamp(17px, calc(var(--vw, 1vw) * 1.6), 22px); font-weight: 800; line-height: 1.45; }
.db-card:hover:not(:disabled) { transform: translateY(-8px) rotate(-1deg); }
.db-card.throw { animation: dbThrow .4s forwards; }
@keyframes dbThrow { to { transform: translate(calc(var(--vw, 1vw) * 30), -45vh) scale(.3) rotate(25deg); opacity: 0; } }
.db-card.wrong { background: #fdeceb; box-shadow: 0 6px 0 #8e2320, inset 0 0 0 3px #e5675f; }
.db-card.right { box-shadow: 0 6px 0 #1b6e40, inset 0 0 0 3px #4cc982, 0 0 0 5px #ffd56b; }

@media (max-width: 900px) {
  .cn-notes { display: none; }
  .cn-bubble, .cn-advisors { right: 12px; }
  .cn-ruler { width: 25%; }
  .mu-placard { grid-template-columns: 80px 1fr; }
  .mu-placard .mini-tw { display: none; }
}
.db-lie .ask { display: inline-block; margin-top: 12px; padding: 6px 16px; border-radius: 999px; background: rgba(0, 0, 0, .32); font-size: clamp(19px, calc(var(--vw, 1vw) * 1.8), 24px); font-weight: 900; color: #ffe27a; }
.db-chip { margin: 0 2px; padding: 0 6px; border-radius: 10px; background: rgba(255, 255, 255, .12); box-shadow: inset 0 -3px 0 rgba(255, 226, 122, .7); color: #fff; font: inherit; line-height: 1.5; transition: background .15s; }
.db-chip:hover { background: rgba(255, 255, 255, .25); }
.db-chip.fine { background: rgba(76, 201, 130, .28); box-shadow: none; }
.db-chip.bad { background: rgba(229, 103, 95, .45); box-shadow: none; text-decoration: line-through 4px #ff6b5a; }
.db-chip.hint { animation: chipHint 1s infinite; }
@keyframes chipHint { 50% { background: rgba(255, 214, 107, .6); } }
.mini-world { width: 150px; border-radius: 8px; }
/* 看結果：結算暫時收起來 */
#ov.peek { opacity: 0; pointer-events: none; }
.peek-back { position: absolute; z-index: 30; right: max(18px, env(safe-area-inset-right, 0px)); bottom: max(18px, env(safe-area-inset-bottom, 0px)); }
/* 卡冊：每一關一段，標題在捲動時停在上方 */
.coll-head { position: sticky; top: -2px; z-index: 2; display: flex; align-items: baseline; gap: 10px; margin: 18px 0 8px; padding: 8px 14px; border-radius: 12px; background: #ead9b4; box-shadow: 0 2px 6px rgba(0, 0, 0, .12); font-weight: 900; }
.coll-head.here { background: #ffe7a0; }
.coll-head b { flex: none; padding: 1px 10px; border-radius: 999px; background: var(--ink); color: var(--gold); font-size: 14px; }
.coll-head .t { font-size: 18px; min-width: 0; }
.coll-head .n { margin-left: auto; flex: none; font-size: 15px; color: var(--ink-2); }

/* ---------- 英文聽力挑戰（js/listen.js，英文網站才有） ---------- */
.ls-panel { position: absolute; left: 50%; transform: translateX(-50%); top: 84px; max-height: calc(100% - 98px); width: min(980px, 94%); display: flex; flex-direction: column; gap: 10px; padding: 14px 18px; border-radius: 18px; background: rgba(255, 250, 236, .97); box-shadow: var(--shadow), inset 0 0 0 4px #e3bb5c; overflow: auto; color: var(--ink); }
.ls-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px; font-size: clamp(20px, calc(var(--vw, 1vw) * 1.9), 26px); }
.ls-head .muted { margin-left: auto; font-size: 15px; font-weight: 700; }
.ls-inst { font-size: clamp(16px, calc(var(--vw, 1vw) * 1.5), 19px); font-weight: 700; color: var(--ink-2); }
.ls-audio { display: flex; align-items: center; gap: 12px; padding: 8px 12px; border-radius: 14px; background: #fff; box-shadow: inset 0 0 0 2px #ead39a; }
.ls-play { flex: none; width: 58px; height: 58px; border: 0; border-radius: 50%; background: linear-gradient(180deg, #ffe08a, var(--gold) 55%, var(--gold-d)); box-shadow: 0 4px 0 #7a520f; font-size: 24px; font-weight: 900; color: #3a2208; cursor: pointer; }
.ls-play.on { animation: pulse-ring 1.2s infinite; }
@keyframes pulse-ring { 50% { box-shadow: 0 4px 0 #7a520f, 0 0 0 8px rgba(242, 193, 78, .35); } }
.ls-bar { flex: 1; height: 10px; border-radius: 5px; background: #eadcbc; overflow: hidden; }
.ls-bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #f2c14e, #e08a2b); }
.ls-time { flex: none; font-variant-numeric: tabular-nums; font-weight: 800; color: var(--ink-2); font-size: 15px; }
.btn.ls-again { flex: none; color: var(--ink); background: #fff; box-shadow: inset 0 0 0 2px #b9821f; padding: 6px 14px; font-size: 16px; }
.ls-fig { display: block; max-width: 100%; max-height: calc(var(--vh, 1vh) * 32); margin: 0 auto; border-radius: 10px; background: #fff; }
.ls-opts { display: grid; gap: 8px; }
.ls-opt { width: 100%; cursor: pointer; }
.ls-pics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.ls-pic { position: relative; padding: 6px; border: 0; border-radius: 14px; background: #fff; box-shadow: 0 4px 0 #c9a86a, inset 0 0 0 2px #ead39a; cursor: pointer; }
.ls-pic img { display: block; width: 100%; max-height: calc(var(--vh, 1vh) * 34); object-fit: contain; }
.ls-pic b { position: absolute; left: 10px; top: 10px; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--gold); font-size: 17px; color: var(--ink); }
.ls-pic:hover:not(:disabled) { transform: translateY(-2px); }
.ls-pic.right { background: #e9fbef; box-shadow: 0 4px 0 #1b6e40, inset 0 0 0 4px #4cc982; }
.ls-pic.wrong { background: #fdeceb; box-shadow: 0 4px 0 #8e2320, inset 0 0 0 4px #e5675f; opacity: .75; }
.ls-script { margin: 0 0 10px; padding: 8px 12px; border-radius: 12px; background: #f4efe2; font-family: "Source Serif 4", Georgia, serif; font-size: .95em; line-height: 1.5; white-space: pre-line; }
.ls-script small { display: block; font-family: inherit; font-size: 13px; font-weight: 900; color: var(--ink-2); }
.ls-ans { font-weight: 900; color: #1d8a4c; }

/* 集滿獎勵（家長 2026-11-02）：卡冊裡集滿的章金框、各篇進度、狀態列的稱號、全螢幕慶祝畫面 */
.coll-head.full { background: linear-gradient(90deg, #ffe08a, #f2c14e); box-shadow: inset 0 0 0 3px #b9821f, 0 2px 6px rgba(0, 0, 0, .12); }
.coll-head .full-tag { flex: none; padding: 1px 10px; border-radius: 999px; background: #7a520f; color: #ffe9b0; font-size: 14px; }
.tab-prog { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; padding: 10px 14px; border-radius: 12px; background: #f3e6c6; font-weight: 900; }
.tab-prog .tp { padding: 3px 12px; border-radius: 999px; background: rgba(0, 0, 0, .07); white-space: nowrap; }
.tab-prog .tp.done { background: linear-gradient(180deg, #ffe08a, #f2c14e); box-shadow: inset 0 0 0 2px #b9821f; }
.title-pill { min-width: 0; font-size: 17px; }
.title-pill .tt { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.celebrate { position: fixed; inset: 0; z-index: 95; display: grid; place-items: center; overflow: hidden; cursor: pointer;
  background: radial-gradient(circle at 50% 45%, rgba(60, 38, 8, .55), rgba(8, 5, 2, .88)); animation: fadein .25s; }
.cel-rays { position: absolute; left: 50%; top: 45%; width: 160vmax; height: 160vmax; margin: -80vmax 0 0 -80vmax; pointer-events: none;
  background: repeating-conic-gradient(rgba(255, 214, 107, .22) 0 9deg, transparent 9deg 22deg); animation: celspin 14s linear infinite; }
@keyframes celspin { to { transform: rotate(360deg); } }
.cel-bit { position: absolute; top: -24px; width: 10px; height: 16px; border-radius: 3px; opacity: .9; pointer-events: none; animation: celfall 2.6s linear infinite; }
@keyframes celfall { to { transform: translateY(calc(var(--vh, 1vh) * 110)) rotate(540deg); } }
.cel-box { position: relative; width: min(520px, calc(calc(var(--vw, 1vw) * 100) - 32px)); padding: 26px 22px 20px; border-radius: 26px; text-align: center; color: var(--ink);
  background: linear-gradient(180deg, #fffaf0, #f3e2bb); box-shadow: 0 0 0 4px var(--gold), 0 0 40px 10px rgba(242, 193, 78, .6); animation: pop .45s cubic-bezier(.2, 1.5, .4, 1); }
.cel-ic { font-size: 84px; line-height: 1.1; animation: bob 1.6s ease-in-out infinite; }
.cel-box h2 { margin: 6px 0 8px; font-size: clamp(26px, calc(var(--vw, 1vw) * 6), 36px); font-weight: 900; text-wrap: balance; }
.cel-box p { margin: 4px 0; font-size: 19px; font-weight: 800; }
.cel-tap { margin-top: 14px; color: var(--ink-2); font-size: 15px; font-weight: 700; animation: blink 1.6s infinite; }
@media (prefers-reduced-motion: reduce) { .cel-rays, .cel-bit, .cel-ic, .cel-tap { animation: none; } .cel-bit { display: none; } }
