:root {
  --bg: #070611;
  --bg-deep: #03030a;
  --panel: rgba(18, 15, 34, 0.78);
  --panel-strong: rgba(18, 15, 34, 0.96);
  --panel-soft: rgba(34, 28, 60, 0.78);
  --line: rgba(255, 255, 255, 0.12);
  --line-soft: rgba(255, 255, 255, 0.08);
  --text: rgba(255, 255, 255, 0.94);
  --soft: rgba(255, 255, 255, 0.68);
  --muted: rgba(255, 255, 255, 0.46);
  --violet: #9b7cff;
  --violet-strong: #7b5cff;
  --pink: #f27bb8;
  --blue: #87d8ff;
  --gold: #e6c27a;
  --danger: #ff8da3;
  --read-bg: rgba(31, 26, 57, 0.86);
  --read-bg-soft: rgba(13, 11, 28, 0.58);
  --read-user-bg: linear-gradient(135deg, rgba(116, 87, 255, 0.94), rgba(156, 124, 255, 0.88));
  --read-text: rgba(238, 232, 255, 0.92);
  --read-dialogue: rgba(255, 242, 255, 0.98);
  --read-choice: rgba(178, 168, 205, 0.78);
  --read-border: rgba(255, 255, 255, 0.08);
  --input-bg: rgba(22, 18, 41, 0.98);
  --font-size: 16px;
  --fantasy-font: "山海魔法精灵w", "Ma Shan Zheng", "STKaiti", "KaiTi", "Songti SC", "PingFang SC", serif;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {

  margin: 0;

  min-height: 100svh;

  background: var(--bg);

  color: var(--text);

  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Noto Sans SC", "Microsoft YaHei", sans-serif;

  font-size: var(--font-size);

  overflow-x: hidden;

  -webkit-overflow-scrolling: touch;

  -webkit-font-smoothing: antialiased;

  transition: background 0.18s ease, color 0.18s ease;

}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  border: 0;
  color: inherit;
  cursor: pointer;
}

img {
  display: block;
  max-width: 100%;
}

.story-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 0%, rgba(155, 124, 255, 0.26), transparent 34%),
    radial-gradient(circle at 14% 25%, rgba(242, 123, 184, 0.16), transparent 30%),
    radial-gradient(circle at 86% 72%, rgba(95, 215, 255, 0.1), transparent 34%),
    linear-gradient(180deg, #0b0920 0%, #070611 48%, #05040c 100%);
}

.bg-orb {
  position: absolute;
  border-radius: 999px;
  filter: blur(46px);
  opacity: 0.42;
  pointer-events: none;
}

.bg-orb-pink {
  width: 240px;
  height: 240px;
  left: -86px;
  top: 130px;
  background: rgba(242, 123, 184, 0.18);
}

.bg-orb-blue {
  width: 260px;
  height: 260px;
  right: -110px;
  bottom: 180px;
  background: rgba(135, 216, 255, 0.12);
}

.bg-grid {
  position: absolute;
  inset: 0;
  opacity: 0.035;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.14) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.14) 1px, transparent 1px);
  background-size: 42px 42px;
}

.story-app {
  width: min(100%, 480px);
  min-height: 100svh;
  margin: 0 auto;
  position: relative;
}

/* 顶部 */

.story-header {
  position: sticky;
  top: 0;
  z-index: 120;
  display: grid;
  grid-template-columns: 52px 1fr 52px;
  align-items: center;
  gap: 12px;
  padding: calc(env(safe-area-inset-top, 0px) + 14px) 16px 10px;
  background: linear-gradient(
    180deg,
    rgba(7, 6, 17, 0.98) 0%,
    rgba(7, 6, 17, 0.88) 72%,
    rgba(7, 6, 17, 0) 100%
  );
}

.header-icon {
  width: 52px;
  height: 52px;
  border-radius: 20px;
  display: grid;
  place-items: center;
  background: rgba(24, 20, 45, 0.86);
  border: 1px solid var(--line);
  color: rgba(255, 255, 255, 0.92);
  font-size: 31px;
  line-height: 1;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.24);
}

.persona-entry {
  font-size: 23px;
  color: #ffd6ec;
  text-shadow: 0 0 14px rgba(242, 123, 184, 0.34);
}

.story-title-pill {
  min-width: 0;
  height: 52px;
  padding: 0 14px;
  border-radius: 20px;
  display: grid;
  align-content: center;
  text-align: center;
  background: rgba(24, 20, 45, 0.72);
  border: 1px solid var(--line);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.2);
}

