/* ============================================================
   铁窗求生记 · 像素风样式
   配色：水泥灰 / 冷钢蓝 / 牢灯暖黄 / 警报红
   ============================================================ */
:root {
  --bg: #14161f;
  --bg-2: #232a3e;
  --panel: #1f2433;
  --panel-2: #181c28;
  --line: #3a4258;
  --ink: #eef0f6;
  --ink-dim: #a2a9c2;
  --ink-faint: #6a7090;
  --yellow: #ffcd75;
  --orange: #ef7d57;
  --red: #e64f57;
  --green: #4caf6e;
  --teal: #5a9fd4;
  --steel: #8a93ad;
  --purple: #8d6fdd;
  --pink: #f582ae;
  --gold: #ffd23a;
  --shadow: rgba(0, 0, 0, .5);
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  font-size: 16px;
  line-height: 1.6;
  overscroll-behavior-y: none;
}
body {
  background-image:
    linear-gradient(rgba(255, 255, 255, .018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .018) 1px, transparent 1px);
  background-size: 24px 24px;
}
button { font-family: inherit; cursor: pointer; user-select: none; -webkit-user-select: none; }
/* 关键：禁掉所有按钮/可点元素的「双击缩放」，避免连续点击触发网页放大误触 */
button, .stash-cell, .task-chip, .mg-fall, .brain-key, .word-btn { touch-action: manipulation; }

#app { max-width: 540px; margin: 0 auto; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; position: relative; }

