:root {
  color-scheme: dark;
  --bg: #05090f;
  --panel: #0a1018;
  --raise: #101924;
  --hover: #172331;
  --line: rgba(120, 160, 190, 0.14);
  --text: #e8eee9;
  --muted: #8c9fb0;
  --dim: #5f7486;
  --teal: #78e1d5;
  --gold: #e8bd7d;
  --sell: #f09a5a;
  --f-tc: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif;
  --f-mono: "JetBrains Mono Variable", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --top: 48px;
}
* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--f-tc);
  font-size: 14px;
}
button,
select,
input {
  font: inherit;
  color: inherit;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---------- top bar: one quiet row, like a trading terminal ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  height: var(--top);
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}
.brand {
  display: flex;
  flex: none;
  align-items: center;
  gap: 8px;
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
}
.topbar h1 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}
.symbol {
  display: flex;
  flex: none;
  align-items: center;
  gap: 8px;
  padding-right: 14px;
  border-right: 1px solid var(--line);
}
.symbol b {
  font-family: var(--f-mono);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.symbol small {
  color: var(--muted);
  font-size: 12px;
}
/* The pair reads like the bold symbol it replaced; the arrow shows it is a choice. */
.mk-pick {
  align-self: center;
  padding: 1px 2px;
  border: 0;
  background: transparent;
  color: var(--text);
  font-family: var(--f-mono);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
}
.mk-pick option {
  background: var(--panel);
}
.ex-pick {
  align-self: center;
  max-width: 150px; /* 全市場's full name shows in the open list */
  min-height: 26px;
  padding: 1px 4px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--raise);
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
}
.ex-pick:hover,
.ex-pick:focus-visible {
  color: var(--text);
}
@media (max-width: 720px) {
  .ex-pick {
    max-width: 92px;
  }
}
.ind-heat {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 8px;
  align-items: center;
  margin-top: 4px;
  font-size: 12px;
}
.ind-heat[hidden] {
  display: none;
}
.ind-heat > span {
  grid-column: 1 / -1;
  color: var(--muted);
}
.ind-heat input[type="range"] {
  width: 100%;
  accent-color: var(--gold);
}
.ind-heat output {
  color: var(--text);
  font-family: var(--f-mono);
  font-size: 11.5px;
}
.ind-heat button {
  justify-self: start;
  min-height: 26px;
  padding: 2px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--raise);
  color: var(--muted);
  cursor: pointer;
}
.ind-heat button[aria-pressed="true"] {
  border-color: rgba(232, 189, 125, 0.5);
  color: var(--gold);
}
.ex-pick option {
  background: var(--panel);
  color: var(--text);
}
.tools {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.seg {
  display: inline-flex;
  flex: none;
  padding: 2px;
  border-radius: 8px;
  background: var(--raise);
}
.seg button,
.tools summary {
  min-height: 28px;
  padding: 3px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-family: var(--f-mono);
  font-size: 12px;
  cursor: pointer;
}
.seg button:hover,
.tools summary:hover {
  color: var(--text);
}
.seg button[aria-pressed="true"] {
  background: var(--hover);
  color: var(--teal);
}
.check input {
  accent-color: var(--teal);
}
.live {
  flex: none;
  margin-left: auto;
  white-space: nowrap;
  color: var(--muted);
  font-family: var(--f-mono);
  font-size: 12px;
}
.site-links {
  display: flex;
  flex: none;
  gap: 2px;
  padding-left: 12px;
  border-left: 1px solid var(--line);
}
.site-links a {
  padding: 5px 8px;
  border-radius: 6px;
  color: var(--muted);
  font-size: 13px;
  text-decoration: none;
}
@media (max-width: 430px) {
  .symbol small {
    display: none;
  }
}
.site-links a:hover,
.site-links a:focus-visible {
  background: var(--hover);
  color: var(--text);
}
.live::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 6px;
  border-radius: 50%;
  background: var(--dim);
  vertical-align: 1px;
}
.live[data-state="on"]::before {
  background: var(--teal);
  box-shadow: 0 0 0 3px rgba(120, 225, 213, 0.15);
}
.live[data-state="stale"]::before {
  background: var(--sell);
}

