:root {
  --ink: #12160f;
  --ink-soft: #1c2418;
  --paper: #e8dfc8;
  --paper-dim: #d4c9a8;
  --cinnabar: #b33a2b;
  --cinnabar-hot: #d4523c;
  --jade: #2f6b4f;
  --gold: #c4a35a;
  --mist: rgba(232, 223, 200, 0.12);
  --line: rgba(196, 163, 90, 0.35);
  --danger: #8b2e22;
  --ok: #3d7a58;
  --text: #ebe4d0;
  --muted: #9aa38c;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  --radius: 10px;
  --font-display: "ZCOOL XiaoWei", "Noto Serif SC", serif;
  --font-body: "Noto Serif SC", "Songti SC", serif;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  min-height: 100%;
  min-height: 100dvh;
  background: var(--ink);
  color: var(--text);
  font-family: var(--font-body);
  -webkit-text-size-adjust: 100%;
}

body {
  background:
    radial-gradient(ellipse at 20% 0%, rgba(179, 58, 43, 0.18), transparent 45%),
    radial-gradient(ellipse at 90% 20%, rgba(47, 107, 79, 0.16), transparent 40%),
    linear-gradient(160deg, #0d100b 0%, #171d14 45%, #10140e 100%);
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

#app {
  min-height: 100vh;
  min-height: 100dvh;
}

.screen {
  display: none;
  min-height: 100vh;
}

.screen.active {
  display: block;
}

button {
  font-family: inherit;
  cursor: pointer;
}

.btn {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  padding: 0.7rem 1.25rem;
  border-radius: 999px;
  transition: 0.2s ease;
}

.btn:hover {
  border-color: var(--gold);
  color: #fff;
}

.btn.primary {
  background: linear-gradient(135deg, var(--cinnabar), #8f2d22);
  border-color: transparent;
  color: #fff7ea;
  box-shadow: 0 8px 24px rgba(179, 58, 43, 0.35);
}

.btn.primary:hover {
  filter: brightness(1.08);
}

.btn.ghost {
  background: transparent;
}

.btn.tiny {
  padding: 0.35rem 0.75rem;
  font-size: 0.85rem;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Title */
#screen-title {
  position: relative;
  display: none;
  place-items: center;
}

#screen-title.active {
  display: grid;
}

.title-backdrop {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(transparent 60%, rgba(0, 0, 0, 0.7)),
    repeating-linear-gradient(
      90deg,
      transparent,
      transparent 80px,
      rgba(196, 163, 90, 0.03) 80px,
      rgba(196, 163, 90, 0.03) 81px
    );
  pointer-events: none;
}

.title-panel {
  position: relative;
  text-align: center;
  max-width: 560px;
  padding: 2rem;
}

.title-eyebrow,
.season-pill {
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--gold);
  font-size: 0.8rem;
}

.title-brand {
  font-family: var(--font-display);
  font-size: clamp(2.8rem, 8vw, 4.5rem);
  margin: 0.6rem 0 0.8rem;
  color: var(--paper);
  text-shadow: 0 0 40px rgba(196, 163, 90, 0.25);
}

.title-lead {
  color: var(--muted);
  line-height: 1.7;
  margin-bottom: 2rem;
}

.title-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* Create */
#screen-create.active {
  display: grid;
  place-items: center;
  padding: 2rem 1rem;
}

.create-panel {
  width: min(640px, 100%);
  background: rgba(28, 36, 24, 0.92);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1.75rem;
  box-shadow: var(--shadow);
}

.create-panel h2 {
  font-family: var(--font-display);
  margin: 0 0 0.5rem;
  font-size: 1.8rem;
}

.hint {
  color: var(--muted);
  line-height: 1.6;
  margin-bottom: 1.25rem;
}

