/* ============ 丢失的光明（3D 版）· 全局样式 ============ */

:root {
  --ember: #ff9d45;
  --ember-glow: rgba(255, 157, 69, 0.55);
  --ink: #e8ddcc;
  --ink-dim: #9d8f7a;
  --panel: rgba(20, 14, 11, 0.92);
  --line: rgba(232, 221, 204, 0.14);
  font-size: 16px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; overflow: hidden; background: #0b0807; }

body {
  font-family: "Noto Serif SC", "Source Han Serif SC", "SimSun", Georgia, serif;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

#app { position: relative; height: 100%; overflow: hidden; }

#canvas-host { position: absolute; inset: 0; }
#canvas-host canvas { display: block; }

/* ---------- 风格化光标 ---------- */
/* 余烬菱心 */
body.cursor-play,
body.cursor-play #canvas-host canvas {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Cpath d='M16 2 L20 14 L30 16 L20 18 L16 30 L12 18 L2 16 L12 14 Z' fill='%23ff9d45' fill-opacity='.9'/%3E%3Ccircle cx='16' cy='16' r='2.2' fill='%23ffe0b0'/%3E%3C/svg%3E") 16 16, crosshair;
}
body.cursor-look,
body.cursor-look #canvas-host canvas {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Ccircle cx='16' cy='16' r='10' fill='none' stroke='%23ff9d45' stroke-opacity='.55' stroke-width='1.2'/%3E%3Ccircle cx='16' cy='16' r='2' fill='%23ff9d45'/%3E%3C/svg%3E") 16 16, move;
}
body.cursor-ui,
body.cursor-ui button,
body.cursor-ui .choice-btn,
body.cursor-ui input {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='28' viewBox='0 0 28 28'%3E%3Cpath d='M4 2 L4 22 L10 16 L14 24 L17 23 L13 15 L22 15 Z' fill='%23e8ddcc' stroke='%23ff9d45' stroke-width='1'/%3E%3C/svg%3E") 4 2, pointer;
}
body.cursor-locked,
body.cursor-locked #canvas-host canvas {
  cursor: none !important;
}

#look-reticle {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 28px;
  height: 28px;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 18;
  opacity: 0;
  transition: opacity 0.25s ease;
}
#look-reticle.show { opacity: 0.9; }
#look-reticle i {
  position: absolute;
  background: var(--ember);
  box-shadow: 0 0 6px var(--ember-glow);
}
#look-reticle i:nth-child(1) { left: 12px; top: 0; width: 2px; height: 7px; }
#look-reticle i:nth-child(2) { left: 12px; bottom: 0; width: 2px; height: 7px; }
#look-reticle i:nth-child(3) { top: 12px; left: 0; width: 7px; height: 2px; }
#look-reticle i:nth-child(4) { top: 12px; right: 0; width: 7px; height: 2px; }
#look-reticle b {
  position: absolute;
  left: 50%; top: 50%;
  width: 3px; height: 3px;
  margin: -1.5px 0 0 -1.5px;
  border-radius: 50%;
  background: #ffe0b0;
  box-shadow: 0 0 8px var(--ember-glow);
}

#cursor-unlock {
  position: absolute;
  right: 1.4rem;
  bottom: 1.4rem;
  z-index: 50;
  display: none;
  font-family: inherit;
  letter-spacing: 0.28em;
  font-size: 0.78rem;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid rgba(255, 157, 69, 0.45);
  padding: 0.55rem 1rem;
  cursor: pointer;
  pointer-events: auto;
  box-shadow: 0 0 20px rgba(255, 120, 40, 0.15);
}
#cursor-unlock.show { display: block; }
#cursor-unlock:hover { border-color: var(--ember); color: var(--ember); }

#cursor-lock-hint {
  position: absolute;
  left: 50%;
  bottom: 12%;
  transform: translateX(-50%);
  z-index: 19;
  pointer-events: none;
  opacity: 0;
  color: var(--ink-dim);
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  text-shadow: 0 0 10px #000;
  transition: opacity 0.3s ease;
  white-space: nowrap;
}
#cursor-lock-hint.show { opacity: 0.85; }

