/* =============================================================
   dsh-tree-task-flow · 介绍片
   1280×720 的设计画布，由脚本等比缩放进窗口；全部离线。
   ============================================================= */

:root {
  --bg: #070909;
  --stage: #0a0d0c;
  --ink: #edebe5;
  --ink-2: #b3b8b3;
  --ink-3: #7d857f;
  --line: rgba(237, 235, 229, 0.14);
  --line-soft: rgba(237, 235, 229, 0.07);
  --accent: #c9f96b;
  --accent-ink: #0a0d05;
  --accent-dim: rgba(201, 249, 107, 0.12);
  --mono: ui-monospace, "SFMono-Regular", "Cascadia Code", "Consolas",
    "Liberation Mono", "Menlo", monospace;
  --sans: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC",
    sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

a {
  color: inherit;
}

.v-top {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 14px clamp(16px, 3vw, 36px);
  border-bottom: 1px solid var(--line-soft);
  font-size: 13px;
  color: var(--ink-3);
  flex: none;
}

.v-top a {
  text-decoration: none;
  color: var(--ink-2);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.v-top a:hover {
  color: var(--accent);
}

.v-top .t {
  color: var(--ink);
  font-weight: 600;
  letter-spacing: -0.01em;
}

.v-top .t small {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--ink-3);
  font-weight: 400;
  letter-spacing: 0;
  margin-left: 8px;
}

.v-top .spacer {
  margin-left: auto;
}

.v-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(16px, 3vw, 40px) clamp(16px, 3vw, 36px) 10px;
}

.player {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 12px 12px 0 0;
  overflow: hidden;
}

/* 缩放的画布 */
.stage {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 1280px;
  height: 720px;
  transform-origin: center center;
  background:
    radial-gradient(120% 90% at 50% 0%, rgba(201, 249, 107, 0.06), transparent 60%),
    var(--stage);
  color: var(--ink);
  overflow: hidden;
  font-family: var(--sans);
}

.stage::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: linear-gradient(var(--line-soft) 1px, transparent 1px),
    linear-gradient(90deg, var(--line-soft) 1px, transparent 1px);
  background-size: 64px 64px;
  opacity: 0.35;
  mask-image: radial-gradient(80% 70% at 50% 40%, #000, transparent 85%);
  pointer-events: none;
}

.scene {
  position: absolute;
  inset: 0;
  padding: 64px 76px;
  opacity: 0;
  will-change: opacity;
}

/* 场景通用元素 */
.eyebrow {
  font-family: var(--mono);
  font-size: 14px;
  letter-spacing: 0.16em;
  color: var(--accent);
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 12px;
}

.eyebrow::before {
  content: "";
  width: 26px;
  height: 1px;
  background: var(--accent);
}

.scene h1 {
  margin: 18px 0 0;
  font-size: 58px;
  line-height: 1.12;
  letter-spacing: -0.02em;
  font-weight: 700;
}

.scene h1 em {
  font-style: normal;
  color: var(--accent);
}

.scene .sub {
  margin-top: 14px;
  font-size: 22px;
  line-height: 1.55;
  color: var(--ink-2);
  max-width: 720px;
}

/* ---------- 场景 1：上下文膨胀 ---------- */

.s1-panel {
  position: absolute;
  left: 76px;
  top: 290px;
  width: 860px;
  height: 320px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(180deg, #101413, #0b0e0d);
  overflow: hidden;
  box-shadow: 0 30px 80px -40px #000;
}

.s1-view {
  position: absolute;
  left: 0;
  right: 0;
  top: 47px;
  bottom: 12px;
  overflow: hidden;
  mask-image: linear-gradient(180deg, transparent 0, #000 8%, #000 92%, transparent 100%);
  -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 8%, #000 92%, transparent 100%);
}

.s1-panel-head {
  display: flex;
  justify-content: space-between;
  padding: 13px 18px;
  border-bottom: 1px solid var(--line-soft);
  font-family: var(--mono);
  font-size: 13px;
  color: var(--ink-3);
  letter-spacing: 0.04em;
}

.s1-rows {
  position: static;
  padding: 10px 18px;
  will-change: transform;
}

.s1-row {
  display: flex;
  gap: 14px;
  height: 30px;
  align-items: center;
  font-family: var(--mono);
  font-size: 14px;
  color: var(--ink-2);
  opacity: 0;
  white-space: nowrap;
}

.s1-row .op {
  width: 92px;
  flex: none;
  text-align: right;
  color: var(--ink-3);
  font-size: 12.5px;
}

.s1-row .file {
  overflow: hidden;
  text-overflow: ellipsis;
}

.s1-row::after,
.s3-row::after {
  content: "ok";
  margin-left: auto;
  flex: none;
  padding-left: 16px;
  font-size: 10.5px;
  letter-spacing: 0.1em;
  color: var(--ink-3);
  opacity: 0.5;
}

.s1-row.hot .file {
  color: var(--ink);
}

/* 计量条 */
.s1-meter {
  position: absolute;
  right: 96px;
  top: 290px;
  width: 26px;
  height: 320px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #0c0f0e;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
}

.s1-meter i {
  display: block;
  width: 100%;
  height: 6%;
  background: linear-gradient(180deg, var(--accent), rgba(201, 249, 107, 0.35));
  border-radius: 999px;
  transition: none;
}

.s1-meter-label {
  position: absolute;
  right: 84px;
  top: 246px;
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--ink-3);
  letter-spacing: 0.08em;
  text-align: right;
}

.s1-now {
  position: absolute;
  right: 96px;
  top: 270px;
  width: 320px;
  text-align: right;
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--ink-3);
  opacity: 0;
}

