/* ============================================================
   推理ADV模板 · 鸣潮风深色科技UI
   换皮：改 :root 变量即可整体换色
   ============================================================ */
:root {
  --c-bg: #0a0f14;
  --c-bg2: #101820;
  --c-panel: rgba(14, 24, 32, 0.92);
  --c-line: #1f3a42;
  --c-cyan: #35e0cf;
  --c-cyan-dim: #1a8f85;
  --c-gold: #e8c56a;
  --c-text: #d8e4e6;
  --c-dim: #7a9298;
  --c-danger: #e05a6a;
  --clip-hud: polygon(0 0, calc(100% - 14px) 0, 100% 14px, 100% 100%, 14px 100%, 0 calc(100% - 14px));
}

* { margin: 0; padding: 0; box-sizing: border-box; user-select: none; }
html, body { width: 100%; height: 100%; overflow: hidden; }
body {
  background: var(--c-bg);
  font-family: "Microsoft YaHei", "Noto Sans SC", sans-serif;
  color: var(--c-text);
}

#app { width: 100%; height: 100%; position: relative; }

.screen {
  position: absolute; inset: 0;
  display: none;
}
.screen.active { display: block; }

/* ---------- 通用按钮 ---------- */
.btn {
  background: linear-gradient(160deg, rgba(53,224,207,0.08), rgba(53,224,207,0.02));
  border: 1px solid var(--c-line);
  color: var(--c-text);
  padding: 9px 20px;
  font-size: 13px;
  letter-spacing: 2px;
  cursor: pointer;
  clip-path: var(--clip-hud);
  transition: all .18s;
}
.btn:hover {
  border-color: var(--c-cyan);
  color: var(--c-cyan);
  background: linear-gradient(160deg, rgba(53,224,207,0.18), rgba(53,224,207,0.05));
  box-shadow: 0 0 12px rgba(53,224,207,0.25);
}
.menu-btn { min-width: 200px; text-align: center; }

/* ---------- 开始游戏 · 角色与登录 ---------- */
#screen-setup {
  background:
    radial-gradient(ellipse 80% 60% at 70% 20%, rgba(53,224,207,0.07), transparent),
    linear-gradient(180deg, #070c10 0%, #0b1319 60%, #070c10 100%);
}
.setup-box {
  width: min(720px, 92vw); max-height: 88vh; overflow-y: auto;
  padding: 24px 30px 26px; text-align: center;
  border: 1px solid var(--c-line);
  background: rgba(8,14,18,0.9);
  box-shadow: 0 0 40px rgba(0,0,0,0.6);
}
.setup-row {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  margin: 16px 0 6px;
}
.setup-row label { color: var(--c-cyan); letter-spacing: 3px; font-size: 14px; white-space: nowrap; }
#setup-name {
  width: 220px; text-align: center;
  background: rgba(53,224,207,0.04);
  border: 1px solid var(--c-line);
  color: var(--c-text);
  padding: 8px 14px; font-size: 15px; letter-spacing: 2px; outline: none;
}
#setup-name:focus { border-color: var(--c-cyan); }
.setup-hint { color: var(--c-dim); font-size: 12px; line-height: 1.6; letter-spacing: .5px; }
.setup-label {
  color: var(--c-cyan); letter-spacing: 2px; font-size: 13px;
  text-align: left; margin: 18px 0 8px;
}
#setup-avatars {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr));
  gap: 8px;
}
.setup-cloud {
  border: 1px dashed var(--c-line);
  padding: 10px 14px; color: var(--c-text);
  font-size: 12px; letter-spacing: 1px;
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: center;
}
.setup-cloud b { color: var(--c-gold); }
.sc-btn {
  border: 1px solid var(--c-gold); border-radius: 8px;
  background: transparent; color: var(--c-gold);
  font-size: 12px; letter-spacing: 2px; padding: 4px 14px;
  cursor: pointer;
}
.sc-btn:hover { background: rgba(232,197,106,0.12); }
.sc-btn.dim { border-color: var(--c-line); color: var(--c-dim); }
.sc-form { display: flex; flex-wrap: wrap; gap: 6px; width: 100%; justify-content: center; }
.sc-form input {
  border: 1px solid var(--c-line); border-radius: 8px;
  background: rgba(0,0,0,0.35); color: var(--c-text);
  font-size: 12px; padding: 6px 10px; outline: none; width: 150px;
}
.sc-form input:focus { border-color: var(--c-gold); }
.sc-tip { width: 100%; color: var(--c-dim); font-size: 11px; letter-spacing: 0.5px; }
.sc-msg { width: 100%; color: #ff8f8f; font-size: 11px; min-height: 14px; text-align: center; }
.setup-tips { color: var(--c-dim); font-size: 12px; line-height: 1.7; margin-top: 8px; text-align: left; }
.setup-btns { display: flex; flex-direction: column; gap: 10px; align-items: center; margin-top: 20px; }

/* ---------- 标题画面 ---------- */
#screen-title {
  background:
    radial-gradient(ellipse 80% 60% at 70% 20%, rgba(53,224,207,0.08), transparent),
    radial-gradient(ellipse 60% 50% at 20% 90%, rgba(232,197,106,0.05), transparent),
    linear-gradient(180deg, #0a0f14 0%, #0d151d 60%, #0a0f14 100%);
}
.title-deco {
  position: absolute; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(53,224,207,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(53,224,207,0.04) 1px, transparent 1px);
  background-size: 60px 60px;
  mask-image: radial-gradient(ellipse at center, black 30%, transparent 75%);
}
.title-box {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}
.title-tag {
  color: var(--c-cyan-dim); font-size: 12px; letter-spacing: 6px; margin-bottom: 18px;
}
.title-main {
  font-size: 56px; font-weight: 300; letter-spacing: 20px;
  color: var(--c-text);
  text-shadow: 0 0 30px rgba(53,224,207,0.35);
}
.title-sub {
  margin: 14px 0 60px; color: var(--c-gold); font-size: 13px; letter-spacing: 8px;
}
.title-menu { display: flex; flex-direction: column; gap: 14px; align-items: center; }
.title-foot { margin-top: 70px; color: var(--c-dim); font-size: 12px; letter-spacing: 10px; }

/* 标题画面 · 云端身份（与 500wrg.com 互认） */
#cloud-status { margin-top: 10px; color: var(--c-dim); font-size: 11px; letter-spacing: 2px; opacity: 0; transition: opacity .6s; text-align: center; }
#cloud-status.show { opacity: 1; }
.slot-item.cloud-slot { border-style: dashed; }

/* 标题画面 · 剧情进度 */
#title-progress {
  margin: -34px 0 22px;
  color: var(--c-gold); font-size: 12px; letter-spacing: 3px;
  border: 1px solid rgba(232,197,106,0.35);
  background: rgba(232,197,106,0.06);
  padding: 6px 22px;
  display: inline-block;
}
/* ---------- 游戏画面 ---------- */
#screen-game {
  background:
    radial-gradient(ellipse 90% 70% at 50% 10%, rgba(53,224,207,0.05), transparent),
    linear-gradient(180deg, #0c1219, #0a0e13);
}

/* 背景层（占位背景由引擎渲染） */
#bg-layer {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: var(--c-dim);
  font-size: 22px; letter-spacing: 8px;
}
#bg-layer img {
  width: 100%; height: 100%;
  object-fit: cover;
  filter: brightness(0.75) saturate(0.95);
}
.bg-label {
  position: absolute; right: 22px; bottom: 214px;
  background: rgba(6,10,14,0.72);
  border: 1px solid var(--c-line);
  border-right: 3px solid var(--c-gold);
  padding: 6px 16px;
  color: var(--c-gold); font-size: 13px; letter-spacing: 4px;
  clip-path: polygon(0 0, 100% 0, calc(100% - 8px) 100%, 8px 100%);
}