/* ---------- 覆盖层（标题 / 叙事 / 结局） ---------- */
.overlay {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 1.6rem;
  z-index: 30;
  opacity: 0;
  transition: opacity 1s ease;
  background: rgba(8, 5, 4, 0.72);
  backdrop-filter: blur(2px);
}
.overlay.active { display: flex; }
.overlay.visible { opacity: 1; }

/* ---------- 标题屏：中心火焰，点击烧开 ---------- */
#screen-title {
  gap: 0;
  justify-content: center;
  background: transparent;
  overflow: hidden;
}
#screen-title .boot-veil {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(48% 42% at 50% 50%, rgba(48, 22, 10, 0.22), rgba(8, 5, 4, 0.58) 58%, rgba(4, 2, 2, 0.9) 100%);
  pointer-events: none;
  transition: opacity 0.85s ease, background 0.85s ease;
}
.boot-stage {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}
.boot-ash {
  position: absolute;
  inset: -10%;
  opacity: 0;
  background-image:
    radial-gradient(1px 1px at 12% 28%, rgba(232, 221, 204, 0.35), transparent),
    radial-gradient(1px 1px at 38% 62%, rgba(255, 157, 69, 0.28), transparent),
    radial-gradient(1.2px 1.2px at 71% 41%, rgba(232, 221, 204, 0.22), transparent),
    radial-gradient(1px 1px at 84% 74%, rgba(255, 120, 40, 0.2), transparent),
    radial-gradient(1px 1px at 22% 82%, rgba(232, 221, 204, 0.18), transparent),
    radial-gradient(1.4px 1.4px at 55% 18%, rgba(255, 180, 90, 0.22), transparent);
  background-size: 100% 100%;
}
.boot-heat {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(255, 140, 50, 0.38) 0%, rgba(255, 90, 20, 0.1) 42%, transparent 70%);
  filter: blur(2px);
  opacity: 0;
}
.boot-ring {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  transform: translate(-50%, -50%) scale(0.2);
  border: 1px solid rgba(255, 157, 69, 0.55);
  box-shadow: 0 0 24px rgba(255, 120, 40, 0.25);
  opacity: 0;
}
.boot-bloom {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  transform: translate(-50%, -50%) scale(0);
  background: radial-gradient(circle, rgba(255, 220, 140, 0.95) 0%, rgba(255, 120, 40, 0.55) 28%, rgba(255, 70, 10, 0.2) 55%, transparent 72%);
  opacity: 0;
  pointer-events: none;
}
.boot-sparks {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 0;
  height: 0;
}
.boot-spark {
  position: absolute;
  left: 0;
  top: 0;
  width: 3px;
  height: 3px;
  margin: -1.5px 0 0 -1.5px;
  border-radius: 50%;
  background: #ffc47a;
  box-shadow: 0 0 6px 2px rgba(255, 140, 50, 0.65);
  opacity: 0;
  --sx: 0px;
  --sy: -40px;
  --delay: 0s;
  --dur: 2.4s;
}

