/* ==========================================================================
   凤阙 · 视觉规范
   漆墨底 #151210 / 鎏金 #B8945F / 浅金 #D6B56B / 朱砂 #B9473F
   月白 #F2E8D5 / 灰褐 #9B8A78 / 危险朱红 #C33F3F / 完成青黛 #5F8A72

   卡片结构固定：①细框 ②标题 ③至少一条分隔线 ④正文区 ⑤末尾短落款【凤阙】
   ========================================================================== */

:root {
  --ink: #151210;
  --ink-2: #1d1916;
  --ink-3: #241f1a;
  --gold: #b8945f;
  --gold-light: #d6b56b;
  --cinnabar: #b9473f;
  --moon: #f2e8d5;
  --gray-brown: #9b8a78;
  --danger: #c33f3f;
  --jade: #5f8a72;

  --paper-frame: #c9b37e;
  --paper-bg: #f3f2ef;
  --paper-title: #a65a4a;
  --paper-ink: #333333;

  --serif: "Songti SC", "STSong", "Noto Serif SC", "Source Han Serif SC", "SimSun", "Times New Roman", serif;
  --sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;

  --story-width: 780px;
  --hud-h: 62px;
  --composer-h: 92px;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  background: var(--ink);
  color: var(--moon);
  font-family: var(--serif);
  font-size: 16px;
  line-height: 1.9;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

button,
input,
textarea,
select {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

/* --------------------------------------------------------------------------
   舞台：背景 / 立绘 / CG
   -------------------------------------------------------------------------- */

.stage {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  background:
    radial-gradient(120% 80% at 50% 0%, #241d17 0%, var(--ink) 55%, #0b0908 100%);
}

/* 还没画背景的场景：给底色加一层极淡的绢纹噪点，免得整屏死黑像加载失败 */
.stage::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}

.stage__bg {
  position: absolute;
  inset: 0;
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  opacity: 0;
  transition: opacity 1.1s ease;
  transform: scale(1.02);
}

.stage__bg.is-on {
  opacity: 1;
}

/* 亮背景会让月白正文糊掉：统一压一层漆墨蒙版（runbook 3.5 坑 1） */
.stage__veil {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(21, 18, 16, 0.92) 0%, rgba(21, 18, 16, 0.55) 28%, rgba(21, 18, 16, 0.72) 100%),
    rgba(21, 18, 16, 0.45);
}

/* 立绘改在「人物志」面板里看：正文区不再放立绘，否则手机上会被文字挡住脸 */
/* 用米白纸底而不是深色底：抠图残留的白会融进纸色，同时像一幅挂在墙上的人物画像 */
.portrait {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  margin: 4px 0 16px;
  padding: 14px 14px 10px;
  background: radial-gradient(120% 80% at 50% 8%, #f8f5ee 0%, #eee7d9 58%, #e1d8c5 100%);
  border: 1px solid var(--gold);
  box-shadow:
    inset 0 0 0 1px rgba(21, 18, 16, 0.85),
    inset 0 0 0 3px rgba(184, 148, 95, 0.32),
    inset 0 0 46px rgba(120, 96, 60, 0.16),
    0 6px 22px rgba(0, 0, 0, 0.5);
}

.portrait img {
  max-width: 100%;
  max-height: min(44vh, 380px);
  object-fit: contain;
  filter: drop-shadow(0 4px 10px rgba(84, 64, 44, 0.22));
}

.portrait__label {
  margin-top: 10px;
  font-size: 12px;
  letter-spacing: 0.2em;
  color: #6f5a45;
}

.portrait--missing {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  height: min(40vh, 300px);
  border: 1px dashed rgba(150, 120, 80, 0.5);
  background: rgba(255, 255, 255, 0.35);
  color: #6f5a45;
  letter-spacing: 0.18em;
}

.portrait--missing span:last-child {
  font-size: 12px;
  color: #8d7a63;
  letter-spacing: 0.1em;
}

.stage__cg {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.8s ease;
}

.stage__cg.is-on {
  opacity: 1;
}

.stage__cg img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

/* --------------------------------------------------------------------------
   HUD：固定两行（第一行时间地点，第二行菜单栏）
   -------------------------------------------------------------------------- */

.hud {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 30;
  height: var(--hud-h);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  padding: 8px 16px;
  background: linear-gradient(180deg, rgba(13, 11, 10, 0.96) 60%, rgba(13, 11, 10, 0));
  border-bottom: 1px solid rgba(184, 148, 95, 0.35);
  backdrop-filter: blur(2px);
}

.hud__line {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.hud__time {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 13px;
  letter-spacing: 0.08em;
  color: var(--gray-brown);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hud__time b {
  color: var(--gold-light);
  font-weight: 500;
}

/* 工具栏：手机上收进「⋯」，避免和时间地点挤在一行 */
.hud__tools {
  position: relative;
  flex: 0 0 auto;
}

.hud__tools > summary {
  list-style: none;
  cursor: pointer;
  width: 30px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(184, 148, 95, 0.35);
  border-radius: 2px;
  color: var(--gold);
  font-size: 15px;
  line-height: 1;
  letter-spacing: 0.1em;
  user-select: none;
}

.hud__tools > summary::-webkit-details-marker {
  display: none;
}

.hud__tools[open] > summary {
  color: var(--gold-light);
  border-color: var(--gold);
}

.hud__tools-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  display: flex;
  flex-direction: column;
  min-width: 92px;
  padding: 6px;
  gap: 4px;
  background: rgba(21, 18, 16, 0.98);
  border: 1px solid var(--gold);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  z-index: 40;
}

.hud__tools-panel button {
  background: none;
  border: 0;
  padding: 7px 10px;
  text-align: left;
  color: var(--gray-brown);
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}

.hud__tools-panel button:hover {
  background: rgba(184, 148, 95, 0.14);
  color: var(--gold-light);
}

.hud__menu {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  font-size: 13px;
  letter-spacing: 0.08em;
}

.hud__menu button {
  background: none;
  border: 0;
  padding: 0;
  color: var(--gold);
  cursor: pointer;
  transition: color 0.2s ease;
}

.hud__menu button:hover,
.hud__menu button:focus-visible {
  color: var(--gold-light);
  text-shadow: 0 0 10px rgba(214, 181, 107, 0.5);
}

/* --------------------------------------------------------------------------
   正文区
   -------------------------------------------------------------------------- */

.story {
  position: relative;
  z-index: 10;
  height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: calc(var(--hud-h) + 18px) 20px calc(var(--composer-h) + 140px);
  scrollbar-width: thin;
  scrollbar-color: rgba(184, 148, 95, 0.4) transparent;
}

.story::-webkit-scrollbar {
  width: 8px;
}

.story::-webkit-scrollbar-thumb {
  background: rgba(184, 148, 95, 0.35);
  border-radius: 4px;
}

.turn {
  max-width: var(--story-width);
  margin: 0 auto 34px;
  animation: rise 0.5s ease both;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* 玩家的行动 */
.turn__player {
  margin: 0 0 18px;
  padding: 10px 14px;
  border-left: 2px solid rgba(214, 181, 107, 0.55);
  background: rgba(184, 148, 95, 0.07);
  color: var(--gold-light);
  font-size: 15px;
  letter-spacing: 0.02em;
}

.turn__player::before {
  content: "你 · ";
  color: var(--gray-brown);
  font-size: 12px;
  letter-spacing: 0.1em;
}

/* 旁白 */
.line {
  margin: 0 0 14px;
  color: var(--moon);
  font-size: 16.5px;
  letter-spacing: 0.03em;
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.75);
}

.line--narration {
  text-indent: 2em;
}

/* 人物对白：另起引用块，说话者用【】 */
.line--dialogue {
  position: relative;
  margin: 0 0 16px;
  padding: 8px 14px 8px 16px;
  border-left: 2px solid var(--gold);
  background: linear-gradient(90deg, rgba(184, 148, 95, 0.1), rgba(184, 148, 95, 0));
  text-indent: 0;
}

.line--dialogue .speaker {
  color: var(--gold-light);
  font-weight: 600;
  letter-spacing: 0.05em;
  margin-right: 4px;
}

.line--dialogue .speaker::before {
  content: "【";
}

.line--dialogue .speaker::after {
  content: "】";
}

.line--dialogue .said {
  color: var(--moon);
}

.line--dialogue .said::before {
  content: "“";
}

.line--dialogue .said::after {
  content: "”";
}

/* 系统一行朱砂提示 */
.line--system {
  margin: 0 0 14px;
  color: var(--cinnabar);
  font-size: 14px;
  letter-spacing: 0.06em;
  text-indent: 0;
}

.line--system::before {
  content: "系统　";
  color: var(--gold);
  font-size: 12px;
  letter-spacing: 0.14em;
}

/* 加载 / 报错 */
.turn__loading {
  color: var(--gray-brown);
  font-size: 14px;
  letter-spacing: 0.3em;
}

.turn__loading::after {
  content: "…";
  animation: dots 1.4s steps(4, end) infinite;
}

@keyframes dots {
  0% { opacity: 0.2; }
  50% { opacity: 1; }
  100% { opacity: 0.2; }
}

.turn__error {
  padding: 10px 14px;
  border: 1px solid var(--danger);
  background: rgba(195, 63, 63, 0.08);
  color: #e0a49f;
  font-size: 14px;
}

.turn__error button {
  margin-left: 10px;
  background: none;
  border: 1px solid var(--danger);
  color: #e0a49f;
  padding: 2px 10px;
  cursor: pointer;
}

/* --------------------------------------------------------------------------
   古风卡片（CSS 复刻 LaTeX 卡片）
   -------------------------------------------------------------------------- */

.fq-card {
  position: relative;
  max-width: 560px;
  margin: 22px auto;
  padding: 18px 20px 14px;
  background: var(--ink-2);
  border: 1px solid var(--gold);
  box-shadow:
    inset 0 0 0 1px rgba(21, 18, 16, 1),
    inset 0 0 0 2px rgba(184, 148, 95, 0.28),
    0 6px 26px rgba(0, 0, 0, 0.55);
  text-align: left;
}

.fq-card__brand {
  color: var(--gold-light);
  font-size: 19px;
  font-weight: 600;
  letter-spacing: 0.28em;
}

.fq-card__brand span {
  display: block;
  margin-top: 2px;
  color: var(--cinnabar);
  font-size: 9px;
  letter-spacing: 0.5em;
}

.fq-card__title {
  margin-top: 10px;
  color: var(--cinnabar);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.1em;
}

.fq-card__sub {
  margin-top: 4px;
  color: var(--gray-brown);
  font-size: 12.5px;
  letter-spacing: 0.04em;
}

.fq-card__rule {
  height: 1px;
  margin: 12px 0;
  background: linear-gradient(90deg, var(--gold), rgba(184, 148, 95, 0.15));
}

.fq-card__section + .fq-card__section {
  margin-top: 4px;
}

.fq-card__heading {
  margin: 8px 0 4px;
  font-size: 13px;
  letter-spacing: 0.08em;
  color: var(--gold-light);
  font-weight: 600;
}

.fq-card__row {
  display: flex;
  gap: 10px;
  align-items: baseline;
  font-size: 14px;
  line-height: 1.85;
}

.fq-card__label {
  flex: 0 0 auto;
  min-width: 5.5em;
  color: var(--gray-brown);
  font-size: 13px;
  letter-spacing: 0.06em;
}

.fq-card__value {
  color: var(--moon);
  flex: 1 1 auto;
}

.fq-card__para {
  font-size: 14px;
  line-height: 1.9;
  color: var(--moon);
  letter-spacing: 0.02em;
}

.fq-card__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 18px;
}

.fq-card__grid .fq-card__label {
  min-width: 4em;
}

.fq-card__foot {
  margin-top: 14px;
  color: var(--gold-light);
  font-size: 12px;
  letter-spacing: 0.16em;
  text-align: right;
}

.tone-muted { color: var(--gray-brown); }
.tone-gold { color: var(--gold-light); }
.tone-moon { color: var(--moon); }
.tone-danger { color: #c66a62; }
.tone-jade { color: #79a88c; }

/* 变体 */
.fq-card--jade {
  border-color: var(--jade);
  box-shadow:
    inset 0 0 0 1px rgba(21, 18, 16, 1),
    inset 0 0 0 2px rgba(95, 138, 114, 0.3),
    0 6px 26px rgba(0, 0, 0, 0.55);
}

.fq-card--jade .fq-card__title,
.fq-card--jade .fq-card__foot {
  color: #79a88c;
}

.fq-card--jade .fq-card__rule {
  background: linear-gradient(90deg, var(--jade), rgba(95, 138, 114, 0.15));
}

.fq-card--danger {
  border-color: var(--danger);
  box-shadow:
    inset 0 0 0 1px rgba(21, 18, 16, 1),
    inset 0 0 0 2px rgba(195, 63, 63, 0.3),
    0 6px 26px rgba(0, 0, 0, 0.55);
}

.fq-card--danger .fq-card__title {
  color: #c95b55;
}

.fq-card--danger .fq-card__rule {
  background: linear-gradient(90deg, #7f2f2f, rgba(195, 63, 63, 0.15));
}

/* 系统脑内回应：浅灰暖纸底，与正式黑金面板明显分层 */
.fq-card--system {
  background: var(--paper-bg);
  border-color: var(--paper-frame);
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.45);
}

.fq-card--system .fq-card__title {
  color: var(--paper-title);
}

.fq-card--system .fq-card__rule {
  background: linear-gradient(90deg, var(--paper-frame), rgba(201, 179, 126, 0.1));
}

.fq-card--system .fq-card__para,
.fq-card--system .fq-card__value,
.fq-card--system .fq-card__foot {
  color: var(--paper-ink);
}

/* 卡片内切换器 */
.fq-card__switcher {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(184, 148, 95, 0.25);
}

.fq-card__switcher button {
  background: none;
  border: 1px solid rgba(184, 148, 95, 0.4);
  color: var(--gray-brown);
  font-size: 12px;
  padding: 2px 9px;
  cursor: pointer;
}

.fq-card__switcher button.is-on,
.fq-card__switcher button:hover {
  border-color: var(--gold);
  color: var(--gold-light);
}

/* --------------------------------------------------------------------------
   行止抉择
   -------------------------------------------------------------------------- */

.options {
  position: fixed;
  left: 0;
  right: 0;
  bottom: var(--composer-h);
  z-index: 20;
  padding: 0 20px 8px;
  pointer-events: none;
}

.options__card {
  max-width: var(--story-width);
  margin: 0 auto;
  background: rgba(21, 18, 16, 0.94);
  border: 1px solid var(--gold);
  box-shadow: inset 0 0 0 2px rgba(184, 148, 95, 0.22);
  padding: 12px 16px;
  pointer-events: auto;
}

.options__title {
  color: var(--cinnabar);
  font-size: 14px;
  letter-spacing: 0.16em;
  margin-bottom: 6px;
}

.options__list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.options__item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  width: 100%;
  text-align: left;
  background: none;
  border: 1px solid transparent;
  padding: 5px 8px;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease;
}

.options__item:hover:not(:disabled) {
  background: rgba(184, 148, 95, 0.1);
  border-color: rgba(184, 148, 95, 0.45);
}

.options__item:disabled {
  opacity: 0.45;
  cursor: default;
}

.options__key {
  flex: 0 0 auto;
  color: var(--gold-light);
  font-weight: 700;
  font-size: 13px;
}

.options__text {
  color: var(--moon);
  font-size: 14px;
  line-height: 1.7;
}

.options__hint {
  margin-top: 8px;
  color: var(--gray-brown);
  font-size: 11.5px;
  letter-spacing: 0.06em;
}

.options__hint b {
  color: var(--gold-light);
}

/* --------------------------------------------------------------------------
   输入区
   -------------------------------------------------------------------------- */

.composer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 25;
  height: var(--composer-h);
  display: flex;
  gap: 10px;
  align-items: flex-end;
  padding: 12px 20px 16px;
  background: linear-gradient(0deg, rgba(13, 11, 10, 0.98) 70%, rgba(13, 11, 10, 0));
}

/* 压边金线：中间亮、两端隐没，像卷轴或书页的压边 */
.composer::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold) 22%, var(--gold-light) 50%, var(--gold) 78%, transparent);
  opacity: 0.5;
}