/* ---------- menus (indicators, sharing, notifications) ---------- */
.ind,
.share,
.notify {
  position: relative;
  flex: none;
}
.tools summary {
  display: inline-flex;
  align-items: center;
  list-style: none;
  font-family: var(--f-tc);
}
.tools summary::-webkit-details-marker {
  display: none;
}
.ind summary::after {
  content: "▾";
  margin-left: 5px;
  color: var(--dim);
  font-size: 10px;
}
.ind[open] summary,
.share[open] summary,
.notify[open] summary {
  background: var(--hover);
  color: var(--text);
}
.ind-panel,
.share-panel,
.notify-panel {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 10;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
}
.ind-panel {
  display: flex;
  gap: 22px;
}
.ind-panel fieldset {
  min-width: 180px;
  margin: 0;
  padding: 0;
  border: 0;
}
.ind-panel legend {
  margin-bottom: 8px;
  color: var(--dim);
  font-size: 11px;
  letter-spacing: 0.08em;
}
.ind-list {
  display: grid;
  gap: 7px;
}
.ind-list label,
.ind-panel .check {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-size: 13px;
}
.ind-select {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
}
.ind-range {
  display: grid;
  gap: 6px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
}
.ind-range output,
.lg-pick {
  color: var(--text);
  font-family: var(--f-mono);
}
.ind-range input,
.lg-range {
  width: 100%;
  accent-color: var(--teal);
}
.ind-select select {
  min-height: 28px;
  padding: 2px 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--raise);
}
.share-panel {
  display: grid;
  gap: 10px;
  width: min(360px, calc(100vw - 24px));
}
.share-note {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}
.share-panel input {
  min-height: 34px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--raise);
  font-family: var(--f-mono);
  font-size: 12px;
}
.share-actions {
  display: flex;
  gap: 8px;
}
.share-actions button,
.share-line {
  flex: 1;
  min-height: 36px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--raise);
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}
.share-line {
  border-color: #06c755;
  background: #06c755;
  color: #fff;
  font-weight: 600;
}
.notify[data-on="true"] summary::before {
  content: "";
  width: 6px;
  height: 6px;
  margin-right: 6px;
  border-radius: 50%;
  background: var(--teal);
}
.notify-panel {
  /* The last menu in the bar: open toward the left so it stays on screen. */
  left: auto;
  right: 0;
  display: grid;
  gap: 12px;
  width: min(380px, calc(100vw - 24px));
}
.notify-switch {
  min-height: 36px;
  border: 1px solid var(--teal);
  border-radius: 8px;
  background: var(--teal);
  color: var(--bg);
  font-weight: 600;
  cursor: pointer;
}
.notify-switch[aria-pressed="true"] {
  background: transparent;
  color: var(--teal);
}
.notify-note,
.notify-foot {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}
.notify-foot {
  color: var(--dim);
}
.notify-panel fieldset {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  border: 0;
}
.notify-panel legend {
  margin-bottom: 6px;
  color: var(--dim);
  font-size: 11px;
  letter-spacing: 0.08em;
}
.notify-panel .check {
  display: grid;
  grid-template-columns: auto auto 1fr;
  align-items: baseline;
  gap: 8px;
  color: var(--text);
  font-size: 13px;
}
.notify-panel .check small {
  color: var(--dim);
  font-size: 11px;
}

.notify-line {
  display: grid;
  gap: 6px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.notify-line h3 {
  margin: 0;
  font-size: 13px;
}
.notify-line p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}
.notify-line-link {
  justify-self: start;
  color: #06c755;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}

/* ---------- toasts (notify.js) ---------- */
.toasts {
  position: fixed;
  top: calc(var(--top) + 10px);
  right: 12px;
  z-index: 20;
  display: grid;
  gap: 8px;
  width: min(360px, calc(100vw - 24px));
  pointer-events: none;
}
.toast {
  display: grid;
  gap: 6px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--teal);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
  pointer-events: auto;
}
.toast p {
  margin: 0;
  color: var(--text);
  font-size: 13px;
  line-height: 1.5;
}
.toast small {
  color: var(--dim);
  font-size: 11px;
}
.toast-actions {
  display: flex;
  gap: 8px;
}
.toast-actions button {
  min-height: 30px;
  padding: 3px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--raise);
  color: var(--text);
  cursor: pointer;
}
.toast-actions button:first-child {
  border-color: var(--teal);
  color: var(--teal);
}

/* ---------- first-visit guide (guide.js) ---------- */
.guide {
  position: fixed;
  left: 16px;
  bottom: 56px;
  z-index: 30;
  display: grid;
  gap: 8px;
  width: min(360px, calc(100vw - 24px));
  padding: 16px 18px 14px;
  border: 1px solid var(--line);
  border-top: 3px solid var(--gold);
  border-radius: 12px;
  background: var(--raise);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}
.guide-count {
  margin: 0;
  color: var(--gold);
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
}
.guide h2 {
  margin: 0;
  font-size: 16px;
}
.guide-body {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}
.guide-links {
  display: flex;
  gap: 8px;
  margin: 2px 0 0;
}
.guide-links a {
  padding: 5px 12px;
  border: 1px solid var(--teal);
  border-radius: 6px;
  color: var(--teal);
  font-size: 13px;
  text-decoration: none;
}
.guide-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}
.guide-actions span {
  flex: 1;
}
.guide-actions button {
  min-height: 32px;
  padding: 3px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}
.guide-actions [data-guide="skip"] {
  border-color: transparent;
  color: var(--dim);
}
.guide-actions [data-guide="next"] {
  border-color: var(--teal);
  background: var(--teal);
  color: #062521;
  font-weight: 600;
}
/* The step's target stays lit inside this frame; its shadow dims everything else. */
.guide-spot {
  position: fixed;
  z-index: 29;
  box-sizing: border-box;
  border: 2px solid var(--gold);
  border-radius: 10px;
  box-shadow: 0 0 0 200vmax rgba(5, 9, 15, 0.68);
  pointer-events: none;
  transition:
    top 0.25s ease,
    left 0.25s ease,
    width 0.25s ease,
    height 0.25s ease;
}
.guide-spot.is-empty {
  border: 0;
}
@media (prefers-reduced-motion: reduce) {
  .guide-spot {
    transition: none;
  }
}
.guide-open {
  margin-left: 10px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}
.rec .guide,
.rec .guide-open {
  display: none;
}
@media (max-width: 720px) {
  .guide {
    left: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom));
  }
}

