*,
*::before,
*::after { box-sizing: border-box; }

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: #05070f;
  color: #e9edf9;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
  overscroll-behavior: none;
}

button {
  margin: 0;
  font-family: inherit;
  color: inherit;
  border: 0;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

button:focus-visible {
  outline: 2px solid #ffb15e;
  outline-offset: 2px;
}

[hidden] { display: none !important; }

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

.app {
  position: relative;
  width: 100%;
  max-width: 560px;
  height: 100vh;
  height: 100dvh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #080c18;
  isolation: isolate;
}

@media (min-width: 600px) {
  .app {
    box-shadow: 0 0 90px rgba(0, 0, 0, 0.85), 0 0 0 1px rgba(255, 255, 255, 0.04);
  }
}

/* ---------------- stage / room ---------------- */

.stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  background:
    radial-gradient(90% 55% at 50% 30%, rgba(37, 52, 92, 0.55), transparent 70%),
    linear-gradient(180deg, #070c1c, #0b1226 60%, #05070f);
}

.room {
  width: 100%;
  height: 100%;
  display: block;
}

.stage::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
  background:
    linear-gradient(180deg, rgba(3, 6, 14, 0.5) 0%, transparent 16%),
    linear-gradient(0deg, rgba(6, 9, 20, 0.62) 0%, transparent 22%);
}

.star { animation: twinkle 4.2s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }

.curtain-l,
.curtain-r { transform-box: fill-box; transform-origin: 50% 0; animation: sway 11s ease-in-out infinite; }
.curtain-r { animation-duration: 13s; animation-direction: reverse; }

.monster {
  transform-box: fill-box;
  transform-origin: 50% 100%;
  animation: monsterBreathe 5.6s ease-in-out infinite;
}
.monster-eyes { transform-box: fill-box; transform-origin: center; animation: eyeGlow 3.4s ease-in-out infinite; }
.monster.is-searching .monster-eyes { animation: eyeScan 0.95s ease-in-out infinite; }
.monster.is-attack { animation: monsterAttack 0.7s cubic-bezier(0.2, 0.8, 0.3, 1) both; }

.peek {
  opacity: 0;
  transition: opacity 0.18s ease;
  transform-box: fill-box;
  transform-origin: 50% 100%;
}
.peek.is-on { opacity: 1; animation: peekPop 0.5s cubic-bezier(0.18, 1.5, 0.4, 1) both; }
.app.is-start #kidBed { opacity: 1; animation: kidTremble 6s ease-in-out infinite; }

.kid-eyes {
  transform-box: fill-box;
  transform-origin: center;
  animation: blink 6.5s ease-in-out infinite;
}

