/* 雨夜咖啡馆 · 解谜 — 移动端竖屏 */
:root {
  --amber: #FF8A3D;
  --amber-2: #FFB15F;
  --amber-3: #FFD9AE;
  --amber-deep: #D9651F;
  --night: #071216;
  --ink: #F7EAD4;
  --muted: #A9B8B4;
  --muted-2: #7F938F;
  --line: rgba(255, 235, 210, .12);
  --glass: rgba(9, 22, 25, .74);
  --serif: "Songti SC", "Noto Serif CJK SC", "STSong", "SimSun", serif;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: #040a0d;
  color: var(--ink);
  font-family: var(--sans);
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}

body {
  background:
    radial-gradient(110% 70% at 50% 0%, #16343a 0%, #081419 52%, #030a0c 100%);
}

button {
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
  touch-action: manipulation;
}

.mp-icon { flex: none; }

.app {
  position: relative;
  width: 100%;
  height: 100dvh;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.stage {
  position: relative;
  width: 100vw;
  height: 100dvh;
  height: 100vh;
  overflow: hidden;
  isolation: isolate;
  background: #0b191d;
}

/* ============ 场景 ============ */
.scene {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.screen-shade {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background:
    linear-gradient(to bottom, rgba(4, 12, 15, .34) 0%, rgba(4, 12, 15, 0) 14%, rgba(4, 12, 15, 0) 60%, rgba(3, 9, 11, .52) 80%, rgba(3, 9, 11, .92) 100%);
}

/* 场景动画 */
.rain-streak {
  stroke: #cfe9ee;
  stroke-width: 1;
  stroke-linecap: round;
  opacity: .45;
  animation: rainFall linear infinite;
}

@keyframes rainFall {
  0% { transform: translateY(-34px); opacity: 0; }
  18% { opacity: .55; }
  75% { opacity: .38; }
  100% { transform: translateY(72px); opacity: 0; }
}

.neon-text { animation: neonFlicker 5.5s steps(1, end) infinite; }
.neon-glow { opacity: .55; animation: neonGlow 5.5s ease-in-out infinite; }

@keyframes neonFlicker {
  0%, 7%, 9%, 12%, 100% { opacity: 1; }
  8% { opacity: .45; }
  10% { opacity: .7; }
  56% { opacity: 1; }
  57% { opacity: .55; }
  58% { opacity: 1; }
}

@keyframes neonGlow {
  0%, 100% { opacity: .5; }
  50% { opacity: .74; }
}

.steam { transform-box: fill-box; transform-origin: 50% 100%; animation: steamRise 4.2s ease-in-out infinite; }
.steam-b { animation-delay: 1.2s; animation-duration: 4.8s; }
.steam-c { animation-delay: .7s; animation-duration: 4.4s; }
.steam-d { animation-delay: 2s; animation-duration: 5s; }

@keyframes steamRise {
  0% { transform: translateY(4px) scaleY(.9); opacity: 0; }
  28% { opacity: 1; }
  75% { opacity: .25; }
  100% { transform: translateY(-16px) scaleY(1.12); opacity: 0; }
}

.radio-wave { animation: radioBlink 2.4s ease-in-out infinite; }
@keyframes radioBlink { 0%, 100% { opacity: .2; } 50% { opacity: .75; } }

.box-lid {
  transition: transform .55s cubic-bezier(.2, .8, .2, 1);
  transform-box: fill-box;
  transform-origin: 8% 100%;
}
.stage.solved .box-lid { transform: translateY(-15px) rotate(-17deg); }
.box-key { transition: opacity .4s ease .18s; }
.stage.solved .box-key { opacity: 1; animation: keyFloat 2.6s ease-in-out infinite; }
@keyframes keyFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }

.door-glow { transition: opacity .7s ease; }
.stage.has-key .door-glow { opacity: 1; }

.stage.cleared .rain-streak { animation: none; opacity: 0; transition: opacity 1.6s ease; }
.stage.cleared .art { filter: brightness(1.12) saturate(1.04); transition: filter 1.6s ease; }
.stage.solved .box-key { opacity: 1; }

/* ============ 调查光点 ============ */
.spot {
  position: absolute;
  left: var(--x, 50%);
  top: var(--y, 50%);
  width: 46px;
  height: 46px;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
  -webkit-tap-highlight-color: transparent;
}

.spot-ring {
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  border: 1px solid rgba(255, 174, 105, .7);
  animation: spotPulse 2.8s ease-out infinite;
  pointer-events: none;
}

.spot-core {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #ffd6a6;
  background: rgba(8, 19, 22, .74);
  border: 1px solid rgba(255, 189, 130, .72);
  box-shadow:
    0 0 0 4px rgba(255, 138, 61, .06),
    0 4px 14px rgba(0, 0, 0, .4),
    inset 0 0 14px rgba(255, 138, 61, .22);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  transition: transform .16s ease, background .2s ease, box-shadow .2s ease;
}

.spot-core .mp-icon { width: 18px; height: 18px; }

.spot-label {
  position: absolute;
  top: 47px;
  left: 50%;
  transform: translateX(-50%) translateY(-2px);
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 10px;
  line-height: 1.6;
  letter-spacing: .05em;
  color: #ead9c2;
  background: rgba(4, 13, 15, .82);
  border: 1px solid rgba(255, 255, 255, .1);
  white-space: nowrap;
  opacity: 0;
  transition: opacity .35s ease, transform .35s ease;
  pointer-events: none;
}

.stage.labels-on .spot-label {
  opacity: .95;
  transform: translateX(-50%) translateY(0);
}

.spot:active .spot-core {
  transform: scale(.9);
  background: rgba(255, 138, 61, .26);
  box-shadow: 0 0 0 7px rgba(255, 138, 61, .12), 0 0 22px rgba(255, 138, 61, .5);
}

.spot-door .spot-core { color: #ffcf98; }

.stage.has-key .spot-door .spot-core {
  color: #fff0d6;
  background: rgba(255, 138, 61, .3);
  border-color: #ffd0a0;
  box-shadow: 0 0 0 6px rgba(255, 138, 61, .14), 0 0 26px rgba(255, 138, 61, .55);
}

.stage.has-key .spot-door .spot-ring {
  border-color: rgba(255, 205, 155, .95);
  animation-duration: 1.6s;
}

@keyframes spotPulse {
  0% { transform: scale(.8); opacity: .9; }
  70% { transform: scale(1.55); opacity: 0; }
  100% { transform: scale(1.55); opacity: 0; }
}

.spot:nth-of-type(2) .spot-ring { animation-delay: .55s; }
.spot:nth-of-type(3) .spot-ring { animation-delay: 1.1s; }
.spot:nth-of-type(4) .spot-ring { animation-delay: 1.65s; }
.spot:nth-of-type(5) .spot-ring { animation-delay: 2.2s; }

/* ============ 顶部控件 ============ */
.hud-top {
  position: absolute;
  top: calc(10px + var(--safe-t));
  left: 14px;
  right: 14px;
  z-index: 8;
  display: flex;
  justify-content: space-between;
  pointer-events: none;
}

.round-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #eadcc8;
  background: rgba(6, 16, 19, .58);
  border: 1px solid rgba(255, 255, 255, .13);
  box-shadow: 0 4px 14px rgba(0, 0, 0, .22);
  backdrop-filter: blur(9px);
  -webkit-backdrop-filter: blur(9px);
  pointer-events: auto;
  transition: transform .16s ease, background .2s ease;
}

.round-btn .mp-icon { width: 18px; height: 18px; }
.round-btn:active { transform: scale(.9); background: rgba(255, 138, 61, .18); }

/* ============ 底部操作 ============ */
.hud-bottom {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 8;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 30px 14px calc(10px + var(--safe-b));
  background: linear-gradient(to top, rgba(3, 9, 11, .94) 0%, rgba(3, 9, 11, .72) 44%, rgba(3, 9, 11, 0) 100%);
}

.ad-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 14px;
  text-align: left;
  color: #ffe4c6;
  background: linear-gradient(135deg, rgba(255, 138, 61, .24), rgba(255, 138, 61, .07));
  border: 1px solid rgba(255, 164, 96, .42);
  box-shadow: 0 6px 20px rgba(0, 0, 0, .24), inset 0 1px 0 rgba(255, 210, 165, .16);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: transform .16s ease, background .2s ease;
}

.ad-btn:active { transform: scale(.99); background: rgba(255, 138, 61, .22); }
.ad-btn[disabled] { opacity: .55; }

.ad-icon {
  width: 33px;
  height: 33px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: #2b1206;
  background: linear-gradient(140deg, #ffc07a, #ef7627);
  box-shadow: 0 3px 10px rgba(255, 138, 61, .28);
}

.ad-icon .mp-icon { width: 19px; height: 19px; }
.ad-copy { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.ad-copy b { font-size: 13px; font-weight: 600; letter-spacing: .01em; }
.ad-copy small { font-size: 10.5px; color: #c7b39c; }
.ad-tag {
  flex: none;
  font-size: 8px;
  letter-spacing: .13em;
  color: #ffcaa0;
  padding: 2px 5px;
  border-radius: 4px;
  border: 1px solid rgba(255, 196, 146, .4);
}

.clue-bar {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 15px;
  text-align: left;
  background: rgba(9, 22, 25, .8);
  border: 1px solid rgba(255, 255, 255, .1);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .22), inset 0 1px 0 rgba(255, 255, 255, .05);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: transform .16s ease, border-color .2s ease;
}

.clue-bar:active { transform: scale(.995); border-color: rgba(255, 177, 108, .4); }

.clue-book {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  flex: none;
  display: grid;
  place-items: center;
  color: #ffc38c;
  background: rgba(255, 255, 255, .055);
  border: 1px solid rgba(255, 255, 255, .06);
}

.clue-book .mp-icon { width: 19px; height: 19px; }
.clue-copy { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.clue-copy b { display: flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; }
.clue-copy em {
  font-style: normal;
  font-size: 9.5px;
  color: #ffc38c;
  background: rgba(255, 138, 61, .13);
  padding: 1px 5px;
  border-radius: 4px;
}
.clue-copy small {
  font-size: 10.5px;
  color: #9dafaa;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.key-chip {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 7px;
  border-radius: 20px;
  font-size: 10px;
  color: #ffe1b8;
  background: rgba(255, 138, 61, .15);
  border: 1px solid rgba(255, 183, 125, .42);
  animation: chipIn .4s cubic-bezier(.2, .9, .3, 1);
}
.key-chip[hidden] { display: none; }
.key-chip .mp-icon { width: 13px; height: 13px; color: #ffc88f; }

@keyframes chipIn { from { transform: scale(.7); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.chev { width: 16px; height: 16px; color: #718580; }

/* ============ 提示浮层 ============ */
.toast {
  position: absolute;
  left: 50%;
  bottom: calc(150px + var(--safe-b));
  z-index: 25;
  max-width: 82%;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 12px;
  line-height: 1.5;
  color: #f5e8d4;
  text-align: center;
  background: rgba(7, 18, 20, .92);
  border: 1px solid rgba(255, 175, 106, .35);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .3);
  backdrop-filter: blur(8px);
  opacity: 0;
  transform: translate(-50%, 8px);
  pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
}

.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ============ 遮罩与卡片 ============ */
.overlay {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 12px;
  background: rgba(2, 8, 10, .52);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .26s ease, visibility .26s ease;
}

.overlay.open { opacity: 1; visibility: visible; pointer-events: auto; }

.sheet {
  position: relative;
  width: 100%;
  max-width: 400px;
  max-height: 88dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 24px 20px calc(18px + var(--safe-b));
  border-radius: 24px;
  background: linear-gradient(178deg, #173034 0%, #0d2023 52%, #0a191c 100%);
  border: 1px solid rgba(255, 190, 130, .22);
  box-shadow: 0 -16px 60px rgba(0, 0, 0, .55), inset 0 1px 0 rgba(255, 216, 174, .12);
  transform: translateY(26px) scale(.98);
  transition: transform .3s cubic-bezier(.2, .8, .2, 1);
}

.overlay.open .sheet { transform: translateY(0) scale(1); }

.sheet::before {
  content: "";
  position: absolute;
  top: 0;
  left: 12%;
  right: 12%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 192, 138, .55), transparent);
}

.sheet-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #b9aaa0;
  background: rgba(255, 255, 255, .05);
  border: 1px solid rgba(255, 255, 255, .07);
}
.sheet-close .mp-icon { width: 17px; height: 17px; }
.sheet-close:active { background: rgba(255, 255, 255, .1); }

.sheet-badge {
  width: 46px;
  height: 46px;
  margin: 2px 0 12px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  color: #ffd0a0;
  background: linear-gradient(150deg, rgba(255, 155, 82, .24), rgba(255, 138, 61, .07));
  border: 1px solid rgba(255, 176, 111, .3);
  box-shadow: inset 0 1px 0 rgba(255, 220, 180, .12), 0 6px 18px rgba(0, 0, 0, .18);
}
.sheet-badge .mp-icon { width: 23px; height: 23px; }

.sheet-kicker {
  margin: 0 0 4px;
  font-size: 9.5px;
  letter-spacing: .18em;
  color: #c18c63;
  text-transform: uppercase;
}

.sheet-title {
  margin: 0 0 10px;
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: .04em;
  color: #f9ecda;
}

.sheet-body {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.85;
  color: #b8c6c1;
}

.primary-btn {
  width: 100%;
  height: 50px;
  margin-top: 18px;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: .06em;
  color: #2a1205;
  background: linear-gradient(140deg, #ffb15f 0%, #ff8a3d 48%, #ee6f1c 100%);
  box-shadow: 0 10px 24px rgba(238, 111, 28, .28), inset 0 1px 0 rgba(255, 235, 205, .5);
  transition: transform .14s ease, filter .14s ease;
}
.primary-btn:active { transform: translateY(1px) scale(.99); filter: brightness(.96); }

.ghost-btn {
  width: 100%;
  min-height: 42px;
  margin-top: 9px;
  border-radius: 12px;
  font-size: 12.5px;
  color: #b9c5c0;
  background: rgba(255, 255, 255, .035);
  border: 1px solid rgba(255, 255, 255, .075);
}
.ghost-btn:active { background: rgba(255, 255, 255, .08); }

.sheet-action { margin-top: 18px; }

/* 线索卡视觉 */
.evidence {
  position: relative;
  margin: 2px 0 14px;
  padding: 16px;
  border-radius: 16px;
  background: rgba(0, 0, 0, .2);
  border: 1px solid rgba(255, 255, 255, .07);
  overflow: hidden;
}
.evidence-note {
  padding: 18px 16px;
  background: linear-gradient(170deg, #f8ecd1, #e5cda4);
  color: #6d4c2d;
  border-radius: 4px;
  font-family: var(--serif);
  font-size: 13px;
  line-height: 1.9;
  letter-spacing: .03em;
  transform: rotate(-1.2deg);
  box-shadow: 0 7px 18px rgba(0, 0, 0, .24);
}
.evidence-note .tape {
  position: absolute;
  top: 5px;
  left: 50%;
  width: 62px;
  height: 16px;
  transform: translateX(-50%) rotate(-2deg);
  background: rgba(240, 226, 190, .58);
  opacity: .75;
}
.evidence-note .sig { display: block; margin-top: 8px; text-align: right; font-size: 11px; opacity: .7; }
.evidence-clock { display: flex; align-items: center; gap: 14px; }
.evidence-clock svg { width: 78px; height: 78px; flex: none; }
.evidence-clock .num { font-family: Georgia, "Times New Roman", serif; font-size: 27px; letter-spacing: .04em; color: #ffd5a6; }
.evidence-clock .lbl { font-size: 11px; color: #9fb0aa; margin-top: 2px; }
.evidence-radio { display: flex; align-items: center; gap: 13px; }
.evidence-radio .dial {
  width: 58px;
  height: 58px;
  flex: none;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #f1e4c8, #b8935d);
  border: 2px solid #6e4b2a;
  position: relative;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, .3);
}
.evidence-radio .dial::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 10px;
  width: 2px;
  height: 18px;
  background: #b95e25;
  transform-origin: 50% 100%;
  transform: translateX(-50%) rotate(38deg);
}
.evidence-radio .waves { display: flex; align-items: center; gap: 4px; height: 32px; }
.evidence-radio .waves i {
  display: block;
  width: 3px;
  border-radius: 3px;
  background: #ffae67;
  opacity: .75;
}
.evidence-radio .waves i:nth-child(1) { height: 8px; }
.evidence-radio .waves i:nth-child(2) { height: 16px; }
.evidence-radio .waves i:nth-child(3) { height: 26px; }
.evidence-radio .waves i:nth-child(4) { height: 14px; }
.evidence-radio .waves i:nth-child(5) { height: 20px; }
.evidence-radio .waves i:nth-child(6) { height: 9px; }
.evidence-door { display: flex; align-items: center; gap: 14px; }
.evidence-door .lock-ico {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex: none;
  color: #e7c59d;
  background: rgba(255, 255, 255, .05);
  border: 1px solid rgba(255, 217, 175, .22);
}
.evidence-door .lock-ico .mp-icon { width: 25px; height: 25px; }
.evidence-door p { margin: 0; font-size: 12px; line-height: 1.7; color: #9fb0aa; }
.recorded {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 13px;
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 11px;
  color: #ffcf9f;
  background: rgba(255, 138, 61, .09);
  border: 1px dashed rgba(255, 174, 107, .28);
}
.recorded .mp-icon { width: 14px; height: 14px; }

/* ============ 笔记 ============ */
.notebook-sheet { padding-bottom: calc(16px + var(--safe-b)); }
.notebook-list { margin-top: 6px; }
.clue-row {
  display: flex;
  gap: 11px;
  padding: 12px 0;
  border-bottom: 1px dashed rgba(255, 255, 255, .085);
}
.clue-row:last-child { border-bottom: 0; }
.clue-row .mark {
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: #ffce9b;
  background: rgba(255, 138, 61, .1);
  border: 1px solid rgba(255, 174, 107, .24);
}
.clue-row .mark .mp-icon { width: 17px; height: 17px; }
.clue-row .txt { min-width: 0; }
.clue-row h4 { margin: 1px 0 2px; font-size: 12.5px; font-weight: 600; color: #eedfca; }
.clue-row p { margin: 0; font-size: 11.5px; line-height: 1.6; color: #94a6a1; }
.clue-row.locked .mark { color: #647873; background: rgba(255, 255, 255, .03); border-color: rgba(255, 255, 255, .06); }
.clue-row.locked h4 { color: #7d918c; }
.clue-row.locked p { color: #627570; }
.notebook-foot {
  margin-top: 14px;
  padding: 11px 12px;
  border-radius: 11px;
  font-size: 11.5px;
  line-height: 1.65;
  color: #a9b8b3;
  background: rgba(255, 255, 255, .035);
  border: 1px solid rgba(255, 255, 255, .055);
}

/* ============ 密码锁 ============ */
.keypad-sheet { text-align: center; }
.lock-badge {
  width: 54px;
  height: 54px;
  margin: 2px auto 12px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  color: #ffcd99;
  background: linear-gradient(150deg, rgba(255, 155, 82, .22), rgba(255, 138, 61, .05));
  border: 1px solid rgba(255, 181, 119, .3);
}
.lock-badge .mp-icon { width: 26px; height: 26px; }
.keypad-sheet .sheet-title { margin-bottom: 4px; }

.code-display {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 16px 0 7px;
}
.code-display span {
  width: 46px;
  height: 54px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 25px;
  color: #ffe2bd;
  background: rgba(0, 0, 0, .3);
  border: 1px solid rgba(255, 185, 125, .22);
  box-shadow: inset 0 3px 9px rgba(0, 0, 0, .35);
  transition: border-color .18s ease, background .18s ease, transform .18s ease;
}
.code-display span.filled {
  border-color: rgba(255, 184, 121, .7);
  background: rgba(255, 138, 61, .1);
  transform: translateY(-1px);
}
.code-display.shake { animation: shake .42s cubic-bezier(.36, .07, .19, .97); }
@keyframes shake {
  10%, 90% { transform: translateX(-2px); }
  20%, 80% { transform: translateX(4px); }
  30%, 50%, 70% { transform: translateX(-7px); }
  40%, 60% { transform: translateX(7px); }
}

.code-hint {
  margin: 0 0 12px;
  font-size: 11px;
  line-height: 1.6;
  color: #91a39e;
  min-height: 18px;
}
.code-hint.err { color: #ff9f75; }

.keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 0 0 14px;
}
.keypad button {
  height: 47px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 18px;
  color: #f0e2cc;
  background: rgba(255, 255, 255, .055);
  border: 1px solid rgba(255, 255, 255, .075);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05), 0 2px 6px rgba(0, 0, 0, .12);
  transition: transform .1s ease, background .15s ease;
}
.keypad button:active { transform: scale(.95); background: rgba(255, 138, 61, .22); }
.keypad button.key-fn { font-size: 12px; color: #bba994; }
.keypad button .mp-icon { width: 19px; height: 19px; }

.inline-hint {
  margin-top: 12px;
  padding: 6px;
  font-size: 11px;
  color: #b99a7a;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ============ 开箱 ============ */
.reward-sheet { text-align: center; }
.reward-key {
  width: 86px;
  height: 86px;
  margin: 4px auto 14px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #ffd49c;
  background: radial-gradient(circle at 40% 34%, rgba(255, 212, 156, .32), rgba(255, 138, 61, .04) 70%);
  border: 1px solid rgba(255, 195, 135, .42);
  box-shadow: 0 0 40px rgba(255, 150, 70, .22), inset 0 0 22px rgba(255, 180, 110, .12);
  animation: keyGlow 2.6s ease-in-out infinite;
}
.reward-key .mp-icon { width: 38px; height: 38px; }
@keyframes keyGlow {
  0%, 100% { box-shadow: 0 0 34px rgba(255, 150, 70, .18), inset 0 0 22px rgba(255, 180, 110, .1); }
  50% { box-shadow: 0 0 54px rgba(255, 150, 70, .34), inset 0 0 26px rgba(255, 180, 110, .2); }
}
.reward-text { margin-bottom: 0; }
.reward-sheet .primary-btn { margin-top: 18px; }

/* ============ 广告 ============ */
.ad-sheet { text-align: center; }
.ad-state[hidden] { display: none; }
.ad-avatar {
  width: 54px;
  height: 54px;
  margin: 2px auto 12px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #ffd29d;
  background: radial-gradient(circle at 40% 30%, rgba(255, 190, 120, .28), rgba(255, 138, 61, .05));
  border: 1px solid rgba(255, 186, 125, .35);
}
.ad-avatar .mp-icon { width: 25px; height: 25px; }
.ad-avatar.fail { color: #b9c8c2; border-color: rgba(255, 255, 255, .12); background: rgba(255, 255, 255, .05); }
.ad-note { margin: 13px 0 0; font-size: 11px; color: #9dafaa; }
.ad-note b { color: #ffc18c; font-weight: 600; }

.ad-player {
  margin: 6px 0 4px;
  padding: 20px 16px 16px;
  border-radius: 16px;
  background: radial-gradient(circle at 50% 28%, rgba(255, 157, 82, .14), rgba(0, 0, 0, .22) 68%);
  border: 1px solid rgba(255, 255, 255, .07);
}
.ad-cup {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #ffc287;
  background: rgba(255, 138, 61, .1);
  border: 1px solid rgba(255, 168, 100, .28);
  animation: adBreathe 2.2s ease-in-out infinite;
}
.ad-cup .mp-icon { width: 30px; height: 30px; }
@keyframes adBreathe { 0%, 100% { transform: scale(1); opacity: .85; } 50% { transform: scale(1.06); opacity: 1; } }
.ad-progress {
  height: 5px;
  border-radius: 5px;
  overflow: hidden;
  background: rgba(255, 255, 255, .08);
  margin-bottom: 13px;
}
.ad-progress span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #ff9b50, #ffd09a);
  transition: width .3s linear;
}
.ad-status { margin: 0 0 5px; font-size: 13px; color: #eddfca; }
.ad-small { margin: 0; font-size: 10px; color: #80938e; letter-spacing: .04em; }

/* ============ 片头 ============ */
.overlay.intro-overlay {
  z-index: 40;
  align-items: center;
  padding: 20px;
  background: rgba(2, 7, 9, .34);
  backdrop-filter: blur(1.5px);
  -webkit-backdrop-filter: blur(1.5px);
}
.intro-overlay .intro-backdrop {
  position: absolute;
  inset: 0;
  background: radial-gradient(60% 48% at 50% 46%, rgba(255, 140, 66, .1), transparent 70%);
  pointer-events: none;
}
.intro-card {
  position: relative;
  width: 100%;
  max-width: 356px;
  padding: 26px 24px 20px;
  border-radius: 26px;
  text-align: center;
  background:
    radial-gradient(90% 50% at 50% 0%, rgba(255, 157, 82, .14), transparent 72%),
    linear-gradient(168deg, rgba(25, 44, 45, .97), rgba(9, 23, 26, .99));
  border: 1px solid rgba(255, 191, 133, .26);
  box-shadow: 0 30px 80px rgba(0, 0, 0, .58), inset 0 1px 0 rgba(255, 220, 180, .14);
  overflow: hidden;
}
.intro-card::before {
  content: "";
  position: absolute;
  top: -70px;
  left: 50%;
  width: 220px;
  height: 150px;
  transform: translateX(-50%);
  background: radial-gradient(circle, rgba(255, 143, 66, .25), transparent 68%);
  pointer-events: none;
}
.intro-card::after {
  content: "";
  position: absolute;
  left: 16px;
  right: 16px;
  top: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 205, 160, .5), transparent);
}
.intro-stamp {
  position: relative;
  width: 54px;
  height: 54px;
  margin: 0 auto 13px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #ffd7a8;
  background: radial-gradient(circle at 38% 30%, rgba(255, 198, 132, .3), rgba(255, 138, 61, .06));
  border: 1px solid rgba(255, 190, 130, .4);
  box-shadow: 0 0 28px rgba(255, 140, 60, .16);
}
.intro-stamp .mp-icon { width: 26px; height: 26px; }
.eyebrow {
  margin: 0;
  font-size: 9.5px;
  letter-spacing: .2em;
  color: #c18c63;
  text-transform: uppercase;
}
.intro-card h1 {
  margin: 8px 0 5px;
  font-family: var(--serif);
  font-size: 33px;
  line-height: 1.2;
  letter-spacing: .1em;
  text-indent: .1em;
  color: #ffe9cf;
  text-shadow: 0 0 26px rgba(255, 147, 70, .22);
}
.intro-sub {
  margin: 0;
  font-size: 12px;
  letter-spacing: .08em;
  color: #d0a980;
}
.intro-text {
  margin: 16px 0 16px;
  font-size: 13px;
  line-height: 1.95;
  color: #b7c4bf;
}
.intro-tips {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 11px 13px;
  margin-bottom: 18px;
  border-radius: 12px;
  background: rgba(255, 255, 255, .035);
  border: 1px solid rgba(255, 255, 255, .06);
}
.intro-tips span {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  color: #b8c5c0;
}
.intro-tips .mp-icon { width: 15px; height: 15px; color: #eab17b; }
.intro-foot {
  margin: 11px 0 0;
  font-size: 9.5px;
  letter-spacing: .1em;
  color: #70847f;
}

/* ============ 结局 ============ */
.overlay.ending-overlay {
  z-index: 50;
  align-items: center;
  padding: 20px;
  background: rgba(2, 8, 10, .5);
}
.ending-sky {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(60% 34% at 50% 24%, rgba(255, 170, 100, .4), transparent 72%),
    linear-gradient(180deg, #1c3b40 0%, #0c2025 48%, #050d10 100%);
  opacity: .96;
}
.ending-card {
  position: relative;
  width: 100%;
  max-width: 350px;
  padding: 27px 24px 21px;
  border-radius: 26px;
  text-align: center;
  background: linear-gradient(168deg, rgba(26, 46, 47, .97), rgba(8, 21, 24, .99));
  border: 1px solid rgba(255, 195, 136, .28);
  box-shadow: 0 32px 80px rgba(0, 0, 0, .6), inset 0 1px 0 rgba(255, 224, 185, .14);
}
.ending-badge {
  width: 58px;
  height: 58px;
  margin: 0 auto 13px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #ffd7a4;
  background: radial-gradient(circle at 40% 30%, rgba(255, 194, 125, .28), rgba(255, 138, 61, .04));
  border: 1px solid rgba(255, 195, 135, .38);
  box-shadow: 0 0 32px rgba(255, 152, 72, .2);
}
.ending-badge .mp-icon { width: 28px; height: 28px; }
.ending-card h2 {
  margin: 7px 0 10px;
  font-family: var(--serif);
  font-size: 34px;
  letter-spacing: .12em;
  text-indent: .12em;
  color: #ffe8cd;
}
.ending-text {
  margin: 0 0 17px;
  font-size: 12.5px;
  line-height: 1.9;
  color: #b3c1bc;
}
.ending-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  overflow: hidden;
  border-radius: 13px;
  background: rgba(255, 255, 255, .07);
  border: 1px solid rgba(255, 255, 255, .07);
  margin-bottom: 4px;
}
.ending-stats div {
  padding: 11px 4px 10px;
  background: rgba(7, 18, 21, .82);
}
.ending-stats span { display: block; font-size: 9.5px; letter-spacing: .08em; color: #869a95; margin-bottom: 3px; }
.ending-stats b { display: block; font-size: 17px; font-weight: 600; color: #ffd5a4; letter-spacing: .03em; }
.ending-foot {
  margin: 12px 0 0;
  font-size: 9px;
  letter-spacing: .18em;
  color: #6c817c;
}

/* ============ 桌面预览 ============ */
@media (min-width: 620px) {
  .app { padding: 0; }
  .stage {
    width: min(430px, calc(100dvh * 390 / 844));
    height: min(100dvh, calc(430px * 844 / 390));
    border-radius: 22px;
    box-shadow: 0 30px 90px rgba(0, 0, 0, .68), 0 0 0 1px rgba(255, 255, 255, .06);
  }
  .hud-bottom { padding-left: 16px; padding-right: 16px; }
}

@media (max-height: 700px) {
  .hud-bottom { gap: 6px; padding-top: 22px; }
  .ad-btn { padding: 7px 10px; }
  .clue-bar { padding: 8px 10px; }
  .ad-copy small { display: none; }
  .intro-card { padding: 20px 20px 16px; }
  .intro-card h1 { font-size: 29px; }
  .intro-text { margin: 12px 0; line-height: 1.8; }
  .intro-tips { margin-bottom: 14px; }
  .sheet { padding-top: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  .rain-streak, .neon-text, .neon-glow, .steam, .radio-wave,
  .spot-ring, .reward-key, .ad-cup, .box-key, .key-chip {
    animation: none !important;
  }
  .overlay, .sheet, .toast, .spot-core, .box-lid { transition-duration: .01ms !important; }
}
