/* 自定义CSS - 补充参考模板CSS中缺少的样式 */

/* 字体定义 */
/* 主字体：从 11.8MB 的 TTF 子集化成 1.2MB 的 WOFF2（2721 个字符）。
   font-display: swap，先显示系统字体，加载完再替换，不阻塞首屏。 */
@font-face {
  font-family: 'ShangTuDongGuan';
  src: url('../fonts/shangtu-subset.woff2') format('woff2');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

/* ========== 对话 / 旁白（精简标记） ==========
   原来每行用 3-4 个 Tailwind 工具类，单是 class 属性就占 200 字节。
   6548 个对话框 + 5272 行旁白把 HTML 撑到 2.5MB，解析要 700ms+。
   改成短类名，样式用主题自己的变量复刻，视觉完全一致。 */
.d {
  position: relative;
  margin-block: calc(var(--spacing, 0.25rem) * 4);
  min-height: calc(var(--spacing, 0.25rem) * 36);
  border: 1px solid var(--color-border);
  text-align: start;
  padding: calc(var(--spacing, 0.25rem) * 4);
  padding-top: calc(var(--spacing, 0.25rem) * 8);
  overflow-wrap: break-word;
}

/* 角色名用伪元素，省掉一个节点（6548 个对话框就省 6548 个盒子） */
.d[data-n]::before {
  content: attr(data-n);
  position: absolute;
  top: calc(var(--spacing, 0.25rem) * -2);
  left: calc(var(--spacing, 0.25rem) * 2);
  border: 1px solid var(--color-border);
  background-color: var(--color-bg);
  padding-block: var(--spacing, 0.25rem);
  padding-inline: calc(var(--spacing, 0.25rem) * 2);
}


/* 带立绘的对话框要建立块格式化上下文，
   否则 float 的立绘不计入父高度，会穿出下边框。 */
.d-f {
  display: flow-root;
}

.d-fig {
  float: right;
  margin: 0 0 0.5rem 1rem;
}

.d-fig-el {
  width: calc(var(--spacing, 0.25rem) * 30);
  height: calc(var(--spacing, 0.25rem) * 30);
}

.n {
  margin-block: var(--spacing, 0.25rem);
  padding-block: var(--spacing, 0.25rem);
  padding-inline: calc(var(--spacing, 0.25rem) * 4);
  overflow-wrap: break-word;
  text-align: start;
}

/* 章节容器：分区渲染 + 满宽。
   content-visibility 会隐含 contain: paint，把子元素裁到章节盒子内，
   所以章节必须自己就是可见宽度，否则全宽背景图会被切掉。
   这里用 width:100%（继承父块宽度），不用 100vw ——
   vw 在部分移动浏览器上不等于可见宽度，这是图片反复变窄的根源。 */
.chapter-section {
  display: block;
  /* 外层 <main class="px-5"> 有 1.25rem 左右内边距，章节被压窄 40px。
     这里用等量负外边距顶出去，让章节真正等于可见宽度。
     px-5 就是 1.25rem，所以两边会一起随根字号变化，不会脱节。 */
  width: calc(100% + 2.5rem);
  max-width: none;
  margin-inline: -1.25rem;
  padding: 0;
  content-visibility: auto;
  contain-intrinsic-size: auto 6000px;
}

/* 章节里的内容默认收窄居中；图片是唯一例外，见下一条。
   不再需要一层包裹容器，图片因此成为章节的直接子元素。 */
.chapter-section > * {
  max-width: min(65ch, calc(100% - 1.5rem));
  margin-inline: auto;
}

/* 图片宽度 100% 就等于章节宽，也就等于可见宽度。
   不依赖 vw、不依赖负外边距、不做位移。 */
.chapter-section > figure.zato-img {
  width: 100%;
  max-width: none;
  margin-inline: 0;
}

/* 恢复阅读位置时临时关闭分段渲染：
   content-visibility 下未渲染章节的高度是估算值，量不到真实位置 */
html.zato-restoring .chapter-section {
  content-visibility: visible !important;
}

/* 确保中文显示正确 */
body {
  font-family: 'ShangTuDongGuan', 'Microsoft YaHei', 'PingFang SC', sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background-color: #111 !important;
}

/* 立绘样式 — 强制居中 */
figure.sprite {
  display: block !important;
  margin: 1rem auto !important;
  margin-inline: auto !important;
  width: fit-content !important;
  max-width: 100% !important;
  overflow: visible !important;
  float: none !important;
  text-align: center;
}

.sprite img {
  height: 22.5rem;
  width: auto;
  display: block;
  margin: 0 auto;
}

.sprite figcaption {
  text-align: center;
  margin-top: 0.25rem;
}

/* ========== 背景图 / CG：铺满视口宽度，水平居中 ==========
   单一类名 + 单一规则，避免多套选择器互相覆盖。
   左右外边距取 calc(50% - 50vw)：父容器的半宽减半屏宽，
   正好把内容列撑到视口边缘，且不受滚动条宽度影响。 */
figure.zato-img {
  display: block !important;
  float: none !important;
  box-sizing: border-box !important;
  /* 宽度 100% 相对章节容器；章节已是可见宽度，
     所以这里不需要 vw、不需要位移、不需要负外边距。 */
  width: 100% !important;
  max-width: none !important;
  min-width: 0 !important;
  margin: 0.5rem 0 !important;
  padding: 0 !important;
  text-align: center !important;
  border: 0 !important;
  background: none !important;
  overflow: visible !important;
}

figure.zato-img > img.zato-img__el {
  display: block !important;
  width: 100% !important;
  max-width: none !important;
  height: auto !important;
  margin: 0 auto !important;
  border: 0 !important;
}

/* 兜底：万一某个子元素仍比容器宽，不让整页横向滚动。
   只设在 body 上，纵向滚动不受影响。 */
body {
  overflow-x: hidden;
}

/* 使用高优先级选择器彻底覆盖 prose figure 的默认间距 */
/* specificity: (0,1,3) + !important，确保覆盖 .prose :where(figure) 和 py-6/mt-2 等工具类 */
article.prose figure.zato-img {
  width: 100% !important;
  max-width: none !important;
  margin-top: 0.5rem !important;
  margin-bottom: 0.5rem !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
}

/* ========== 音频指示器 — 毛玻璃胶囊 ========== */
.audio-cue-container {
  display: block;
  width: fit-content;
  margin-left: auto !important;
  margin-right: auto !important;
  margin-inline: auto !important;
  margin-top: 0.375rem;
  margin-bottom: 0.375rem;
}

.audio-cue {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.75rem;
  border-radius: 2rem;
  font-size: 0.8125rem;
  color: var(--color-fg, #e7e5e4);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  opacity: 0.45;
  transition: all 0.25s ease;
  user-select: none;
  cursor: default;
}

.audio-cue:hover {
  opacity: 0.9;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.14);
}

/* 音乐 — 暖色左竖线，更明显 */
.audio-cue-music {
  border-left: 3px solid rgba(210, 165, 120, 0.7);
  opacity: 0.65;
}

.audio-cue-music:hover {
  opacity: 0.95;
  border-left-color: rgba(210, 165, 120, 0.9);
}

/* 音效 — 冷色左竖线 */
.audio-cue-sfx {
  border-left: 2px solid rgba(140, 170, 195, 0.5);
}

/* 停止 — 中性色 */
.audio-cue-stop {
  border-left: 2px solid rgba(165, 155, 145, 0.35);
}

.audio-cue-icon {
  width: 0.875rem;
  height: 0.875rem;
  flex-shrink: 0;
  opacity: 0.55;
}

.audio-cue-btn {
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  font-family: inherit;
  font-size: inherit;
  padding: 0;
  line-height: 1.3;
  white-space: nowrap;
}

.audio-cue-btn:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: rgba(255, 255, 255, 0.3);
}