/* 火焰本身就是开始按钮 */
#screen-title .boot-core {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 3;
  width: 72px;
  height: 88px;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  transform: translate(-50%, -50%) scale(0);
  opacity: 0;
  cursor: pointer;
  pointer-events: none;
  -webkit-tap-highlight-color: transparent;
}
#screen-title .boot-core:focus-visible {
  outline: 1px solid rgba(255, 157, 69, 0.7);
  outline-offset: 10px;
  border-radius: 50%;
}
.boot-flame {
  position: absolute;
  left: 50%;
  bottom: 18px;
  width: 28px;
  height: 46px;
  margin-left: -14px;
  border-radius: 50% 50% 45% 45% / 65% 65% 35% 35%;
  background: linear-gradient(180deg, #ffe7b0 0%, #ff9d45 42%, #ff5a18 100%);
  box-shadow: 0 0 28px 10px var(--ember-glow), 0 0 70px 28px rgba(255, 100, 30, 0.32);
  transform-origin: 50% 90%;
  pointer-events: none;
}
.boot-flame--inner {
  width: 13px;
  height: 22px;
  margin-left: -6.5px;
  bottom: 24px;
  background: linear-gradient(180deg, #fff6df 0%, #ffd27a 55%, transparent 100%);
  box-shadow: none;
  opacity: 0.9;
}

/* 入场：火星出现，可点 */
#screen-title.boot-run .boot-ash {
  animation: ashIn 1s ease forwards, ashDrift 14s linear 1s infinite;
}
#screen-title.boot-run .boot-core {
  animation: coreBirth 1s cubic-bezier(0.2, 0.85, 0.25, 1) 0.35s forwards;
}
#screen-title.boot-run .boot-flame {
  animation: flameFlicker 1.8s ease-in-out 1.1s infinite;
}
#screen-title.boot-run .boot-flame--inner {
  animation: flameFlicker 1.35s ease-in-out 1.25s infinite reverse;
}
#screen-title.boot-run .boot-heat {
  animation: heatBloom 1.8s ease-out 0.5s forwards;
}
#screen-title.boot-run .boot-ring {
  animation: ringPulse 2.2s cubic-bezier(0.15, 0.8, 0.2, 1) 0.65s forwards;
}
#screen-title.boot-run .boot-spark {
  animation: sparkRise var(--dur) ease-out var(--delay) infinite;
}

#screen-title.boot-done .boot-core {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
  pointer-events: auto;
  animation: coreBreathe 3.2s ease-in-out infinite;
}
#screen-title.boot-done .boot-flame {
  animation: flameFlicker 1.8s ease-in-out infinite;
}
#screen-title.boot-done .boot-flame--inner {
  animation: flameFlicker 1.35s ease-in-out infinite reverse;
}
#screen-title.boot-done .boot-ash {
  opacity: 0.5;
  animation: ashDrift 14s linear infinite;
}
#screen-title.boot-done .boot-spark {
  animation: sparkRise var(--dur) ease-out var(--delay) infinite;
}
#screen-title.boot-done .boot-heat {
  opacity: 0.75;
  width: min(58vw, 420px);
  height: min(58vw, 420px);
}
#screen-title.boot-done .boot-core:hover .boot-flame,
#screen-title.boot-done .boot-core:focus-visible .boot-flame {
  filter: brightness(1.15);
  box-shadow: 0 0 36px 14px var(--ember-glow), 0 0 90px 36px rgba(255, 100, 30, 0.4);
}

/* 点击后：火焰烧开全屏 */
#screen-title.igniting .boot-core {
  pointer-events: none;
  animation: flameBurst 0.95s cubic-bezier(0.15, 0.75, 0.2, 1) forwards;
}
#screen-title.igniting .boot-flame,
#screen-title.igniting .boot-flame--inner {
  animation: flameRoar 0.9s ease-out forwards;
}
#screen-title.igniting .boot-bloom {
  animation: bloomOpen 0.95s cubic-bezier(0.12, 0.7, 0.2, 1) forwards;
}
#screen-title.igniting .boot-heat {
  animation: heatFlood 0.9s ease-out forwards;
}
#screen-title.igniting .boot-veil {
  background:
    radial-gradient(70% 70% at 50% 50%, rgba(255, 140, 50, 0.45), rgba(40, 14, 6, 0.55) 55%, rgba(8, 4, 2, 0.85) 100%);
  opacity: 0.35;
}
#screen-title.igniting .boot-spark {
  animation: sparkBurst 0.85s ease-out forwards;
}

@keyframes ashIn {
  from { opacity: 0; }
  to { opacity: 0.5; }
}
@keyframes ashDrift {
  from { transform: translate3d(0, 0, 0); }
  to { transform: translate3d(-1.5%, -2.5%, 0); }
}
@keyframes coreBirth {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0); }
  50% { opacity: 1; transform: translate(-50%, -50%) scale(1.35); }
  100% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}
