/* =========================================================
   CCS'26 组会汇报 · 设计系统
   舞台按 1920×1080 设计，整体等比缩放适配任意屏幕
   ========================================================= */

@font-face { font-family: "InterV"; src: url("../fonts/inter.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "JBMono"; src: url("../fonts/jetbrains-mono.woff2") format("woff2"); font-weight: 100 800; font-display: swap; }
@font-face { font-family: "Grotesk"; src: url("../fonts/space-grotesk.woff2") format("woff2"); font-weight: 300 700; font-display: swap; }

:root {
  --font-sans: "InterV", "PingFang SC", "Microsoft YaHei UI", "Microsoft YaHei", "Noto Sans SC", "Source Han Sans SC", system-ui, sans-serif;
  --font-display: "Grotesk", "InterV", "PingFang SC", "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
  --font-mono: "JBMono", "Cascadia Code", Consolas, "Microsoft YaHei UI", monospace;

  --ease-out: cubic-bezier(.16, .84, .3, 1);
  --ease-spring: cubic-bezier(.34, 1.4, .5, 1);
  --radius: 22px;
  --radius-sm: 14px;
}

/* ---------- 深色主题（默认） ---------- */
:root,
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #060912;
  --bg-glow-1: rgba(70, 190, 255, .11);
  --bg-glow-2: rgba(150, 120, 255, .10);
  --dot: rgba(170, 190, 230, .055);
  --surface: rgba(160, 180, 220, .055);
  --surface-2: rgba(160, 180, 220, .09);
  --surface-3: rgba(160, 180, 220, .15);
  --panel: #0b1221;
  --panel-2: #0f1829;
  --line: rgba(160, 180, 220, .14);
  --line-2: rgba(160, 180, 220, .28);
  --ink: #edf2fb;
  --ink-2: #a9b5ca;
  --ink-3: #6f7c94;
  --ink-inv: #04101a;

  --cyan: #56d4ff;
  --teal: #34e0c0;
  --violet: #a594ff;
  --amber: #ffc857;
  --rose: #ff6b8b;
  --green: #4ade80;
  --blue: #6aa8ff;
  --orange: #ff9f5a;

  --accent: var(--cyan);
  --shadow: 0 30px 80px -30px rgba(0, 0, 0, .7);
  --glow: 0 0 0 1px rgba(86, 212, 255, .35), 0 0 32px -4px rgba(86, 212, 255, .45);
}

/* ---------- 浅色主题（按 T 切换，适合亮堂的会议室投影） ---------- */
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f3f5f9;
  --bg-glow-1: rgba(14, 165, 233, .09);
  --bg-glow-2: rgba(124, 58, 237, .07);
  --dot: rgba(20, 40, 80, .07);
  --surface: rgba(255, 255, 255, .78);
  --surface-2: #ffffff;
  --surface-3: #e9eef6;
  --panel: #ffffff;
  --panel-2: #f6f8fc;
  --line: rgba(15, 30, 60, .11);
  --line-2: rgba(15, 30, 60, .22);
  --ink: #0c1424;
  --ink-2: #46546a;
  --ink-3: #7f8da3;
  --ink-inv: #ffffff;

  --cyan: #0a8fd1;
  --teal: #0e9e86;
  --violet: #6b52e6;
  --amber: #c47f00;
  --rose: #df3459;
  --green: #149b45;
  --blue: #2f6fe0;
  --orange: #de6419;

  --shadow: 0 24px 60px -28px rgba(20, 40, 80, .35);
  --glow: 0 0 0 1px rgba(10, 143, 209, .35), 0 0 26px -6px rgba(10, 143, 209, .45);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body { transition: background-color .4s ease, color .4s ease; }

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

/* ---------- 舞台 ---------- */
#viewport {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background:
    radial-gradient(900px 700px at 12% 8%, var(--bg-glow-1), transparent 70%),
    radial-gradient(1000px 800px at 90% 95%, var(--bg-glow-2), transparent 70%),
    var(--bg);
}

