/* kit.css — 物理科普动画 统一视觉规范
   5 条视频共用。改这里 = 改全部动画的视觉风格。 */

:root {
  --bg:        #070b14;
  --bg2:       #0c1424;
  --text:      #e8eef7;
  --muted:     #8b9bb4;
  --yellow:    #ffc94d;
  --blue:      #4da6ff;
  --red:       #ff5c5c;
  --green:     #4ddba0;
  --line:      rgba(139,155,180,0.18);
  --panel:     rgba(12,20,36,0.72);
  --font:      "Microsoft YaHei","PingFang SC","Noto Sans SC",system-ui,sans-serif;
  --mono:      Consolas,"SF Mono",Menlo,monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: #04060b;
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}

/* ---------- 页面骨架 ---------- */
.page {
  max-width: 1280px;
  margin: 0 auto;
  padding: 20px 16px 48px;
}

.page-head {
  display: flex;
  align-items: baseline;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.page-head h1 {
  font-size: 19px;
  font-weight: 700;
  margin: 0;
  letter-spacing: .02em;
}

.page-head .sub {
  font-size: 13px;
  color: var(--muted);
}

.back {
  font-size: 13px;
  color: var(--muted);
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 12px;
}
.back:hover { color: var(--text); border-color: var(--muted); }

/* ---------- 舞台（= 视频画面，16:9） ---------- */
.stage-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}

.stage-wrap canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* ---------- HUD / 控制条 ---------- */
.hud {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 13px;
}

.hud button {
  font-family: var(--font);
  font-size: 13px;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 6px 13px;
  cursor: pointer;
}
.hud button:hover { border-color: var(--muted); }
.hud button.on { border-color: var(--yellow); color: var(--yellow); }
.hud button.dim { opacity: .42; }

.scrub {
  position: relative;
  flex: 1 1 320px;
  height: 22px;
  cursor: pointer;
  display: flex;
  align-items: center;
}

.scrub .track {
  position: relative;
  width: 100%;
  height: 5px;
  background: rgba(139,155,180,0.22);
  border-radius: 999px;
  overflow: hidden;
}

.scrub .fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0%;
  background: linear-gradient(90deg, var(--blue), var(--yellow));
}

/* 分镜刻度 */
.scrub .ticks { position: absolute; inset: 0; pointer-events: none; }
.scrub .ticks i {
  position: absolute;
  top: 0;
  width: 1px;
  height: 100%;
  background: rgba(232,238,247,0.42);
}

.time, .scene-name {
  font-family: var(--mono);
  color: var(--muted);
  white-space: nowrap;
}
.scene-name { color: var(--yellow); }

/* ---------- 场景快捷跳转 ---------- */
.scene-list {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.scene-list button {
  font-family: var(--font);
  font-size: 12px;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 11px;
  cursor: pointer;
}
.scene-list button:hover { color: var(--text); border-color: var(--muted); }
.scene-list button.active { color: var(--yellow); border-color: var(--yellow); }

/* ---------- 说明区 ---------- */
.notes {
  margin-top: 26px;
  border-top: 1px solid var(--line);
  padding-top: 18px;
  font-size: 13.5px;
  line-height: 1.85;
  color: var(--muted);
}
.notes h2 { font-size: 14px; color: var(--text); margin: 0 0 8px; }
.notes code {
  font-family: var(--mono);
  font-size: 12px;
  background: rgba(139,155,180,0.14);
  padding: 1px 6px;
  border-radius: 4px;
  color: var(--yellow);
}
.notes kbd {
  font-family: var(--mono);
  font-size: 11.5px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 1px 6px;
  color: var(--text);
}
.notes ul { margin: 6px 0 0; padding-left: 20px; }
.notes li { margin: 3px 0; }

/* ---------- 录制模式：隐藏所有界面，只留画面 ---------- */
body.recording .hud,
body.recording .scene-list,
body.recording .page-head,
body.recording .notes { display: none; }

body.recording .page { padding: 0; max-width: none; }
body.recording .stage-wrap { border: 0; border-radius: 0; }
body.recording .play-cover { display: none; }

/* ---------- 播放遮罩：浏览器禁止带声音自动播放，需要一次用户点击 ---------- */
.play-cover {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: rgba(4, 7, 14, 0.62);
  cursor: pointer;
  z-index: 5;
  transition: opacity .25s;
}
.play-cover.hidden { opacity: 0; pointer-events: none; }

.play-cover .pc-btn {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  border: 2px solid var(--yellow);
  background: rgba(255, 201, 77, 0.12);
  color: var(--yellow);
  font-size: 36px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-left: 8px;
  margin: 0;
}
.play-cover:hover .pc-btn { background: rgba(255, 201, 77, 0.22); }
.play-cover .pc-tip { font-size: 14px; color: var(--text); }
.play-cover .pc-sub { font-size: 12.5px; color: var(--muted); }

/* 音频加载失败时的提示条 */
.audio-warn {
  margin-top: 8px;
  font-size: 12.5px;
  color: var(--yellow);
}

/* ---------- 公开访问模式（地址后加 ?public） ---------- */
/* 线上给观众看时用这个地址：隐藏所有制作相关界面，控制条只留播放与进度 */
body.public .notes,
body.public .scene-list { display: none; }

body.public .page { max-width: 1080px; }
body.public .page-head { justify-content: center; }
body.public .page-head h1 { font-size: 17px; }
body.public .hud .js-restart,
body.public .hud .js-speed,
body.public .hud .js-loop { display: none; }
body.public .stage-wrap { border-radius: 12px; }

/* ---------- 文字稿（SEO 正文） ----------
   动画画在 canvas 上，DOM 里没有正文，搜索引擎看到的是空白页。
   这个折叠区块是页面唯一能被索引的内容，所以：
     · 不要删
     · 不要改成 display:none（那样会被判成隐藏文字，反而有害）
   <details> 是合规做法：内容真实存在，用户点一下就能看到。 */
.transcript {
  margin-top: 24px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
  font-size: 14px;
  line-height: 1.95;
  color: var(--muted);
}

.transcript summary {
  cursor: pointer;
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  padding: 4px 0;
  list-style: none;
}
.transcript summary::-webkit-details-marker { display: none; }
.transcript summary::before {
  content: '▸ ';
  color: var(--yellow);
}
.transcript[open] summary::before { content: '▾ '; }
.transcript summary:hover { color: var(--yellow); }

.transcript-body { padding: 6px 0 4px; }
.transcript-body p { margin: 0 0 12px; }

/* ---------- 相关动画（内链） ----------
   内链既是给人看的"下一步"，也是告诉搜索引擎
   "这些页面属于同一个主题簇"的信号。 */
.related {
  margin-top: 26px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.related h2 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 10px;
}

.related ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 10px;
}