@keyframes coreBreathe {
  0%, 100% { transform: translate(-50%, -50%) scale(1); }
  50% { transform: translate(-50%, -50%) scale(1.08); }
}
@keyframes flameFlicker {
  0%, 100% { transform: scaleY(1) scaleX(1) rotate(-1deg); filter: brightness(1); }
  35% { transform: scaleY(1.12) scaleX(0.92) rotate(2deg); filter: brightness(1.12); }
  65% { transform: scaleY(0.94) scaleX(1.06) rotate(-2deg); filter: brightness(0.95); }
}
@keyframes heatBloom {
  0% { opacity: 0; width: 0; height: 0; }
  55% { opacity: 0.85; }
  100% { opacity: 0.75; width: min(58vw, 420px); height: min(58vw, 420px); }
}
@keyframes ringPulse {
  0% { opacity: 0.9; transform: translate(-50%, -50%) scale(0.2); }
  70% { opacity: 0.3; }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(12); }
}
@keyframes sparkRise {
  0% { opacity: 0; transform: translate(0, 0) scale(0.6); }
  12% { opacity: 1; }
  100% { opacity: 0; transform: translate(var(--sx), var(--sy)) scale(0.2); }
}
@keyframes flameBurst {
  0% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
  55% { transform: translate(-50%, -50%) scale(3.2); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(8); opacity: 0; }
}
@keyframes flameRoar {
  0% { filter: brightness(1); }
  40% { filter: brightness(1.55); }
  100% { filter: brightness(2); opacity: 0.2; }
}
@keyframes bloomOpen {
  0% { opacity: 0.9; transform: translate(-50%, -50%) scale(0.2); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(28); }
}
@keyframes heatFlood {
  0% { opacity: 0.75; width: min(58vw, 420px); height: min(58vw, 420px); }
  100% { opacity: 0.95; width: 160vmax; height: 160vmax; }
}
@keyframes sparkBurst {
  0% { opacity: 1; transform: translate(0, 0) scale(1); }
  100% { opacity: 0; transform: translate(calc(var(--sx) * 2.4), calc(var(--sy) * 2.2)) scale(0.15); }
}

@media (prefers-reduced-motion: reduce) {
  #screen-title.boot-run .boot-ash,
  #screen-title.boot-run .boot-core,
  #screen-title.boot-run .boot-flame,
  #screen-title.boot-run .boot-flame--inner,
  #screen-title.boot-run .boot-heat,
  #screen-title.boot-run .boot-ring,
  #screen-title.boot-run .boot-spark,
  #screen-title.igniting .boot-core,
  #screen-title.igniting .boot-flame,
  #screen-title.igniting .boot-bloom,
  #screen-title.igniting .boot-heat,
  #screen-title.igniting .boot-spark {
    animation: none !important;
  }
  #screen-title.boot-run .boot-core,
  #screen-title.boot-done .boot-core {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
    pointer-events: auto;
  }
  #screen-title.boot-run .boot-ash,
  #screen-title.boot-run .boot-heat {
    opacity: 0.55;
  }
  #screen-title.boot-run .boot-heat,
  #screen-title.boot-done .boot-heat {
    width: min(58vw, 420px);
    height: min(58vw, 420px);
  }
}

button.primary {
  font-family: inherit;
  font-size: 1.05rem;
  letter-spacing: 0.35em;
  text-indent: 0.35em;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--line);
  padding: 0.9rem 2.6rem;
  cursor: pointer;
  transition: all 0.4s ease;
}
button.primary:hover {
  border-color: var(--ember);
  box-shadow: 0 0 24px rgba(255, 157, 69, 0.25);
  color: #fff;
}

/* ---------- 叙事幕间 ---------- */
#screen-narration { padding: 2rem; }
.narration-box {
  max-width: 620px;
  font-size: 1.12rem;
  line-height: 2.3;
  white-space: pre-wrap;
  text-align: justify;
}
.narration-hint {
  margin-top: 2.4rem;
  color: var(--ink-dim);
  font-size: 0.85rem;
  letter-spacing: 0.2em;
  animation: hintFade 2.4s ease-in-out infinite;
}
@keyframes hintFade { 0%,100% { opacity: 0.35; } 50% { opacity: 0.9; } }