.s1-now b {
  color: var(--accent);
  font-weight: 500;
}

/* ---------- 场景 2：需求 / 任务 / 步骤 ---------- */

.node {
  position: absolute;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(180deg, #121716, #0d1110);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  opacity: 0;
  transform: translateY(14px);
  box-shadow: 0 18px 40px -30px #000;
  white-space: nowrap;
}

.node .tag {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--ink-3);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 2px 7px;
  flex: none;
}

.node .name {
  font-size: 19px;
  color: var(--ink-2);
}

.node .st {
  margin-left: 12px;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--ink-3);
}

.node.req {
  border-color: rgba(201, 249, 107, 0.55);
  background: linear-gradient(180deg, rgba(201, 249, 107, 0.1), rgba(201, 249, 107, 0.03));
}

.node.req .tag {
  border-color: rgba(201, 249, 107, 0.5);
  color: var(--accent);
  background: var(--accent-dim);
}

.node.req .name {
  color: var(--ink);
  font-weight: 600;
}

.node.req .st,
.node.done .st {
  color: var(--accent);
}

.edge {
  position: absolute;
  background: var(--line);
  transform-origin: left center;
  transform: scaleX(0);
}

.edge.h {
  height: 1px;
}

.edge.v {
  width: 1px;
  transform-origin: top center;
  transform: scaleY(0);
}

/* ---------- 场景 3：折叠 ---------- */

.s3-panel {
  position: absolute;
  left: 120px;
  top: 230px;
  width: 760px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(180deg, #101413, #0b0e0d);
  overflow: hidden;
  box-shadow: 0 30px 90px -40px #000;
}

.s3-head {
  display: flex;
  justify-content: space-between;
  padding: 13px 18px;
  border-bottom: 1px solid var(--line-soft);
  font-family: var(--mono);
  font-size: 13px;
  color: var(--ink-3);
}

.s3-body {
  padding: 8px 18px 14px;
}

.s3-row {
  display: flex;
  gap: 14px;
  align-items: center;
  height: 30px;
  font-family: var(--mono);
  font-size: 14px;
  color: var(--ink-2);
  overflow: hidden;
  opacity: 0;
}

.s3-row .op {
  width: 92px;
  flex: none;
  text-align: right;
  color: var(--ink-3);
  font-size: 12.5px;
}

.s3-done {
  position: absolute;
  left: 920px;
  top: 244px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  font-family: var(--mono);
  font-size: 14px;
  color: var(--ink-2);
  opacity: 0;
}

.s3-done .pill {
  border: 1px solid rgba(201, 249, 107, 0.5);
  background: var(--accent-dim);
  color: var(--accent);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 12.5px;
}

.s3-notice {
  margin: 4px 0 10px;
  border-left: 2px solid var(--accent);
  background: var(--accent-dim);
  border-radius: 0 10px 10px 0;
  padding: 12px 16px;
  opacity: 0;
  transform: translateY(8px);
  overflow: hidden;
  max-height: 0;
}

.s3-notice .nt {
  font-size: 18px;
  color: var(--ink);
}

.s3-notice .files {
  margin-top: 4px;
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--ink-2);
  line-height: 1.7;
}

.s3-notice .files span {
  color: var(--ink-3);
}

.s3-after {
  position: absolute;
  left: 920px;
  top: 350px;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--ink-3);
  text-align: left;
  opacity: 0;
  line-height: 2;
  display: block;
}

.s3-after b {
  color: var(--accent);
  font-weight: 500;
}

/* ---------- 场景 4：结果留下 ---------- */