.composer__inner {
  display: flex;
  gap: 10px;
  width: 100%;
  max-width: var(--story-width);
  margin: 0 auto;
}

.composer textarea {
  flex: 1 1 auto;
  min-height: 46px;
  max-height: 120px;
  resize: none;
  padding: 12px 15px;
  /* 底：漆墨；再叠笺纸竖格；最上四角鎏金角饰 */
  background-color: rgba(19, 16, 14, 0.94);
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='11' height='11' viewBox='0 0 11 11'%3E%3Cpath d='M0.9 4.2 V0.9 H4.2' fill='none' stroke='%23D6B56B' stroke-width='1' stroke-opacity='0.9'/%3E%3Ccircle cx='2.3' cy='2.3' r='0.65' fill='%23D6B56B' fill-opacity='0.9'/%3E%3C/svg%3E"),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='11' height='11' viewBox='0 0 11 11'%3E%3Cpath d='M6.8 0.9 H10.1 V4.2' fill='none' stroke='%23D6B56B' stroke-width='1' stroke-opacity='0.9'/%3E%3Ccircle cx='8.7' cy='2.3' r='0.65' fill='%23D6B56B' fill-opacity='0.9'/%3E%3C/svg%3E"),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='11' height='11' viewBox='0 0 11 11'%3E%3Cpath d='M0.9 6.8 V10.1 H4.2' fill='none' stroke='%23D6B56B' stroke-width='1' stroke-opacity='0.9'/%3E%3Ccircle cx='2.3' cy='8.7' r='0.65' fill='%23D6B56B' fill-opacity='0.9'/%3E%3C/svg%3E"),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='11' height='11' viewBox='0 0 11 11'%3E%3Cpath d='M6.8 10.1 H10.1 V6.8' fill='none' stroke='%23D6B56B' stroke-width='1' stroke-opacity='0.9'/%3E%3Ccircle cx='8.7' cy='8.7' r='0.65' fill='%23D6B56B' fill-opacity='0.9'/%3E%3C/svg%3E"),
    repeating-linear-gradient(90deg, rgba(184, 148, 95, 0.055) 0 1px, transparent 1px 24px);
  background-position: left 4px top 4px, right 4px top 4px, left 4px bottom 4px, right 4px bottom 4px, 0 0;
  background-repeat: no-repeat, no-repeat, no-repeat, no-repeat, repeat;
  background-size: 11px 11px, 11px 11px, 11px 11px, 11px 11px, auto;
  /* 双线细框，和人物志 / 任务簿的卡片同一套语言 */
  border: 1px solid rgba(184, 148, 95, 0.75);
  box-shadow:
    inset 0 0 0 1px rgba(21, 18, 16, 1),
    inset 0 0 0 2px rgba(184, 148, 95, 0.22),
    inset 0 2px 10px rgba(0, 0, 0, 0.55);
  border-radius: 0;
  color: var(--moon);
  font-size: 15px;
  line-height: 1.6;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.composer textarea:focus {
  border-color: var(--gold-light);
  box-shadow:
    inset 0 0 0 1px rgba(21, 18, 16, 1),
    inset 0 0 0 2px rgba(214, 181, 107, 0.42),
    inset 0 2px 12px rgba(0, 0, 0, 0.6);
}