/* ---------- 结局屏 ---------- */
#screen-ending { padding: 2rem; overflow-y: auto; }
.ending-box {
  max-width: 640px;
  font-size: 1.08rem;
  line-height: 2.35;
  white-space: pre-wrap;
  text-align: justify;
}
.ending-title {
  font-size: 1.4rem;
  letter-spacing: 0.5em;
  text-indent: 0.5em;
  color: var(--ember);
  margin-bottom: 1.6rem;
}
.ending-actions { margin-top: 2.4rem; }

/* ---------- HUD ---------- */
#interact-prompt {
  position: absolute;
  left: 50%;
  bottom: 18%;
  transform: translateX(-50%);
  display: none;
  align-items: center;
  gap: 0.7rem;
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 0.55rem 1.2rem;
  z-index: 10;
  letter-spacing: 0.15em;
  font-size: 0.95rem;
  cursor: pointer;
}
#interact-prompt.show { display: flex; }
#interact-prompt .key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px; height: 26px;
  border: 1px solid var(--ember);
  color: var(--ember);
  font-size: 0.85rem;
  border-radius: 4px;
}

#tod-hud {
  position: absolute;
  top: 1.6rem;
  left: 1.8rem;
  z-index: 12;
  pointer-events: none;
  color: var(--ink-dim);
  font-size: 0.78rem;
  letter-spacing: 0.42em;
  text-shadow: 0 0 10px #000;
  opacity: 0.72;
}
#tod-hud #tod-label {
  border-bottom: 1px solid rgba(200, 170, 120, 0.35);
  padding-bottom: 0.15em;
}

#ambient-caption {
  position: absolute;
  top: 8%;
  left: 50%;
  transform: translateX(-50%);
  color: var(--ink-dim);
  font-size: 0.98rem;
  letter-spacing: 0.25em;
  opacity: 0;
  transition: opacity 1.6s ease;
  pointer-events: none;
  text-shadow: 0 0 12px #000;
  white-space: nowrap;
  z-index: 10;
}
#ambient-caption.show { opacity: 0.92; }
#ambient-caption.finale {
  left: auto;
  right: 6%;
  transform: none;
  text-align: right;
  max-width: 42vw;
  white-space: normal;
  line-height: 1.8;
}

/* 天平偏移瞬间色闪 —— 不显示数值，但让世界“抖一下色温” */
#balance-flash {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 25;
  opacity: 0;
  transition: opacity 0.15s ease-out;
}
#balance-flash.asha {
  background: radial-gradient(ellipse at 50% 60%, rgba(255, 180, 80, 0.38), rgba(255, 140, 40, 0.08) 45%, transparent 70%);
}
#balance-flash.druj {
  background: radial-gradient(ellipse at 50% 60%, rgba(90, 70, 180, 0.42), rgba(40, 30, 90, 0.12) 45%, transparent 70%);
}
#balance-flash.finale-ember {
  background: radial-gradient(ellipse at 50% 55%, rgba(255, 120, 40, 0.45), rgba(180, 60, 20, 0.12) 40%, transparent 68%);
}
#balance-flash.pulse { opacity: 1; transition: none; }

/* 终局烈焰瞬间：闪光更亮、更久 */
#balance-flash.asha.pulse,
#balance-flash.druj.pulse,
#balance-flash.finale-ember.pulse {
  opacity: 0.92;
}
#controls-hint {
  position: absolute;
  left: 1.2rem;
  bottom: 1rem;
  color: var(--ink-dim);
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  opacity: 0.65;
  z-index: 10;
  text-shadow: 0 0 8px #000;
  display: none;
}
#controls-hint.show { display: block; }