/* ---------- 盤面旁白 (narrate.js): a rail beside the chart, a bottom sheet on phones ---------- */
.workspace {
  display: flex;
}
.workspace .stage {
  flex: 1 1 auto;
  min-width: 0;
}
.narration {
  display: flex;
  flex: none;
  flex-direction: column;
  width: 380px;
  /* As tall as the chart beside it; the list scrolls inside instead of stretching the page. */
  height: max(520px, calc(100vh - var(--top) - 34px));
  height: max(520px, calc(100dvh - var(--top) - 34px));
  min-height: 0;
  border-left: 1px solid var(--line);
  background: var(--panel);
}
.narration[hidden],
.nar-open[hidden] {
  display: none;
}
.nar-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px 10px;
}
.nar-head h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 900;
  letter-spacing: 0.02em;
}
.nar-count {
  color: var(--muted);
  font-family: var(--f-mono);
  font-size: 11px;
}
.nar-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  margin-left: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.nar-close:hover {
  color: var(--text);
}
.nar-handle {
  display: none;
}
.nar-body {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  padding: 0 14px 14px;
  overflow-y: auto;
  overscroll-behavior: contain;
  /* Older stories come from a button; an opened card that runs long still scrolls, without a bar. */
  scrollbar-width: none;
}
.nar-body::-webkit-scrollbar {
  display: none;
}
.nar-pager {
  display: flex;
  gap: 8px;
}
.nar-pager[hidden],
.nar-pager [hidden] {
  display: none;
}
.nar-pager button {
  flex: 1;
  min-height: 38px;
  border: 1px dashed rgba(120, 160, 190, 0.3);
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
}
.nar-pager button:hover {
  border-color: var(--teal);
  color: var(--teal);
}
.nar-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.nar-filters button {
  min-height: 30px;
  padding: 0 12px;
  border: 1px solid rgba(120, 160, 190, 0.24);
  border-radius: 999px;
  background: transparent;
  color: #c4d0d6;
  font-size: 12px;
  cursor: pointer;
}
.nar-filters button[aria-pressed="true"] {
  border-color: var(--teal);
  background: rgba(120, 225, 213, 0.12);
  color: var(--teal);
}
.nar-now {
  padding: 13px 15px;
  border: 1px solid rgba(232, 189, 125, 0.35);
  border-radius: 12px;
  background: linear-gradient(180deg, #13202c, #0e1822);
}
.nar-now:empty {
  display: none;
}
.nar-now-meta {
  display: flex;
  justify-content: space-between;
  color: var(--gold);
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
}
.nar-now-head {
  margin: 7px 0 0;
  font-size: 14.5px;
  font-weight: 500;
  line-height: 1.6;
}
.nar-now-sub {
  margin: 5px 0 0;
  color: #c4d0d6;
  font-size: 13px;
  line-height: 1.6;
}
.nar-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.nar-empty {
  margin: 6px 2px;
  color: var(--muted);
  font-size: 13px;
}
.nar-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  transition: border-color 0.2s;
}
.nar-card.is-latest {
  border-color: rgba(120, 225, 213, 0.45);
}
.nar-card.is-open {
  border-color: rgba(120, 225, 213, 0.45);
  background: var(--raise);
}
.nar-toggle {
  display: flex;
  flex-direction: column;
  gap: 5px;
  width: 100%;
  padding: 12px 15px;
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.nar-toggle:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: -2px;
  border-radius: 12px;
}
.nar-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-family: var(--f-mono);
  font-size: 11px;
}
.nar-kinds {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 1px;
}
.nar-kind {
  padding: 1px 8px;
  border-radius: 999px;
  background: rgba(120, 225, 213, 0.14);
  font-size: 11px;
}
/* One colour per family of event kinds: chips, timeline names and the explanations. */
.nar-kind,
.nar-kn {
  color: var(--teal);
}
.nar-kind[data-choice="divergence"],
.nar-kind[data-choice="oi"] {
  background: rgba(185, 166, 255, 0.14);
}
.nar-kn[data-choice="divergence"],
.nar-kn[data-choice="oi"],
.nar-kind[data-choice="divergence"],
.nar-kind[data-choice="oi"] {
  color: #c9baff;
}
.nar-kind[data-choice="wall"],
.nar-kind[data-choice="spoof"],
.nar-kind[data-choice="iceberg"] {
  background: rgba(240, 154, 90, 0.14);
}
.nar-kn[data-choice="wall"],
.nar-kn[data-choice="spoof"],
.nar-kn[data-choice="iceberg"],
.nar-kind[data-choice="wall"],
.nar-kind[data-choice="spoof"],
.nar-kind[data-choice="iceberg"] {
  color: #f5b585;
}
.nar-kind[data-choice="print"],
.nar-kind[data-choice="liq"] {
  background: rgba(232, 189, 125, 0.14);
}
.nar-kn[data-choice="print"],
.nar-kn[data-choice="liq"],
.nar-kind[data-choice="print"],
.nar-kind[data-choice="liq"] {
  color: var(--gold);
}
.nar-title {
  font-size: 14.5px;
  font-weight: 700;
  line-height: 1.45;
}
.nar-detail {
  color: var(--text);
  font-size: 13px;
  line-height: 1.65;
}
.nar-more {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 0 15px 14px;
}
.nar-lines {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin: 0 0 0 4px;
  padding: 0 0 0 14px;
  border-left: 1px solid rgba(120, 160, 190, 0.24);
  list-style: none;
  color: #c4d0d6;
  font-size: 12.5px;
  line-height: 1.55;
}
.nar-lines li {
  display: flex;
  gap: 10px;
}
.nar-lines b {
  flex: none;
  color: var(--text);
  font-family: var(--f-mono);
  font-weight: 600;
}
.nar-earlier {
  align-self: flex-start;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  text-decoration: underline dotted;
  text-underline-offset: 3px;
  cursor: pointer;
}
.nar-earlier:hover {
  color: var(--text);
}
.nar-plain {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--panel);
  color: #c4d0d6;
  font-size: 12.5px;
  line-height: 1.7;
}
.nar-lesson {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
}
.nar-lesson[hidden] {
  display: none;
}
.nar-lesson-canvas {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
}
.nar-lesson-cap {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin: 0;
  padding: 8px 12px;
  font-size: 12px;
}
.nar-lesson-cap a {
  color: var(--teal);
  white-space: nowrap;
}
.nar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.nar-actions button {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid rgba(120, 160, 190, 0.28);
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font-size: 12.5px;
  cursor: pointer;
}
.nar-actions button:hover {
  border-color: var(--teal);
}
.nar-actions .nar-primary {
  border-color: var(--teal);
  background: var(--teal);
  color: #062521;
  font-weight: 700;
}
.nar-foot {
  margin: 4px 2px 0;
  color: var(--muted);
  font-size: 12px;
}
.nar-open {
  position: absolute;
  top: 10px;
  right: 72px;
  z-index: 5;
  min-height: 32px;
  padding: 0 14px;
  border: 1px solid rgba(232, 189, 125, 0.5);
  border-radius: 999px;
  background: var(--panel);
  color: var(--gold);
  font-size: 13px;
  cursor: pointer;
}
.toast a {
  color: var(--teal);
  font-size: 13px;
}
.rec .narration,
.rec .nar-open,
.rec .legend {
  display: none;
}
@media (max-width: 1100px) {
  .narration {
    width: 320px;
  }
  /* Tablets: the one-row tool bar needs the room the brand name and exchange label take. */
  .brand span,
  .symbol small {
    display: none;
  }
}
@media (max-width: 720px) {
  .narration {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 25;
    width: auto;
    max-height: 196px;
    border: 0;
    border-top: 1px solid rgba(232, 189, 125, 0.35);
    border-radius: 16px 16px 0 0;
    background: #0e1822;
    box-shadow: 0 -18px 40px rgba(0, 0, 0, 0.55);
    transition: max-height 0.25s ease;
  }
  .sheet-open .narration {
    max-height: 80dvh;
  }
  .nar-handle {
    position: absolute;
    top: 0;
    left: 50%;
    display: block;
    width: 96px;
    height: 22px;
    margin-left: -48px;
    border: 0;
    background: transparent;
    cursor: pointer;
  }
  .nar-handle::before {
    content: "";
    display: block;
    width: 40px;
    height: 4px;
    margin: 8px auto 0;
    border-radius: 2px;
    background: rgba(140, 159, 176, 0.6);
  }
  .nar-head {
    padding-top: 20px;
  }
  .nar-close {
    display: none;
  }
  /* Peeking: the summary and the newest story only. */
  body:not(.sheet-open) .nar-filters,
  body:not(.sheet-open) .nar-foot,
  body:not(.sheet-open) .nar-list > :not(:first-child),
  body:not(.sheet-open) .nar-more,
  body:not(.sheet-open) .nar-now-sub {
    display: none;
  }
  body:not(.sheet-open) .nar-body {
    overflow: hidden;
  }
  /* Chart, then the footer note, then the sheet: the page fits the screen without scrolling. */
  .has-rail .stage {
    height: max(320px, calc(100dvh - var(--top) - 196px - 58px));
  }
  .nar-open {
    top: 8px;
    right: 64px;
  }
  .has-rail .guide {
    bottom: calc(208px + env(safe-area-inset-bottom));
  }
}

