@font-face { font-family: "Cinzel"; font-weight: 600; src: url(../fonts/cinzel_600.ttf) format("truetype"); font-display: swap; }
@font-face { font-family: "Cinzel"; font-weight: 800; src: url(../fonts/cinzel_800.ttf) format("truetype"); font-display: swap; }

/* 颜色 token（DESIGN §7.10）。游戏只有暗色一套，跟 Android 版一致 */
:root {
  --bg: #0E0D14; --bg2: #14121C; --panel: #1A1724; --panel-hi: #241F31; --line: #342E44;
  --gold: #E8B95A; --gold-hi: #F7DA92; --gold-dim: #9C7A3A;
  --text: #EDE6D6; --dim: #A198B0; --faint: #6E667D; --good: #7CC783; --bad: #E5625B; --blue: #86AEDC;
  --display: "Cinzel", "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", "Segoe UI", sans-serif;
  --en: "Georgia", "Iowan Old Style", "Palatino", serif;
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: #07060A; color: var(--text); font: 15px/1.47 var(--sans); }
body { overscroll-behavior: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
button:disabled { cursor: default; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 22px; font-weight: 700; }
h2 { font-size: 17px; font-weight: 700; }
input, textarea { font: inherit; color: inherit; }

#app {
  position: relative; margin: 0 auto; width: 100%; max-width: 480px; height: 100dvh; overflow: hidden;
  background: var(--bg); display: flex; flex-direction: column;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
@media (min-width: 520px) { #app { box-shadow: 0 0 0 1px #1d1a26, 0 20px 80px rgba(0,0,0,.6); } }
.screen { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; animation: fadein .22s ease; }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
.scroll { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.pad { padding-left: 16px; padding-right: 16px; }
.row { display: flex; align-items: center; }
.row.top { align-items: flex-start; }
.row.bottom { align-items: flex-end; }
.col { display: flex; flex-direction: column; }
.grow { flex: 1; min-width: 0; }
.gap { gap: 10px; }
.gap6 { gap: 6px; }
.wrap { flex-wrap: wrap; }
.center { display: flex; align-items: center; justify-content: center; }
.tc { text-align: center; }
.sp8 { height: 8px; } .sp12 { height: 12px; } .sp16 { height: 16px; } .sp24 { height: 24px; } .sp32 { height: 32px; }
.dim { color: var(--dim); }
.small { font-size: 13px; color: var(--dim); line-height: 1.4; }
.tiny { font-size: 11px; color: var(--faint); line-height: 1.35; }
.num { font-family: var(--display); font-weight: 800; }
.hero { font-family: var(--display); font-weight: 800; color: var(--gold); letter-spacing: 1px; font-size: 34px; line-height: 1.15; }
.en { font-family: var(--en); font-size: 18px; line-height: 1.5; }
.ell { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clamp2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ico { flex: none; display: block; }

/* 背景图与渐隐 */
.bgimg { position: absolute; inset: 0; background-size: cover; background-position: center; pointer-events: none; }
.vignette { position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(180deg, rgba(14,13,20,.8) 0%, transparent var(--t, 25%), transparent var(--b, 60%), rgba(14,13,20,.95) 100%); }

/* 面板 */
.panel { background: linear-gradient(180deg, var(--panel-hi), var(--panel)); border: 1px solid var(--line); border-radius: 16px; padding: 16px; }
.panel + .panel { margin-top: 12px; }

/* 石板按钮 */
.btn { position: relative; min-height: 52px; padding: 6px 14px; border-radius: 12px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-weight: 700; font-size: 16px; text-align: center; border: 1px solid; overflow: hidden; transition: transform .06s, opacity .15s; user-select: none; }
.btn:active:not(:disabled) { transform: translateY(2px); }
.btn:disabled { opacity: .4; }
.btn .btn-s { font-size: 11px; font-weight: 400; opacity: .75; margin-top: 1px; }
.btn-primary { background: linear-gradient(180deg, var(--gold-hi), var(--gold) 50%, var(--gold-dim)); color: #241A08; border-color: var(--gold-hi); box-shadow: inset 0 -3px 0 rgba(0,0,0,.33); }
.btn-secondary { background: linear-gradient(180deg, var(--panel-hi), var(--panel)); color: var(--gold); border-color: var(--gold-dim); }
.btn-ghost { color: var(--dim); border-color: var(--line); }
.btn-danger { background: linear-gradient(180deg, #4A2224, #331718); color: var(--bad); border-color: rgba(229,98,91,.6); }
.btn-wide { width: 100%; }
.iconbtn { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; flex: none; }
.iconbtn:active { background: rgba(255,255,255,.06); }

.chip { --c: var(--dim); display: inline-flex; align-items: center; border-radius: 999px; padding: 6px 12px; font-size: 13px; line-height: 1.2;
  border: 1px solid color-mix(in srgb, var(--c) 45%, transparent); color: color-mix(in srgb, var(--c) 90%, transparent); white-space: nowrap; }
.chip.on { background: color-mix(in srgb, var(--c) 22%, transparent); border-color: color-mix(in srgb, var(--c) 90%, transparent); color: var(--c); font-weight: 700; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }

.bar { background: #2A2536; border-radius: 99px; overflow: hidden; }
.bar-f { height: 100%; border-radius: 99px; transition: width .6s ease; }
.bar.noanim .bar-f { transition: none; }

.sec { display: flex; align-items: flex-end; gap: 8px; padding: 8px 0; }
.sec i { width: 3px; height: 16px; background: var(--gold); align-self: center; }
.sec h3 { font-size: 17px; }
.sec span { font-size: 13px; color: var(--dim); }

.stat { display: flex; align-items: center; gap: 5px; padding: 5px 10px; border-radius: 99px; background: rgba(0,0,0,.4); }
.stat b { font-size: 14px; }
.mini { display: flex; flex-direction: column; align-items: center; }
.mini b { font-size: 16px; }
.mini span { font-size: 11px; color: var(--faint); }
.topback { display: flex; align-items: center; padding: 6px 8px; gap: 4px; flex: none; }
.topback h2 { flex: 1; }

/* 遮罩与弹层 */
.scrim { position: absolute; inset: 0; z-index: 40; background: rgba(0,0,0,.66); animation: fadein .18s; }
.scrim.center { display: flex; align-items: center; justify-content: center; padding: 28px; }
.scrim.bottom { display: flex; align-items: flex-end; }
.dialog { width: 100%; }
.dialog p { margin: 8px 0 18px; }
.sheet { width: 100%; border-radius: 16px 16px 0 0; animation: slideup .26s cubic-bezier(.2,.8,.2,1); max-height: 90%; display: flex; flex-direction: column; }
@keyframes slideup { from { transform: translateY(100%); } to { transform: none; } }
.toast { position: absolute; left: 50%; top: 64px; transform: translateX(-50%); z-index: 90; background: rgba(42,36,54,.94); border-radius: 12px;
  padding: 12px 18px; max-width: 86%; text-align: center; animation: toastin .2s; pointer-events: none; }
@keyframes toastin { from { opacity: 0; transform: translate(-50%, -10px); } }

/* 底部 tab */
.tabs { flex: none; display: flex; background: linear-gradient(180deg, var(--bg2), var(--bg)); padding: 6px 0 4px; border-top: 1px solid #1c1926; }
.tab { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 0; color: var(--faint); font-size: 11px; }
.tab.on { color: var(--gold); }
.tab i { display: block; height: 2px; width: 0; background: var(--gold); margin-top: 3px; transition: width .2s; }
.tab.on i { width: 18px; }

/* 塔图 */
.statsbar { display: flex; align-items: center; padding: 8px 12px; gap: 6px; flex: none; }
.regionnav { display: flex; align-items: center; padding: 0 8px; flex: none; }
.regionnav .mid { flex: 1; text-align: center; }
.floors { position: relative; display: flex; flex-direction: column-reverse; padding: 12px 0 20px; }
.floor { position: relative; height: 108px; }
.floor svg.path { position: absolute; left: 0; top: -54px; width: 100%; height: 108px; overflow: visible; pointer-events: none; }
.node { position: absolute; top: 22px; width: 64px; height: 64px; margin-left: -32px; border-radius: 50%; display: grid; place-items: center;
  border: 2px solid; background: radial-gradient(var(--panel-hi), var(--bg2)); font-family: var(--display); font-weight: 800; font-size: 24px; z-index: 2; }
.node.cleared { background: radial-gradient(var(--gold-hi), var(--gold), var(--gold-dim)); color: #2A1D08; border-color: var(--gold); }
.node.cur::before { content: ""; position: absolute; inset: -6px; border-radius: 50%; background: rgba(232,185,90,.3); animation: pulse 1.2s ease-in-out infinite alternate; z-index: -1; }
@keyframes pulse { from { transform: scale(1); opacity: .9; } to { transform: scale(1.35); opacity: .25; } }
.flabel { position: absolute; top: 50%; transform: translateY(-50%); max-width: 150px; padding: 0 18px; }
.flabel.l { right: 0; text-align: right; } .flabel.r { left: 0; }
.flabel b { font-size: 13px; display: block; }
.elites { position: absolute; bottom: 0; display: flex; padding: 0 10px; }
.elites.l { left: 0; } .elites.r { right: 0; }
.elite { width: 40px; height: 40px; margin: 2px; border-radius: 50%; border: 1.5px solid var(--bad); background: #3A1416 center/cover; }
.gate { display: flex; flex-direction: column; align-items: center; padding: 16px 0; }
.gate .door { position: relative; width: 150px; height: 170px; border-radius: 75px 75px 8px 8px; border: 2px solid var(--line); overflow: hidden;
  background: linear-gradient(#2B2438, #120F18); display: grid; place-items: center; }
.gate .door img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.gate .door.ready { border-color: var(--gold-hi); cursor: pointer; }
.gate .door.ready::after { content: ""; position: absolute; inset: 0; background: linear-gradient(rgba(232,185,90,.5), transparent); animation: glow 1.4s ease-in-out infinite alternate; }
@keyframes glow { from { opacity: .3; } to { opacity: 1; } }
.bossbanner { margin: 4px 16px; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--gold); display: flex; align-items: center; gap: 10px; flex: none;
  background: linear-gradient(90deg, rgba(232,185,90,.26), rgba(232,185,90,.08)), var(--panel); }
.actionbar { display: flex; align-items: center; gap: 8px; padding: 8px 12px; flex: none; }
.unitrow { display: flex; align-items: center; gap: 12px; padding: 12px 14px; margin: 4px 0; border-radius: 12px; background: var(--bg2); border: 1px solid var(--line); width: 100%; text-align: left; }
.unitrow.got { border-color: var(--gold-dim); }

/* 战斗 */
.battle-top { display: flex; align-items: center; padding: 6px 8px; gap: 2px; flex: none; }
.shield { transition: transform .3s cubic-bezier(.3,1.8,.5,1); margin: 2px; }
.shield.off { transform: scale(.7); }
.enemy { flex: none; display: flex; flex-direction: column; align-items: center; padding: 10px 24px; }
.enemy.compact { flex-direction: row; padding: 8px 12px; gap: 12px; }
.enemy .portrait { position: relative; width: 168px; height: 168px; border-radius: 24px; border: 2px solid rgba(229,98,91,.6); overflow: hidden; background: center/cover; transition: transform .1s; }
.enemy.compact .portrait { width: 64px; height: 64px; border-radius: 14px; }
.enemy .portrait .flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; }
.enemy .hpwrap { width: 100%; margin-top: 10px; }
.enemy.compact .hpwrap { margin-top: 0; flex: 1; min-width: 0; }
.hpbar { position: relative; height: 10px; border-radius: 5px; background: #2A2536; overflow: hidden; margin-top: 4px; }
.hpbar .trail, .hpbar .fill { position: absolute; left: 0; top: 0; bottom: 0; }
.hpbar .trail { background: #B8463F; transition: width .7s ease .26s; }
.hpbar .fill { background: linear-gradient(90deg, #E5625B, #F08A5D); transition: width .26s ease; }
.floater { position: absolute; left: 50%; top: 40%; font-family: var(--display); font-weight: 800; font-size: 24px; color: #fff; pointer-events: none; white-space: nowrap;
  text-shadow: 0 2px 6px rgba(0,0,0,.7); animation: floatup .8s cubic-bezier(.2,.7,.3,1) forwards; z-index: 5; }
.floater.crit { font-size: 30px; color: var(--gold-hi); }
.enemy.compact .floater { left: 0; top: 10%; font-size: 20px; animation-name: floatupc; }
.enemy.compact .floater.crit { font-size: 24px; }
@keyframes floatupc { 0% { transform: translate(0, 0); opacity: 1; } 55% { opacity: 1; } 100% { transform: translate(0, -30px); opacity: 0; } }
@keyframes floatup { 0% { transform: translate(-50%, 0); opacity: 1; } 55% { opacity: 1; } 100% { transform: translate(-50%, -70px); opacity: 0; } }
.caption { position: absolute; left: 50%; top: 42%; z-index: 30; font-family: var(--display); font-weight: 800; font-size: 44px; color: var(--gold-hi); pointer-events: none;
  text-shadow: 0 4px 20px rgba(0,0,0,.8); animation: caption 1.1s forwards; white-space: nowrap; }
@keyframes caption { 0% { transform: translate(-50%,-50%) scale(2.2); opacity: 0; } 25% { transform: translate(-50%,-50%) scale(1); opacity: 1; } 75% { opacity: 1; } 100% { transform: translate(-50%,-50%) scale(1); opacity: 0; } }
.rededge { position: absolute; inset: 0; pointer-events: none; z-index: 20; background: radial-gradient(transparent 45%, rgba(229,98,91,.55)); opacity: 0; }
.rededge.go { animation: redfade .5s forwards; }
@keyframes redfade { from { opacity: 1; } to { opacity: 0; } }
.shake { animation: shake .12s linear; }
@keyframes shake { 20% { transform: translateX(6px); } 40% { transform: translateX(-6px); } 60% { transform: translateX(4px); } 80% { transform: translateX(-3px); } }
.combo { display: flex; align-items: flex-end; gap: 4px; transition: transform .25s cubic-bezier(.3,1.8,.5,1); }
.qarea { padding: 0 16px; }
.typetag { display: flex; align-items: center; gap: 6px; font-size: 11px; }
.typetag i { width: 6px; height: 6px; border-radius: 50%; }
.drawer { position: absolute; left: 0; right: 0; bottom: 0; z-index: 25; border-radius: 16px 16px 0 0; animation: slideup .25s cubic-bezier(.2,.8,.2,1); }
.drawer .body { max-height: 260px; overflow-y: auto; }

/* 题目 */
.opt { display: flex; align-items: center; width: 100%; text-align: left; padding: 12px 14px; border-radius: 12px; background: var(--panel); border: 1.5px solid var(--line);
  transition: border-color .2s; font-size: 15px; line-height: 1.4; }
.opt.big { padding: 16px 14px; font-size: 17px; min-height: 56px; }
.opt.ok { border-color: var(--good); background: rgba(124,199,131,.16); }
.opt.bad { border-color: var(--bad); background: rgba(229,98,91,.16); }
.opt.other { color: var(--faint); }
.opt:active:not(:disabled) { background: var(--panel-hi); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.optlist { display: flex; flex-direction: column; gap: 8px; }
.tile { padding: 10px 12px; margin: 3px; border-radius: 10px; background: var(--panel-hi); border: 1px solid var(--gold-dim); font-family: var(--en); font-size: 18px; line-height: 1.2; }
.tile.used { visibility: hidden; }
.tiles { display: flex; flex-wrap: wrap; justify-content: center; }
.tiles.left { justify-content: flex-start; }
.slots { display: flex; flex-wrap: wrap; justify-content: center; }
.slot { width: 30px; height: 40px; margin: 2px; display: flex; align-items: center; justify-content: center; border-bottom: 2px solid var(--line); font-family: var(--en); font-weight: 700; font-size: 24px; }
.dropzone { min-height: 64px; border-radius: 12px; background: var(--bg2); border: 1px solid var(--line); padding: 6px; display: flex; flex-wrap: wrap; align-content: flex-start; }
.speaker { display: inline-flex; align-items: center; gap: 6px; padding: 10px; border-radius: 99px; background: var(--panel-hi); border: 1px solid var(--line); color: var(--gold); font-size: 13px; }
.speaker.lab { padding: 10px 14px; }
.bigspeaker { width: 88px; height: 88px; border-radius: 50%; background: var(--panel-hi); border: 2px solid var(--gold); display: grid; place-items: center; }
.dictbox { width: 100%; min-height: 96px; border-radius: 12px; background: var(--bg2); border: 1px solid var(--gold-dim); padding: 12px; font-family: var(--en); font-size: 18px; resize: none; outline: none; }
.dictbox:focus { border-color: var(--gold); }
.tap w { cursor: pointer; border-radius: 3px; }
.tap w:hover, .tap w:active { background: rgba(232,185,90,.18); }
.tap w.hl { color: var(--gold-hi); }
.passage { display: flex; flex-direction: column; min-height: 0; }
.passage .txt { overflow-y: auto; min-height: 0; font-family: var(--en); font-size: 16px; line-height: 1.56; white-space: pre-wrap; }
.player { display: flex; align-items: center; gap: 12px; }
.player .pbtn { width: 52px; height: 52px; border-radius: 50%; background: var(--gold); color: #241A08; display: grid; place-items: center; flex: none; }
.lines { max-height: 220px; overflow-y: auto; margin-top: 10px; }
.line { display: flex; gap: 8px; padding: 4px 0; width: 100%; text-align: left; }
.line b { width: 64px; flex: none; color: var(--gold); font-size: 13px; font-weight: 400; }

/* 结算 */
.result-glow { position: absolute; inset: 0; pointer-events: none; }
.bigstar { transition: transform .35s cubic-bezier(.3,1.8,.5,1); transform: scale(.6); margin: 0 6px; }
.bigstar.on { transform: scale(1); }
.pop { animation: pop .5s cubic-bezier(.3,1.6,.5,1); }
@keyframes pop { from { transform: scale(.4); } to { transform: scale(1); } }
.bottombar { flex: none; padding: 12px 20px; background: linear-gradient(transparent, var(--bg) 40%); }

/* 列表行 */
.listrow { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 14px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); margin: 5px 0; }
.listrow.next { background: var(--panel-hi); border-color: var(--gold); }
.listrow.done { border-color: rgba(156,122,58,.4); }
.listrow.done .t { color: var(--faint); text-decoration: line-through; }
.listrow .circ { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; background: var(--bg2); flex: none; }
.quest { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); margin: 4px 0; }
.quest.ready { border-color: var(--gold); }
.toggle { width: 46px; height: 26px; border-radius: 13px; background: var(--panel-hi); border: 1px solid var(--line); padding: 3px; flex: none; position: relative; }
.toggle i { position: absolute; top: 2px; left: 3px; width: 20px; height: 20px; border-radius: 10px; background: var(--dim); transition: left .15s; }
.toggle.on { background: var(--gold); border-color: var(--gold-hi); }
.toggle.on i { left: 21px; background: #241A08; }

/* 收藏 */
.cardgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 12px; }
.wtile { height: 92px; border-radius: 12px; border: 1px solid rgba(52,46,68,.4); background: linear-gradient(var(--panel), var(--bg2)); padding: 8px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center; min-width: 0; }
.wtile b { font-size: 15px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wtile span { font-size: 11px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 12px; }
.mcard { border-radius: 14px; background: var(--panel); border: 1.5px solid var(--line); overflow: hidden; text-align: left; }
.mcard .img { position: relative; aspect-ratio: 1; }
.mcard .pic { position: absolute; inset: 0; background: center/cover; }
.mcard .pic.unk { filter: grayscale(1) brightness(.22) blur(5px); transform: scale(1.08); }
.mcard .pic.met { filter: saturate(.25); }
.mcard .q { position: absolute; inset: 0; display: grid; place-items: center; }
.regiontabs { display: flex; gap: 6px; padding: 0 12px; }
.regiontabs button { flex: 1; padding: 8px 0; border-radius: 10px; background: var(--panel); border: 1px solid var(--line); color: var(--dim); font-size: 12px; }

.boot { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; }
.boot .hero { font-size: 46px; letter-spacing: 6px; }
.spin { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--gold); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }

.w76 { width: 76px; flex: none; } .w96 { width: 96px; flex: none; } .w140 { width: 140px; flex: none; } .w100 { width: 100%; }
.towersil.anim .seg { animation: segin .45s backwards; animation-delay: var(--d); }
@keyframes segin { from { opacity: .15; } }
.lockedimg { filter: grayscale(1) brightness(.22) blur(4px); }
.ttable { width: 100%; border-collapse: collapse; font-size: 13px; color: var(--dim); }
.ttable th { font-size: 11px; color: var(--faint); font-weight: 400; text-align: left; padding: 0 0 4px; }
.ttable td { padding: 4px 0; }
.ttable td:first-child { color: var(--text); }
.ttable td i { display: inline-block; width: 6px; height: 6px; border-radius: 50%; margin-right: 8px; vertical-align: middle; }