/* ---------- 对话层 ---------- */
#dialogue-layer {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  justify-content: flex-end;
  background: linear-gradient(to bottom, rgba(5,3,2,0.15) 0%, rgba(5,3,2,0.85) 60%);
  z-index: 40;
}
#dialogue-layer.active { display: flex; }

.dlg-box {
  margin: 0 auto;
  width: min(720px, calc(100% - 2rem));
  background: var(--panel);
  border: 1px solid var(--line);
  border-bottom: none;
  padding: 1.4rem 1.8rem 1.8rem;
  max-height: 72vh;
  overflow-y: auto;
}
.dlg-speaker { color: var(--ember); letter-spacing: 0.3em; font-size: 0.9rem; margin-bottom: 0.8rem; }
.dlg-text {
  font-size: 1.05rem;
  line-height: 2.15;
  white-space: pre-wrap;
  min-height: 3rem;
  text-align: justify;
}
.dlg-continue {
  margin-top: 1.2rem;
  text-align: right;
  color: var(--ink-dim);
  font-size: 0.85rem;
  letter-spacing: 0.2em;
  cursor: pointer;
  animation: hintFade 2s ease-in-out infinite;
}

.dlg-choices { margin-top: 1.3rem; display: flex; flex-direction: column; gap: 0.7rem; }
.choice-btn {
  text-align: left;
  font-family: inherit;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 0.8rem 1.1rem;
  cursor: pointer;
  transition: all 0.3s ease;
  line-height: 1.8;
}
.choice-btn:hover { border-color: var(--ember); background: rgba(255, 157, 69, 0.06); }
.choice-speech { display: block; font-size: 1rem; }

/* ---------- NPC 自由对话（对齐 #dialogue-layer 底栏） ---------- */
#npc-chat-layer {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  justify-content: flex-end;
  /* 上半屏留给 3D 对视；遮罩只压在对话框一带 */
  background: linear-gradient(to bottom, rgba(5,3,2,0) 0%, rgba(5,3,2,0.08) 42%, rgba(5,3,2,0.72) 72%);
  z-index: 42;
  pointer-events: none;
}
#npc-chat-layer.active {
  display: flex;
  pointer-events: auto;
}
#npc-chat-layer .npc-chat-box {
  margin: 0 auto;
  width: min(720px, calc(100% - 2rem));
  max-height: min(46vh, 380px);
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  border-bottom: none;
  padding-bottom: 1.4rem;
}
.npc-chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.npc-chat-head .dlg-speaker { margin-bottom: 0; }
#npc-chat-close {
  font-family: inherit;
  letter-spacing: 0.28em;
  font-size: 0.78rem;
  color: var(--ink-dim);
  background: transparent;
  border: 1px solid var(--line);
  padding: 0.35rem 0.85rem;
  cursor: pointer;
  transition: all 0.3s ease;
}
#npc-chat-close:hover { border-color: var(--ember); color: var(--ink); }

.npc-chat-trust {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 0.72rem;
  letter-spacing: 0.22em;
  color: var(--ink-dim);
}
.npc-chat-trust-tag { opacity: 0.75; }
.npc-chat-trust-bar {
  flex: 1;
  height: 2px;
  background: rgba(232, 221, 204, 0.1);
  position: relative;
  overflow: hidden;
}
#npc-chat-trust-fill {
  display: block;
  height: 100%;
  width: 35%;
  background: linear-gradient(90deg, rgba(255,157,69,0.25), var(--ember));
  box-shadow: 0 0 10px var(--ember-glow);
  transition: width 0.45s ease;
}
#npc-chat-trust-label {
  min-width: 2.5em;
  text-align: right;
  color: var(--ember);
  letter-spacing: 0.35em;
}

