/* copytrade page — two themes, tokens only. No gradients, no external assets. */
:root, :root[data-theme="typewriter"] {
  --bg: #ece3cf;
  --surface: #f4eddd;
  --sunk: #e4d9c1;
  --ink: #2b1f17;
  --muted: #7c6a56;
  --faint: #a8977f;
  --line: #d3c5a8;
  --accent: #6e1b2a;          /* bordeaux */
  --accent-ink: #f4eddd;
  --pos: #2f6b3c;
  --neg: #b02a22;
  --warn: #9a6a12;
  --pos-soft: rgba(47, 107, 60, .12);
  --neg-soft: rgba(176, 42, 34, .12);
  --glow: none;
  --font: "Courier Prime", "American Typewriter", "Courier New", "Nimbus Mono PS", "Liberation Mono", Courier, monospace;
  --radius: 3px;
  color-scheme: light;
}
:root[data-theme="matrix"] {
  --bg: #000;
  --surface: #030805;
  --sunk: #06110a;
  --ink: #b9f4c6;
  --muted: #4d8a5c;
  --faint: #2c5a39;
  --line: #0f2d19;
  --accent: #00ff66;
  --accent-ink: #000;
  --pos: #3dff7e;
  --neg: #ff3b5c;
  --warn: #e3c341;
  --pos-soft: rgba(61, 255, 126, .10);
  --neg-soft: rgba(255, 59, 92, .12);
  --glow: 0 0 18px rgba(61, 255, 126, .28);
  --font: ui-monospace, "JetBrains Mono", "Fira Code", "DejaVu Sans Mono", "Liberation Mono", monospace;
  --radius: 2px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font);
  font-size: 14px; line-height: 1.45; font-variant-numeric: tabular-nums;
  transition: background-color .35s ease, color .35s ease;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
a { color: inherit; }
.dim { color: var(--muted); }
.pos { color: var(--pos); }
.neg { color: var(--neg); }
.warn { color: var(--warn); }
.zero { color: var(--muted); }

/* ---- top bar ---- */
.bar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 12px 28px; background: var(--bg); border-bottom: 1px solid var(--line);
  transition: background-color .35s ease, border-color .35s ease;
}
.bar-l, .bar-r { display: flex; align-items: center; gap: 20px; min-width: 0; }
.brand { font-weight: 700; letter-spacing: .02em; font-size: 15px; white-space: nowrap; }
.brand-sub { margin-left: 8px; padding: 1px 6px; font-size: 11px; font-weight: 400; border: 1px solid var(--line);
  border-radius: var(--radius); color: var(--muted); vertical-align: 2px; }
.books { position: relative; display: flex; gap: 2px; padding: 3px; border: 1px solid var(--line); border-radius: var(--radius); }
.book-btn { position: relative; z-index: 1; padding: 4px 12px; color: var(--muted); border-radius: var(--radius);
  transition: color .25s ease; white-space: nowrap; }
.book-btn:hover { color: var(--ink); }
.book-btn.on { color: var(--accent-ink); }
.book-ind { position: absolute; z-index: 0; top: 3px; bottom: 3px; left: 0; width: 0; background: var(--accent);
  border-radius: var(--radius); transition: transform .35s cubic-bezier(.2, .8, .2, 1), width .35s cubic-bezier(.2, .8, .2, 1); }
.book-dot { display: inline-block; width: 6px; height: 6px; margin-left: 7px; border-radius: 50%; vertical-align: 1px; background: var(--pos); }
.book-dot.bad { background: var(--neg); }
.updated { font-size: 12px; color: var(--muted); white-space: nowrap; }
.updated.stale { color: var(--neg); }
.back { font-size: 12px; color: var(--muted); text-decoration: none; border-bottom: 1px solid var(--line); }
.back:hover { color: var(--ink); }
.gear { display: grid; place-items: center; width: 32px; height: 32px; color: var(--muted); border-radius: var(--radius);
  transition: color .2s ease, transform .5s cubic-bezier(.2, .8, .2, 1); }
.gear:hover { color: var(--ink); }
.gear[aria-expanded="true"] { color: var(--accent); transform: rotate(60deg); }
.settings { position: absolute; top: 54px; right: 28px; width: 220px; padding: 10px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 10px 30px rgba(0, 0, 0, .12);
  animation: pop .22s cubic-bezier(.2, .8, .2, 1); }