/* 分层立绘舞台（无框） */
#portrait-layer {
  position: absolute; bottom: 150px; left: 0; right: 0;
  display: flex; justify-content: center; align-items: flex-end; gap: 60px;
  pointer-events: none;
  z-index: 8;
}
.char-stage {
  position: relative;
  width: 250px; height: 470px;
  transform-origin: bottom center;
  transition: opacity .3s, filter .3s;
  filter: drop-shadow(0 8px 22px rgba(0,0,0,0.55));
}
.char-stage.speaking { animation: stageBob 3.2s ease-in-out infinite; }
@keyframes stageBob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
.char-stage .layer { position: absolute; inset: 0; }
.char-stage .layer svg { width: 100%; height: 100%; display: block; }
.char-stage .layer img { width: 100%; height: 100%; object-fit: contain; object-position: bottom center; display: block; }
/* 整图立绘：融入深色背景（去黑边+底部渐隐） */
.layer-full img {
  mix-blend-mode: screen;
  -webkit-mask-image: linear-gradient(180deg, #000 76%, transparent 99%);
  mask-image: linear-gradient(180deg, #000 76%, transparent 99%);
}

/* 衣物飘动 */
.layer-cloth svg { transform-origin: 50% 12%; animation: sway 3.4s ease-in-out infinite; }
@keyframes sway { 0%,100% { transform: rotate(-2.4deg); } 50% { transform: rotate(2.4deg); } }
/* 发丝飘动 */
.layer-bangs svg { transform-origin: 50% 6%; animation: sway2 2.6s ease-in-out infinite; }
@keyframes sway2 { 0%,100% { transform: rotate(-3deg); } 50% { transform: rotate(3deg); } }
/* 双手待机摆动 */
.layer-armL svg { transform-origin: 60% 16%; animation: bobL 2.8s ease-in-out infinite; }
.layer-armR svg { transform-origin: 40% 16%; animation: bobR 3.1s ease-in-out infinite; }
@keyframes bobL { 0%,100% { transform: rotate(0deg); } 50% { transform: rotate(2.6deg); } }
@keyframes bobR { 0%,100% { transform: rotate(0deg); } 50% { transform: rotate(-2.6deg); } }
/* 眨眼（仅普通表情） */
.fx .eyes { transform-box: fill-box; transform-origin: center; }
.fx-normal .eyes { animation: blink 4.6s infinite; }
@keyframes blink { 0%, 91%, 100% { transform: scaleY(1); } 94% { transform: scaleY(0.12); } 97% { transform: scaleY(1); } }

/* 表情切换（SVG/图片两种形态均支持） */
.layer-face .fx { display: none; position: absolute; inset: 0; }
.layer-face .fx svg { width: 100%; height: 100%; }
.layer-face .fx img { width: 100%; height: 100%; object-fit: contain; object-position: top center; }
.char-stage[data-face="normal"]   .fx-normal   { display: block; }
.char-stage[data-face="smile"]    .fx-smile    { display: block; }
.char-stage[data-face="think"]    .fx-think    { display: block; }
.char-stage[data-face="surprise"] .fx-surprise { display: block; }

/* 顶部HUD */
#hud {
  position: absolute; top: 0; left: 0; right: 0;
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 20px;
  background: linear-gradient(180deg, rgba(6,10,14,0.85), transparent);
  z-index: 20;
}
#hud { justify-content: space-between; gap: 16px; }
/* 可拖动对话进度条 */
#hud-progress { flex: 1; max-width: 340px; display: flex; align-items: center; }
#progress-bar {
  width: 100%; height: 4px; margin: 0;
  -webkit-appearance: none; appearance: none;
  border-radius: 2px; outline: none; cursor: pointer;
  background: linear-gradient(90deg, rgba(53,224,207,.75), rgba(53,224,207,.15));
}
#progress-bar::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 14px; height: 14px; border-radius: 50%; border: none;
  background: var(--c-cyan); box-shadow: 0 0 8px rgba(53,224,207,.85);
  cursor: grab;
}
#progress-bar::-webkit-slider-thumb:active { cursor: grabbing; transform: scale(1.15); }
#progress-bar::-moz-range-thumb {
  width: 14px; height: 14px; border-radius: 50%; border: none;
  background: var(--c-cyan); box-shadow: 0 0 8px rgba(53,224,207,.85);
  cursor: grab;
}
#progress-bar::-moz-range-track {
  height: 4px; border-radius: 2px;
  background: rgba(53,224,207,.25);
}
.hud-btns { display: flex; gap: 8px; }
.hud-btn { padding: 5px 12px; font-size: 12px; }

/* 对话框（精修：渐变面板+金角装饰+辉光） */
#dialog-box {
  position: absolute; left: 50%; bottom: 26px;
  transform: translateX(-50%);
  width: min(1100px, 94vw);
  min-height: 150px;
  background: linear-gradient(180deg, rgba(14,22,30,0.93), rgba(8,12,17,0.97));
  border: 1px solid var(--c-line);
  border-top: 1px solid rgba(53,224,207,0.4);
  box-shadow: 0 -8px 34px rgba(0,0,0,0.5), inset 0 0 0 1px rgba(53,224,207,0.06);
  padding: 24px 38px 28px;
  z-index: 15;
  backdrop-filter: blur(6px);
}
#dialog-box::before {
  content: ""; position: absolute; left: 0; top: 0; width: 3px; height: 100%;
  background: linear-gradient(180deg, var(--c-cyan), transparent);
}
#dialog-box::after {
  content: ""; position: absolute; right: -1px; bottom: -1px;
  width: 26px; height: 26px;
  border-right: 2px solid var(--c-gold);
  border-bottom: 2px solid var(--c-gold);
  opacity: .85;
}
#name-plate {
  position: absolute; top: -34px; left: 18px;
  background: linear-gradient(135deg, rgba(10,18,24,0.97), rgba(17,34,40,0.97));
  border: 1px solid color-mix(in srgb, var(--npc, #4dd8c7) 70%, transparent);
  border-left: 4px solid var(--npc, #4dd8c7);
  padding: 8px 32px 6px 20px;
  color: var(--npc, var(--c-cyan));
  font-size: 15px; letter-spacing: 4px;
  clip-path: polygon(0 0, calc(100% - 16px) 0, 100% 100%, 0 100%);
  box-shadow: 0 0 18px color-mix(in srgb, var(--npc, #4dd8c7) 30%, transparent);
  text-shadow: 0 0 10px color-mix(in srgb, var(--npc, #4dd8c7) 55%, transparent);
  display: none;
  z-index: 2;
}
#dialog-text {
  margin-top: 6px;
  font-size: 14px; line-height: 1.9; letter-spacing: 1px;
  min-height: 64px;
  white-space: pre-wrap;
  text-shadow: 0 1px 2px rgba(0,0,0,0.6);
}
#next-arrow {
  position: absolute; right: 24px; bottom: 12px;
  color: var(--c-cyan); font-size: 13px;
  text-shadow: 0 0 8px rgba(53,224,207,0.8);
  animation: bob 1s infinite;
  display: none;
}
@keyframes bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(4px); } }

#click-layer { position: absolute; inset: 0; z-index: 10; cursor: pointer; }

/* ---------- 调查模式 ---------- */
#screen-investigate { background: #06090c; z-index: 30; }
#invest-scene {
  position: absolute; inset: 60px 40px 90px;
  border: 1px solid var(--c-line);
  background:
    radial-gradient(ellipse 70% 60% at 50% 40%, rgba(53,224,207,0.06), transparent),
    repeating-linear-gradient(45deg, rgba(53,224,207,0.015) 0 2px, transparent 2px 24px);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
#invest-scene .scene-label { color: var(--c-dim); font-size: 26px; letter-spacing: 12px; }
.hotspot {
  position: absolute;
  cursor: pointer;
  border: 1px dashed transparent;
  transition: all .15s;
}
.hotspot:hover {
  border-color: var(--c-cyan);
  background: rgba(53,224,207,0.10);
  box-shadow: 0 0 14px rgba(53,224,207,0.35);
}
.hotspot::after {
  content: "?";
  position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%);
  color: rgba(53,224,207,0.0); font-size: 18px; transition: color .15s;
}
.hotspot:hover::after { color: var(--c-cyan); }
.hotspot.found { border: 1px solid rgba(232,197,106,0.4); cursor: default; }
.hotspot.found::after { content: "✓"; color: var(--c-gold); font-size: 14px; }

#invest-hud {
  position: absolute; left: 0; right: 0; bottom: 0; height: 76px;
  display: flex; align-items: center; gap: 24px;
  padding: 0 40px;
  background: linear-gradient(0deg, rgba(6,10,14,0.95), transparent);
}
#invest-name { color: var(--c-gold); letter-spacing: 3px; border-left: 3px solid var(--c-gold); padding-left: 10px; }
#invest-progress { color: var(--c-cyan); letter-spacing: 2px; font-size: 14px; }
#invest-hint { color: var(--c-dim); font-size: 13px; flex: 1; }
.hidden { display: none !important; }

#invest-result {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%);
  width: min(640px, 90vw);
  background: var(--c-panel);
  border: 1px solid var(--c-cyan-dim);
  clip-path: var(--clip-hud);
  padding: 30px 36px;
  z-index: 5;
  text-align: center;
}
#invest-result-title {
  color: var(--c-gold); font-size: 18px; letter-spacing: 4px; margin-bottom: 16px;
  border-bottom: 1px solid var(--c-line); padding-bottom: 10px;
}
#invest-result-text { color: var(--c-text); font-size: 14px; line-height: 1.9; margin-bottom: 20px; white-space: pre-wrap; }