#viewport::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(var(--dot) 1.2px, transparent 1.3px);
  background-size: 34px 34px;
  mask-image: radial-gradient(ellipse at 50% 45%, #000 40%, transparent 85%);
  pointer-events: none;
}

#stage {
  position: absolute;
  left: 0;
  top: 0;
  width: 1920px;
  height: 1080px;
  transform-origin: 0 0;
}

.scene {
  position: absolute;
  inset: 0;
  padding: 78px 120px 90px;
  opacity: 0;
  visibility: hidden;
  transform: translateX(46px);
  transition: opacity .55s ease, transform .7s var(--ease-out), visibility 0s linear .7s;
  display: flex;
  flex-direction: column;
}

.scene.active {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition: opacity .55s ease .08s, transform .7s var(--ease-out) .04s, visibility 0s;
  z-index: 2;
}

.scene.past { transform: translateX(-46px); }

.notes { display: none !important; }

/* ---------- 逐步显示 ---------- */
.scene [data-at] {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity .6s ease, transform .75s var(--ease-out), filter .6s ease;
  transition-delay: calc(var(--i, 0) * 70ms);
}
.scene [data-at][data-fx="fade"] { transform: none; }
.scene [data-at][data-fx="left"] { transform: translateX(-28px); }
.scene [data-at][data-fx="right"] { transform: translateX(28px); }
.scene [data-at][data-fx="scale"] { transform: scale(.94); }
.scene [data-at][data-fx="blur"] { transform: none; filter: blur(10px); }
.scene [data-at].shown { opacity: 1; transform: none; filter: none; }
.scene [data-at]:not(.shown) { pointer-events: none; }
.scene [data-until].gone { opacity: 0 !important; transform: translateY(-14px) !important; pointer-events: none; }

/* ---------- 版式 ---------- */
.head { flex: none; margin-bottom: 34px; }

.kicker {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  font-family: var(--font-mono);
  font-size: 19px;
  font-weight: 500;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--accent);
}
.kicker::before {
  content: "";
  width: 34px;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
}
.kicker .sep { opacity: .45; }

.h1 {
  margin: 14px 0 0;
  font-size: 64px;
  line-height: 1.14;
  font-weight: 750;
  letter-spacing: -.012em;
}
.h1 em, .hl { font-style: normal; color: var(--accent); }
.h1 .soft { color: var(--ink-3); font-weight: 600; }

.lead {
  margin: 14px 0 0;
  font-size: 29px;
  line-height: 1.5;
  color: var(--ink-2);
  font-weight: 400;
}