.story-title-pill span {
  display: block;
  min-width: 0;
  font-family: var(--fantasy-font);
  color: #ffd6ec;
  font-size: 19px;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.story-title-pill small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.14em;
}

/* 右上角人设菜单 */

.persona-menu {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 80px);
  right: max(16px, calc((100vw - 480px) / 2 + 16px));
  z-index: 240;
  width: 205px;
  padding: 10px;
  border-radius: 24px;
  background: rgba(13, 11, 28, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.11);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.42);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-8px) scale(0.98);
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.persona-menu.show {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.persona-menu-item {
  width: 100%;
  min-height: 58px;
  margin: 0 0 9px;
  padding: 10px 14px;
  border-radius: 18px;
  display: grid;
  gap: 3px;
  text-align: left;
  background: rgba(40, 32, 72, 0.9);
}

.persona-menu-item:last-child {
  margin-bottom: 0;
}

.persona-menu-item span {
  color: rgba(255, 255, 255, 0.94);
  font-size: 15px;
  font-weight: 700;
}

.persona-menu-item small {
  color: var(--muted);
  font-size: 11px;
}

/* 主内容 */

.story-main {
  padding: 6px 16px calc(104px + env(safe-area-inset-bottom, 0px));
}

/* 封面 */

.hero-card {
  overflow: hidden;
  border-radius: 28px;
  background: rgba(18, 15, 34, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.11);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.24);
}

.hero-cover {
  position: relative;
  height: 250px;
  overflow: hidden;
  background: #100c20;
}

.hero-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 18%;
}

.hero-shade {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(7, 6, 17, 0.04) 0%, rgba(7, 6, 17, 0.16) 38%, rgba(7, 6, 17, 0.92) 100%),
    radial-gradient(circle at 50% 74%, rgba(242, 123, 184, 0.2), transparent 40%);
}

.hero-info {
  padding: 16px 18px 18px;
  background: rgba(18, 15, 34, 0.92);
}

.hero-kicker {
  margin: 0 0 8px;
  font-size: 11px;
  letter-spacing: 0.22em;
  color: rgba(255, 218, 239, 0.62);
}

.hero-info h1 {
  margin: 0 0 12px;
  font-family: var(--fantasy-font);
  color: #ffd6ec;
  font-size: 28px;
  line-height: 1.1;
}

.hero-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.hero-tags span {
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(39, 32, 70, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--soft);
  font-size: 12px;
}

/* 状态小卡 */

.mini-status {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-top: 12px;
}

.status-chip {
  width: 100%;
  min-height: 62px;
  padding: 12px 15px;
  border-radius: 21px;
  text-align: left;
  background: rgba(24, 20, 45, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.09);
}

.status-chip small {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 12px;
}

.status-chip strong {
  display: block;
  color: rgba(255, 255, 255, 0.94);
  font-size: 15px;
}

/* 折叠区 */