.field {
  display: grid;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.field span {
  color: var(--gold);
  font-size: 0.9rem;
}

.field input,
.field textarea {
  width: 100%;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  padding: 0.75rem 0.9rem;
  font: inherit;
  resize: vertical;
}

.field input:focus,
.field textarea:focus {
  outline: 1px solid var(--gold);
}

.preset-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin: 0.5rem 0 1.25rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.chip {
  border: 1px solid var(--line);
  background: rgba(196, 163, 90, 0.08);
  color: var(--paper);
  border-radius: 999px;
  padding: 0.35rem 0.8rem;
  font: inherit;
}

.chip:hover {
  border-color: var(--gold);
}

.create-actions {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
}

/* Game layout */
#screen-game.active {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  min-height: 100vh;
  min-height: 100dvh;
  max-height: 100vh;
  max-height: 100dvh;
  overflow: hidden;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid var(--line);
  background: rgba(18, 22, 15, 0.9);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 10;
  flex-shrink: 0;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-mark {
  font-family: var(--font-display);
  font-size: 1.15rem;
  color: var(--paper);
}

.season-pill {
  border: 1px solid var(--line);
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  letter-spacing: 0.12em;
}

.topbar-meta {
  margin-left: auto;
  display: flex;
  gap: 1rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.topbar-actions {
  display: flex;
  gap: 0.5rem;
}

.layout {
  display: grid;
  grid-template-columns: minmax(280px, 340px) 1fr;
  gap: 0;
  flex: 1;
  min-height: 0;
}

.sidebar {
  border-right: 1px solid var(--line);
  background: rgba(18, 22, 15, 0.72);
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 58px);
  min-height: calc(100dvh - 58px);
}

.sidebar-toggle {
  display: none;
}

.sidebar-toggle-meta {
  display: none;
}

.sidebar-chevron {
  display: none;
}

.sidebar-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.sidebar-sheet {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: auto;
}

.mobile-hud {
  display: none;
}

.side-tabs {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.side-tab {
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  padding: 0.85rem 0.15rem;
  font: inherit;
  font-size: 0.82rem;
}

.side-tab.active {
  color: var(--paper);
  border-bottom-color: var(--cinnabar);
}

.side-panel {
  display: none;
  padding: 1rem;
  overflow: auto;
  flex: 1;
}

.side-panel.active {
  display: block;
}

.hero-card h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.45rem;
}

.hero-title {
  margin: 0.25rem 0 0.6rem;
  color: var(--gold);
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0 0 1rem;
}

.tag {
  font-size: 0.75rem;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--paper-dim);
}

.stat-list {
  display: grid;
  gap: 0.65rem;
  margin-bottom: 1rem;
}

.stat-row {
  display: grid;
  gap: 0.25rem;
}

.stat-row header {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--muted);
}

.bar {
  height: 8px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 999px;
  overflow: hidden;
}

.bar > i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--jade), #5ea67d);
  border-radius: inherit;
}