/* ---------- 面板（询问/推理） ---------- */
#screen-panel {
  background: rgba(4, 8, 11, 0.9);
  z-index: 35;
  display: none; align-items: center; justify-content: center;
}
#screen-panel.active { display: flex; }
.panel-frame {
  width: min(860px, 94vw);
  max-height: 86vh;
  background: var(--c-panel);
  border: 1px solid var(--c-line);
  clip-path: var(--clip-hud);
  padding: 26px 34px;
  display: flex; flex-direction: column;
  overflow: hidden;
}
.panel-title, #panel-title {
  color: var(--c-gold); font-size: 15px; letter-spacing: 4px;
  border-bottom: 1px solid var(--c-line); padding-bottom: 12px; margin-bottom: 16px;
  text-align: center;
}
#panel-body { flex: 1; overflow-y: auto; min-height: 120px; }
.topic-btn {
  display: block; width: 100%;
  background: rgba(53,224,207,0.04);
  border: 1px solid var(--c-line);
  border-left: 3px solid var(--c-cyan-dim);
  color: var(--c-text);
  padding: 11px 16px; margin-bottom: 10px;
  font-size: 13px; letter-spacing: 1px;
  cursor: pointer; text-align: left;
  transition: all .15s;
}
.topic-btn:hover { border-left-color: var(--c-cyan); background: rgba(53,224,207,0.10); color: var(--c-cyan); }
.topic-btn.locked { opacity: .35; cursor: not-allowed; }
.topic-btn.asked { opacity: .5; border-left-color: var(--c-gold); }
.topic-answer {
  background: rgba(232,197,106,0.04);
  border: 1px dashed var(--c-line);
  padding: 12px 16px; margin: -4px 0 14px;
  color: var(--c-text); font-size: 13px; line-height: 1.8; white-space: pre-wrap;
}
.topic-q { color: var(--c-cyan); }

/* 推理：证物格 */
.evi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 6px; }
.evi-cell {
  border: 1px solid var(--c-line);
  background: rgba(53,224,207,0.03);
  padding: 12px 8px;
  text-align: center; font-size: 12px; letter-spacing: 1px;
  cursor: pointer; transition: all .15s;
  min-height: 64px; display: flex; align-items: center; justify-content: center;
}
.evi-cell:hover { border-color: var(--c-cyan); color: var(--c-cyan); background: rgba(53,224,207,0.1); }
.evi-cell.wrong { border-color: var(--c-danger); color: var(--c-danger); animation: shake .3s; }
.evi-cell.correct { border-color: var(--c-gold); color: var(--c-gold); box-shadow: 0 0 14px rgba(232,197,106,0.3); }
@keyframes shake { 0%,100%{transform:translateX(0)} 25%{transform:translateX(-5px)} 75%{transform:translateX(5px)} }
.deduce-fb { margin-top: 16px; min-height: 52px; font-size: 13px; line-height: 1.8; white-space: pre-wrap; }
.deduce-fb.bad { color: var(--c-danger); }
.deduce-fb.good { color: var(--c-gold); }

/* ---------- 选择支 ---------- */
#screen-choice {
  z-index: 40; display: none; align-items: center; justify-content: center;
  background: rgba(4,8,11,0.55);
}
#screen-choice.active { display: flex; }
#choice-box { width: min(560px, 90vw); text-align: center; }
#choice-prompt {
  color: var(--c-cyan); font-size: 15px; letter-spacing: 3px; margin-bottom: 28px;
  text-shadow: 0 0 14px rgba(53,224,207,0.4);
}
#choice-options { display: flex; flex-direction: column; gap: 14px; align-items: center; }
.choice-btn { min-width: 420px; }

/* ---------- 结局 ---------- */
#screen-ending {
  z-index: 50; display: none; align-items: center; justify-content: center;
  background: linear-gradient(180deg, #05080b, #0a1216);
}
#screen-ending.active { display: flex; }
.ending-box { text-align: center; max-width: 640px; padding: 20px; }
#ending-title { color: var(--c-gold); font-size: 30px; letter-spacing: 10px; margin-bottom: 24px; font-weight: 300; }
#ending-text { color: var(--c-dim); font-size: 14px; line-height: 2; margin-bottom: 40px; white-space: pre-wrap; }
/* 结局页倒计时：到点自动进入主城 */
.ending-auto {
  margin-top: 14px; min-height: 16px;
  color: var(--c-dim); font-size: 12px; letter-spacing: 2px;
  font-variant-numeric: tabular-nums;
}

/* ---------- 回想记录 ---------- */
#screen-log {
  z-index: 45; display: none; align-items: center; justify-content: center;
  background: rgba(4,8,11,0.92);
}
#screen-log.active { display: flex; }
#log-list { max-height: 55vh; overflow-y: auto; }
.log-item { margin-bottom: 16px; line-height: 1.8; }
.log-who { color: var(--c-cyan); margin-bottom: 4px; letter-spacing: 2px; }
.log-text { color: var(--c-text); white-space: pre-wrap; }
.log-text.narr { color: var(--c-dim); }

/* ---------- 手帐 ---------- */
#screen-note {
  z-index: 45; display: none; align-items: center; justify-content: center;
  background: rgba(4,8,11,0.92);
}
#screen-note.active { display: flex; }
.note-tabs { display: flex; gap: 10px; margin-bottom: 16px; justify-content: center; }
.tab-btn.active { border-color: var(--c-gold); color: var(--c-gold); }
#note-body { min-height: 200px; max-height: 55vh; overflow-y: auto; }
.note-empty { color: var(--c-dim); text-align: center; padding: 40px 0; letter-spacing: 3px; }
.note-card {
  border: 1px solid var(--c-line); border-left: 3px solid var(--c-cyan-dim);
  padding: 12px 16px; margin-bottom: 10px;
}
.note-card b { color: var(--c-cyan); letter-spacing: 2px; }
.note-card p { color: var(--c-dim); font-size: 13px; margin-top: 4px; line-height: 1.7; white-space: pre-wrap; }
.note-card.got { border-left-color: var(--c-gold); }
.note-card.got b { color: var(--c-gold); }

/* ---------- 全量号库（数据来自 500wrg.com） ---------- */
#screen-library {
  z-index: 55; display: none; align-items: center; justify-content: center;
  background: rgba(4,8,11,0.92);
}
#screen-library.active { display: flex; }
.lib-frame { width: min(720px, 94vw); max-height: 90vh; overflow-y: auto; }
.lib-lede { color: var(--c-dim); font-size: 13px; line-height: 1.9; margin-bottom: 16px; }
.lib-lede b { color: var(--c-gold); letter-spacing: 1px; }
.lib-stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px; margin-bottom: 14px;
}
.lib-stat {
  border: 1px solid var(--c-line); background: rgba(53,224,207,0.03);
  padding: 10px 8px; text-align: center;
  display: flex; flex-direction: column; gap: 4px; align-items: center;
}
.lib-stat span { color: var(--c-dim); font-size: 11px; letter-spacing: 2px; }
.lib-stat b { color: var(--c-cyan); font-size: 16px; letter-spacing: 1px; font-weight: normal; }
.lib-stat i { color: var(--c-dim); font-size: 10px; font-style: normal; }
.lib-bar {
  height: 6px; border-radius: 3px; overflow: hidden;
  background: rgba(53,224,207,0.1); margin-bottom: 16px;
}
#lib-bar-fill {
  height: 100%; width: 0; border-radius: 3px; transition: width .8s;
  background: linear-gradient(90deg, var(--c-cyan-dim), var(--c-cyan));
  box-shadow: 0 0 10px rgba(53,224,207,.5);
}
.lib-rules { border-top: 1px dashed var(--c-line); padding-top: 12px; margin-bottom: 12px; }
.lib-rules p { color: var(--c-dim); font-size: 12px; line-height: 2; }
.lib-foot { color: var(--c-cyan-dim); font-size: 11px; letter-spacing: 1px; margin-bottom: 14px; }
.lib-foot.offline { color: var(--c-dim); }

/* ---------- 存档 ---------- */
#screen-saveload {
  z-index: 60; display: none; align-items: center; justify-content: center;
  background: rgba(4,8,11,0.92);
}
#screen-saveload.active { display: flex; }
.slot-btn {
  display: flex; justify-content: space-between; align-items: center;
  width: 100%;
  background: rgba(53,224,207,0.03);
  border: 1px solid var(--c-line);
  color: var(--c-text);
  padding: 14px 20px; margin-bottom: 10px;
  cursor: pointer; font-size: 14px; letter-spacing: 1px;
  transition: all .15s;
}
.slot-btn:hover { border-color: var(--c-cyan); background: rgba(53,224,207,0.08); }
.slot-btn .slot-info { color: var(--c-dim); font-size: 12px; }
.slot-btn.empty { opacity: .5; }