/* ---------- 一鍵覆盤 (event-replay.js) ---------- */
.nar-actions .nar-replay {
  border-color: var(--gold);
  background: var(--gold);
  color: #1d1405;
  font-weight: 700;
}
.toast-actions .toast-replay {
  border-color: var(--gold);
  color: var(--gold);
}
.er-caption[hidden],
.er-controls[hidden],
.er-outro[hidden],
.er-cover[hidden] {
  display: none;
}
/* A replay runs on the chart as it is: the controls float over it, and it keeps its size. They sit
   left of centre to clear the zoom buttons, and "newest" means nothing while the clock is back. */
.er-on .guide,
.er-on #latest {
  display: none;
}
.er-badge {
  flex: none;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--gold);
  color: #1d1405;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.06em;
}
.er-ghost,
.er-primary,
.er-text {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid rgba(120, 160, 190, 0.3);
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  text-decoration: none;
  cursor: pointer;
}
.er-ghost:hover {
  border-color: var(--teal);
}
.er-primary {
  border-color: var(--teal);
  background: var(--teal);
  color: #062521;
  font-weight: 700;
}
.er-text {
  border-color: transparent;
  color: var(--muted);
}
.er-caption {
  position: absolute;
  bottom: 88px;
  left: calc(50% - 60px);
  z-index: 6;
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: min(560px, calc(100% - 240px));
  box-sizing: border-box;
  padding: 8px 14px 9px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(10, 16, 24, 0.86);
  text-align: center;
  transform: translateX(-50%);
  transition: border-color 0.3s;
  pointer-events: none;
}
.er-caption.is-event {
  border-color: rgba(232, 189, 125, 0.55);
}
.er-kicker {
  color: var(--gold);
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
}
.er-head {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.4;
}
.er-sub {
  margin: 0;
  color: #c4d0d6;
  font-size: 12.5px;
  line-height: 1.5;
}
.er-controls {
  position: absolute;
  bottom: 38px;
  left: calc(50% - 60px);
  z-index: 6;
  display: flex;
  align-items: center;
  gap: 8px;
  width: min(560px, calc(100% - 240px));
  height: 42px;
  box-sizing: border-box;
  padding: 0 8px 0 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(10, 16, 24, 0.92);
  transform: translateX(-50%);
}
.er-play {
  position: relative;
  flex: none;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 50%;
  background: var(--teal);
  cursor: pointer;
}
.er-play::before {
  content: "";
  position: absolute;
  top: 8px;
  left: 11px;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-left: 9px solid #062521;
}
.er-play.is-playing::before {
  top: 8px;
  left: 9px;
  width: 3px;
  height: 12px;
  border: 0;
  background: #062521;
  box-shadow: 7px 0 0 #062521;
}
.er-speed {
  display: inline-flex;
  flex: none;
  gap: 1px;
}
.er-speed button {
  min-height: 26px;
  padding: 0 6px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  font-family: var(--f-mono);
  font-size: 11px;
  cursor: pointer;
}
.er-speed button[aria-pressed="true"] {
  background: var(--hover);
  color: var(--teal);
}
.er-track {
  position: relative;
  flex: 1 1 auto;
  min-width: 80px;
}
.er-track input {
  display: block;
  width: 100%;
  accent-color: var(--teal);
}
.er-ticks {
  position: absolute;
  top: 50%;
  right: 8px;
  left: 8px;
  pointer-events: none;
}
.er-ticks i {
  position: absolute;
  width: 6px;
  height: 6px;
  margin: -3px 0 0 -3px;
  border-radius: 1px;
  background: var(--gold);
  transform: rotate(45deg);
}
.er-clock {
  flex: none;
  color: #c4d0d6;
  font-family: var(--f-mono);
  font-size: 11px;
}
.er-mini {
  flex: none;
  min-height: 26px;
  padding: 0 7px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
}
.er-mini:hover {
  background: var(--hover);
  color: var(--text);
}
.er-outro {
  position: absolute;
  bottom: 88px;
  left: calc(50% - 60px);
  z-index: 6;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(560px, calc(100% - 240px));
  max-height: calc(100% - 104px);
  box-sizing: border-box;
  overflow-y: auto;
  padding: 14px 16px;
  border: 1px solid rgba(232, 189, 125, 0.4);
  border-radius: 12px;
  background: rgba(14, 24, 34, 0.96);
  transform: translateX(-50%);
}
.er-outro h2 {
  margin: -6px 0 0;
  font-size: 15px;
  font-weight: 700;
}
.er-facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}
.er-fact {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--raise);
}
.er-fact span {
  color: var(--muted);
  font-size: 11px;
}
.er-fact b {
  font-family: var(--f-mono);
  font-size: 15px;
}
.er-fact b.is-gold {
  color: var(--gold);
}
.er-fact b.is-teal {
  color: var(--teal);
}
.er-fact small {
  color: #c4d0d6;
  font-size: 11px;
}
.er-note {
  margin: 0;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.6;
}
.er-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.er-cover {
  position: absolute;
  inset: 0 0 88px;
  z-index: 7;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 16px;
  background: radial-gradient(50% 45% at 50% 50%, rgba(5, 9, 15, 0.82) 0%, rgba(5, 9, 15, 0) 100%);
  text-align: center;
}
.er-cover b {
  font-size: 18px;
}
.er-cover span {
  color: var(--muted);
  font-family: var(--f-mono);
  font-size: 12px;
}
.er-start {
  position: relative;
  width: 72px;
  height: 72px;
  border: 0;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 0 12px rgba(120, 225, 213, 0.15);
  cursor: pointer;
}
.er-start::before {
  content: "";
  position: absolute;
  top: 24px;
  left: 29px;
  border-top: 12px solid transparent;
  border-bottom: 12px solid transparent;
  border-left: 19px solid #062521;
}
@media (max-width: 720px) {
  /* Phones: too little chart to float over, so captions and controls dock under it. */
  .er-on #chart {
    height: calc(100% - 186px);
  }
  .er-on .narration,
  .er-on .nar-open,
  .er-on .chart-tools {
    display: none;
  }
  .er-caption {
    right: 0;
    bottom: 50px;
    left: 0;
    width: auto;
    height: 136px;
    justify-content: center;
    border-width: 1px 0 0;
    border-radius: 0;
    transform: none;
  }
  .er-controls {
    right: 0;
    bottom: 0;
    left: 0;
    width: auto;
    height: 50px;
    border-width: 1px 0 0;
    border-radius: 0;
    transform: none;
  }
  .er-speed button[data-speed="0.5"],
  .er-clock,
  #er-share {
    display: none;
  }
  .er-outro {
    right: 0;
    bottom: 50px;
    left: 0;
    width: auto;
    max-height: calc(100% - 50px);
    border-radius: 12px 12px 0 0;
    transform: none;
  }
  .er-facts {
    grid-template-columns: 1fr;
  }
  .er-cover {
    inset: 0 0 186px;
  }
}

