:root {
  color-scheme: light;
  --canvas: #f3f5f7;
  --surface: #ffffff;
  --surface-subtle: #f8f9fa;
  --ink: #17202a;
  --ink-soft: #56616d;
  --ink-faint: #89939d;
  --line: #dfe4e8;
  --line-strong: #cbd2d8;
  --brand: #2956c7;
  --brand-dark: #173b96;
  --brand-soft: #eaf0ff;
  --up: #118567;
  --up-soft: #e5f5f0;
  --down: #d05252;
  --down-soft: #fbecec;
  --warning: #b87312;
  --shadow: 0 18px 50px rgba(27, 41, 59, 0.08);
  --font-ui: system-ui, -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-width: 320px;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

button, a { font: inherit; }
button { color: inherit; }
button:focus-visible, a:focus-visible { outline: 3px solid rgba(41, 86, 199, 0.28); outline-offset: 3px; }

.app-shell { min-height: 100vh; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  min-height: 70px;
  padding: 0 36px;
  border-bottom: 1px solid rgba(203, 210, 216, 0.82);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
}

.brand { display: inline-flex; align-items: center; gap: 12px; width: max-content; color: inherit; text-decoration: none; }
.brand strong { display: block; font-size: 15px; line-height: 1.35; }
.brand small { display: block; color: var(--ink-faint); font-size: 11px; }
.brand-mark { display: grid; grid-template-columns: repeat(3, 5px); align-items: end; gap: 3px; width: 25px; height: 25px; padding: 4px; border-radius: 6px; background: var(--brand); }
.brand-mark i { display: block; width: 5px; border-radius: 1px; background: white; }
.brand-mark i:nth-child(1) { height: 8px; opacity: .6; }
.brand-mark i:nth-child(2) { height: 14px; }
.brand-mark i:nth-child(3) { height: 11px; opacity: .82; }

.topbar nav { display: flex; align-items: center; gap: 28px; height: 70px; }
.nav-link { position: relative; display: grid; align-items: center; height: 100%; padding: 0; border: 0; background: none; color: var(--ink-soft); text-decoration: none; cursor: pointer; }
.nav-link:hover, .nav-link.is-active { color: var(--ink); }
.nav-link.is-active::after { position: absolute; right: 0; bottom: -1px; left: 0; height: 2px; background: var(--brand); content: ""; }

.demo-disclosure { justify-self: end; display: inline-flex; align-items: center; gap: 8px; color: var(--warning); font-size: 13px; font-weight: 600; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #d78a20; box-shadow: 0 0 0 4px rgba(215, 138, 32, .12); }

.workspace { width: min(1480px, calc(100% - 72px)); margin: 0 auto; padding: 44px 0 56px; }
.intro { display: flex; align-items: flex-end; justify-content: space-between; gap: 48px; margin-bottom: 28px; }
.intro h1 { margin: 5px 0 10px; font-size: clamp(26px, 3vw, 38px); line-height: 1.18; letter-spacing: -0.035em; }
.intro > div > p:last-child { max-width: 680px; margin: 0; color: var(--ink-soft); font-size: 15px; }
.eyebrow { margin: 0; color: var(--brand); font-size: 12px; font-weight: 700; letter-spacing: .08em; }

.session-facts { display: flex; margin: 0; }
.session-facts div { min-width: 125px; padding: 0 18px; border-left: 1px solid var(--line-strong); }
.session-facts dt { color: var(--ink-faint); font-size: 12px; }
.session-facts dd { margin: 4px 0 0; font-weight: 650; font-variant-numeric: tabular-nums; }

.market-board { overflow: hidden; border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow); }
.market-toolbar { display: flex; justify-content: space-between; min-height: 67px; border-bottom: 1px solid var(--line); }
.product-switcher { display: flex; align-items: stretch; }
.product-tab { position: relative; min-width: 118px; padding: 12px 22px 11px; border: 0; border-right: 1px solid var(--line); background: transparent; text-align: left; cursor: pointer; }
.product-tab span, .product-tab small { display: block; }
.product-tab span { font-weight: 700; }
.product-tab small { margin-top: 1px; color: var(--ink-faint); font-size: 11px; }
.product-tab:hover { background: var(--surface-subtle); }
.product-tab.is-active { background: var(--brand-soft); color: var(--brand-dark); }
.product-tab.is-active::after { position: absolute; right: 0; bottom: -1px; left: 0; height: 3px; background: var(--brand); content: ""; }

.toolbar-actions { display: flex; align-items: center; gap: 14px; padding: 0 18px; }
.interval-switcher { display: inline-flex; padding: 3px; background: var(--surface-subtle); border: 1px solid var(--line); }
.interval-button, .quiet-button { min-height: 36px; border: 0; background: transparent; cursor: pointer; }
.interval-button { min-width: 58px; padding: 0 10px; color: var(--ink-soft); font-size: 13px; }
.interval-button.is-active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 4px rgba(23, 32, 42, .1); font-weight: 650; }
.quiet-button { display: inline-flex; align-items: center; gap: 8px; padding: 0 10px; color: var(--ink-soft); }
.pause-icon { width: 9px; height: 11px; border-right: 3px solid currentColor; border-left: 3px solid currentColor; }
.quiet-button[aria-pressed="true"] .pause-icon { width: 0; height: 0; border: 6px solid transparent; border-right-width: 0; border-left: 9px solid currentColor; }

