:root {
  --paper: #f1f1ee;
  --ink: #0c0c0c;
  --body: #5b5b58;
  --muted: #8a8a85;
  --mist: #e2e3f1;
  --surface: rgba(255, 255, 255, 0.78);
  --surface-solid: #ffffff;
  --bg-deep: #f1f1ee;
  --bg-card: #ffffff;
  --bg-elevated: #f8f8f5;
  --bg-glass: rgba(255, 255, 255, 0.86);
  --text-main: #0c0c0c;
  --text-muted: #5b5b58;
  --text-dim: #8a8a85;
  --gold: #9a7428;
  --gold-soft: rgba(154, 116, 40, 0.12);
  --peacock: #1f4e5f;
  --peacock-bright: #1f4e5f;
  --crimson: #a32d2d;
  --crimson-soft: rgba(163, 45, 45, 0.10);
  --green-warm: #2fb36a;
  --border: rgba(12, 12, 12, 0.10);
  --border-gold: rgba(12, 12, 12, 0.18);
  --font-serif: "Inter", "Source Han Serif SC", "Noto Serif SC", "Songti SC", serif;
  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-mono: "Consolas", "Cascadia Code", monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

html, body {
  min-height: 100vh;
  background-color: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: #e9e9e5;
}
::-webkit-scrollbar-thumb {
  background: #c7c7c1;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--ink);
}

/* 顶部导航栏：Driftbar 毛玻璃宣纸风 */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 28px;
  background: rgba(241, 241, 238, 0.86);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  flex-shrink: 0;
}

.seal-badge {
  position: relative;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: linear-gradient(to bottom, #2b2b2b, #0a0a0a 55%);
  color: #fff;
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 14px;
  display: grid;
  place-items: center;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

.seal-badge::after {
  content: "";
  position: absolute;
  left: 20%;
  right: 20%;
  bottom: 3px;
  height: 2.5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.85);
}

.brand-title {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.brand-sub {
  font-size: 11px;
  color: var(--muted);
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.nav-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--body);
  padding: 6px 13px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.01em;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: var(--font-sans);
}

.nav-btn:hover {
  color: var(--ink);
  background: rgba(12, 12, 12, 0.05);
}

.nav-btn.active {
  color: #fff;
  background: var(--ink);
  font-weight: 500;
}

.nav-game-link {
  text-decoration: none;
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid var(--border);
  color: var(--ink);
}

.nav-game-link:hover {
  background: var(--ink);
  color: #fff;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.bgm-widget {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--border);
  padding: 3px 8px;
  border-radius: 999px;
}

.bgm-select {
  background: transparent;
  border: none;
  color: var(--ink);
  font-size: 12px;
  outline: none;
  max-width: 145px;
  cursor: pointer;
}

.bgm-select option,
.bgm-select optgroup {
  background: #fff;
  color: var(--ink);
}

.icon-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--ink);
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: 0.2s;
}

.icon-btn.playing {
  border-color: var(--ink);
  color: #fff;
  background: var(--ink);
}

.ending-counter {
  font-size: 12px;
  font-weight: 500;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid var(--border);
  padding: 4px 11px;
  border-radius: 999px;
  white-space: nowrap;
}

/* 返回导航栏 */
.subpage-bar {
  background: rgba(241, 241, 238, 0.92);
  border-bottom: 1px solid var(--border);
  padding: 8px 28px;
}

.subpage-bar.hidden {
  display: none;
}

.subpage-bar-inner {
  max-width: 1380px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.subpage-breadcrumb {
  font-size: 12px;
  color: var(--muted);
}

/* 视图容器 */
.app-main {
  max-width: 1380px;
  margin: 0 auto;
  padding: 24px 28px 36px;
}

.view {
  display: none;
  animation: fadeIn 0.25s ease;
}

.view.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Driftbar 风格按钮与胶囊 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 15px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.01em;
  cursor: pointer;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.75);
  color: var(--ink);
  transition: all 0.2s ease;
  font-family: var(--font-sans);
}