.fold-section {
  margin-top: 12px;
  padding: 16px;
  border-radius: 26px;
  background: rgba(18, 15, 34, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.fold-section.compact {
  padding-bottom: 14px;
}

.fold-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.fold-head p,
.scene-head p {
  margin: 0 0 6px;
  color: rgba(218, 209, 255, 0.58);
  font-size: 11px;
  letter-spacing: 0.23em;
}

.fold-head h2,
.scene-head h2 {
  margin: 0;
  color: #ffe5f3;
  font-family: var(--fantasy-font);
  font-size: 21px;
  line-height: 1.18;
}

.fold-btn {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(50, 40, 87, 0.76);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--soft);
  font-size: 12px;
}

.fold-body {
  margin-top: 14px;
}

.readable-text {
  color: rgba(255, 255, 255, 0.78);
  line-height: 1.78;
}

.readable-text p {
  margin: 0 0 12px;
}

.readable-text p:last-child {
  margin-bottom: 0;
}

.fold-section.is-collapsed .fold-body,
.fold-section.is-collapsed .character-strip {
  display: none;
}

/* 人物小卡 */

.character-strip {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  margin-top: 14px;
  padding-bottom: 2px;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}

.mini-character-card {
  flex: 0 0 108px;
  min-height: 132px;
  padding: 9px;
  border-radius: 20px;
  background: rgba(30, 25, 56, 0.76);
  border: 1px solid rgba(255, 255, 255, 0.1);
  text-align: left;
  scroll-snap-align: start;
}

.mini-character-art {
  height: 64px;
  border-radius: 16px;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.mini-character-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.mini-character-art.sigil {
  font-family: var(--fantasy-font);
  font-size: 27px;
  color: #ffd6ec;
  text-shadow: 0 0 12px rgba(242, 123, 184, 0.28);
}

.mini-character-card strong {
  display: block;
  margin-top: 8px;
  color: #ffd6ec;
  font-size: 13px;
  line-height: 1.2;
}

.mini-character-card small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.25;
}

/* 第一幕 */

.scene-strip {
  margin-top: 14px;
}

.scene-head {
  display: flex;
  flex-direction: column;
  padding: 0 2px;
}

.scene-text {

  margin-top: 12px;

  padding: 15px;

  border-radius: 24px;

  background: var(--read-bg-soft);

  border: 1px solid var(--read-border);

  color: var(--read-text);

  line-height: 1.76;

}

.scene-text p {
  margin: 0 0 10px;
}

.scene-text p:last-child {
  margin-bottom: 0;
}

.quick-actions {
  display: flex;
  gap: 9px;
  overflow-x: auto;
  margin-top: 12px;
  padding-bottom: 2px;
  -webkit-overflow-scrolling: touch;
}

.quick-actions button {
  flex: 0 0 auto;
  min-height: 38px;
  padding: 0 13px;
  border-radius: 999px;
  background: rgba(50, 40, 87, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.82);
  font-size: 13px;
}

/* 聊天流：不放大框 */

.chat-flow {
  margin-top: 16px;
}

.chat-list {
  display: grid;
  gap: 12px;
}

.message {
  max-width: 86%;
  padding: 12px 14px;
  border-radius: 20px;
  line-height: 1.64;
  font-size: 0.98em;
  word-break: break-word;
}

.message p {
  margin: 0;
}

.message.world {

  justify-self: start;

  max-width: min(92%, 420px);

  background: var(--read-bg);

  border: 1px solid var(--read-border);

  color: var(--read-text);

  border-bottom-left-radius: 7px;

  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.14);

}

.message.user {

  justify-self: end;

  max-width: min(88%, 390px);

  background: var(--read-user-bg);

  color: #fff;

  border-bottom-right-radius: 7px;

  box-shadow: 0 8px 20px rgba(70, 48, 160, 0.18);

}

/* 输入栏：轻，不套大框 */

.input-dock {
  position: fixed;
  left: 50%;
  bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  z-index: 170;
  width: min(calc(100% - 22px), 480px);
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  gap: 8px;
  align-items: center;
  padding: 0;
  pointer-events: auto;
}

.dock-symbol {
  width: 44px;
  height: 44px;
  border-radius: 17px;
  display: grid;
  place-items: center;
  background: rgba(28, 23, 52, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #d8c8ff;
  font-size: 20px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.28);
}

.input-form {
  height: 46px;
  display: grid;
  grid-template-columns: 1fr 58px;
  gap: 8px;
}

.input-form input {

  width: 100%;

  height: 46px;

  border-radius: 17px;

  border: 1px solid var(--line);

  outline: none;

  padding: 0 14px;

  background: var(--input-bg);

  color: var(--text);

  font-size: 15px;

  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.16);

}

.input-form input::placeholder {

  color: var(--muted);

}