.price-header { display: grid; grid-template-columns: minmax(230px, .8fr) minmax(320px, 1fr) 1.5fr; align-items: center; gap: 28px; padding: 24px 28px; border-bottom: 1px solid var(--line); }
.asset-identity { display: flex; align-items: center; gap: 12px; }
.asset-code { display: grid; place-items: center; width: 45px; height: 45px; background: #192c53; color: white; font-size: 12px; font-weight: 750; }
.asset-identity strong, .asset-identity small { display: block; }
.asset-identity strong { font-size: 15px; }
.asset-identity small { margin-top: 2px; color: var(--ink-faint); font-size: 12px; }
.headline-price { display: flex; align-items: baseline; gap: 6px; white-space: nowrap; }
.headline-price .currency { color: var(--ink-soft); font-size: 19px; }
.headline-price strong { font-size: clamp(31px, 3.4vw, 44px); line-height: 1; letter-spacing: -0.04em; font-variant-numeric: tabular-nums lining-nums; }
.headline-price .unit { color: var(--ink-soft); }
.price-change { margin-left: 8px; padding: 3px 7px; font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; }
.price-change.is-up { background: var(--up-soft); color: var(--up); }
.price-change.is-down { background: var(--down-soft); color: var(--down); }
.market-stats { display: grid; grid-template-columns: repeat(4, 1fr); margin: 0; }
.market-stats div { padding-left: 20px; border-left: 1px solid var(--line); }
.market-stats dt { color: var(--ink-faint); font-size: 12px; }
.market-stats dd { margin: 4px 0 0; font-weight: 650; font-variant-numeric: tabular-nums lining-nums; }

.chart-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; }
.chart-column { min-width: 0; padding: 18px 24px 12px; }
.chart-caption { display: flex; justify-content: space-between; min-height: 26px; color: var(--ink-faint); font-size: 12px; font-variant-numeric: tabular-nums; }
.chart-caption > div:last-child { display: flex; align-items: center; gap: 7px; }
.legend-candle, .legend-volume { display: inline-block; width: 10px; height: 10px; margin-left: 8px; }
.legend-candle { background: var(--brand); }
.legend-volume { background: #b9c2cc; }
.chart-stage { position: relative; height: 420px; overflow: hidden; cursor: crosshair; }
#price-chart { display: block; width: 100%; height: 100%; }
.live-price-tag { position: absolute; right: 0; top: 50%; transform: translateY(-50%); padding: 3px 7px; background: var(--brand); color: white; font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums; pointer-events: none; }
.chart-tooltip { position: absolute; z-index: 3; min-width: 168px; padding: 9px 11px; border: 1px solid var(--line); background: rgba(255, 255, 255, .96); box-shadow: 0 8px 24px rgba(23, 32, 42, .12); color: var(--ink-soft); font-size: 12px; font-variant-numeric: tabular-nums; pointer-events: none; }
.chart-footnote { display: flex; justify-content: space-between; padding-top: 8px; border-top: 1px solid var(--line); color: var(--ink-faint); font-size: 11px; font-variant-numeric: tabular-nums; }

.quote-tape { min-width: 0; padding: 22px 22px 18px; border-left: 1px solid var(--line); background: var(--surface-subtle); }
.tape-heading { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 18px; }
.tape-heading h2 { margin: 2px 0 0; font-size: 18px; }
.stream-badge { display: inline-flex; align-items: center; gap: 7px; color: var(--up); font-size: 12px; font-weight: 650; }
.stream-badge i { width: 7px; height: 7px; border-radius: 50%; background: var(--up); animation: pulse 1.5s ease-out infinite; }
.stream-badge.is-paused { color: var(--ink-faint); }
.stream-badge.is-paused i { background: var(--ink-faint); animation: none; }
.tape-columns, .quote-list li { display: grid; grid-template-columns: 1fr 1fr .7fr; align-items: center; }
.tape-columns { padding: 0 0 7px; border-bottom: 1px solid var(--line); color: var(--ink-faint); font-size: 11px; }
.tape-columns span:not(:first-child), .quote-list li span:not(:first-child) { text-align: right; }
.quote-list { height: 266px; margin: 0; padding: 0; overflow: hidden; list-style: none; font-variant-numeric: tabular-nums lining-nums; }
.quote-list li { min-height: 38px; border-bottom: 1px solid rgba(223, 228, 232, .7); color: var(--ink-soft); font-size: 12px; animation: tape-in .22s ease-out; }
.quote-list .quote-price { color: var(--up); font-weight: 650; }
.quote-list .quote-price.is-down { color: var(--down); }
.basis-note { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line-strong); }
.basis-note strong { font-size: 12px; }
.basis-note p { margin: 5px 0 0; color: var(--ink-soft); font-size: 12px; line-height: 1.6; }