.btn:hover {
  background: #ffffff;
  border-color: rgba(12, 12, 12, 0.28);
  transform: translateY(-1px);
}

.btn-primary {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
  font-weight: 500;
}

.btn-primary:hover {
  background: #262626;
  border-color: #262626;
  color: #fff;
}

.btn-gold {
  background: #ffffff;
  border-color: rgba(12, 12, 12, 0.2);
  color: var(--ink);
  font-weight: 600;
}

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

.btn-sm {
  padding: 5px 11px;
  font-size: 12px;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 500;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  color: var(--body);
  border: 1px solid var(--border);
}

.tag-gold {
  background: rgba(255, 255, 255, 0.85);
  color: var(--ink);
  border-color: rgba(12, 12, 12, 0.16);
}

.tag-crimson {
  background: var(--crimson-soft);
  color: var(--crimson);
  border-color: rgba(163, 45, 45, 0.25);
}

.tag-peacock {
  background: rgba(31, 78, 95, 0.10);
  color: var(--peacock);
  border-color: rgba(31, 78, 95, 0.22);
}

/* 史料卡：温润纸感 + 右侧虚线撕边 */
.history-scroll-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-right: 4px dashed rgba(12, 12, 12, 0.22);
  border-radius: 10px 3px 3px 10px;
  padding: 16px 20px;
  box-shadow: 0 2px 10px rgba(12, 12, 12, 0.03);
}

.history-scroll-card .source-label {
  font-size: 12px;
  color: var(--crimson);
  font-weight: 600;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.history-scroll-card .quote-text {
  font-family: var(--font-serif);
  font-size: 15px;
  color: var(--ink);
  line-height: 1.72;
  margin-bottom: 6px;
}

.history-scroll-card .note-text {
  font-size: 13px;
  color: var(--body);
  line-height: 1.65;
}

/* 开屏动态交互封面：宣纸浅雾风 */
.splash-intro {
  position: fixed;
  inset: 0;
  z-index: 2500;
  background:
    radial-gradient(circle at 50% 35%, #ffffff 0%, var(--paper) 55%, var(--mist) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.6s ease, visibility 0.6s ease;
}

.splash-intro.dismissed {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.splash-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.splash-content {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 32px;
  max-width: 720px;
}

.splash-seal {
  display: inline-block;
  padding: 4px 14px;
  border: 1px solid rgba(163, 45, 45, 0.35);
  background: rgba(163, 45, 45, 0.08);
  color: var(--crimson);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 3px;
  border-radius: 999px;
  margin-bottom: 16px;
}

.splash-title {
  font-size: clamp(30px, 5vw, 52px);
  font-weight: 600;
  letter-spacing: -0.04em;
  color: var(--ink);
  margin-bottom: 10px;
}

.splash-sub {
  font-size: 14.5px;
  color: var(--body);
  margin-bottom: 26px;
}

.splash-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.splash-enter-btn {
  padding: 12px 24px;
  font-size: 14px;
  border-radius: 8px;
}

.splash-hint {
  margin-top: 18px;
  font-size: 12px;
  color: var(--muted);
}

/* 音量滑块通用控件 */
.vol-control {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--border);
  padding: 3px 8px;
  border-radius: 999px;
}

.vol-control input[type="range"] {
  width: 68px;
  accent-color: var(--ink);
  cursor: pointer;
}

/* 主页全屏铺满影院 */
.home-fullscreen-stage {
  position: relative;
  width: 100vw;
  margin-left: calc(50% - 50vw);
  height: calc(100vh - 54px);
  min-height: 460px;
  background: #0c0c0c;
  overflow: hidden;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.home-fullscreen-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.home-fullscreen-video.contain-mode {
  object-fit: contain;
}

.home-fullscreen-hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 20px 32px;
  color: #fff;
  background: linear-gradient(180deg, rgba(12,12,12,0.68) 0%, transparent 26%, transparent 66%, rgba(12,12,12,0.88) 100%);
}

.home-fullscreen-hud > * {
  pointer-events: auto;
}

.home-fullscreen-hud .btn {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.25);
  color: #fff;
  backdrop-filter: blur(8px);
}

.home-fullscreen-hud .btn:hover {
  background: #fff;
  color: var(--ink);
}

.home-fullscreen-hud .btn-primary {
  background: #fff;
  color: var(--ink);
  border-color: #fff;
}

.home-fullscreen-hud .vol-control {
  background: rgba(12, 12, 12, 0.55);
  border-color: rgba(255, 255, 255, 0.25);
  color: #fff;
}

.chapter-jump-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
  align-items: center;
}