.npc-chat-log {
  flex: 1;
  min-height: 7rem;
  max-height: 280px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding: 0.2rem 0.15rem 0.4rem 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.npc-line { display: flex; flex-direction: column; gap: 0.25rem; }
.npc-line.player { align-items: flex-end; }
.npc-line-you {
  font-size: 0.72rem;
  letter-spacing: 0.35em;
  color: var(--ink-dim);
}
.npc-line-speech {
  font-size: 1.02rem;
  line-height: 2.05;
  white-space: pre-wrap;
  text-align: justify;
  max-width: 100%;
}
.npc-line.player .npc-line-speech {
  color: var(--ink-dim);
  border-left: 2px solid rgba(255, 157, 69, 0.35);
  padding-left: 0.75rem;
  text-align: left;
}
.npc-line.npc .npc-line-speech { color: var(--ink); }

.npc-chat-status {
  min-height: 1.1em;
  font-size: 0.75rem;
  letter-spacing: 0.18em;
  color: var(--ink-dim);
  opacity: 0.85;
}
.npc-chat-input-row {
  display: flex;
  gap: 0.65rem;
  align-items: stretch;
}
#npc-chat-input {
  flex: 1;
  font-family: inherit;
  font-size: 0.98rem;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  padding: 0.75rem 1rem;
  outline: none;
  transition: border-color 0.3s ease;
}
#npc-chat-input::placeholder { color: rgba(157, 143, 122, 0.55); letter-spacing: 0.06em; }
#npc-chat-input:focus { border-color: rgba(255, 157, 69, 0.55); }
#npc-chat-send {
  min-width: 4.2rem;
  padding-left: 1.1rem;
  padding-right: 1.1rem;
}
#npc-chat-send:disabled { opacity: 0.4; cursor: wait; }

/* ---------- 火坛印记密码 ---------- */
#deduction-layer {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 45;
  padding: 1.5rem;
  background: radial-gradient(70% 70% at 50% 62%, rgba(58, 30, 14, 0.55), rgba(6, 4, 3, 0.93));
  backdrop-filter: blur(3px);
}
#deduction-layer.active { display: flex; }

.ded-box {
  width: min(640px, 100%);
  max-height: 88vh;
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 1.8rem 2rem 1.6rem;
}
.ded-title {
  color: var(--ember);
  letter-spacing: 0.4em;
  text-indent: 0.4em;
  font-size: 0.85rem;
  text-align: center;
  margin-bottom: 1.2rem;
}

.ded-evidence-prompt {
  color: var(--ink);
  font-size: 1.05rem;
  letter-spacing: 0.08em;
  text-align: center;
}
.ded-hint {
  margin-top: 0.45rem;
  color: var(--ink-dim);
  font-size: 0.88rem;
  letter-spacing: 0.12em;
  text-align: center;
}

.ded-sentence { margin-top: 1.4rem; }
.seal-ring {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  flex-wrap: wrap;
}
.seal-slot {
  width: 7.2rem;
  height: 8.4rem;
  border: 1px dashed var(--line);
  background: rgba(255,255,255,0.02);
  color: var(--ink);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.25s ease, background 0.25s ease, transform 0.25s ease;
}
.seal-slot.filled {
  border-style: solid;
  border-color: var(--ember);
  background: rgba(255,157,69,0.07);
}
.seal-slot:hover.filled { transform: translateY(-2px); }
.seal-empty {
  font-size: 1.6rem;
  color: var(--ink-dim);
  letter-spacing: 0;
}
.seal-arrow {
  color: var(--ember);
  opacity: 0.7;
  font-size: 1.4rem;
}
.seal-glyph svg,
.clue-slot svg,
.clue-toast-glyph svg,
.seal-tile svg {
  width: 3.2rem;
  height: 3.2rem;
  display: block;
  color: var(--ember);
}
.seal-name { font-size: 0.92rem; letter-spacing: 0.2em; }

.ded-hand {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin-top: 1.5rem;
  justify-content: center;
}
.seal-tile {
  min-width: 8.5rem;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  font-family: inherit;
  color: var(--ink);
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--line);
  padding: 0.65rem 0.9rem;
  cursor: pointer;
  transition: border-color 0.25s ease, background 0.25s ease;
}
.seal-tile:hover { border-color: var(--ember); background: rgba(255,157,69,0.06); }
.seal-tile.used { opacity: 0.28; pointer-events: none; }
.seal-meta { display: flex; flex-direction: column; align-items: flex-start; gap: 0.15rem; }
.seal-meta b { font-weight: 500; letter-spacing: 0.18em; }
.seal-meta i { font-style: normal; color: var(--ink-dim); font-size: 0.8rem; }