.marker { opacity: 0; transition: opacity 0.2s ease; pointer-events: none; }
.marker.is-on { opacity: 1; }
.marker-ring {
  fill: none;
  stroke: #ffb15e;
  stroke-width: 3;
  stroke-dasharray: 10 9;
  filter: url(#glow);
  transform-box: fill-box;
  transform-origin: center;
}
.marker-core { fill: #ffb15e; }
.marker.is-search .marker-ring { animation: markerPing 0.9s ease-out 2; }
.marker.is-safe .marker-ring {
  stroke: #5ee0a0;
  stroke-dasharray: none;
  stroke-width: 4;
  animation: safePulse 1.3s ease-in-out infinite;
}
.marker.is-safe .marker-core { fill: #5ee0a0; }
.marker.is-wrong .marker-ring { stroke: #ff5e6c; animation: markerPing 0.9s ease-out 2; }
.marker.is-wrong .marker-core { fill: #ff5e6c; }

.motes {
  position: absolute;
  inset: 0;
  z-index: 2;
  overflow: hidden;
  pointer-events: none;
}
.motes span {
  position: absolute;
  bottom: -12px;
  left: var(--x);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: rgba(255, 216, 168, 0.55);
  box-shadow: 0 0 8px rgba(255, 195, 130, 0.4);
  animation: moteRise var(--t) linear infinite;
  animation-delay: var(--d);
}

.stage.is-hit { animation: stageShake 0.45s cubic-bezier(0.36, 0.07, 0.19, 0.97); }

.flash {
  position: absolute;
  inset: 0;
  z-index: 33;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(circle at 66% 42%, rgba(255, 66, 86, 0.42), rgba(120, 0, 24, 0.18) 42%, transparent 72%);
}
.flash.is-on { animation: hitFlash 0.6s ease-out; }

/* ---------------- HUD ---------------- */

.hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 30;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 7px;
  padding: calc(9px + env(safe-area-inset-top)) 12px 0;
  pointer-events: none;
  transition: opacity 0.25s ease, visibility 0.25s;
}
.hud > * { pointer-events: auto; }
.app.is-start .hud { opacity: 0; visibility: hidden; }

.hud-lives,
.hud-night,
.hud-score,
.icon-btn {
  background: rgba(9, 13, 27, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.hud-lives {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 36px;
  padding: 0 10px;
  border-radius: 12px;
}
.life { display: inline-flex; align-items: center; justify-content: center; }
.life .mp-icon {
  width: 17px;
  height: 17px;
  color: #ff6b6b;
  filter: drop-shadow(0 0 6px rgba(255, 90, 90, 0.5));
  transition: color 0.25s, filter 0.25s, transform 0.25s;
}
.life.is-lost .mp-icon { color: #39405a; filter: none; transform: scale(0.86); }
.life.is-pulse .mp-icon { animation: heartHit 0.5s ease-out; }

.hud-night {
  min-width: 92px;
  padding: 5px 11px 6px;
  border-radius: 12px;
  text-align: center;
}
.night-line {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 2px;
  font-size: 9.5px;
  letter-spacing: 1px;
  color: #97a2c2;
  line-height: 1.1;
}
.night-line b { font-size: 14px; font-weight: 900; color: #ffe9d6; letter-spacing: 0; }
.night-line em { font-style: normal; color: #6f7999; }
.pips { display: flex; justify-content: center; gap: 3px; margin-top: 4px; }
.pips i { width: 12px; height: 3px; border-radius: 2px; background: rgba(255, 255, 255, 0.13); }
.pips i.done { background: #ff8a3d; box-shadow: 0 0 6px rgba(255, 138, 61, 0.65); }
.pips i.now { background: #ffd2ae; animation: pipPulse 1.1s ease-in-out infinite; }

.hud-right { display: flex; align-items: center; gap: 6px; }
.hud-score {
  height: 36px;
  min-width: 54px;
  padding: 4px 9px;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-end;
}
.hud-score span { font-size: 8px; line-height: 1; color: #8b95b5; letter-spacing: 1px; }
.hud-score b { margin-top: 2px; font-size: 13px; line-height: 1; color: #ffe9d6; font-variant-numeric: tabular-nums; }

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #cdd5ea;
  transition: transform 0.12s ease, background 0.2s;
}
.icon-btn:active { transform: scale(0.92); }
.icon-btn .mp-icon { width: 19px; height: 19px; }
.ico-off { display: none; }
.app.is-muted .ico-on { display: none; }
.app.is-muted .ico-off { display: inline-block; }

/* ---------------- panel ---------------- */

.panel {
  position: relative;
  z-index: 40;
  flex: 0 0 auto;
  padding: 7px 14px calc(10px + env(safe-area-inset-bottom));
  border-radius: 22px 22px 0 0;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background:
    radial-gradient(120% 60% at 50% 0%, rgba(255, 138, 61, 0.09), transparent 62%),
    linear-gradient(180deg, #1b223b 0%, #121628 100%);
  box-shadow: 0 -18px 40px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}
.panel::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 15%;
  right: 15%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 170, 100, 0.55), transparent);
}
.panel-handle { width: 38px; height: 4px; margin: 1px auto 7px; border-radius: 999px; background: rgba(255, 255, 255, 0.14); }

.app.is-start .panel { display: none; }

.status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 22px;
}
.status-left { display: flex; align-items: center; gap: 7px; min-width: 0; }
.pulse-dot {
  flex: none;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #ff8a3d;
  box-shadow: 0 0 0 0 rgba(255, 138, 61, 0.55);
  animation: dotPulse 1.5s ease-out infinite;
}
.panel.is-safe .pulse-dot { background: #5ee0a0; box-shadow: 0 0 10px rgba(94, 224, 160, 0.6); animation: none; }
.panel.is-danger .pulse-dot { background: #ff5e6c; box-shadow: 0 0 10px rgba(255, 94, 108, 0.6); animation: dotPulse 0.7s ease-out infinite; }
.status-text {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.2px;
  color: #c7cfe5;
}
.timer {
  flex: none;
  min-width: 34px;
  font-size: 23px;
  line-height: 1;
  font-weight: 900;
  text-align: right;
  color: #ffb26b;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 16px rgba(255, 150, 80, 0.24);
}
.timer.is-urgent { color: #ff6b6b; animation: urgent 0.55s ease-in-out infinite; }

.timebar {
  height: 6px;
  margin: 6px 0 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.075);
  overflow: hidden;
}
.timebar i {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  transform: scaleX(0);
  transform-origin: left center;
  background: linear-gradient(90deg, #ff8a3d, #ffd08a);
  box-shadow: 0 0 12px rgba(255, 138, 61, 0.45);
}
.timebar i.is-safe { background: linear-gradient(90deg, #2fae78, #7bf0b8); box-shadow: 0 0 12px rgba(94, 224, 160, 0.4); }
.timebar.is-urgent i { background: linear-gradient(90deg, #ff4d5e, #ff8a6b); }

.clues {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 6px;
  min-height: 62px;
  margin-bottom: 6px;
}
.clue {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 100%;
  padding: 6px 9px;
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  background: rgba(255, 255, 255, 0.05);
  font-size: 12px;
  line-height: 1.2;
  color: #d8def0;
  animation: clueIn 0.3s cubic-bezier(0.2, 0.9, 0.3, 1) both;
}
.clue .tick {
  flex: none;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: rgba(255, 138, 61, 0.16);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.clue .tick::after { content: ""; width: 5px; height: 5px; border-radius: 50%; background: #ff8a3d; }
.clue.is-safe { border-color: rgba(94, 224, 160, 0.35); background: rgba(94, 224, 160, 0.08); }
.clue.is-safe .tick { background: rgba(94, 224, 160, 0.18); }
.clue.is-safe .tick::after { background: #5ee0a0; }

.ask {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin: 0 1px 7px;
}
.ask-title { font-size: 14px; font-weight: 800; color: #fff1df; letter-spacing: 0.3px; }
.ask-sub { font-size: 10px; color: #8c95b4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.spots { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; }
.spot {
  position: relative;
  height: 62px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.085);
  background: linear-gradient(180deg, #242d4b 0%, #192038 100%);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  transition: transform 0.12s ease, border-color 0.18s, background 0.18s, opacity 0.18s;
  overflow: hidden;
}
.spot::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(80% 60% at 50% 0%, rgba(255, 160, 90, 0.14), transparent 70%);
  pointer-events: none;
}
.spot:active { transform: scale(0.955); border-color: rgba(255, 170, 100, 0.45); }
.spot-ico { position: relative; z-index: 1; display: inline-flex; color: #ffb27a; filter: drop-shadow(0 0 7px rgba(255, 138, 61, 0.25)); }
.spot-ico svg { width: 23px; height: 23px; }
.spot-name { position: relative; z-index: 1; font-size: 11.5px; font-weight: 700; color: #dce2f5; letter-spacing: 0.2px; }
.spots.is-locked { pointer-events: none; }
.spots.is-locked .spot { opacity: 0.55; }
.spot.is-right {
  border-color: #5ee0a0;
  background: linear-gradient(180deg, #1d5944 0%, #143a2f 100%);
  box-shadow: 0 0 0 1px rgba(94, 224, 160, 0.25) inset, 0 6px 18px rgba(30, 180, 120, 0.2);
}
.spot.is-right .spot-ico { color: #7bf0b8; }
.spot.is-right .spot-name { color: #d6ffee; }
.spot.is-wrong {
  border-color: #ff5e6c;
  background: linear-gradient(180deg, #5a2233 0%, #391624 100%);
  animation: wrongShake 0.4s ease;
}
.spot.is-wrong .spot-ico { color: #ff8a94; }
.spot.is-wrong .spot-name { color: #ffd5d9; }

/* ---------------- floating feedback ---------------- */

.float-layer { position: absolute; inset: 0; z-index: 35; pointer-events: none; overflow: hidden; }
.float-score {
  position: absolute;
  left: 50%;
  top: 52%;
  transform: translate(-50%, -50%);
  font-size: 30px;
  font-weight: 900;
  letter-spacing: 1px;
  color: #ffd08a;
  text-shadow: 0 3px 0 #7a2e0e, 0 0 26px rgba(255, 138, 61, 0.6);
  animation: floatUp 1.05s ease-out both;
  white-space: nowrap;
}

/* ---------------- start screen ---------------- */

.screen { position: absolute; inset: 0; }
.screen.start {
  z-index: 50;
  display: flex;
  background:
    radial-gradient(110% 48% at 50% 96%, rgba(255, 138, 61, 0.18), transparent 62%),
    linear-gradient(180deg, rgba(4, 7, 15, 0.08) 0%, rgba(4, 7, 15, 0.38) 36%, rgba(4, 7, 15, 0.78) 60%, rgba(4, 7, 15, 0.97) 100%);
  transition: opacity 0.38s ease, transform 0.38s ease;
}
.screen.start::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 24%;
  background: linear-gradient(180deg, rgba(3, 5, 12, 0.62), transparent);
  pointer-events: none;
}
.screen.start.is-out { opacity: 0; transform: scale(1.025); pointer-events: none; }

.start-inner {
  position: relative;
  z-index: 1;
  width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: calc(env(safe-area-inset-top) + 8px) 22px calc(16px + env(safe-area-inset-bottom));
}
.start-top { padding-top: clamp(84px, 15vh, 170px); text-align: center; }
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  border-radius: 999px;
  border: 1px solid rgba(255, 190, 130, 0.24);
  background: rgba(16, 21, 38, 0.6);
  color: #ffc48f;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 2px;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
.eyebrow .mp-icon { width: 13px; height: 13px; color: #ffb15e; }

.game-title {
  margin: 14px 0 0;
  font-family: "Arial Black", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: clamp(50px, 15vw, 68px);
  line-height: 0.98;
  font-weight: 900;
  letter-spacing: 3px;
  color: #fff2e2;
  text-shadow: 0 4px 0 #2b1a14, 0 12px 34px rgba(0, 0, 0, 0.65);
}
.game-title span {
  color: #ff8a3d;
  text-shadow: 0 4px 0 #6e2a0e, 0 0 34px rgba(255, 138, 61, 0.38), 0 14px 34px rgba(0, 0, 0, 0.5);
}
.tagline {
  margin: 15px 0 0;
  font-size: 13.5px;
  line-height: 1.9;
  color: #b9c1d9;
  letter-spacing: 0.4px;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.65);
}

.start-bottom {
  width: 100%;
  max-width: 342px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 11px;
  animation: fadeUp 0.6s 0.15s cubic-bezier(0.2, 0.9, 0.3, 1) both;
}
.start-facts { display: flex; gap: 7px; }
.start-facts > div {
  flex: 1;
  padding: 7px 4px 6px;
  border-radius: 13px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  background: rgba(17, 23, 42, 0.62);
  text-align: center;
  -webkit-backdrop-filter: blur(9px);
  backdrop-filter: blur(9px);
}
.start-facts b { display: block; font-size: 19px; line-height: 1.1; font-weight: 900; color: #ffb26b; }
.start-facts span { display: block; margin-top: 2px; font-size: 9.5px; letter-spacing: 0.8px; color: #939cba; }

.btn-primary {
  position: relative;
  width: 100%;
  min-height: 56px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 20px;
  border-radius: 18px;
  overflow: hidden;
  background: linear-gradient(180deg, #ffa45c 0%, #ff7a28 54%, #f2651a 100%);
  color: #2a1206;
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 1.5px;
  box-shadow:
    0 10px 24px rgba(255, 122, 40, 0.32),
    inset 0 1px 0 rgba(255, 255, 255, 0.55),
    inset 0 -3px 0 rgba(120, 40, 0, 0.24);
  transition: transform 0.12s ease, box-shadow 0.18s ease;
}
.btn-primary::after {
  content: "";
  position: absolute;
  top: -30%;
  bottom: -30%;
  left: -40%;
  width: 34%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.42), transparent);
  transform: skewX(-18deg) translateX(-120%);
  animation: shine 3.4s ease-in-out infinite;
  pointer-events: none;
}
.btn-primary > * { position: relative; z-index: 1; }
.btn-primary .mp-icon { width: 24px; height: 24px; color: #2a1206; }
.btn-primary:active {
  transform: translateY(2px) scale(0.986);
  box-shadow: 0 4px 12px rgba(255, 122, 40, 0.28), inset 0 2px 5px rgba(120, 40, 0, 0.18);
}
.btn-start { min-height: 58px; font-size: 19px; }

.start-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 0 3px; }
.best-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10.5px;
  color: #8f99b8;
  letter-spacing: 0.5px;
}
.best-chip .mp-icon { width: 13px; height: 13px; color: #ffb15e; }
.best-chip b { font-size: 12px; color: #ffd7b3; font-variant-numeric: tabular-nums; }
.link-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 4px;
  font-size: 11px;
  color: #b8c1da;
  letter-spacing: 0.4px;
}
.link-btn .mp-icon { width: 14px; height: 14px; color: #ffb15e; }
.link-btn:active { opacity: 0.7; }

/* ---------------- end screen ---------------- */

.screen.end {
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  overflow: hidden;
}
.screen.end.win {
  background:
    radial-gradient(90% 52% at 50% 84%, rgba(255, 154, 61, 0.32), transparent 64%),
    linear-gradient(180deg, rgba(5, 8, 18, 0.92) 0%, rgba(20, 15, 29, 0.95) 55%, rgba(86, 38, 28, 0.94) 100%);
  -webkit-backdrop-filter: blur(5px);
  backdrop-filter: blur(5px);
}
.screen.end.lose {
  background:
    radial-gradient(75% 46% at 62% 34%, rgba(255, 70, 86, 0.18), transparent 62%),
    rgba(4, 5, 12, 0.93);
  -webkit-backdrop-filter: blur(7px);
  backdrop-filter: blur(7px);
}

.end-card {
  position: relative;
  width: 100%;
  max-width: 358px;
  padding: 20px 20px calc(16px + env(safe-area-inset-bottom));
  border-radius: 26px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: linear-gradient(180deg, rgba(30, 36, 59, 0.96) 0%, rgba(15, 18, 32, 0.98) 100%);
  box-shadow: 0 26px 60px rgba(0, 0, 0, 0.62), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  text-align: center;
  animation: cardIn 0.45s cubic-bezier(0.16, 0.9, 0.3, 1) both;
}
.screen.end.lose .end-card { border-color: rgba(255, 110, 120, 0.16); }

.end-art {
  position: relative;
  width: 86px;
  height: 86px;
  margin: 2px auto 10px;
  border-radius: 50%;
}
.screen.end.win .end-art {
  background: radial-gradient(circle at 50% 50%, rgba(255, 220, 170, 0.55) 0%, rgba(255, 154, 61, 0.22) 46%, transparent 70%);
}
.screen.end.win .end-art::before {
  content: "";
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  background: repeating-conic-gradient(from 0deg, rgba(255, 190, 110, 0.5) 0deg 2.5deg, transparent 2.5deg 20deg);
  -webkit-mask: radial-gradient(circle, transparent 54%, #000 56%);
  mask: radial-gradient(circle, transparent 54%, #000 56%);
  animation: spin 30s linear infinite;
}
.art-sun {
  display: none;
  position: absolute;
  inset: 25px;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 32%, #fff6df, #ffc46e 55%, #ff9a3d 100%);
  box-shadow: 0 0 24px rgba(255, 200, 120, 0.95);
}
.screen.end.win .art-sun { display: block; animation: sunPop 1.1s cubic-bezier(0.2, 1.4, 0.4, 1) both; }
.art-eye { display: none; }
.screen.end.lose .end-art {
  background: #08070f;
  box-shadow: inset 0 0 28px #000, 0 0 50px rgba(255, 90, 60, 0.16), 0 0 0 1px rgba(255, 140, 90, 0.16);
}
.screen.end.lose .art-eye {
  display: block;
  position: absolute;
  top: 35px;
  width: 18px;
  height: 10px;
  border-radius: 50%;
  background: #ff9a3d;
  box-shadow: 0 0 16px #ff7a28;
  animation: angryEye 2.4s ease-in-out infinite;
}
.screen.end.lose .art-eye.left { left: 22px; transform: rotate(9deg); }
.screen.end.lose .art-eye.right { right: 22px; transform: rotate(-9deg); animation-delay: -0.4s; }

.end-kicker {
  margin: 0 0 5px;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 3px;
  color: #9aa4c2;
  text-transform: uppercase;
}
.screen.end.win .end-kicker { color: #ffc38a; }
.screen.end.lose .end-kicker { color: #d58b95; }
.end-title {
  margin: 0;
  font-size: 31px;
  line-height: 1.2;
  font-weight: 900;
  letter-spacing: 2px;
  color: #fff2e2;
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.28);
}
.screen.end.win .end-title { text-shadow: 0 0 26px rgba(255, 154, 61, 0.4), 0 3px 0 rgba(0, 0, 0, 0.28); }
.screen.end.lose .end-title { color: #ffdfe2; text-shadow: 0 0 26px rgba(255, 70, 86, 0.28); }
.end-desc {
  margin: 8px auto 0;
  max-width: 280px;
  font-size: 12px;
  line-height: 1.7;
  color: #a6b0ca;
}
.end-score {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 4px;
  margin-top: 10px;
  color: #ffb26b;
}
.end-score b {
  font-size: 46px;
  line-height: 1;
  font-weight: 900;
  letter-spacing: 1px;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 3px 0 #6e2a0e, 0 0 28px rgba(255, 138, 61, 0.35);
}
.end-score span { font-size: 12px; color: #b3825d; }
.end-stats {
  display: flex;
  margin: 14px 0 12px;
  padding: 9px 4px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.035);
}
.end-stats > div { position: relative; flex: 1; min-width: 0; }
.end-stats > div + div::before {
  content: "";
  position: absolute;
  top: 12%;
  left: 0;
  width: 1px;
  height: 76%;
  background: rgba(255, 255, 255, 0.08);
}
.end-stats b { display: block; font-size: 16px; line-height: 1.2; color: #ffe9d6; font-variant-numeric: tabular-nums; }
.end-stats span { display: block; margin-top: 2px; font-size: 9px; letter-spacing: 0.5px; color: #8c95b4; }
.end-record {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: 0 auto 10px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 170, 100, 0.35);
  background: rgba(255, 138, 61, 0.12);
  color: #ffc38a;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1px;
  animation: recordPop 0.5s 0.25s cubic-bezier(0.2, 1.5, 0.4, 1) both;
}
.end-record .mp-icon { width: 12px; height: 12px; }
.end-card .btn-primary { min-height: 52px; font-size: 16px; margin-top: 2px; }
.btn-ghost {
  width: 100%;
  min-height: 44px;
  margin-top: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.035);
  color: #b9c2d9;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 1px;
}
.btn-ghost:active { transform: scale(0.985); background: rgba(255, 255, 255, 0.08); }

/* ---------------- modal ---------------- */

.modal { position: fixed; inset: 0; z-index: 80; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 5, 12, 0.74);
  -webkit-backdrop-filter: blur(7px);
  backdrop-filter: blur(7px);
}
.modal-card {
  position: relative;
  width: 100%;
  max-width: 360px;
  max-height: calc(100dvh - 40px);
  overflow-y: auto;
  padding: 22px 20px calc(16px + env(safe-area-inset-bottom));
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: linear-gradient(180deg, #1e253f 0%, #121628 100%);
  box-shadow: 0 26px 60px rgba(0, 0, 0, 0.62), inset 0 1px 0 rgba(255, 255, 255, 0.07);
  animation: cardIn 0.32s cubic-bezier(0.16, 0.9, 0.3, 1) both;
}
.modal-x {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #9aa4c2;
  background: rgba(255, 255, 255, 0.05);
}
.modal-x:active { transform: scale(0.92); }
.modal-x .mp-icon { width: 17px; height: 17px; }
.modal-kicker { margin: 0 0 4px; font-size: 9px; letter-spacing: 3px; color: #ffb26b; font-weight: 800; }
.modal-card h3 { margin: 0; font-size: 23px; letter-spacing: 1px; color: #fff1df; }
.how-list { list-style: none; margin: 15px 0 13px; padding: 0; display: flex; flex-direction: column; gap: 11px; }
.how-list li { display: flex; align-items: flex-start; gap: 10px; text-align: left; }
.how-num {
  flex: none;
  width: 24px;
  height: 24px;
  margin-top: 1px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 138, 61, 0.15);
  border: 1px solid rgba(255, 138, 61, 0.25);
  color: #ffb26b;
  font-size: 11px;
  font-weight: 900;
}
.how-list b { display: block; font-size: 13px; color: #ffe9d6; letter-spacing: 0.5px; }
.how-list p { margin: 3px 0 0; font-size: 11.5px; line-height: 1.65; color: #98a1be; }
.how-note {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  padding: 9px 10px;
  margin-bottom: 14px;
  border-radius: 11px;
  border: 1px solid rgba(255, 110, 120, 0.16);
  background: rgba(255, 90, 100, 0.06);
  font-size: 10.5px;
  line-height: 1.6;
  color: #c8a7ad;
  text-align: left;
}
.how-note .mp-icon { flex: none; width: 13px; height: 13px; margin-top: 2px; color: #ff6b6b; }

/* ---------------- keyframes ---------------- */

@keyframes twinkle {
  0%, 100% { opacity: 0.35; transform: scale(0.85); }
  50% { opacity: 1; transform: scale(1.15); }
}
@keyframes sway {
  0%, 100% { transform: rotate(0deg); }
  50% { transform: rotate(0.7deg); }
}
@keyframes monsterBreathe {
  0%, 100% { transform: scale(1) translateY(0); }
  50% { transform: scale(1.012) translateY(-4px); }
}
@keyframes eyeGlow {
  0%, 100% { opacity: 0.82; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.06); }
}
@keyframes eyeScan {
  0%, 100% { transform: translateX(-4px) scaleX(0.92); }
  50% { transform: translateX(4px) scaleX(1.04); }
}
@keyframes monsterAttack {
  0% { transform: scale(1) translate(0, 0); }
  35% { transform: scale(1.16) translate(-14px, -6px); }
  60% { transform: scale(1.1) translate(-8px, -2px); }
  100% { transform: scale(1) translate(0, 0); }
}
@keyframes peekPop {
  0% { opacity: 0; transform: scale(0.62) translateY(12px); }
  70% { opacity: 1; transform: scale(1.05) translateY(0); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes kidTremble {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  2% { transform: translate(-1px, 0) rotate(-0.4deg); }
  4% { transform: translate(1px, 0) rotate(0.4deg); }
  6% { transform: translate(0, 0) rotate(0deg); }
  50% { transform: translate(0, 1.5px) rotate(0deg); }
}
@keyframes blink {
  0%, 93%, 100% { transform: scaleY(1); }
  95% { transform: scaleY(0.1); }
  97% { transform: scaleY(1); }
}
@keyframes markerPing {
  0% { transform: scale(0.75); opacity: 1; }
  80% { transform: scale(1.35); opacity: 0.25; }
  100% { transform: scale(1.5); opacity: 0; }
}
@keyframes safePulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.08); opacity: 0.62; }
}
@keyframes moteRise {
  0% { transform: translate3d(0, 0, 0); opacity: 0; }
  12% { opacity: 0.7; }
  80% { opacity: 0.35; }
  100% { transform: translate3d(18px, -78vh, 0); opacity: 0; }
}
@keyframes stageShake {
  10%, 90% { transform: translate3d(-2px, 0, 0); }
  20%, 80% { transform: translate3d(4px, 0, 0); }
  30%, 50%, 70% { transform: translate3d(-6px, 1px, 0); }
  40%, 60% { transform: translate3d(6px, -1px, 0); }
}
@keyframes hitFlash {
  0% { opacity: 0; }
  18% { opacity: 1; }
  100% { opacity: 0; }
}
@keyframes heartHit {
  0%, 100% { transform: scale(0.86); }
  35% { transform: scale(1.35); }
  65% { transform: scale(0.76); }
}
@keyframes pipPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.42; }
}
@keyframes dotPulse {
  0% { box-shadow: 0 0 0 0 rgba(255, 138, 61, 0.5); }
  70% { box-shadow: 0 0 0 7px rgba(255, 138, 61, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 138, 61, 0); }
}
@keyframes urgent {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.12); opacity: 0.82; }
}
@keyframes clueIn {
  0% { opacity: 0; transform: translateY(6px) scale(0.96); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes floatUp {
  0% { opacity: 0; transform: translate(-50%, 8px) scale(0.8); }
  20% { opacity: 1; transform: translate(-50%, -4px) scale(1.06); }
  70% { opacity: 1; transform: translate(-50%, -34px) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -60px) scale(0.96); }
}
@keyframes wrongShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  50% { transform: translateX(5px); }
  75% { transform: translateX(-3px); }
}
@keyframes fadeUp {
  0% { opacity: 0; transform: translateY(16px); }
  100% { opacity: 1; transform: translateY(0); }
}
@keyframes shine {
  0%, 55% { transform: skewX(-18deg) translateX(-120%); }
  75%, 100% { transform: skewX(-18deg) translateX(620%); }
}
@keyframes cardIn {
  0% { opacity: 0; transform: translateY(18px) scale(0.97); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes recordPop {
  0% { opacity: 0; transform: scale(0.7); }
  70% { transform: scale(1.08); }
  100% { opacity: 1; transform: scale(1); }
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes sunPop {
  0% { opacity: 0; transform: scale(0.4); }
  70% { opacity: 1; transform: scale(1.12); }
  100% { opacity: 1; transform: scale(1); }
}
@keyframes angryEye {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.5); }
}

/* ---------------- responsive ---------------- */

@media (max-height: 720px) {
  .start-top { padding-top: clamp(52px, 10vh, 100px); }
  .game-title { font-size: clamp(42px, 12.5vw, 56px); }
  .tagline { margin-top: 10px; font-size: 12px; line-height: 1.75; }
  .start-inner { padding-left: 18px; padding-right: 18px; }
  .start-bottom { gap: 8px; }
  .start-facts > div { padding: 5px 3px; }
  .start-facts b { font-size: 16px; }
  .btn-primary { min-height: 50px; font-size: 16.5px; }
  .btn-start { min-height: 52px; font-size: 17.5px; }
  .clues { min-height: 56px; }
  .spot { height: 56px; }
  .clue { font-size: 11px; padding: 5px 8px; }
  .end-card { padding-top: 15px; }
  .end-art { width: 64px; height: 64px; margin-bottom: 5px; }
  .art-sun { inset: 18px; }
  .screen.end.lose .art-eye { top: 26px; }
  .screen.end.lose .art-eye.left { left: 15px; }
  .screen.end.lose .art-eye.right { right: 15px; }
  .end-title { font-size: 26px; }
  .end-score b { font-size: 38px; }
  .end-stats { margin: 10px 0; }
  .end-desc { font-size: 11px; }
}

@media (max-height: 600px) {
  .start-facts { display: none; }
  .start-top { padding-top: 40px; }
  .game-title { font-size: 42px; letter-spacing: 2px; }
  .tagline { font-size: 11.5px; }
  .start-foot { margin-top: 2px; }
  .panel { padding-top: 5px; }
  .panel-handle { display: none; }
  .status-row { min-height: 18px; }
  .timer { font-size: 19px; }
  .timebar { margin: 4px 0 5px; height: 5px; }
  .clues { min-height: 48px; margin-bottom: 4px; }
  .clue { font-size: 10.5px; padding: 4px 7px; }
  .ask { margin-bottom: 5px; }
  .ask-title { font-size: 12.5px; }
  .ask-sub { display: none; }
  .spot { height: 50px; border-radius: 12px; }
  .spot-ico svg { width: 20px; height: 20px; }
  .spot-name { font-size: 10.5px; }
  .hud-lives, .hud-score, .icon-btn, .hud-night { height: 31px; }
  .hud-score { min-width: 48px; }
  .hud-night { padding: 3px 9px; }
  .pips { margin-top: 3px; }
  .end-art { display: none; }
  .screen.end .end-card { padding-top: 20px; }
  .end-kicker { margin-top: 0; }
}

@media (max-width: 350px) {
  .panel { padding-left: 10px; padding-right: 10px; }
  .spots { gap: 5px; }
  .spot { height: 54px; }
  .spot-name { font-size: 10.5px; }
  .clue { font-size: 10.5px; }
  .hud { padding-left: 8px; padding-right: 8px; gap: 4px; }
  .hud-lives { padding: 0 7px; gap: 2px; }
  .life .mp-icon { width: 15px; height: 15px; }
  .hud-night { min-width: 78px; padding-left: 6px; padding-right: 6px; }
  .start-inner { padding-left: 16px; padding-right: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .star, .curtain-l, .curtain-r, .monster, .monster-eyes, .kid-eyes, .motes span,
  .app.is-start #kidBed, .btn-primary::after { animation: none !important; }
  .btn-primary, .spot, .screen.start { transition: none; }
}