.input-form button {
  height: 46px;
  border-radius: 17px;
  background: linear-gradient(135deg, #7357ff, #a18aff);
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  box-shadow: 0 10px 24px rgba(83, 61, 210, 0.3);
}

/* 左右快捷面板 */

.quick-panel {
  position: fixed;
  z-index: 165;
  bottom: calc(64px + env(safe-area-inset-bottom, 0px));
  padding: 8px;
  border-radius: 20px;
  display: flex;
  gap: 6px;
  background: rgba(13, 11, 28, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.32);
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.quick-panel.show {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.quick-panel.left {
  left: max(12px, calc((100vw - 480px) / 2 + 12px));
}

.quick-panel.right {
  right: max(12px, calc((100vw - 480px) / 2 + 12px));
}

.quick-panel button {
  min-width: 54px;
  height: 48px;
  padding: 5px 8px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  gap: 2px;
  background: rgba(40, 32, 72, 0.86);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.quick-panel b {
  display: block;
  color: #d8c8ff;
  font-size: 14px;
  line-height: 1;
  font-weight: 700;
}

.quick-panel span {
  display: block;
  color: var(--soft);
  font-size: 11px;
  line-height: 1;
  white-space: nowrap;
}

/* 弹窗 */

.modal-layer {
  position: fixed;
  inset: 0;
  z-index: 320;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 16px;
  background: rgba(5, 4, 12, 0.72);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.16s ease;
}

.modal-layer.show {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  position: relative;
  width: min(100%, 430px);
  max-height: 82svh;
  overflow-y: auto;
  padding: 18px;
  border-radius: 28px;
  background: rgba(16, 13, 31, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 22px 42px rgba(0, 0, 0, 0.38);
  -webkit-overflow-scrolling: touch;
}

.modal-close {
  position: absolute;
  top: 13px;
  right: 13px;
  width: 38px;
  height: 38px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.08);
  font-size: 24px;
}

.modal-eyebrow {
  margin: 0 44px 8px 0;
  color: rgba(215, 203, 255, 0.72);
  font-size: 12px;
  letter-spacing: 0.18em;
}

.modal-title {
  margin: 0 44px 14px 0;
  color: #fff;
  font-size: 22px;
  line-height: 1.22;
  font-weight: 800;
}

.modal-content {
  color: rgba(255, 255, 255, 0.78);
}

/* 弹窗内容 */

.role-profile {
  display: grid;
  grid-template-columns: 98px 1fr;
  gap: 14px;
  align-items: start;
}

.role-big-portrait {
  height: 120px;
  border-radius: 22px;
  display: grid;
  place-items: center;
  overflow: hidden;
  font-family: var(--fantasy-font);
  font-size: 42px;
  color: var(--role-color);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.role-big-portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.role-facts {
  display: grid;
  gap: 8px;
}

.role-facts p {
  margin: 0;
  line-height: 1.45;
  font-size: 14px;
}

.role-facts span {
  color: var(--muted);
}

.role-desc {
  margin: 14px 0 0;
  line-height: 1.7;
}

/* 表单与选项 */

.identity-form {
  display: grid;
  gap: 11px;
}

.identity-form label {
  display: grid;
  gap: 6px;
  color: var(--soft);
  font-size: 13px;
}

.identity-form input,
.identity-form select,
.identity-form textarea {
  width: 100%;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  outline: none;
  background: rgba(27, 23, 48, 0.96);
  color: #fff;
  padding: 12px 13px;
}

.identity-form textarea {
  min-height: 76px;
  resize: vertical;
}

.option-list {
  display: grid;
  gap: 10px;
}

.option-btn {
  width: 100%;
  padding: 13px 14px;
  border-radius: 18px;
  background: rgba(34, 28, 60, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.1);
  text-align: left;
}

.option-btn.active {
  border-color: rgba(175, 151, 255, 0.95);
  box-shadow: inset 0 0 0 1px rgba(175, 151, 255, 0.42);
}

.option-btn strong {
  display: block;
  margin-bottom: 5px;
  color: #fff;
}

.option-btn span {
  display: block;
  color: var(--soft);
  font-size: 13px;
  line-height: 1.5;
}

.primary-btn,
.danger-btn {
  min-height: 48px;
  border-radius: 17px;
  padding: 0 16px;
  color: #fff;
  font-weight: 800;
}

.primary-btn {
  background: linear-gradient(135deg, #7357ff, #a18aff);
}

.danger-btn {
  background: rgba(119, 40, 54, 0.96);
}

/* 星图 */

.map-layer {
  position: relative;
  width: 100%;
  height: min(62vh, 520px);
  min-height: 430px;
  border-radius: 24px;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 72%, rgba(122, 95, 255, 0.18), transparent 38%),
    radial-gradient(circle at 72% 16%, rgba(255, 141, 163, 0.08), transparent 28%),
    radial-gradient(circle at 18% 78%, rgba(135, 216, 255, 0.07), transparent 30%),
    rgba(8, 7, 18, 0.48);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

/* 地图连接线：整体变淡，不抢节点 */
.star-line {
  position: absolute;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(205, 190, 255, 0.26),
    transparent
  );
  transform-origin: left center;
  opacity: 0.38;
}

/* 所有地点格子：缩小 */
.star-node {
  position: absolute;
  width: 78px;
  min-height: 50px;
  padding: 7px 5px;
  border-radius: 15px;
  background: rgba(27, 22, 50, 0.86);
  border: 1px solid rgba(255, 255, 255, 0.1);
  text-align: center;
  font-size: 12px;
  backdrop-filter: blur(10px);
}

.star-node strong {
  display: block;
  margin-bottom: 4px;
  color: rgba(255, 255, 255, 0.92);
  font-size: 11px;
  line-height: 1.18;
  font-weight: 800;
}

.star-node span {
  display: block;
  color: rgba(255, 255, 255, 0.58);
  font-size: 10px;
  line-height: 1.12;
}

/* 当前所在位置：最亮 */
.star-node.current {
  opacity: 1;
  border-color: rgba(255, 236, 160, 0.9);
  background: rgba(54, 42, 88, 0.98);
  box-shadow:
    0 0 0 1px rgba(255, 236, 160, 0.22),
    0 0 26px rgba(255, 216, 112, 0.34),
    inset 0 0 16px rgba(255, 236, 160, 0.08);
}

.star-node.current strong {
  color: rgba(255, 246, 205, 0.98);
}

.star-node.current span {
  color: rgba(255, 236, 160, 0.98);
}

/* 已走过 / 已解锁地点：亮，但不抢当前位置 */
.star-node.unlocked {
  opacity: 1;
  border-color: rgba(170, 150, 255, 0.48);
  background: rgba(35, 29, 65, 0.9);
  box-shadow:
    0 0 15px rgba(159, 130, 255, 0.2),
    inset 0 0 12px rgba(170, 150, 255, 0.06);
}

.star-node.unlocked strong {
  color: rgba(255, 255, 255, 0.94);
}

/* 危险地点：走过后会偏红 */
.star-node.danger {
  opacity: 1;
  border-color: rgba(255, 141, 163, 0.5);
  background: rgba(50, 25, 42, 0.9);
  box-shadow:
    0 0 16px rgba(255, 90, 112, 0.22),
    inset 0 0 12px rgba(255, 90, 112, 0.07);
}

.star-node.danger strong {
  color: rgba(255, 222, 229, 0.96);
}

/* 记忆地点：走过后偏金色 */
.star-node.memory {
  opacity: 1;
  border-color: rgba(230, 194, 122, 0.56);
  background: rgba(48, 39, 25, 0.9);
  box-shadow:
    0 0 16px rgba(230, 194, 122, 0.22),
    inset 0 0 12px rgba(230, 194, 122, 0.07);
}

.star-node.memory strong {
  color: rgba(255, 236, 190, 0.96);
}

/* 锁着的地方：明显暗，不亮 */
.star-node.locked {
  opacity: 0.28;
  background: rgba(16, 13, 30, 0.72);
  border-color: rgba(255, 255, 255, 0.07);
  box-shadow: none;
  filter: saturate(0.45);
}

.star-node.locked strong {
  color: rgba(255, 255, 255, 0.52);
}

.star-node.locked span {
  color: rgba(255, 255, 255, 0.36);
}

/* 重要但锁着的地方：看得到，但还是锁着，不发光 */
.star-node.important.locked,
.star-node.locked.important {
  opacity: 0.42;
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(22, 18, 38, 0.78);
}

.star-node.important.locked strong,
.star-node.locked.important strong {
  color: rgba(255, 255, 255, 0.64);
}

/* 手机小屏再缩一点 */
@media (max-width: 480px) {
  .map-layer {
    height: 520px;
  }

  .star-node {
    width: 72px;
    min-height: 48px;
    padding: 6px 5px;
    border-radius: 14px;
  }

  .star-node strong {
    font-size: 10.5px;
  }

  .star-node span {
    font-size: 9.5px;
  }
}

@media (max-width: 380px) {
  .star-node {
    width: 68px;
    min-height: 46px;
  }

  .star-node strong {
    font-size: 10px;
  }

  .star-node span {
    font-size: 9px;
  }
}

/* 记忆 */

.memory-list {
  display: grid;
  gap: 12px;
}

.memory-card {
  padding: 14px;
  border-radius: 19px;
  background: rgba(31, 26, 57, 0.84);
  border: 1px solid rgba(255, 255, 255, 0.09);
}

.memory-card strong {
  display: block;
  margin-bottom: 8px;
  color: #ffe5f3;
}

.memory-card p {
  margin: 0;
  color: var(--soft);
  line-height: 1.7;
}

/* 提示 */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(78px + env(safe-area-inset-bottom, 0px));
  z-index: 360;
  max-width: calc(100vw - 42px);
  padding: 11px 15px;
  border-radius: 999px;
  background: rgba(25, 20, 48, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 13px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(16px);
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* 字体大小 */

body.font-tiny {

  --font-size: 13px;

}

body.font-small {

  --font-size: 14.5px;

}

body.font-medium {

  --font-size: 16px;

}

body.font-large {

  --font-size: 18px;

}

body.font-huge {

  --font-size: 20px;

}

body.font-tiny .message,

body.font-tiny .readable-text,

body.font-tiny .scene-text {

  line-height: 1.72;

}

body.font-small .message,

body.font-small .readable-text,

body.font-small .scene-text {

  line-height: 1.76;

}

body.font-medium .message,

body.font-medium .readable-text,

body.font-medium .scene-text {

  line-height: 1.82;

}

body.font-large .message,

body.font-large .readable-text,

body.font-large .scene-text,

body.font-huge .message,

body.font-huge .readable-text,

body.font-huge .scene-text {

  line-height: 1.9;

}

/* 亮度主题 */

body.brightness-night {

  --bg: #070611;

  --bg-deep: #03030a;

  --panel: rgba(18, 15, 34, 0.78);

  --panel-strong: rgba(18, 15, 34, 0.96);

  --panel-soft: rgba(34, 28, 60, 0.78);

  --line: rgba(255, 255, 255, 0.12);

  --line-soft: rgba(255, 255, 255, 0.08);

  --text: rgba(255, 255, 255, 0.94);

  --soft: rgba(255, 255, 255, 0.68);

  --muted: rgba(255, 255, 255, 0.46);

  --read-bg: rgba(31, 26, 57, 0.86);

  --read-bg-soft: rgba(13, 11, 28, 0.58);

  --read-user-bg: linear-gradient(135deg, rgba(116, 87, 255, 0.94), rgba(156, 124, 255, 0.88));

  --read-text: rgba(238, 232, 255, 0.92);

  --read-dialogue: rgba(255, 242, 255, 0.98);

  --read-choice: rgba(178, 168, 205, 0.78);

  --read-border: rgba(255, 255, 255, 0.08);

  --input-bg: rgba(22, 18, 41, 0.98);

}

body.brightness-mist {

  --bg: #151323;

  --bg-deep: #0f0d1a;

  --panel: rgba(39, 36, 58, 0.82);

  --panel-strong: rgba(39, 36, 58, 0.96);

  --panel-soft: rgba(58, 53, 80, 0.78);

  --line: rgba(255, 255, 255, 0.16);

  --line-soft: rgba(255, 255, 255, 0.11);

  --text: rgba(255, 255, 255, 0.94);

  --soft: rgba(245, 240, 255, 0.74);

  --muted: rgba(245, 240, 255, 0.56);

  --read-bg: rgba(51, 47, 72, 0.9);

  --read-bg-soft: rgba(44, 40, 62, 0.72);

  --read-user-bg: linear-gradient(135deg, rgba(124, 104, 218, 0.9), rgba(164, 143, 238, 0.84));

  --read-text: rgba(250, 247, 255, 0.94);

  --read-dialogue: rgba(255, 250, 255, 0.98);

  --read-choice: rgba(222, 214, 240, 0.82);

  --read-border: rgba(255, 255, 255, 0.13);

  --input-bg: rgba(46, 42, 64, 0.98);

}

body.brightness-parchment {

  --bg: #efe2c6;

  --bg-deep: #d9c59b;

  --panel: rgba(255, 247, 226, 0.84);

  --panel-strong: rgba(255, 248, 230, 0.98);

  --panel-soft: rgba(247, 232, 199, 0.82);

  --line: rgba(88, 61, 28, 0.16);

  --line-soft: rgba(88, 61, 28, 0.1);

  --text: rgba(48, 34, 22, 0.94);

  --soft: rgba(70, 52, 34, 0.74);

  --muted: rgba(92, 70, 46, 0.56);

  --read-bg: rgba(255, 249, 232, 0.96);

  --read-bg-soft: rgba(249, 238, 211, 0.78);

  --read-user-bg: linear-gradient(135deg, rgba(133, 89, 54, 0.88), rgba(174, 126, 74, 0.84));

  --read-text: rgba(53, 38, 24, 0.94);

  --read-dialogue: rgba(38, 27, 18, 0.98);

  --read-choice: rgba(98, 75, 50, 0.76);

  --read-border: rgba(98, 75, 50, 0.15);

  --input-bg: rgba(255, 249, 232, 0.98);

  --violet: #8b6748;

  --violet-strong: #755238;

  --pink: #b77a65;

  --blue: #6b8a9b;

  --gold: #a9783f;

}

body.brightness-moon {

  --bg: #f4f1ff;

  --bg-deep: #e4def6;

  --panel: rgba(255, 255, 255, 0.84);

  --panel-strong: rgba(255, 255, 255, 0.98);

  --panel-soft: rgba(235, 229, 250, 0.82);

  --line: rgba(66, 49, 118, 0.14);

  --line-soft: rgba(66, 49, 118, 0.09);

  --text: rgba(34, 29, 54, 0.94);

  --soft: rgba(55, 47, 82, 0.72);

  --muted: rgba(82, 73, 112, 0.54);

  --read-bg: rgba(255, 255, 255, 0.96);

  --read-bg-soft: rgba(242, 238, 255, 0.78);

  --read-user-bg: linear-gradient(135deg, rgba(111, 93, 213, 0.9), rgba(151, 133, 232, 0.84));

  --read-text: rgba(38, 32, 58, 0.94);

  --read-dialogue: rgba(24, 19, 42, 0.98);

  --read-choice: rgba(80, 70, 110, 0.76);

  --read-border: rgba(80, 70, 110, 0.14);

  --input-bg: rgba(255, 255, 255, 0.98);

}

body.brightness-mist .story-bg,

body.brightness-parchment .story-bg,

body.brightness-moon .story-bg {

  background:

    radial-gradient(circle at 50% 0%, rgba(155, 124, 255, 0.16), transparent 34%),

    radial-gradient(circle at 14% 25%, rgba(242, 123, 184, 0.1), transparent 30%),

    linear-gradient(180deg, var(--bg) 0%, var(--bg-deep) 100%);

}

body.brightness-parchment .bg-orb,

body.brightness-moon .bg-orb,

body.brightness-parchment .bg-grid,

body.brightness-moon .bg-grid {

  opacity: 0.08;

/* 流畅模式：减少动画、阴影和背景负担 */

body.smooth-mode * {
  animation: none !important;
  transition: none !important;
  scroll-behavior: auto !important;
}

body.smooth-mode .bg-orb,
body.smooth-mode .bg-grid {
  display: none !important;
}

body.smooth-mode .story-bg {
  background:
    linear-gradient(180deg, #0b0920 0%, #070611 48%, #05040c 100%) !important;
}

body.smooth-mode .hero-card,
body.smooth-mode .story-title-pill,
body.smooth-mode .header-icon,
body.smooth-mode .persona-menu,
body.smooth-mode .persona-menu-item,
body.smooth-mode .status-chip,
body.smooth-mode .fold-section,
body.smooth-mode .mini-character-card,
body.smooth-mode .mini-character-art,
body.smooth-mode .scene-text,
body.smooth-mode .quick-actions button,
body.smooth-mode .message,
body.smooth-mode .dock-symbol,
body.smooth-mode .input-form input,
body.smooth-mode .input-form button,
body.smooth-mode .quick-panel,
body.smooth-mode .quick-panel button,
body.smooth-mode .modal-card,
body.smooth-mode .modal-close,
body.smooth-mode .option-btn,
body.smooth-mode .memory-card,
body.smooth-mode .toast {
  box-shadow: none !important;
}

body.smooth-mode .modal-layer {
  background: rgba(5, 4, 12, 0.82) !important;
}

body.smooth-mode .modal-card,
body.smooth-mode .persona-menu,
body.smooth-mode .quick-panel {
  background: rgba(16, 13, 31, 0.98) !important;
}

/* 小屏幕 */

@media (max-width: 380px) {
  .story-main {
    padding-left: 14px;
    padding-right: 14px;
  }

  .hero-cover {
    height: 220px;
  }

  .hero-info h1 {
    font-size: 25px;
  }

  .input-dock {
    width: calc(100% - 18px);
    grid-template-columns: 42px 1fr 42px;
    gap: 7px;
  }

  .dock-symbol {
    width: 42px;
    height: 42px;
  }

  .input-form {
    height: 44px;
    grid-template-columns: 1fr 54px;
    gap: 7px;
  }

  .input-form input,
  .input-form button {
    height: 44px;
  }

  .quick-panel button {
    min-width: 50px;
  }

  .role-profile {
    grid-template-columns: 1fr;
  }
}

/* 强制修复：隐藏层不能挡住页面点击 */
#modalLayer:not(.show),
.modal-layer:not(.show),
#menuPanel:not(.show),
.persona-menu:not(.show),
#leftPanel:not(.show),
#rightPanel:not(.show),
.quick-panel:not(.show) {
opacity: 0 !important;
pointer-events: none !important;
visibility: hidden !important;
}

/* 显示时才允许点击 */
#modalLayer.show,
.modal-layer.show,
#menuPanel.show,
.persona-menu.show,
#leftPanel.show,
#rightPanel.show,
.quick-panel.show {
visibility: visible !important;
pointer-events: auto !important;
}

/* 确保真正按钮可以触摸 */
button,
input,
textarea,
select,
a,
#inputForm,
.input-form,
#userInput,
#sendBtn,
#quickActions,
.quick-actions,
#quickActions button,
.quick-actions button,
.mini-character-card,
.option-btn,
.status-chip,
.fold-btn,
.dock-symbol {
touch-action: manipulation;
}

/* 输入栏必须在普通内容上面 */
.input-dock,
#inputForm {
z-index: 260 !important;
pointer-events: auto !important;
}

#sendBtn,
#userInput {
pointer-events: auto !important;
}

.message.world {

  color: var(--read-text);

}

.fta-reply-p {
  margin: 0 0 14px;
  line-height: 1.82;
  letter-spacing: 0.02em;
  white-space: pre-wrap;
}

.fta-reply-p:last-child {
  margin-bottom: 0;
}

.fta-reply-narration {

  color: var(--read-text);

}

.fta-reply-dialogue {

  color: var(--read-dialogue);

  text-shadow: 0 0 10px rgba(190, 130, 255, 0.12);

}

.fta-reply-choice {

  margin-top: 18px;

  padding-top: 12px;

  color: var(--read-choice);

  border-top: 1px solid var(--read-border);

  font-size: 0.95em;

}

.message.world {
  line-height: 1.78;
}

.message.world .fta-reply-p {
  margin: 0 0 14px;
}

.message.world .fta-reply-p:last-child {
  margin-bottom: 0;
}

.message.world .fta-reply-dialogue {
  margin-top: 12px;
  margin-bottom: 14px;
}

.message.world .fta-reply-narration {
  opacity: 0.96;
}

.message.world .fta-reply-choice {
  margin-top: 16px;
  opacity: 0.9;
}

/* 浅色阅读主题细节修正 */

body.brightness-parchment .story-header,
body.brightness-moon .story-header {
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--bg) 92%, white 8%) 0%,
    color-mix(in srgb, var(--bg) 76%, transparent 24%) 72%,
    rgba(255, 255, 255, 0) 100%
  );
}

body.brightness-parchment .header-icon,
body.brightness-parchment .story-title-pill,
body.brightness-parchment .dock-symbol,
body.brightness-parchment .quick-panel,
body.brightness-parchment .modal-card,
body.brightness-moon .header-icon,
body.brightness-moon .story-title-pill,
body.brightness-moon .dock-symbol,
body.brightness-moon .quick-panel,
body.brightness-moon .modal-card {
  background: var(--panel-strong);
  color: var(--text);
  border-color: var(--line);
}

body.brightness-parchment .hero-info,
body.brightness-moon .hero-info {
  background: var(--panel-strong);
}

body.brightness-parchment .story-title-pill span,
body.brightness-parchment .hero-info h1,
body.brightness-parchment .fold-head h2,
body.brightness-parchment .scene-head h2,
body.brightness-parchment .mini-character-card strong,
body.brightness-parchment .memory-card strong,
body.brightness-moon .story-title-pill span,
body.brightness-moon .hero-info h1,
body.brightness-moon .fold-head h2,
body.brightness-moon .scene-head h2,
body.brightness-moon .mini-character-card strong,
body.brightness-moon .memory-card strong {
  color: var(--text);
}

body.brightness-parchment .hero-shade,
body.brightness-moon .hero-shade {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.02) 0%, rgba(255, 255, 255, 0.08) 38%, var(--panel-strong) 100%);
}

body.brightness-parchment .status-chip,
body.brightness-parchment .fold-section,
body.brightness-parchment .mini-character-card,
body.brightness-parchment .quick-actions button,
body.brightness-parchment .option-btn,
body.brightness-parchment .memory-card,
body.brightness-moon .status-chip,
body.brightness-moon .fold-section,
body.brightness-moon .mini-character-card,
body.brightness-moon .quick-actions button,
body.brightness-moon .option-btn,
body.brightness-moon .memory-card {
  background: var(--panel);
  border-color: var(--line);
  color: var(--text);
}

body.brightness-parchment .modal-layer,
body.brightness-moon .modal-layer {
  background: rgba(42, 31, 20, 0.28);
}

body.brightness-moon .modal-layer {
  background: rgba(32, 25, 70, 0.24);
}

body.brightness-parchment .message.user,
body.brightness-moon .message.user {
  color: #fff;
}

body.brightness-parchment .input-form button {
  background: linear-gradient(135deg, #8a5b36, #b9834f);
}

body.brightness-moon .input-form button {
  background: linear-gradient(135deg, #6f5dd5, #9a84ee);
}