/* 播放中状态 */
.audio-cue-btn.is-playing {
  opacity: 1;
}

/* 音乐播放中 — 金色 */
.audio-cue-music .audio-cue-btn.is-playing {
  color: #e8c67a;
}

/* 音效播放中 — 浅蓝 */
.audio-cue-sfx .audio-cue-btn.is-playing {
  color: #8cc4e8;
}

/* 旁白文本 — 无边框段落 */
/* 全屏文字叠加 — 信号阻塞 / 致谢等（居中大字，无框） */
/* 全屏文字叠加 — 诗歌/信号阻塞/致谢（强制居中） */

/* ========== 时间表 / 居中文字块 — 居中容器，文字左对齐，左边框 ========== */
.schedule-block {
  width: 100%;
  margin: 1.25rem 0;
}

.schedule-block-inner {
  display: block;
  width: fit-content;
  max-width: 100%;
  margin: 0 auto;
  text-align: left;
  padding: 0.5rem 1rem 0.5rem 1.25rem;
  border-left: 2px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.015);
  font-family: 'Georgia', 'Times New Roman', 'ShangTuDongGuan', 'Microsoft YaHei', 'PingFang SC', serif;
  font-size: 1rem;
  line-height: 1.85;
  letter-spacing: 0.03em;
  color: var(--color-fg, #e7e5e4);
  opacity: 0.8;
}
/* ========== 制作人员名单 — 衬线字体，居中引用块 ========== */
.credits-block {
  width: 100%;
  margin: 1.5rem 0;
}