.bar.mp > i {
  background: linear-gradient(90deg, #3a5f8a, #6fa0d0);
}

.bar.qi > i {
  background: linear-gradient(90deg, var(--cinnabar), var(--cinnabar-hot));
}

.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.stat-cell {
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(196, 163, 90, 0.18);
  border-radius: 8px;
  padding: 0.55rem 0.65rem;
}

.stat-cell span {
  display: block;
  color: var(--muted);
  font-size: 0.75rem;
}

.stat-cell strong {
  font-size: 1.05rem;
}

.side-block {
  margin-top: 0.85rem;
  padding-top: 0.85rem;
  border-top: 1px dashed rgba(196, 163, 90, 0.22);
}

.side-block h4 {
  margin: 0 0 0.35rem;
  color: var(--gold);
  font-size: 0.85rem;
  font-weight: 600;
}

.side-block p {
  margin: 0;
  color: var(--paper-dim);
  line-height: 1.55;
  font-size: 0.92rem;
}

.relation-list,
.bag-list,
.skills-list {
  display: grid;
  gap: 0.7rem;
}

.relation-card,
.bag-card,
.skill-card {
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(196, 163, 90, 0.18);
  border-radius: 10px;
  padding: 0.75rem;
}

.relation-card header,
.bag-card header,
.skill-card header {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.relation-card h4,
.bag-card h4,
.skill-card h4 {
  margin: 0;
  font-size: 1rem;
}

.relation-card .meta,
.bag-card .meta,
.skill-card .meta {
  color: var(--muted);
  font-size: 0.8rem;
}

.relation-card p,
.bag-card p,
.skill-card p {
  margin: 0.35rem 0 0;
  color: var(--paper-dim);
  font-size: 0.88rem;
  line-height: 1.5;
}

.affinity {
  height: 6px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 999px;
  margin-top: 0.5rem;
  overflow: hidden;
}

.affinity > i {
  display: block;
  height: 100%;
  background: var(--gold);
}

.skill-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.5rem;
}

.skill-card.picked {
  border-color: rgba(196, 163, 90, 0.55);
  box-shadow: inset 0 0 0 1px rgba(196, 163, 90, 0.2);
}

.combine-box {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 0.75rem;
  padding: 0.65rem 0.75rem;
  border-radius: 10px;
  background: rgba(196, 163, 90, 0.08);
  border: 1px solid var(--line);
}

.combine-hint {
  margin: 0;
  flex: 1;
  min-width: 10rem;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.45;
}

.btn.tiny.primary {
  background: linear-gradient(135deg, var(--cinnabar), #8f2d22);
  border-color: transparent;
  color: #fff7ea;
}

.bag-money {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.85rem;
  padding: 0.7rem 0.85rem;
  border-radius: 10px;
  background: rgba(196, 163, 90, 0.1);
  border: 1px solid var(--line);
}

.bag-money strong {
  color: var(--gold);
  font-size: 1.25rem;
}

.empty-hint {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.6;
}

.map-hint {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.55;
  margin: 0 0 0.75rem;
}

.world-map {
  position: relative;
  height: 200px;
  margin-bottom: 0.85rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background:
    radial-gradient(ellipse at 30% 20%, rgba(47, 107, 79, 0.18), transparent 50%),
    radial-gradient(ellipse at 80% 70%, rgba(179, 58, 43, 0.12), transparent 45%),
    linear-gradient(160deg, rgba(232, 223, 200, 0.06), rgba(0, 0, 0, 0.25));
  overflow: hidden;
}

.map-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.map-link {
  stroke-width: 0.6;
  fill: none;
}

.map-link.known {
  stroke: rgba(196, 163, 90, 0.55);
}

.map-link.fog {
  stroke: rgba(154, 163, 140, 0.15);
  stroke-dasharray: 1.5 1.5;
}

.map-node {
  position: absolute;
  transform: translate(-50%, -50%);
  background: transparent;
  border: 0;
  padding: 0;
  color: var(--paper);
  font: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  z-index: 1;
}

.map-node:disabled {
  cursor: default;
  opacity: 0.85;
}

.map-node:not(:disabled) {
  cursor: pointer;
}

.map-node:not(:disabled):hover .map-dot {
  transform: scale(1.2);
}

.map-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid rgba(18, 22, 15, 0.8);
  background: var(--gold);
  transition: transform 0.15s ease;
  box-shadow: 0 0 0 3px rgba(196, 163, 90, 0.15);
}

.map-node.here .map-dot {
  background: var(--cinnabar-hot);
  box-shadow: 0 0 0 4px rgba(179, 58, 43, 0.28);
}

.map-node.fog .map-dot {
  background: #5a6354;
  box-shadow: none;
}

.map-label {
  font-size: 0.68rem;
  white-space: nowrap;
  color: var(--paper-dim);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
  max-width: 5.5rem;
  overflow: hidden;
  text-overflow: ellipsis;
}

.map-node.here .map-label {
  color: #f0d2c8;
}

.map-list {
  display: grid;
  gap: 0.65rem;
}

.map-card {
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(196, 163, 90, 0.18);
  border-radius: 10px;
  padding: 0.75rem;
}

.map-card.here {
  border-color: rgba(179, 58, 43, 0.45);
  background: rgba(179, 58, 43, 0.08);
}

.map-card.fog {
  opacity: 0.7;
}

.map-card header {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.map-card h4 {
  margin: 0;
  font-size: 1rem;
}

.map-card .meta {
  color: var(--muted);
  font-size: 0.8rem;
}

.map-card p {
  margin: 0.35rem 0 0;
  color: var(--paper-dim);
  font-size: 0.88rem;
  line-height: 1.5;
}

.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background:
    linear-gradient(180deg, rgba(232, 223, 200, 0.03), transparent 120px),
    rgba(14, 17, 12, 0.35);
}

.story-log {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 1.25rem 1.5rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  scroll-padding-bottom: 8rem;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
}

.story-entry {
  max-width: 760px;
  line-height: 1.8;
  color: var(--paper);
  animation: fadeUp 0.35s ease;
}

.story-log > .story-entry:last-child {
  margin-bottom: 0.5rem;
  scroll-margin-bottom: 1rem;
}

.story-entry.system {
  color: var(--gold);
  font-size: 0.92rem;
}

.story-entry.combat {
  border-left: 3px solid var(--cinnabar);
  padding-left: 0.85rem;
  color: #f0d2c8;
}

.story-entry.choice-echo {
  color: var(--muted);
  font-style: italic;
}

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

/* 移动端快速推进剧情时动画缩短，避免拖沓 */
@media (max-width: 900px) {
  .story-entry {
    animation-duration: 0.18s;
  }
}

/* 尊重系统"减弱动态效果"设置 */
@media (prefers-reduced-motion: reduce) {
  .story-entry {
    animation: none;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
  }
}

.choice-bar {
  border-top: 1px solid var(--line);
  padding: 1rem 1.25rem 1.25rem;
  display: grid;
  gap: 0.65rem;
  background: rgba(18, 22, 15, 0.88);
  flex-shrink: 0;
}

.choice-btn {
  text-align: left;
  background: rgba(232, 223, 200, 0.04);
  border: 1px solid rgba(196, 163, 90, 0.28);
  color: var(--text);
  border-radius: 12px;
  padding: 0.85rem 1rem;
  font: inherit;
  line-height: 1.5;
  transition: 0.18s ease;
  overflow-wrap: break-word;
  word-break: break-word;
}

.choice-btn:hover {
  border-color: var(--gold);
  background: rgba(196, 163, 90, 0.1);
  box-shadow: inset 3px 0 0 var(--gold);
}

/* 按压反馈：只变颜色不变形，避免文字视觉错位 */
.choice-btn:active {
  background: rgba(196, 163, 90, 0.18);
  border-color: var(--gold);
}

.choice-btn .cost {
  display: block;
  margin-top: 0.25rem;
  color: var(--muted);
  font-size: 0.82rem;
}

/* Ending */
#screen-ending.active {
  display: grid;
  place-items: center;
  padding: 2rem 1rem;
}