.handoff-strip { display: grid; grid-template-columns: 1.15fr 2.2fr auto; align-items: center; gap: 36px; margin-top: 22px; padding: 24px 28px; border: 1px solid var(--line); background: var(--surface); }
.handoff-strip h2 { margin: 4px 0 0; font-size: 19px; }
.handoff-strip ol { display: grid; grid-template-columns: repeat(3, 1fr); margin: 0; padding: 0; list-style: none; }
.handoff-strip li { display: flex; align-items: center; gap: 12px; padding: 4px 20px; border-left: 1px solid var(--line); }
.handoff-strip li > span { color: var(--brand); font-weight: 750; font-variant-numeric: tabular-nums; }
.handoff-strip strong, .handoff-strip small { display: block; }
.handoff-strip strong { font-size: 13px; }
.handoff-strip small { margin-top: 2px; color: var(--ink-faint); font-size: 11px; }
.primary-button { min-height: 42px; padding: 0 18px; border: 1px solid var(--brand); background: var(--brand); color: white; font-weight: 650; cursor: pointer; }
.primary-button:hover { background: var(--brand-dark); }

footer { display: flex; justify-content: space-between; width: min(1480px, calc(100% - 72px)); margin: 0 auto; padding: 0 0 30px; color: var(--ink-faint); font-size: 11px; }