.credits-block-inner {
  display: block;
  max-width: 520px;
  margin: 0 auto;
  text-align: left;
  padding: 1rem 1.5rem;
  border-left: 3px solid rgba(232, 198, 122, 0.5);
  background: rgba(255, 255, 255, 0.015);
  font-family: 'Georgia', 'Times New Roman', 'Noto Serif SC', 'Source Han Serif SC', 'STSong', 'SimSun', 'ShangTuDongGuan', serif;
  font-size: 1.05rem;
  line-height: 2;
  letter-spacing: 0.04em;
  color: var(--color-fg, #e7e5e4);
  opacity: 0.85;
}

.text-overlay {
  padding: 1.5rem 0;
  margin: 1rem 0;
}

.text-overlay p {
  text-align: center !important;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--color-fg, #e7e5e4);
  opacity: 0.8;
  line-height: 2;
  margin: 0;
}

/* 章节标题样式 */
.chapter-heading {
  font-size: 2.25rem;
  font-weight: bold;
  border-bottom: 1px solid var(--border, #44403c);
  margin: 2rem auto;
  padding-bottom: 0.5rem;
  text-align: start;
}

/* ========== 横幅 Logo ========== */
.banner-logo {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 280px;
  height: auto;
  opacity: 0.9;
  filter: drop-shadow(0 1px 3px rgba(0,0,0,0.5));
  pointer-events: none;
  z-index: 1;
}

/* ========== 阅读工具栏（配乐 + 字号） ==========
   尺寸一律用 px，不用 rem。
   因为字号档位会改 html 根字号，用 rem 会让工具栏跟着变大。 */
.reader-tools {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 9998;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 6px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(18, 18, 18, 0.74);
  -webkit-backdrop-filter: blur(14px) saturate(1.3);
  backdrop-filter: blur(14px) saturate(1.3);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  opacity: 0;
  transform: translateY(14px) scale(0.96);
  animation: rt-enter 0.55s cubic-bezier(0.16, 1, 0.3, 1) 0.35s forwards;
  transition: border-color 0.35s ease, box-shadow 0.35s ease;
}

.reader-tools:hover {
  border-color: rgba(232, 198, 122, 0.25);
  box-shadow: 0 10px 34px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.07);
}

@keyframes rt-enter {
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  .reader-tools { animation: none; opacity: 1; transform: none; }
}

.rt-divider {
  width: 1px;
  height: 16px;
  background: rgba(255, 255, 255, 0.1);
}

/* 配乐开关 */
.rt-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 30px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: rgba(255, 255, 255, 0.5);
  font-family: inherit;
  font-size: 12px;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: color 0.3s ease, background 0.3s ease, border-color 0.3s ease,
              transform 0.18s ease, box-shadow 0.3s ease;
}

.rt-btn .rt-icon {
  width: 14px;
  height: 14px;
  transition: transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.rt-btn:hover {
  color: rgba(255, 255, 255, 0.88);
  background: rgba(255, 255, 255, 0.05);
}

.rt-btn:active {
  transform: scale(0.94);
}

.rt-btn.is-on {
  color: #141414;
  background: #e8c67a;
  border-color: #e8c67a;
  box-shadow: 0 0 14px rgba(232, 198, 122, 0.35);
}

.rt-btn.is-on .rt-icon {
  transform: rotate(-12deg) scale(1.08);
}

/* 字号分段控件 */
.rt-fonts {
  position: relative;
  display: flex;
  padding: 2px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
}

.rt-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 32px;
  height: calc(100% - 4px);
  border-radius: 999px;
  background: rgba(232, 198, 122, 0.16);
  border: 1px solid rgba(232, 198, 122, 0.32);
  box-shadow: 0 0 10px rgba(232, 198, 122, 0.12);
  transform: translateX(0);
  transition: transform 0.38s cubic-bezier(0.34, 1.3, 0.5, 1);
  pointer-events: none;
}