.composer textarea::placeholder {
  color: rgba(155, 138, 120, 0.6);
  letter-spacing: 0.1em;
}

/* 「落子」做成朱砂印：实心朱红 + 一层湍流噪声做出印泥的斑驳 */
.composer button {
  flex: 0 0 auto;
  height: 46px;
  padding: 0 18px;
  background-color: #9a3831;
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='90' height='90'%3E%3Cfilter id='i'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='90' height='90' filter='url(%23i)'/%3E%3C/svg%3E"),
    linear-gradient(180deg, #a8403a 0%, #8a312c 100%);
  background-blend-mode: soft-light, normal;
  border: 1px solid #c25048;
  color: var(--moon);
  letter-spacing: 0.28em;
  text-indent: 0.28em;
  cursor: pointer;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.14),
    inset 0 -6px 12px rgba(0, 0, 0, 0.22),
    0 3px 10px rgba(0, 0, 0, 0.5);
  transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

.composer button:hover:not(:disabled) {
  background-color: #b9473f;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.2),
    inset 0 -6px 12px rgba(0, 0, 0, 0.2),
    0 0 14px rgba(185, 71, 63, 0.45);
}

.composer button:disabled {
  opacity: 0.45;
  cursor: default;
}

.composer__meta {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: 2px;
  color: rgba(155, 138, 120, 0.6);
  font-size: 11px;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

/* --------------------------------------------------------------------------
   开场三轮
   -------------------------------------------------------------------------- */

.opening {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow-y: auto;
  background: radial-gradient(120% 90% at 50% 0%, #221c17 0%, #0d0b0a 70%);
}

.opening[hidden] {
  display: none;
}

.opening .fq-card {
  margin: 0;
}

.opening__fields {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 12px;
}

.opening__field label {
  display: block;
  color: var(--gold-light);
  font-size: 13px;
  letter-spacing: 0.12em;
  margin-bottom: 5px;
}

.opening__field input,
.opening__field textarea {
  width: 100%;
  padding: 9px 10px;
  background: rgba(21, 18, 16, 0.85);
  border: 1px solid rgba(184, 148, 95, 0.45);
  border-radius: 2px;
  color: var(--moon);
  font-size: 15px;
  outline: none;
}

.opening__field textarea {
  min-height: 64px;
  resize: vertical;
  line-height: 1.6;
}

.opening__field input:focus,
.opening__field textarea:focus {
  border-color: var(--gold);
}

.opening__hint {
  color: var(--gray-brown);
  font-size: 12px;
  line-height: 1.7;
  letter-spacing: 0.03em;
}

.opening__actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}

.btn {
  padding: 8px 18px;
  background: rgba(184, 148, 95, 0.12);
  border: 1px solid var(--gold);
  color: var(--gold-light);
  letter-spacing: 0.16em;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.btn:hover:not(:disabled) {
  background: rgba(184, 148, 95, 0.26);
}

.btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.btn--quiet {
  border-color: rgba(184, 148, 95, 0.35);
  color: var(--gray-brown);
}

.btn--danger {
  border-color: var(--danger);
  color: #c95b55;
}

.opening__choices {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.choice {
  display: flex;
  gap: 12px;
  align-items: baseline;
  text-align: left;
  padding: 10px 12px;
  background: rgba(184, 148, 95, 0.05);
  border: 1px solid rgba(184, 148, 95, 0.35);
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.choice:hover,
.choice.is-on {
  background: rgba(184, 148, 95, 0.16);
  border-color: var(--gold);
}

.choice__key {
  flex: 0 0 auto;
  color: var(--cinnabar);
  font-weight: 700;
  font-size: 13px;
}

.choice__text {
  color: var(--moon);
  font-size: 14px;
  line-height: 1.7;
}

.choice__desc {
  display: block;
  color: var(--gray-brown);
  font-size: 12px;
  margin-top: 2px;
}

.seg {
  display: flex;
  gap: 8px;
}

.seg button {
  flex: 1 1 0;
  padding: 8px 6px;
  background: rgba(184, 148, 95, 0.05);
  border: 1px solid rgba(184, 148, 95, 0.35);
  color: var(--gray-brown);
  font-size: 13px;
  cursor: pointer;
}

.seg button.is-on {
  border-color: var(--gold);
  color: var(--gold-light);
  background: rgba(184, 148, 95, 0.16);
}

/* --------------------------------------------------------------------------
   面板抽屉 / 提示
   -------------------------------------------------------------------------- */

.panel-host {
  position: fixed;
  inset: 0;
  z-index: 40;
  overflow-y: auto;
  padding: calc(var(--hud-h) + 16px) 20px 40px;
  background: rgba(9, 8, 7, 0.86);
  backdrop-filter: blur(3px);
}

.panel-host[hidden] {
  display: none;
}

.panel-host__close {
  display: block;
  margin: 0 auto;
  max-width: 560px;
  text-align: right;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--composer-h) + 18px);
  transform: translateX(-50%);
  z-index: 70;
  max-width: 80vw;
  padding: 9px 16px;
  background: rgba(29, 25, 22, 0.96);
  border: 1px solid var(--gold);
  color: var(--gold-light);
  font-size: 13px;
  letter-spacing: 0.04em;
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.6);
}

.toast[hidden] {
  display: none;
}

.toast--danger {
  border-color: var(--danger);
  color: #e0a49f;
}

/* --------------------------------------------------------------------------
   窄屏
   -------------------------------------------------------------------------- */

@media (max-width: 720px) {
  :root {
    --hud-h: 58px;
    --composer-h: 84px;
  }

  body {
    font-size: 15px;
  }

  /* 六个菜单项在窄屏上会挤到换行，收紧字距和间距让它稳定占一行 */
  .hud {
    padding: 6px 12px;
  }

  .hud__time {
    font-size: 12px;
  }

  .hud__menu {
    gap: 6px;
    font-size: 12px;
    letter-spacing: 0;
  }

  .hud__tools > summary {
    width: 26px;
    height: 22px;
    font-size: 14px;
  }

  .panel-host {
    padding-left: 12px;
    padding-right: 12px;
  }

  .line { font-size: 15.5px; }

  .portrait img {
    max-height: 38vh;
  }

  .story {
    padding-left: 14px;
    padding-right: 14px;
  }

  .composer {
    padding: 10px 12px 14px;
  }

  .composer button {
    padding: 0 14px;
    letter-spacing: 0.1em;
  }

  .fq-card {
    padding: 14px 14px 12px;
  }

  .options {
    padding: 0 12px 6px;
  }
}

/* 手机横过来时别让固定栏吃掉整个屏幕 */
@media (max-height: 480px) {
  :root {
    --hud-h: 50px;
    --composer-h: 68px;
  }

  .hud__time { display: none; }

  .portrait img { max-height: 60vh; }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