/* ---------- chart ---------- */
.stage {
  position: relative;
  height: max(520px, calc(100vh - var(--top) - 34px));
  height: max(520px, calc(100dvh - var(--top) - 34px));
}
#chart {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: crosshair;
}
#chart.style-hit {
  cursor: pointer;
}
#chart.row-resize {
  cursor: row-resize;
}
/* Zoom and back-to-latest float over the chart's lower right, left of the price axis. */
.chart-tools {
  position: absolute;
  right: 86px;
  bottom: 34px;
  display: flex;
  gap: 4px;
  opacity: 0.55;
  transition: opacity 0.15s;
}
.stage:hover .chart-tools,
.chart-tools:focus-within {
  opacity: 1;
}
/* 畫線工具: a slim strip on the chart's left edge, like other charting tools' drawing bar. */
.pen-tools {
  position: absolute;
  top: 50%;
  left: 6px;
  z-index: 3;
  display: grid;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(10, 16, 24, 0.88);
  transform: translateY(-50%);
  opacity: 0.6;
  transition: opacity 0.15s;
}
.stage:hover .pen-tools,
.pen-tools:focus-within {
  opacity: 1;
}
.pen-tools button {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.pen-tools button:hover,
.pen-tools button:focus-visible {
  background: var(--hover);
  color: var(--text);
}
.pen-tools button[aria-pressed="true"] {
  background: rgba(138, 180, 255, 0.16);
  color: #8ab4ff;
}
.pen-tools #pen-clear {
  margin-top: 4px;
}
#chart.pen {
  cursor: crosshair;
}
#chart.pen-hit {
  cursor: move;
}
.rec .pen-tools,
.pen-tools[hidden],
.legend[hidden] {
  display: none;
}
@media (max-width: 720px) {
  .pen-tools {
    display: none;
  }
}
/* The main chart's indicator legend under the canvas-drawn OHLC line; the buttons show on hover. */
.legend {
  position: absolute;
  top: 28px;
  left: 4px;
  z-index: 3;
  display: grid;
  justify-items: start;
  gap: 1px;
  font-family: var(--f-mono);
  font-size: 11px;
  pointer-events: none;
}
.lg-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 20px;
  padding: 0 4px 0 6px;
  border-radius: 4px;
  background: rgba(5, 9, 15, 0.72);
  pointer-events: auto;
}
.lg-fold {
  min-height: 18px;
  padding: 0 6px;
  border: 0;
  border-radius: 4px;
  background: rgba(5, 9, 15, 0.72);
  color: var(--muted);
  font-family: var(--f-tc);
  font-size: 11px;
  cursor: pointer;
  pointer-events: auto;
}
.lg-fold::after {
  content: " ▴";
}
.legend.is-folded .lg-fold::after {
  content: " ▾";
}
.lg-fold:hover,
.lg-fold:focus-visible {
  color: var(--text);
  background: rgba(16, 25, 36, 0.95);
}
.legend.is-folded .lg-row {
  display: none;
}
.lg-row:hover {
  background: rgba(16, 25, 36, 0.95);
}
.lg-name {
  color: var(--muted);
  font-family: var(--f-tc);
}
.lg-value {
  display: flex;
  gap: 8px;
  color: var(--text);
}
.lg-vwap {
  color: #c4a0ff;
}
.lg-up {
  color: var(--teal);
}
.lg-down {
  color: var(--sell);
}
.lg-pick {
  padding: 0 4px;
  border: 0;
  border-radius: 3px;
  background: transparent;
  font-size: 11px;
  cursor: pointer;
}
.lg-pick::after {
  content: " ▾";
  color: var(--muted);
}
.lg-pick:hover,
.lg-pick:focus-visible,
.lg-pick[aria-expanded="true"] {
  background: var(--hover);
}
.lg-range {
  width: 140px;
  height: 18px;
  margin: 0;
}
.lg-range[hidden] {
  display: none;
}
.lg-row.is-off .lg-name {
  color: var(--dim);
  text-decoration: line-through;
}
.lg-btn {
  display: grid;
  place-items: center;
  width: 20px;
  height: 18px;
  padding: 0;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  opacity: 0;
}
.lg-row:hover .lg-btn,
.lg-row:focus-within .lg-btn,
.lg-row.is-off .lg-btn {
  opacity: 1;
}
.lg-btn:hover,
.lg-btn:focus-visible {
  background: var(--hover);
  color: var(--text);
}
@media (hover: none) {
  .lg-btn {
    opacity: 1;
  }
}
@media (max-width: 720px) {
  .legend {
    display: none;
  }
}
.chart-tools button {
  min-width: 30px;
  height: 28px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(16, 25, 36, 0.92);
  color: var(--text);
  font-family: var(--f-mono);
  font-size: 12px;
  cursor: pointer;
}
.chart-tools button:hover {
  border-color: var(--teal);
}
.status {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  margin: 0;
  padding: 16px;
  color: var(--muted);
  text-align: center;
}
.status[hidden] {
  display: none;
}
/* Loading: faint candle outlines breathe behind the message instead of an empty chart. */
.status {
  align-content: center;
  gap: 18px;
}
.sk-bars {
  display: flex;
  align-items: center;
  gap: 9px;
  height: 140px;
}
.sk-bars i {
  width: 10px;
  height: 60px;
  border-radius: 3px;
  background: rgba(140, 159, 176, 0.12);
  animation: sk-breathe 1.6s ease-in-out infinite;
}
.sk-bars i:nth-child(3n) {
  height: 96px;
  animation-delay: 0.2s;
}
.sk-bars i:nth-child(4n + 1) {
  height: 40px;
  margin-top: 40px;
  animation-delay: 0.4s;
}
.sk-bars i:nth-child(5n + 2) {
  height: 120px;
  margin-bottom: 30px;
  animation-delay: 0.6s;
}
@keyframes sk-breathe {
  50% {
    background: rgba(140, 159, 176, 0.24);
  }
}
@media (prefers-reduced-motion: reduce) {
  .sk-bars i {
    animation: none;
  }
}