.body { font-size: 26px; line-height: 1.55; color: var(--ink-2); }
.small { font-size: 21px; line-height: 1.5; color: var(--ink-3); }
.tiny { font-size: 17px; line-height: 1.45; color: var(--ink-3); }
.mono { font-family: var(--font-mono); }
.num { font-family: var(--font-display); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.ink { color: var(--ink); }
.muted { color: var(--ink-2); }
.faint { color: var(--ink-3); }
.c-cyan { color: var(--cyan); } .c-teal { color: var(--teal); } .c-violet { color: var(--violet); }
.c-amber { color: var(--amber); } .c-rose { color: var(--rose); } .c-green { color: var(--green); }
.c-blue { color: var(--blue); } .c-orange { color: var(--orange); }
.b { font-weight: 700; color: var(--ink); }

.fill { flex: 1; min-height: 0; position: relative; }
.row { display: flex; gap: 28px; }
.col { display: flex; flex-direction: column; gap: 20px; }
.center { display: flex; align-items: center; justify-content: center; }
.grow { flex: 1; min-width: 0; }

/* ---------- 组件 ---------- */
.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 30px 32px;
  transition: border-color .3s ease, background-color .3s ease, box-shadow .3s ease, transform .4s var(--ease-out), opacity .4s ease;
}
.card.solid { background: var(--panel); }
.card.lift { box-shadow: var(--shadow); }
.card-title { font-size: 28px; font-weight: 700; color: var(--ink); margin: 0 0 10px; }
.card-sub { font-size: 21px; color: var(--ink-3); margin: 0; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 9px 18px;
  border-radius: 999px;
  font-size: 21px;
  line-height: 1.2;
  border: 1px solid var(--line-2);
  background: var(--surface);
  color: var(--ink-2);
  white-space: nowrap;
}
.chip .dot { width: 9px; height: 9px; border-radius: 50%; background: currentColor; }
.chip.cyan { color: var(--cyan); border-color: color-mix(in srgb, var(--cyan) 45%, transparent); background: color-mix(in srgb, var(--cyan) 9%, transparent); }
.chip.teal { color: var(--teal); border-color: color-mix(in srgb, var(--teal) 45%, transparent); background: color-mix(in srgb, var(--teal) 9%, transparent); }
.chip.violet { color: var(--violet); border-color: color-mix(in srgb, var(--violet) 45%, transparent); background: color-mix(in srgb, var(--violet) 9%, transparent); }
.chip.amber { color: var(--amber); border-color: color-mix(in srgb, var(--amber) 45%, transparent); background: color-mix(in srgb, var(--amber) 9%, transparent); }
.chip.rose { color: var(--rose); border-color: color-mix(in srgb, var(--rose) 45%, transparent); background: color-mix(in srgb, var(--rose) 9%, transparent); }
.chip.green { color: var(--green); border-color: color-mix(in srgb, var(--green) 45%, transparent); background: color-mix(in srgb, var(--green) 9%, transparent); }
.chip.blue { color: var(--blue); border-color: color-mix(in srgb, var(--blue) 45%, transparent); background: color-mix(in srgb, var(--blue) 9%, transparent); }
.chip.mono { font-family: var(--font-mono); font-size: 19px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 13px 26px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  background: var(--surface-2);
  color: var(--ink);
  font-size: 22px;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  transition: transform .15s ease, border-color .2s ease, background-color .2s ease, box-shadow .25s ease, opacity .2s;
}
.btn:hover { border-color: var(--accent); box-shadow: var(--glow); }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--accent); border-color: transparent; color: var(--ink-inv); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { background: var(--rose); border-color: transparent; color: #fff; }
.btn.ghost { background: transparent; }
.btn.sm { padding: 9px 18px; font-size: 19px; }
.btn[disabled] { opacity: .4; pointer-events: none; }
.btn svg { width: 22px; height: 22px; }

/* 分段控件 */
.seg {
  display: inline-flex;
  padding: 5px;
  gap: 4px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
}
.seg button {
  border: 0;
  background: transparent;
  padding: 10px 22px;
  border-radius: 999px;
  font-size: 21px;
  font-weight: 600;
  color: var(--ink-2);
  cursor: pointer;
  transition: background-color .25s ease, color .25s ease;
  white-space: nowrap;
}
.seg button:hover { color: var(--ink); }
.seg button.on { background: var(--accent); color: var(--ink-inv); }

/* 开关 */
.switch {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  user-select: none;
  font-size: 22px;
  color: var(--ink-2);
}
.switch input { display: none; }
.switch .track {
  position: relative;
  width: 62px;
  height: 34px;
  border-radius: 999px;
  background: var(--surface-3);
  border: 1px solid var(--line-2);
  transition: background-color .25s ease;
  flex: none;
}
.switch .track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--ink);
  transition: transform .3s var(--ease-spring);
}
.switch input:checked + .track { background: var(--green); border-color: transparent; }
.switch input:checked + .track::after { transform: translateX(28px); background: #fff; }
.switch input:checked ~ .lbl { color: var(--ink); }

/* 滑块 */
input[type="range"].rng {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 40px;
  background: transparent;
  cursor: pointer;
  --p: 50%;
}
input[type="range"].rng::-webkit-slider-runnable-track {
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent) var(--p), var(--surface-3) var(--p));
  border: 1px solid var(--line);
}
input[type="range"].rng::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 34px;
  height: 34px;
  margin-top: -13px;
  border-radius: 50%;
  background: #fff;
  border: 4px solid var(--accent);
  box-shadow: 0 4px 14px rgba(0, 0, 0, .35);
  transition: transform .15s ease;
}
input[type="range"].rng:active::-webkit-slider-thumb { transform: scale(1.12); }
input[type="range"].rng::-moz-range-track { height: 10px; border-radius: 999px; background: var(--surface-3); }
input[type="range"].rng::-moz-range-progress { height: 10px; border-radius: 999px; background: var(--accent); }
input[type="range"].rng::-moz-range-thumb { width: 28px; height: 28px; border-radius: 50%; background: #fff; border: 4px solid var(--accent); }

/* 引语 */
.quote {
  position: relative;
  padding: 6px 0 6px 30px;
  border-left: 4px solid var(--accent);
}
.quote p { margin: 0; font-size: 27px; line-height: 1.5; color: var(--ink); font-style: italic; }
.quote cite { display: block; margin-top: 10px; font-style: normal; font-size: 20px; color: var(--ink-3); font-family: var(--font-mono); }

/* 代码块 */
.code {
  font-family: var(--font-mono);
  font-size: 21px;
  line-height: 1.6;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 22px 26px;
  white-space: pre;
  color: var(--ink-2);
  overflow: hidden;
}
.code .k { color: var(--violet); }
.code .t { color: var(--cyan); }
.code .s { color: var(--green); }
.code .n { color: var(--orange); }
.code .c { color: var(--ink-3); font-style: italic; }
.code .bad { background: color-mix(in srgb, var(--rose) 18%, transparent); border-radius: 6px; box-shadow: 0 0 0 2px color-mix(in srgb, var(--rose) 50%, transparent); color: var(--ink); }

.term {
  font-family: var(--font-mono);
  font-size: 20px;
  line-height: 1.6;
  background: #070b12;
  color: #cfe3f5;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: var(--shadow);
}
:root[data-theme="light"] .term { background: #0e1422; }
.term .bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: rgba(255, 255, 255, .04);
  border-bottom: 1px solid rgba(255, 255, 255, .07);
  font-size: 16px;
  color: #7b8aa3;
}
.term .bar i { width: 12px; height: 12px; border-radius: 50%; background: #ff5f57; display: inline-block; }
.term .bar i:nth-child(2) { background: #febc2e; }
.term .bar i:nth-child(3) { background: #28c840; margin-right: 10px; }
.term .out { padding: 16px 20px; white-space: pre-wrap; word-break: break-all; }
.term .err { color: #ff7b93; }
.term .warn { color: #ffd166; }
.term .ok { color: #5ef0a0; }
.term .dim { color: #6b7a92; }
.term .cmd { color: #9fd8ff; }

/* 统计大数字 */
.stat .v { font-family: var(--font-display); font-weight: 700; font-size: 120px; line-height: 1; letter-spacing: -.03em; color: var(--ink); }
.stat .v small { font-size: .45em; color: var(--ink-3); font-weight: 600; margin-left: 6px; }
.stat .l { margin-top: 10px; font-size: 23px; color: var(--ink-2); }

/* 图标 */
.ico { width: 1em; height: 1em; display: inline-block; vertical-align: -0.14em; }
svg.i { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* 角标：发现编号 */
.lesson-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  padding: 0 10px;
  border-radius: 12px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 23px;
  color: var(--ink-inv);
  background: var(--accent);
}

/* 底部注脚 */
.foot-note {
  position: absolute;
  left: 120px;
  right: 120px;
  bottom: 38px;
  font-size: 16px;
  color: var(--ink-3);
  display: flex;
  justify-content: space-between;
  gap: 30px;
  pointer-events: none;
}

/* ---------- HUD ---------- */
#hud {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  pointer-events: none;
}
#progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 4px;
  display: flex;
  gap: 3px;
  padding: 0 3px;
  opacity: .9;
}
#progress span {
  flex: 1;
  background: var(--line);
  border-radius: 2px;
  transition: background-color .4s ease;
}
#progress span.done { background: color-mix(in srgb, var(--accent) 55%, transparent); }
#progress span.cur { background: var(--accent); }

#hudbar {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink-3);
  opacity: 0;
  transition: opacity .35s ease;
}
body.show-hud #hudbar { opacity: 1; pointer-events: auto; }
#hudbar .grp { display: flex; align-items: center; gap: 8px; }
#hudbar button {
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 70%, transparent);
  color: var(--ink-2);
  border-radius: 8px;
  padding: 5px 10px;
  font-family: var(--font-mono);
  font-size: 13px;
  cursor: pointer;
}
#hudbar button:hover { color: var(--ink); border-color: var(--line-2); }
#hudbar .steps { display: inline-flex; gap: 5px; margin-left: 6px; }
#hudbar .steps i { width: 6px; height: 6px; border-radius: 50%; background: var(--line-2); }
#hudbar .steps i.on { background: var(--accent); }

#pageNo {
  position: absolute; right: 22px; bottom: 14px; font-family: var(--font-mono); font-size: 13px; letter-spacing: .1em;
  color: var(--ink-3); opacity: .7; transition: opacity .3s ease;
}
body.show-hud #pageNo { opacity: 0; }

/* ---------- 总览 ---------- */
#overview {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(12px);
  display: none;
  overflow: auto;
  padding: 48px 56px;
}
body.overview #overview { display: block; }
#overview h2 { margin: 0 0 26px; font-size: 22px; font-family: var(--font-mono); color: var(--ink-3); font-weight: 500; letter-spacing: .12em; }
#overview .grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
#overview .item {
  text-align: left;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 14px;
  padding: 16px 18px 18px;
  cursor: pointer;
  transition: border-color .2s, transform .2s;
  min-height: 112px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
#overview .item:hover { border-color: var(--accent); transform: translateY(-2px); }
#overview .item.cur { border-color: var(--accent); box-shadow: var(--glow); }
#overview .item .n { font-family: var(--font-mono); font-size: 13px; color: var(--accent); letter-spacing: .1em; }
#overview .item .t { font-size: 17px; font-weight: 650; color: var(--ink); line-height: 1.35; }
#overview .item .c { font-size: 13px; color: var(--ink-3); margin-top: auto; }

/* ---------- 黑屏 & 帮助 ---------- */
#blackout { position: fixed; inset: 0; background: #000; z-index: 60; display: none; }
body.blackout #blackout { display: block; }

#help {
  position: fixed;
  right: 22px;
  bottom: 46px;
  z-index: 50;
  width: 380px;
  padding: 20px 22px;
  border-radius: 16px;
  background: var(--panel);
  border: 1px solid var(--line-2);
  box-shadow: var(--shadow);
  font-size: 14px;
  color: var(--ink-2);
  display: none;
}
body.help #help { display: block; }
#help h3 { margin: 0 0 12px; font-size: 15px; color: var(--ink); }
#help table { width: 100%; border-collapse: collapse; }
#help td { padding: 5px 0; vertical-align: top; }
#help td:first-child { width: 130px; }
#help kbd {
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 2px 7px;
  border-radius: 6px;
  border: 1px solid var(--line-2);
  background: var(--surface-2);
  color: var(--ink);
  margin-right: 3px;
}

/* ---------- 讲稿浮层（N 键，排练用） ---------- */
#notesPanel {
  position: fixed;
  left: 22px;
  bottom: 46px;
  z-index: 50;
  width: min(760px, 60vw);
  max-height: 46vh;
  overflow: auto;
  padding: 20px 24px;
  border-radius: 16px;
  background: color-mix(in srgb, var(--panel) 96%, transparent);
  border: 1px solid var(--line-2);
  box-shadow: var(--shadow);
  font-size: 16px;
  line-height: 1.7;
  color: var(--ink-2);
  display: none;
}
body.notes-on #notesPanel { display: block; }
#notesPanel h4 { margin: 0 0 8px; color: var(--accent); font-family: var(--font-mono); font-size: 13px; letter-spacing: .1em; display: flex; justify-content: space-between; }
#notesPanel p { margin: 0 0 8px; }
#notesPanel b { color: var(--ink); }

@media (prefers-reduced-motion: reduce) {
  .scene, .scene [data-at] { transition-duration: .01s !important; }
}