/* ---------- 我的形象（立绘自选） ---------- */
#home-avatars {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  gap: 10px; margin-top: 10px;
}
.avatar-card {
  border: 1px solid var(--c-line); background: rgba(53,224,207,0.03);
  padding: 8px 6px; cursor: pointer; text-align: center;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 112px; gap: 6px;
  transition: all .15s;
}
.avatar-card img { height: 96px; max-width: 100%; object-fit: contain; object-position: top; }
/* 卡片不再显示任何预设角色名（名称全部由玩家自定义） */
.avatar-card span { display: none; }
.avatar-card:hover { border-color: var(--c-cyan); }
.avatar-card.sel {
  border-color: var(--c-cyan); background: rgba(53,224,207,0.1);
  box-shadow: 0 0 12px rgba(53,224,207,0.25);
}
.avatar-card.sel span { color: var(--c-cyan); }


/* ---------- toast ---------- */
#toast {
  position: fixed; top: 70px; left: 50%; transform: translateX(-50%) translateY(-16px);
  background: var(--c-panel);
  border: 1px solid var(--c-gold);
  color: var(--c-gold);
  padding: 10px 26px; letter-spacing: 2px; font-size: 14px;
  clip-path: var(--clip-hud);
  opacity: 0; pointer-events: none; transition: all .3s; z-index: 99;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* 滚动条 */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-thumb { background: var(--c-line); }
::-webkit-scrollbar-track { background: transparent; }

/* ============================================================
   主城（剑与远征式场景大厅）
   ============================================================ */
#screen-hub { z-index: 5; }
#hub-bg {
  position: absolute; inset: 0; overflow: hidden;
  background: radial-gradient(ellipse at 50% 40%, #131a20 0%, #0a0e13 70%, #070a0d 100%);
  display: flex; align-items: center; justify-content: center;
}
/* 主图按原始 3:2 完整显示（不裁切、不放大），两侧留出舞台黑边 */
#hub-stage {
  position: relative;
  aspect-ratio: 3 / 2;
  width: 100%; max-width: calc(100vh * 1.5);
  max-height: 100%;
  overflow: hidden;
  box-shadow: 0 0 60px rgba(0, 0, 0, .55);
}
#hub-stage > img.hub-base {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; transform: none;
  filter: brightness(1) saturate(1.02);
}
/* 右下角极轻暗角，柔和收边（不遮挡画面内容） */
#hub-stage::after {
  content: ""; position: absolute; right: 0; bottom: 0; width: 13%; height: 8%;
  background: radial-gradient(ellipse at 100% 100%, rgba(8, 12, 14, .55), rgba(8, 12, 14, 0) 72%);
  pointer-events: none; z-index: 5;
}
#hub-top {
  position: absolute; top: 0; left: 0; right: 0;
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 20px;
  background: linear-gradient(180deg, rgba(6,10,14,0.85), transparent);
  z-index: 6;
}