.related li a {
  display: block;
  text-decoration: none;
  color: inherit;
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 13px;
  transition: border-color .15s, transform .15s;
}
.related li a:hover { border-color: var(--muted); transform: translateY(-2px); }

.related li a b {
  display: block;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.related li a span {
  display: block;
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.6;
}

/* ---------- 索引页 ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(268px, 1fr));
  gap: 16px;
  margin-top: 22px;
}

.card {
  display: block;
  text-decoration: none;
  color: inherit;
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px 17px 17px;
  transition: border-color .15s, transform .15s;
}
.card:hover { border-color: var(--muted); transform: translateY(-2px); }

.card .code {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--yellow);
  letter-spacing: .06em;
}
.card h3 { font-size: 15px; margin: 7px 0 8px; line-height: 1.5; font-weight: 600; }
.card p { font-size: 12.5px; color: var(--muted); margin: 0; line-height: 1.7; }
.card .meta {
  margin-top: 11px;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--muted);
  display: flex;
  gap: 12px;
}

/* ---------- 手机适配 ---------- */
@media (max-width: 720px) {
  .page { padding: 12px 10px 32px; }
  .page-head { gap: 8px; }
  .page-head h1 { font-size: 15px; }
  .page-head .sub { font-size: 12px; }
  .hud { font-size: 12px; gap: 8px; }
  /* 手指点得中：按钮做大一点 */
  .hud button { padding: 8px 13px; font-size: 12.5px; min-height: 36px; }
  .scrub { flex: 1 1 100%; order: 3; height: 30px; }
  .scrub .track { height: 7px; }
  .time { font-size: 12px; }
  .scene-name { font-size: 12px; }
  .notes { font-size: 12.5px; }
  .grid { grid-template-columns: 1fr; }
  .card h3 { font-size: 14.5px; }
}

/* ---------- 触屏设备：键盘提示没意义，换成触屏提示 ---------- */
.hint-touch { display: none; }

@media (hover: none) {
  .hint-kbd { display: none; }
  .hint-touch { display: block; }
}

/* ---------- 伪全屏（CSS 兜底） ----------
   iPhone Safari 不支持对普通元素调用全屏 API，安卓 Chrome 支持。
   所以真全屏不可用时，用这套把画面铺满视口，效果基本一样。 */
body.immersive .page-head,
body.immersive .notes,
body.immersive .scene-list,
body.immersive .audio-warn { display: none; }

body.immersive .page { padding: 0; max-width: none; }

body.immersive .stage-wrap {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  border: 0;
  border-radius: 0;
  z-index: 9998;
}

/* 关键：保持 16:9，不拉伸变形。
   max-width 用视口高度反推，横屏时上下不留黑边，竖屏时左右不留黑边。 */
body.immersive .stage-wrap canvas {
  width: 100vw;
  height: auto;
  max-width: calc((100vh - 54px) * 1.7778);
  aspect-ratio: 16 / 9;
}

body.immersive .hud {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  margin: 0;
  padding: 6px 12px;
  background: rgba(4, 7, 14, 0.86);
  z-index: 9999;
}

/* 伪全屏里，把「退出全屏」按钮做得显眼一点 */
body.immersive .js-fs {
  border-color: var(--yellow);
  color: var(--yellow);
}