/* ============ 屏幕切换 ============ */
.screen { display: none; flex: 1; flex-direction: column; animation: screenIn .28s ease; }
.screen.active { display: flex; }
@keyframes screenIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ============ 通用按钮 ============ */
.btn {
  display: block; width: 100%;
  padding: 13px 16px; font-size: 17px; font-weight: 600;
  color: var(--ink); background: var(--panel);
  border: 2px solid var(--line); border-bottom-width: 5px; border-radius: 10px;
  transition: transform .06s, filter .15s;
}
.btn:active { transform: translateY(3px); border-bottom-width: 2px; margin-bottom: 3px; }
.btn:disabled { opacity: .38; pointer-events: none; }
.btn-primary { background: var(--orange); border-color: #b85436; color: #fff; text-shadow: 0 1px 0 rgba(0,0,0,.25); background-image: linear-gradient(180deg, rgba(255,255,255,.18), rgba(0,0,0,.08)); }
.btn-good { background: var(--green); border-color: #2c7c4c; color: #fff; }
.btn-icon {
  width: 42px; height: 42px; flex: none; font-size: 20px; line-height: 1;
  color: var(--ink); background: var(--panel);
  border: 2px solid var(--line); border-bottom-width: 4px; border-radius: 10px;
}
.btn-icon:active { transform: translateY(2px); border-bottom-width: 2px; }

/* ============ 标题屏 ============ */
#screen-title { justify-content: center; padding: 24px 22px 40px; text-align: center; }
.title-inner { width: 100%; }
#title-canvas { width: min(78%, 300px); image-rendering: pixelated; image-rendering: crisp-edges; margin: 0 auto 6px; display: block; filter: drop-shadow(0 10px 24px rgba(0, 0, 0, .55)); }
.logo {
  font-size: clamp(44px, 13vw, 64px); font-weight: 900; letter-spacing: 4px; line-height: 1.15;
  color: var(--steel); text-shadow: 0 4px 0 #2a3247, 0 8px 0 rgba(0, 0, 0, .4);
}
.logo-2 { color: var(--yellow); text-shadow: 0 4px 0 #8a6a26, 0 8px 0 rgba(0, 0, 0, .4); }
.subtitle { color: var(--ink-dim); margin: 10px 0 26px; letter-spacing: 2px; font-size: 14px; }
.menu { display: flex; flex-direction: column; gap: 12px; max-width: 320px; margin: 0 auto; }
.title-tip { margin-top: 26px; min-height: 44px; font-size: 13px; color: var(--ink-faint); padding: 0 8px; }
.title-credit { margin-top: 6px; font-size: 12px; letter-spacing: 3px; color: var(--yellow); opacity: .8; }

/* ============ HUD ============ */
.hud {
  display: flex; justify-content: space-between; align-items: center; padding: 12px 14px 8px; gap: 10px;
  background: linear-gradient(180deg, rgba(35,42,62,.32), rgba(35,42,62,0));
  border-bottom: 1px solid var(--line); margin-bottom: 2px;
}
.hud-left { min-width: 0; }
.hud-day { font-size: 15px; font-weight: 700; letter-spacing: .5px; }
.hud-level { font-size: 12px; color: var(--yellow); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hud-right { display: flex; align-items: center; gap: 10px; }
.hud-money { font-size: 17px; font-weight: 800; color: var(--ink); white-space: nowrap; text-shadow: 0 0 8px rgba(255,205,117,.25); }
.hud-money.flash { animation: moneyFlash .6s; }
@keyframes moneyFlash { 30% { transform: scale(1.18); color: var(--yellow); } }

/* ============ 场景 ============ */
.scene-wrap { position: relative; padding: 0 14px; }
#scene {
  width: 100%; aspect-ratio: 16 / 9; display: block;
  border: 3px solid #2c3450; border-radius: 12px; background: #0c0e16;
  image-rendering: pixelated; image-rendering: crisp-edges;
  box-shadow: 0 6px 22px rgba(0,0,0,.45), inset 0 0 26px rgba(0,0,0,.4);
}
.scene-time {
  position: absolute; top: 10px; left: 26px; font-size: 12px; color: rgba(255, 255, 255, .85);
  background: rgba(0, 0, 0, .45); padding: 2px 10px; border-radius: 99px; pointer-events: none;
  border: 1px solid rgba(255,255,255,.12); font-weight: 600; letter-spacing: .5px; backdrop-filter: blur(2px);
}
.sentence-tag {
  position: absolute; bottom: 10px; left: 26px; font-size: 12px; font-weight: 700;
  color: var(--yellow); background: rgba(0,0,0,.5); padding: 2px 11px; border-radius: 99px;
  border: 1px solid rgba(255,205,117,.3); pointer-events: none; letter-spacing: .5px;
}
.daily-chip {
  position: absolute; top: 10px; right: 26px; z-index: 5;
  display: flex; align-items: center; gap: 5px; padding: 3px 10px 3px 7px; border-radius: 99px;
  font-size: 12px; font-weight: 700; background: rgba(16,18,30,.8); border: 1px solid var(--line);
  pointer-events: none; max-width: 58%; animation: dailyIn .4s ease;
}
.daily-chip.good { border-color: #2c7c4c; color: #9fe9b8; }
.daily-chip.bad { border-color: #93363c; color: #ff9aa0; }
.daily-chip.hidden { display: none; }
.daily-chip .dc-icon { font-size: 14px; }
.daily-chip .dc-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@keyframes dailyIn { from { opacity: 0; transform: translateY(-6px); } }

/* ============ 属性条 ============ */
.stats { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 7px 10px; padding: 10px 14px 4px; }
.stat { font-size: 12px; }
.stat-label { display: flex; justify-content: space-between; color: var(--ink-dim); margin-bottom: 2px; }
.stat-label b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.stat-bar { height: 9px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 4px; overflow: hidden; box-shadow: inset 0 1px 2px rgba(0,0,0,.4); }
.stat-fill {
  height: 100%; border-radius: 3px; transition: width .45s ease, background-color .45s;
  background-image: linear-gradient(180deg, rgba(255,255,255,.3), rgba(255,255,255,0) 45%, rgba(0,0,0,.18));
  box-shadow: 0 0 5px rgba(255,255,255,.1);
}
.stat-fill.low { animation: lowPulse 1.1s infinite; }
@keyframes lowPulse { 50% { opacity: .45; } }

/* ============ 主屏快捷栏（小卖部 / 存档） ============ */
.quickbar { display: flex; gap: 10px; padding: 4px 14px 0; }
.qbtn {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 7px;
  padding: 10px 8px; font-size: 15px; font-weight: 800; color: var(--ink);
  background: var(--panel); border: 2px solid var(--line); border-bottom-width: 4px; border-radius: 11px;
  background-image: linear-gradient(180deg, rgba(255,255,255,.05), rgba(0,0,0,.08));
  transition: transform .06s, border-color .15s;
}
.qbtn:active { transform: translateY(2px); border-bottom-width: 2px; }
.qbtn .qb-ic { font-size: 19px; filter: drop-shadow(0 1px 2px rgba(0,0,0,.4)); }
#btn-shop { border-color: #8a6c3c; }
#btn-save { border-color: #2c6e8a; }
.qbtn.saved { border-color: var(--green); }

/* ============ 叙述与操作面板 ============ */
.panel { flex: 1; display: flex; flex-direction: column; margin: 10px 14px 14px; background: var(--panel-2); border: 2px solid var(--line); border-radius: 14px; padding: 13px 14px; min-height: 230px; }
.narr { font-size: 15px; color: var(--ink); min-height: 52px; margin-bottom: 12px; white-space: pre-wrap; }
.narr .narr-cursor { display: inline-block; width: 8px; height: 16px; background: var(--yellow); vertical-align: -2px; animation: blink .7s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: auto; }
.action-btn {
  position: relative; padding: 11px 8px 9px; background: var(--panel);
  border: 2px solid var(--line); border-bottom-width: 5px; border-radius: 12px;
  color: var(--ink); text-align: center; transition: transform .06s;
  background-image: linear-gradient(180deg, rgba(255,255,255,.05), rgba(0,0,0,.08));
}
.action-btn:active { transform: translateY(3px); border-bottom-width: 2px; margin-bottom: 3px; }
.action-btn .a-icon { font-size: 24px; line-height: 1.2; display: block; filter: drop-shadow(0 2px 3px rgba(0,0,0,.4)); }
.action-btn .a-name { font-size: 15px; font-weight: 700; display: block; margin-top: 2px; }
.action-btn .a-desc { font-size: 11px; color: var(--ink-faint); display: block; line-height: 1.4; margin-top: 1px; }
.action-btn.wide { grid-column: 1 / -1; }
.action-btn:disabled { opacity: .4; pointer-events: none; }
.action-btn.hot { border-color: #8a6c3c; }
.action-btn .a-badge { position: absolute; top: 4px; right: 6px; font-size: 13px; opacity: .8; filter: drop-shadow(0 1px 1px rgba(0,0,0,.5)); }

/* ============ 弹窗 ============ */
.overlay { position: fixed; inset: 0; z-index: 200; background: rgba(8, 9, 18, .8); display: flex; align-items: center; justify-content: center; padding: 20px; animation: fadeIn .22s ease; }
.overlay.hidden { display: none; }
@keyframes fadeIn { from { opacity: 0; } }
.modal {
  width: 100%; max-width: 420px; max-height: 86vh; max-height: 86dvh; overflow-y: auto;
  background: var(--panel); border: 3px solid var(--line); border-radius: 16px; padding: 22px 20px 18px;
  text-align: center; animation: popIn .25s cubic-bezier(.34, 1.56, .64, 1); box-shadow: 0 18px 50px var(--shadow);
}
@keyframes popIn { from { opacity: 0; transform: scale(.85); } }
.modal-icon { font-size: 46px; line-height: 1.2; }
.modal-title { font-size: 20px; margin: 6px 0 8px; color: var(--yellow); }
.modal-text { font-size: 15px; color: var(--ink); text-align: left; white-space: pre-wrap; }
.modal-text .hl { color: var(--yellow); font-weight: 700; }
.modal-choices { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.modal.emergency { border-color: var(--red); box-shadow: 0 0 0 3px rgba(230, 79, 87, .35), 0 18px 50px var(--shadow); animation: popIn .25s cubic-bezier(.34, 1.56, .64, 1), emFlash 1s ease infinite; }
.modal.emergency .modal-title { color: var(--red); }
@keyframes emFlash { 50% { box-shadow: 0 0 0 5px rgba(230, 79, 87, .55), 0 18px 50px var(--shadow); } }
.name-input {
  width: 100%; padding: 12px 14px; font-size: 18px; font-weight: 700; text-align: center;
  color: var(--ink); background: var(--panel-2); border: 2px solid var(--line); border-radius: 10px; outline: none; transition: border-color .15s;
}
.name-input::placeholder { color: var(--ink-faint); font-weight: 400; }
.name-input:focus { border-color: var(--yellow); }
.name-hint { font-size: 12px; color: var(--ink-faint); margin: -2px 0 2px; }

/* 囚服配色选择器 */
.look-picker { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 2px 0 4px; }
.look-sw { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 4px 5px; background: var(--panel-2); border: 2px solid var(--line); border-radius: 10px; color: var(--ink-dim); font-size: 11px; transition: border-color .12s, transform .08s; }
.look-sw.sel { border-color: var(--yellow); color: var(--ink); }
.look-sw:active { transform: translateY(2px); }
.look-suit { width: 22px; height: 20px; border-radius: 4px; overflow: hidden; display: flex; flex-direction: column; }
.look-suit i { flex: 1; display: block; }
.look-sw .lw-name { white-space: nowrap; }

/* 出身 / 天赋选择 */
.perk-pick { display: flex; flex-direction: column; gap: 7px; margin: 2px 0 4px; }
.perk-opt { display: flex; align-items: center; gap: 10px; text-align: left; padding: 8px 10px; background: var(--panel-2); border: 2px solid var(--line); border-bottom-width: 3px; border-radius: 11px; color: var(--ink); transition: border-color .12s, transform .08s; }
.perk-opt.sel { border-color: var(--yellow); background: #2a2410; }
.perk-opt:active { transform: translateY(2px); }
.perk-opt .pk-icon { font-size: 24px; flex: none; width: 30px; text-align: center; }
.perk-opt .pk-info { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.perk-opt .pk-info b { font-size: 14px; }
.perk-opt .pk-info i { font-size: 11px; color: var(--ink-dim); font-style: normal; line-height: 1.35; }

/* ============ 小游戏 ============ */
.mg-box { position: relative; width: 100%; max-width: 440px; max-height: calc(100dvh - 24px); overflow-y: auto; background: var(--panel); border: 3px solid var(--line); border-radius: 16px; padding: 16px; animation: popIn .25s cubic-bezier(.34, 1.56, .64, 1); }
.mg-box.mg-shake { animation: mgShake .25s; }
@keyframes mgShake { 0%,100%{transform:none} 25%{transform:translateX(-5px)} 75%{transform:translateX(5px)} }
.mg-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; font-weight: 800; }
.mg-title { font-size: 17px; color: var(--yellow); }
.mg-timer { font-size: 15px; color: var(--ink-dim); font-variant-numeric: tabular-nums; }
.mg-timer.urgent { color: var(--red); animation: lowPulse .5s infinite; }
.mg-score { font-size: 15px; color: var(--green); font-variant-numeric: tabular-nums; }
.mg-arena {
  position: relative; height: 300px;
  background: linear-gradient(180deg, #2a3148 0%, #232a3e 62%, #2a2620 62%, #241f1a 100%);
  border: 2px solid var(--line); border-radius: 12px; overflow: hidden; touch-action: manipulation; box-shadow: inset 0 0 30px rgba(0,0,0,.45);
}
.mg-intro { text-align: center; padding: 10px 6px 4px; }
.mg-intro .mg-emoji { font-size: 52px; }
.mg-intro h3 { font-size: 21px; color: var(--yellow); margin: 6px 0; }
.mg-intro p { font-size: 14px; color: var(--ink-dim); margin-bottom: 16px; white-space: pre-wrap; }
.mg-result { text-align: center; padding: 14px 6px 4px; }
.mg-result .mg-emoji { font-size: 52px; }
.mg-result h3 { font-size: 22px; margin: 8px 0 4px; }
.mg-result p { font-size: 14px; color: var(--ink-dim); margin-bottom: 16px; white-space: pre-wrap; }
.mg-combo { position: absolute; top: 8px; right: 10px; font-size: 14px; font-weight: 900; color: var(--yellow); pointer-events: none; z-index: 3; }
.mg-float { position: absolute; z-index: 6; font-size: 15px; font-weight: 900; pointer-events: none; animation: floatUp .85s ease forwards; }
.mg-float.plus { color: var(--yellow); }
.mg-float.minus { color: var(--red); }
@keyframes floatUp { from { opacity: 1; } to { transform: translateY(-26px); opacity: 0; } }

/* 通用大按钮（开关型小游戏） */
.slack-toggle { width: 100%; padding: 16px; font-size: 19px; font-weight: 900; border-radius: 14px; border: 3px solid #2c7c4c; border-bottom-width: 6px; background: var(--green); color: #fff; }
.slack-toggle.working { background: var(--teal); border-color: #2a6db1; }
.slack-toggle:active { transform: translateY(3px); border-bottom-width: 3px; margin-bottom: 3px; }
.slack-status { text-align: center; font-size: 15px; font-weight: 700; min-height: 26px; margin: 6px 0; }
.slack-status.danger { color: var(--red); animation: lowPulse .35s infinite; }
.slack-status.safe { color: var(--green); }
.slack-meter { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-dim); margin-bottom: 8px; }
.slack-meter .stat-bar { flex: 1; height: 10px; }

/* 飘落抓取（打饭抢菜 / 黑市） */
.mg-fall { position: absolute; min-width: 46px; padding: 6px 8px; background: var(--panel-2); border: 2px solid var(--teal); border-radius: 10px; font-size: 22px; text-align: center; will-change: top; z-index: 2; }
.mg-fall.bad { border-color: var(--red); }
.mg-fall.gift { border-color: var(--yellow); box-shadow: 0 0 8px rgba(255,205,117,.5); }
.fall-pop { animation: fallPop .22s ease forwards !important; pointer-events: none; }
@keyframes fallPop { to { transform: scale(1.4); opacity: 0; } }

/* 任务块（车间糊纸盒） */
.task-chip { position: absolute; min-width: 84px; padding: 8px 10px 6px; background: var(--panel-2); border: 2px solid var(--teal); border-radius: 10px; color: var(--ink); font-size: 13px; font-weight: 700; text-align: center; animation: chipIn .18s ease; z-index: 2; }
.task-chip .chip-bar { height: 4px; background: #14162b; border-radius: 2px; margin-top: 5px; overflow: hidden; }
.task-chip .chip-fill { height: 100%; background: var(--teal); width: 100%; }
.task-chip.urgent { border-color: var(--red); }
.task-chip.urgent .chip-fill { background: var(--red); }
@keyframes chipIn { from { transform: scale(.6); opacity: 0; } }
.chip-pop { animation: chipPop .22s ease forwards !important; pointer-events: none; }
@keyframes chipPop { to { transform: scale(1.45); opacity: 0; } }

/* 时机条（撸铁 / 打架 / 挖地道） */
.mg-gym-stage { position: relative; padding: 12px 0; }
.mg-gym-stage.mg-shake { animation: mgShake .26s; }
.mg-gym-track { position: relative; height: 48px; background: var(--bg); border: 2px solid var(--line); border-radius: 10px; overflow: hidden; touch-action: manipulation; transition: box-shadow .15s; }
.mg-gym-track.flash { background: #3d1a2a; }
.mg-gym-sweet { position: absolute; top: 0; bottom: 0; background: rgba(76,175,110,.28); border-left: 2px solid var(--green); border-right: 2px solid var(--green); }
.mg-gym-fail { position: absolute; top: 0; bottom: 0; background: rgba(230,79,87,.34); border: 1px solid var(--red); }
.mg-gym-needle { position: absolute; top: -2px; bottom: -2px; width: 4px; margin-left: -2px; background: var(--yellow); box-shadow: 0 0 6px var(--yellow); will-change: left; pointer-events: none; }
.mg-gym-pop { position: absolute; top: -4px; transform: translateX(-50%); font-size: 14px; font-weight: 900; pointer-events: none; white-space: nowrap; z-index: 4; animation: floatUp .45s ease forwards; }

/* 选项型（唠嗑过招 / 探监） */
.mg-boss-bubble { position: relative; background: var(--panel-2); border: 2px solid var(--line); border-radius: 12px; padding: 12px 14px; margin: 8px 0 10px; font-size: 15px; font-weight: 700; color: var(--ink); min-height: 62px; line-height: 1.45; transition: background .18s; }
.mg-boss-bubble.crash { background: #3d1a2a; }
.mg-boss-face { font-size: 22px; margin-right: 6px; }
.mg-boss-hint { font-size: 13px; color: var(--yellow); min-height: 18px; text-align: center; margin-bottom: 8px; font-weight: 700; }
.mg-opts { display: flex; flex-direction: column; gap: 9px; }
.mg-opt { width: 100%; min-height: 54px; padding: 12px 14px; background: var(--panel); color: var(--ink); border: 2px solid var(--line); border-bottom-width: 4px; border-radius: 12px; font-size: 14px; font-weight: 700; text-align: left; white-space: normal; line-height: 1.35; transition: transform .1s, border-color .15s, background .15s; }
.mg-opt:active { transform: translateY(2px); border-bottom-width: 2px; }
.mg-opt.good { background: #2a2410; border-color: var(--yellow); animation: optPop .22s ease; }
.mg-opt.bad { border-color: var(--red); animation: optShake .18s ease; }
.mg-opt.dim { opacity: .55; }
@keyframes optPop { 50% { transform: scale(1.04); } }
@keyframes optShake { 0%,100%{transform:translateX(0)} 25%{transform:translateX(-5px)} 75%{transform:translateX(5px)} }

/* 词语拼搭（思想汇报） */
.word-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 10px 0; }
.word-btn { padding: 9px 2px; font-size: 14px; font-weight: 700; background: var(--panel-2); border: 2px solid var(--line); border-radius: 9px; color: var(--ink); }
.word-btn.sel { background: var(--orange); border-color: #b85436; color: #fff; }
.report-out { background: var(--bg); border: 2px dashed var(--line); border-radius: 10px; padding: 12px; font-size: 14px; min-height: 86px; margin: 10px 0; text-align: left; white-space: pre-wrap; }
.report-out .hl { color: var(--yellow); font-weight: 700; }

/* 藏违禁品（查房） */
.stash-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 8px 0; touch-action: manipulation; }
.stash-cell { position: relative; aspect-ratio: 1 / 1; background: var(--panel-2); border: 2px solid var(--line); border-radius: 12px; overflow: hidden; display: flex; align-items: center; justify-content: center; font-size: 30px; transition: transform .08s, border-color .15s, background .15s; }
.stash-cell .sc-label { position: absolute; bottom: 3px; left: 0; right: 0; text-align: center; font-size: 10px; color: var(--ink-faint); font-weight: 700; }
.stash-cell.has { background: #2a2410; border-color: var(--yellow); }
.stash-cell.searched { background: #2a2d3e; }
.stash-cell.busted { background: #3d1a2a; border-color: var(--red); animation: mgShake .25s; }
.stash-cell.safe { border-color: var(--green); }
.stash-cell:active { transform: scale(.94); }
.stash-bar { display: flex; align-items: center; gap: 8px; margin: 6px 0; font-size: 13px; font-weight: 700; color: var(--ink-dim); }
.stash-bar .stat-bar { flex: 1; height: 12px; }
.stash-bar .stat-fill { background: var(--red); }

/* 数铁栏入睡 */
.count-stage { position: relative; height: 200px; background: linear-gradient(180deg, #161a30, #232a52); border: 2px solid var(--line); border-radius: 12px; overflow: hidden; }
.count-num { position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); font-size: 60px; font-weight: 900; color: var(--yellow); text-shadow: 0 4px 0 rgba(0,0,0,.4); pointer-events: none; }
.count-bar-zone { position: absolute; left: 0; bottom: 30px; width: 60px; font-size: 40px; text-align: center; will-change: transform; }
.count-tap { width: 100%; padding: 18px; margin-top: 8px; font-size: 20px; font-weight: 900; border-radius: 14px; border: 3px solid #2a6db1; border-bottom-width: 6px; background: var(--teal); color: #fff; }
.count-tap:active { transform: translateY(3px); border-bottom-width: 3px; }
.count-status { text-align: center; font-size: 15px; font-weight: 700; min-height: 24px; margin: 6px 0; color: var(--ink-dim); }

/* ============ 浮动提示 ============ */
#toast-wrap { position: fixed; top: 18dvh; left: 50%; transform: translateX(-50%); z-index: 300; display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; width: max-content; max-width: 90vw; }
.toast { background: rgba(18, 20, 36, .92); border: 2px solid var(--line); border-radius: 99px; padding: 6px 16px; font-size: 14px; font-weight: 700; animation: toastUp 1.5s ease forwards; white-space: nowrap; }
.toast.t-good { color: #7beda4; border-color: #2c7c4c; }
.toast.t-bad { color: #ff9aa0; border-color: #93363c; }
.toast.t-info { color: var(--yellow); border-color: #8a6c3c; }
@keyframes toastUp { 0% { opacity: 0; transform: translateY(12px); } 12% { opacity: 1; transform: none; } 78% { opacity: 1; } 100% { opacity: 0; transform: translateY(-16px); } }

#ach-pop { position: fixed; top: calc(12px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); z-index: 400; background: linear-gradient(135deg, #3a2f12, #2a2410); border: 2px solid var(--gold); border-radius: 14px; padding: 10px 18px; display: flex; align-items: center; gap: 10px; box-shadow: 0 8px 30px rgba(0, 0, 0, .6); animation: achIn 3.2s ease forwards; max-width: 92vw; }
#ach-pop.hidden { display: none; }
#ach-pop .ap-icon { font-size: 30px; }
#ach-pop .ap-head { font-size: 11px; color: var(--gold); letter-spacing: 2px; }
#ach-pop .ap-name { font-size: 16px; font-weight: 900; color: #fff; }
@keyframes achIn { 0% { opacity: 0; transform: translate(-50%, -24px); } 10% { opacity: 1; transform: translate(-50%, 0); } 85% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -18px); } }

/* ============ 结局屏 ============ */
#screen-ending { justify-content: center; padding: 30px 22px; text-align: center; }
#ending-canvas { display: block; width: min(92%, 360px); max-width: 360px; margin: 0 auto 4px; border-radius: 14px; border: 3px solid var(--line); image-rendering: pixelated; image-rendering: crisp-edges; box-shadow: 0 8px 26px rgba(0,0,0,.45); }
#screen-ending .ending-icon { font-size: 48px; margin-top: -34px; position: relative; filter: drop-shadow(0 3px 5px rgba(0,0,0,.5)); animation: endFloat 2.6s ease-in-out infinite; }
@keyframes endFloat { 50% { transform: translateY(-10px); } }
.ending-tag { display: inline-block; font-size: 12px; letter-spacing: 4px; color: var(--ink-faint); border: 1px solid var(--line); padding: 2px 14px; border-radius: 99px; margin: 14px 0 8px; }
.ending-title { font-size: 30px; color: var(--yellow); margin-bottom: 14px; }
.ending-text { font-size: 15px; color: var(--ink-dim); white-space: pre-wrap; text-align: left; max-width: 400px; margin: 0 auto; }
.ending-stats { margin: 20px auto; max-width: 380px; background: var(--panel-2); border: 2px solid var(--line); border-radius: 14px; padding: 14px 18px; font-size: 13.5px; text-align: left; display: grid; grid-template-columns: 1fr 1fr; gap: 5px 16px; color: var(--ink-dim); }
.ending-stats b { color: var(--ink); }
.ending-btns { display: flex; flex-direction: column; gap: 10px; max-width: 320px; margin: 0 auto; }

/* ============ 子页面 ============ */
.sub-header { display: flex; align-items: center; justify-content: space-between; padding: 14px; gap: 10px; }
.sub-header h2 { font-size: 19px; }
.ach-count { font-size: 13px; color: var(--ink-faint); min-width: 42px; text-align: right; }
.ach-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 4px 14px 24px; }
.ach-card { background: var(--panel-2); border: 2px solid var(--line); border-radius: 12px; padding: 12px; display: flex; gap: 10px; align-items: center; }
.ach-card .ac-icon { font-size: 26px; flex: none; }
.ach-card .ac-name { font-size: 14px; font-weight: 800; }
.ach-card .ac-desc { font-size: 11px; color: var(--ink-faint); line-height: 1.4; }
.ach-card.locked { opacity: .45; filter: grayscale(1); }
.ach-card.unlocked { border-color: #8a6c3c; }

.help-body { padding: 4px 20px 30px; }
.help-body h3 { color: var(--yellow); font-size: 16px; margin: 16px 0 4px; }
.help-body p { font-size: 14px; color: var(--ink-dim); margin-bottom: 6px; }
.help-body b { color: var(--ink); }
.help-credit { margin-top: 26px; text-align: center; font-size: 12px; color: var(--ink-faint); }

/* 出狱图鉴 */
.codex-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 7px 10px; padding: 4px 14px 12px; }
.codex-stat { display: flex; justify-content: space-between; align-items: center; background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 7px 11px; font-size: 12.5px; color: var(--ink-dim); }
.codex-stat b { color: var(--ink); font-variant-numeric: tabular-nums; }
.codex-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 4px 14px 26px; }
.codex-card { background: var(--panel-2); border: 2px solid var(--line); border-radius: 14px; overflow: hidden; border-bottom-width: 4px; }
.codex-card.locked { opacity: .6; }
.codex-illu { display: block; width: 100%; height: auto; image-rendering: pixelated; background: #0c0e1a; }
.codex-illu.locked-illu { display: flex; align-items: center; justify-content: center; aspect-ratio: 240/105; font-size: 34px; color: var(--ink-faint); }
.codex-meta { padding: 8px 10px 10px; }
.codex-meta .cx-tag { display: block; font-size: 10px; letter-spacing: 2px; color: var(--ink-faint); }
.codex-meta b { font-size: 14px; }
.codex-meta i { font-size: 11px; color: var(--yellow); font-style: normal; margin-left: 4px; }
@media (max-width: 380px) { .codex-grid { grid-template-columns: 1fr; } }

/* 小卖部 */
.shop-money { font-size: 15px; font-weight: 800; color: var(--yellow); }
.shop-tip { text-align: center; font-size: 12px; color: var(--ink-faint); margin: -4px 0 8px; }
.shop-list { display: flex; flex-direction: column; gap: 10px; padding: 0 14px 24px; }
.shop-card { display: flex; align-items: center; gap: 12px; background: var(--panel-2); border: 2px solid var(--line); border-bottom-width: 4px; border-radius: 14px; padding: 11px 13px; }
.shop-card.owned { opacity: .72; border-color: #8a6c3c; }
.shop-icon { font-size: 30px; flex: none; width: 36px; text-align: center; filter: drop-shadow(0 2px 3px rgba(0,0,0,.4)); }
.shop-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.shop-info b { font-size: 15px; }
.shop-info i { font-size: 11.5px; color: var(--ink-dim); font-style: normal; line-height: 1.35; }
.shop-buy { flex: none; min-width: 76px; padding: 9px 12px; font-size: 14px; font-weight: 800; color: #fff; background: var(--green); border: 2px solid #2c7c4c; border-bottom-width: 4px; border-radius: 10px; font-variant-numeric: tabular-nums; }
.shop-buy:active { transform: translateY(2px); border-bottom-width: 2px; }
.shop-buy.off { background: var(--panel); border-color: var(--line); color: var(--ink-faint); }
.shop-owned { flex: none; font-size: 13px; font-weight: 700; color: var(--yellow); }

/* ============ 其他 ============ */
.icp { text-align: center; padding: 10px 0 calc(14px + env(safe-area-inset-bottom, 0px)); }
.icp a { color: #4a4f6a; font-size: 11px; text-decoration: none; }
#btn-mute { position: fixed; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); z-index: 150; width: 44px; height: 44px; font-size: 19px; background: var(--panel); border: 2px solid var(--line); border-radius: 50%; opacity: .8; }

.day-trans { position: fixed; inset: 0; z-index: 500; background: #0a0c14; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 8px; animation: dayTrans 1.15s ease forwards; }
.day-trans .dt-day { font-size: 30px; font-weight: 900; color: var(--yellow); }
.day-trans .dt-sub { font-size: 14px; color: var(--ink-faint); }
@keyframes dayTrans { 0% { opacity: 0; } 18% { opacity: 1; } 75% { opacity: 1; } 100% { opacity: 0; } }

/* FX 层 */
#fx-layer { position: fixed; inset: 0; z-index: 350; pointer-events: none; overflow: hidden; }
.fx-confetti { position: absolute; border-radius: 1px; will-change: transform, opacity; }
.fx-coin { position: absolute; font-size: 20px; will-change: transform, opacity; }
@keyframes shake { 0%,100%{transform:translate(0,0)} 15%{transform:translate(-5px,3px)} 30%{transform:translate(5px,-3px)} 45%{transform:translate(-4px,-2px)} 60%{transform:translate(4px,2px)} 75%{transform:translate(-2px,2px)} 90%{transform:translate(2px,-1px)} }
@keyframes shakeHard { 0%,100%{transform:translate(0,0)} 12%{transform:translate(-9px,5px)} 28%{transform:translate(9px,-5px)} 44%{transform:translate(-7px,-3px)} 60%{transform:translate(7px,4px)} 76%{transform:translate(-4px,3px)} 90%{transform:translate(4px,-2px)} }
#app.shake { animation: shake .42s cubic-bezier(.36,.07,.19,.97) both; }
#app.shake-hard { animation: shakeHard .58s cubic-bezier(.36,.07,.19,.97) both; }
@media (prefers-reduced-motion: reduce) { #app.shake, #app.shake-hard { animation: none; } }

@media (max-width: 360px) {
  .word-grid { grid-template-columns: repeat(3, 1fr); }
  .word-btn { font-size: 13px; }
  .look-picker { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 380px) {
  .stats { grid-template-columns: 1fr 1fr 1fr; gap: 6px 8px; padding: 8px 12px 2px; }
  .action-btn .a-icon { font-size: 20px; }
  .action-btn .a-name { font-size: 14px; }
  .logo { letter-spacing: 2px; }
}