.rt-fonts button {
  position: relative;
  z-index: 1;
  width: 32px;
  height: 26px;
  padding: 0;
  border: 0;
  background: none;
  color: rgba(255, 255, 255, 0.38);
  font-family: inherit;
  line-height: 1;
  cursor: pointer;
  transition: color 0.28s ease, transform 0.28s cubic-bezier(0.34, 1.4, 0.5, 1);
}

.rt-fonts button:nth-child(2) { font-size: 10px; }
.rt-fonts button:nth-child(3) { font-size: 12px; }
.rt-fonts button:nth-child(4) { font-size: 14px; }
.rt-fonts button:nth-child(5) { font-size: 16px; }

.rt-fonts button:hover {
  color: rgba(255, 255, 255, 0.75);
  transform: translateY(-1px);
}

.rt-fonts button.is-active {
  color: #e8c67a;
}

/* 字体大小档位 — 修改根字号，所有 rem 单位自动缩放 */
html.font-sm { font-size: 14px; }
html.font-md { font-size: 16px; }
html.font-lg { font-size: 18px; }
html.font-xl { font-size: 20px; }

/* ========== 项目介绍区域 ========== */
.intro {
  margin-bottom: 2rem;
  padding: 1rem 0;
  font-size: 0.95rem;
  line-height: 1.75;
  color: var(--color-fg, #e7e5e4);
  opacity: 0.8;
}

.intro p {
  margin: 0.5rem 0;
}

.intro hr {
  margin: 1rem 0;
  border-color: rgba(255, 255, 255, 0.08);
}

.intro a {
  color: #c9a96e;
}

.intro a:hover {
  color: #e0c78a;
}

/* 响应式设计 */
/* ========== 阅读进度条 ========== */
html {
  /* 锚点跳转时给顶部进度条留出空间，标题不被遮住 */
  scroll-padding-top: 20px;
}

.progress-container {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 10px;
  z-index: 9999;
  cursor: pointer;
  background: transparent;
  /* 拖动进度条时不要触发页面滚动 */
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

.progress-track {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: rgba(255, 255, 255, 0.06);
  transition: height 0.2s;
}

.progress-container:hover .progress-track {
  height: 5px;
}

.progress-bar {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #e8c67a;
  box-shadow: 0 0 8px rgba(232, 198, 122, 0.5), 0 0 16px rgba(232, 198, 122, 0.2);
  /* 用 transform 推进，避免每帧改 width 触发重排 */
  transform: scaleX(0);
  transform-origin: 0 50%;
  will-change: transform;
  pointer-events: none;
}

/* 章节节点 */
.progress-markers {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 100%;
  pointer-events: none;
}

.progress-marker {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.35);
  border: 1.5px solid rgba(232, 198, 122, 0.4);
  transition: all 0.2s;
}

.progress-container:hover .progress-marker {
  width: 9px;
  height: 9px;
  background: rgba(232, 198, 122, 0.8);
  border-color: rgba(232, 198, 122, 1);
  box-shadow: 0 0 6px rgba(232, 198, 122, 0.6);
}

.progress-marker.reached {
  background: #e8c67a;
  border-color: #e8c67a;
}

/* 章节提示 */
.progress-tooltip {
  position: fixed;
  top: 24px;
  transform: translateX(-50%);
  padding: 3px 10px;
  border-radius: 3px;
  font-size: 0.75rem;
  color: #e8c67a;
  background: rgba(0, 0, 0, 0.85);
  border: 1px solid rgba(232, 198, 122, 0.3);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 10000;
}

.progress-container:hover .progress-tooltip,
.progress-tooltip.visible {
  opacity: 1;
}

/* ========== 正在播放（常驻迷你条） ========== */
/* 放在左下角，避开右下角的字号/配乐控件 */
.bgm-now {
  position: fixed;
  left: 1.25rem;
  bottom: 1.25rem;
  z-index: 9997;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: min(52vw, 300px);
  padding: 6px 8px 6px 10px;
  border: 1px solid rgba(232, 198, 122, 0.35);
  border-radius: 999px;
  background: rgba(20, 20, 20, 0.88);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.45);
  font-size: 0.8rem;
  color: #e8c67a;
}

/* 配乐开关 + 分隔线 */
/* 音乐停止点：不可见锚点，只用于定位 */
.audio-stop-mark {
  display: block;
  height: 0;
  overflow: hidden;
}

.bgm-now[hidden] {
  display: none;
}

