/* ==========================================================
   财富的深渊 — 全局样式(暗色调悬疑风格)
   ========================================================== */

:root {
  --bg-deep: #0a0e14;
  --bg: #10161f;
  --surface: #161d29;
  --surface-2: #1c2534;
  --border: #263244;
  --border-soft: #1d2736;
  --text: #e6edf3;
  --text-dim: #8b98a9;
  --text-faint: #5a6a7d;
  --accent: #4dd0e1;
  --accent-dim: #2a7f8c;
  --amber: #f0b429;
  --amber-dim: #8a6a1f;
  --danger: #d64545;
  --success: #3ecf8e;
  --font-serif: "Noto Serif SC", "Songti SC", "SimSun", serif;
  --font-sans: "Noto Sans SC", "Microsoft YaHei", "PingFang SC", sans-serif;
  --font-mono: "JetBrains Mono", Consolas, "Courier New", monospace;
  --radius: 10px;
  --shadow: 0 4px 24px rgba(0, 0, 0, .55);
  --shadow-lg: 0 12px 48px rgba(0, 0, 0, .75);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: var(--bg-deep);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}
input { font-family: inherit; }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #34435c; }

.screen { position: fixed; inset: 0; }
.hidden { display: none !important; }

/* ============ 通用按钮 ============ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: 8px;
  font-size: 14px;
  letter-spacing: 1px;
  transition: all .18s ease;
  user-select: none;
}
.btn:focus-visible, .icon-btn:focus-visible, .clue-tab:focus-visible, .help-tab:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.btn-primary {
  background: linear-gradient(135deg, #16a3b8, #0e7a8c);
  color: #04161b;
  font-weight: 700;
  box-shadow: 0 0 0 1px rgba(77, 208, 225, .35), 0 6px 20px rgba(14, 122, 140, .35);
}
.btn-primary:hover { filter: brightness(1.15); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }
.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-danger { background: rgba(214, 69, 69, .15); color: #ff8a8a; border: 1px solid rgba(214, 69, 69, .4); }
.btn-danger:hover { background: rgba(214, 69, 69, .3); }
.btn-lg { padding: 13px 34px; font-size: 16px; border-radius: 10px; }
.btn-sm { padding: 5px 12px; font-size: 12.5px; border-radius: 6px; }
.btn-bar {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  color: var(--text-dim);
  font-size: 13.5px;
  padding: 7px 14px;
}
.btn-bar:hover { color: var(--accent); border-color: var(--accent-dim); }

.icon-btn {
  width: 34px; height: 34px;
  border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 15px;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  transition: all .18s ease;
}
.icon-btn:hover { border-color: var(--accent); box-shadow: 0 0 10px rgba(77, 208, 225, .25); }

/* ============ 标题画面 ============ */
#title-screen { z-index: 200; }
.title-bg {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, #0b0f17 0%, #10182a 55%, #0a0e14 100%);
  background-size: cover; background-position: center;
}
.title-vignette {
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at center, transparent 35%, rgba(0, 0, 0, .82) 100%);
}
.title-scanline {
  position: absolute; inset: 0;
  background: repeating-linear-gradient(0deg, rgba(255, 255, 255, .015) 0 1px, transparent 1px 4px);
  animation: scanmove 9s linear infinite;
  pointer-events: none;
}
@keyframes scanmove { from { background-position-y: 0; } to { background-position-y: 400px; } }

.title-content {
  position: relative; z-index: 2;
  height: 100%;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center;
  padding: 0 24px;
}
.title-kicker {
  font-size: 13px; letter-spacing: 8px;
  color: var(--amber);
  font-family: var(--font-mono);
  margin-bottom: 18px;
  opacity: .9;
}
.title-main {
  font-family: var(--font-serif);
  font-size: clamp(44px, 8vw, 84px);
  font-weight: 900;
  letter-spacing: 16px;
  text-indent: 16px;
  color: #eef4f8;
  text-shadow: 0 0 40px rgba(77, 208, 225, .35), 0 4px 12px rgba(0, 0, 0, .8);
  animation: titleIn 1.4s ease both;
}
@keyframes titleIn {
  from { opacity: 0; transform: translateY(24px); letter-spacing: 30px; }
  to { opacity: 1; transform: none; }
}
.title-sub {
  margin-top: 8px;
  font-family: var(--font-mono);
  font-size: 14px;
  letter-spacing: 10px;
  color: var(--text-faint);
  text-indent: 10px;
}
.title-divider {
  display: flex; align-items: center; gap: 10px;
  margin: 26px 0 22px;
  width: min(420px, 70vw);
}
.title-divider span { flex: 1; height: 1px; background: linear-gradient(90deg, transparent, var(--border)); }
.title-divider span:last-child { background: linear-gradient(90deg, var(--border), transparent); }
.title-divider i { width: 6px; height: 6px; background: var(--amber); transform: rotate(45deg); box-shadow: 0 0 12px var(--amber); }
.title-desc {
  font-size: 14.5px; line-height: 2;
  color: var(--text-dim);
  max-width: 560px;
  margin-bottom: 34px;
}
.title-actions { display: flex; gap: 16px; flex-wrap: wrap; justify-content: center; }
.title-tip {
  margin-top: 28px;
  font-size: 12px; color: var(--text-faint);
  animation: tipPulse 2.4s ease-in-out infinite;
}
@keyframes tipPulse { 0%, 100% { opacity: .5; } 50% { opacity: 1; } }
.title-copyright {
  position: absolute; bottom: 18px; width: 100%;
  text-align: center; font-size: 11.5px;
  color: var(--text-faint); z-index: 2;
  letter-spacing: 2px;
}