.settings[hidden] { display: none; }
.settings-h { padding: 2px 6px 8px; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.theme-opt { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 6px; border-radius: var(--radius); text-align: left; }
.theme-opt .dim { margin-left: auto; font-size: 11px; }
.theme-opt:hover { background: var(--sunk); }
.theme-opt.on { outline: 1px solid var(--accent); }
.sw { width: 18px; height: 18px; border-radius: 50%; border: 1px solid var(--line); flex: none; }
.sw-tw { background: #ece3cf; box-shadow: inset -6px 0 0 #6e1b2a; }
.sw-mx { background: #000; box-shadow: inset -6px 0 0 #00ff66; }
@keyframes pop { from { opacity: 0; transform: translateY(-6px) scale(.98); } to { opacity: 1; transform: none; } }

/* ---- layout ---- */
.wrap { max-width: 1240px; margin: 0 auto; padding: 24px 28px 80px; }
.alerts:empty { display: none; }
.alert { display: flex; gap: 10px; align-items: baseline; padding: 10px 14px; margin-bottom: 10px;
  border-left: 3px solid var(--neg); background: var(--neg-soft); border-radius: var(--radius); animation: rise .4s ease both; }
.alert b { color: var(--neg); font-weight: 700; white-space: nowrap; }

.hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 36px; align-items: stretch; padding: 12px 0 28px; }
@media (max-width: 900px) { .hero { grid-template-columns: 1fr; gap: 24px; } }

/* ---- glance ---- */
.glance { display: flex; flex-direction: column; min-width: 0; animation: rise .5s ease both; }
.state { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.state .led { width: 8px; height: 8px; border-radius: 50%; background: var(--pos); }
.state .led.bad { background: var(--neg); }
.state .led.live { animation: breathe 2.4s ease-in-out infinite; }
@keyframes breathe { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
.big-l { margin-top: 26px; font-size: 12px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.big { margin: 2px 0 0; font-size: clamp(56px, 8vw, 96px); line-height: 1; font-weight: 700; letter-spacing: -.02em;
  text-shadow: var(--glow); transition: color .4s ease; }
.big.neg { text-shadow: 0 0 18px rgba(255, 59, 92, .0); }
:root[data-theme="matrix"] .big.neg { text-shadow: 0 0 18px rgba(255, 59, 92, .3); }
.big-sub { margin-top: 10px; font-size: 15px; color: var(--muted); }
.big-sub b { font-weight: 700; }
.horizons { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; margin-top: 26px;
  border-top: 1px solid var(--line); }
.hz { padding: 14px 16px 14px 0; }
.hz + .hz { padding-left: 16px; border-left: 1px solid var(--line); }
.hz-l { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.hz-v { margin-top: 2px; font-size: 26px; font-weight: 700; }
.hz-s { font-size: 12px; color: var(--muted); }
.facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
@media (max-width: 560px) { .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.fact { padding: 12px 12px 12px 0; min-width: 0; }
.fact + .fact { padding-left: 12px; border-left: 1px solid var(--line); }
@media (max-width: 560px) { .fact:nth-child(3) { padding-left: 0; border-left: 0; } .fact:nth-child(n+3) { border-top: 1px solid var(--line); } }
.fact-l { font-size: 11px; color: var(--muted); white-space: nowrap; }
.fact-v { margin-top: 2px; font-size: 17px; font-weight: 700; white-space: nowrap; }
.meter { height: 4px; margin-top: 7px; background: var(--sunk); border-radius: 2px; overflow: hidden; }
.meter > i { display: block; height: 100%; width: 0; background: var(--pos); transition: width .8s cubic-bezier(.2, .8, .2, 1), background-color .3s; }
.meter > i.mid { background: var(--warn); }
.meter > i.hi { background: var(--neg); }

/* ---- chart ---- */
.chartcard { display: flex; flex-direction: column; min-width: 0; min-height: 360px; padding: 16px 16px 8px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); animation: rise .6s .05s ease both;
  transition: background-color .35s ease, border-color .35s ease; }
.chart-h { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.chart-t { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .1em; }
.ranges { display: flex; gap: 2px; }
.rng { padding: 2px 8px; font-size: 12px; color: var(--muted); border-radius: var(--radius); transition: color .2s, background-color .2s; }
.rng:hover { color: var(--ink); }
.rng.on { color: var(--accent-ink); background: var(--accent); }
.chart { position: relative; flex: 1; min-height: 300px; }
.chart-empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: 13px; }

/* ---- pulse line ---- */
.pulse { display: flex; flex-wrap: wrap; gap: 8px 22px; padding: 14px 0 22px; font-size: 12px; color: var(--muted); }
.pulse:empty { display: none; }
.chip { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.chip i { width: 6px; height: 6px; border-radius: 50%; background: var(--pos); }
.chip.bad i { background: var(--neg); }
.chip.bad { color: var(--neg); }
.chip.note i { background: var(--warn); }
.chip.note { color: var(--warn); }
.chip.link { cursor: pointer; border-bottom: 1px dotted currentColor; }

/* ---- tabs ---- */
.tabs { position: sticky; top: 57px; z-index: 10; display: flex; gap: 26px; overflow-x: auto; scrollbar-width: none;
  background: var(--bg); border-bottom: 1px solid var(--line); transition: background-color .35s ease; }
.tabs::-webkit-scrollbar { display: none; }
.tab { position: relative; padding: 12px 0 11px; color: var(--muted); white-space: nowrap; transition: color .2s ease; }
.tab:hover { color: var(--ink); }
.tab.on { color: var(--ink); }
.tab-n { margin-left: 6px; font-size: 11px; color: var(--faint); }
.tab-ind { position: absolute; bottom: -1px; left: 0; height: 2px; width: 0; background: var(--accent);
  transition: transform .35s cubic-bezier(.2, .8, .2, 1), width .35s cubic-bezier(.2, .8, .2, 1); }
.panel { padding-top: 22px; min-height: 320px; }
.panel.anim > * { animation: rise .35s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.sub-h { margin: 26px 0 10px; font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.sub-h:first-child { margin-top: 0; }
.note { padding: 8px 12px; margin: 0 0 12px; font-size: 12px; color: var(--warn); border-left: 3px solid var(--warn); }
.empty { padding: 28px 0; color: var(--muted); }

/* ---- tables ---- */
.tbl-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { padding: 8px 10px; font-size: 11px; font-weight: 400; text-align: left; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 9px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th.r, td.r { text-align: right; }
tbody tr { transition: background-color .15s ease; }
tbody tr:hover { background: var(--sunk); }
tr.flag td:first-child { box-shadow: inset 3px 0 0 var(--warn); }

/* ---- wallets ---- */
.wl { border-top: 1px solid var(--line); }
.w { border-bottom: 1px solid var(--line); }
.w-row { display: grid; grid-template-columns: 22px minmax(150px, 1.4fr) repeat(5, minmax(84px, 1fr)); align-items: center;
  gap: 10px; width: 100%; padding: 13px 6px; text-align: left; transition: background-color .15s ease; }
.w-row:hover { background: var(--sunk); }
.w-row .caret { color: var(--faint); transition: transform .3s cubic-bezier(.2, .8, .2, 1); }
.w.open .caret { transform: rotate(90deg); color: var(--accent); }
.w-id { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.w-id .tier { margin-left: 8px; padding: 0 5px; font-size: 10px; border: 1px solid var(--line); border-radius: var(--radius); color: var(--muted); }
.w-id .tier.paused { color: var(--neg); border-color: var(--neg); }
.w-c { text-align: right; }
.w-c small { display: block; font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.w-head { padding-top: 0; padding-bottom: 6px; cursor: default; }
.w-head:hover { background: none; }
.w-head .w-c, .w-head .w-id { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
@media (max-width: 760px) { .w-row { grid-template-columns: 18px minmax(0, 1fr) repeat(2, 84px); } .w-c.opt { display: none; } }
.w-body { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .4s cubic-bezier(.2, .8, .2, 1); }
.w.open .w-body { grid-template-rows: 1fr; }
.w-in { overflow: hidden; }
.w-detail { padding: 6px 6px 20px 38px; }
.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px 18px; margin-bottom: 14px; }
.kv-l { font-size: 11px; color: var(--muted); }
.kv-v { font-weight: 700; }
.addr { font-size: 12px; color: var(--muted); word-break: break-all; margin-bottom: 12px; }

/* ---- small grids ---- */
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 36px; }
@media (max-width: 900px) { .grid2 { grid-template-columns: 1fr; } }
.seg { display: inline-flex; gap: 2px; margin-bottom: 14px; }
.list { margin: 0; padding: 0; list-style: none; }
.list li { padding: 9px 0; border-bottom: 1px solid var(--line); }
.list li .dim { font-size: 12px; }
.defs { font-size: 12px; color: var(--muted); }
.defs li { padding: 4px 0; border: 0; }

@media (max-width: 640px) {
  .bar { padding: 10px 16px; flex-wrap: wrap; }
  .bar-l { gap: 12px; flex-wrap: wrap; }
  .updated, .back { display: none; }
  .wrap { padding: 16px 16px 60px; }
  .tabs { top: 98px; }
  .settings { right: 16px; top: 52px; }
}

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

.foot { max-width: 1240px; margin: 0 auto; padding: 18px 28px 32px; font-size: 11px; color: var(--faint); border-top: 1px solid var(--line); }
.foot a { color: inherit; }
.book-btn.on .book-dot:not(.bad) { background: var(--accent-ink); }
.hero { transition: opacity .4s ease, filter .4s ease; }
.hero.offline { opacity: .5; filter: grayscale(.7); }
@media (max-width: 560px) { .hz { padding-right: 8px; } .hz + .hz { padding-left: 8px; } .hz-v { font-size: 19px; } }

/* ======================================================================
   balatro theme — card-table panels over a slow paint swirl, CRT on top.
   The swirl is a low-resolution WebGL canvas (ct_app.js); the CRT is a
   fixed, click-through overlay. Both exist only in this theme.
   ====================================================================== */
.bg-swirl, .crt { display: none; }
:root[data-theme="balatro"] {
  --bg: #1d2a2e;
  --surface: rgba(38, 52, 56, .86);
  --sunk: rgba(22, 32, 35, .85);
  --ink: #f4f1e8;
  --muted: #a9b8b9;
  --faint: #6f8486;
  --line: #3e5357;
  --accent: #0093ff;          /* chips blue: selection, never a loss */
  --accent-ink: #fff;
  --pos: #59d38c;
  --neg: #fe5f55;
  --warn: #ff8f3d;            /* orange: warnings */
  --gold: #f5b143;            /* money gold: labels */
  --pos-soft: rgba(89, 211, 140, .16);
  --neg-soft: rgba(254, 95, 85, .18);
  --chips: #0093ff;           /* chips blue */
  --glow: none;
  --font: "m6x11", ui-monospace, "JetBrains Mono", "DejaVu Sans Mono", monospace;
  --radius: 9px;
  color-scheme: dark;
}
:root[data-theme="balatro"] html, :root[data-theme="balatro"] { background: #12191b; }
:root[data-theme="balatro"] body { background: transparent; font-weight: 600; letter-spacing: .01em;
  text-shadow: 0 1px 0 rgba(0, 0, 0, .55); }
:root[data-theme="balatro"] .bg-swirl { display: block; position: fixed; inset: 0; z-index: -1; width: 100vw; height: 100vh;
  image-rendering: pixelated; filter: blur(1.2px) saturate(1.05); }
:root[data-theme="balatro"] .crt { display: block; position: fixed; inset: 0; z-index: 60; pointer-events: none;
  /* scanlines */
  background: repeating-linear-gradient(to bottom, rgba(0, 0, 0, .13) 0 1px, transparent 1px 3px);
  animation: crt-flicker 7s steps(1) infinite; }
:root[data-theme="balatro"] .crt::after { content: ""; position: absolute; inset: 0; border-radius: 26px / 34px;
  /* curved glass: dark corners, soft rim */
  background: radial-gradient(ellipse 85% 80% at 50% 50%, transparent 62%, rgba(0, 0, 0, .55) 100%);
  box-shadow: inset 0 0 90px rgba(0, 0, 0, .55), inset 0 0 0 2px rgba(0, 0, 0, .35); }
@keyframes crt-flicker { 0%, 100% { opacity: 1; } 48% { opacity: .93; } 49% { opacity: 1; } 77% { opacity: .96; } 78% { opacity: 1; } }

/* chunky card panels with a hard drop shadow */
:root[data-theme="balatro"] .bar { background: rgba(20, 29, 31, .88); border-bottom: 3px solid #0e1517; backdrop-filter: blur(3px); }
:root[data-theme="balatro"] .tabs { background: rgba(20, 29, 31, .9); border-bottom: 3px solid #0e1517; border-radius: 0 0 var(--radius) var(--radius); padding: 0 14px; }
:root[data-theme="balatro"] .glance,
:root[data-theme="balatro"] .chartcard,
:root[data-theme="balatro"] .panel,
:root[data-theme="balatro"] .pulse { background: var(--surface); border: 3px solid #0e1517; border-radius: var(--radius);
  box-shadow: 0 6px 0 #0b1112, 0 14px 28px rgba(0, 0, 0, .35); }
:root[data-theme="balatro"] .glance { padding: 18px 20px 20px; }
:root[data-theme="balatro"] .pulse { padding: 12px 16px; margin: 18px 0 18px; }
:root[data-theme="balatro"] .panel { padding: 20px; margin-top: 14px; }
:root[data-theme="balatro"] .settings { background: #263438; border: 3px solid #0e1517; box-shadow: 0 6px 0 #0b1112; }
:root[data-theme="balatro"] .alert { background: linear-gradient(rgba(254, 95, 85, .18), rgba(254, 95, 85, .18)), #1a2427; border: 3px solid var(--neg); border-left-width: 6px; position: relative; z-index: 61; }
:root[data-theme="balatro"] .alert b { color: #ff8a80; }

/* the score: big, outlined, a touch of colour fringe */
:root[data-theme="balatro"] .big { font-weight: 800; letter-spacing: 0;
  text-shadow: -2px 0 rgba(0, 147, 255, .55), 2px 0 rgba(254, 95, 85, .55), 0 4px 0 #0b1112; }
:root[data-theme="balatro"] .hz-v, :root[data-theme="balatro"] .fact-v { text-shadow: -1px 0 rgba(0, 147, 255, .4), 1px 0 rgba(254, 95, 85, .4), 0 2px 0 #0b1112; }
:root[data-theme="balatro"] .big-l, :root[data-theme="balatro"] .hz-l, :root[data-theme="balatro"] .chart-t { color: var(--gold); }

/* buttons: solid, pressable */
:root[data-theme="balatro"] .books { border: 3px solid #0e1517; background: #1a2427; }
:root[data-theme="balatro"] .book-ind { background: var(--accent); box-shadow: 0 3px 0 #005fa8; }
:root[data-theme="balatro"] .rng, :root[data-theme="balatro"] .seg .rng { background: #2f4145; color: var(--ink); box-shadow: 0 3px 0 #0e1517; margin-bottom: 3px; }
:root[data-theme="balatro"] .rng.on { background: var(--chips); color: #fff; box-shadow: 0 3px 0 #005fa8; }
:root[data-theme="balatro"] .rng:active, :root[data-theme="balatro"] .book-btn:active { transform: translateY(2px); }
:root[data-theme="balatro"] .tab-ind { height: 4px; background: var(--gold); border-radius: 2px; }
:root[data-theme="balatro"] .foot { background: rgba(20, 29, 31, .88); color: var(--muted); border-top: 3px solid #0e1517; position: relative; z-index: 61; }
:root[data-theme="balatro"] .bar { z-index: 61; }      /* controls and the settings popover stay above the CRT glass */
:root[data-theme="balatro"] .w-row:hover, :root[data-theme="balatro"] tbody tr:hover { background: rgba(0, 147, 255, .1); }
:root[data-theme="balatro"] .meter { background: #0e1517; height: 6px; border-radius: 3px; }
:root[data-theme="balatro"] .chip i { box-shadow: 0 0 6px currentColor; }
:root[data-theme="balatro"] .w-id .tier { border-color: var(--chips); color: var(--chips); }
.sw-bl { background: #fe5f55; box-shadow: inset -6px 0 0 #0093ff; }

@media (prefers-reduced-motion: reduce) { :root[data-theme="balatro"] .crt { animation: none; } }

/* regions rebuilt by the 15 s poll must never be picked as the scroll anchor:
   the page stays where it is instead of jumping */
.alerts, .glance, .pulse, .panel, .tabs, .books { overflow-anchor: none; }
