/* Crypto chart. System fonts only; follows the device light or dark setting. */
:root {
  color-scheme: light dark;
  --page: #EEEEEA;
  --card: #FFFFFF;
  --ink: #16181D;
  --muted: #585E69;
  --rule: #D9DBDF;
  --accent: #B45309;
  --accent-ink: #FFFFFF;
  --bar: rgba(22, 24, 29, 0.07);
}

@media (prefers-color-scheme: dark) {
  :root {
    --page: #0F1012;
    --card: #1A1C20;
    --ink: #ECEDEF;
    --muted: #A4A9B3;
    --rule: #33363C;
    --accent: #F2A33A;
    --accent-ink: #17181B;
    --bar: rgba(236, 237, 239, 0.09);
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

a { color: var(--ink); text-underline-offset: 2px; }

:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.top, .wrap, .foot {
  max-width: 1120px;
  margin: 0 auto;
  padding-left: 16px;
  padding-right: 16px;
}

.top { padding-top: 8px; padding-bottom: 4px; }

.brand {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.01em;
  text-decoration: none;
}

.brand:hover { text-decoration: underline; }

h1 { font-size: 22px; line-height: 1.3; margin: 4px 0 12px; }

h2 { font-size: 16px; line-height: 1.4; margin: 0 0 8px; }

.card {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 14px;
  padding: 16px;
}

.controls { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-bottom: 12px; }

.seg { display: flex; flex-wrap: wrap; gap: 4px; }

.seg button {
  min-width: 44px;
  min-height: 44px;
  padding: 0 10px;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 120ms ease, color 120ms ease;
}

.seg button:hover { border-color: var(--ink); }

.seg button[aria-pressed="true"] { background: var(--ink); color: var(--card); border-color: var(--ink); }

.quote { margin-bottom: 8px; }

.quote p { margin: 0; }

.price { font-variant-numeric: tabular-nums; }

#cc-price { font-size: 28px; font-weight: 700; line-height: 1.2; }

.change { font-size: 16px; font-weight: 600; margin-left: 6px; }

.tag, .market, .status, .note { color: var(--muted); font-size: 14px; }

.updated { margin-left: 6px; font-variant-numeric: tabular-nums; }

.body { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }

.plot { position: relative; min-width: 0; }

.chart { position: relative; width: 100%; height: clamp(260px, 50vh, 520px); }

/* The library's frame is hidden until the chart is ready (view.js adds is-ready): until its styles load, the browser
   paints the frame white, a white box in the dark card. */
.chart iframe { visibility: hidden; }

.chart.is-ready iframe { visibility: visible; }

.note { margin: 4px 0 0; }

.book { min-width: 0; }

.ladder { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }

.ladder th, .ladder td { padding: 3px 8px; text-align: right; font-weight: 400; }

.ladder thead th { color: var(--muted); font-size: 13px; }

.ladder tr { --w: 0; }

.ladder td.sz { background: linear-gradient(to left, var(--bar) calc(var(--w) * 100%), transparent 0); }

.ladder .mid td { color: var(--muted); text-align: left; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }

.bids td.px { font-weight: 600; }

.depth { margin-top: 12px; }

.depth p { margin: 0; font-size: 14px; }

.depth-title { color: var(--muted); }

.depth-sides { display: flex; justify-content: space-between; gap: 8px; font-variant-numeric: tabular-nums; }

.depth-bar { --b: 0.5; height: 6px; margin-top: 6px; border-radius: 3px; background: var(--rule); overflow: hidden; }

.depth-bar span { display: block; height: 100%; width: calc(var(--b) * 100%); background: var(--ink); }

.foot { padding-top: 20px; padding-bottom: 32px; font-size: 14px; color: var(--muted); }

.foot section { margin-top: 16px; }

.foot h2 { color: var(--ink); font-size: 15px; margin-bottom: 4px; }

.foot p { margin: 0 0 6px; }

.credits { color: var(--ink); font-size: 14px; }

.foot .risk { margin-top: 16px; }

@media (min-width: 900px) {
  .body { grid-template-columns: minmax(0, 1fr) 260px; }
}

@media (max-width: 420px) {
  .top, .wrap, .foot { padding-left: 8px; padding-right: 8px; }
  .card { padding: 8px; }
  .controls { gap: 8px; }
  .seg button { padding: 0 6px; }
}

@media (prefers-reduced-motion: reduce) {
  .seg button { transition: background-color 120ms linear, color 120ms linear; }
}