.integration-dialog { width: min(620px, calc(100% - 32px)); max-height: calc(100vh - 48px); padding: 0; border: 0; background: var(--surface); box-shadow: 0 28px 90px rgba(22, 31, 46, .28); }
.integration-dialog::backdrop { background: rgba(24, 33, 46, .46); backdrop-filter: blur(3px); }
.dialog-bar { display: flex; align-items: center; justify-content: space-between; padding: 22px 26px; border-bottom: 1px solid var(--line); }
.dialog-bar h2 { margin: 2px 0 0; font-size: 22px; }
.icon-button { display: grid; place-items: center; width: 40px; height: 40px; padding: 0; border: 1px solid var(--line); background: transparent; font-size: 25px; line-height: 1; cursor: pointer; }
.dialog-content { max-height: calc(100vh - 140px); padding: 24px 26px 28px; overflow: auto; }
.dialog-lead { margin: 0 0 22px; color: var(--ink-soft); font-size: 15px; }
.integration-steps { margin: 0; padding: 0; list-style: none; }
.integration-steps li { display: grid; grid-template-columns: 34px 1fr; gap: 12px; padding: 15px 0; border-top: 1px solid var(--line); }
.integration-steps li > span { display: grid; place-items: center; width: 28px; height: 28px; background: var(--brand-soft); color: var(--brand-dark); font-weight: 750; }
.integration-steps strong { display: block; }
.integration-steps p { margin: 4px 0 0; color: var(--ink-soft); font-size: 13px; }
code { font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; font-size: .92em; }
.integration-steps code { display: inline-block; margin-top: 4px; padding: 4px 7px; background: var(--surface-subtle); color: var(--brand-dark); }
.contract-example { margin-top: 20px; border: 1px solid var(--line); }
.contract-example > div { display: flex; justify-content: space-between; padding: 10px 12px; border-bottom: 1px solid var(--line); font-size: 12px; }
.contract-example > div span { color: var(--ink-faint); }
.contract-example pre { margin: 0; padding: 14px; overflow: auto; background: #192233; color: #e5edf7; line-height: 1.65; }
.dialog-note { margin: 18px 0 0; color: var(--ink-faint); font-size: 12px; }

@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(17, 133, 103, .35); } 70% { box-shadow: 0 0 0 6px rgba(17, 133, 103, 0); } 100% { box-shadow: 0 0 0 0 rgba(17, 133, 103, 0); } }
@keyframes tape-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 1120px) {
  .workspace { width: min(100% - 36px, 1120px); }
  .price-header { grid-template-columns: .8fr 1fr; }
  .market-stats { grid-column: 1 / -1; }
  .market-stats div:first-child { padding-left: 0; border-left: 0; }
  .chart-layout { grid-template-columns: minmax(0, 1fr) 260px; }
  .handoff-strip { grid-template-columns: 1fr auto; }
  .handoff-strip ol { grid-column: 1 / -1; grid-row: 2; }
}

@media (max-width: 820px) {
  .topbar { grid-template-columns: 1fr auto; min-height: 62px; padding: 0 18px; }
  .topbar nav { display: none; }
  .brand small { display: none; }
  .workspace { width: calc(100% - 24px); padding-top: 26px; }
  .intro { display: block; }
  .intro h1 { font-size: 28px; }
  .session-facts { margin-top: 24px; overflow-x: auto; }
  .session-facts div:first-child { padding-left: 0; border-left: 0; }
  .market-toolbar { display: block; }
  .product-switcher { overflow-x: auto; }
  .product-tab { flex: 0 0 auto; min-width: 105px; padding: 11px 16px; }
  .toolbar-actions { justify-content: space-between; min-height: 58px; border-top: 1px solid var(--line); }
  .price-header { grid-template-columns: 1fr; gap: 18px; padding: 20px; }
  .headline-price strong { font-size: 38px; }
  .market-stats { grid-template-columns: repeat(2, 1fr); gap: 14px 0; }
  .market-stats div:nth-child(3) { padding-left: 0; border-left: 0; }
  .chart-layout { display: block; }
  .chart-column { padding: 16px 12px 12px; }
  .chart-stage { height: 360px; }
  .quote-tape { border-top: 1px solid var(--line); border-left: 0; }
  .handoff-strip { display: block; padding: 22px; }
  .handoff-strip ol { display: block; margin: 20px 0; }
  .handoff-strip li { padding: 10px 0; border-top: 1px solid var(--line); border-left: 0; }
  footer { display: block; width: calc(100% - 24px); }
  footer span { display: block; margin-top: 4px; }
}

@media (max-width: 480px) {
  .demo-disclosure { font-size: 12px; }
  .intro h1 { font-size: 25px; }
  .session-facts div { min-width: 112px; padding: 0 12px; }
  .toolbar-actions { gap: 4px; padding: 0 10px; }
  .interval-button { min-width: 52px; padding: 0 6px; }
  .quiet-button { padding: 0 4px; }
  .headline-price { flex-wrap: wrap; }
  .price-change { margin-left: 0; }
  .chart-caption > div:last-child { display: none; }
  .chart-stage { height: 320px; }
  .chart-footnote { display: block; }
  .chart-footnote span { display: block; }
}

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