.ending-panel {
  width: min(680px, 100%);
  background: rgba(28, 36, 24, 0.94);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 2rem;
  box-shadow: var(--shadow);
}

.ending-panel h2 {
  font-family: var(--font-display);
  font-size: 2rem;
  margin: 0.4rem 0 1rem;
}

.ending-summary {
  line-height: 1.8;
  color: var(--paper-dim);
}

.rumor-list {
  margin: 1.25rem 0 1.75rem;
  display: grid;
  gap: 0.6rem;
}

.rumor-list li,
.rumor {
  list-style: none;
  padding: 0.7rem 0.85rem;
  border-left: 3px solid var(--gold);
  background: rgba(0, 0, 0, 0.2);
  color: var(--muted);
  line-height: 1.6;
}

.ending-actions {
  display: flex;
  justify-content: flex-end;
}

@media (max-width: 900px) {
  .mobile-hud {
    display: block;
    flex-shrink: 0;
    padding: 0.45rem 0.75rem 0.55rem;
    border-bottom: 1px solid var(--line);
    background: rgba(14, 18, 12, 0.96);
    z-index: 9;
  }

  .mh-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.35rem;
  }

  .mh-identity {
    display: flex;
    align-items: baseline;
    gap: 0.45rem;
    min-width: 0;
  }

  .mh-identity strong {
    font-family: var(--font-display);
    font-size: 0.98rem;
    color: var(--paper);
  }

  .mh-sub {
    color: var(--muted);
    font-size: 0.72rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .mh-money-chip {
    display: flex;
    align-items: baseline;
    gap: 0.2rem;
    flex-shrink: 0;
    font-size: 0.72rem;
    color: var(--muted);
  }

  .mh-money-chip strong {
    color: var(--gold);
    font-size: 0.92rem;
  }

  .mh-bars {
    display: grid;
    gap: 0.22rem;
    margin-bottom: 0.4rem;
  }

  .mh-bar-row {
    display: grid;
    grid-template-columns: 1.1rem 1fr 2.8rem;
    align-items: center;
    gap: 0.35rem;
  }

  .mh-bar-label {
    font-size: 0.68rem;
    color: var(--muted);
  }

  .mh-bar-row .bar {
    height: 6px;
  }

  .mh-bar-val {
    font-size: 0.68rem;
    color: var(--paper-dim);
    text-align: right;
    font-variant-numeric: tabular-nums;
  }

  .mh-stats {
    display: flex;
    flex-wrap: nowrap;
    gap: 0.3rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 0.1rem;
  }

  .mh-stats::-webkit-scrollbar {
    display: none;
  }

  .mh-chip {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: baseline;
    gap: 0.18rem;
    padding: 0.12rem 0.4rem;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.28);
    border: 1px solid rgba(196, 163, 90, 0.18);
    font-size: 0.68rem;
    line-height: 1.2;
  }

  .mh-chip i {
    font-style: normal;
    color: var(--muted);
  }

  .mh-chip b {
    color: var(--paper);
    font-weight: 600;
  }

  .layout {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
  }

  .main {
    order: 1;
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
  }

  .sidebar {
    order: 2;
    min-height: auto;
    max-height: none;
    border-right: 0;
    border-top: 1px solid var(--line);
    background: rgba(12, 15, 10, 0.98);
    flex-shrink: 0;
  }

  .sidebar-body {
    display: flex;
    flex-direction: column;
    flex: 0 0 auto;
  }

  .sidebar-sheet {
    display: none;
    max-height: min(42dvh, 360px);
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    border-bottom: 1px solid var(--line);
    order: -1;
  }

  .sidebar.sheet-open .sidebar-sheet {
    display: block;
  }

  .side-tabs {
    order: 2;
    position: relative;
    z-index: 2;
    background: rgba(18, 22, 15, 0.98);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: env(safe-area-inset-bottom);
  }

  .side-tabs::-webkit-scrollbar {
    display: none;
  }

  .side-tab {
    min-width: 3.4rem;
    padding: 0.7rem 0.4rem;
    font-size: 0.78rem;
  }

  .side-tab.active {
    color: var(--gold);
  }

  .side-panel {
    padding: 0.75rem 0.85rem 1rem;
  }

  .topbar {
    flex-wrap: nowrap;
    gap: 0.45rem;
    padding: 0.5rem 0.7rem;
    padding-top: max(0.5rem, env(safe-area-inset-top));
  }

  .topbar-brand {
    gap: 0.35rem;
    min-width: 0;
    flex: 1;
  }

  .brand-mark {
    display: none;
  }

  .season-pill {
    font-size: 0.68rem;
    letter-spacing: 0.05em;
    padding: 0.12rem 0.4rem;
    white-space: nowrap;
  }

  .topbar-meta {
    margin-left: 0;
    width: auto;
    order: 0;
    flex: 1;
    gap: 0.45rem;
    font-size: 0.72rem;
    min-width: 0;
    justify-content: flex-end;
  }

  .topbar-meta span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 42%;
  }

  .topbar-actions {
    margin-left: 0;
    flex-shrink: 0;
  }

  .topbar-actions .btn.tiny {
    padding: 0.32rem 0.55rem;
    font-size: 0.75rem;
  }

  .story-log {
    padding: 0.75rem 0.85rem 0.6rem;
    gap: 0.65rem;
    scroll-padding-bottom: 12rem;
  }

  .story-spacer {
    flex-shrink: 0;
    pointer-events: none;
  }

  .story-entry {
    font-size: 0.92rem;
    line-height: 1.7;
  }

  .choice-bar {
    padding: 0.65rem 0.75rem;
    gap: 0.45rem;
    position: sticky;
    bottom: 0;
    z-index: 5;
  }

  .choice-btn {
    padding: 0.8rem 0.85rem;
    min-height: 44px;
    border-radius: 12px;
    font-size: 0.9rem;
    -webkit-tap-highlight-color: transparent;
  }

  .choice-btn:hover {
    transform: none;
  }

  .choice-btn:active {
    background: rgba(196, 163, 90, 0.16);
    border-color: var(--gold);
  }

  .world-map {
    height: 150px;
  }

  .map-label {
    font-size: 0.62rem;
    max-width: 4.2rem;
  }

  .title-panel {
    padding: 1.25rem 1rem;
  }

  .title-brand {
    font-size: clamp(2.4rem, 12vw, 3.4rem);
  }

  .create-panel,
  .ending-panel {
    padding: 1.25rem;
    border-radius: 14px;
  }

  .create-actions {
    flex-direction: column-reverse;
  }

  .create-actions .btn,
  .ending-actions .btn,
  .title-actions .btn {
    width: 100%;
    min-height: 48px;
  }

  .preset-row {
    gap: 0.4rem;
  }

  .chip {
    min-height: 36px;
  }

  .field input,
  .field textarea {
    font-size: 16px;
  }

  #panel-stats .stat-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.35rem;
  }

  #panel-stats .stat-cell {
    padding: 0.4rem 0.45rem;
  }

  #panel-stats .stat-cell strong {
    font-size: 0.95rem;
  }
}