/* 卡片与网格 */
.portal-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 24px;
}

.portal-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.portal-card:hover {
  background: #fff;
  border-color: rgba(12, 12, 12, 0.24);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(12, 12, 12, 0.05);
}

.portal-card h3 {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
  color: var(--ink);
}

.portal-card p {
  font-size: 13px;
  color: var(--body);
}

.chapter-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.chapter-tab {
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid var(--border);
  color: var(--body);
  padding: 7px 14px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: 0.2s;
}

.chapter-tab:hover {
  color: var(--ink);
  background: #fff;
}

.chapter-tab.active {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

.chapter-detail-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 20px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 18px;
}

.section-title {
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--ink);
}

.filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.search-input {
  background: #fff;
  border: 1px solid var(--border);
  color: var(--ink);
  padding: 7px 12px;
  border-radius: 7px;
  font-size: 13px;
  outline: none;
  min-width: 200px;
}

.search-input:focus {
  border-color: var(--ink);
}

.cards-layout {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 20px;
  align-items: start;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(195px, 1fr));
  gap: 14px;
}

.media-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
}

.media-card:hover,
.media-card.selected {
  background: #fff;
  border-color: var(--ink);
  box-shadow: 0 6px 18px rgba(12, 12, 12, 0.06);
}

.media-card-thumb {
  width: 100%;
  aspect-ratio: 16 / 10;
  background: #e8e8e3;
  overflow: hidden;
  position: relative;
}

.media-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s;
}

.media-card:hover .media-card-thumb img {
  transform: scale(1.04);
}

.media-card-body {
  padding: 11px 13px;
}

.media-card-title {
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--ink);
  margin-bottom: 2px;
}

.media-card-sub {
  font-size: 12px;
  color: var(--body);
}

.detail-panel {
  position: sticky;
  top: 72px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  max-height: calc(100vh - 92px);
  overflow-y: auto;
  box-shadow: 0 8px 30px rgba(12, 12, 12, 0.05);
}

.detail-img-wrap {
  width: 100%;
  border-radius: 8px;
  overflow: hidden;
  background: #f5f5f2;
  border: 1px solid var(--border);
  margin-bottom: 12px;
  cursor: zoom-in;
}

.detail-img-wrap img {
  width: 100%;
  max-height: 280px;
  object-fit: contain;
  display: block;
}

.variant-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}

.prompt-box {
  background: #f7f7f4;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: #2b2b29;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 170px;
  overflow-y: auto;
  margin-top: 8px;
}

.modal-prompt-panel {
  padding: 14px 18px 16px;
  border-top: 1px solid var(--border);
  background: #fafaf8;
}

.modal-prompt-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  font-size: 12.5px;
  color: var(--ink);
  font-weight: 600;
}

.modal-prompt-panel .prompt-box {
  max-height: 135px;
  margin-top: 8px;
}

/* 色卡条 */
.swatch-row {
  display: flex;
  gap: 6px;
  margin: 8px 0;
}
.swatch {
  flex: 1;
  height: 28px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-family: var(--font-mono);
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.8);
}

/* 全景探索舞台（保留影院暗底） */
.panorama-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}

.panorama-stage-wrap {
  position: relative;
  width: 100%;
  height: 540px;
  background: #0b0a09;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  user-select: none;
}