/* ============ 音频激活层 ============ */
.audio-activate {
  position: fixed; inset: 0; z-index: 300;
  display: flex; align-items: center; justify-content: center;
  background: rgba(4, 6, 10, .92);
  backdrop-filter: blur(6px);
}
.aa-box {
  text-align: center;
  padding: 44px 52px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  animation: titleIn .5s ease both;
}
.aa-title { font-family: var(--font-serif); font-size: 22px; letter-spacing: 4px; margin-bottom: 10px; }
.aa-sub { color: var(--text-dim); font-size: 13.5px; margin-bottom: 26px; }

/* ============ 游戏主界面 ============ */
#game-screen { z-index: 10; display: none; }
#game-screen.active { display: block; }

#topbar {
  position: absolute; top: 0; left: 0; right: 0; z-index: 30;
  height: 54px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px;
  background: linear-gradient(180deg, rgba(8, 11, 17, .92), rgba(8, 11, 17, .6) 70%, transparent);
  backdrop-filter: blur(4px);
}
.topbar-left { display: flex; align-items: center; gap: 12px; }
.chapter-badge {
  font-family: var(--font-serif);
  font-size: 13px; letter-spacing: 2px;
  padding: 5px 12px;
  background: rgba(240, 180, 41, .12);
  border: 1px solid rgba(240, 180, 41, .4);
  color: var(--amber);
  border-radius: 6px;
  white-space: nowrap;
}
.scene-name { font-size: 14px; font-weight: 600; letter-spacing: 1px; }
.scene-time { font-size: 11.5px; color: var(--text-faint); font-family: var(--font-mono); margin-top: 1px; }
.topbar-right { display: flex; align-items: center; gap: 8px; }

.truth-meter {
  display: flex; align-items: center; gap: 5px;
  margin-right: 8px;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  padding: 5px 10px;
}
.tm-label { font-size: 11px; color: var(--text-faint); margin-right: 2px; }
.tm-bar {
  width: 26px; height: 5px; border-radius: 3px;
  background: #0d1420;
  overflow: hidden;
}
.tm-bar i { display: block; height: 100%; width: 0%; transition: width .6s ease; }
.tm-suicide i { background: #7d8ca3; }
.tm-accident i { background: var(--amber); }
.tm-murder i { background: var(--danger); }

/* ============ 底部栏 ============ */
#bottombar {
  position: absolute; bottom: 0; left: 0; right: 0; z-index: 30;
  height: 56px;
  display: flex; align-items: center; gap: 8px;
  padding: 0 16px;
  background: linear-gradient(0deg, rgba(8, 11, 17, .95), rgba(8, 11, 17, .7) 70%, transparent);
  backdrop-filter: blur(4px);
}
.bar-spacer { flex: 1; }
.coin-count {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--amber);
  background: rgba(240, 180, 41, .1);
  border: 1px solid rgba(240, 180, 41, .3);
  padding: 5px 12px;
  border-radius: 6px;
  letter-spacing: 1px;
}

/* ============ 通用面板 ============ */
.panel { position: fixed; z-index: 100; }
.side-panel {
  top: 0; right: 0; bottom: 0;
  width: min(420px, 92vw);
  background: rgba(14, 19, 29, .97);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column;
  animation: slideIn .28s ease;
}
@keyframes slideIn { from { transform: translateX(100%); } to { transform: none; } }
.side-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border-soft);
  font-family: var(--font-serif);
  font-size: 16px; letter-spacing: 2px;
  font-weight: 700;
}