.clue-toast-glyph {
  display: flex;
  justify-content: center;
  margin: 0.35rem 0 0.15rem;
}
.clue-slot {
  width: 2.6rem;
  height: 2.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.clue-slot svg { width: 1.5rem; height: 1.5rem; }

.ded-actions {
  margin-top: 1.8rem;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 1.2rem;
}
.ded-actions .primary { padding: 0.7rem 1.8rem; font-size: 0.95rem; letter-spacing: 0.25em; text-indent: 0.25em; }
.ded-actions .primary:disabled { opacity: 0.3; cursor: default; border-color: var(--line); box-shadow: none; }
.ded-cancel {
  font-family: inherit;
  background: transparent;
  border: none;
  color: var(--ink-dim);
  font-size: 0.88rem;
  letter-spacing: 0.15em;
  cursor: pointer;
}
.ded-cancel:hover { color: var(--ink); }

@media (max-width: 640px) {
  .ded-box { padding: 1.3rem 1.1rem; }
  .ded-sentence { font-size: 1rem; line-height: 2.2; }
  .ded-ev { max-width: 100%; }
}

/* ---------- 调查描述层 ---------- */
#inspect-layer {
  position: absolute;
  inset: 0;
  display: none;
  align-items: flex-end;
  justify-content: center;
  z-index: 35;
  background: linear-gradient(to bottom, transparent 40%, rgba(5,3,2,0.7));
  cursor: pointer;
}
#inspect-layer.active { display: flex; }
.inspect-box {
  margin-bottom: 3rem;
  width: min(640px, calc(100% - 2rem));
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 1.3rem 1.6rem;
  font-size: 1rem;
  line-height: 2.1;
  white-space: pre-wrap;
  text-align: justify;
}

/* ---------- 线索提示 / 线索栏 ---------- */
#clue-toast {
  position: absolute;
  top: 16%;
  left: 50%;
  transform: translate(-50%, -12px);
  background: var(--panel);
  border: 1px solid var(--ember);
  padding: 1rem 1.6rem;
  z-index: 50;
  opacity: 0;
  pointer-events: none;
  transition: all 0.6s ease;
  text-align: center;
  max-width: 420px;
}
#clue-toast.show { opacity: 1; transform: translate(-50%, 0); }
#clue-toast .clue-label { color: var(--ember); font-size: 0.8rem; letter-spacing: 0.35em; margin-bottom: 0.4rem; }
#clue-toast .clue-name { font-size: 1.1rem; letter-spacing: 0.2em; }

#clue-bar {
  position: absolute;
  top: 0.9rem;
  right: 1.2rem;
  display: flex;
  gap: 0.5rem;
  z-index: 15;
}
.clue-slot {
  width: 34px; height: 34px;
  border: 1px solid var(--line);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  color: var(--ink-dim);
  background: rgba(12,8,6,0.6);
  transition: all 0.5s ease;
}
.clue-slot.filled {
  border-color: var(--ember);
  color: var(--ember);
  box-shadow: 0 0 10px rgba(255,157,69,0.25);
}

/* ---------- 调试 ---------- */
#debug-bar {
  position: absolute;
  bottom: 6px; left: 50%;
  transform: translateX(-50%);
  z-index: 99;
  font-size: 11px;
  font-family: monospace;
  color: #7f7;
  background: rgba(0,0,0,0.7);
  padding: 3px 10px;
  border-radius: 4px;
  display: none;
}

::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-thumb { background: #3a2f26; border-radius: 4px; }

@media (max-width: 640px) {
  #screen-title .boot-core { width: 80px; height: 96px; }
  .boot-flame { width: 30px; height: 48px; margin-left: -15px; }
  .narration-box { font-size: 1rem; }
}
