/* 《第四人称》主题修正层：确保 UTF-8、移动端与可读性 */
:root {
  --ink: #0b0f10;
  --paper: #e6dfcc;
  --rust: #b4645c;
  --teal: #8fb8ad;
  --text: #ddd6c6;
  --text-dim: #a7a294;
}

/* 标题页：去掉旧样式误渲染的装饰字 */
.title-paper::after {
  content: "READ" !important;
  position: absolute;
  right: 22px;
  bottom: 22px;
  width: 58px;
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(180, 100, 92, 0.32);
  border-radius: 50%;
  font-family: "Noto Sans SC", "Microsoft YaHei", sans-serif;
  font-size: 9px;
  letter-spacing: 0.18em;
  color: rgba(180, 100, 92, 0.55);
  transform: rotate(-8deg);
}

/* MiniMax 生成插画：加载成功才显示，失败时保留原程序化背景 */
.title-art {
  position: absolute;
  inset: 0;
  z-index: 1;
  background-image: url("../assets/scenes/title.jpg");
  background-position: center;
  background-size: cover;
  opacity: 0.58;
  pointer-events: none;
}
.title-art.loaded { opacity: 0.58; }
.title-art::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(6, 10, 10, 0.90) 0%, rgba(6, 10, 10, 0.62) 46%, rgba(6, 10, 10, 0.28) 100%);
}

.ending-art {
  position: absolute;
  inset: 0;
  z-index: 1;
  background-image: url("../assets/scenes/ending.jpg");
  background-position: center;
  background-size: cover;
  opacity: 0.34;
  pointer-events: none;
}
.ending-art.loaded { opacity: 0.34; }
.ending-art::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 45%, transparent 20%, rgba(5, 8, 8, 0.72) 80%);
}

.title-jp { letter-spacing: 0.12em; }
.title-tag { color: #b9b2a2; }

/* 结局：提高正文对比度 */
.ending-desc { color: #ded6c5 !important; font-size: 14px; line-height: 2; }
.ending-sub { color: #bbb4a4 !important; }
.ending-card { background: rgba(11, 16, 16, 0.96) !important; position: relative; z-index: 3; }

/* 档案面板更易读 */
.panel { max-width: 760px; }
.panel-goal { color: #b9b2a2; }
.clue-card p { color: #c5beae; }

/* 移动端 */
@media (max-width: 600px) {
  html, body, #app { max-width: 100vw; overflow: hidden; }

  #hud {
    padding: 10px 10px 8px;
    gap: 6px;
    align-items: flex-start;
  }

  .hud-left {
    flex: 1 1 auto;
    max-width: 56%;
    min-width: 0;
    overflow: hidden;
  }

  .hud-chapter {
    display: block;
    font-size: 10px;
    letter-spacing: 0.06em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .hud-place { display: none; }
  .hud-clock { display: none; }
  .qa-wrap { display: none; }

  .hud-right {
    flex: 0 0 auto;
    gap: 4px;
    max-width: 44%;
  }

  #btn-note { display: none; }

  .hud-btn {
    padding: 4px 7px;
    font-size: 9px;
    letter-spacing: 0.04em;
  }

  .san-wrap { padding: 4px 6px; gap: 4px; }
  .san-bar { width: 38px; }
  .san-num { font-size: 11px; min-width: 18px; }

  .textbox {
    left: 12px !important;
    width: calc(100vw - 24px) !important;
    max-width: calc(100vw - 24px) !important;
    transform: none !important;
    padding: 22px 18px 20px !important;
    min-height: 150px;
    bottom: calc(56px + env(safe-area-inset-bottom));
  }

  .line {
    font-size: calc(15px * var(--font-scale)) !important;
    line-height: 1.85;
    min-height: 5.4em;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .speaker { left: 14px; }
  .next-indicator { right: 14px; }

  #quickbar {
    width: 100vw;
    padding: 0 4px env(safe-area-inset-bottom);
    height: calc(46px + env(safe-area-inset-bottom));
    justify-content: space-evenly;
    gap: 0;
  }

  .quick-btn {
    padding: 5px 4px;
    font-size: 9px;
    letter-spacing: 0.03em;
  }

  .choices {
    left: 12px;
    right: 12px;
    bottom: calc(58px + env(safe-area-inset-bottom) + 210px);
  }

  .workbench {
    width: 100vw;
    max-height: 96vh;
    border-left: none;
    border-right: none;
  }

  .wb-head { gap: 6px; }
  .wb-meters { gap: 6px; }
  .wb-seg { display: none; }
  .wb-pane { padding: 14px 16px; }
  .wb-source-text, .wb-target-text { font-size: 12.5px; line-height: 1.9; }
  .trans-main b { font-size: 12.5px; }
}

@media (max-width: 380px) {
  .hud-chapter { font-size: 9px; }
  .hud-btn { padding: 4px 5px; font-size: 8.5px; }
  .san-bar { width: 30px; }
  .quick-btn { font-size: 8.5px; }
  .textbox { padding: 18px 14px !important; }
  .line { font-size: 14px !important; }
}