/* ============ 背包 ============ */
.inventory-grid {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 10px; padding: 16px 18px;
}
.inv-item {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  padding: 12px 8px;
  text-align: center;
  cursor: pointer;
  transition: all .18s ease;
}
.inv-item:hover { border-color: var(--accent-dim); transform: translateY(-2px); }
.inv-item .inv-icon { font-size: 26px; display: block; margin-bottom: 6px; }
.inv-item .inv-name { font-size: 12px; color: var(--text-dim); }
.inv-item.selected { border-color: var(--amber); box-shadow: 0 0 12px rgba(240, 180, 41, .2); }
.inventory-detail {
  flex: 1; overflow-y: auto;
  padding: 14px 18px;
  border-top: 1px solid var(--border-soft);
  font-size: 13.5px; line-height: 1.9;
  color: var(--text-dim);
}
.inventory-empty { color: var(--text-faint); text-align: center; padding: 30px 0; font-size: 13px; }

/* ============ 线索板 ============ */
.clue-search { padding: 12px 18px 6px; }
.clue-search input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 9px 14px;
  font-size: 13.5px;
  outline: none;
  transition: border-color .2s;
}
.clue-search input:focus { border-color: var(--accent); }
.clue-tabs { display: flex; gap: 4px; padding: 10px 18px; flex-wrap: wrap; }
.clue-tab {
  font-size: 12px; padding: 5px 11px;
  border-radius: 20px;
  color: var(--text-dim);
  background: var(--surface);
  border: 1px solid var(--border-soft);
  transition: all .18s;
}
.clue-tab:hover { color: var(--text); }
.clue-tab.active { background: rgba(77, 208, 225, .15); color: var(--accent); border-color: var(--accent-dim); }
.clue-list { flex: 1; overflow-y: auto; padding: 4px 18px 20px; }
.clue-card {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-left: 3px solid var(--accent-dim);
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 8px;
  animation: clueIn .35s ease;
}
@keyframes clueIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; } }
.clue-card .clue-title { font-size: 13.5px; font-weight: 700; display: flex; justify-content: space-between; gap: 8px; }
.clue-card .clue-tag { font-size: 10.5px; padding: 2px 7px; border-radius: 10px; background: rgba(77, 208, 225, .12); color: var(--accent); white-space: nowrap; }
.clue-card .clue-desc { font-size: 12.5px; color: var(--text-dim); line-height: 1.7; margin-top: 6px; }
.clue-card .clue-links { font-size: 11.5px; color: var(--amber); margin-top: 6px; line-height: 1.6; }
.clue-card.key { border-left-color: var(--amber); background: linear-gradient(135deg, rgba(240, 180, 41, .07), var(--surface) 60%); }
.clue-card.key .clue-title { color: var(--amber); }
.clue-empty { color: var(--text-faint); text-align: center; padding: 40px 0; font-size: 13px; }

/* ============ 物品/文件阅读 ============ */
#doc-panel, #task-panel { inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(4, 6, 10, .78); backdrop-filter: blur(4px); }
.doc-window, .task-window {
  width: min(560px, 92vw);
  max-height: 82vh;
  background: #151c28;
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column;
  overflow: hidden;
  animation: zoomIn .3s ease;
}
@keyframes zoomIn { from { opacity: 0; transform: scale(.94); } to { opacity: 1; } }
.doc-header, .task-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 15px 20px;
  border-bottom: 1px solid var(--border-soft);
  font-family: var(--font-serif); font-weight: 700; letter-spacing: 2px;
}
.doc-body { padding: 20px 24px; overflow-y: auto; line-height: 2; font-size: 14px; color: var(--text-dim); }
.doc-body .doc-paper {
  background: #e8e2d0;
  color: #2a2418;
  border-radius: 4px;
  padding: 26px 28px;
  font-family: var(--font-serif);
  box-shadow: inset 0 0 30px rgba(120, 100, 60, .25);
  position: relative;
}
.doc-body .doc-paper::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 4px;
  background: linear-gradient(90deg, #c9b890, #e8e2d0 30%, #e8e2d0 70%, #c9b890);
}
.doc-body .doc-hand { font-size: 17px; line-height: 2.1; color: #1c1710; letter-spacing: 1px; }
.doc-body .doc-mono { font-family: var(--font-mono); font-size: 13px; color: var(--accent); background: rgba(77, 208, 225, .06); border: 1px dashed var(--accent-dim); padding: 10px 14px; border-radius: 8px; line-height: 1.8; margin: 10px 0; }
.doc-body h4 { color: var(--text); margin: 14px 0 6px; font-size: 14px; letter-spacing: 1px; }
.doc-body .doc-stamp { display: inline-block; border: 2px solid var(--danger); color: var(--danger); padding: 2px 10px; font-size: 11px; letter-spacing: 3px; border-radius: 4px; transform: rotate(-6deg); opacity: .8; margin: 8px 0; }
.doc-body .doc-photo {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  margin: 12px 0;
}
.doc-body .doc-photo img { width: 100%; display: block; opacity: .85; }

/* ============ 任务弹窗 ============ */
.task-content { padding: 18px 24px; line-height: 1.9; font-size: 14px; color: var(--text); }
.task-content .task-meta { color: var(--text-faint); font-size: 12px; margin-bottom: 10px; font-family: var(--font-mono); }
.task-hints { padding: 0 24px 20px; }
.task-hint-item {
  display: flex; gap: 10px; align-items: flex-start;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 8px;
  font-size: 13px; color: var(--text-dim);
  line-height: 1.7;
}
.task-hint-item .hint-level { font-size: 11px; padding: 2px 8px; border-radius: 10px; white-space: nowrap; flex-shrink: 0; margin-top: 2px; }
.hint-level.lv1 { background: rgba(139, 152, 169, .15); color: var(--text-dim); }
.hint-level.lv2 { background: rgba(240, 180, 41, .12); color: var(--amber); }
.hint-level.lv3 { background: rgba(77, 208, 225, .12); color: var(--accent); }

/* ============ 通用 Toast ============ */
.toast {
  position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%);
  z-index: 500;
  background: rgba(22, 29, 41, .96);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  padding: 11px 22px;
  border-radius: 8px;
  font-size: 13.5px;
  box-shadow: var(--shadow-lg);
  animation: toastIn .3s ease;
  max-width: 80vw;
}
.toast.amber { border-left-color: var(--amber); }
.toast.danger { border-left-color: var(--danger); }
.toast.success { border-left-color: var(--success); }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 14px); } to { opacity: 1; } }