.bgm-now-dot {
  width: 7px;
  height: 7px;
  flex: none;
  border-radius: 50%;
  background: #e8c67a;
  box-shadow: 0 0 8px rgba(232, 198, 122, 0.8);
  animation: bgm-pulse 1.6s ease-in-out infinite;
}

@keyframes bgm-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(0.82); }
}

.bgm-now-track {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.bgm-now-stop {
  flex: none;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 1px solid rgba(232, 198, 122, 0.4);
  border-radius: 50%;
  background: transparent;
  color: #e8c67a;
  font-size: 0.6rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.bgm-now-stop:hover,
.bgm-now-stop:focus-visible {
  background: #e8c67a;
  color: #141414;
  outline: none;
}

@media (prefers-reduced-motion: reduce) {
  .bgm-now-dot { animation: none; }
}

/* ========== 自动播放被拦时的提示 ========== */
.tap-hint {
  position: fixed;
  left: 50%;
  bottom: 112px;
  z-index: 9996;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid rgba(232, 198, 122, 0.3);
  background: rgba(18, 18, 18, 0.92);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.45);
  color: #e8c67a;
  font-size: 12px;
  white-space: nowrap;
  opacity: 0;
  transform: translate(-50%, 8px);
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.tap-hint.is-on {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ========== 阅读位置提示条 ========== */
.read-resume {
  position: fixed;
  left: 50%;
  bottom: 72px;
  z-index: 9996;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid rgba(232, 198, 122, 0.28);
  background: rgba(18, 18, 18, 0.9);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.45);
  color: #e8c67a;
  font-size: 12px;
  white-space: nowrap;
  opacity: 0;
  transform: translate(-50%, 10px) scale(0.97);
  pointer-events: none;
  transition: opacity 0.35s ease, transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.read-resume.is-on {
  opacity: 1;
  transform: translate(-50%, 0) scale(1);
  pointer-events: auto;
}

.read-resume button {
  border: 0;
  background: none;
  padding: 0;
  color: rgba(255, 255, 255, 0.55);
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color 0.25s ease;
}

.read-resume button:hover {
  color: #e8c67a;
}

/* ========== 移动端适配 ========== */
@media (max-width: 768px) {

  /* 基础排版 */
  body {
    font-size: 0.95rem;
  }

  /* 横幅 */
  .banner {
    margin-bottom: 1rem !important;
  }
  .banner header {
    font-size: 0.75rem;
    padding: 0.5rem 1rem 2rem !important;
  }
  .banner-logo {
    width: 200px;
  }

  /* 主标题 */
  article h1 {
    font-size: 1.5rem !important;
    margin-top: 1.5rem !important;
  }

  /* 章节标题 */
  .chapter-heading {
    font-size: 1.35rem;
    margin: 1.25rem auto;
  }
  article h2 {
    font-size: 1.35rem !important;
    margin-top: 1.25rem !important;
    margin-bottom: 1.25rem !important;
  }

  /* 对话框 — 移动端容纳标签(1.5rem) + 头像(110px+边距) = ~10rem */
  article .min-h-36 {
    min-height: 10rem !important;
  }
  /* 标签改为自然流布局后，还原顶部内边距 */
  article .pt-8 {
    padding-top: 0.75rem !important;
  }
  /* 角色标签 — 移动端改为自然流布局，作为文字上方标题，彻底消除重叠 */
  article .d {
    padding: 0.75rem !important;
  }
  /* 角色名改成顶部通栏条，标签贴着盒子顶边，横线拉满 */
  article .d[data-n]::before {
    position: static !important;
    display: block !important;
    margin: -0.75rem -0.75rem 0.5rem -0.75rem;
    padding: 0.5rem 0.75rem 0.3rem;
    border: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    background: transparent !important;
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #c9a96e;
    box-sizing: border-box;
    width: auto;
  }

  /* 立绘 — 增大尺寸 */
  .sprite img {
    height: 16rem;
  }

  /* 对话框内嵌头像 — 增大尺寸 + 防止溢出 */
  .size-30 {
    width: 110px !important;
    height: 110px !important;
  }

  /* 旁白内边距 */
  .n {
    padding-left: 0.75rem !important;
    padding-right: 0.75rem !important;
  }
  article .py-1 {
    padding-top: 0.25rem !important;
    padding-bottom: 0.25rem !important;
  }

  /* 背景图 — 修正 calc 偏移 */
  /* 视频容器 */
  .video-container video {
    width: 100%;
    height: auto;
  }

  /* 全屏文字叠加 */
  .text-overlay,
  article .font-bold[style*="font-size:1.25rem"] {
    font-size: 1.05rem !important;
    padding: 0.75rem 0.5rem !important;
  }

  /* 时间表代码块 */
  .schedule-block-inner {
    font-size: 0.9rem;
    padding: 0.5rem 0.75rem 0.5rem 1rem;
    line-height: 1.7;
  }

  /* 制作人员名单 */
  .credits-block-inner {
    font-size: 0.9rem;
    padding: 1rem 1.25rem;
    max-width: 95%;
    line-height: 1.8;
  }

  /* 音频按钮 — 增大点击区域 */
  .audio-cue {
    font-size: 0.875rem;
    padding: 0.35rem 0.85rem;
  }
  .audio-cue-icon {
    width: 1rem;
    height: 1rem;
  }

  /* 进度条 — 增大触摸区域 */
  .progress-container {
    height: 18px;
  }
  .progress-track {
    height: 3px;
  }
  .progress-container:hover .progress-track {
    height: 6px;
  }
  .progress-marker {
    width: 8px;
    height: 8px;
  }
  .progress-tooltip {
    font-size: 0.7rem;
    padding: 2px 8px;
  }

  /* 项目介绍 */
  .intro {
    font-size: 0.9rem;
    line-height: 1.65;
  }

  /* 目录 */
  details {
    font-size: 0.9rem;
  }

  /* 水平线 */
  article hr {
    margin: 1rem 0;
  }
}

/* 小屏手机 */
@media (max-width: 480px) {
  body {
    font-size: 0.9rem;
  }

  article h1 {
    font-size: 1.25rem !important;
  }

  article h2 {
    font-size: 1.15rem !important;
  }

  .sprite img {
    height: 14rem;
  }

  .size-30 {
    width: 90px !important;
    height: 90px !important;
  }

  /* 对话框 — 小屏容纳标签 + 头像(90px+边距) */
  article .min-h-36 {
    min-height: 8.5rem !important;
  }
  /* 标签改为自然流布局后，还原顶部内边距 */
  article .pt-8 {
    padding-top: 0.6rem !important;
  }
  /* 角色标签 — 小屏自然流布局，作为文字上方标题 */
  article .d {
    padding: 0.75rem !important;
  }
  /* 角色名改成顶部通栏条，标签贴着盒子顶边，横线拉满 */
  article .d[data-n]::before {
    position: static !important;
    display: block !important;
    margin: -0.75rem -0.75rem 0.5rem -0.75rem;
    padding: 0.5rem 0.75rem 0.3rem;
    border: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    background: transparent !important;
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #c9a96e;
    box-sizing: border-box;
    width: auto;
  }

  /* 内嵌立绘 — 小屏继续靠右浮动，只缩小尺寸。
     改成居中独占一行会把文字挤到下面，读起来像错位。 */
  .d-fig {
    float: right !important;
    margin: 0 0 0.4rem 0.6rem !important;
  }
  .d-fig-el {
    width: 64px !important;
    height: 64px !important;
  }

  .schedule-block-inner {
    font-size: 0.8rem;
    padding: 0.4rem 0.6rem 0.4rem 0.75rem;
  }

  .credits-block-inner {
    font-size: 0.8rem;
    padding: 0.75rem 1rem;
    max-width: 98%;
  }

  .intro {
    font-size: 0.85rem;
  }

  .progress-container {
    height: 20px;
  }

  /* 正在播放条：贴边缩小，避开 iPhone 底部手势区 */
  .bgm-now {
    left: 10px;
    bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    max-width: 58vw;
    padding: 5px 6px 5px 9px;
    font-size: 0.72rem;
  }

  .read-resume {
    bottom: 64px;
    padding: 6px 12px;
    font-size: 11px;
  }
  .read-resume button {
    font-size: 11px;
  }

  /* 阅读工具栏：收紧 */
  .reader-tools {
    right: 10px;
    bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    padding: 4px 5px;
    gap: 4px;
  }
  .rt-btn {
    height: 28px;
    padding: 0 8px;
    font-size: 11px;
  }
  .rt-divider {
    height: 14px;
  }
  .rt-fonts button {
    width: 30px;
    height: 24px;
  }
  .rt-thumb {
    width: 30px;
  }
  .bgm-now-stop {
    width: 20px;
    height: 20px;
  }

  .banner-logo {
    width: 150px;
  }
}