@media (max-width: 480px) {
  .topbar-meta span:last-child {
    max-width: 36%;
  }

  .map-node .map-label {
    display: none;
  }

  .map-node.here .map-label {
    display: block;
  }
}

@media (min-width: 901px) {
  .mobile-hud {
    display: none !important;
  }

  .sidebar-body {
    display: flex !important;
    flex-direction: column;
    flex: 1;
    min-height: 0;
  }

  .sidebar-sheet {
    display: flex !important;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: auto;
  }

  .sidebar-body .side-tabs {
    flex-shrink: 0;
  }

  .sidebar-sheet .side-panel.active {
    flex: 1;
    overflow: auto;
  }
}

/* ============ 体验优化：移动端与阅读舒适度 ============ */
button,
.btn,
.choice-btn,
.side-tab,
.map-node,
.chip {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}

/* 选项过多时可滚动，避免占满整屏 */
.choice-bar {
  max-height: 40dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
  -ms-overflow-style: none;
  flex-shrink: 0;
}

.choice-bar::-webkit-scrollbar {
  display: none;
}

/* 桌面端：正文与选项限宽居中，读起来更舒服 */
@media (min-width: 901px) {
  .story-log {
    align-items: center;
  }

  .story-log > .story-entry {
    width: 100%;
  }

  .choice-bar {
    max-width: 760px;
    margin: 0 auto;
    width: 100%;
  }
}

@media (max-width: 900px) {
  /* 底部选项栏贴底时留出安全区 */
  .choice-bar {
    padding-bottom: max(0.65rem, env(safe-area-inset-bottom));
  }

  /* 侧边面板更高一些，信息可见性更好 */
  .sidebar-sheet {
    max-height: min(56dvh, 420px);
  }

  /* 移动端正文略放大，夜间阅读更轻松 */
  .story-entry {
    font-size: 0.96rem;
  }

  .choice-btn {
    min-height: 46px;
  }
}

@media (max-width: 480px) {
  .topbar {
    padding-left: 0.6rem;
    padding-right: 0.6rem;
  }

  .topbar-meta {
    gap: 0.3rem;
    font-size: 0.68rem;
  }

  .topbar-actions .btn.tiny {
    padding: 0.28rem 0.42rem;
    font-size: 0.7rem;
  }

  .choice-btn {
    min-height: 48px;
    padding: 0.78rem 0.8rem;
  }

  /* 小屏下创建屏预设按钮贴满一行 */
  .preset-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.45rem;
  }

  .preset-row > span {
    grid-column: 1 / -1;
  }
}