.panorama-canvas-layer {
  position: absolute;
  inset: 0;
  transform-origin: center center;
  transition: transform 0.08s linear;
}

.panorama-bg-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
}

.panorama-particles {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.hotspot-pin {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(163, 45, 45, 0.92);
  border: 2px solid #fff;
  color: #fff;
  font-size: 13px;
  font-weight: bold;
  cursor: pointer;
  display: grid;
  place-items: center;
  animation: pulsePin 2.2s infinite;
  z-index: 5;
}

.hotspot-pin:hover {
  transform: translate(-50%, -50%) scale(1.18);
  background: var(--ink);
}

.hotspot-tooltip {
  position: absolute;
  bottom: 36px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(12, 12, 12, 0.92);
  color: #fff;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 12px;
  white-space: nowrap;
  pointer-events: none;
}

@keyframes pulsePin {
  0% { box-shadow: 0 0 0 0 rgba(163, 45, 45, 0.65); }
  70% { box-shadow: 0 0 0 12px rgba(163, 45, 45, 0); }
  100% { box-shadow: 0 0 0 0 rgba(163, 45, 45, 0); }
}

.panorama-side-drawer {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 350px;
  max-height: calc(100% - 28px);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  overflow-y: auto;
  color: var(--ink);
  z-index: 10;
}

.panorama-controls-hint {
  position: absolute;
  left: 14px;
  top: 14px;
  background: rgba(12, 12, 12, 0.78);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  color: #f1f1ee;
  z-index: 8;
}

/* 剧本阅读器 */
.scripts-layout {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 18px;
  align-items: start;
}

.script-list {
  display: grid;
  gap: 8px;
  max-height: 74vh;
  overflow-y: auto;
  padding-right: 4px;
}

.script-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 11px 13px;
  cursor: pointer;
  transition: 0.2s;
  text-align: left;
  color: var(--ink);
}

.script-item:hover,
.script-item.active {
  background: #fff;
  border-color: var(--ink);
}

.script-reader {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  min-height: 520px;
}

.script-content-pre {
  background: #f8f8f5;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  font-family: var(--font-sans);
  font-size: 13.5px;
  line-height: 1.78;
  color: var(--ink);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 64vh;
  overflow-y: auto;
}

.script-content-pre mark {
  background: #fde047;
  color: #0c0c0c;
  padding: 0 2px;
  border-radius: 2px;
}

/* 音频室 */
.audio-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.audio-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
}

.audio-card audio {
  width: 100%;
  height: 36px;
  margin-top: 6px;
}

/* 18天使用周期条 & 制作流程导视图 */
.cycle-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.cycle-phase {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 3px solid var(--ink);
  border-radius: 8px;
  padding: 14px;
}

.workflow-diagram {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.wf-node {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 12px;
  cursor: pointer;
  transition: 0.2s;
}

.wf-node:hover,
.wf-node.active {
  background: #fff;
  border-color: var(--ink);
  box-shadow: 0 4px 14px rgba(12, 12, 12, 0.06);
}

.wf-node .wf-step {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--crimson);
  font-weight: 700;
}

.wf-node .wf-title {
  font-size: 14.5px;
  font-weight: 600;
  margin: 4px 0;
  color: var(--ink);
}

.wf-node .wf-tool {
  font-size: 11.5px;
  color: var(--body);
}

.wf-detail-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 20px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 24px;
}

/* 互动游戏与舞台样式 */
.game-role-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.role-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: 0.22s;
}

.role-card:hover {
  background: #fff;
  border-color: var(--ink);
  transform: translateY(-2px);
}

.role-card-top {
  display: flex;
  gap: 14px;
  padding: 14px;
  align-items: center;
  border-bottom: 1px solid var(--border);
}

.role-card-top img {
  width: 68px;
  height: 68px;
  border-radius: 8px;
  object-fit: cover;
  background: #e8e8e3;
}

.role-card-body {
  padding: 14px;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
}

.game-stage-shell {
  position: relative;
  width: 100%;
  height: 520px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: #0c0c0c;
  color: #fff;
  margin-bottom: 14px;
}

