:root {
  --ink: #12304f;
  --ink-soft: #46647e;
  --paper: #eaf5ff;
  --paper-2: #f8fcff;
  --line: rgba(55, 119, 168, .2);
  --ochre: #2d78c4;
  --ochre-2: #6aafe5;
  --moss: #2f7891;
  --moss-2: #6b9db2;
  --night: #173f67;
  --gold: #70bfe9;
  --white: #fbfdff;
  --font: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif;
  --serif: "Songti SC", "STSong", "Noto Serif CJK SC", serif;
}

* { box-sizing: border-box; }

html,
body { width: 100%; height: 100%; }

body {
  margin: 0;
  overflow: hidden;
  color: var(--ink);
  background: #d5e6f4;
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
a { font: inherit; }

button { color: inherit; }

button:focus-visible,
a:focus-visible {
  outline: 4px solid rgba(45, 120, 196, .5);
  outline-offset: 4px;
}

.viewport {
  position: fixed;
  inset: 0;
  overflow: hidden;
}

.stage {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 1600px;
  height: 900px;
  overflow: hidden;
  transform-origin: center;
  background:
    radial-gradient(circle at 10% 0%, rgba(255, 255, 255, .98), transparent 31%),
    radial-gradient(circle at 92% 86%, rgba(75, 167, 224, .16), transparent 29%),
    linear-gradient(135deg, #f8fcff 0%, #dceeff 100%);
  box-shadow: 0 38px 100px rgba(20, 66, 105, .22);
}

.paper-grain {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: .16;
  background-image:
    repeating-linear-gradient(0deg, rgba(33, 99, 150, .045) 0 1px, transparent 1px 4px),
    repeating-linear-gradient(90deg, rgba(33, 99, 150, .022) 0 1px, transparent 1px 7px);
  mix-blend-mode: multiply;
}

.topbar,
.workspace,
.footerbar { position: relative; z-index: 1; }

.topbar {
  height: 126px;
  padding: 33px 56px 19px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  border-bottom: 1px solid rgba(55, 119, 168, .16);
}

.brand-block { min-width: 0; }

.eyebrow,
.micro-label {
  margin: 0 0 6px;
  color: var(--ochre);
  font-size: 15px;
  font-weight: 850;
  letter-spacing: .16em;
}

.brand-block h1 {
  display: inline;
  margin: 0;
  font: 900 46px/1 var(--serif);
  letter-spacing: -.04em;
}

.subtitle {
  display: inline;
  margin: 0 0 0 18px;
  color: #54728b;
  font-size: 18px;
  font-weight: 650;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.control,
.icon-control {
  height: 48px;
  border: 1px solid rgba(53, 111, 158, .22);
  background: rgba(250, 253, 255, .78);
  box-shadow: 0 8px 24px rgba(33, 92, 139, .09);
  cursor: pointer;
  transition: transform .18s ease, background .18s ease, border-color .18s ease;
}

.control:hover,
.icon-control:hover { transform: translateY(-2px); border-color: rgba(45, 120, 196, .58); }

.control {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 17px;
  border-radius: 16px;
  font-size: 16px;
  font-weight: 800;
}

.control.primary { color: #fff; border-color: var(--ochre); background: var(--ochre); }
.control.is-active { color: #fff; border-color: var(--moss); background: var(--moss); }

.control svg,
.icon-control svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.control.primary svg path:first-child { fill: currentColor; stroke: none; }

.icon-control {
  width: 48px;
  padding: 0;
  display: grid;
  place-items: center;
  border-radius: 50%;
}

.icon-control[aria-pressed="true"] { color: #fff; border-color: var(--night); background: var(--night); }

.workspace {
  height: 725px;
  padding: 22px 56px 18px;
  display: grid;
  grid-template-columns: 770px 1fr;
  grid-template-rows: minmax(0, 1fr);
  gap: 25px;
}

.comic-shell,
.story-console {
  min-width: 0;
  min-height: 0;
  border: 1px solid var(--line);
  background: rgba(249, 253, 255, .84);
  box-shadow: 0 24px 64px rgba(31, 91, 139, .11);
  backdrop-filter: blur(16px);
}

.comic-shell {
  padding: 18px 20px 15px;
  border-radius: 27px;
}

.comic-heading {
  height: 50px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.comic-heading .micro-label { margin-bottom: 3px; font-size: 12px; }

.comic-heading h2 {
  margin: 0;
  color: #244662;
  font: 800 23px/1.2 var(--serif);
}

.comic-legend {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-top: 7px;
  color: #5f7990;
  font-size: 13px;
  font-weight: 700;
}

.comic-legend span { display: flex; align-items: center; gap: 6px; }

.legend-dot { width: 9px; height: 9px; border-radius: 50%; }
.legend-dot.fact { background: var(--ochre); }
.legend-dot.infer { background: var(--moss-2); }

.comic-grid {
  width: 100%;
  height: 560px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 8px;
  padding: 8px;
  overflow: hidden;
  border: 1px solid rgba(46, 110, 161, .22);
  border-radius: 22px;
  background: #b8d5e9;
}

.comic-panel {
  position: relative;
  min-width: 0;
  min-height: 0;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 13px;
  background: #183b58;
  cursor: pointer;
  isolation: isolate;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .1);
}

.panel-image {
  position: absolute;
  inset: 0;
  z-index: -3;
  background-image: url("./assets/beijing-man-day-nine-panel-v1.png");
  background-size: 300% 300%;
  background-position: var(--bg-x) var(--bg-y);
  transform: scale(1.025);
  filter: saturate(.9) contrast(1.03);
  transition: transform .75s cubic-bezier(.2, .8, .2, 1), filter .35s ease;
}

.comic-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -2;
  background: linear-gradient(180deg, rgba(10, 14, 12, .05) 36%, rgba(10, 14, 12, .82) 100%);
  transition: background .3s ease;
}

.comic-panel::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 8;
  border: 0 solid rgba(74, 174, 235, .98);
  border-radius: inherit;
  pointer-events: none;
  transition: border-width .2s ease, box-shadow .2s ease;
}

.comic-panel:hover .panel-image { transform: scale(1.085); }

.comic-panel.is-active { z-index: 3; }
.comic-panel.is-active::after { border-width: 5px; box-shadow: inset 0 0 0 2px rgba(12, 54, 87, .48), 0 0 0 3px rgba(239, 249, 255, .92); }
.comic-panel.is-active .panel-image { transform: scale(1.1); filter: saturate(1.08) contrast(1.05) brightness(1.04); }

.panel-topline,
.panel-bottomline { position: absolute; left: 13px; right: 13px; z-index: 4; display: flex; align-items: center; justify-content: space-between; }
.panel-topline { top: 12px; }
.panel-bottomline { bottom: 11px; align-items: flex-end; }

.panel-number,
.panel-time {
  display: inline-flex;
  align-items: center;
  min-height: 27px;
  padding: 0 9px;
  border: 1px solid rgba(255, 255, 255, .34);
  border-radius: 999px;
  color: #fff;
  background: rgba(20, 30, 27, .58);
  backdrop-filter: blur(9px);
  font-size: 12px;
  font-weight: 850;
}

.panel-number { width: 29px; padding: 0; justify-content: center; color: #173e60; background: rgba(239, 249, 255, .94); }

.panel-title {
  max-width: 74%;
  color: #fff;
  text-align: left;
  font: 850 18px/1.1 var(--serif);
  text-shadow: 0 2px 10px rgba(0, 0, 0, .65);
}

.panel-play-state {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, .5);
  border-radius: 50%;
  color: #fff;
  background: rgba(45, 120, 196, .86);
  backdrop-filter: blur(8px);
  opacity: 0;
  transform: scale(.72);
  transition: opacity .2s ease, transform .2s ease;
}

.panel-play-state svg { width: 15px; height: 15px; fill: currentColor; }
.comic-panel.is-active .panel-play-state { opacity: 1; transform: scale(1); }

.evidence-ribbon {
  position: absolute;
  top: 48px;
  right: 12px;
  z-index: 5;
  max-width: calc(100% - 24px);
  padding: 7px 10px;
  border: 1px solid rgba(255, 255, 255, .38);
  border-radius: 10px;
  color: #fff;
  background: rgba(23, 75, 109, .82);
  font-size: 12px;
  font-weight: 800;
  opacity: 0;
  transform: translateY(-7px);
  transition: opacity .2s ease, transform .2s ease;
  backdrop-filter: blur(8px);
}

.comic-grid.has-evidence .evidence-ribbon { opacity: 1; transform: none; }

.comic-grid.has-evidence .comic-panel:not(.is-active) .panel-image { filter: saturate(.45) contrast(1.02) brightness(.75); }

.motion-layer { position: absolute; inset: 0; z-index: 2; pointer-events: none; overflow: hidden; }
.fx { position: absolute; display: block; visibility: hidden; opacity: 0; animation-play-state: paused !important; }
.comic-panel.is-playing .fx { visibility: visible; opacity: 1; animation-play-state: running !important; }

.fx.ember {
  left: calc(38% + var(--offset));
  bottom: 19%;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #ffbd4c;
  box-shadow: 0 0 12px #ff7b32;
  animation: ember-rise 1.65s var(--delay) ease-out infinite;
}

.fx.chip {
  left: 52%;
  top: 51%;
  width: 7px;
  height: 3px;
  border-radius: 50%;
  background: #ffe3a0;
  transform: rotate(var(--rotate));
  animation: chip-burst 1.15s var(--delay) ease-out infinite;
}

.fx.step {
  left: var(--left);
  top: var(--top);
  width: 18px;
  height: 7px;
  border: 2px solid rgba(250, 235, 199, .92);
  border-top: 0;
  border-radius: 50%;
  transform: rotate(-18deg);
  animation: step-pulse 1.8s var(--delay) ease-in-out infinite;
}

.fx.ring {
  left: var(--left);
  top: var(--top);
  width: 22px;
  height: 22px;
  border: 2px solid rgba(205, 235, 166, .92);
  border-radius: 50%;
  animation: ring-pulse 2s var(--delay) ease-out infinite;
}

.fx.track {
  left: var(--left);
  top: var(--top);
  width: 8px;
  height: 13px;
  border-radius: 50% 50% 42% 42%;
  background: rgba(255, 231, 169, .85);
  transform: rotate(var(--rotate));
  animation: track-run 1.7s var(--delay) ease-in-out infinite;
}

.fx.shine {
  left: 36%;
  top: 55%;
  width: 34%;
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, #fff4c8, transparent);
  transform: rotate(-16deg) translateX(-25%);
  animation: blade-shine 1.65s ease-in-out infinite;
}

.fx.dust {
  left: var(--left);
  bottom: 19%;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(225, 207, 163, .72);
  filter: blur(1px);
  animation: dust-drift 2s var(--delay) ease-out infinite;
}

.fx.star {
  left: var(--left);
  top: var(--top);
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #edf7ff;
  box-shadow: 0 0 9px #cce7ff;
  animation: star-twinkle 2s var(--delay) ease-in-out infinite;
}

@keyframes ember-rise { 0% { opacity: 0; transform: translate(0, 4px) scale(.6); } 25% { opacity: 1; } 100% { opacity: 0; transform: translate(8px, -52px) scale(.1); } }
@keyframes chip-burst { 0%, 58% { opacity: 0; transform: translate(0, 0) rotate(var(--rotate)) scale(.4); } 68% { opacity: 1; } 100% { opacity: 0; transform: translate(var(--x), var(--y)) rotate(calc(var(--rotate) + 90deg)) scale(.1); } }
@keyframes step-pulse { 0%, 35% { opacity: 0; } 50% { opacity: .9; } 80%, 100% { opacity: 0; transform: translate(8px, 5px) rotate(-18deg); } }
@keyframes ring-pulse { 0% { opacity: 0; transform: scale(.35); } 25% { opacity: 1; } 100% { opacity: 0; transform: scale(2.1); } }
@keyframes track-run { 0%, 20% { opacity: 0; transform: rotate(var(--rotate)) scale(.55); } 40%, 68% { opacity: .95; } 100% { opacity: 0; transform: translate(9px, -8px) rotate(var(--rotate)) scale(1.05); } }
@keyframes blade-shine { 0%, 22% { opacity: 0; transform: rotate(-16deg) translateX(-55%); } 48% { opacity: 1; } 75%, 100% { opacity: 0; transform: rotate(-16deg) translateX(75%); } }
@keyframes dust-drift { 0% { opacity: 0; transform: translate(0, 6px) scale(.4); } 30% { opacity: .8; } 100% { opacity: 0; transform: translate(22px, -22px) scale(2.5); } }
@keyframes star-twinkle { 0%, 100% { opacity: .2; transform: scale(.6); } 45% { opacity: 1; transform: scale(1.55); } }

.board-footer {
  height: 42px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  color: #4f6c84;
  font-size: 12px;
}

.board-footer p { margin: 0; }
.board-footer strong { color: var(--ochre); }

.day-meter { display: flex; align-items: center; gap: 8px; font-weight: 750; }
.day-meter-track { width: 176px; height: 6px; overflow: hidden; border-radius: 999px; background: rgba(46, 105, 150, .14); }
.day-meter-track i { display: block; width: 0%; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #315f80, #63b8e7 52%, #173f67); transition: width .45s ease; }

.story-console {
  display: flex;
  flex-direction: column;
  padding: 25px 27px 20px;
  border-radius: 27px;
}

.console-topline { display: flex; align-items: center; justify-content: space-between; }

.scene-index {
  color: var(--ochre);
  font-size: 15px;
  font-weight: 900;
  letter-spacing: .12em;
}

.scene-time {
  padding: 6px 10px;
  border: 1px solid rgba(53, 111, 158, .16);
  border-radius: 999px;
  color: #4f6c84;
  background: rgba(229, 243, 254, .78);
  font-size: 13px;
  font-weight: 800;
}

.scene-title-row {
  min-height: 99px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 15px 0 12px;
}

.scene-kicker { margin: 0 0 5px; color: var(--moss); font-size: 15px; font-weight: 850; }

.scene-title-row h2 {
  max-width: 390px;
  margin: 0;
  font: 900 31px/1.15 var(--serif);
  letter-spacing: -.03em;
}

.evidence-grade {
  flex: none;
  padding: 7px 10px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 850;
}

.evidence-grade.direct { color: #1f5f9b; background: #dceeff; }
.evidence-grade.supported { color: #2b6673; background: #dcf2f4; }
.evidence-grade.imagined { color: #4d5e91; background: #e6ebfa; }

.narration-card {
  padding: 17px 18px 16px;
  border: 1px solid rgba(45, 120, 196, .22);
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(250, 253, 255, .98), rgba(222, 241, 255, .82));
}

.voice-row { display: flex; align-items: center; gap: 13px; }

.play-button {
  width: 50px;
  height: 50px;
  flex: none;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: #fff;
  background: var(--ochre);
  box-shadow: 0 9px 22px rgba(45, 120, 196, .28);
  cursor: pointer;
}

.play-button svg { grid-area: 1/1; width: 23px; height: 23px; fill: currentColor; }
.play-button .play-icon { transform: translateX(2px); }
.play-button .pause-icon { display: none; }
.play-button.is-playing .play-icon { display: none; }
.play-button.is-playing .pause-icon { display: block; }

.voice-meta { min-width: 145px; display: flex; flex-direction: column; gap: 3px; }
.voice-meta span { color: var(--ochre); font-size: 12px; font-weight: 900; letter-spacing: .12em; }
.voice-meta strong { color: #49677f; font-size: 14px; }

.wave { flex: 1; height: 38px; display: flex; align-items: center; justify-content: flex-end; gap: 4px; }
.wave i { width: 3px; height: 11px; border-radius: 999px; background: rgba(45, 120, 196, .36); transform-origin: center; }
.is-audio-playing .wave i { background: rgba(45, 120, 196, .74); animation: wave .72s ease-in-out infinite alternate; }
.is-audio-playing .wave i:nth-child(3n+1) { animation-delay: -.16s; }
.is-audio-playing .wave i:nth-child(3n+2) { animation-delay: -.36s; }
.is-audio-playing .wave i:nth-child(4n) { animation-delay: -.5s; }
@keyframes wave { from { height: 8px; } to { height: 31px; } }

.audio-progress { height: 4px; margin: 13px 0 14px 63px; overflow: hidden; border-radius: 999px; background: rgba(49, 112, 160, .14); }
.audio-progress i { display: block; width: 0%; height: 100%; background: linear-gradient(90deg, var(--ochre), var(--gold)); }

.caption {
  min-height: 50px;
  margin: 0;
  color: #294b67;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.52;
}

.caption .caption-segment { color: #5b758a; transition: color .2s ease; }
.caption .caption-segment.is-current { color: #173f61; background: linear-gradient(transparent 68%, rgba(83, 176, 229, .28) 0); }

.evidence-card,
.thinking-card { margin-top: 13px; border-radius: 17px; }

.evidence-card {
  padding: 16px 17px 15px;
  border: 1px solid rgba(47, 120, 145, .2);
  background: rgba(226, 245, 250, .78);
}

.section-label { display: flex; align-items: center; gap: 8px; color: var(--moss); font-size: 13px; font-weight: 900; letter-spacing: .08em; }
.section-label svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.evidence-main { margin: 9px 0 10px; color: #31546b; font-size: 15px; font-weight: 750; line-height: 1.55; }

.evidence-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.evidence-tags span { padding: 5px 8px; border: 1px solid rgba(47, 120, 145, .19); border-radius: 999px; color: #3f6e82; background: rgba(255, 255, 255, .72); font-size: 11px; font-weight: 800; }

.thinking-card {
  padding: 14px 16px;
  border-left: 4px solid var(--night);
  background: rgba(222, 238, 251, .7);
}

.thinking-head { display: flex; align-items: center; justify-content: space-between; color: #365e7b; font-size: 12px; font-weight: 900; letter-spacing: .08em; }
.thinking-head strong { color: var(--ochre); letter-spacing: 0; }
.thinking-card p { margin: 7px 0 0; color: #486982; font-size: 14px; font-weight: 680; line-height: 1.5; }

.scene-navigation {
  min-height: 54px;
  display: grid;
  grid-template-columns: 96px 1fr 96px;
  align-items: center;
  gap: 10px;
  margin-top: auto;
  padding-top: 15px;
}

.scene-navigation > button {
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border: 1px solid rgba(53, 111, 158, .2);
  border-radius: 12px;
  background: rgba(255, 255, 255, .72);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.scene-navigation > button:hover { border-color: var(--ochre); }
.scene-navigation svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.scene-dots { display: flex; align-items: center; justify-content: center; gap: 7px; }
.scene-dots button { width: 10px; height: 10px; padding: 0; border: 0; border-radius: 50%; background: rgba(42, 100, 145, .22); cursor: pointer; transition: width .2s ease, border-radius .2s ease, background .2s ease; }
.scene-dots button.is-active { width: 29px; border-radius: 999px; background: var(--ochre); }

.source-note { display: flex; align-items: center; justify-content: space-between; padding-top: 11px; color: #4f6c84; font-size: 11px; font-weight: 700; }
.source-note button { padding: 0; border: 0; color: var(--ochre); background: none; font-weight: 900; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

.footerbar {
  height: 49px;
  padding: 0 57px;
  display: grid;
  grid-template-columns: 1fr 1.4fr 1fr;
  align-items: center;
  border-top: 1px solid rgba(55, 119, 168, .14);
  color: #4f6c84;
  font-size: 12px;
  font-weight: 700;
}

.footerbar span:nth-child(2) { color: #41627d; text-align: center; }
.footerbar span:last-child { text-align: right; }

.sources-dialog {
  width: 900px;
  max-width: calc(100vw - 48px);
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(50, 112, 160, .22);
  border-radius: 28px;
  color: var(--ink);
  background: #f2f9ff;
  box-shadow: 0 34px 120px rgba(16, 55, 88, .3);
}

.sources-dialog::backdrop { background: rgba(13, 43, 70, .55); backdrop-filter: blur(10px); }

.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 25px 29px 21px;
  border-bottom: 1px solid var(--line);
  background: rgba(249, 253, 255, .9);
}

.dialog-head h2 { margin: 0; font: 900 32px/1.1 var(--serif); }
.dialog-head button { width: 42px; height: 42px; display: grid; place-items: center; padding: 0; border: 1px solid var(--line); border-radius: 50%; background: #fff; cursor: pointer; }
.dialog-head svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }

.dialog-body { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; padding: 22px 28px 28px; }
.dialog-body section { padding: 17px 19px; border: 1px solid var(--line); border-radius: 17px; background: rgba(255, 255, 255, .64); }
.dialog-body h3 { margin: 0 0 8px; color: var(--ochre); font-size: 17px; }
.dialog-body p { margin: 0; color: #48657c; font-size: 14px; font-weight: 650; line-height: 1.7; }
.dialog-sources { display: flex; flex-direction: column; gap: 8px; }
.dialog-sources a { color: #246caa; font-size: 13px; font-weight: 750; text-underline-offset: 3px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
