/* ============================================================
   铁窗求生记 · 像素风样式
   配色：水泥灰 / 冷钢蓝 / 牢灯暖黄 / 警报红
   ============================================================ */
: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);
  --native-safe-top: 0px;
  --native-safe-right: 0px;
  --native-safe-bottom: 0px;
  --native-safe-left: 0px;
  --app-safe-top: max(env(safe-area-inset-top, 0px), var(--native-safe-top));
  --app-safe-right: max(env(safe-area-inset-right, 0px), var(--native-safe-right));
  --app-safe-bottom: max(env(safe-area-inset-bottom, 0px), var(--native-safe-bottom));
  --app-safe-left: max(env(safe-area-inset-left, 0px), var(--native-safe-left));
}

* { 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); } }

/* ============ 服刑阶段 / 路线目标 ============ */
.campaign-card {
  margin: 8px 14px 2px; padding: 8px 11px 9px;
  background: linear-gradient(135deg, #1b2638, #1c2030);
  border: 2px solid #394966; border-radius: 11px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.04);
}
.campaign-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.campaign-top b { color: var(--teal); font-size: 12px; letter-spacing: .4px; }
.campaign-top span { color: var(--yellow); font-size: 12px; font-weight: 800; white-space: nowrap; }
.campaign-goal { color: var(--ink-dim); font-size: 11.5px; line-height: 1.35; margin-top: 3px; }
.campaign-meter { height: 5px; margin-top: 6px; overflow: hidden; background: #101522; border-radius: 99px; }
.campaign-meter i { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--teal), var(--green)); transition: width .35s ease; }
.campaign-card.ready { border-color: #8a6c3c; background: linear-gradient(135deg, #2a2414, #202333); }
.campaign-card.ready .campaign-top b { color: var(--yellow); }
.campaign-card.ready .campaign-meter i { background: linear-gradient(90deg, var(--yellow), var(--orange)); }

/* ============ 属性条 ============ */
.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: min(420px, calc(100vw - 24px));
  max-height: calc(100dvh - 24px); overflow: hidden;
  background: var(--panel); border: 3px solid var(--line); border-radius: 16px;
  padding: 14px; 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-scroll { max-height: calc(100dvh - 58px); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.mg-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; 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: 210px;
  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: 4px 3px 1px; }
.mg-intro .mg-emoji, .mg-result .mg-emoji { font-size: 46px; line-height: 1.1; }
.mg-intro h3 { font-size: 21px; color: var(--yellow); margin: 4px 0 8px; }
.mg-rule-list { display: grid; gap: 7px; margin: 8px 0 12px; text-align: left; }
.mg-rule-row { display: grid; grid-template-columns: 48px 1fr; gap: 8px; align-items: start; padding: 8px 10px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 9px; }
.mg-rule-row b { color: var(--yellow); font-size: 13px; }
.mg-rule-row span { color: var(--ink-dim); font-size: 13px; line-height: 1.45; }
.mg-tip { color: var(--teal); font-size: 12px; margin: -3px 0 10px; }
.mg-result { text-align: center; padding: 8px 4px 2px; }
.mg-result h3 { font-size: 22px; margin: 7px 0 2px; }
.mg-result-score { color: var(--yellow); font-size: 17px; font-weight: 900; }
.mg-result-reason { color: var(--ink-dim); font-size: 14px; margin: 10px 0 14px; white-space: pre-wrap; }
.mg-consequence { color: #ff9aa0; background: #3d1a2a; border: 1px solid var(--red); border-radius: 8px; padding: 7px; margin: -5px 0 12px; font-size: 12px; }
.mg-box button:focus-visible, .stash-cell:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; }

/* 通用大按钮（开关型小游戏） */
.slack-toggle { width: 100%; min-height: 50px; padding: 11px 10px; font-size: 16px; font-weight: 900; border-radius: 12px; border: 3px solid #2c7c4c; border-bottom-width: 5px; background: var(--green); color: #fff; touch-action: manipulation; }
.slack-toggle.working { background: var(--teal); border-color: #2a6db1; }
.slack-toggle.is-held { filter: brightness(1.2); transform: translateY(2px); border-bottom-width: 3px; }
.slack-toggle:disabled { opacity: .44; filter: grayscale(.3); cursor: default; }
.slack-toggle:active { transform: translateY(3px); border-bottom-width: 3px; margin-bottom: 3px; }
.slack-status { text-align: center; font-size: 14px; font-weight: 800; min-height: 25px; margin: 5px 0; }
.slack-status.danger { color: var(--red); animation: lowPulse .35s infinite; }
.slack-status.safe { color: var(--green); }
.mg-meter { margin: 6px 0 8px; }
.mg-meter-label { color: var(--ink-dim); font-size: 12px; font-weight: 700; margin-bottom: 3px; }
.mg-meter-track { height: 12px; background: var(--bg); border: 1px solid var(--line); border-radius: 99px; overflow: hidden; }
.mg-meter-fill { display: block; width: 0; height: 100%; background: linear-gradient(90deg, var(--teal), var(--green), var(--yellow)); transition: width .08s linear; }
.mg-control-row, .mg-choice-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.mg-choice-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.mg-big-cue { min-height: 72px; display: flex; align-items: center; justify-content: center; background: var(--panel-2); border: 2px solid var(--line); border-radius: 12px; font-size: 30px; font-weight: 900; }
.mg-cue-label { color: var(--yellow); font-size: 13px; font-weight: 800; text-align: center; margin: 4px 0; }

/* 选项型（唠嗑过招 / 探监） */
.mg-boss-bubble { position: relative; background: var(--panel-2); border: 2px solid var(--line); border-radius: 12px; padding: 10px 12px; margin: 6px 0 8px; font-size: 14px; font-weight: 700; color: var(--ink); min-height: 58px; line-height: 1.45; }
.mg-boss-bubble.crash { background: #3d1a2a; }
.mg-boss-face { font-size: 22px; margin-right: 6px; }
.mg-boss-hint { font-size: 12px; color: var(--yellow); min-height: 18px; text-align: center; margin-bottom: 7px; font-weight: 700; }
.mg-boss-hint.danger { color: var(--red); }
.mg-opts { display: flex; flex-direction: column; gap: 9px; }
.mg-opt { width: 100%; min-height: 48px; padding: 9px 11px; background: var(--panel); color: var(--ink); border: 2px solid var(--line); border-bottom-width: 4px; border-radius: 10px; font-size: 13px; font-weight: 700; text-align: left; white-space: normal; line-height: 1.35; touch-action: manipulation; }
.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)} }

/* 藏违禁品（查房） */
.mg-risk-legend { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; font-size: 10px; font-weight: 800; text-align: center; }
.mg-risk-legend .safe { color: var(--green); } .mg-risk-legend .uncertain { color: var(--yellow); } .mg-risk-legend .danger { color: var(--red); }
.stash-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin: 6px 0; touch-action: manipulation; }
.stash-cell { position: relative; min-height: 72px; background: var(--panel-2); border: 2px solid var(--line); border-radius: 10px; overflow: hidden; display: flex; align-items: center; justify-content: center; font-size: 28px; color: var(--ink); transition: transform .08s, border-color .15s, background .15s; touch-action: manipulation; }
.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.risk-safe { border-color: var(--green); } .stash-cell.risk-uncertain { border-color: var(--yellow); } .stash-cell.risk-danger { border-color: var(--red); }
.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); }