/* 背景交叉淡入 */
#hub-stage img.wx-fade { opacity: 0; transition: opacity .7s ease; }
#hub-stage img.wx-fade.wx-show { opacity: 1; }
/* ---------- 主城动态特效层 ---------- */
#hub-fx {
  position: absolute; inset: 0;
  z-index: 3; pointer-events: none; overflow: hidden;
}
#hub-fx canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
/* 云影缓缓飘移 */
.fx-clouds {
  position: absolute; inset: -25%;
  background:
    radial-gradient(ellipse 34% 16% at 22% 18%, rgba(255,255,255,0.10), transparent 70%),
    radial-gradient(ellipse 40% 18% at 68% 10%, rgba(255,255,255,0.08), transparent 70%),
    radial-gradient(ellipse 28% 14% at 48% 30%, rgba(255,255,255,0.06), transparent 70%);
  animation: cloudDrift 80s ease-in-out infinite alternate;
}
@keyframes cloudDrift {
  from { transform: translateX(-5%) translateY(-2%); }
  to   { transform: translateX(5%) translateY(2%); }
}
/* 水面波光轻晃（覆盖池塘区域） */
.fx-water {
  position: absolute; left: 30%; top: 52%; width: 68%; height: 46%;
  background: repeating-linear-gradient(104deg,
    transparent 0 22px, rgba(255,255,255,0.055) 22px 25px,
    transparent 25px 60px, rgba(255,244,214,0.045) 60px 62px);
  mix-blend-mode: screen;
  animation: waterShift 6.5s ease-in-out infinite;
}
@keyframes waterShift {
  0%, 100% { transform: translateX(-8px) skewX(0deg); opacity: .8; }
  50%      { transform: translateX(8px) skewX(-1.6deg); opacity: 1; }
}
/* ---------- 主城人物层 ---------- */
#hub-cast {
  position: absolute; inset: 0;
  z-index: 4; pointer-events: none;
  perspective: 900px;
  perspective-origin: 50% 60%;
}
.cast {
  position: absolute;
  transform: translate(-50%, -100%) rotateX(3.5deg);
  transform-origin: 50% 100%;
  transition: left 4s linear, top 4s linear;
  will-change: left, top;
  pointer-events: auto;
  cursor: pointer;
  filter: drop-shadow(0 10px 12px rgba(20, 30, 25, .38));
}
.cast-shadow {
  position: absolute; left: 50%; bottom: -5px;
  width: 68%; height: 15px;
  transform: translateX(-50%);
  background: radial-gradient(ellipse at center, rgba(16, 26, 22, .5), rgba(16, 26, 22, 0) 72%);
  filter: blur(2.5px);
  pointer-events: none;
}
.cast-flip {
  position: relative;
  height: 100%; aspect-ratio: 2 / 3;
  transform-origin: 50% 100%;
  transition: transform .25s ease;
}
.cast.face-left .cast-flip { transform: scaleX(-1); }
.cast-img {
  position: absolute; left: 0; right: 0; bottom: 0;
  width: 100%; height: 100%;
  object-fit: contain; object-position: bottom center;
  transform-origin: 50% 100%;
  /* 与场景融合：轻微降饱和贴暖光，模拟环境反射 */
  filter: saturate(1.04) contrast(1.03) brightness(1.02)
          drop-shadow(0 0 5px rgba(255, 244, 205, .35));
  animation: castBreath 3.8s ease-in-out infinite;
  user-select: none; -webkit-user-drag: none;
}
/* 动作姿态立绘：交叉淡入淡出 */
.cast-base { opacity: 1; transition: opacity .2s ease; }
.cast-act { opacity: 0; transition: opacity .2s ease; }
.cast.pose-act .cast-base { opacity: 0; }
.cast.pose-act .cast-act { opacity: 1; }
@keyframes castBreath {
  0%, 100% { transform: translateY(0) scale(1); }
  50%      { transform: translateY(-1.2%) scale(1.008); }
}
/* 行走：上下起伏 + 轻微前倾 */
.cast.walking .cast-img { animation: castWalkBob .52s ease-in-out infinite; }
@keyframes castWalkBob {
  0%, 100% { transform: translateY(0) rotate(-.6deg); }
  50%      { transform: translateY(-3.4%) rotate(.6deg); }
}
/* 驻足动作：钓鱼（微微前倾持竿） */
.cast.act-fish .cast-img { animation: castFish 2.6s ease-in-out infinite; }
@keyframes castFish {
  0%, 100% { transform: rotate(-1.4deg) translateY(0); }
  45%      { transform: rotate(1.2deg) translateY(-1%); }
}
/* 驻足动作：看橱窗（歪头端详） */
.cast.act-look .cast-img { animation: castLook 3.2s ease-in-out infinite; }
@keyframes castLook {
  0%, 100% { transform: rotate(0deg); }
  35%      { transform: rotate(-2.2deg) translateY(-.5%); }
  70%      { transform: rotate(1.6deg); }
}
/* 驻足动作：发呆（慢呼吸拉长） */
.cast.act-idle .cast-img { animation: castBreath 5.6s ease-in-out infinite; }
/* 快步走 */
.cast.walk-quick .cast-img { animation: castWalkBob .34s ease-in-out infinite; }
/* 思考（歪头沉吟） */
.cast.act-think .cast-img { animation: castThink 3.4s ease-in-out infinite; }
@keyframes castThink {
  0%, 100% { transform: rotate(0deg) translateY(0); }
  40%      { transform: rotate(-2.4deg) translateY(-.6%); }
  72%      { transform: rotate(-1.2deg) translateY(0); }
}
/* 读物（低头看卷宗） */
.cast.act-read .cast-img { animation: castRead 4s ease-in-out infinite; }
@keyframes castRead {
  0%, 100% { transform: rotate(0deg) translateY(0); }
  50%      { transform: rotate(1.8deg) translateY(.9%); }
}
/* 挥手（上半身摆动） */
.cast.act-wave .cast-img { animation: castWaveLoop 1.15s ease-in-out infinite; transform-origin: 50% 22%; }
@keyframes castWaveLoop {
  0%, 100% { transform: rotate(-1deg); }
  25%      { transform: rotate(-5.5deg); }
  75%      { transform: rotate(3.5deg); }
}
/* 指路（侧身引导） */
.cast.act-point .cast-img { animation: castPoint 1.7s ease-in-out infinite; transform-origin: 50% 45%; }
@keyframes castPoint {
  0%, 100% { transform: translateX(0) rotate(0deg); }
  50%      { transform: translateX(2.2%) rotate(1.6deg); }
}
/* 伸懒腰（纵向拉伸） */
.cast.act-stretch .cast-img { animation: castStretch 2.3s ease-in-out infinite; }
@keyframes castStretch {
  0%, 100% { transform: scaleY(1) translateY(0); }
  45%      { transform: scaleY(1.05) translateY(-2.6%); }
}
/* 轻晃（闲聊律动） */
.cast.act-sway .cast-img { animation: castSway 2.6s ease-in-out infinite; transform-origin: 50% 100%; }
@keyframes castSway {
  0%, 100% { transform: rotate(-2.6deg); }
  50%      { transform: rotate(2.6deg); }
}
/* 点头欠身 */
.cast.act-bow .cast-img { animation: castBow 1.9s ease-in-out infinite; transform-origin: 50% 100%; }
@keyframes castBow {
  0%, 100% { transform: rotate(0deg); }
  45%      { transform: rotate(6deg) translateY(1%); }
}
/* 端茶送饮 */
.cast.act-sip .cast-img { animation: castSip 3s ease-in-out infinite; transform-origin: 50% 30%; }
@keyframes castSip {
  0%, 100% { transform: rotate(0deg) translateY(0); }
  40%      { transform: rotate(1.4deg) translateY(-1%); }
}
/* 点击交互：跳一下 + 挥手 */
.cast.react .cast-flip { animation: castHop .62s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes castHop {
  0%   { transform: translateY(0) scale(1); }
  35%  { transform: translateY(-9%) scale(1.04); }
  60%  { transform: translateY(0) scale(.98); }
  80%  { transform: translateY(-3%) scale(1.01); }
  100% { transform: translateY(0) scale(1); }
}
/* 镜像朝向的人物跳动时保持翻转 */
.cast.face-left.react .cast-flip { animation: castHopFlip .62s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes castHopFlip {
  0%   { transform: scaleX(-1) translateY(0) scale(1); }
  35%  { transform: scaleX(-1) translateY(-9%) scale(1.04); }
  60%  { transform: scaleX(-1) translateY(0) scale(.98); }
  80%  { transform: scaleX(-1) translateY(-3%) scale(1.01); }
  100% { transform: scaleX(-1) translateY(0) scale(1); }
}
.cast.react .cast-img { animation: castWave .3s ease-in-out 2; }
@keyframes castWave {
  0%, 100% { transform: rotate(0deg); }
  50%      { transform: rotate(-5deg); }
}
/* 名牌（悬停显示） */
.cast-tag {
  position: absolute; left: 50%; top: -18px;
  transform: translateX(-50%) translateY(4px);
  padding: 2px 8px; border-radius: 999px;
  font-size: 11px; white-space: nowrap;
  color: #f3ecd8; background: rgba(18, 26, 22, .62);
  border: 1px solid rgba(232, 197, 106, .35);
  opacity: 0; pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
}
.cast:hover .cast-tag { opacity: 1; transform: translateX(-50%) translateY(0); }
.cast:hover .cast-img { filter: saturate(1.08) contrast(1.04) brightness(1.06)
          drop-shadow(0 0 10px rgba(255, 236, 180, .55)); }
/* 对话气泡 */
.cast-bubble {
  position: absolute; left: 50%; bottom: 100%;
  transform: translate(-50%, 6px) scale(.86);
  margin-bottom: 26px;
  max-width: 190px;
  padding: 7px 11px;
  border-radius: 12px;
  font-size: 12.5px; line-height: 1.45; text-align: center;
  color: #22302a;
  background: rgba(255, 252, 244, .96);
  border: 1px solid rgba(210, 186, 140, .7);
  box-shadow: 0 8px 18px rgba(10, 18, 14, .28);
  opacity: 0; pointer-events: none;
  transition: opacity .22s ease, transform .22s cubic-bezier(.3, 1.5, .5, 1);
  white-space: normal;
}
.cast-bubble::after {
  content: ""; position: absolute; left: 50%; top: 100%;
  width: 0; height: 0; transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: rgba(255, 252, 244, .96);
}
.cast-bubble.show { opacity: 1; transform: translate(-50%, 0) scale(1); }
/* 小屏幕上人物缩小一档，避免遮挡入口按钮 */
@media (max-width: 900px) {
  .cast { transform: translate(-50%, -100%) scale(.82) rotateX(3.5deg); }
}
#hub-player {
  color: var(--c-gold); font-size: 13px; letter-spacing: 3px;
  border-left: 3px solid var(--c-gold); padding-left: 10px;
}
/* 入口热点：呼吸闪动的小圆圈（文字标签隐藏，点击后再弹出） */
.hub-ent {
  position: absolute; z-index: 6;
  width: 44px; height: 44px; padding: 0;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  border: 1px solid rgba(53, 224, 207, .60);
  background: radial-gradient(circle, rgba(53, 224, 207, .24) 0%, rgba(53, 224, 207, .08) 58%, rgba(53, 224, 207, 0) 74%);
  cursor: pointer;
  transform: scale(.8);
  transition: border-color .2s ease, box-shadow .2s ease;
  animation: entBreath 2.8s ease-in-out infinite;
}
.hub-ent:hover {
  border-color: var(--c-cyan);
  box-shadow: 0 0 22px rgba(53, 224, 207, .55), 0 0 8px rgba(53, 224, 207, .35) inset;
  animation-play-state: paused;
}
.hub-ent .ent-name, .hub-ent .ent-desc { display: none; }
/* 中心光点 */
.hub-ent::after {
  content: ""; position: absolute; width: 6px; height: 6px; border-radius: 50%;
  background: var(--c-cyan);
  box-shadow: 0 0 10px rgba(53, 224, 207, .95);
  animation: entDot 1.5s ease-in-out infinite;
}
/* 呼吸外环 */
.hub-ent::before {
  content: ""; position: absolute; inset: 4px; border-radius: 50%;
  border: 1px solid rgba(53, 224, 207, .45);
  animation: entPing 2.8s ease-in-out infinite;
}
/* 整体：小幅缩放 + 明暗呼吸 */
@keyframes entBreath {
  0%, 100% { transform: scale(.8);  opacity: .5; }
  50%      { transform: scale(1);   opacity: 1;  }
}
@keyframes entPing {
  0%, 100% { transform: scale(.86); opacity: .15; }
  50%      { transform: scale(1.06); opacity: .7; }
}
@keyframes entDot {
  0%, 100% { opacity: .45; transform: scale(.8); }
  50%      { opacity: 1;   transform: scale(1.05); }
}
/* 位置：左上市街区 / 左下盲盒区 / 右上我的小院 / 右下钓鱼区 */
.ent-story  { left: 8%;   top: 22%; }
.ent-box    { left: 9%;   bottom: 15%; }
.ent-home   { right: 8%;  top: 21%; }
.ent-fish   { right: 9%;  bottom: 15%; }
/* 中央金圈：全量号库（城中心茶楼位置，金色以区别四个青色场景入口） */
.ent-lib {
  left: 55%; top: 23%;
  border-color: rgba(232, 197, 106, .65);
  background: radial-gradient(circle, rgba(232, 197, 106, .26) 0%, rgba(232, 197, 106, .10) 58%, rgba(232, 197, 106, 0) 74%);
}
.ent-lib::after { background: var(--c-gold); box-shadow: 0 0 10px rgba(232, 197, 106, .95); }
.ent-lib::before { border-color: rgba(232, 197, 106, .5); }
.ent-lib:hover {
  border-color: var(--c-gold);
  box-shadow: 0 0 22px rgba(232, 197, 106, .55), 0 0 8px rgba(232, 197, 106, .35) inset;
}

/* 点击圆圈后弹出的标签卡：画面居中 */
#hub-ent-pop {
  position: absolute; z-index: 12;
  left: 50%; top: 50%;
  width: min(320px, 76%);
  padding: 22px 26px 20px;
  text-align: center;
  background: rgba(8, 15, 21, .94);
  border: 1px solid rgba(53, 224, 207, .58);
  box-shadow: 0 0 30px rgba(53, 224, 207, .22), 0 16px 40px rgba(0, 0, 0, .55);
  transform: translate(-50%, -50%);
  transform-origin: 50% 50%;
  animation: entPopIn .18s ease-out;
  backdrop-filter: blur(4px);
}
#hub-ent-pop.hidden { display: none; }
@keyframes entPopIn {
  from { opacity: 0; transform: translate(-50%, -50%) scale(.92); }
  to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}