/* ---------- live connection strip ---------- */
.conn {
  position: absolute;
  top: 34px;
  left: 50%;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 12px;
  width: min(640px, calc(100% - 100px));
  box-sizing: border-box;
  padding: 9px 14px;
  border: 1px solid rgba(232, 189, 125, 0.5);
  border-radius: 10px;
  background: rgba(60, 44, 10, 0.92);
  color: #f7e2b0;
  font-size: 13px;
  line-height: 1.5;
  transform: translateX(-50%);
}
.conn[hidden] {
  display: none;
}
.conn[data-state="off"] {
  border-color: rgba(140, 159, 176, 0.4);
  background: rgba(16, 25, 36, 0.94);
  color: #c4d0d6;
}
.conn span {
  flex: 1;
}
.conn button {
  flex: none;
  min-height: 30px;
  padding: 0 12px;
  border: 1px solid rgba(120, 160, 190, 0.35);
  border-radius: 7px;
  background: transparent;
  cursor: pointer;
}

/* ---------- bar card ---------- */
.bar-card {
  position: absolute;
  z-index: 4;
  display: flex;
  flex-direction: column;
  gap: 9px;
  width: 272px;
  box-sizing: border-box;
  padding: 13px 14px;
  border: 1px solid rgba(120, 160, 190, 0.22);
  border-radius: 12px;
  background: rgba(14, 22, 32, 0.96);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.55);
  font-size: 12.5px;
  pointer-events: none;
}
.bar-card[hidden] {
  display: none;
}
.bar-card.is-pinned {
  border-color: rgba(232, 189, 125, 0.45);
  pointer-events: auto;
}
.bar-card [hidden] {
  display: none;
}
.bc-head {
  display: flex;
  align-items: center;
  gap: 8px;
}
.bc-head b {
  flex: 1;
  font-family: var(--f-mono);
  font-size: 12.5px;
  font-weight: 600;
}
.bc-head span {
  font-family: var(--f-mono);
  font-size: 12px;
}
.bc-close {
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.bar-card .is-up {
  color: var(--teal);
}
.bar-card .is-down {
  color: var(--sell);
}
.bc-ohlc {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding-bottom: 9px;
  border-bottom: 1px solid var(--line);
  font-family: var(--f-mono);
  font-size: 13px;
}
.bc-ohlc span {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.bc-ohlc small {
  color: var(--muted);
  font-family: var(--f-tc);
  font-size: 12px;
}
.bc-ohlc b {
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.bc-rows {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.bc-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}
.bc-row span {
  color: var(--muted);
}
.bc-sub {
  padding-left: 12px;
  font-size: 12px;
}
.bc-row b {
  font-family: var(--f-mono);
  font-weight: 500;
  text-align: right;
}
.bc-ratio {
  height: 5px;
  overflow: hidden;
  border-radius: 3px;
  background: var(--sell);
}
.bc-ratio i {
  display: block;
  height: 100%;
  background: var(--teal);
}
.bc-note {
  margin: 0;
  color: #c4d0d6;
}
.bc-events {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 9px;
  border-top: 1px solid var(--line);
}
.bc-event {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  color: #c4d0d6;
}
.bc-chip {
  padding: 1px 8px;
  border-radius: 999px;
  background: rgba(232, 189, 125, 0.16);
  color: var(--gold);
  font-size: 11.5px;
  white-space: nowrap;
}
.bc-events small {
  color: var(--muted);
}
.bc-hint {
  margin: 0;
  color: var(--muted);
  font-size: 11.5px;
}
.bc-actions {
  display: flex;
  gap: 6px;
}
.bc-actions button {
  flex: 1;
  min-height: 32px;
  border: 1px solid rgba(120, 160, 190, 0.3);
  border-radius: 7px;
  background: transparent;
  color: var(--text);
  font-size: 12px;
  cursor: pointer;
}
.bc-actions .bc-replay {
  border-color: var(--gold);
  background: var(--gold);
  color: #1d1405;
  font-weight: 700;
}
.rec .bar-card,
.rec .conn,
.er-on .bar-card {
  display: none;
}
@media (max-width: 720px) {
  /* Phones: a tapped bar's card docks under the chart in place of the narration sheet. */
  .bar-card {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 26;
    width: auto;
    padding: 14px 16px calc(16px + env(safe-area-inset-bottom));
    border-width: 1px 0 0;
    border-radius: 16px 16px 0 0;
    font-size: 13px;
  }
  .card-open .narration {
    display: none;
  }
  .bc-actions button {
    min-height: 44px;
    font-size: 13px;
  }
  .conn {
    top: 8px;
    width: calc(100% - 80px);
    font-size: 12px;
  }
}

/* ---------- footer ---------- */
.note {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 18px;
  min-height: 34px;
  padding: 8px 16px;
  color: var(--dim);
  font-size: 12px;
}
.note p {
  margin: 0;
}
.help summary {
  color: var(--muted);
  cursor: pointer;
}
.help[open] {
  flex-basis: 100%;
  padding-bottom: 16px;
}
.help p {
  margin: 6px 0;
  color: var(--muted);
  line-height: 1.6;
}

@media (max-width: 720px) {
  :root {
    --top: 92px;
  }
  /* Two rows: brand, symbol and status, then the tools scrolling sideways. */
  .topbar {
    flex-wrap: wrap;
    align-content: center;
    gap: 6px 12px;
    padding: 6px 12px;
  }
  .brand span {
    display: none;
  }
  /* The site links share the first row, between the symbol and the live status. */
  .site-links {
    order: 1;
    margin-left: auto;
    padding-left: 0;
    border-left: 0;
  }
  .site-links a {
    padding: 4px 6px;
  }
  .live {
    order: 2;
    margin-left: 0;
  }
  .tools {
    order: 3;
    flex-basis: 100%;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .tools::-webkit-scrollbar {
    display: none;
  }
  .seg button,
  .tools summary {
    min-height: 32px;
  }
  .ind-panel,
  .share-panel,
  .notify-panel {
    position: fixed;
    top: calc(var(--top) + 6px);
    left: 12px;
    right: 12px;
    width: auto;
    max-height: calc(100vh - var(--top) - 20px);
    max-height: calc(100dvh - var(--top) - 20px);
    overflow-y: auto;
  }
  .ind-panel {
    flex-direction: column;
    gap: 14px;
  }
  .ind-list label {
    min-height: 30px;
  }
  .chart-tools {
    right: 66px;
    opacity: 0.85;
  }
  .stage {
    height: max(440px, calc(100vh - var(--top) - 40px));
    height: max(440px, calc(100dvh - var(--top) - 40px));
  }
}

/* ---------- replay (?case=<id>) ---------- */
.live[data-state="replay"]::before {
  background: var(--gold);
}
.replay {
  position: absolute;
  top: 10px;
  left: 50%;
  display: flex;
  align-items: center;
  gap: 6px;
  width: min(560px, calc(100% - 100px));
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(10, 16, 24, 0.92);
  transform: translateX(-50%);
}
.replay[hidden] {
  display: none;
}
.replay button,
.replay select {
  min-width: 30px;
  height: 28px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--raise);
  font-family: var(--f-mono);
  font-size: 12px;
  cursor: pointer;
}
.replay button:hover {
  border-color: var(--teal);
}
.replay input[type="range"] {
  flex: 1;
  min-width: 60px;
  accent-color: var(--gold);
}
.rp-clock {
  flex: none;
  color: var(--muted);
  font-family: var(--f-mono);
  font-size: 12px;
}
/* The script's narration, placed by app.js near the top of the price pane. */
.caption {
  position: absolute;
  left: 50%;
  max-width: min(720px, calc(100% - 110px));
  margin: 0;
  padding: 9px 16px;
  border: 1px solid rgba(232, 189, 125, 0.35);
  border-radius: 10px;
  background: rgba(5, 9, 15, 0.88);
  color: var(--text);
  font-size: 17px;
  font-weight: 600;
  line-height: 1.5;
  text-align: center;
  transform: translateX(-50%);
  pointer-events: none;
}
.caption[hidden] {
  display: none;
}
/* ?rec=1: a clean frame for screen recording, with the captions in a band under the chart. */
.rec {
  --band: 22vh;
}
.rec .tools,
.rec .chart-tools,
.rec .replay,
.rec .live,
.rec .site-links,
.rec .note {
  display: none;
}
.rec .stage {
  height: calc(100vh - var(--top) - var(--band));
  height: calc(100dvh - var(--top) - var(--band));
}
.rec .caption {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: none;
  height: var(--band);
  padding: 0 28px;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  background: var(--panel);
  font-size: 24px;
  transform: none;
}
.rec .caption[hidden] {
  display: none;
}
@media (max-width: 720px) {
  .rec {
    --top: 48px;
  }
  .rec .topbar {
    flex-wrap: nowrap;
  }
  .replay {
    width: calc(100% - 76px);
    left: 8px;
    transform: none;
  }
  .caption {
    max-width: calc(100% - 80px);
    left: calc(50% - 29px);
    font-size: 15px;
  }
  .rec .caption {
    left: 0;
    max-width: none;
    font-size: 20px;
  }
}
