/* 赌上心动 BET MY HEART — 8-bit UI（契约 §8：硬边、无圆角、无模糊阴影、有限调色板） */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

:root {
  --bgc: #0d0d1a; --panel: #1a1a2e; --line: #e8e8ff; --text: #f4f4f4;
  --lucy: #e8334a; --kira: #ff6bc1; --saiko: #4dd8e8; --may: #a86be8;
  --queen: #f4c542; --gold: #ffd24d; --heart: #ff4d6b;
}

html, body { width: 100%; height: 100%; background: #000; overflow: hidden; }
body {
  font-family: 'Fusion Pixel 12px Monospaced SC', 'Courier New', monospace;
  color: var(--text);
  image-rendering: pixelated;
  -webkit-font-smoothing: none;
}

#app { width: 100vw; height: 100vh; display: flex; align-items: center; justify-content: center; background: #000; }

#screen {
  position: relative; width: 640px; height: 360px;
  background: var(--bgc); overflow: hidden;
  transform-origin: center center;
  user-select: none; cursor: default;
}
#screen.shake { animation: shake .42s steps(2) both; }
@keyframes shake {
  0%,100% { transform: translate(0,0) scale(var(--sc,1)); }
  20% { transform: translate(-6px,3px) scale(var(--sc,1)); }
  40% { transform: translate(5px,-4px) scale(var(--sc,1)); }
  60% { transform: translate(-4px,-3px) scale(var(--sc,1)); }
  80% { transform: translate(4px,3px) scale(var(--sc,1)); }
}

canvas { image-rendering: pixelated; image-rendering: crisp-edges; }

/* ---------- CRT ---------- */
#crt { position: absolute; inset: 0; pointer-events: none; z-index: 90; display: none; }
#screen.crt #crt { display: block; }
#crt::before {
  content: ''; position: absolute; inset: 0;
  background: repeating-linear-gradient(to bottom, rgba(0,0,0,0) 0 2px, rgba(0,0,0,.22) 2px 4px);
}
#crt::after {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(ellipse at center, rgba(0,0,0,0) 58%, rgba(0,0,0,.38) 100%);
}

/* ---------- 背景 ---------- */
#bg { position: absolute; inset: 0; z-index: 0; transition: none;
  background-size: cover; background-position: center;
  image-rendering: pixelated; image-rendering: crisp-edges; }
/* Ken Burns 缓动镜头（仅真实背景图） */
#bg.bg-img { animation: kbpan 38s ease-in-out infinite alternate; }
@keyframes kbpan { from { background-position: 47% 48%; } to { background-position: 53% 52%; } }
/* 场景转场幽灵层（阶梯淡出） */
.bg-ghost {
  position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background-size: cover; background-position: center;
  animation: ghostfade .34s steps(5) forwards !important;
}
@keyframes ghostfade { from { opacity: 1; } to { opacity: 0; } }
/* 入桌运镜：轻推近景回正 */
#bg.bg-pop { animation: bgpop .55s cubic-bezier(.2,.8,.3,1) 1, kbpan 38s ease-in-out .55s infinite alternate; }
@keyframes bgpop { from { transform: scale(1.1); } to { transform: scale(1); } }
/* 室内漂浮尘埃 */
.deco-motes { display: none; position: absolute; inset: 0; pointer-events: none; opacity: .3;
  background-image: radial-gradient(rgba(255,220,150,.9) 1px, transparent 1.5px),
    radial-gradient(rgba(255,255,255,.6) 1px, transparent 1.5px);
  background-size: 120px 140px, 190px 170px;
  animation: motes 26s linear infinite; }
@keyframes motes {
  from { background-position: 0 140px, 60px 170px; }
  to   { background-position: -50px -140px, 20px -170px; }
}
.bg-lobby .deco-motes, .bg-shop .deco-motes, .bg-bar .deco-motes, .bg-vault .deco-motes,
[class*="bg-table_"] .deco-motes { display: block; }
/* 外部 AI 背景图生效时：CSS 山脉/拱门让位（雪保留做氛围） */
#bg.bg-img::before, #bg.bg-img::after { display: none; }
.bg-img .deco-mtn, .bg-img .deco-arch { display: none !important; }

/* —— 雷诺装饰层（#bg 内常驻子元素，按场景 class 显隐）—— */
.deco-mtn, .deco-arch, .deco-snow { display: none; position: absolute; pointer-events: none; }