.ent-pop-name {
  font-size: 16px; letter-spacing: 4px; color: var(--c-cyan);
  margin-bottom: 8px;
}
.ent-pop-desc {
  font-size: 12px; letter-spacing: 1.5px; color: var(--c-dim);
  line-height: 1.7; margin-bottom: 16px;
}
.ent-pop-btns { display: flex; gap: 10px; justify-content: center; }
.ent-pop-btns .menu-btn { flex: 1; padding: 8px 0; font-size: 13px; }

#hub-dialog {
  position: absolute; inset: 0; z-index: 8;
  display: flex; align-items: center; justify-content: center;
  background: rgba(4,8,11,0.6);
}
#hub-dialog.hidden { display: none; }
.hub-dialog-frame { width: min(460px, 90vw); text-align: center; }
#hub-dialog-text { color: var(--c-text); font-size: 15px; line-height: 1.9; margin-bottom: 18px; white-space: pre-wrap; }
.hub-dialog-btns { display: flex; flex-direction: column; gap: 10px; align-items: center; }

/* ============================================================
   缘分盲盒屋
   ============================================================ */
.screen-flex.active { display: flex; align-items: center; justify-content: center; }
/* 盲盒屋/小家 场景背景层 */
#box-bg, #home-bg { position: absolute; inset: 0; overflow: hidden; background: linear-gradient(180deg,#101820,#0a0e13); }
#box-bg img, #home-bg img {
  width: 100%; height: 100%;
  object-fit: cover;
  filter: brightness(0.55) saturate(0.95);
  transform: scale(1.08);
}
.box-frame { width: min(720px, 94vw); max-height: 88vh; overflow-y: auto; }
#box-info { color: var(--c-text); font-size: 13px; letter-spacing: 1px; text-align: center; margin-bottom: 10px; }
#box-info b { color: var(--c-gold); }
#box-rules {
  color: var(--c-dim); font-size: 12px; line-height: 1.8;
  border: 1px dashed var(--c-line);
  padding: 10px 14px; margin-bottom: 16px; text-align: center;
}
.box-btns { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-bottom: 16px; }
.box-open { min-width: 150px; }
#box-result {
  min-height: 30px; text-align: center; margin-bottom: 10px;
  color: var(--c-gold); font-size: 13px; letter-spacing: 2px; line-height: 1.8;
  white-space: pre-wrap;
}
#box-result.jackpot { color: var(--c-cyan); text-shadow: 0 0 16px rgba(53,224,207,0.5); }
#box-tickets {
  /* 列数自适应：宽屏多列、窄屏自动减列，一注一行不换行，行数随注数增加（超高滚动） */
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px;
  max-height: 280px; overflow-y: auto; margin-bottom: 16px;
}
.ticket-cell {
  border: 1px solid var(--c-line);
  background: rgba(53,224,207,0.04);
  color: var(--c-text);
  font-size: 12px; letter-spacing: 1px;
  padding: 7px 6px; text-align: center;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ticket-cell .tk-combo {
  font-size: 12px; letter-spacing: 0.5px;
  color: var(--c-dim);
  font-variant-numeric: tabular-nums;
}
/* 幸运盲盒 · 预览态：单组重选 + 底部确认登记 */
.ticket-cell.reroll {
  display: flex; align-items: center; gap: 8px;
  text-align: left; padding: 6px 10px;
}
.ticket-cell .tk-reroll {
  margin-left: auto; flex: none;
  border: 1px solid var(--c-line); border-radius: 6px;
  background: transparent; color: var(--c-dim);
  font-size: 11px; letter-spacing: 1px; padding: 3px 10px;
  cursor: pointer;
}
.ticket-cell .tk-reroll:hover { color: var(--c-gold); border-color: var(--c-gold); }
.box-frame > .box-confirm-btn { align-self: center; margin-bottom: 4px; }
.box-frame > #btn-box-confirm:not(.hidden) { border-color: var(--c-gold); color: var(--c-gold); }
.box-frame > #btn-box-confirm:not(.hidden):hover { background: rgba(232,197,106,0.12); }

.ticket-cell.hit .tk-combo { color: var(--c-gold); }
.ticket-cell.hit { border-color: var(--c-gold); color: var(--c-gold); box-shadow: 0 0 10px rgba(232,197,106,0.4); }
.box-frame > .menu-btn:last-child { align-self: center; }

/* ============================================================
   溪畔钓台
   ============================================================ */
#screen-fish { z-index: 5; }
#fish-bg { position: absolute; inset: 0; background: linear-gradient(180deg,#0a1420 0%,#0d2233 55%,#0a1a28 100%); }
#fish-bg img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 100%; filter: brightness(0.8); }
#fish-pond {
  position: absolute; inset: 0 0 130px;
  display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 30px;
}
#bobber {
  position: absolute; left: 57%; top: 44%; margin-left: -8px;   /* 人物正前方远处水面，下半截可被人物遮挡 */
  width: 16px; height: 84px;
  background: url("assets/bobber.png?v=2") no-repeat center / contain;
  animation: float 2.4s ease-in-out infinite;
  display: none;
  will-change: transform;
  filter: drop-shadow(0 3px 5px rgba(0,0,0,.35));
}
@keyframes float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
#bobber.visible { display: block; }
#bobber.bite {
  animation: bite .18s linear infinite;
  filter: drop-shadow(0 0 10px rgba(224,90,106,.9));
}
@keyframes bite { 0%,100% { transform: translateY(6px) scale(1); } 50% { transform: translateY(16px) scale(0.92); } }
/* 提竿拉拽：浮漂被拽向钓鱼人方向来回挣扎 */
#bobber.pull {
  animation: pullToward .9s ease-in-out infinite;
  filter: drop-shadow(0 0 9px rgba(224,90,106,.75));
}
@keyframes pullToward {
  0%   { transform: translate(0,0) rotate(0deg); }
  30%  { transform: translate(-48px, 30px) rotate(-20deg); }
  55%  { transform: translate(-12px, 10px) rotate(-5deg); }
  80%  { transform: translate(-44px, 26px) rotate(-16deg); }
  100% { transform: translate(0,0) rotate(0deg); }
}
#fish-status {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%);
  color: var(--c-text); font-size: 14px; letter-spacing: 3px;
  background: rgba(6,10,14,0.6);
  border: 1px solid var(--c-line);
  padding: 10px 26px;
  clip-path: var(--clip-hud);
  white-space: nowrap;
}
#fish-status.excite { color: var(--c-gold); border-color: var(--c-gold); }
#fish-bar {
  position: absolute; left: 0; right: 0; bottom: 0; height: 130px;
  display: flex; align-items: center; justify-content: center; gap: 16px;
  background: linear-gradient(0deg, rgba(6,10,14,0.95), transparent);
  z-index: 7;
}
#fish-log {
  position: absolute; top: 12px; right: 20px;
  width: 240px; max-height: 40vh; overflow-y: auto;
  color: var(--c-dim); font-size: 11px; line-height: 1.9;
  background: rgba(6,10,14,0.6);
  border: 1px solid var(--c-line);
  padding: 10px 14px;
  clip-path: var(--clip-hud);
}
#fish-log .rare { color: var(--c-gold); }
/* 图鉴进度 / 空状态 / 条目可点 */
#fish-log .dex-sum {
  color: var(--c-main); font-size: 11px; letter-spacing: 1px;
  padding-bottom: 6px; margin-bottom: 6px;
  border-bottom: 1px dashed var(--c-line);
}
#fish-log .dex-empty { color: var(--c-dim); opacity: .7; }
#fish-log > div:not(.dex-sum):not(.dex-empty) { cursor: pointer; transition: color .15s; }
#fish-log > div:not(.dex-sum):not(.dex-empty):hover { color: var(--c-main); }

/* ---- 咬钩全屏闪动 ---- */
#screen-fish.flash::after {
  content: ""; position: absolute; inset: 0; z-index: 6; pointer-events: none;
  background: rgba(232,197,106,.16);
  animation: biteFlash .4s linear infinite;
}
@keyframes biteFlash { 0%, 100% { opacity: 0; } 50% { opacity: 1; } }