.game-bg {
  position: absolute;
  inset: -20px;
  background-size: cover;
  background-position: center;
  transition: transform 0.15s ease-out;
  filter: brightness(0.86);
}

.game-vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, transparent 45%, rgba(10, 9, 8, 0.78) 100%);
  pointer-events: none;
}

.game-interact-marker {
  position: absolute;
  bottom: 138px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  z-index: 5;
  cursor: pointer;
}

.game-interact-marker .marker-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #f59e0b;
  border: 2px solid #fff;
  box-shadow: 0 0 14px rgba(245, 158, 11, 0.8);
}

.game-interact-marker.near .marker-dot {
  background: var(--crimson);
  transform: scale(1.25);
}

.game-interact-marker.done .marker-dot {
  background: var(--green-warm);
}

.marker-label {
  background: rgba(12, 12, 12, 0.9);
  color: #fff;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 12px;
  white-space: nowrap;
}

.game-player {
  position: absolute;
  bottom: 52px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 7;
  transition: left 0.06s linear, bottom 0.08s linear;
}

.game-player img {
  height: 154px;
  width: auto;
  max-width: 132px;
  object-fit: cover;
  border-radius: 8px;
  border: 2px solid rgba(255, 255, 255, 0.85);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.85);
}

.game-player.facing-left img {
  transform: scaleX(-1);
}

.game-prompt-pill {
  position: absolute;
  top: -32px;
  background: var(--crimson);
  color: #fff;
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 20px;
  white-space: nowrap;
}

.game-dialogue-bar {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  width: min(820px, 92%);
  background: rgba(12, 12, 12, 0.88);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  padding: 12px 18px;
  z-index: 9;
  font-size: 14.5px;
}

.game-choices-overlay {
  position: absolute;
  inset: 0;
  background: rgba(12, 12, 12, 0.82);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 12;
}

.choices-card {
  background: #ffffff;
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 22px;
  max-width: 660px;
  width: 100%;
}

.choice-option {
  width: 100%;
  text-align: left;
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 13px 16px;
  color: var(--ink);
  cursor: pointer;
  margin-top: 10px;
  transition: 0.2s;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.choice-option:hover {
  border-color: var(--ink);
  background: #fff;
}

.keypad-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 10px 14px;
  border-radius: 10px;
  margin-bottom: 12px;
}

.kbd {
  display: inline-block;
  padding: 2px 7px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 11px;
  background: #fff;
  color: var(--ink);
}

/* Driftbar 风格页脚：磨砂玻璃巨字 + 雾化实景底图 */
.drift-footer {
  position: relative;
  margin-top: 48px;
  background: var(--paper);
  border-top: 1px solid var(--border);
  overflow: hidden;
  isolation: isolate;
}

.drift-footer__stage {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.drift-footer__bg {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 80%;
  display: block;
}

.drift-footer__stage::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    var(--paper) 0%,
    rgba(241, 241, 238, 0.96) 46%,
    rgba(241, 241, 238, 0.78) 68%,
    rgba(241, 241, 238, 0.18) 90%
  );
}

.drift-footer__wordmark {
  position: relative;
  z-index: 1;
  text-align: center;
  font-size: clamp(64px, 16vw, 220px);
  font-weight: 600;
  line-height: 0.85;
  letter-spacing: -0.045em;
  margin: 24px 0 -10px;
  pointer-events: none;
  user-select: none;
  color: rgba(232, 234, 250, 0.45);
  background: linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.88),
    rgba(214, 218, 246, 0.42) 50%,
    rgba(255, 255, 255, 0.68)
  );
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 -1px 0 rgba(255, 255, 255, 0.65)) drop-shadow(0 0 18px rgba(190, 200, 255, 0.45));
}

.drift-footer__fog {
  position: absolute;
  inset: auto 0 0;
  z-index: 2;
  height: 75px;
  pointer-events: none;
  background: linear-gradient(to top, var(--mist) 0%, rgba(226, 227, 241, 0.6) 40%, rgba(226, 227, 241, 0) 100%);
}

