:root {
  color-scheme: dark;
  --page: #0a0a0a;
  --head: #000000;
  --panel: #0a0a0a;
  --surface: #0a0a0a;
  --line: #232327;
  --ink: #f2f4f8;
  --ink2: #d0d0d6;
  --muted: #8f8f98;
  --accent: #f7931a;
  --grid: #1a1a1d;
  --axis: #2e2e33;
  --up: #2ec27e;
  --down: #f0555a;
  --s1: #3987e5; --s2: #f7931a; --s3: #199e70; --s4: #d55181; --s5: #9085e9; --s6: #5b6275;
  --good: #0ca30c; --warning: #fab219; --serious: #ec835a; --critical: #d03b3b;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; background: var(--page); color: var(--ink);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
.dim { color: var(--muted); }
.small { font-size: 12px; }
.up { color: var(--up) !important; } .down { color: var(--down) !important; }
sup { font-size: 9px; }

/* ---------- header ---------- */
.top { display: flex; align-items: center; gap: 20px; height: 58px; padding: 0 20px; background: var(--head); position: sticky; top: 0; z-index: 5; border-bottom: 1px solid var(--line); }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 20px; letter-spacing: 0.08em; text-decoration: none; }
.logo .dim { color: var(--accent); }
.mark { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 6px; background: var(--accent); color: #000000; font-size: 16px; font-weight: 900; letter-spacing: 0; }
nav { margin-left: auto; display: flex; align-items: center; gap: 22px; font-size: 13px; text-transform: uppercase; letter-spacing: 0.08em; }
nav a { text-decoration: none; color: var(--muted); }
nav a:hover { color: var(--ink); }
nav .cur { color: var(--accent); font-weight: 700; }
.demo { background: var(--warning); color: #0b0b0b; text-align: center; font-size: 13px; font-weight: 600; padding: 6px 16px; }

/* ---------- top grid ---------- */
.topgrid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; border-bottom: 1px solid var(--line); }
.main { min-width: 0; border-right: 1px solid var(--line); }
.strip { display: grid; grid-template-columns: 250px minmax(0, 1fr); border-bottom: 1px solid var(--line); }
.pricebox { padding: 16px 20px; border-right: 1px solid var(--line); }
.plabel { color: var(--accent); font-size: 15px; letter-spacing: 0.02em; }
.price { font-size: 40px; font-weight: 700; letter-spacing: -0.01em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.pchg { font-size: 16px; font-variant-numeric: tabular-nums; }
.stripstats { margin: 0; padding: 14px 20px; display: grid; grid-template-columns: 1fr 1fr; column-gap: 40px; row-gap: 4px; align-content: center; }
.stripstats div { display: flex; justify-content: space-between; gap: 12px; }
.stripstats dt { color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; font-size: 13px; }
.stripstats dd { margin: 0; font-variant-numeric: tabular-nums; font-size: 15px; }

.tfbar { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.tf { display: flex; gap: 4px; flex-wrap: wrap; }
.tf button, .logbtn { font: inherit; font-size: 14px; letter-spacing: 0.06em; color: var(--muted); background: none; border: 0; padding: 6px 12px; border-radius: 6px; cursor: pointer; }
.tf button:hover, .logbtn:hover { color: var(--ink); }
.tf button.on { background: var(--accent); color: #000000; font-weight: 700; }
.logbtn[aria-pressed="true"] { color: var(--accent); font-weight: 700; }

.chart { position: relative; height: 220px; }
.chart.tall { height: 440px; }
.chart svg { display: block; width: 100%; height: 100%; overflow: visible; }
.chart .empty { display: grid; place-items: center; height: 100%; color: var(--muted); font-size: 14px; text-align: center; padding: 0 20px; }
.histnote { color: var(--muted); font-size: 12px; padding: 0 16px 10px; min-height: 10px; }
.tip { position: absolute; pointer-events: none; background: var(--head); border: 1px solid var(--line); box-shadow: 0 4px 16px rgba(0,0,0,.4); border-radius: 6px; padding: 6px 10px; font-size: 12px; white-space: nowrap; transform: translate(-50%, -115%); }
.tip b { display: block; font-size: 14px; }

/* ---------- sidebar ---------- */
.side { min-width: 0; }
.sidebox { padding: 16px 20px; border-bottom: 1px solid var(--line); }
.sidebox:last-child { border-bottom: 0; }
h2 { color: var(--accent); text-transform: uppercase; letter-spacing: 0.08em; font-size: 17px; font-weight: 600; margin: 0 0 14px; }
.meter-status { font-size: 14px; color: var(--ink2); margin-bottom: 14px; }
.meter-status b { color: var(--ink); }
.badge { display: inline-flex; align-items: center; gap: 6px; margin-left: 6px; font-weight: 600; white-space: nowrap; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.meter { position: relative; height: 10px; background: var(--grid); border-radius: 5px; margin: 18px 0 14px; }
.meter-fill { height: 100%; border-radius: 5px; width: 0; transition: width .4s; }
.meter-mark { position: absolute; left: 51%; top: -6px; bottom: -6px; width: 2px; background: var(--critical); }
.meter-mark span { position: absolute; top: -16px; left: 50%; transform: translateX(-50%); font-size: 10px; color: var(--critical); font-weight: 700; }
.stack { display: flex; gap: 2px; height: 22px; margin-bottom: 10px; }
.stack div { height: 100%; min-width: 2px; }
.stack div:first-child { border-radius: 4px 0 0 4px; }
.stack div:last-child { border-radius: 0 4px 4px 0; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: var(--ink2); }
.sw { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 7px; vertical-align: 0; }
.blocklist { list-style: none; margin: 0; padding: 0; }
.blocklist li { display: grid; grid-template-columns: 90px 1fr auto; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14px; font-variant-numeric: tabular-nums; }
.blocklist li:last-child { border-bottom: 0; }
.blocklist .h { color: var(--accent); }
.blocklist .t { color: var(--muted); font-size: 13px; }

/* ---------- stats grid ---------- */
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.sec { padding: 22px 20px 24px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); min-width: 0; }
.sec:nth-child(3n) { border-right: 0; }
.rows { margin: 0; }
.rows div { display: flex; justify-content: space-between; gap: 14px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.rows div:last-child { border-bottom: 0; }
.rows dt { color: var(--ink2); font-size: 16px; }
.rows dd { margin: 0; font-size: 16px; font-variant-numeric: tabular-nums; text-align: right; }
.note { color: var(--muted); font-size: 12px; margin: 10px 0 0; }
.big { font-size: 28px; font-weight: 700; }
.bar { height: 6px; background: var(--grid); border-radius: 3px; margin: 12px 0 6px; overflow: hidden; }
.bar span { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 3px; }

.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; color: var(--muted); font-weight: 500; font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; padding: 6px 6px; border-bottom: 1px solid var(--axis); }
.tbl td { padding: 9px 6px; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .r { text-align: right; }

.form { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; margin-bottom: 8px; }
.form label { display: grid; gap: 4px; font-size: 12px; color: var(--muted); }
.form label:first-child { grid-column: 1 / -1; }
input, select { font: inherit; font-size: 14px; color: var(--ink); background: var(--head); border: 1px solid var(--axis); border-radius: 6px; padding: 7px 9px; width: 100%; }
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.foot { padding: 20px; font-size: 13px; color: var(--ink2); }
.foot p { margin: 6px 0; }

@keyframes fu { from { color: var(--up); } to { color: var(--ink); } }
@keyframes fd { from { color: var(--down); } to { color: var(--ink); } }
.flash-up { animation: fu 1.2s ease-out; }
.flash-down { animation: fd 1.2s ease-out; }
@media (prefers-reduced-motion: reduce) { .flash-up, .flash-down { animation: none; } }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .topgrid { grid-template-columns: minmax(0, 1fr); }
  .main { border-right: 0; }
  .side { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--line); }
  .sidebox { border-bottom: 0; border-right: 1px solid var(--line); }
  .sidebox:last-child { border-right: 0; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sec:nth-child(3n) { border-right: 1px solid var(--line); }
  .sec:nth-child(2n) { border-right: 0; }
}
@media (max-width: 720px) {
  .top { padding: 0 16px; }
  nav a { display: none; }
  .strip { grid-template-columns: 1fr; }
  .pricebox { border-right: 0; border-bottom: 1px solid var(--line); padding: 14px 16px; }
  .stripstats { grid-template-columns: 1fr; padding: 12px 16px; }
  .chart.tall { height: 300px; }
  .tfbar { padding: 6px 8px; }
  .tf button, .logbtn { padding: 6px 8px; font-size: 13px; }
  .side { grid-template-columns: 1fr; }
  .sidebox { border-right: 0; border-bottom: 1px solid var(--line); padding: 16px; }
  .stats { grid-template-columns: minmax(0, 1fr); }
  .sec { border-right: 0 !important; padding: 18px 16px; }
  .rows dt, .rows dd { font-size: 15px; }
}

/* breakout buttons + modal */
.bo { display: inline-grid; place-items: center; width: 20px; height: 20px; padding: 0; margin-left: 6px; vertical-align: -3px; background: none; border: 0; color: var(--muted); cursor: pointer; border-radius: 4px; }
.bo svg { width: 15px; height: 15px; }
.bo:hover { color: var(--accent); background: var(--grid); }
.plabel .bo { color: var(--accent); }
.modal { position: fixed; inset: 0; z-index: 20; background: rgba(5,7,12,.72); display: grid; place-items: center; padding: 16px; }
.modal[hidden] { display: none; }
.modal-box { width: min(1100px, 100%); background: var(--page); border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px 8px; box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.modal-h { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.modal-h h2 { margin: 0; }
.modal-h .tf { margin-left: auto; }
.modal-x { font: inherit; font-size: 18px; background: none; border: 0; color: var(--muted); cursor: pointer; padding: 4px 8px; }
.modal-x:hover { color: var(--ink); }
.modal-now { font-size: 22px; font-weight: 700; margin: 8px 0 4px; font-variant-numeric: tabular-nums; }
.tf button:disabled { opacity: .35; cursor: not-allowed; }
@media (max-width: 720px) { .modal-h .tf { margin-left: 0; } .modal-box { padding: 12px; } }

.buybtn { background: var(--accent); color: #000000 !important; font-weight: 800; padding: 7px 14px; border-radius: 6px; letter-spacing: 0.06em; }
.buybtn:hover { filter: brightness(1.08); }
#venues a { text-decoration: none; }
#venues a:hover { color: var(--accent); }
.note a { color: var(--accent); }
@media (max-width: 720px) { nav .buybtn { display: inline-block; } }

/* loading skeletons: shown until data arrives, never "n/a" */
@keyframes sk { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
dd:empty::before, .price:empty::before, .big:empty::before, #updated:empty::before {
  content: ""; display: inline-block; width: 72px; height: 0.8em; border-radius: 4px; vertical-align: -0.05em;
  background: linear-gradient(90deg, var(--grid) 0%, #2c2c32 50%, var(--grid) 100%); background-size: 200% 100%;
  animation: sk 1.3s ease-in-out infinite;
}
.price:empty::before { width: 170px; height: 0.75em; }
.big:empty::before { width: 150px; }
.chart:empty { border-radius: 6px; background: linear-gradient(90deg, rgba(30,30,34,.5) 0%, rgba(46,46,52,.6) 50%, rgba(30,30,34,.5) 100%); background-size: 200% 100%; animation: sk 1.6s ease-in-out infinite; }
.mark { background: none; }
.mark img { width: 28px; height: 28px; display: block; }
.lk { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-right: 6px; vertical-align: 1px; }

.tscroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
#mkts td, #mkts th { white-space: nowrap; }
#mkts td:first-child small { display: block; color: var(--muted); font-size: 12px; }
#markets { grid-column: 1 / -1; border-right: 0; }
.cta-inline { font-weight: 700; color: var(--accent) !important; }

/* ---------- mobile: nav row + chart first ---------- */
.buybtn.mob { display: none; }
@media (max-width: 720px) {
  .top { flex-wrap: wrap; height: auto; padding: 10px 16px 0; row-gap: 0; }
  .buybtn.mob { display: inline-block; margin-left: auto; }
  nav { order: 3; width: 100%; margin: 0 -16px; padding: 10px 16px; gap: 20px; overflow-x: auto; white-space: nowrap; scrollbar-width: none; border-top: 1px solid var(--line); margin-top: 10px; width: calc(100% + 32px); }
  nav::-webkit-scrollbar { display: none; }
  nav a { display: inline-block; }
  nav .buybtn { display: none !important; }
  .main { display: flex; flex-direction: column; }
  .strip { display: contents; }
  .pricebox { order: 1; }
  .tfbar { order: 2; }
  #price-chart { order: 3; }
  .histnote { order: 4; }
  .stripstats { order: 5; border-top: 1px solid var(--line); }
}
.buybtn { text-decoration: none; }

/* nav icons */
nav a svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; margin-right: 6px; }
nav a.buybtn svg { display: none; }
.tfbar { border-top: 1px solid var(--line); }
@media (max-width: 720px) {
  nav { display: grid !important; grid-template-columns: repeat(4, 1fr); gap: 2px 0; overflow: visible; padding: 8px 8px 10px; margin: 10px -16px 0; width: calc(100% + 32px); }
  nav a { display: flex !important; flex-direction: column; align-items: center; gap: 5px; padding: 8px 2px; font-size: 10.5px; letter-spacing: 0.06em; border-radius: 8px; }
  nav a svg { width: 22px; height: 22px; margin: 0; color: var(--accent); }
  nav a:active { background: var(--line); }
  .pricebox { order: 1; } #price-chart { order: 2; } .tfbar { order: 3; } .histnote { order: 4; } .stripstats { order: 5; }
  .tfbar { padding: 6px 4px; border-top: 1px solid var(--line); }
  .tf { flex-wrap: nowrap; gap: 0; }
  .tf button, .logbtn { padding: 6px 7px; font-size: 12.5px; letter-spacing: 0.02em; }
}
/* phones: one header row = logo mark + icon-only nav + Where to Buy */
@media (max-width: 720px) {
  .top { flex-wrap: nowrap; height: 54px; padding: 0 10px; gap: 6px; }
  .logo { gap: 0; flex: none; }
  .logo > span:last-child { display: none; }
  .buybtn.mob { order: 3; margin-left: 0; padding: 6px 9px; font-size: 11px; letter-spacing: 0.02em; white-space: nowrap; flex: none; }
  nav { order: 2; display: flex !important; flex: 1; justify-content: space-around; width: auto; margin: 0; padding: 0; border: 0; gap: 0; }
  nav a { padding: 6px 2px; flex: 1; min-width: 0; }
  nav a span { display: none; }
  nav a svg { width: 19px; height: 19px; }
  nav a[href$="/buy/"]:not(.buybtn) { display: none !important; }
}
.pricebox { text-align: center; }

/* nav: the How to Buy link duplicates the Where to Buy button */
nav a[href$="/buy/"]:not(.buybtn) { display: none !important; }
nav a { white-space: nowrap; }
@media (min-width: 721px) and (max-width: 1240px) { nav { gap: 16px; } nav a span { display: none; } nav a svg { width: 19px; height: 19px; margin: 0; } }

/* XBT Weekly signup */
.sub { margin: 20px; padding: 16px; border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 10px; background: var(--head); max-width: 720px; }
main .sub { margin: 20px 0; }
.sub-t { font-size: 14px; line-height: 1.45; }
.sub-t b { color: var(--ink); font-size: 16px; display: block; margin-bottom: 2px; }
.sub-r { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.sub-r input[type=email] { flex: 1 1 200px; min-width: 0; font: inherit; font-size: 16px; background: #000; color: var(--ink); border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; }
.sub-r input[type=email]:focus { outline: none; border-color: var(--accent); }
.sub-r button { font: inherit; font-weight: 800; background: var(--accent); color: #000; border: 0; border-radius: 6px; padding: 10px 18px; cursor: pointer; }
.sub-r button:disabled { opacity: .6; }
.sub .hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.sub-m { margin: 8px 0 0; font-size: 13px; color: var(--muted); min-height: 1em; }
.sub.done .sub-m { color: var(--up); }

/* phones: keep the header inside the screen (9 icons + Buy button) */
@media (max-width: 720px) {
  .top { padding: 0 8px; gap: 4px; overflow: hidden; }
  .buybtn.mob { padding: 6px 8px; }
  nav a { padding: 6px 1px; }
}
@media (max-width: 380px) { nav a svg { width: 17px; height: 17px; } }