.result-card {
  position: absolute;
  left: 150px;
  top: 250px;
  width: 900px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(180deg, #111614, #0b0f0e);
  padding: 26px 30px;
  overflow: hidden;
  box-shadow: 0 40px 90px -50px #000;
  opacity: 0;
  transform: translateY(16px);
}

.result-card .rc-head {
  font-family: var(--mono);
  font-size: 12.5px;
  letter-spacing: 0.05em;
  color: var(--ink-3);
  text-transform: uppercase;
}

.result-card .rc-line {
  margin-top: 12px;
  font-size: 25px;
  line-height: 1.5;
  color: var(--ink);
}

.result-card .rc-line code {
  font-family: var(--mono);
  font-size: 21px;
  color: var(--accent);
}

.result-card .rc-sub {
  margin-top: 10px;
  font-size: 17px;
  color: var(--ink-2);
  line-height: 1.6;
}

.sweep {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 180px;
  background: linear-gradient(90deg, transparent, rgba(201, 249, 107, 0.13), transparent);
  transform: skewX(-12deg);
  opacity: 0;
  pointer-events: none;
}

.tags {
  position: absolute;
  left: 150px;
  top: 470px;
  display: flex;
  gap: 14px;
}

.tags span {
  font-family: var(--mono);
  font-size: 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 14px;
  color: var(--ink-2);
  opacity: 0;
  transform: translateY(8px);
  background: #0c0f0e;
}

.tags span b {
  color: var(--accent);
  font-weight: 500;
}

.s4-note {
  position: absolute;
  left: 150px;
  top: 532px;
  font-size: 16px;
  color: var(--ink-3);
  opacity: 0;
  max-width: 900px;
  line-height: 1.7;
}

/* ---------- 场景 5：收束 ---------- */

.s5 {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0 90px;
}

.s5 h1 {
  font-size: 92px;
  margin: 0;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.s5 .s5-sub {
  margin-top: 24px;
  font-size: 22px;
  color: var(--ink-2);
  opacity: 0;
}

.s5 .s5-meta {
  margin-top: 40px;
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.14em;
  color: var(--ink-3);
  opacity: 0;
  text-transform: uppercase;
}

.s5 .s5-rule {
  width: 1px;
  height: 56px;
  background: linear-gradient(var(--line), transparent);
  margin-top: 34px;
  opacity: 0;
}

/* 场景顶部的品牌条 */
.stage-brand {
  position: absolute;
  left: 76px;
  top: 34px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--ink-3);
  z-index: 5;
}

.stage-brand svg {
  width: 18px;
  height: 18px;
  color: var(--accent);
}

.stage-tick {
  position: absolute;
  right: 76px;
  top: 34px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-3);
  letter-spacing: 0.06em;
  z-index: 5;
}

.stage-tick b {
  color: var(--ink-2);
  font-weight: 500;
}

/* ---------- 字幕 ---------- */

.subs {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 44px;
  display: flex;
  justify-content: center;
  pointer-events: none;
  z-index: 8;
}

.subs span {
  max-width: 1000px;
  padding: 9px 22px;
  border-radius: 10px;
  background: rgba(6, 8, 8, 0.72);
  backdrop-filter: blur(4px);
  border: 1px solid var(--line-soft);
  font-size: 21px;
  line-height: 1.55;
  color: #f3f1ea;
  text-align: center;
  letter-spacing: 0.01em;
  text-wrap: balance;
}

.subs.subs-off {
  display: none;
}

/* ---------- 控制条 ---------- */

.bar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 0 0 12px 12px;
  background: #0c0f0e;
  flex: none;
}

.bar button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 34px;
  min-width: 34px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink-2);
  font: inherit;
  font-size: 12.5px;
  cursor: pointer;
  transition: border-color 0.18s, color 0.18s, background 0.18s;
}

.bar button:hover {
  border-color: rgba(201, 249, 107, 0.5);
  color: var(--ink);
}

.bar button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.bar button svg {
  width: 15px;
  height: 15px;
}

.bar .time {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-3);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.bar .time b {
  color: var(--ink-2);
  font-weight: 500;
}

.progress {
  position: relative;
  flex: 1;
  height: 34px;
  display: flex;
  align-items: center;
  min-width: 80px;
}

.progress input {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  margin: 0;
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    var(--accent) calc(var(--p, 0) * 100%),
    rgba(237, 235, 229, 0.16) calc(var(--p, 0) * 100%)
  );
  cursor: pointer;
  outline: none;
}

.progress input::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid #0c0f0e;
  cursor: pointer;
}

.progress input::-moz-range-thumb {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid #0c0f0e;
  cursor: pointer;
}

.progress input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

.bar .cc[aria-pressed="false"] {
  color: var(--ink-3);
  opacity: 0.6;
}

.v-note {
  max-width: 1180px;
  margin: 14px auto 0;
  font-size: 12.5px;
  color: var(--ink-3);
  line-height: 1.8;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 20px;
}

.v-note kbd {
  font-family: var(--mono);
  font-size: 11px;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 1px 5px;
  color: var(--ink-2);
}

.v-note .end {
  margin-left: auto;
}

/* ---------- 全屏 ---------- */

.player:fullscreen {
  max-width: none;
  width: 100%;
  height: 100%;
  padding: 0;
  background: #000;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.player:fullscreen .frame {
  width: min(100vw, calc((100vh - 62px) * 16 / 9));
  margin: 0 auto;
  border: 0;
  border-radius: 0;
}

.player:fullscreen .bar {
  width: min(100vw, calc((100vh - 62px) * 16 / 9));
  margin: 0 auto;
  border-radius: 0;
  background: #000;
  border-color: var(--line-soft);
}

/* 全屏时隐藏顶栏 */
body.is-fs .v-top {
  display: none;
}

/* ---------- 窄屏 ---------- */

@media (max-width: 720px) {
  .v-top .t small,
  .v-top .hint {
    display: none;
  }

  .bar {
    gap: 8px;
    padding: 10px;
  }

  .bar .time {
    font-size: 11px;
  }

  .bar button span.label {
    display: none;
  }

  .v-note {
    font-size: 11.5px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .stage * {
    transition: none !important;
  }
}