/* 各玩法舞台 */
.mg-sleep-stage { height: 105px; display: grid; place-items: center; background: #11172c; border: 2px solid var(--line); border-radius: 12px; font-size: 48px; transition: background .15s; }
.mg-sleep-stage.danger { background: #5a2630; box-shadow: inset 0 0 34px rgba(255,220,150,.35); }
.mg-assemble-stage { height: 210px; }
.mg-crate { position: absolute; display: grid; place-items: center; background: var(--orange); border: 2px solid var(--yellow); border-radius: 4px; font-size: 15px; transition: bottom .08s; }
.mg-runner-stage, .mg-climb-stage { position: relative; height: 210px; overflow: hidden; background: linear-gradient(#202a50, #151a2d); border: 2px solid var(--line); border-radius: 12px; touch-action: manipulation; }
.mg-lane-line { position: absolute; inset-block: 0; width: 1px; background: rgba(255,255,255,.12); }
.mg-finish-line, .mg-wall-top { position: absolute; inset: 2px 0 auto; text-align: center; color: var(--yellow); border-bottom: 2px dashed var(--yellow); font-size: 12px; font-weight: 900; z-index: 3; }
.mg-obstacle, .mg-runner-player, .mg-climber { position: absolute; width: 33.333%; text-align: center; font-size: 24px; transition: left .1s, bottom .06s linear, opacity .2s; z-index: 2; }
.mg-obstacle.passed { opacity: .3; } .mg-obstacle.hit { color: var(--red); transform: scale(1.3); }
.mg-runner-player, .mg-climber { bottom: 8px; }
.mg-lane-buttons { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 7px; }
.mg-lane-buttons .slack-toggle { min-height: 48px; padding: 8px 4px; font-size: 14px; }
.mg-trace-stage { position: relative; height: 220px; background: #eee6d4; border: 2px solid #776b5b; border-radius: 10px; overflow: hidden; touch-action: none; }
.mg-trace-stage svg { width: 100%; height: 100%; display: block; }
.mg-trace-guide { fill: none; stroke: #908878; stroke-width: 10; stroke-linecap: round; stroke-dasharray: 7 8; opacity: .32; }
.mg-trace-guide.current { stroke: #c9574f; opacity: .85; } .mg-trace-guide.done { stroke: #4f8b62; stroke-dasharray: none; opacity: .6; }
.mg-trace-ink { fill: none; stroke: #252525; stroke-width: 6; stroke-linecap: round; }
.mg-trace-start, .mg-trace-end { position: absolute; width: 18px; height: 18px; transform: translate(-50%,-50%); pointer-events: none; z-index: 4; }
.mg-trace-start { background: var(--red); border-radius: 50%; box-shadow: 0 0 0 3px rgba(230,79,87,.25); }
.mg-trace-end { border: 3px solid var(--green); border-radius: 3px; }
.mg-rollcall-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 7px; }
.mg-market-stage { position: relative; height: 165px; overflow: hidden; background: linear-gradient(#263457, #171b2a); border: 2px solid var(--line); border-radius: 12px; }
.mg-market-target { position: absolute; bottom: 8px; height: 52px; display: grid; place-items: center; background: rgba(255,205,117,.18); border: 2px dashed var(--yellow); border-radius: 8px; }
.mg-market-cig { position: absolute; left: 8%; bottom: 14px; font-size: 22px; z-index: 3; }
.mg-angle-needle { position: absolute; left: 8%; bottom: 18px; width: 76px; color: var(--teal); font-size: 38px; transform-origin: 0 100%; }
.mg-predicted { position: absolute; bottom: 4px; width: 3px; height: 28px; background: #fff; border-radius: 3px; opacity: .75; }
.mg-fact-card { background: #1a2741; border: 2px solid var(--teal); border-radius: 10px; padding: 8px 10px; color: #c9e3ff; font-size: 12px; font-weight: 700; line-height: 1.5; }
.mg-fold-stage { height: 220px; display: grid; place-items: center; background: #1a2031; border: 2px solid var(--line); border-radius: 12px; touch-action: none; }
.mg-quilt { position: relative; width: 82%; height: 72%; background: repeating-linear-gradient(0deg,#5a7ca8 0 22px,#668bb8 22px 44px); border: 4px solid #b9d4ed; border-radius: 8px; transition: width .25s, height .25s, transform .25s; }
.mg-quilt .mg-crease { position: absolute; inset: 0 50% 0 auto; border-right: 3px dashed rgba(255,255,255,.8); }
.mg-fold-arrow { position: absolute; inset: 50% auto auto 50%; transform: translate(-50%,-50%); color: #fff; font-size: 58px; font-weight: 900; text-shadow: 0 3px 6px #000; }
.mg-quilt.fold-1 { width: 58%; } .mg-quilt.fold-2 { width: 38%; } .mg-quilt.fold-3 { height: 42%; transform: translateY(-10%); }
.mg-climb-beam { position: absolute; inset: 0 auto 0 0; width: 33.333%; opacity: 0; background: rgba(255,240,170,.12); transition: left .15s, opacity .15s, background .15s; }
.mg-climb-beam.warning { opacity: 1; background: rgba(255,215,100,.18); border: 2px dashed var(--yellow); }
.mg-climb-beam.active { opacity: 1; background: rgba(230,79,87,.42); border: 2px solid var(--red); }

@media (max-height: 620px) {
  .mg-box { padding: 10px; }
  .mg-scroll { max-height: calc(100dvh - 44px); }
  .mg-intro .mg-emoji, .mg-result .mg-emoji { font-size: 38px; }
  .mg-rule-list { gap: 4px; margin: 4px 0 8px; }
  .mg-rule-row { padding: 5px 7px; }
  .mg-big-cue { min-height: 55px; font-size: 25px; }
  .mg-arena, .mg-runner-stage, .mg-climb-stage { height: 170px; }
  .mg-trace-stage, .mg-fold-stage { height: 180px; }
  .mg-market-stage { height: 130px; }
  .mg-opt { min-height: 42px; padding: 6px 9px; }
  .mg-boss-bubble { min-height: 48px; padding: 7px 9px; margin: 3px 0 5px; }
  .slack-toggle { min-height: 46px; padding: 8px; }
}

/* ============ 浮动提示 ============ */
#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; }
.help-support { display: flex; gap: 10px; margin-bottom: 18px; }
.help-support a { flex: 1; min-height: 44px; display: flex; align-items: center; justify-content: center; padding: 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: var(--yellow); text-decoration: none; }
.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) {
  .campaign-card { margin-inline: 12px; padding: 7px 9px 8px; }
  .campaign-top { align-items: flex-start; }
  .campaign-top b, .campaign-top span { font-size: 11px; }
  .campaign-goal { font-size: 10.5px; }
  .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; }
}


/* ============ 高墙生活 · v22 视觉与统一响应式布局 ============ */
:root {
  --bg: #101b25; --bg-2: #243341; --panel: #263642; --panel-2: #182630;
  --line: #425361; --ink: #f1eee5; --ink-dim: #c0c8ca; --ink-faint: #98a9af;
  --yellow: #efc17b; --orange: #cc9760; --green: #79ad92; --teal: #83b7c5;
  --red: #e9827c; --steel: #d2d9d6; --gold: #efc17b;
}
body { background-image: radial-gradient(ellipse at 50% 0, #314552 0, transparent 62%), linear-gradient(90deg, #0c151d, #182731 50%, #0c151d); background-size: auto; }
button { -webkit-font-smoothing: antialiased; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 3px solid var(--yellow); outline-offset: 3px; }
.hidden { display: none !important; }
#app { max-width: 560px; }
.btn, .qbtn, .action-btn { border-width: 1px; border-bottom-width: 3px; box-shadow: inset 0 1px 0 #ffffff0d, 0 2px 3px #0002; }
.btn { font-size: 15px; border-radius: 9px; }
.btn-primary { background: #e3b579; color: #1e2b32; border-color: #a77c47; text-shadow: none; }
.btn:active, .qbtn:active, .action-btn:active { transform: translateY(1px); margin-bottom: 0; border-bottom-width: 3px; filter: brightness(1.08); }
.btn:disabled { opacity: .48; }
.btn-icon { border-width: 1px; border-radius: 8px; width: 44px; height: 44px; }
.title-kicker { color: var(--yellow); letter-spacing: 4px; font-size: 11px; margin-bottom: 18px; }
#screen-title { padding: max(24px, var(--app-safe-top)) 24px max(24px, var(--app-safe-bottom)); }
#title-canvas { width: 100%; max-width: 440px; border: 1px solid #4b5964; border-radius: 12px 12px 2px 2px; margin-bottom: 23px; filter: none; box-shadow: 0 12px 28px #0005; }
.logo { font-family: "Songti SC", "STSong", "Noto Serif SC", serif; font-size: clamp(36px, 11vw, 54px); letter-spacing: 3px; text-shadow: 0 2px 0 #0a141d; color: var(--ink); }
.logo-2 { color: var(--yellow); text-shadow: inherit; }
.subtitle { margin: 13px 0 24px; font-size: 13px; letter-spacing: 2px; }
.menu { width: 100%; max-width: 440px; gap: 9px; }
.menu > .btn { min-height: 50px; }
.menu-secondary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin-top: 6px; }
.menu-secondary .btn { font-size: 12px; padding: 13px 4px; min-height: 48px; font-weight: 500; background: #1b2a34; }
.title-tip { font-size: 12px; line-height: 1.7; text-align: left; color: var(--ink-dim); border-left: 2px solid #647471; margin: 20px auto 0; max-width: 440px; padding-left: 12px; min-height: 44px; }
.title-credit { margin-top: 22px; color: var(--ink-faint); font-size: 10px; }
.hud { padding: 9px 14px; border: 0; background: none; }
.hud-day { font-size: 17px; font-variant-numeric: tabular-nums; }
.hud-level { font-size: 11px; color: #abbdbd; max-width: 230px; }
.hud-money { color: var(--yellow); font-size: 16px; text-shadow: none; }
#scene { border: 1px solid #52616a; border-radius: 10px; box-shadow: 0 6px 18px #0003; }
.scene-time, .sentence-tag, .daily-chip { border-radius: 4px; background: #12202ddd; backdrop-filter: none; }
.campaign-card { display: block; color: var(--ink); text-align: left; background: #23343e; border: 1px solid #455d66; border-left: 3px solid #83b7c5; border-radius: 5px; margin: 9px 14px 1px; padding: 9px 10px; }
.campaign-top { display: flex; }
.campaign-top b { font-size: 11px; }
.campaign-top span { font-size: 12px; }
.campaign-goal { display: block; font-size: 12px; line-height: 1.4; }
.campaign-goal::after { content: '  ›'; color: var(--yellow); }
.campaign-meter { display: block; height: 3px; margin-top: 6px; background: #0d1b24; }
.campaign-meter i { background: #87b8b4; }
.campaign-card.ready { background: #323a32; border-color: #b19865; }
.stats { gap: 7px 12px; padding: 10px 14px 5px; }
.stat-label { font-size: 11px; }
.stat-label b { font-size: 12px; }
.stat-bar { height: 6px; border: 0; background: #0e1c25; border-radius: 2px; }
.stat-fill { border-radius: 2px; background-image: none; box-shadow: none; }
.quickbar { gap: 7px; padding-top: 6px; }
.qbtn { border-color: #435662 !important; background: #21323d; border-radius: 7px; min-height: 44px; padding: 7px; font-size: 12px; font-weight: 600; gap: 5px; }
.qbtn .qb-ic { font-size: 16px; filter: none; }
.panel { border: 1px solid #3d535e; border-radius: 10px; background: #13232d; padding: 11px; margin-top: 9px; }
.panel-heading { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex: none; min-height: 27px; margin-bottom: 3px; color: var(--yellow); font-size: 11px; letter-spacing: .7px; }
#btn-more-actions { color: var(--ink-dim); background: none; border: 0; font-size: 11px; min-height: 28px; padding: 3px 0 3px 10px; }
#btn-more-actions:disabled { opacity: .35; cursor: default; }
#save-status { color: #a2b8af; font-size: 9px; letter-spacing: 0; font-weight: 400; }
.narr { font-size: 13px; line-height: 1.55; color: #d3dcdb; min-height: 40px; margin-bottom: 9px; }
.narr .narr-cursor { width: 3px; height: 12px; }
.actions { gap: 8px; }
.action-btn { background: linear-gradient(135deg, #2a3b45, #22323c); border-color: #4a606b; border-radius: 7px; padding: 10px 8px; }
.action-btn .a-icon { font-size: 25px; filter: none; }
.action-btn .a-name { font-size: 14px; margin-top: 6px; }
.action-btn .a-desc { font-size: 11px; color: var(--ink-dim); line-height: 1.35; margin-top: 4px; }
.action-btn .a-badge { font-size: 10px; color: var(--yellow); opacity: 1; filter: none; }
.action-btn.recovery { border-color: #86b99d; background: linear-gradient(135deg, #30493e, #233b35); }
.action-btn.route-action { border-color: #c0a77c; }
.action-btn .a-preview { display: block; color: #b8d0cd; font-size: 10px; font-variant-numeric: tabular-nums; margin-top: 4px; line-height: 1.35; }
.action-btn.wide { background: #e3b579; color: #1e2b32; border-color: #a77c47; min-height: 48px; }
.action-btn.wide .a-name { margin-top: 0; }
.result-summary { padding: 10px 12px; border: 1px solid #49665e; border-left: 3px solid #88b59d; background: #22372f; border-radius: 5px; font-size: 12px; line-height: 1.65; margin-bottom: 10px; }
.result-summary .result-title { display: block; color: var(--yellow); font-weight: 700; margin-bottom: 4px; }
.result-summary .delta { display: inline-block; margin: 2px 8px 2px 0; white-space: nowrap; }
.result-summary .negative { color: #f0aaa0; }
.result-summary .positive { color: #acd4bb; }
.panel:has(.single-action) .narr { max-height: none; overflow: visible; -webkit-line-clamp: unset; display: block; }
.panel:has(.single-action) { overflow-y: auto; }
.modal { border-width: 1px; border-color: #6f817f; border-radius: 12px; background: #21323d; padding: 23px 20px 18px; box-shadow: 0 22px 70px #0008; }
.modal-title { color: var(--yellow); font-family: "Songti SC", "STSong", serif; font-size: 23px; }
.modal-text { font-size: 14px; line-height: 1.75; }
.modal-icon { font-size: 38px; }
.modal { position: relative; }
.modal-close { position: absolute; top: 5px; right: 5px; width: 44px; height: 44px; background: transparent; border: 0; color: var(--ink-dim); font-size: 26px; border-radius: 8px; }
.modal-choices .btn { min-height: 48px; font-size: 14px; white-space: normal; }
.overlay { background: #08141de6; }
.mg-box { border-color: #5c726f; background: #21323d; }
.mg-rule-row { border-color: #435b65; background: #192b35; }
.mg-intro h3, .mg-result h3 { font-family: "Songti SC", "STSong", serif; }
.perk-opt { background: #172831; border-width: 1px; border-color: #51636b; border-radius: 7px; padding: 11px 10px; }
.perk-opt.sel { border-color: var(--yellow); background: #354033; }
.perk-opt .pk-info i { color: #bccac9; font-size: 12px; }
.name-input { background: #13232d; border-width: 1px; color: var(--ink); }
.route-detail { display: grid; gap: 8px; margin: 14px 0; }
.route-step { display: flex; justify-content: space-between; gap: 10px; border-bottom: 1px solid #43545f; padding: 8px 0; font-size: 13px; }
.route-step.complete { color: #acd4bb; }
.route-next { color: var(--yellow); padding: 10px 0; }
.journal-entry { border-bottom: 1px solid #43545f; padding: 12px 0; font-size: 13px; }
.journal-entry h4 { color: var(--yellow); margin: 0 0 5px; }
.journal-entry p { margin: 4px 0; }
.shop-card { border-width: 1px; background: #20313c; border-color: #455d65; border-radius: 9px; }
.shop-info i { font-size: 12px; color: var(--ink-dim); }
.shop-duration { display: block; color: var(--yellow); font-size: 11px; margin-top: 5px; }
.shop-buy { border-width: 1px; border-bottom-width: 3px; background: #83b59a; color: #152b22; }
.sub-header h2 { font-family: "Songti SC", "STSong", serif; color: var(--ink); }
#btn-mute { border-width: 1px; color: var(--ink); }
/* 游戏内返回链接放进菜单；站点注入的悬浮控件仅留在首页。 */
body[data-screen="screen-game"] #town-return-control,
body[data-screen="screen-shop"] #town-return-control,
body:has(.overlay:not(.hidden)) #town-return-control { display: none !important; }
html[data-native-app="1"] .icp { display: none; }
html[data-native-app="1"] #app { width: 100%; }
#screen-help, #screen-ach, #screen-codex, #screen-shop, #screen-ending { padding-top: var(--app-safe-top); padding-bottom: var(--app-safe-bottom); }
.overlay { padding: max(14px, var(--app-safe-top)) max(14px, var(--app-safe-right)) max(14px, var(--app-safe-bottom)) max(14px, var(--app-safe-left)); }

@media (max-width: 759px) {
  #app { width: 100%; }
  body[data-screen="screen-game"] { overflow: hidden; }
  body[data-screen="screen-game"] #app { height: 100dvh; min-height: 100dvh; overflow: hidden; }
  #screen-game.active { height: 100dvh; min-height: 0; padding: var(--app-safe-top) var(--app-safe-right) var(--app-safe-bottom) var(--app-safe-left); overflow-y: auto; animation: none; }
  body[data-screen="screen-game"] .icp { display: none; }
  #screen-game .hud { flex: none; min-height: 56px; padding: 5px 12px; margin: 0; }
  #screen-game .hud-day { font-size: 15px; }
  #screen-game .hud-level { font-size: 10px; max-width: 175px; }
  #screen-game .hud-right { gap: 57px; }
  #screen-game .hud-money { font-size: 14px; }
  #screen-game .btn-icon { width: 42px; height: 42px; }
  body[data-screen="screen-game"] #btn-mute { top: calc(7px + var(--app-safe-top)); right: calc(max(0px, (100vw - 560px) / 2) + 61px + var(--app-safe-right)); bottom: auto; width: 42px; height: 42px; border-radius: 8px; opacity: 1; }
  #screen-game .scene-wrap { padding-inline: 10px; flex: 0 0 clamp(145px, 25dvh, 230px); min-height: 0; overflow: hidden; }
  #screen-game #scene { width: 100%; height: 100%; aspect-ratio: auto; object-fit: cover; object-position: center; border-radius: 8px; }
  #screen-game .scene-time { top: 7px; left: 18px; padding: 2px 6px; font-size: 10px; }
  #screen-game .sentence-tag { bottom: 7px; left: 18px; padding: 2px 6px; font-size: 10px; }
  #screen-game .daily-chip { top: 7px; right: 18px; font-size: 10px; }
  #screen-game .campaign-card { flex: none; margin: 7px 10px 0; padding: 7px 9px; }
  #screen-game .campaign-top b, #screen-game .campaign-top span { font-size: 10.5px; }
  #screen-game .campaign-goal { font-size: 11px; line-height: 1.4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  #screen-game .campaign-meter { margin-top: 4px; }
  #screen-game .stats { flex: none; padding: 8px 11px 4px; gap: 6px 10px; }
  #screen-game .stat-label { font-size: 10.5px; line-height: 1.4; }
  #screen-game .stat-label b { font-size: 11px; }
  #screen-game .quickbar { flex: none; padding: 4px 10px 0; gap: 6px; }
  #screen-game .qbtn { min-height: 42px; padding: 5px; }
  #screen-game .panel { flex: 1 0 252px; min-height: 0; padding: 8px; margin: 7px 10px 8px; overflow: visible; }
  #screen-game .panel-heading { min-height: 24px; line-height: 1.25; margin: 0; }
  #screen-game .narr { flex: none; min-height: 32px; max-height: 36px; font-size: 12px; line-height: 1.5; margin-bottom: 6px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  #screen-game .actions { flex: 1 1 0; grid-template-columns: repeat(2, minmax(0,1fr)); grid-auto-rows: minmax(56px,1fr); align-content: stretch; gap: 7px; margin-top: 0; min-height: 0; overflow: visible; }
  #screen-game .action-btn { min-width: 0; min-height: 56px; padding: 5px; display: flex; flex-direction: column; justify-content: center; align-items: center; }
  #screen-game .action-btn .a-icon { font-size: 23px; line-height: 1; }
  #screen-game .action-btn .a-name { font-size: 13px; line-height: 1.3; margin-top: 4px; }
  #screen-game .action-btn .a-desc { font-size: 10.5px; line-height: 1.3; margin-top: 3px; }
  #screen-game .action-btn .a-preview { font-size: 10px; line-height: 1.2; margin-top: 3px; }
  #screen-game .actions.single-action { flex: 0 0 48px; grid-auto-rows: 48px; margin-top: auto; }
  #screen-game .actions.single-action .action-btn { min-height: 48px; }
  #screen-game .panel:has(.single-action) { overflow-y: auto; }
  #screen-game .panel:has(.single-action) .narr { max-height: none; overflow: visible; display: block; -webkit-line-clamp: unset; }
}
@media (max-width: 759px) and (max-height: 700px) {
  #screen-game .hud { min-height: 48px; padding-block: 3px; }
  #screen-game .hud-day { font-size: 13px; }
  #screen-game .hud-level { line-height: 1.25; }
  #screen-game .scene-wrap { flex-basis: clamp(80px, 17.5dvh, 122px); }
  #screen-game #scene { object-position: center bottom; }
  #screen-game .campaign-card { margin-top: 4px; padding: 5px 8px; }
  #screen-game .campaign-goal { display: none; }
  #screen-game .campaign-meter { margin-top: 4px; height: 3px; }
  #screen-game .stats { padding-block: 6px 3px; gap: 4px 9px; }
  #screen-game .stat-label { font-size: 10px; margin-bottom: 1px; }
  #screen-game .stat-bar { height: 5px; }
  #screen-game .quickbar { padding-top: 3px; }
  #screen-game .qbtn { min-height: 40px; font-size: 11px; }
  #screen-game .panel { flex-basis: 225px; margin-top: 5px; margin-bottom: 5px; padding: 6px; }
  #screen-game .panel-heading { min-height: 23px; font-size: 10px; }
  #screen-game #btn-more-actions { min-height: 23px; font-size: 10px; }
  #screen-game .narr { min-height: 28px; max-height: 29px; font-size: 10.5px; line-height: 1.35; margin-bottom: 4px; }
  #screen-game .actions { grid-auto-rows: minmax(49px,1fr); gap: 5px; }
  #screen-game .action-btn { min-height: 49px; padding: 3px; }
  #screen-game .action-btn .a-icon { font-size: 17px; }
  #screen-game .action-btn .a-name { font-size: 11px; margin-top: 2px; line-height: 1.15; }
  #screen-game .action-btn .a-desc { font-size: 9px; margin-top: 2px; line-height: 1.2; }
  #screen-game .action-btn .a-preview { font-size: 9px; margin-top: 2px; line-height: 1.15; }
  #screen-game .action-btn:has(.a-preview) .a-desc { display: none; }
  #screen-game .result-summary { font-size: 11px; padding: 7px 9px; }
}
@media (min-width: 760px) {
  body[data-screen="screen-game"] #app { max-width: 1060px; padding: 25px 24px; }
  #screen-game.active { display: grid; flex: 0 0 auto; grid-template-columns: minmax(0,1.1fr) minmax(0,1fr); grid-template-rows: auto auto auto auto auto; grid-template-areas: 'hud hud' 'scene panel' 'route panel' 'stats panel' 'quick panel'; gap: 10px 22px; align-content: start; }
  .hud { grid-area: hud; padding: 0 0 10px; }
  .scene-wrap { grid-area: scene; padding: 0; }
  .scene-time { left: 12px; }
  .sentence-tag { left: 12px; }
  .daily-chip { right: 12px; }
  .campaign-card { grid-area: route; margin: 0; }
  .stats { grid-area: stats; padding: 4px 0; }
  .quickbar { grid-area: quick; padding: 0; align-self: start; }
  .panel { grid-area: panel; margin: 0; min-height: 480px; }
  .actions { flex: 1; grid-auto-rows: minmax(92px,1fr); }
  .actions.single-action { flex: 0; grid-auto-rows: 48px; margin-top: auto; }
  body[data-screen="screen-game"] .icp { margin-top: auto; padding-top: 28px; }
}
@media (orientation: landscape) and (max-height: 600px) {
  body[data-screen="screen-game"] { overflow-y: auto; }
  body[data-screen="screen-game"] #app { height: auto; min-height: 100dvh; overflow: visible; }
  #screen-game.active { height: auto; min-height: 100dvh; overflow: visible; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* ============ v23 · 技巧、推理与节奏小游戏 ============ */
.mg-box[data-mg-screen="active"] { overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.mg-box .slack-toggle { background: #dcb47e; border-color: #a88657; color: #172831; font-size: 15px; }
.mg-box .slack-toggle.working { background: #49616d; border-color: #304b56; color: var(--ink); }
.mg-box .slack-toggle:disabled { opacity: .48; }
.mg-stack-foundation { position: absolute; bottom: 1px; height: 5px; background: #a4bfb6; border-radius: 2px; }
.mg-assemble-stage { background: repeating-linear-gradient(0deg, transparent 0 20px, #ffffff08 20px 21px), linear-gradient(#142936,#233d45); }
.mg-assemble-stage .mg-crate { border: 1px solid #e7c48e; border-radius: 2px; background: repeating-linear-gradient(90deg, #ac8050 0 15px, #be9360 15px 17px); box-shadow: inset 0 2px #fff2, 0 2px 2px #0004; }
.mg-breath-stage { height: 110px; display: grid; place-items: center; overflow: hidden; background: radial-gradient(ellipse, #345d69 0, #182d3b 65%); border-radius: 12px; margin: 8px 0; }
.mg-breath-ring { width: 82px; height: 82px; display: grid; place-items: center; border: 3px solid #adcecb; border-radius: 50%; outline: 9px solid #7cb1b51a; color: #e2f0e9; font: 26px "Songti SC", serif; box-shadow: 0 0 35px #99c9b81a; }
.mg-rhythm-track { height: 34px; position: relative; background: #13242e; border: 1px solid #4d6770; border-radius: 6px; margin: 12px 10px; }
.mg-rhythm-zone { position: absolute; height: 100%; background: #779a772e; border-inline: 1px dashed #bed2a6; }
.mg-rhythm-track::after { content: ''; position: absolute; left: 76%; height: 100%; width: 2px; background: #e0c080; }
.mg-rhythm-cursor { position: absolute; top: 50%; width: 13px; height: 13px; border: 2px solid #fff0c7; background: #edc98a; border-radius: 50%; transform: translate(-50%,-50%); z-index: 2; box-shadow: 0 0 9px #f9e6b466; }
.mg-fold-precision { position: relative; user-select: none; -webkit-user-select: none; touch-action: none; }
.mg-fold-handle, .mg-fold-target, .mg-fold-ghost { position: absolute; transform: translate(-50%,-50%); pointer-events: none; display: grid; place-items: center; }
.mg-fold-handle { width: 44px; height: 44px; border: 2px solid #fff0cb; background: #c19a59; color: #142935; border-radius: 50%; font-size: 24px; font-weight: 900; z-index: 4; box-shadow: 0 3px 8px #0004; }
.mg-fold-target { width: 58px; height: 48px; border: 2px dashed #e1ead1; background: #13293588; color: #ecf0d6; border-radius: 4px; font-size: 12px; z-index: 3; }
.mg-fold-ghost { display: none; width: 32px; height: 32px; background: #ece6c9bb; border: 1px solid #fff; border-radius: 3px; z-index: 5; }
.mg-fold-ghost.active { display: block; }
.mg-force-duel { display: flex; justify-content: space-around; align-items: center; min-height: 74px; background: #182b35; border-radius: 10px; font-size: 25px; margin: 8px 0 14px; }
.mg-force-track { height: 46px; position: relative; background: linear-gradient(90deg,#284958 0 78%,#73423d 96%); border: 2px solid #59717c; border-radius: 8px; overflow: hidden; }
.mg-force-zone { position: absolute; top: 3px; bottom: 3px; border: 2px solid #abcba1; background: #84ae8180; border-radius: 4px; }
.mg-force-pointer { position: absolute; top: 0; bottom: 0; width: 4px; background: #ffe3b1; transform: translateX(-50%); box-shadow: 0 0 8px #fff4; }
.mg-force-labels { display: flex; justify-content: space-between; font-size: 10px; color: var(--ink-dim); margin: 4px 0 12px; }
.mg-duel-stage { display: flex; justify-content: space-around; align-items: center; min-height: 112px; position: relative; background: repeating-linear-gradient(0deg,transparent 0 26px,#ffffff08 26px 27px),#1a303b; border: 1px solid #4d6570; border-radius: 10px; margin: 9px 0; }
.mg-duel-fighter { font-size: 43px; transition: transform .16s; }
.mg-duel-fighter.opponent.feint { transform: translateX(9px) rotate(10deg); opacity: .85; }
.mg-duel-stage[data-phase="counter"] .opponent { transform: rotate(-14deg); }
.mg-sequence-display { display: flex; justify-content: center; gap: 7px; flex-wrap: wrap; min-height: 88px; align-items: center; padding: 12px 7px; background: #172b35; border: 1px solid #4b646f; border-radius: 8px; margin: 10px 0; }
.mg-sequence-token { display: grid; place-items: center; width: 49px; height: 49px; border: 1px solid #526873; border-radius: 7px; background: #213843; color: #a9bfc5; font-size: 23px; }
.mg-sequence-token.active { background: #e4bd7e; color: #182c35; border-color: #f8ddb2; box-shadow: 0 0 12px #e0bc7555; }
.mg-sequence-token.good { background: #446958; color: #daead9; border-color: #8eba9c; }
.mg-sequence-token.reveal { border-color: #edb694; }
.mg-budget { display: flex; flex-wrap: wrap; gap: 7px; padding: 8px 9px; background: #152a33; border: 1px solid #526e73; border-radius: 7px; font-size: 12px; color: #dee9df; margin: 8px 0; }
.mg-choice-card { min-height: 64px; text-align: left; background: #263d47; border: 2px solid #4d6571; border-radius: 8px; color: var(--ink); padding: 9px; font-family: inherit; font-size: 12px; line-height: 1.45; touch-action: manipulation; }
.mg-choice-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
.mg-choice-card strong, .mg-choice-card b { display: block; font-size: 13px; margin-bottom: 3px; }
.mg-choice-card small { display: block; color: #bfd0cd; font-size: 11px; line-height: 1.4; }
.mg-choice-card.selected { border-color: #e5c28a; background: #455044; }
.mg-memory .stash-cell { font-size: 24px; min-height: 70px; }
.mg-memory.observation .stash-cell { border-color: #b9ca9b; }
.mg-memory.concealed .stash-cell { background: #233b48; }
.mg-serving { margin: 10px 0; }
.mg-serving-order { text-align: center; color: var(--yellow); font-weight: 800; font-size: 15px; margin-bottom: 7px; }
.mg-serving-bowl { position: relative; height: 146px; overflow: hidden; width: 78%; margin: 0 auto; border: 3px solid #bfd0cc; border-top: 0; border-radius: 5px 5px 34px 34px; background: #132733; }
.mg-serving-fill { position: absolute; bottom: 0; left: 0; width: 100%; background: repeating-linear-gradient(140deg,#e8d5a8 0 5px,#d4bd8e 5px 7px); border-top: 2px solid #f5e5bb; }
.mg-serving-zone { position: absolute; left: 0; right: 0; background: #8bbe9244; border-block: 2px dashed #a0d3a5; z-index: 2; }
.mg-serving-forecast { position: absolute; left: 0; width: 100%; border-top: 2px dotted #fff4c2; z-index: 3; }
.mg-serving-readout { text-align: center; color: var(--ink-dim); font-size: 12px; margin: 6px 0; }
.mg-serving-trays { display: flex; justify-content: center; gap: 8px; margin: 7px 0; }
.mg-serving-tray { min-width: 64px; padding: 5px; border: 1px solid #526f76; border-radius: 5px; font-size: 12px; text-align: center; }
.mg-note-track { position: relative; height: 215px; overflow: hidden; touch-action: manipulation; border: 1px solid #59717a; border-radius: 8px; background: repeating-linear-gradient(90deg,#142a35 0 33%,#59717a 33% 33.4%,#142a35 33.4% 66.2%,#59717a 66.2% 66.6%,#142a35 66.6% 100%); }
.mg-note-scan { position: absolute; left: 0; width: 100%; top: 76%; height: 16%; border-block: 1px dashed #d7be83; background: #ccae5d22; pointer-events: none; }
.mg-note-paper { position: absolute; width: 26%; max-width: 84px; min-height: 44px; height: 49px; transform: translate(-50%,-50%); border: 2px solid #d8c6a1; border-bottom-width: 4px; background: #eadfc4; color: #273842; border-radius: 5px; font-family: monospace; font-size: 20px; font-weight: 900; padding: 3px; }
.mg-note-target { color: var(--yellow); text-align: center; font-size: 18px; font-weight: 800; margin: 7px 0; }
.mg-note-paper span { display: block; font: 9px sans-serif; line-height: 1; color: #50616c; }
.mg-note-paper b { display: block; font-size: 22px; line-height: 1.2; }
.mg-note-scan { font-size: 10px; color: #dac49a; text-align: center; transform: translateY(-50%); display: grid; place-items: center; }
.mg-note-summary { color: var(--ink-dim); text-align: center; font-size: 12px; margin: 7px 0; }
@media (max-height: 620px) {
  .mg-box .mg-opt { min-height: 44px; }
  .mg-breath-stage { height: 82px; }
  .mg-breath-ring { width: 64px; height: 64px; }
  .mg-force-duel, .mg-sequence-display { min-height: 64px; margin-block: 6px; }
  .mg-duel-stage { min-height: 90px; }
  .mg-serving-bowl { height: 116px; }
  .mg-note-track { height: 180px; }
  .mg-choice-card { min-height: 57px; padding: 7px; }
  .mg-budget { padding: 5px 7px; font-size: 11px; }
}
