:root {
  color-scheme: dark;
  --bg: #0b1218;
  --panel: #101b22;
  --ink: #edf2ed;
  --muted: #91a4ab;
  --line: #26363c;
  --buy: #8bd7c4;
  --sell: #d8b689;
  font-family: "Noto Sans TC", "Microsoft JhengHei", system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-synthesis: none;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
a {
  color: inherit;
  text-decoration: none;
}
button {
  font: inherit;
  cursor: pointer;
}
button:disabled {
  cursor: default;
}
button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 2px solid var(--buy);
  outline-offset: 5px;
}
[hidden] {
  display: none !important;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}
.skip {
  position: fixed;
  top: -100px;
  left: 16px;
  background: var(--buy);
  color: var(--bg);
  padding: 12px;
  z-index: 10;
}
.skip:focus {
  top: 12px;
}
.site-header,
main,
footer {
  width: min(1080px, calc(100% - 72px));
  margin: auto;
}
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
  border-bottom: 1px solid var(--line);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -0.5px;
}
.brand img {
  border-radius: 50%;
}
.series {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 2px;
}
.series span {
  margin: 0 10px;
  color: #53666e;
}
main {
  padding-top: 22px;
}
.scene-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  gap: 18px;
  color: #b0c1c5;
  font-size: 11px;
  letter-spacing: 1.5px;
}
.scene-route {
  display: flex;
  list-style: none;
  padding: 0;
  margin: 0;
  gap: 6px;
}
.scene-route li {
  width: 27px;
  height: 2px;
  background: #34484f;
}
.scene-route [aria-current] {
  background: var(--buy);
}
.scene-route .visited {
  background: #77918f;
}
.stage {
  border: 1px solid #2a3a40;
  border-radius: 4px;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 63% 33%, #17293066, transparent 66%),
    var(--panel);
}
.stage-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 25px;
  gap: 20px;
}
.instrument {
  display: flex;
  align-items: center;
  gap: 18px;
}
.instrument strong {
  font-size: 13px;
  letter-spacing: 1px;
  font-weight: 600;
}
.instrument strong span {
  font-size: 10px;
  color: var(--muted);
}
.instrument small {
  font-size: 10px;
  color: #869da5;
}
.clock {
  display: flex;
  align-items: center;
  gap: 16px;
}
.clock span {
  font-size: 10px;
  color: var(--sell);
}
.clock b {
  font:
    12px ui-monospace,
    "Cascadia Code",
    monospace;
  color: #c9d8d9;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}
.canvas {
  position: relative;
}
#market {
  display: block;
  width: 100%;
  height: clamp(280px, 38vw, 400px);
  overflow: hidden;
}
#market text {
  font-family: "Noto Sans TC", "Microsoft JhengHei", system-ui, sans-serif;
}
#market .number {
  font-family: ui-monospace, "Cascadia Code", monospace;
  font-variant-numeric: tabular-nums;
}
.stage-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 0 25px;
  padding: 12px 0 15px;
  border-top: 1px solid #263b424d;
  gap: 15px;
  min-height: 52px;
}
#lens-label {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.5px;
}
.last-price {
  display: flex;
  gap: 12px;
  align-items: center;
}
.last-price span {
  color: var(--muted);
  font-size: 10px;
}
.last-price b {
  font:
    17px ui-monospace,
    "Cascadia Code",
    monospace;
  color: var(--buy);
}
.timeline {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 0 25px;
  padding: 0 0 12px;
  color: var(--muted);
  font-size: 10px;
}
.timeline label {
  white-space: nowrap;
  cursor: pointer;
}
.elapsed {
  white-space: nowrap;
  font:
    11px ui-monospace,
    "Cascadia Code",
    monospace;
  font-variant-numeric: tabular-nums;
}
#scene-progress {
  --progress: 0%;
  appearance: none;
  flex: 1;
  min-width: 0;
  height: 24px;
  margin: 0;
  background: transparent;
  cursor: pointer;
  accent-color: var(--buy);
}
#scene-progress::-webkit-slider-runnable-track {
  height: 3px;
  border-radius: 3px;
  background: linear-gradient(
    to right,
    var(--buy) var(--progress),
    #34484f var(--progress)
  );
}
#scene-progress::-webkit-slider-thumb {
  appearance: none;
  height: 11px;
  width: 11px;
  margin-top: -4px;
  border: 2px solid var(--panel);
  border-radius: 50%;
  background: var(--buy);
  box-shadow: 0 0 0 1px #8bd7c455;
}
#scene-progress::-moz-range-track {
  height: 3px;
  background: #34484f;
}
#scene-progress::-moz-range-progress {
  height: 3px;
  background: var(--buy);
}
#scene-progress::-moz-range-thumb {
  height: 8px;
  width: 8px;
  border: 2px solid var(--panel);
  border-radius: 50%;
  background: var(--buy);
}
.story-copy {
  min-height: 135px;
  padding: 23px 0 17px;
}
.story-copy #eyebrow {
  margin: 0 0 8px;
  color: var(--sell);
  font-size: 10px;
  letter-spacing: 2px;
}
h1 {
  margin: 0;
  font-size: clamp(23px, 2.7vw, 31px);
  line-height: 1.45;
  letter-spacing: -0.8px;
  font-weight: 550;
}
#question {
  margin: 8px 0 0;
  color: #a4b6bd;
  font-size: 13px;
  line-height: 1.7;
}
.story-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 0 20px;
  gap: 15px;
}
.story-controls button {
  border: 1px solid transparent;
  min-height: 44px;
  white-space: nowrap;
  transition:
    background-color 0.18s,
    color 0.18s;
}
.back,
.pause {
  background: transparent;
  color: #a7bbc1;
  font-size: 12px;
  padding: 10px 0;
}
.back:disabled {
  opacity: 0.22;
}
.back:hover:not(:disabled),
.pause:hover:not(:disabled) {
  color: var(--ink);
}
.advance {
  display: flex;
  align-items: center;
  gap: 24px;
}
.pause {
  min-width: 44px;
}
.pause:disabled {
  opacity: 0.28;
}
.next {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  padding: 13px 20px;
  min-width: 156px;
  border-radius: 3px;
  background: var(--buy);
  color: #0c2b26;
  font-size: 13px;
  font-weight: 650;
}
.next span {
  font-size: 18px;
  line-height: 1;
}
.next:hover:not(:disabled) {
  background: #b1ecdc;
}
.next:disabled {
  background: #1b3034;
  color: #728e91;
  border-color: #2d4448;
}
.next:disabled span {
  opacity: 0.4;
}
footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 16px 0 25px;
  border-top: 1px solid var(--line);
  font-size: 10px;
  color: #71878f;
}
@media (min-width: 850px) and (max-height: 820px) {
  .site-header {
    height: 56px;
  }
  main {
    padding-top: 15px;
  }
  #market {
    height: 310px;
  }
  .stage-top {
    padding: 12px 25px;
  }
  .story-copy {
    min-height: 118px;
    padding-top: 17px;
  }
  h1 {
    font-size: 27px;
  }
  .story-controls {
    padding-bottom: 15px;
  }
  footer {
    padding-top: 12px;
  }
}
@media (max-width: 650px) {
  .site-header,
  main,
  footer {
    width: calc(100% - 32px);
  }
  .site-header {
    height: 58px;
  }
  .brand {
    font-size: 15px;
    gap: 8px;
  }
  .brand img {
    width: 24px;
    height: 24px;
  }
  .series {
    font-size: 9px;
    letter-spacing: 0.5px;
  }
  .series span {
    margin: 0 4px;
  }
  main {
    padding-top: 16px;
  }
  .scene-meta {
    font-size: 10px;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
  }
  .scene-route li {
    width: 18px;
  }
  .stage-top {
    padding: 13px 15px;
    align-items: flex-start;
  }
  .instrument {
    display: block;
  }
  .instrument strong {
    font-size: 12px;
  }
  .instrument strong span {
    font-size: 9px;
  }
  .instrument small {
    display: block;
    font-size: 8px;
    margin-top: 5px;
  }
  .clock {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 5px;
  }
  .clock b {
    font-size: 11px;
  }
  .clock span {
    font-size: 9px;
  }
  #market {
    height: auto;
    aspect-ratio: 390/460;
  }
  .stage-bottom {
    margin: 0 15px;
    padding: 11px 0;
    gap: 8px;
    min-height: 50px;
  }
  #lens-label {
    font-size: 9px;
    max-width: 160px;
  }
  .last-price {
    display: block;
    text-align: right;
  }
  .last-price span {
    display: block;
    font-size: 8px;
    margin-bottom: 3px;
  }
  .last-price b {
    font-size: 15px;
  }
  .story-copy {
    padding: 19px 0 13px;
    min-height: 140px;
  }
  h1 {
    font-size: 24px;
    line-height: 1.5;
  }
  #question {
    font-size: 12px;
    line-height: 1.7;
  }
  .story-copy #eyebrow {
    font-size: 9px;
    margin-bottom: 6px;
  }
  .story-controls {
    position: sticky;
    bottom: 0;
    z-index: 2;
    background: linear-gradient(0deg, var(--bg) 83%, #0b121800);
    padding: 13px 0 max(14px, env(safe-area-inset-bottom));
  }
  .advance {
    gap: 14px;
  }
  .next {
    min-width: 132px;
    padding: 12px 15px;
    gap: 22px;
    font-size: 12px;
  }
  .back {
    font-size: 11px;
  }
  footer {
    font-size: 9px;
    padding: 16px 0 23px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
/* Portrait stories keep their own readable SVG coordinates and touch controls. */
@media (max-width: 650px) {
  body {
    padding-bottom: calc(78px + env(safe-area-inset-bottom));
  }
  .site-header,
  main,
  footer {
    width: calc(100% - 24px);
  }
  .site-header {
    height: 52px;
  }
  .series {
    max-width: 55%;
    text-align: right;
    line-height: 1.5;
  }
  main {
    display: flex;
    flex-direction: column;
    padding-top: 13px;
  }
  .scene-meta {
    order: 0;
    display: block;
    margin-bottom: 0;
    font-size: 12px;
    scroll-margin-top: 10px;
  }
  .scene-route {
    margin-top: 9px;
    gap: 4px;
  }
  .scene-route li {
    flex: 1;
    width: auto;
  }
  .story-copy {
    order: 1;
    min-height: 139px;
    padding: 14px 2px 17px;
  }
  .story-copy #eyebrow {
    font-size: 10px;
    letter-spacing: 1px;
  }
  h1 {
    font-size: 21px;
    line-height: 1.45;
    letter-spacing: -0.5px;
  }
  #question {
    font-size: 14px;
    line-height: 1.6;
    margin-top: 7px;
  }
  .stage {
    order: 2;
    border-radius: 9px;
  }
  .stage-top {
    padding: 12px 12px 8px;
    gap: 8px;
  }
  .instrument strong {
    font-size: 12px;
    letter-spacing: 0;
  }
  .instrument small {
    display: none;
  }
  .clock {
    gap: 4px;
  }
  .clock span {
    font-size: 10px;
  }
  .clock b {
    font-size: 11px;
  }
  #market {
    width: 100%;
    height: auto;
  }
  .stage-bottom {
    margin: 0 12px;
    min-height: 52px;
    padding: 9px 0;
  }
  #lens-label {
    font-size: 11px;
    line-height: 1.55;
    max-width: 72%;
  }
  .last-price {
    flex-shrink: 0;
  }
  .last-price span {
    font-size: 10px;
  }
  .last-price b {
    font-size: 18px;
  }
  .timeline {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0 8px;
    margin: 0 12px;
    padding-bottom: 4px;
    font-size: 11px;
  }
  .timeline label {
    grid-column: 1;
    grid-row: 1;
  }
  .elapsed {
    grid-column: 2;
    grid-row: 1;
    font-size: 11px;
  }
  #scene-progress {
    grid-column: 1 / -1;
    grid-row: 2;
    width: 100%;
    height: 44px;
    touch-action: pan-y;
  }
  #scene-progress::-webkit-slider-thumb {
    width: 20px;
    height: 20px;
    margin-top: -8px;
  }
  #scene-progress::-moz-range-thumb {
    width: 16px;
    height: 16px;
  }
  .story-controls {
    position: fixed;
    order: 3;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 10;
    padding: 10px max(12px, env(safe-area-inset-right))
      max(10px, env(safe-area-inset-bottom))
      max(12px, env(safe-area-inset-left));
    border-top: 1px solid var(--line);
    background: #0b1218f5;
    backdrop-filter: blur(12px);
    gap: 6px;
  }
  .story-controls button {
    min-height: 46px;
  }
  .back {
    padding: 10px 5px;
    font-size: 12px;
  }
  .pause {
    min-width: 48px;
    padding: 10px 3px;
    font-size: 13px;
  }
  .advance {
    gap: 10px;
  }
  .next {
    min-width: 126px;
    font-size: 13px;
    gap: 12px;
  }
  footer {
    font-size: 10px;
    line-height: 1.7;
    margin-top: 16px;
  }
}