.hint-toast {
  position: fixed; bottom: 90px; right: 20px;
  z-index: 480;
  background: rgba(20, 26, 38, .97);
  border: 1px solid var(--accent-dim);
  color: var(--text);
  padding: 12px 18px;
  border-radius: 10px;
  font-size: 13px;
  max-width: 300px;
  line-height: 1.7;
  box-shadow: var(--shadow-lg);
  animation: toastIn .3s ease;
}
.hint-toast .ht-title { color: var(--accent); font-size: 12px; letter-spacing: 2px; margin-bottom: 4px; }

.affection-float {
  position: fixed; top: 90px; left: 50%; transform: translateX(-50%);
  z-index: 480;
  font-size: 13px;
  color: var(--amber);
  background: rgba(240, 180, 41, .1);
  border: 1px solid rgba(240, 180, 41, .35);
  padding: 6px 16px;
  border-radius: 20px;
  animation: floatUp 1.6s ease both;
  pointer-events: none;
}
@keyframes floatUp {
  0% { opacity: 0; transform: translate(-50%, 10px); }
  20% { opacity: 1; }
  80% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -26px); }
}

.fade-mask {
  position: fixed; inset: 0; z-index: 400;
  background: #05070b;
  opacity: 0;
  pointer-events: none;
  transition: opacity .8s ease;
}
.fade-mask.show { opacity: 1; pointer-events: auto; }

/* ============ 结局面板 ============ */
#ending-panel { z-index: 220; }
.ending-bg { position: absolute; inset: 0; background-size: cover; background-position: center; }
.ending-vignette { position: absolute; inset: 0; background: radial-gradient(ellipse at center, transparent 30%, rgba(0, 0, 0, .88) 100%); }
.ending-content {
  position: relative; z-index: 2;
  height: 100%;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center;
  padding: 0 40px;
  max-width: 760px;
  margin: 0 auto;
}
.ending-type { font-family: var(--font-mono); color: var(--amber); letter-spacing: 8px; font-size: 13px; margin-bottom: 14px; }
.ending-title {
  font-family: var(--font-serif);
  font-size: clamp(30px, 5vw, 48px);
  letter-spacing: 10px;
  text-indent: 10px;
  margin-bottom: 22px;
  text-shadow: 0 0 30px rgba(240, 180, 41, .3);
}
.ending-text {
  font-size: 14.5px; line-height: 2.1;
  color: var(--text-dim);
  max-height: 40vh; overflow-y: auto;
  margin-bottom: 22px;
}
.ending-stats {
  display: flex; gap: 18px; flex-wrap: wrap; justify-content: center;
  margin-bottom: 26px;
}
.ending-stat {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  padding: 8px 18px;
  border-radius: 8px;
  font-size: 12.5px;
  color: var(--text-dim);
}
.ending-stat b { color: var(--amber); font-family: var(--font-mono); margin-left: 4px; }

/* 响应式 */
@media (max-width: 720px) {
  .truth-meter { display: none; }
  .scene-name { font-size: 12.5px; }
  .btn-bar { font-size: 12px; padding: 6px 10px; }
  .coin-count { font-size: 11px; padding: 4px 8px; }
  .ending-content { padding: 0 20px; }
}