.drift-footer__content {
  position: relative;
  z-index: 3;
  max-width: 1380px;
  margin: 0 auto;
  padding: 48px 28px 16px;
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr 1fr;
  gap: 32px;
  align-items: start;
}

.drift-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.drift-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 11px;
  border: 1px solid rgba(12, 12, 12, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.68);
  font-size: 11.5px;
  font-weight: 500;
  color: var(--ink);
  white-space: nowrap;
}

.drift-chip__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #2fb36a;
  box-shadow: 0 0 0 2.5px rgba(47, 179, 106, 0.2);
}

.drift-col__title {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 14px;
  color: var(--ink);
}

.drift-col__list {
  display: grid;
  gap: 10px;
  font-size: 13.5px;
  color: var(--body);
}

.drift-col__list button,
.drift-col__list a {
  background: none;
  border: none;
  padding: 0;
  text-align: left;
  font: inherit;
  color: inherit;
  cursor: pointer;
  transition: opacity 0.2s;
}

.drift-col__list button:hover,
.drift-col__list a:hover {
  opacity: 0.55;
}

/* 模态弹窗与 Toast */
.modal {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal.hidden {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(12, 12, 12, 0.65);
  backdrop-filter: blur(6px);
}

.lightbox-content,
.video-modal-content {
  position: relative;
  z-index: 2;
  background: #ffffff;
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: 12px;
  max-width: 1080px;
  width: 100%;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
}

.modal-close {
  background: #f1f1ee;
  border: 1px solid var(--border);
  color: var(--ink);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
}

.lightbox-img-wrap {
  flex: 1;
  overflow: auto;
  display: grid;
  place-items: center;
  background: #f5f5f2;
  padding: 14px;
}

.lightbox-img-wrap img {
  max-width: 100%;
  max-height: 70vh;
  object-fit: contain;
}

.video-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
}

.video-stage {
  background: #000;
  display: grid;
  place-items: center;
}

.video-stage video {
  width: 100%;
  max-height: 64vh;
}

.video-modal-desc {
  padding: 10px 18px;
  font-size: 13px;
  color: var(--body);
}

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  font-weight: 500;
  font-size: 13px;
  padding: 8px 18px;
  border-radius: 999px;
  z-index: 2000;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

.toast.hidden {
  display: none;
}

.mobile-bottom-nav {
  display: none;
}

@media (max-width: 1024px) {
  .cards-layout,
  .chapter-detail-box,
  .wf-detail-grid,
  .scripts-layout {
    grid-template-columns: 1fr;
  }
  .portal-grid,
  .drift-footer__content {
    grid-template-columns: repeat(2, 1fr);
  }
  .workflow-diagram {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  body {
    padding-bottom: 66px;
  }
  .topbar {
    padding: 8px 12px;
  }
  .main-nav,
  .brand-sub {
    display: none;
  }
  .bgm-select {
    max-width: 105px;
  }
  .subpage-bar {
    padding: 8px 12px;
  }
  .app-main {
    padding: 14px 12px 24px;
  }
  .portal-grid,
  .workflow-diagram,
  .drift-footer__content,
  .audio-grid {
    grid-template-columns: 1fr;
  }
  .card-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  .panorama-stage-wrap {
    height: 340px;
  }
  .panorama-side-drawer {
    position: static;
    width: 100%;
    max-height: none;
    margin-top: 10px;
  }
  .mobile-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 200;
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    background: rgba(241, 241, 238, 0.96);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--border);
    padding: 4px 2px;
  }
  .mob-nav-btn {
    background: transparent;
    border: none;
    color: var(--body);
    font-size: 15px;
    padding: 4px 2px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    text-decoration: none;
    cursor: pointer;
  }
  .mob-nav-btn span {
    font-size: 10.5px;
  }
  .mob-nav-btn.active {
    color: var(--ink);
    font-weight: 600;
  }
}