/* ---- 上鱼过场（单帧 2.5D 悬摆：鱼挂在钓线上轻摆上浮） ---- */
#fish-catch {
  position: absolute; inset: 0 0 130px; z-index: 6;
  display: none; align-items: center; justify-content: center;
  pointer-events: none;
}
#fish-catch.show { display: flex; }
#fish-catch img { display: none; width: 52%; max-width: 420px; height: auto; transform-origin: 50% -55%; }
#fish-catch img.on {
  display: block;
  animation: catchSwing 1.5s cubic-bezier(.4,.1,.3,1) forwards,
             catchGlow 1s ease-in-out .3s infinite alternate;
}
/* 2.5D：钓线悬挂点左右摆动 + 缓缓上提，透视缩放制造纵深 */
@keyframes catchSwing {
  0%   { transform: translateY(46px) scale(.82) rotate(-7deg); opacity: 0; }
  16%  { opacity: 1; }
  38%  { transform: translateY(14px) scale(.9)  rotate(6deg); }
  62%  { transform: translateY(2px)  scale(.96) rotate(-5deg); }
  84%  { transform: translateY(-6px) scale(1)   rotate(4deg); }
  100% { transform: translateY(-12px) scale(1.02) rotate(-2deg); opacity: 1; }
}
@keyframes catchGlow {
  from { filter: drop-shadow(0 8px 18px rgba(0,0,0,.5)) drop-shadow(0 0 6px rgba(232,197,106,.4)); }
  to   { filter: drop-shadow(0 8px 18px rgba(0,0,0,.5)) drop-shadow(0 0 20px rgba(232,197,106,.95)); }
}
#fish-log div { display: flex; align-items: center; gap: 6px; }
#fish-log img { width: 36px; height: 26px; object-fit: contain; flex: none; }

/* ---- 拟真：浮漂涟漪 / 轻点试探 / 蓄力条 / 张力条 ---- */
#bobber::before, #bobber::after {
  content: ""; position: absolute; inset: -6px; border-radius: 50%;
  border: 2px solid rgba(53,224,207,.4); opacity: 0; pointer-events: none;
}
#bobber.visible::before { animation: ripple 2.4s ease-out infinite; }
#bobber.visible::after  { animation: ripple 2.4s ease-out infinite 1.2s; }
@keyframes ripple { 0% { transform: scale(.6); opacity: .55; } 100% { transform: scale(2.8); opacity: 0; } }
#bobber.nibble {
  animation: nibbleDip .55s ease-in-out infinite;
  filter: drop-shadow(0 0 8px rgba(53,224,207,.55));
}
/* 拉鱼时 nibble+pull 同时挂载：拉拽轨迹优先于试探下探（联合选择器提高优先级） */
#bobber.nibble.pull {
  animation: pullToward .9s ease-in-out infinite;
  filter: drop-shadow(0 0 9px rgba(224,90,106,.75));
}
@keyframes nibbleDip { 0%, 100% { transform: translateY(0) scale(1); } 50% { transform: translateY(5px) scale(.94); } }

#cast-power { display: flex; align-items: center; gap: 8px; }
#cast-power.hidden { display: none; }
#cast-power-track {
  width: 130px; height: 10px; border: 1px solid var(--c-line); border-radius: 5px;
  background: rgba(53,224,207,.08); overflow: hidden;
}
#cast-power-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, #7fe8d6, var(--c-gold));
}
#cast-zone { color: var(--c-cyan); font-size: 12px; letter-spacing: 2px; min-width: 40px; }

/* ---- 钓鱼动态视觉 v2（水波 / 鱼影 / 鱼竿鱼线 / 水花 / 鱼跃） ---- */
#fish-waves {
  position: absolute; left: 0; right: 0; bottom: 130px; height: 46%;
  overflow: hidden; pointer-events: none; z-index: 2;
}
#fish-waves .wave {
  position: absolute; left: 0; bottom: 0; width: 200%; height: 55%;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 240 60'%3E%3Cpath d='M0 30 Q30 0 60 30 T120 30 T180 30 T240 30 V60 H0 Z' fill='%2355c8d8' fill-opacity='0.10'/%3E%3C/svg%3E") repeat-x;
  background-size: 240px 100%;
  animation: waveMove 9s linear infinite;
}
#fish-waves .w2 {
  bottom: 16%; opacity: .6;
  animation-duration: 15s; animation-direction: reverse;
}
@keyframes waveMove { from { transform: translateX(0); } to { transform: translateX(-240px); } }

/* 水下鱼影游动（仅水面以下 · 时隐时现） */
#fish-shadows {
  position: absolute; left: 0; right: 0; top: 42%; bottom: 130px; overflow: hidden;
  pointer-events: none; z-index: 3;
}
.fish-shadow {
  position: absolute; left: -150px; width: 56px; height: 12px;
  background: radial-gradient(ellipse at 55% 50%, rgba(3,10,16,.6), rgba(3,10,16,.2) 68%, transparent 78%);
  border-radius: 50%;
  animation: fishSwim linear infinite;
  opacity: 0;
}
.fish-shadow::after {
  content: ""; position: absolute; right: -9px; top: 2px;
  border: 4px solid transparent; border-right-color: rgba(3,10,16,.5);
}
@keyframes fishSwim {
  0%   { transform: translateX(0); opacity: 0; }
  10%  { opacity: var(--o, .4); }
  38%  { opacity: var(--o, .4); }
  46%  { opacity: 0; }                            /* 潜入深水 */
  58%  { opacity: 0; }
  66%  { opacity: var(--o, .4); }                 /* 再浮起 */
  92%  { opacity: var(--o, .4); }
  100% { transform: translateX(calc(100vw + 220px)); opacity: 0; }
}

/* 随机鱼跃出水（剪影弧线） */
.amb-fish {
  position: absolute; width: 56px; height: 14px; opacity: 0;
  background: radial-gradient(ellipse at 55% 50%, rgba(6,16,24,.85), rgba(6,16,24,.35) 68%, transparent 78%);
  border-radius: 50%;
  pointer-events: none;
  animation: ambLeap 1.5s cubic-bezier(.3,.6,.6,1) forwards;
}
.amb-fish::after {
  content: ""; position: absolute; right: -9px; top: 3px;
  border: 4px solid transparent; border-right-color: rgba(6,16,24,.6);
}
@keyframes ambLeap {
  0%   { transform: translate(0, 26px) rotate(35deg); opacity: 0; }
  14%  { opacity: .85; }
  46%  { transform: translate(26px, -58px) rotate(-18deg); opacity: .9; }
  62%  { transform: translate(40px, -66px) rotate(-30deg); }
  100% { transform: translate(64px, 30px) rotate(58deg); opacity: 0; }
}

/* AI 钓鱼人立绘（三姿态切换） */
/* 鱼线：竿梢（随姿态锚点）→ 浮漂 的连线 */
#fish-line {
  position: absolute; z-index: 4; height: 1px; display: none;
  background: linear-gradient(90deg, rgba(255,255,255,.08), rgba(255,255,255,.55));
  transform-origin: 0 0; pointer-events: none;
}
#fish-line.on { display: block; }

/* 背面视角：人物坐于钓台木栈道（画面中偏右 47%~78% 区域），面向水面 */
#fish-fisher {
  position: absolute; left: 46%; bottom: 58px; height: 54%;
  z-index: 4; pointer-events: none;
  display: flex; align-items: flex-end;
}
#fisher-img {
  height: 100%; width: auto; object-fit: contain;
  filter: drop-shadow(0 6px 14px rgba(0,0,0,.55));
  animation: fisherBreath 3.2s ease-in-out infinite;
  transition: opacity .12s ease;
}
#fisher-img.pop { animation: fisherPop .3s ease, fisherBreath 3.2s ease-in-out infinite .3s; }
@keyframes fisherBreath { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
@keyframes fisherPop { 0% { opacity: .2; } 100% { opacity: 1; } }

#fish-fx {
  position: absolute; inset: 0 0 130px; overflow: hidden;
  pointer-events: none; z-index: 6;
}
.splash-p {
  position: absolute; width: 6px; height: 6px; border-radius: 50%;
  background: rgba(170,230,240,.85); box-shadow: 0 0 6px rgba(170,230,240,.6);
  animation: splashFly .6s ease-out forwards;
}
@keyframes splashFly {
  0%   { transform: translate(0, 0) scale(1); opacity: .9; }
  100% { transform: translate(var(--dx), var(--dy)) scale(.3); opacity: 0; }
}
.fish-leap {
  position: absolute; left: 72%; bottom: 32%;
  width: 120px; height: auto; transform: translateX(-50%);
  animation: leapArc .95s cubic-bezier(.25,.8,.35,1) forwards;
}
.fish-leap.glow { filter: drop-shadow(0 0 12px rgba(232,197,106,.95)); }
@keyframes leapArc {
  0%   { transform: translateX(-50%) translateY(24px) rotate(-8deg); opacity: 0; }
  22%  { opacity: 1; }
  100% { transform: translateX(-50%) translateY(-160px) rotate(14deg); opacity: 0; }
}