/* 内华达山脉：两道阶梯状像素山脊 */
.deco-mtn { left: 0; right: 0; bottom: 0; height: 150px; }
.deco-mtn::before, .deco-mtn::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; }
.deco-mtn::before { height: 150px; background: var(--mtn-back, #141233);
  clip-path: polygon(0% 100%, 0% 58%, 5% 58%, 5% 46%, 9% 46%, 9% 54%, 14% 54%, 14% 36%, 18% 36%,
    18% 26%, 22% 26%, 22% 40%, 27% 40%, 27% 52%, 33% 52%, 33% 44%, 38% 44%, 38% 32%, 43% 32%,
    43% 48%, 50% 48%, 50% 56%, 56% 56%, 56% 42%, 61% 42%, 61% 30%, 65% 30%, 65% 22%, 69% 22%,
    69% 34%, 74% 34%, 74% 46%, 80% 46%, 80% 54%, 86% 54%, 86% 43%, 91% 43%, 91% 51%, 100% 51%, 100% 100%); }
.deco-mtn::after { height: 90px; background: var(--mtn-front, #0c0b22);
  clip-path: polygon(0% 100%, 0% 70%, 7% 70%, 7% 56%, 13% 56%, 13% 66%, 20% 66%, 20% 48%, 26% 48%,
    26% 60%, 34% 60%, 34% 52%, 41% 52%, 41% 64%, 49% 64%, 49% 44%, 55% 44%, 55% 58%, 63% 58%,
    63% 50%, 70% 50%, 70% 62%, 78% 62%, 78% 54%, 85% 54%, 85% 66%, 92% 66%, 92% 58%, 100% 58%, 100% 100%); }

/* 雷诺拱门：「RENO」霓虹 + 弧形门架（标题画面里框住整个菜单） */
.deco-arch { left: 50%; bottom: 0; transform: translateX(-50%); width: 470px; height: 252px; }
.deco-arch::before { content: ''; position: absolute; inset: 0;
  border: 7px solid #f4c542; border-bottom: none;
  border-radius: 235px 235px 0 0 / 170px 170px 0 0;
  box-shadow: inset 0 0 0 2px #7a5a14; }
.deco-arch::after { content: 'R E N O'; position: absolute; top: 22px; left: 50%;
  transform: translateX(-50%); font-size: 24px; color: #ffd24d;
  text-shadow: 2px 2px 0 #7a1a2a; white-space: nowrap;
  animation: archflick 4s steps(1) infinite; }
.bg-night .deco-arch { width: 300px; height: 120px; }
.bg-night .deco-arch::before { border-width: 5px; border-radius: 150px 150px 0 0 / 96px 96px 0 0; }
.bg-night .deco-arch::after { font-size: 12px; top: 10px; }
@keyframes archflick { 0%, 7%, 100% { opacity: 1; } 3% { opacity: .35; } 5% { opacity: 1; } 6% { opacity: .5; } }

/* 十一月的雪：双层像素雪点，阶梯式下落 */
.deco-snow { inset: 0;
  background-image: radial-gradient(#fff 1px, transparent 1.6px), radial-gradient(#cfe0ff 1px, transparent 1.6px);
  background-size: 56px 64px, 88px 96px;
  animation: snowfall 9s steps(36) infinite; opacity: .8; }
@keyframes snowfall {
  from { background-position: 0 -64px, 40px -96px; }
  to   { background-position: 0 320px, 40px 480px; }
}

/* 场景显隐与配色 */
.bg-title .deco-mtn, .bg-night .deco-mtn, .bg-ending .deco-mtn { display: block; }
.bg-title .deco-arch { display: block; }
.bg-night .deco-arch { display: block; opacity: .5; }
.bg-title .deco-snow, .bg-night .deco-snow { display: block; }
.bg-night .deco-mtn { --mtn-back: #0c0c26; --mtn-front: #07071a; }
.bg-ending .deco-mtn { --mtn-back: #52203a; --mtn-front: #321226; }

/* 分带像素天空 */
.bg-title  { background: linear-gradient(#04030f 0 30%, #0a0822 30% 55%, #181040 55% 72%, #2a1356 72% 88%, #3a1a4e 88% 100%); }
.bg-title::after { content: ''; position: absolute; inset: 0;
  background-image: radial-gradient(#fff 1px, transparent 1px), radial-gradient(#8888ff 1px, transparent 1px);
  background-size: 90px 70px, 130px 110px; background-position: 10px 10px, 50px 40px; opacity: .5; }
.bg-lobby { background: linear-gradient(#16102e 0 60%, #241640 60% 100%); }
.bg-lobby::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 10px;
  background: repeating-linear-gradient(90deg, var(--heart) 0 24px, #2de8a0 24px 48px, var(--saiko) 48px 72px, var(--gold) 72px 96px); }
.bg-lobby::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 40%;
  background: repeating-linear-gradient(45deg, #1c1233 0 16px, #221540 16px 32px); }
.bg-table_lucy  { background: linear-gradient(#1c0a12 0 30%, #471320 30% 100%); }
.bg-table_lucy::after  { content:''; position:absolute; left:0; right:0; bottom:0; height:55%;
  background: linear-gradient(#5e1a2a 0 8px, #3c1018 8px 100%); }
.bg-table_kira  { background: linear-gradient(#1c0a18 0 30%, #4d1438 30% 100%); }
.bg-table_kira::after  { content:''; position:absolute; left:0; right:0; bottom:0; height:55%;
  background: repeating-linear-gradient(90deg, #5e1a44 0 20px, #4a1236 20px 40px); }
.bg-table_saiko { background: linear-gradient(#06141c 0 30%, #0e3340 30% 100%); }
.bg-table_saiko::after { content:''; position:absolute; left:0; right:0; bottom:0; height:55%;
  background: repeating-linear-gradient(0deg, #11404f 0 12px, #0d3340 12px 24px); }
.bg-table_may   { background: linear-gradient(#160a20 0 30%, #331347 30% 100%); }
.bg-table_may::after   { content:''; position:absolute; left:0; right:0; bottom:0; height:55%;
  background: linear-gradient(90deg, #471a5e 0 30%, #331347 70% 100%); }
.bg-bar   { background: linear-gradient(#1c1208 0 45%, #2e1c10 45% 100%); }
.bg-bar::before { content:''; position:absolute; left:0; right:0; top:18%; height:8px; background:#4d3018;
  box-shadow: 0 40px 0 #4d3018, 0 80px 0 #4d3018; }
.bg-bar::after { content:''; position:absolute; left:0; right:0; bottom:0; height:30%;
  background: linear-gradient(#3c2410 0 6px, #241408 6px 100%); }
.bg-shop  { background: linear-gradient(#100c1c 0 100%); }
.bg-shop::after { content:''; position:absolute; inset:0;
  background: radial-gradient(circle at 50% 30%, rgba(255,210,77,.28) 0 18%, rgba(255,210,77,0) 55%); }
.bg-cafe  { background: linear-gradient(#1c1410 0 40%, #33241a 40% 100%); }
.bg-cafe::after { content:''; position:absolute; inset:0;
  background: radial-gradient(circle at 30% 35%, rgba(255,190,110,.30) 0 22%, transparent 55%); }
.bg-arcade { background: linear-gradient(#0c0a1e 0 100%); }
.bg-arcade::after { content:''; position:absolute; inset:0;
  background-image: radial-gradient(rgba(120,80,255,.5) 2px, transparent 3px),
    radial-gradient(rgba(77,216,232,.5) 2px, transparent 3px);
  background-size: 90px 70px, 130px 100px; opacity:.5; }
.bg-vault { background: linear-gradient(#0a0805 0 100%); }
.bg-vault::before { content:''; position:absolute; inset:0;
  background: repeating-linear-gradient(90deg, rgba(244,197,66,.16) 0 6px, transparent 6px 60px); }
.bg-vault::after { content:''; position:absolute; inset:0;
  background: radial-gradient(circle at 50% 45%, rgba(244,197,66,.25) 0 12%, transparent 50%); }
.bg-night { background: linear-gradient(#02020c 0 35%, #070b20 35% 60%, #0d1230 60% 80%, #141a40 80% 100%); }
.bg-night::after { content:''; position:absolute; inset:0;
  background-image: radial-gradient(#fff 1px, transparent 1px), radial-gradient(#aaccff 1px, transparent 1px);
  background-size: 70px 60px, 110px 90px; background-position: 20px 15px, 60px 45px; opacity:.7; }
.bg-ending { background: linear-gradient(#1a0f2e 0 30%, #5e2240 30% 55%, #a83e3a 55% 75%, #e8924d 75% 92%, #ffd24d 92% 100%); }
.bg-ending::after { content:''; position:absolute; inset:0;
  background: radial-gradient(circle at 50% 70%, rgba(255,210,77,.4) 0 10%, transparent 38%); }

/* ---------- 立绘（落地到屏幕底，裁切线藏进对话框后面） ---------- */
#portrait {
  position: absolute; left: 50%; bottom: 0; transform: translateX(-50%);
  width: 250px; height: 312px; z-index: 5; display: none;
  animation: breathe 3.2s steps(2) infinite;
}
#portrait.enter { animation: penter .28s steps(4) both, breathe 3.2s steps(2) .3s infinite; }
#portrait.real { image-rendering: pixelated; animation: breatheReal 3.6s ease-in-out infinite; }
#portrait.real.enter { animation: penter .28s ease both, breatheReal 3.6s ease-in-out .3s infinite; }
#portrait.real.talk { animation: ptalk .22s ease-out 1, breatheReal 3.6s ease-in-out .22s infinite; }
@keyframes breatheReal {
  0%,100% { transform: translateX(calc(-50% + var(--px, 0px))) translateY(0); }
  50% { transform: translateX(calc(-50% + var(--px, 0px))) translateY(2px); }
}
@keyframes ptalk {
  0% { transform: translateX(calc(-50% + var(--px, 0px))) translateY(2px) scale(1); }
  45% { transform: translateX(calc(-50% + var(--px, 0px))) translateY(-1px) scale(1.015); }
  100% { transform: translateX(calc(-50% + var(--px, 0px))) translateY(0) scale(1); }
}
@keyframes penter { from { opacity: 0; transform: translateX(-50%) translateY(8px); } to { opacity: 1; transform: translateX(-50%); } }
@keyframes breathe { 0%,100% { margin-bottom: 0; } 50% { margin-bottom: 2px; } }

/* ---------- HUD ---------- */
#hud {
  position: absolute; top: 0; left: 0; right: 0; height: 30px; z-index: 40;
  display: flex; align-items: center; gap: 10px; padding: 0 8px;
  background: var(--panel);
  border-bottom: 2px solid #000; box-shadow: inset 0 -2px 0 #34345e;
  font-size: 12px;
}
#hud .hud-sec { display: flex; align-items: center; gap: 4px; white-space: nowrap; }
#hud-gold { color: var(--gold); }
#hud-girls { margin-left: auto; display: flex; gap: 8px; }
#hud-girls .hg { display: flex; align-items: center; gap: 3px; }
#hud-girls canvas { width: 24px; height: 24px; border: 2px solid #000; background: #0a0a14; }
#hud-girls span { font-size: 12px; min-width: 20px; }

/* ---------- 对话框 ---------- */
#dialog {
  position: absolute; left: 8px; right: 8px; bottom: 8px; z-index: 30;
  height: auto; min-height: 92px; max-height: 156px;
  background: var(--panel);
  border: 4px solid #000; box-shadow: inset 0 0 0 2px var(--line);
  padding: 14px 16px 16px; display: none;
}
#nameplate {
  position: absolute; top: -14px; left: 10px; padding: 2px 10px;
  background: #000; border: 2px solid var(--line);
  font-size: 12px; display: none;
}
#dtext { font-size: 12px; line-height: 1.55; white-space: pre-line; overflow: hidden; }
#dtext.narr { color: #b8b8cc; }
#cursor {
  position: absolute; right: 10px; bottom: 6px; font-size: 12px; display: none;
  animation: blink .8s steps(1) infinite;
}
@keyframes blink { 0%,100% { opacity: 1; } 50% { opacity: 0; } }

/* ---------- 选项 ---------- */
#choices {
  position: absolute; left: 50%; top: 52%; transform: translate(-50%, -50%);
  z-index: 45; display: none; flex-direction: column; gap: 8px; min-width: 280px; max-width: 90%;
}

/* ---------- 像素按钮/面板 ---------- */
.pixel-btn {
  font-family: inherit; font-size: 12px; color: var(--text);
  background: var(--panel); border: 3px solid #000;
  box-shadow: inset 0 0 0 2px var(--line);
  padding: 8px 14px; cursor: pointer; text-align: center;
}
.pixel-btn:hover, .pixel-btn.sel { background: var(--line); color: #0d0d1a; box-shadow: inset 0 0 0 2px #000; }
.pixel-btn:active { transform: translateY(2px); }
.pixel-btn.ok { box-shadow: inset 0 0 0 2px var(--heart); }
.pixel-btn.ok:hover { background: var(--heart); color: #fff; }
.pixel-panel {
  background: var(--panel); border: 4px solid #000;
  box-shadow: inset 0 0 0 2px var(--line); padding: 14px;
}

/* ---------- 赌局容器（第一人称赌桌视角） ---------- */
#game-stage { position: absolute; inset: 30px 0 0 0; z-index: 20; display: none; overflow: hidden; }
#game-stage.felt-img { background-size: cover; background-position: center;
  image-rendering: pixelated; image-rendering: crisp-edges; }
#game-stage.felt-img::before, #game-stage.felt-css::before {
  content: ''; position: absolute; inset: 0; z-index: -1;
  background: rgba(6, 8, 18, .42); pointer-events: none;
}
#game-stage.felt-css {
  background:
    radial-gradient(ellipse at 50% 120%, #1d4a33 0 45%, #143626 45% 70%, #0e2a1e 70% 100%),
    #0e2a1e;
  box-shadow: inset 0 0 0 8px #3a2414, inset 0 0 0 12px #241608;
}

/* ---------- 沉浸演出包 v2 ---------- */
/* 荷官入局：她坐在桌对面 */
#dealer-wrap {
  position: absolute; left: 24%; top: -4px; transform: translateX(-50%);
  width: 200px; height: 152px; overflow: hidden; pointer-events: none;
  -webkit-mask-image: linear-gradient(180deg, #000 0 70%, transparent 100%);
  mask-image: linear-gradient(180deg, #000 0 70%, transparent 100%);
}
/* 轮盘：左列是转盘，荷官回中（板面在右挡不住关键 UI） */
.g-roulette #dealer-wrap { left: 50%; }
#dealer-cv { width: 200px; height: 306px; image-rendering: pixelated; }
/* 大胜镜头 */
#screen.winpunch { animation: wpunch .4s cubic-bezier(.2,.9,.3,1.4) 1; }
@keyframes wpunch {
  0%,100% { transform: scale(var(--sc,1)); }
  35% { transform: scale(calc(var(--sc,1) * 1.035)); }
}
/* 深夜雪加密（第8夜起） */
#screen.snow-heavy .deco-snow { animation-duration: 5.5s; opacity: 1; }

/* ---------- 沉浸演出包 ---------- */
/* 情绪文字 */
#dtext.fx-shake { animation: txshake .4s steps(2) infinite; }
@keyframes txshake { 0%,100% { transform: translate(0,0); } 25% { transform: translate(-1px,1px); } 75% { transform: translate(1px,-1px); } }
#dtext.fx-warm { color: #ffd6e0; text-shadow: 0 0 0 transparent; }
#dtext.fx-dim { color: #aab4d4; }
/* 赢分筹码飞向头像 */
.chipfly {
  position: absolute; width: 16px; height: 16px; z-index: 85; pointer-events: none;
  transition: transform .62s cubic-bezier(.3,-.2,.6,1), opacity .62s steps(6);
}
/* 回收 glitch */
#screen.glitch { animation: glitchjit .12s steps(2) 5; }
#screen.glitch::after {
  content: ''; position: absolute; inset: 0; z-index: 95; pointer-events: none;
  background: repeating-linear-gradient(0deg,
    rgba(255,255,255,.16) 0 2px, transparent 2px 7px,
    rgba(77,216,232,.18) 7px 9px, transparent 9px 17px);
  mix-blend-mode: difference;
  animation: glitchband .6s steps(8) 1;
}
@keyframes glitchjit { 0%,100% { transform: translate(0,0) scale(var(--sc,1)); } 30% { transform: translate(-5px,2px) scale(var(--sc,1)); } 70% { transform: translate(4px,-2px) scale(var(--sc,1)); } }
@keyframes glitchband { from { background-position: 0 0; opacity: 1; } to { background-position: 0 120px; opacity: 0; } }
/* CRT 开机扫描（进入赌局） */
.poweron {
  position: absolute; inset: 0; z-index: 88; pointer-events: none; background: #000;
  animation: pon .42s steps(8) forwards;
}
.poweron::after {
  content: ''; position: absolute; left: 0; right: 0; top: 50%; height: 3px;
  background: #e8f6ff; box-shadow: 0 0 0 1px #9adfff;
  animation: ponline .42s steps(8) forwards;
}
@keyframes pon { 0% { opacity: 1; } 70% { opacity: 1; } 100% { opacity: 0; } }
@keyframes ponline { 0% { transform: scaleX(.02); } 45% { transform: scaleX(1); top: 50%; height: 3px; }
  100% { transform: scaleX(1) scaleY(120); opacity: 0; } }
/* ALL-IN 心跳红晕 */
#screen.allin-pulse::after {
  content: ''; position: absolute; inset: 0; z-index: 86; pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 52%, rgba(255,45,80,.30) 100%);
  animation: ainpulse 1.15s ease-in-out infinite;
}
@keyframes ainpulse { 0%,100% { opacity: .25; } 12% { opacity: .85; } 24% { opacity: .35; } 36% { opacity: .7; } 50% { opacity: .25; } }
/* 场景动态灯光层 */
.deco-light { display: none; position: absolute; inset: 0; pointer-events: none; }
.bg-lobby .deco-light { display: block;
  background: linear-gradient(180deg, rgba(255,210,120,.16) 0 18%, transparent 40%);
  animation: lampflick 4.2s steps(2) infinite; }
.bg-bar .deco-light { display: block;
  background: radial-gradient(ellipse at 50% 30%, rgba(255,170,80,.16) 0 30%, transparent 65%);
  animation: lampwarm 5.5s ease-in-out infinite; }
.bg-vault .deco-light { display: block;
  background: linear-gradient(115deg, transparent 30%, rgba(255,224,130,.18) 46% 52%, transparent 68%);
  background-size: 220% 100%;
  animation: rayslide 9s ease-in-out infinite alternate; }
[class*="bg-table_"] .deco-light { display: block;
  background: radial-gradient(ellipse at 50% 0%, rgba(255,255,255,.10) 0 18%, transparent 50%);
  animation: lampflick 6s steps(2) infinite; }
@keyframes lampflick { 0%, 92%, 100% { opacity: 1; } 95% { opacity: .55; } }
@keyframes lampwarm { 0%,100% { opacity: .7; } 50% { opacity: 1; } }
@keyframes rayslide { from { background-position: 0% 0; } to { background-position: 100% 0; } }

/* ---------- 特效层 ---------- */
#fx { position: absolute; inset: 0; z-index: 80; pointer-events: none; }
.flash { position: absolute; inset: 0; background: #fff; animation: flashout .26s steps(3) both; }
@keyframes flashout { from { opacity: 1; } to { opacity: 0; } }
.toast {
  position: absolute; top: 38px; left: 50%; transform: translateX(-50%);
  background: #000; border: 2px solid var(--line); color: var(--text);
  font-size: 12px; padding: 4px 12px; white-space: nowrap;
}
.toast.out { opacity: 0; transition: opacity .5s steps(4); }
.chipfloat {
  position: absolute; top: 46px; right: 14px; font-size: 12px;
  animation: cfloat 1.3s steps(8) both;
}
@keyframes cfloat { from { transform: translateY(0); opacity: 1; } to { transform: translateY(-26px); opacity: 0; } }

/* ---------- 下注面板 ---------- */
#betpick {
  position: absolute; inset: 0; z-index: 60;
  display: flex; align-items: center; justify-content: center;
  background: rgba(5,5,12,.6);
}
.bp-panel { width: 300px; text-align: center; }
.bp-label { font-size: 12px; margin-bottom: 10px; }
.bp-amt { font-size: 24px; color: var(--heart); margin-bottom: 10px; display: flex; align-items: center; justify-content: center; gap: 8px; }
.bp-row { display: flex; gap: 6px; justify-content: center; margin-top: 8px; flex-wrap: wrap; }
.bp-row .pixel-btn { padding: 6px 10px; font-size: 12px; }

/* ---------- 赌局规则书 ---------- */
#rulebtn {
  position: absolute; top: 34px; right: 6px; z-index: 58;
  font-size: 12px; padding: 4px 8px;
}
#rules-ov {
  position: absolute; inset: 0; z-index: 62;
  display: flex; align-items: center; justify-content: center;
  background: rgba(5,5,12,.74);
}
.rules-panel { width: 430px; max-width: 92%; max-height: 88%; overflow-y: auto; }
.r-title { font-size: 12px; color: var(--gold); margin-bottom: 10px; text-align: center; }
.r-text { font-size: 12px; line-height: 1.75; white-space: pre-line; margin-bottom: 12px; }
.rules-panel .r-close { width: 100%; }

/* ---------- 结局卡 ---------- */
#ending-card {
  position: absolute; inset: 0; z-index: 70;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  background: rgba(5,5,12,.82); text-align: center; padding: 20px;
}
.ec-tag { font-size: 12px; color: var(--gold); letter-spacing: 4px; }
.ec-title { font-size: 24px; color: var(--text); }
.ec-desc { font-size: 12px; color: #c8c8da; line-height: 1.7; max-width: 480px; white-space: pre-line; }
.ec-meta { font-size: 12px; color: var(--heart); margin-top: 8px; }
.ec-hint { font-size: 12px; color: #8888a0; animation: blink .9s steps(1) infinite; }

/* ---------- 标题画面（有 AI 背景图时的紧凑排版：让画说话） ---------- */
#bg.bg-img.bg-title ~ #title { justify-content: flex-end; padding-bottom: 14px; gap: 8px; }
#bg.bg-img.bg-title ~ #title .t-hearts,
#bg.bg-img.bg-title ~ #title .t-sub,
#bg.bg-img.bg-title ~ #title .t-en { display: none; }
#bg.bg-img.bg-title ~ #title .t-logo {
  font-size: 24px; line-height: 1;
  background: rgba(10,10,20,.82); border: 3px solid #000;
  box-shadow: inset 0 0 0 2px var(--line); padding: 7px 16px 5px;
  text-shadow: 2px 2px 0 var(--heart);
}
#bg.bg-img.bg-title ~ #title .t-menu {
  flex-direction: row; min-width: 0; gap: 8px; flex-wrap: wrap; justify-content: center;
}
#bg.bg-img.bg-title ~ #title .t-menu .pixel-btn {
  font-size: 12px; padding: 8px 12px; background: rgba(13,13,26,.86);
}
#bg.bg-img.bg-title ~ #title .t-wiped { bottom: 92px; }

/* ---------- 标题画面 ---------- */
#title {
  position: absolute; inset: 0; z-index: 50;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
}
#title .t-sub { font-size: 12px; color: var(--gold); letter-spacing: 6px; }
#title .t-logo {
  font-size: 48px; line-height: 1.1; color: var(--text); text-align: center;
  text-shadow: 3px 3px 0 var(--heart), 6px 6px 0 #47102a;
  margin: 4px 0;
}
#title .t-en { font-size: 12px; color: var(--heart); letter-spacing: 3px; margin-bottom: 10px; }
#title .t-menu { display: flex; flex-direction: column; gap: 7px; min-width: 210px; }
#title .t-wiped {
  position: absolute; bottom: 34px; font-size: 12px; color: #8a8aa8;
  animation: wflicker 5s steps(2) infinite;
}
@keyframes wflicker { 0%, 88%, 96% { opacity: 0; } 92%, 100% { opacity: .9; } }
#title .t-ver { position: absolute; bottom: 8px; right: 10px; font-size: 10px; color: #55556a; }
#title .t-echo { position: absolute; left: 26px; bottom: 20px; text-align: center; pointer-events: none; }
#title .t-echo canvas { width: 48px; height: 64px; image-rendering: pixelated; opacity: .92; }
#title .t-echo-cap { font-size: 12px; color: #c8b8d8; margin-top: 2px; text-shadow: 1px 1px 0 #000; }
#title .t-hearts { display: flex; gap: 8px; margin-bottom: 6px; }
#title canvas { width: 24px; height: 24px; }

/* ---------- 覆盖层（图鉴/设置/夜场卡） ---------- */
.overlay-panel {
  position: absolute; inset: 0; z-index: 55;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  background: rgba(5,5,12,.88); padding: 24px;
}
.overlay-panel h2 { font-size: 24px; color: var(--gold); }
.gallery-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; width: 100%; max-width: 560px;
}
.gallery-grid .gcell {
  border: 2px solid #34345e; background: var(--panel);
  font-size: 12px; padding: 6px 4px; text-align: center; line-height: 1.4; min-height: 44px;
  display: flex; flex-direction: column; justify-content: center;
}
.gallery-grid .gcell.got { border-color: var(--heart); }
.gallery-grid .gcell .gt { color: var(--text); font-size: 12px; }
.gallery-grid .gcell.got .gt { color: var(--heart); }
.gallery-grid .gcell .gd { color: #777790; }
.set-row { display: flex; align-items: center; gap: 10px; font-size: 12px; }
.set-row input[type=range] { width: 140px; }

#nightcard {
  position: absolute; inset: 0; z-index: 65;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  background: #04040c;
}
#nightcard .nc-n { font-size: 36px; color: var(--text); text-shadow: 3px 3px 0 var(--heart); }
#nightcard .nc-s { font-size: 12px; color: #9a9ab8; }
/* 撕页日历 */
#nightcard .nc-cal {
  background: #f4ede0; color: #1a1a2e; border: 4px solid #000;
  box-shadow: inset 0 0 0 2px #c8bda4, 4px 4px 0 rgba(0,0,0,.6);
  padding: 8px 22px 10px; text-align: center; margin-bottom: 6px;
  animation: calflip .35s steps(4) both;
}
#nightcard .nc-month { font-size: 10px; letter-spacing: 3px; color: #8a2233; }
#nightcard .nc-date { font-size: 36px; line-height: 1.1; color: #1a1a2e; }
#nightcard .nc-week { font-size: 12px; color: #444; }
#nightcard .nc-count { font-size: 12px; color: #8a2233; margin-top: 3px; border-top: 2px dashed #c8bda4; padding-top: 3px; }
@keyframes calflip { from { transform: rotateX(80deg); opacity: 0; } to { transform: rotateX(0); opacity: 1; } }

/* ---------- 酒店房间：电视 / BB机 / 战利品架 ---------- */
.tv-ov {
  position: absolute; inset: 0; z-index: 66;
  display: flex; align-items: center; justify-content: center;
  background: rgba(4,4,12,.55);
}
.tv-set {
  width: 440px; background: #3a2c22; border: 4px solid #000;
  box-shadow: inset 0 0 0 3px #5a4636, 6px 6px 0 rgba(0,0,0,.5);
  padding: 12px 14px 8px;
}
.tv-head { font-size: 11px; color: #d8c8a8; letter-spacing: 2px; margin-bottom: 6px; }
.tv-screen {
  background: #0a1408; border: 4px solid #000;
  box-shadow: inset 0 0 0 2px #1c3a16;
  min-height: 96px; padding: 12px 14px; position: relative; overflow: hidden;
}
.tv-screen::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(to bottom, rgba(120,255,120,.05) 0 2px, transparent 2px 4px);
}
.tv-text { font-size: 13px; line-height: 1.8; color: #9aff9a; white-space: pre-line; }
.tv-text.roll { animation: tvroll .25s steps(3) both; }
@keyframes tvroll { from { transform: translateY(10px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.tv-hint { font-size: 10px; color: #8a7a64; text-align: right; margin-top: 4px; animation: blink .9s steps(1) infinite; }

.pager-ov {
  position: absolute; inset: 0; z-index: 66;
  display: flex; align-items: flex-end; justify-content: center; padding-bottom: 110px;
  background: rgba(4,4,12,.35);
}
.pager-box {
  width: 330px; background: #23232e; border: 4px solid #000;
  box-shadow: inset 0 0 0 2px #4a4a5e, 5px 5px 0 rgba(0,0,0,.5);
  padding: 10px 14px; position: relative;
}
.pager-led {
  position: absolute; top: 8px; right: 10px; width: 8px; height: 8px;
  background: #4dff6b; animation: blink .5s steps(1) infinite;
}
.pager-label { font-size: 10px; color: #8a8aa0; letter-spacing: 2px; margin-bottom: 6px; }
.pager-text {
  background: #1a2616; border: 3px solid #000; box-shadow: inset 0 0 0 2px #2c441e;
  color: #b8ff7a; font-size: 13px; line-height: 1.7; padding: 8px 10px; white-space: pre-line;
}

.shelf-ov { z-index: 66; justify-content: flex-start; overflow-y: auto; }
.sh-icon img { height: 30px; image-rendering: pixelated; display: inline-block; }
.shelf-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; width: 100%; max-width: 520px;
}
.shelf-cell {
  border: 2px solid #34345e; background: var(--panel); padding: 6px 2px;
  text-align: center; min-height: 52px; cursor: default;
}
.shelf-cell.got { border-color: var(--gold); cursor: pointer; }
.shelf-cell.got:hover { background: #26263e; }
.sh-icon { font-size: 18px; line-height: 1.4; }
.sh-name { font-size: 10px; color: #b8b8cc; line-height: 1.3; }
.shelf-cell.got .sh-name { color: var(--text); }
.shelf-memo {
  min-height: 64px; width: 100%; max-width: 520px;
  background: var(--panel); border: 3px solid #000; box-shadow: inset 0 0 0 2px var(--line);
  font-size: 12px; line-height: 1.7; padding: 8px 12px; color: #d8d8e8;
}
.shelf-memo .sh-from { color: var(--gold); font-size: 10px; }

/* ---------- 事件 CG（全屏插画） ---------- */
.cg-ov {
  position: absolute; inset: 0; z-index: 72; cursor: pointer;
  background-size: cover; background-position: center;
  image-rendering: pixelated;
  animation: cgIn .5s steps(6, end);
}
@keyframes cgIn { from { opacity: 0; filter: brightness(2); } to { opacity: 1; filter: brightness(1); } }
.cg-ov .cg-hint {
  position: absolute; right: 12px; bottom: 8px; font-size: 12px; color: #fff;
  text-shadow: 2px 2px 0 #000; animation: blink 1s steps(2, start) infinite;
}

/* ---------- 对话框控制角标：回想 / AUTO / SKIP ---------- */
#dlg-ctrl {
  position: absolute; top: -22px; right: 6px; display: flex; gap: 4px;
}
#dlg-ctrl button {
  font: inherit; font-size: 10px; line-height: 1; padding: 4px 7px;
  background: var(--panel); color: #9a9ab4; border: 2px solid #000;
  box-shadow: inset 0 0 0 1px var(--line); cursor: pointer;
}
#dlg-ctrl button:hover { color: var(--text); }
#dlg-ctrl button.on {
  color: #1a1a2e; background: var(--gold);
  box-shadow: inset 0 0 0 1px #fff;
  animation: dcOn 1s steps(2, start) infinite;
}
@keyframes dcOn { 50% { filter: brightness(1.25); } }

/* ---------- 回想（对话历史） ---------- */
.log-ov {
  position: absolute; inset: 0; z-index: 75;
  background: rgba(8, 8, 16, .88);
  display: flex; align-items: center; justify-content: center;
}
.log-box {
  width: 86%; max-width: 540px; height: 84%;
  background: var(--panel); border: 3px solid #000;
  box-shadow: inset 0 0 0 2px var(--line);
  display: flex; flex-direction: column; gap: 8px; padding: 12px 14px;
}
.log-box h2 { font-size: 14px; color: var(--gold); margin: 0; }
.log-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding-right: 4px; }
.log-row { display: flex; gap: 8px; font-size: 12px; line-height: 1.7; }
.log-who { flex: 0 0 56px; color: var(--gold); }
.log-who.dim { color: #55556e; }
.log-text { flex: 1; color: #d8d8e8; }
.log-box .pixel-btn { align-self: center; }

/* ---------- 收藏室：CG 鉴赏 + 成就 ---------- */
#collect-ov { justify-content: flex-start; overflow-y: auto; }
.cg-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
  width: 100%; max-width: 520px;
}
.cg-cell {
  border: 2px solid #34345e; background: var(--panel);
  text-align: center; padding: 4px; min-height: 70px;
}
.cg-cell.got { border-color: var(--gold); cursor: pointer; }
.cg-cell.got:hover { background: #26263e; }
.cg-cell img { width: 100%; display: block; image-rendering: pixelated; border: 1px solid #000; }
.cg-q { font-size: 24px; color: #55556e; line-height: 2.2; }
.cg-name { font-size: 10px; color: #b8b8cc; margin-top: 4px; line-height: 1.4; }
.collect-h2 { margin-top: 6px; }
.achv-list {
  width: 100%; max-width: 520px; display: flex; flex-direction: column; gap: 4px;
}
.achv-row {
  display: flex; align-items: baseline; gap: 8px;
  border: 2px solid #26263e; background: var(--panel);
  padding: 5px 8px; font-size: 11px; color: #707088;
}
.achv-row.got { border-color: var(--gold); color: var(--text); }
.av-ic { flex: 0 0 18px; text-align: center; }
.av-name { flex: 0 0 108px; }
.achv-row.got .av-name { color: var(--gold); }
.av-desc { flex: 1; line-height: 1.5; }

/* ---------- 读档 / 日记 / 收音机 ---------- */
.load-list { display: flex; flex-direction: column; gap: 6px; width: 100%; max-width: 420px; }
.load-slot { text-align: left; }
.load-slot.empty { color: #55556e; cursor: default; }
.save-tip { font-size: 11px; color: #9a9ab4; }
.juke-list { display: flex; flex-direction: column; gap: 6px; width: 100%; max-width: 420px; }
.juke-row { text-align: left; }
.juke-row.off { color: #55556e; }
.juke-row.sel { background: var(--gold); color: #1a1a2e; }
.juke-row.sel::after { content: ' ♪'; animation: blink 1s steps(2, start) infinite; }

/* ---------- 道具像素图标 ---------- */
.opt-ic {
  height: 18px; width: auto; image-rendering: pixelated;
  vertical-align: -3px; margin-right: 7px;
}
.rules-panel { position: relative; }
.r-book {
  position: absolute; top: -26px; left: 50%; transform: translateX(-50%) rotate(-6deg);
  height: 44px; image-rendering: pixelated;
  filter: drop-shadow(2px 3px 0 rgba(0,0,0,.55));
}

/* ---------- 撕日历仪式 ---------- */
#tear-ov {
  position: absolute; inset: 0; z-index: 74; cursor: pointer;
  background: rgba(5, 5, 12, .82);
  display: flex; align-items: center; justify-content: center;
  transition: opacity .4s steps(4, end);
}
#tear-ov.fade { opacity: 0; }
.tear-stack { position: relative; width: 190px; height: 220px; }
.tear-page {
  position: absolute; inset: 0; text-align: center;
  background: #f0e8d8; border: 4px solid #000;
  box-shadow: inset 0 0 0 2px #c8b896, 6px 8px 0 rgba(0,0,0,.45);
  color: #2a2018; padding-top: 18px;
}
.tear-page::before {
  content: ''; position: absolute; top: -10px; left: 50%; transform: translateX(-50%);
  width: 64px; height: 14px; background: #8a2433; border: 3px solid #000;
}
.tear-page .tp-month { font-size: 10px; letter-spacing: 2px; color: #8a7a5c; }
.tear-page .tp-date { font-size: 64px; line-height: 1.25; color: #1a1410; }
.tear-page .tp-week { font-size: 13px; color: #5a4a34; }
.tear-page.tg .tp-date, .tear-page.tg .tp-week { color: #a82433; }
.tear-page .tp-hint {
  margin-top: 12px; font-size: 11px; color: #a8243a;
  animation: blink 1s steps(2, start) infinite;
}
.tear-page.front { transform-origin: 18% -6%; }
.tear-page.front.rip { animation: ripFall 1.05s cubic-bezier(.45, .02, .9, .6) forwards; }
@keyframes ripFall {
  0%   { transform: rotate(0) translate(0, 0); }
  22%  { transform: rotate(-7deg) translate(-7px, 4px); }
  38%  { transform: rotate(5deg) translate(5px, 14px); }
  100% { transform: rotate(38deg) translate(60px, 360px); opacity: .85; }
}

/* ---------- 电视开机/关机 ---------- */
.tv-set { animation: tvOn .45s steps(6, end); }
@keyframes tvOn {
  0% { transform: scaleY(.04) scaleX(.6); filter: brightness(3); }
  60% { transform: scaleY(1.06) scaleX(1); filter: brightness(1.6); }
  100% { transform: scaleY(1) scaleX(1); filter: brightness(1); }
}
.tv-set.off { animation: tvOff .4s steps(5, end) forwards; }
@keyframes tvOff {
  0% { transform: scaleY(1); filter: brightness(1); }
  55% { transform: scaleY(.035) scaleX(1.04); filter: brightness(2.4); }
  100% { transform: scaleY(.012) scaleX(.02); filter: brightness(4); opacity: 0; }
}

/* ---------- BB机滑入 ---------- */
.pager-box { animation: pagerUp .42s cubic-bezier(.2, .9, .3, 1.18); }
@keyframes pagerUp {
  0% { transform: translateY(140px); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}

/* ---------- 移动端 ---------- */
@media (pointer: coarse) {
  .pixel-btn { padding: 10px 16px; }
  #dlg-ctrl button { padding: 6px 9px; }
}
