/* =========================================================
   午夜回廊 · 夜间躲怪物解谜
   深色电影感 / 移动端竖屏 / 主色 #FF8A3D
   ========================================================= */

:root {
  --amber: #ff8a3d;
  --amber-2: #ffb877;
  --amber-3: #ffd9b4;
  --amber-deep: #b34e17;
  --blood: #c8322e;
  --bg: #06070a;
  --bg-2: #0b0d11;
  --panel: #101216;
  --line: rgba(255, 235, 210, .09);
  --line-strong: rgba(255, 138, 61, .34);
  --bone: #efe6d7;
  --text: #d8cdbb;
  --muted: #938b7d;
  --dim: #666159;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --font-ui: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  --font-serif: "Songti SC", "STSong", "SimSun", "Noto Serif SC", Georgia, serif;
}

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

html, body {
  height: 100%;
  margin: 0;
  background: #030405;
  color: var(--bone);
  font-family: var(--font-ui);
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body { user-select: none; -webkit-user-select: none; }

button {
  font-family: inherit;
  color: inherit;
  border: 0;
  background: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  touch-action: manipulation;
}
button:focus { outline: none; }
button:focus-visible { outline: 2px solid rgba(255, 138, 61, .8); outline-offset: 2px; }
input { font-family: inherit; }

.app {
  position: relative;
  width: 100%;
  max-width: 520px;
  height: 100vh;
  height: 100dvh;
  margin: 0 auto;
  overflow: hidden;
  background: var(--bg);
  isolation: isolate;
}

@media (min-width: 521px) {
  body { background: radial-gradient(circle at 50% 20%, #10151b 0%, #040506 62%); }
  .app {
    box-shadow: 0 0 0 1px rgba(255, 255, 255, .05), 0 30px 120px rgba(0, 0, 0, .85);
  }
}

.screen {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
}
.screen.is-active { display: flex; animation: screenIn .38s ease both; }

@keyframes screenIn {
  from { opacity: 0; transform: scale(1.012); }
  to { opacity: 1; transform: scale(1); }
}

.kicker {
  margin: 0;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .32em;
  text-transform: uppercase;
  color: var(--amber);
  text-indent: .32em;
}

.mp-icon { flex: 0 0 auto; }

/* =========================================================
   大厅
   ========================================================= */

.screen-home {
  padding: calc(12px + var(--safe-t)) 18px calc(16px + var(--safe-b));
  overflow: hidden;
}

.home-art {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background: #06080b;
}
.mansion-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
.window-lit { animation: windowFlicker 8.5s ease-in-out infinite; }
.window-lit:nth-of-type(2n) { animation-duration: 11s; animation-delay: -3s; }
.window-lit:nth-of-type(3n) { animation-duration: 6.8s; animation-delay: -1.4s; }

@keyframes windowFlicker {
  0%, 100% { opacity: 1; }
  41% { opacity: 1; }
  43% { opacity: .62; }
  45% { opacity: .94; }
  47% { opacity: .48; }
  49% { opacity: 1; }
  72% { opacity: .82; }
  74% { opacity: 1; }
}

.home-fog {
  position: absolute;
  left: -40%;
  right: -40%;
  bottom: 8%;
  height: 42%;
  pointer-events: none;
  background: radial-gradient(ellipse at 50% 50%, rgba(164, 184, 202, .13) 0%, rgba(120, 142, 160, .05) 42%, rgba(0, 0, 0, 0) 70%);
  filter: blur(21px);
  animation: fogDrift 26s ease-in-out infinite alternate;
}
.fog-b {
  bottom: -2%;
  height: 48%;
  opacity: .72;
  animation-duration: 37s;
  animation-direction: alternate-reverse;
  background: radial-gradient(ellipse at 46% 50%, rgba(140, 164, 184, .10) 0%, rgba(90, 110, 130, .04) 46%, rgba(0, 0, 0, 0) 72%);
}
@keyframes fogDrift {
  0% { transform: translate3d(-6%, 0, 0) scale(1); }
  50% { transform: translate3d(4%, -2%, 0) scale(1.08); }
  100% { transform: translate3d(9%, 1%, 0) scale(.98); }
}

.home-grain {
  position: absolute;
  inset: 0;
  opacity: .05;
  mix-blend-mode: overlay;
  pointer-events: none;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="140" height="140"><filter id="n"><feTurbulence type="fractalNoise" baseFrequency=".86" numOctaves="2"/></filter><rect width="140" height="140" filter="url(%23n)" opacity=".7"/></svg>');
}
.home-scrim {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(3, 4, 6, .62) 0%, rgba(3, 4, 6, 0) 20%, rgba(3, 4, 6, 0) 46%, rgba(3, 4, 6, .58) 64%, #050608 82%, #050608 100%),
    radial-gradient(ellipse at 50% 38%, rgba(6, 8, 11, 0) 30%, rgba(3, 4, 6, .45) 100%);
}

.home-top {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.profile {
  display: flex;
  align-items: center;
  gap: 9px;
  max-width: calc(100% - 58px);
  padding: 5px 12px 5px 5px;
  border-radius: 999px;
  border: 1px solid rgba(255, 138, 61, .24);
  background: linear-gradient(135deg, rgba(14, 16, 21, .78), rgba(9, 10, 13, .52));
  box-shadow: 0 6px 22px rgba(0, 0, 0, .4), inset 0 1px 0 rgba(255, 255, 255, .05);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  text-align: left;
}
.profile:active { transform: scale(.985); }
.avatar {
  position: relative;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-family: var(--font-serif);
  font-size: 17px;
  color: #ffe0bf;
  background: radial-gradient(circle at 35% 28%, #503421 0%, #241811 52%, #0b0c0f 100%);
  border: 1.5px solid #ff9c57;
  box-shadow: 0 0 0 3px rgba(255, 138, 61, .08), 0 0 20px rgba(255, 138, 61, .22);
  flex: 0 0 auto;
}
.avatar::after {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: 50%;
  border-bottom: 1.5px solid rgba(255, 214, 170, .85);
}
.profile-txt { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.profile-txt b {
  display: block;
  max-width: 128px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: .02em;
  color: #f2e7d6;
}
.profile-txt small {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 9.5px;
  letter-spacing: .04em;
  color: #9d9587;
  white-space: nowrap;
}
.live-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #8fd3a8;
  box-shadow: 0 0 6px #8fd3a8;
  display: inline-block;
}
.profile-edit { width: 14px !important; height: 14px !important; color: #776f63; }

.icon-btn {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  color: #cfc1ad;
  border: 1px solid var(--line);
  background: rgba(11, 13, 17, .68);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: transform .12s ease, background .2s ease, border-color .2s ease;
}
.icon-btn .mp-icon { width: 21px; height: 21px; }
.icon-btn:active { transform: scale(.92); background: rgba(255, 138, 61, .14); border-color: var(--line-strong); }
.icon-btn.glass { background: rgba(8, 10, 14, .5); }

.home-title {
  position: relative;
  z-index: 3;
  margin-top: clamp(22px, 7.2vh, 64px);
  text-align: center;
  pointer-events: none;
}
.home-title .kicker { color: rgba(255, 166, 104, .9); }
.home-title h1 {
  margin: 5px 0 0;
  font-family: var(--font-serif);
  font-size: clamp(43px, 13vw, 58px);
  line-height: 1.04;
  font-weight: 700;
  letter-spacing: .11em;
  text-indent: .11em;
  color: #f7eee0;
  text-shadow:
    0 2px 0 rgba(0, 0, 0, .6),
    0 0 22px rgba(255, 138, 61, .3),
    0 0 64px rgba(160, 88, 40, .32),
    0 10px 40px rgba(0, 0, 0, .8);
}
.home-title h1::after {
  content: "";
  display: block;
  width: 42px;
  height: 1px;
  margin: 12px auto 0;
  background: linear-gradient(90deg, transparent, rgba(255, 138, 61, .85), transparent);
}
.tagline {
  margin: 9px 0 0;
  font-size: 11.5px;
  letter-spacing: .28em;
  text-indent: .28em;
  color: #b4a894;
  text-shadow: 0 2px 8px #000;
}

.home-panel {
  position: relative;
  z-index: 3;
  margin-top: auto;
  padding-top: 16px;
}
.home-panel::before {
  content: "";
  position: absolute;
  left: -18px;
  right: -18px;
  top: -34px;
  bottom: -16px;
  z-index: -1;
  background: linear-gradient(180deg, rgba(5, 6, 8, 0) 0%, rgba(5, 6, 8, .55) 26%, rgba(5, 6, 8, .92) 58%, #050608 100%);
  pointer-events: none;
}

.mode-tabs {
  display: flex;
  gap: 5px;
  padding: 5px;
  border-radius: 15px;
  border: 1px solid var(--line);
  background: rgba(12, 14, 18, .72);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.mode-tab {
  flex: 1;
  min-width: 0;
  height: 43px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  font-size: 12.5px;
  color: #8d867a;
  border: 1px solid transparent;
  transition: all .18s ease;
}
.mode-tab .mp-icon { width: 17px; height: 17px; }
.mode-tab.is-on {
  color: #ffd4ab;
  border-color: rgba(255, 138, 61, .42);
  background: linear-gradient(180deg, rgba(255, 138, 61, .2), rgba(255, 138, 61, .055));
  box-shadow: inset 0 0 14px rgba(255, 138, 61, .12), 0 2px 8px rgba(0, 0, 0, .3);
}
.mode-tab:active { transform: scale(.97); }
.mode-desc {
  margin: 7px 2px 0;
  min-height: 14px;
  font-size: 10.5px;
  letter-spacing: .04em;
  color: #847c6f;
  text-align: center;
}

.btn-primary {
  position: relative;
  display: block;
  width: 100%;
  padding: 14px 54px 14px 18px;
  border-radius: 17px;
  text-align: left;
  color: #231208;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, .28) 0%, rgba(255, 255, 255, 0) 38%),
    linear-gradient(135deg, #ffa45d 0%, #ff8a3d 38%, #dc5c1e 100%);
  border: 1px solid rgba(255, 193, 138, .75);
  box-shadow:
    0 12px 30px rgba(226, 88, 26, .26),
    0 2px 0 rgba(255, 220, 185, .22) inset,
    0 -8px 18px rgba(120, 40, 6, .25) inset;
  transition: transform .12s ease, filter .15s ease;
  overflow: hidden;
}
.btn-primary::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, .22) 48%, transparent 62%);
  transform: translateX(-120%);
  animation: btnSheen 6.5s ease-in-out infinite;
  pointer-events: none;
}
@keyframes btnSheen {
  0%, 62% { transform: translateX(-120%); }
  78%, 100% { transform: translateX(120%); }
}
.btn-primary:active { transform: translateY(1px) scale(.994); filter: brightness(.94); }
.btn-main { display: block; font-size: 18px; font-weight: 800; letter-spacing: .09em; }
.btn-sub { display: block; margin-top: 2px; font-size: 10.5px; font-weight: 500; opacity: .68; letter-spacing: .03em; }
.btn-arrow {
  position: absolute;
  right: 17px;
  top: 50%;
  width: 30px;
  height: 30px;
  margin-top: -15px;
  border-radius: 50%;
  background: rgba(45, 20, 7, .17);
  box-shadow: inset 0 0 0 1px rgba(50, 22, 8, .16);
}
.btn-arrow::before, .btn-arrow::after {
  content: "";
  position: absolute;
  top: 50%;
  background: #2a1408;
}
.btn-arrow::before { left: 9px; width: 11px; height: 2px; margin-top: -1px; border-radius: 1px; }
.btn-arrow::after {
  right: 9px;
  width: 7px;
  height: 7px;
  margin-top: -3.5px;
  border-top: 2px solid #2a1408;
  border-right: 2px solid #2a1408;
  background: none;
  transform: rotate(45deg);
}

.start-btn { margin-top: 11px; }

.home-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 12px;
}
.link-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #a19786;
  font-size: 11.5px;
  padding: 6px 3px;
  border-radius: 8px;
  transition: color .15s ease;
}
.link-btn .mp-icon { width: 14px; height: 14px; opacity: .8; }
.link-btn:active { color: var(--amber-2); }
.divider-dot { width: 2px; height: 2px; border-radius: 50%; background: #4b463f; }
.home-foot {
  margin: 3px 0 0;
  text-align: center;
  font-size: 9.5px;
  letter-spacing: .06em;
  color: #615b51;
}

/* =========================================================
   游戏
   ========================================================= */

.screen-game {
  padding: calc(7px + var(--safe-t)) 11px calc(6px + var(--safe-b));
  gap: 6px;
  overflow: hidden;
}

.game-hud {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 3px;
  flex: 0 0 auto;
}
.relic-box { display: flex; align-items: center; gap: 9px; }
.relic-pips { display: flex; gap: 4px; padding: 2px 0; }
.relic-pip {
  width: 13px;
  height: 13px;
  border-radius: 2px;
  transform: rotate(45deg);
  background: #141414;
  border: 1px solid #3c3830;
  transition: all .35s ease;
}
.relic-pip.on {
  background: linear-gradient(135deg, #ffe0b8, #ff8a3d 55%, #c24d15);
  border-color: #ffd6ab;
  box-shadow: 0 0 10px rgba(255, 138, 61, .8);
}
.relic-txt { display: flex; flex-direction: column; line-height: 1.1; }
.relic-txt b { font-size: 14px; letter-spacing: .06em; color: #f2e5d2; font-variant-numeric: tabular-nums; }
.relic-txt small { margin-top: 2px; font-size: 8.5px; letter-spacing: .14em; color: #8c8374; }

.round-box {
  margin-left: auto;
  display: flex;
  align-items: baseline;
  gap: 4px;
  padding: 4px 9px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, .06);
  background: rgba(255, 255, 255, .025);
}
.round-box small { font-size: 8.5px; letter-spacing: .08em; color: #777064; }
.round-box b { font-size: 12px; color: #c6b9a6; font-variant-numeric: tabular-nums; }
.hud-actions { display: flex; gap: 5px; }
.hud-actions .icon-btn { width: 34px; height: 34px; border-radius: 10px; }
.hud-actions .icon-btn .mp-icon { width: 18px; height: 18px; }

.chips {
  display: flex;
  gap: 5px;
  flex: 0 0 auto;
  min-height: 26px;
  padding: 0 2px;
  overflow-x: auto;
  scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  display: flex;
  align-items: center;
  gap: 5px;
  flex: 0 0 auto;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .06);
  background: rgba(255, 255, 255, .028);
  font-size: 10.5px;
  color: #9c9385;
  white-space: nowrap;
  transition: all .2s ease;
}
.chip b { font-weight: 600; max-width: 74px; overflow: hidden; text-overflow: ellipsis; }
.chip .cdot { width: 6px; height: 6px; border-radius: 50%; box-shadow: 0 0 6px currentColor; }
.chip .hp { display: flex; gap: 2px; margin-left: 1px; }
.chip .hp i {
  width: 5px;
  height: 5px;
  transform: rotate(45deg);
  border-radius: 1px;
  background: #c8322e;
  box-shadow: 0 0 4px rgba(200, 50, 46, .5);
}
.chip .hp i.off { background: #2b2925; box-shadow: none; }
.chip em { font-style: normal; font-size: 9px; color: #a77c5d; letter-spacing: .04em; }
.chip.active {
  color: #ffe2c4;
  border-color: rgba(255, 138, 61, .5);
  background: linear-gradient(180deg, rgba(255, 138, 61, .16), rgba(255, 138, 61, .045));
  box-shadow: 0 0 14px rgba(255, 138, 61, .08);
}
.chip.dead { opacity: .4; }
.chip.dead b { text-decoration: line-through; }
.chip.escaped { color: #8fc9b8; border-color: rgba(127, 216, 198, .24); }

.board-wrap {
  position: relative;
  flex: 1 1 auto;
  min-height: 218px;
  border-radius: 17px;
  overflow: hidden;
  background: #050506;
  border: 1px solid rgba(255, 138, 61, .17);
  box-shadow:
    0 14px 34px rgba(0, 0, 0, .64),
    0 0 0 1px rgba(0, 0, 0, .6),
    inset 0 0 50px rgba(0, 0, 0, .85);
  touch-action: none;
}
#boardCanvas { display: block; width: 100%; height: 100%; pointer-events: none; }
.board-vignette {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  box-shadow: inset 0 0 56px 14px rgba(0, 0, 0, .78);
}
.danger-glow {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  opacity: 0;
  pointer-events: none;
  transition: opacity .55s ease;
  background:
    radial-gradient(ellipse at center, rgba(0, 0, 0, 0) 42%, rgba(120, 9, 9, .55) 100%),
    linear-gradient(180deg, rgba(110, 8, 8, .18), rgba(0, 0, 0, 0) 26%);
}
.danger-glow.on { animation: dangerPulse 1.5s ease-in-out infinite; }
@keyframes dangerPulse {
  0%, 100% { opacity: .5; }
  50% { opacity: .9; }
}
.board-wrap.is-danger { border-color: rgba(200, 50, 46, .45); }
.board-wrap.is-danger .board-vignette { box-shadow: inset 0 0 70px 22px rgba(80, 0, 0, .7); }

.board-toast {
  position: absolute;
  left: 50%;
  top: 12px;
  transform: translate(-50%, -6px);
  max-width: 92%;
  padding: 7px 13px;
  border-radius: 999px;
  border: 1px solid rgba(255, 138, 61, .4);
  background: rgba(7, 8, 10, .9);
  color: #ffd8b2;
  font-size: 11px;
  letter-spacing: .03em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0;
  pointer-events: none;
  transition: opacity .24s ease, transform .24s ease;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 3;
}
.board-toast.show { opacity: 1; transform: translate(-50%, 0); }

.turn-pill {
  position: absolute;
  left: 9px;
  bottom: 9px;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .09);
  background: rgba(4, 5, 7, .82);
  font-size: 10px;
  color: #cdbfab;
  opacity: 0;
  transform: translateY(4px);
  transition: all .25s ease;
  pointer-events: none;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.turn-pill.show { opacity: 1; transform: translateY(0); }
.turn-pill .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 8px var(--amber); }
.turn-pill b { font-weight: 600; }
.turn-pill em { font-style: normal; color: #837a6d; }

.narrator {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  margin: 0;
  padding: 1px 5px 0;
  min-height: 30px;
  flex: 0 0 auto;
  font-size: 11px;
  line-height: 1.45;
  letter-spacing: .02em;
  color: #a89e8e;
  font-family: var(--font-serif);
}
.narrator .mp-icon { width: 15px; height: 15px; margin-top: 1px; color: var(--amber); opacity: .75; }
#narratorText {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.narrator.beat { animation: narrBeat .45s ease; }
@keyframes narrBeat {
  0% { opacity: .35; transform: translateY(2px); }
  100% { opacity: 1; transform: translateY(0); }
}

.game-controls {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  padding: 0 4px;
  flex: 0 0 auto;
}

.dpad {
  width: 142px;
  height: 128px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 4px;
  flex: 0 0 auto;
}
.dbtn {
  display: grid;
  place-items: center;
  border-radius: 12px;
  border: 1px solid #2c2a25;
  background: linear-gradient(180deg, #1c1d20 0%, #0d0e11 100%);
  box-shadow: 0 3px 7px rgba(0, 0, 0, .5), inset 0 1px 0 rgba(255, 255, 255, .07);
  transition: all .1s ease;
}
.dbtn:active {
  transform: scale(.94);
  border-color: rgba(255, 138, 61, .55);
  background: linear-gradient(180deg, #3d2a1c 0%, #22150d 100%);
}
.dbtn.up { grid-area: 1 / 2 / 2 / 3; }
.dbtn.left { grid-area: 2 / 1 / 3 / 2; }
.dbtn.right { grid-area: 2 / 3 / 3 / 4; }
.dbtn.down { grid-area: 3 / 2 / 4 / 3; }
.chev {
  width: 0;
  height: 0;
  display: block;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-bottom: 8px solid #caba9f;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .7));
}
.dbtn.down .chev { transform: rotate(180deg); }
.dbtn.left .chev { transform: rotate(-90deg); }
.dbtn.right .chev { transform: rotate(90deg); }

.dpad-core {
  grid-area: 2 / 2 / 3 / 3;
  border-radius: 50%;
  display: grid;
  place-items: center;
  border: 1px solid #3a3128;
  background: radial-gradient(circle at 50% 32%, #2a2119 0%, #10100e 58%, #070708 100%);
  box-shadow: inset 0 0 12px rgba(0, 0, 0, .9), 0 0 16px rgba(255, 138, 61, .08);
}
#coreNum {
  font-family: var(--font-serif);
  font-size: 17px;
  color: var(--amber);
  text-shadow: 0 0 12px rgba(255, 138, 61, .55);
}

.action-col {
  flex: 1 1 auto;
  max-width: 188px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.action-btn {
  width: 100%;
  min-height: 84px;
  padding: 11px 13px;
  border-radius: 15px;
  display: grid;
  grid-template-columns: 25px 1fr;
  grid-template-rows: auto auto;
  column-gap: 9px;
  align-items: center;
  text-align: left;
  color: #ffe4c9;
  border: 1px solid rgba(255, 138, 61, .36);
  background:
    linear-gradient(160deg, rgba(255, 138, 61, .19), rgba(44, 23, 12, .62)),
    #14100d;
  box-shadow: 0 7px 20px rgba(0, 0, 0, .45), inset 0 1px 0 rgba(255, 255, 255, .07);
  transition: transform .1s ease, filter .15s ease, background .2s ease;
}
.action-btn .mp-icon { grid-row: 1 / 3; width: 24px; height: 24px; color: var(--amber-2); }
.action-label { font-size: 16px; font-weight: 700; letter-spacing: .06em; line-height: 1.15; }
.action-btn small { font-size: 9.5px; color: #b09a83; letter-spacing: .02em; line-height: 1.3; }
.action-btn:active { transform: scale(.98); filter: brightness(1.1); }
.action-btn.is-strong {
  color: #241307;
  border-color: #ffd3a4;
  background:
    linear-gradient(160deg, rgba(255, 255, 255, .24), rgba(255, 255, 255, 0) 46%),
    linear-gradient(150deg, #ffab63, #ff8a3d 48%, #d9561b);
  box-shadow: 0 9px 24px rgba(226, 88, 26, .3), inset 0 1px 0 rgba(255, 235, 210, .5);
}
.action-btn.is-strong .mp-icon { color: #3a1a09; }
.action-btn.is-strong small { color: rgba(40, 20, 8, .62); }
.action-btn.is-locked { opacity: .72; }
.step-pill {
  text-align: center;
  font-size: 9px;
  letter-spacing: .12em;
  color: #6f685d;
}
.step-pill b { margin-left: 2px; font-size: 11.5px; color: #c2b4a0; font-variant-numeric: tabular-nums; }

/* =========================================================
   结算
   ========================================================= */

.screen-result {
  justify-content: center;
  padding: calc(28px + var(--safe-t)) 22px calc(22px + var(--safe-b));
  background:
    radial-gradient(ellipse at 50% 14%, rgba(90, 46, 22, .32) 0%, rgba(12, 12, 15, 0) 56%),
    radial-gradient(ellipse at 50% 100%, rgba(18, 28, 34, .5) 0%, rgba(4, 5, 7, 0) 60%),
    #050608;
  overflow-y: auto;
}
.result-bg { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.result-moon {
  position: absolute;
  top: -42px;
  left: 50%;
  width: 230px;
  height: 230px;
  margin-left: -115px;
  border-radius: 50%;
  background: radial-gradient(circle at 42% 38%, rgba(247, 238, 222, .18), rgba(180, 150, 110, .05) 46%, rgba(0, 0, 0, 0) 70%);
  filter: blur(2px);
}
.result-rays {
  position: absolute;
  top: -10%;
  left: 50%;
  width: 340px;
  height: 70%;
  margin-left: -170px;
  background: conic-gradient(from 178deg at 50% 0%, transparent 0deg, rgba(255, 170, 110, .06) 5deg, transparent 11deg, transparent 20deg, rgba(255, 170, 110, .04) 26deg, transparent 33deg);
  opacity: .8;
}
.result-fog {
  position: absolute;
  left: -30%;
  right: -30%;
  bottom: -8%;
  height: 46%;
  background: radial-gradient(ellipse at 50% 50%, rgba(120, 150, 166, .11), rgba(0, 0, 0, 0) 68%);
  filter: blur(22px);
  animation: fogDrift 30s ease-in-out infinite alternate;
}
.result-inner {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 400px;
  margin: auto;
  text-align: center;
  animation: resultRise .55s cubic-bezier(.2, .8, .2, 1) both;
}
@keyframes resultRise {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
.result-title {
  margin: 8px 0 0;
  font-family: var(--font-serif);
  font-size: clamp(32px, 9.6vw, 42px);
  line-height: 1.16;
  letter-spacing: .06em;
  color: #f4ead9;
  text-shadow: 0 2px 0 #000, 0 0 30px rgba(255, 138, 61, .22);
}
.result-title.lose { color: #e3c3b9; text-shadow: 0 2px 0 #000, 0 0 34px rgba(180, 30, 26, .5); }
.result-sub {
  margin: 10px auto 0;
  max-width: 310px;
  font-size: 11.5px;
  line-height: 1.7;
  color: #9c9281;
}
.result-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin: 22px 0 12px;
}
.stat {
  padding: 9px 3px;
  border-radius: 13px;
  border: 1px solid rgba(255, 255, 255, .07);
  background: linear-gradient(180deg, rgba(255, 255, 255, .05), rgba(255, 255, 255, .018));
}
.stat small { display: block; font-size: 8.5px; letter-spacing: .1em; color: #7d7568; }
.stat b { display: block; margin-top: 4px; font-size: 15px; font-weight: 700; color: #ecdfcc; font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.result-players { display: flex; flex-direction: column; gap: 4px; margin: 0 0 10px; }
.result-players .rp {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 11px;
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, .055);
  background: rgba(255, 255, 255, .025);
  font-size: 11px;
  color: #b3a897;
}
.result-players .rp em { font-style: normal; font-size: 10px; color: #8f8678; }
.result-players .rp.ok em { color: #8fc9b8; }
.result-players .rp.no em { color: #a8756b; }
.result-record { min-height: 16px; margin: 2px 0 0; font-size: 10.5px; color: #b98b5f; letter-spacing: .04em; }
.result-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.btn-ghost, .btn-line {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 100%;
  min-height: 44px;
  padding: 11px 14px;
  border-radius: 13px;
  border: 1px solid rgba(255, 255, 255, .1);
  background: rgba(255, 255, 255, .035);
  color: #b8ad9c;
  font-size: 12.5px;
  letter-spacing: .05em;
  transition: all .15s ease;
}
.btn-ghost:active, .btn-line:active { transform: scale(.99); background: rgba(255, 138, 61, .1); border-color: rgba(255, 138, 61, .35); color: #ffd6ae; }
.btn-line .mp-icon { width: 17px; height: 17px; opacity: .8; }
.btn-line.danger { color: #bd8b80; border-color: rgba(200, 50, 46, .22); }

/* =========================================================
   浮层 / 弹窗
   ========================================================= */

.overlay {
  position: absolute;
  inset: 0;
  z-index: 44;
  display: none;
  align-items: flex-end;
  justify-content: center;
  padding: 18px;
  padding-bottom: calc(18px + var(--safe-b));
  background: rgba(2, 3, 4, .72);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
}
.overlay.is-open { display: flex; animation: fadeIn .22s ease both; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  position: relative;
  width: 100%;
  max-width: 410px;
  max-height: calc(100dvh - 40px);
  overflow-y: auto;
  padding: 24px 20px 20px;
  border-radius: 22px;
  border: 1px solid rgba(255, 138, 61, .22);
  background:
    linear-gradient(180deg, rgba(255, 138, 61, .055) 0%, rgba(255, 138, 61, 0) 22%),
    linear-gradient(180deg, #14161b 0%, #0a0b0e 100%);
  box-shadow: 0 28px 80px rgba(0, 0, 0, .85), inset 0 1px 0 rgba(255, 255, 255, .06);
  animation: modalRise .32s cubic-bezier(.2, .8, .2, 1) both;
  scrollbar-width: none;
}
.modal::-webkit-scrollbar { display: none; }
@keyframes modalRise {
  from { opacity: 0; transform: translateY(18px) scale(.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.modal h3 {
  margin: 7px 0 0;
  font-family: var(--font-serif);
  font-size: 26px;
  letter-spacing: .06em;
  color: #f3e7d5;
  font-weight: 700;
}
.modal-lead {
  margin: 10px 0 0;
  font-size: 11.5px;
  line-height: 1.7;
  color: #9b9180;
}
.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #897f70;
  border: 1px solid rgba(255, 255, 255, .08);
  background: rgba(255, 255, 255, .03);
}
.modal-close:active { transform: scale(.92); background: rgba(255, 138, 61, .12); }
.modal-close .mp-icon { width: 17px; height: 17px; }

.guide-list { list-style: none; margin: 18px 0; padding: 0; display: flex; flex-direction: column; gap: 13px; }
.guide-list li { display: flex; gap: 11px; align-items: flex-start; }
.gi {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: var(--amber-2);
  border: 1px solid rgba(255, 138, 61, .26);
  background: linear-gradient(160deg, rgba(255, 138, 61, .14), rgba(255, 138, 61, .03));
}
.gi .mp-icon { width: 18px; height: 18px; }
.guide-list b { display: block; font-size: 12.5px; letter-spacing: .05em; color: #e3d5c1; }
.guide-list p { margin: 2px 0 0; font-size: 10.5px; line-height: 1.6; color: #8e8577; }
.modal .btn-primary { margin-top: 4px; }
.modal .btn-main { font-size: 16px; }

.pause-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 18px; }
.pause-actions .btn-primary { margin-bottom: 2px; }
.pause-modal h3 { font-size: 30px; }

.pick-modal h3 { font-size: 27px; }
.pick-track {
  position: relative;
  height: 46px;
  margin: 20px 0 6px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #2c2923;
  background: linear-gradient(180deg, #0d0d0d, #050505);
  box-shadow: inset 0 3px 10px rgba(0, 0, 0, .9);
}
.pick-zone {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 30%;
  width: 32%;
  border-left: 1px solid rgba(255, 219, 180, .9);
  border-right: 1px solid rgba(255, 219, 180, .9);
  background: linear-gradient(180deg, rgba(255, 138, 61, .48), rgba(255, 138, 61, .14));
  box-shadow: 0 0 22px rgba(255, 138, 61, .38), inset 0 0 18px rgba(255, 180, 110, .22);
}
.pick-needle {
  position: absolute;
  top: -2px;
  bottom: -2px;
  left: 0;
  width: 3px;
  margin-left: -1.5px;
  background: #fff2df;
  box-shadow: 0 0 12px #ffb26b, 0 0 3px #fff;
  z-index: 2;
}
.pick-marks {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(90deg, transparent 0, transparent 8.7%, rgba(255, 255, 255, .055) 8.7%, rgba(255, 255, 255, .055) 9.3%);
}
.pick-scale {
  display: flex;
  justify-content: space-between;
  padding: 0 3px;
  font-size: 9px;
  letter-spacing: .2em;
  color: #625c52;
  margin-bottom: 14px;
}
.pick-btn { margin-top: 2px; }
.pick-cancel { display: block; width: 100%; text-align: center; margin-top: 9px; color: #7f786c; font-size: 11px; }

.text-input {
  width: 100%;
  height: 48px;
  margin: 16px 0 4px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 138, 61, .3);
  background: rgba(0, 0, 0, .4);
  color: #f2e4d1;
  font-size: 15px;
  letter-spacing: .06em;
  outline: none;
}
.text-input:focus { border-color: rgba(255, 138, 61, .75); box-shadow: 0 0 0 3px rgba(255, 138, 61, .1); }
.text-input::placeholder { color: #5f594f; }
.name-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }

.record-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 18px 0; }
.record-cell {
  padding: 13px 12px;
  border-radius: 13px;
  border: 1px solid rgba(255, 255, 255, .07);
  background: rgba(255, 255, 255, .03);
}
.record-cell small { display: block; font-size: 9px; letter-spacing: .1em; color: #7d7568; }
.record-cell b { display: inline-block; margin-top: 5px; font-size: 22px; font-family: var(--font-serif); color: #f0e2cc; }
.record-cell em { font-style: normal; font-size: 9px; color: #837a6c; margin-left: 3px; }
.record-tip {
  display: flex;
  gap: 8px;
  padding: 11px;
  margin-bottom: 14px;
  border-radius: 11px;
  border: 1px dashed rgba(255, 138, 61, .22);
  background: rgba(255, 138, 61, .045);
  font-size: 10.5px;
  line-height: 1.6;
  color: #a49682;
}
.record-tip .mp-icon { width: 15px; height: 15px; color: var(--amber); margin-top: 1px; }

/* =========================================================
   惊吓
   ========================================================= */

.scare {
  position: absolute;
  inset: 0;
  z-index: 70;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #030303;
  overflow: hidden;
}
.scare.show { display: flex; animation: scareFlash .14s steps(2) both; }
@keyframes scareFlash {
  0% { background: #d9d4c9; }
  100% { background: #030303; }
}
.scare-face {
  width: min(82vw, 340px);
  max-height: 62dvh;
  filter: drop-shadow(0 0 34px rgba(150, 16, 16, .38));
  animation: faceZoom .62s cubic-bezier(.16, .84, .3, 1) both;
}
@keyframes faceZoom {
  0% { transform: scale(.55) rotate(-2deg); opacity: 0; }
  30% { opacity: 1; }
  100% { transform: scale(1) rotate(0); opacity: 1; }
}
.scare p {
  margin: 8px 0 0;
  font-family: var(--font-serif);
  font-size: 14px;
  letter-spacing: .34em;
  text-indent: .34em;
  color: #d9b0a4;
  text-shadow: 0 0 18px rgba(180, 30, 26, .7);
}
.scare::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at 50% 45%, rgba(0, 0, 0, 0) 26%, rgba(110, 0, 0, .24) 62%, rgba(0, 0, 0, .92) 100%);
}

/* =========================================================
   高度适配
   ========================================================= */

@media (max-height: 720px) {
  .home-title { margin-top: 12px; }
  .home-title h1 { font-size: clamp(36px, 11vw, 46px); }
  .tagline { margin-top: 6px; font-size: 10.5px; }
  .home-panel { padding-top: 10px; }
  .mode-tab { height: 39px; }
  .mode-desc { margin-top: 5px; }
  .btn-primary { padding-top: 11px; padding-bottom: 11px; }
  .start-btn { margin-top: 9px; }
  .home-links { margin-top: 8px; }
  .dpad { width: 128px; height: 114px; }
  .action-btn { min-height: 74px; }
  .board-wrap { min-height: 200px; }
  .narrator { min-height: 26px; font-size: 10.5px; }
}
@media (max-height: 640px) {
  .home-title h1 { font-size: 34px; }
  .home-title .kicker { font-size: 8px; }
  .home-top .profile { padding-top: 3px; padding-bottom: 3px; }
  .avatar { width: 32px; height: 32px; font-size: 14px; }
  .dpad { width: 116px; height: 104px; }
  .action-btn { min-height: 66px; padding: 8px 10px; }
  .action-label { font-size: 14px; }
  .game-controls { gap: 8px; }
  .chips { min-height: 22px; }
}

@media (max-width: 350px) {
  .screen-home { padding-left: 14px; padding-right: 14px; }
  .screen-game { padding-left: 8px; padding-right: 8px; }
  .profile-txt b { max-width: 96px; }
  .dpad { width: 120px; height: 108px; }
  .action-col { max-width: 160px; }
  .action-label { font-size: 14px; }
}

/* 横屏矮屏：压缩暂停弹窗，保证底部按钮可见 */
@media (orientation: landscape) and (max-height: 560px) {
  #pauseOverlay { align-items: center; padding: 8px; }
  .pause-modal { max-height: calc(100dvh - 16px); padding: 14px 16px 12px; }
  .pause-modal .kicker { font-size: 8px; }
  .pause-modal h3 { margin-top: 2px; font-size: 22px; }
  .pause-modal .modal-lead { margin-top: 4px; font-size: 10px; line-height: 1.5; }
  .pause-actions { margin-top: 9px; gap: 6px; }
  .pause-actions .btn-primary { min-height: 46px; padding-top: 8px; padding-bottom: 8px; }
  .pause-actions .btn-line { min-height: 36px; padding: 7px 12px; font-size: 11.5px; }
  .pause-modal .btn-sub { font-size: 9px; }
}