/* ============================================================
   我的小家
   ============================================================ */
.home-frame { width: min(640px, 94vw); max-height: 88vh; overflow-y: auto; }
.home-row {
  display: flex; align-items: center; gap: 12px; margin-bottom: 18px;
}
.home-row label { color: var(--c-cyan); letter-spacing: 3px; font-size: 14px; }
#home-name {
  flex: 1;
  background: rgba(53,224,207,0.04);
  border: 1px solid var(--c-line);
  color: var(--c-text);
  padding: 8px 14px; font-size: 15px; letter-spacing: 2px;
  outline: none;
}
#home-name:focus { border-color: var(--c-cyan); }
#home-stats { margin-bottom: 18px; }
.stat-group {
  border: 1px solid var(--c-line);
  border-left: 3px solid var(--c-cyan-dim);
  padding: 12px 16px; margin-bottom: 12px;
}
.stat-group h3 {
  color: var(--c-cyan); font-size: 13px; letter-spacing: 3px; margin-bottom: 8px; font-weight: normal;
}
.stat-group p { color: var(--c-dim); font-size: 12px; line-height: 2; }
.stat-group p b { color: var(--c-gold); }
/* 小家 · 幸运盲盒存注的详细号码组合（与盲盒屋同款：一注一行，列数自适应） */
.home-tickets {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px; margin-top: 10px;
}
.home-tickets .ticket-cell { text-align: center; }
.home-tickets-empty { color: var(--c-dim); font-size: 12px; letter-spacing: 1px; margin-top: 8px; }
.home-btns { display: flex; flex-direction: column; gap: 10px; align-items: center; }
.danger-btn { border-color: rgba(224,90,106,0.5); color: var(--c-danger); }
.danger-btn:hover { border-color: var(--c-danger); color: var(--c-danger); background: rgba(224,90,106,0.08); box-shadow: 0 0 12px rgba(224,90,106,0.25); }

/* ============================================================
   小屏适配：弹窗面板 & 按钮（≤720px）
   ============================================================ */
@media (max-width: 720px) {
  /* ---- 通用按钮：收窄留白、去掉固定最小宽、保证点击面积 ---- */
  .btn { padding: 9px 14px; font-size: 12px; letter-spacing: 1px; }
  .menu-btn { min-width: 0; }
  .menu-btn, .choice-btn, .topic-btn, .slot-btn { box-sizing: border-box; }

  /* ---- 弹窗面板：内边距收紧、宽度占满、高度放宽 ---- */
  .panel-frame {
    width: min(860px, 96vw);
    max-height: 92vh;
    padding: 16px 14px;
  }
  .panel-title, #panel-title {
    font-size: 13px; letter-spacing: 2px;
    padding-bottom: 8px; margin-bottom: 10px;
  }
  /* 面板里的按钮行：自动换行、均分宽度，不再被 min-width 撑破 */
  .hub-dialog-btns, .ent-pop-btns, .note-tabs, .home-btns { flex-wrap: wrap; }
  .hub-dialog-btns .menu-btn,
  .panel-frame > .menu-btn,
  .home-btns .menu-btn { width: 100%; }
  .ent-pop-btns .menu-btn { flex: 1 1 40%; }
  .note-tabs .btn { flex: 1 1 auto; }
  .note-tabs { gap: 8px; }

  /* ---- 主城对话框 & 入口弹卡 ---- */
  .hub-dialog-frame { width: min(460px, 94vw); }
  #hub-dialog-text { font-size: 14px; margin-bottom: 14px; }
  #hub-ent-pop { width: min(320px, 90vw); padding: 16px 14px; }
  .ent-pop-name { font-size: 14px; letter-spacing: 2px; }
  .ent-pop-btns .menu-btn { padding: 9px 0; }

  /* ---- 选择支 ---- */
  #choice-box { width: min(560px, 94vw); }
  #choice-prompt { font-size: 13px; letter-spacing: 2px; margin-bottom: 16px; }
  #choice-options { gap: 10px; width: 100%; }
  .choice-btn { min-width: 0; width: 100%; }

  /* ---- 结局 ---- */
  .ending-box { max-width: 92vw; padding: 14px; }
  #ending-title { font-size: 22px; letter-spacing: 6px; margin-bottom: 14px; }
  #ending-text { font-size: 13px; margin-bottom: 22px; }
  #screen-ending .menu-btn { width: 100%; }

  /* ---- 回想 / 手帐 / 存档 ---- */
  #log-list, #note-body { max-height: 58vh; }
  .log-item { margin-bottom: 12px; }
  .note-card { padding: 10px 12px; }
  .slot-btn { padding: 11px 12px; font-size: 13px; }
  .slot-btn .slot-info { font-size: 11px; }
  .topic-btn { padding: 10px 12px; font-size: 12px; }
  .topic-answer { padding: 10px 12px; font-size: 12px; }

  /* ---- 调查弹层 ---- */
  #invest-scene { inset: 54px 12px 70px; }
  #invest-scene .scene-label { font-size: 18px; letter-spacing: 6px; }
  #invest-hud { height: 58px; padding: 0 14px; gap: 12px; }
  #invest-name { font-size: 12px; }
  #invest-result { width: min(640px, 94vw); }
  #invest-result-title { font-size: 15px; letter-spacing: 2px; }

  /* ---- 证据格 4 列 → 2 列 ---- */
  .evi-grid { grid-template-columns: repeat(2, 1fr); }

  /* ---- 全量号库页 ---- */
  .lib-frame { width: min(720px, 96vw); max-height: 92vh; }
  .lib-stat b { font-size: 13px; }

  /* ---- HUD 进度条收窄，按钮变小 ---- */
  #hud { padding: 10px 12px; }
  #hud-progress { max-width: 150px; }
  .hud-btn { padding: 5px 8px; font-size: 11px; letter-spacing: 1px; }
  #hub-top { padding: 10px 12px; }
  #hub-player { font-size: 11px; letter-spacing: 2px; }

  /* ---- 入口圆圈略微缩小 ---- */
  .hub-ent { width: 38px; height: 38px; }
  .hub-ent::after { width: 5px; height: 5px; }

  /* ---- toast ---- */
  #toast { top: 56px; max-width: 90vw; padding: 8px 16px; font-size: 12px; letter-spacing: 1px; }

  /* ---- 钓鱼动态层 ---- */
  #fish-pond { touch-action: none; user-select: none; -webkit-user-select: none; }
  #fish-status { max-width: 92vw; white-space: normal; text-align: center; font-size: 12px; padding: 8px 14px; }
  #fish-bar { height: 100px; gap: 10px; }
  #fish-fisher { height: 46%; bottom: 50px; left: 7%; }
  #fish-shadows { top: 40%; }
  #bobber { top: 60%; left: 50%; width: 12px; height: 58px; margin-left: -6px; }
  .fish-leap { left: 50%; }
  .fish-leap { width: 90px; }
  .amb-fish { width: 44px; height: 11px; }
  #btn-fish-cast, #btn-fish-pull { padding: 9px 12px; }
}

/* ---- 更窄屏（≤420px）：进一步收紧 ---- */
@media (max-width: 420px) {
  .btn { padding: 8px 10px; font-size: 11px; letter-spacing: 1px; }
  .panel-frame { padding: 12px 10px; }
  #ending-title { font-size: 18px; letter-spacing: 4px; }
  #ending-text { font-size: 12px; line-height: 1.8; }
  .choice-btn { font-size: 12px; }
  .ent-pop-btns { flex-direction: column; }
  .ent-pop-btns .menu-btn { flex: none; width: 100%; }
  .note-tabs .btn { padding: 7px 6px; font-size: 10px; }
  .hub-ent { width: 34px; height: 34px; }
}

/* ---- 横屏矮窗（手机横握）：面板压扁、滚动区缩短 ---- */
@media (max-height: 480px) and (orientation: landscape) {
  .panel-frame { max-height: 94vh; padding: 10px 16px; }
  .panel-title, #panel-title { margin-bottom: 6px; padding-bottom: 5px; }
  #log-list, #note-body { max-height: 46vh; }
  #note-body { min-height: 80px; }
  .title-menu { gap: 8px; }
  .title-foot { margin-top: 18px; }
  /* ---- 钓台横屏矮窗适配 ---- */
  #fish-fx { inset: 0 0 100px; }
  #fish-fisher { height: 52%; bottom: 44px; }
  #bobber { top: 64%; }
}
