/* Markets — a macOS-style desktop for stocks and other assets.
   Tokens first, then desktop chrome, then the app window, then the dock. */

:root {
  --font: "Inter", -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --blue: #0a84ff;
  --green: #30d158;
  --red: #ff453a;
  --amber: #ffd60a;
  --violet: #bf5af2;
  --teal: #40cbe0;
  --orange: #ff9f0a;
  --radius: 14px;
  --dur: .55s;
  --ease: cubic-bezier(.22, 1, .36, 1);
}

/* dark is the default palette; the toggle and the OS setting swap in the light one */
:root {
  --ink: #f2f4f8;
  --ink-2: #a7b0bd;
  --ink-3: #737d8a;
  --chrome: rgba(38, 40, 46, .72);
  --chrome-solid: #1e2025;
  --surface: rgba(255, 255, 255, .045);
  --surface-2: rgba(255, 255, 255, .075);
  --hair: rgba(255, 255, 255, .11);
  --hair-soft: rgba(255, 255, 255, .06);
  --shadow: 0 50px 100px -30px rgba(0, 0, 0, .85);
  --wall-1: #1b2a4a; --wall-2: #0b1020; --wall-3: #2a1840;
}

:root[data-theme="light"] {
  --ink: #131720;
  --ink-2: #5b6472;
  --ink-3: #8a929e;
  --chrome: rgba(246, 247, 250, .78);
  --chrome-solid: #f3f4f7;
  --surface: rgba(255, 255, 255, .72);
  --surface-2: rgba(0, 0, 0, .035);
  --hair: rgba(0, 0, 0, .1);
  --hair-soft: rgba(0, 0, 0, .06);
  --shadow: 0 40px 90px -32px rgba(20, 30, 60, .45);
  --wall-1: #cfe0ff; --wall-2: #eef1f8; --wall-3: #e5d8ff;
  --blue: #007aff; --green: #1eb954; --red: #f0413a;
}

* { box-sizing: border-box; }

/* Several elements are toggled with the hidden attribute while their own rule
   sets a display, which would otherwise win over the browser default. */
[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--wall-2);
  overflow-x: hidden;
  transition: background .4s ease, color .4s ease;
}

h1, h2, h3, h4 { margin: 0; line-height: 1.15; letter-spacing: -.02em; font-weight: 600; }
p { margin: 0; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
::selection { background: color-mix(in srgb, var(--blue) 45%, transparent); }

/* ============ wallpaper ============ */

.wallpaper {
  position: fixed; inset: 0; z-index: -2; overflow: hidden;
  background: linear-gradient(160deg, var(--wall-1), var(--wall-2) 52%, var(--wall-3));
  transition: background .5s ease;
}
.blob { position: absolute; border-radius: 50%; filter: blur(90px); opacity: .55; }
.b1 { width: 46vw; height: 46vw; left: -8vw; top: -10vw; background: radial-gradient(circle, var(--blue), transparent 62%); }
.b2 { width: 40vw; height: 40vw; right: -6vw; top: 12vh; background: radial-gradient(circle, var(--violet), transparent 62%); }
.b3 { width: 52vw; height: 40vw; left: 22vw; bottom: -16vw; background: radial-gradient(circle, var(--teal), transparent 65%); opacity: .35; }
.noise {
  position: absolute; inset: 0; opacity: .16; mix-blend-mode: overlay;
  background-image: radial-gradient(rgba(255,255,255,.35) .5px, transparent .6px);
  background-size: 3px 3px;
}

/* ============ menu bar ============ */

.menubar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 60;
  height: 30px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 12px; font-size: 13px; font-weight: 500;
  background: var(--chrome); backdrop-filter: blur(26px) saturate(180%);
  border-bottom: 1px solid var(--hair-soft);
  transform: translateY(-100%);
}
body.ready .menubar { transform: none; transition: transform var(--dur) var(--ease); }

.menubar-left, .menubar-right { display: flex; align-items: center; gap: 4px; }
.logo { display: grid; place-items: center; width: 22px; height: 22px; color: var(--ink); }
.menu-item { padding: 3px 9px; border-radius: 6px; font-size: 13px; color: var(--ink); opacity: .92; }
.menu-item.strong { font-weight: 700; }
.menu-item:hover { background: var(--surface-2); }
/* ---- menu bar menus ---- */
.menu { position: relative; }
.menu.open > .menu-item { background: var(--blue); color: #fff; opacity: 1; }
.menu-drop {
  display: none; position: absolute; top: calc(100% + 4px); left: 0; z-index: 70;
  min-width: 226px; padding: 6px; border-radius: 11px;
  background: var(--chrome-solid); border: 1px solid var(--hair);
  box-shadow: 0 26px 50px -22px rgba(0, 0, 0, .75);
}
.menu.open .menu-drop { display: block; }
.mi {
  display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 26px;
  padding: 6px 10px; border-radius: 7px; font-size: 13px; text-align: left; color: var(--ink);
}
.mi:hover { background: var(--blue); color: #fff; }
.mi:hover .mi-key { color: rgba(255, 255, 255, .75); }
.mi-key { font-family: var(--mono); font-size: 11px; color: var(--ink-3); }
.mi-sep { height: 1px; background: var(--hair); margin: 5px 8px; }

.menu-icon { display: grid; place-items: center; width: 26px; height: 22px; border-radius: 6px; color: var(--ink); opacity: .85; }
.menu-icon:hover { background: var(--surface-2); opacity: 1; }
.x-link:hover { color: var(--blue); }
.battery { width: 30px; }
.battery i {
  position: relative; display: block; width: 22px; height: 11px; border-radius: 3px;
  border: 1.4px solid currentColor; opacity: .8;
}
.battery i::before { content: ""; position: absolute; inset: 1.4px; width: 12px; background: currentColor; border-radius: 1px; }
.battery i::after { content: ""; position: absolute; right: -4px; top: 3px; width: 2px; height: 4px; background: currentColor; border-radius: 0 2px 2px 0; }
.menu-clock { font-variant-numeric: tabular-nums; padding-left: 6px; font-size: 13px; }

/* ============ stage + window ============ */

.stage { padding: 58px 22px 132px; display: flex; justify-content: center; }

.window {
  width: min(1240px, 100%);
  border-radius: 16px; overflow: hidden;
  background: var(--chrome); backdrop-filter: blur(34px) saturate(180%);
  border: 1px solid var(--hair);
  box-shadow: var(--shadow);
  opacity: 0; transform: scale(.965) translateY(14px);
}
body.ready .window { opacity: 1; transform: none; transition: opacity .7s var(--ease) .1s, transform .7s var(--ease) .1s; }

.titlebar {
  display: flex; align-items: center; gap: 16px;
  height: 50px; padding: 0 14px;
  border-bottom: 1px solid var(--hair-soft);
  background: linear-gradient(180deg, var(--surface-2), transparent);
}
.lights { display: flex; gap: 8px; }
.l { width: 12px; height: 12px; border-radius: 50%; display: block; }
.l.red { background: #ff5f57; } .l.amber { background: #febc2e; } .l.green { background: #28c840; }
.window:hover .l { filter: brightness(1.05); }

.titlebar-mid { flex: 1; display: flex; justify-content: center; min-width: 0; }
.seg {
  display: flex; gap: 2px; padding: 2px; border-radius: 9px;
  background: var(--surface-2); border: 1px solid var(--hair-soft); max-width: 100%; overflow-x: auto;
  scrollbar-width: none;
}
.seg::-webkit-scrollbar { display: none; }
.seg button {
  padding: 5px 13px; border-radius: 7px; font-size: 12.6px; font-weight: 500;
  color: var(--ink-2); white-space: nowrap; transition: background .18s ease, color .18s ease;
}
.seg button:hover { color: var(--ink); }
.seg button.on { background: var(--blue); color: #fff; box-shadow: 0 1px 6px -1px color-mix(in srgb, var(--blue) 70%, transparent); }

/* ---- wallet ---- */
/* Every colour here comes from the tokens already defined above. */
/* menu bar status item, sitting left of the battery */
.menu-wallet { display: flex; align-items: center; width: auto; gap: 6px; padding: 0 7px; }
.menu-wallet.on { color: var(--blue); opacity: 1; }
.menu-wallet-label { font-family: var(--mono); font-size: 11.4px; color: var(--ink); }
.wallet-avatar { width: 15px; height: 15px; border-radius: 50%; display: block; flex: none; }

.wallet-body { text-align: left; margin-top: 6px; }
.wallet-list { border: 1px solid var(--hair); border-radius: 12px; background: var(--surface-2); overflow: hidden; }
.wallet-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 10px 14px; font-size: 13px; color: var(--ink-2); }
.wallet-row + .wallet-row { border-top: 1px solid var(--hair-soft); }
.wallet-row b { font-family: var(--mono); font-size: 12.4px; font-weight: 500; color: var(--ink); }
.wallet-id { display: flex; align-items: center; gap: 11px; padding: 14px; }
.wallet-id .wallet-avatar { width: 34px; height: 34px; }
.wallet-id-text { min-width: 0; }
.wallet-id-text b { display: block; font-family: var(--mono); font-size: 14px; }
.wallet-id-text span { font-size: 12px; color: var(--ink-3); }
.wallet-mini {
  height: 26px; padding: 0 10px; border-radius: 7px; border: 1px solid var(--hair);
  background: var(--surface-2); color: var(--ink-2); font-size: 11.8px; margin-left: auto; flex: none;
}
.wallet-mini:hover { color: var(--ink); border-color: var(--line-strong, var(--hair)); }
.wallet-hint { font-size: 12.4px; color: var(--ink-3); margin-top: 12px; }
.wallet-hint a { color: var(--blue); }

.search {
  display: flex; align-items: center; gap: 7px; height: 28px; padding: 0 10px;
  border-radius: 8px; background: var(--surface-2); border: 1px solid var(--hair-soft); color: var(--ink-3);
  transition: border-color .18s ease, box-shadow .18s ease;
}
.search:focus-within { border-color: var(--blue); box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue) 22%, transparent); }
.search input {
  width: 150px; border: 0; background: none; outline: none; color: var(--ink);
  font-size: 13px; font-family: inherit;
}
.search input::placeholder { color: var(--ink-3); }
.search input::-webkit-search-cancel-button { filter: grayscale(1) opacity(.6); }

.window-body { display: grid; grid-template-columns: 218px 1fr; min-height: 620px; }
/* Grid and flex children default to a content-based minimum, which would let the
   chart's aspect ratio and the wide table push the whole window past the screen. */
.window-body > *, .sidebar > *, .content > * { min-width: 0; }
.content > *, .chart, .chart-shell { max-width: 100%; }

/* ============ sidebar ============ */

.sidebar {
  padding: 16px 12px; border-right: 1px solid var(--hair-soft);
  background: var(--surface); display: flex; flex-direction: column; gap: 22px;
}
.side-group h4 {
  font-size: 11px; text-transform: uppercase; letter-spacing: .09em;
  color: var(--ink-3); font-weight: 600; padding: 0 8px 8px;
}
.side-item {
  display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 7px 8px; border-radius: 8px; font-size: 13.4px; color: var(--ink);
  transition: background .16s ease;
}
.side-item:hover { background: var(--surface-2); }
.side-item.on { background: var(--blue); color: #fff; }
.side-item.on .si-ico { background: rgba(255,255,255,.24); color: #fff; }
.si-ico {
  display: grid; place-items: center; width: 22px; height: 22px; border-radius: 6px;
  font-size: 11px; background: var(--surface-2);
}
.si-ico.blue { color: var(--blue); } .si-ico.green { color: var(--green); }
.si-ico.violet { color: var(--violet); } .si-ico.orange { color: var(--orange); }
.si-ico.teal { color: var(--teal); } .si-ico.gold { color: var(--amber); }

.side-status { display: flex; align-items: center; gap: 8px; padding: 4px 8px 10px; font-size: 12.8px; color: var(--ink-2); }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 0 color-mix(in srgb, var(--green) 60%, transparent); animation: pulse 2.2s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 8px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
.side-meta { display: flex; justify-content: space-between; padding: 5px 8px; font-size: 12.6px; color: var(--ink-2); }
.side-meta b { font-family: var(--mono); font-size: 12px; }

.side-clock { padding: 2px 8px 10px; }
.side-clock .side-meta { padding: 3px 0; gap: 8px; }
.side-clock .side-meta span {
  font-size: 11.6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.side-clock .side-meta b { font-size: 11px; white-space: nowrap; color: var(--ink-2); }
.side-bar { height: 4px; margin-top: 7px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.side-bar i { display: block; height: 100%; border-radius: 999px; background: var(--blue); transition: width .6s ease; }

.heat { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; padding: 0 4px; }
.heat button {
  display: grid; gap: 2px; padding: 7px 3px; border-radius: 8px;
  border: 1px solid var(--hair-soft); text-align: center;
  font-family: var(--mono); font-size: 9.6px; color: var(--ink-2);
  transition: border-color .18s ease, transform .18s ease;
}
.heat button:hover { transform: translateY(-1px); border-color: var(--hair); }
.heat button.on { border-color: var(--blue); }
.heat button b { font-size: 10.4px; font-weight: 700; color: var(--ink); letter-spacing: .02em; }
.heat-note { font-size: 11px; color: var(--ink-3); padding: 9px 8px 0; }

.side-x {
  margin-top: auto; display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px; border-radius: 9px; font-size: 12.8px; font-weight: 500;
  border: 1px solid var(--hair); color: var(--ink-2); transition: all .18s ease;
}
.side-x:hover { color: var(--ink); border-color: var(--blue); background: var(--surface-2); }

.up { color: var(--green); } .down { color: var(--red); }

/* ============ content ============ */

.content { padding: 20px; display: flex; flex-direction: column; gap: 26px; min-width: 0; }

.anim { opacity: 0; transform: translateY(16px); }
body.ready .anim.in { opacity: 1; transform: none; transition: opacity .6s var(--ease), transform .6s var(--ease); }

/* hero */
.hero-card {
  border: 1px solid var(--hair); border-radius: var(--radius); padding: 18px;
  background: var(--surface); box-shadow: 0 20px 40px -34px rgba(0,0,0,.6);
}
.hero-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; flex-wrap: wrap; }
.hero-id { display: flex; align-items: center; gap: 13px; }
.asset-badge {
  display: grid; place-items: center; border-radius: 12px; font-family: var(--mono);
  font-weight: 700; background: var(--surface-2); color: var(--accent, var(--ink));
  border: 1px solid var(--hair-soft);
  transition: color .3s ease;
}
.asset-badge.lg { width: 52px; height: 52px; font-size: 13px; }
.hero-id h1 { font-size: 25px; letter-spacing: -.03em; }
.hero-id p { color: var(--ink-2); font-size: 13.2px; margin-top: 3px; }
.hero-price { text-align: right; }
.hero-price b { display: block; font-family: var(--mono); font-size: 30px; font-weight: 700; letter-spacing: -.02em; }
.delta { font-family: var(--mono); font-size: 13px; }

.chart-shell { position: relative; margin: 14px 0 6px; }
.chart { width: 100%; height: clamp(190px, 26vw, 260px); display: block; overflow: visible; cursor: crosshair; }
#grid line { stroke: var(--hair-soft); stroke-width: 1; }
#linePath { stroke: var(--green); filter: drop-shadow(0 6px 14px color-mix(in srgb, var(--green) 30%, transparent)); }
.falling #linePath { stroke: var(--red); filter: drop-shadow(0 6px 14px color-mix(in srgb, var(--red) 30%, transparent)); }
.g-top { stop-color: var(--green); stop-opacity: .3; }
.g-bottom { stop-color: var(--green); stop-opacity: 0; }
.falling .g-top { stop-color: var(--red); stop-opacity: .3; }
.falling .g-bottom { stop-color: var(--red); stop-opacity: 0; }
#cross line { stroke: var(--ink-3); stroke-width: 1; stroke-dasharray: 4 4; }
#cross circle { fill: var(--ink); stroke: var(--chrome-solid); stroke-width: 3; }
#cross.hidden { display: none; }
.drawing #linePath { stroke-dasharray: var(--len); stroke-dashoffset: var(--len); animation: draw 1.1s var(--ease) forwards; }
.drawing #areaPath { opacity: 0; animation: fadeIn .8s ease .35s forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes fadeIn { to { opacity: 1; } }

.tip {
  position: absolute; pointer-events: none; transform: translate(-50%, -120%);
  padding: 7px 10px; border-radius: 9px; font-family: var(--mono); font-size: 11.6px; white-space: nowrap;
  background: var(--chrome-solid); border: 1px solid var(--hair); box-shadow: 0 12px 24px -14px rgba(0,0,0,.7);
  z-index: 3;
}
.tip small { display: block; color: var(--ink-3); font-size: 10.5px; }

.hero-foot { display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap; margin-top: 12px; }
.ranges { display: flex; gap: 4px; padding: 3px; border-radius: 9px; background: var(--surface-2); border: 1px solid var(--hair-soft); }
.ranges button { padding: 5px 12px; border-radius: 7px; font-size: 12.4px; font-weight: 500; color: var(--ink-2); }
.ranges button.on { background: var(--chrome-solid); color: var(--ink); box-shadow: 0 1px 4px -1px rgba(0,0,0,.35); }

.stats { display: flex; flex-wrap: wrap; gap: 22px; margin: 0; }
.stats div { min-width: 74px; }
.stats dt { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-3); }
.stats dd { margin: 3px 0 0; font-family: var(--mono); font-size: 14px; font-weight: 500; }

/* blocks */
.block-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.block-head h2 { font-size: 16.5px; }
.block-title h2::before {
  content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent, var(--blue)); margin-right: 9px; vertical-align: middle;
}
.block-blurb { font-size: 12.8px; color: var(--ink-3); margin-top: 5px; }
.count, .hint { font-size: 12.4px; color: var(--ink-3); }

/* One strip of figures per asset class, so each tab reports on its own market. */
.class-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 14px; }
.class-stat {
  padding: 9px 12px; border-radius: 10px; background: var(--surface-2);
  border-left: 2px solid var(--accent, var(--blue));
}
.class-stat dt { font-size: 10.6px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); }
.class-stat dd { margin: 3px 0 0; font-family: var(--mono); font-size: 14.5px; font-weight: 500; font-variant-numeric: tabular-nums; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(206px, 1fr)); gap: 12px; }
.card {
  text-align: left; padding: 14px; border-radius: var(--radius); border: 1px solid var(--hair);
  background: var(--surface); transition: transform .2s var(--ease), border-color .2s ease, background .2s ease;
}
.card:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--blue) 55%, var(--hair)); background: var(--surface-2); }
.card.on { border-color: var(--blue); box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue) 20%, transparent); }
.card-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card-sym { display: flex; align-items: center; gap: 9px; font-weight: 600; font-size: 14px; }
.asset-badge.sm { width: 30px; height: 30px; font-size: 10px; }
.card-chg { font-family: var(--mono); font-size: 12px; padding: 2px 7px; border-radius: 999px; }
.card-chg.up { background: color-mix(in srgb, var(--green) 16%, transparent); }
.card-chg.down { background: color-mix(in srgb, var(--red) 16%, transparent); }
.card-name { font-size: 11.8px; color: var(--ink-3); margin-top: 8px; }
.card-price { font-family: var(--mono); font-size: 19px; font-weight: 700; margin-top: 2px; }
.card-spark { width: 100%; height: 38px; display: block; margin-top: 8px; }

/* table */
.table-card { border: 1px solid var(--hair); border-radius: var(--radius); background: var(--surface); overflow-x: auto; }
table.markets { width: 100%; border-collapse: collapse; min-width: 640px; }
table.markets th {
  position: sticky; top: 0; text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--ink-3); font-weight: 600; padding: 11px 16px; border-bottom: 1px solid var(--hair-soft);
  background: var(--chrome); backdrop-filter: blur(20px); cursor: pointer; white-space: nowrap;
}
table.markets th:hover { color: var(--ink); }
table.markets th.sorted::after { content: " ▾"; color: var(--blue); }
table.markets th.sorted.asc::after { content: " ▴"; }
table.markets td { padding: 11px 16px; border-bottom: 1px solid var(--hair-soft); font-size: 13.4px; }
table.markets tbody tr { cursor: pointer; transition: background .15s ease; }
table.markets tbody tr:hover { background: var(--surface-2); }
table.markets tbody tr.on { background: color-mix(in srgb, var(--blue) 12%, transparent); }
table.markets tbody tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-family: var(--mono); font-size: 12.8px; }
.row-sym { display: flex; align-items: center; gap: 9px; font-weight: 600; }
.asset-badge.xs { width: 26px; height: 26px; font-size: 9.4px; border-radius: 8px; }
.row-spark { width: 84px; height: 26px; display: inline-block; vertical-align: middle; }
.flash-up { animation: fu .9s ease; } .flash-down { animation: fd .9s ease; }
@keyframes fu { from { background: color-mix(in srgb, var(--green) 18%, transparent); } }
@keyframes fd { from { background: color-mix(in srgb, var(--red) 18%, transparent); } }

.content-foot { display: flex; align-items: center; justify-content: space-between; gap: 14px; color: var(--ink-3); font-size: 12px; padding-top: 4px; }
.foot-x { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; border: 1px solid var(--hair); transition: all .18s ease; }
.foot-x:hover { color: var(--blue); border-color: var(--blue); }

/* ============ dock ============ */

.dock {
  position: fixed; left: 50%; bottom: 14px; z-index: 60;
  display: flex; align-items: flex-end; gap: 10px;
  padding: 9px 12px; border-radius: 22px;
  background: var(--chrome); backdrop-filter: blur(30px) saturate(180%);
  border: 1px solid var(--hair); box-shadow: 0 24px 50px -22px rgba(0,0,0,.6);
  transform: translate(-50%, 130%);
}
body.ready .dock { transform: translate(-50%, 0); transition: transform .8s var(--ease) .25s; }

.dock-app { position: relative; display: block; }
.dock-app .ico {
  display: grid; place-items: center; width: 50px; height: 50px; border-radius: 14px;
  font-size: 25px; background: var(--surface-2); border: 1px solid var(--hair-soft);
  transition: transform .22s var(--ease), box-shadow .22s ease;
  transform-origin: bottom center;
}
.dock-app:hover .ico { transform: scale(1.22) translateY(-8px); box-shadow: 0 16px 26px -14px rgba(0,0,0,.75); }
.dock-app:active .ico { transform: scale(1.05) translateY(-2px); }
.i-markets { background: linear-gradient(160deg, #34c759, #0a84ff) !important; }
.i-watch { background: linear-gradient(160deg, #ffd60a, #ff9f0a) !important; }
.i-table { background: linear-gradient(160deg, #bf5af2, #5e5ce6) !important; }
.i-theme { background: linear-gradient(160deg, #64d2ff, #5e5ce6) !important; }
.i-terms { background: linear-gradient(160deg, #f2f2f7, #c7c7cc) !important; }
.i-x { background: #0b0b0d !important; color: #fff; }
.i-wallet { background: linear-gradient(160deg, #64d2ff, #0a84ff) !important; color: #fff; }
.i-game { background: linear-gradient(160deg, #40cbe0, #30d158) !important; color: #fff; }
.dock-dot {
  position: absolute; left: 50%; bottom: -6px; translate: -50% 0;
  width: 4px; height: 4px; border-radius: 50%; background: var(--ink);
}
.dock-sep { width: 1px; height: 42px; background: var(--hair); margin: 0 2px; align-self: center; }
.dock-app::after {
  content: attr(data-tip); position: absolute; bottom: 100%; left: 50%; translate: -50% -12px;
  padding: 4px 9px; border-radius: 7px; font-size: 11.5px; white-space: nowrap;
  background: var(--chrome-solid); border: 1px solid var(--hair); color: var(--ink);
  opacity: 0; pointer-events: none; transition: opacity .18s ease;
}
.dock-app:hover::after { opacity: 1; }

/* ============ terms modal ============ */

.modal-layer {
  position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px;
  background: color-mix(in srgb, #05070d 55%, transparent); backdrop-filter: blur(14px) saturate(140%);
  transition: opacity .4s ease, visibility .4s ease;
}
.modal-layer.gone { opacity: 0; visibility: hidden; }

.sheet {
  width: min(520px, 100%); max-height: min(88vh, 680px); overflow: hidden;
  display: flex; flex-direction: column; gap: 10px; text-align: center;
  padding: 24px 24px 20px; border-radius: 18px;
  background: var(--chrome-solid); border: 1px solid var(--hair);
  box-shadow: 0 50px 90px -30px rgba(0,0,0,.8);
  animation: sheetIn .5s var(--ease);
}
@keyframes sheetIn { from { opacity: 0; transform: scale(.9) translateY(10px); } }
.sheet.shake { animation: shake .38s ease; }
@keyframes shake { 25% { transform: translateX(-7px); } 50% { transform: translateX(7px); } 75% { transform: translateX(-4px); } }

.sheet-icon { font-size: 40px; line-height: 1; }
.sheet h2 { font-size: 19px; }
.sheet-lede { font-size: 13px; color: var(--ink-2); }
.sheet-scroll {
  text-align: left; overflow-y: auto; padding: 14px 16px; margin-top: 6px;
  border: 1px solid var(--hair); border-radius: 12px; background: var(--surface-2);
  font-size: 13px; color: var(--ink-2); line-height: 1.55; flex: 1; min-height: 140px;
}
.sheet-scroll h3 { font-size: 13px; color: var(--ink); margin: 14px 0 4px; }
.sheet-scroll h3:first-child { margin-top: 0; }
.sheet-check { display: flex; align-items: center; gap: 9px; text-align: left; font-size: 13px; color: var(--ink); padding: 4px 2px; cursor: pointer; }
.sheet-check input { width: 16px; height: 16px; accent-color: var(--blue); cursor: pointer; }
.sheet-actions { display: flex; gap: 10px; justify-content: flex-end; }
.btn { height: 34px; padding: 0 18px; border-radius: 9px; font-size: 13.4px; font-weight: 500; transition: filter .16s ease, background .16s ease, transform .12s ease; }
.btn:active { transform: translateY(1px); }
.btn-blue { background: var(--blue); color: #fff; }
.btn-blue:disabled { opacity: .45; cursor: not-allowed; }
.btn-blue:not(:disabled):hover { filter: brightness(1.1); }
.btn-green { background: var(--green); color: #08130c; }
.btn-red { background: var(--red); color: #fff; }
.btn-green:hover, .btn-red:hover { filter: brightness(1.08); }
.btn-quiet { background: var(--surface-2); border: 1px solid var(--hair); color: var(--ink); }
.btn-quiet:hover { background: var(--hair-soft); }
.sheet-note { font-size: 12.2px; color: var(--red); text-align: right; }

/* ============ responsive ============ */

@media (max-width: 900px) {
  .side-heat, .side-clock { display: none; }   /* the sidebar becomes a strip */
  .window-body { grid-template-columns: 1fr; }
  .sidebar { flex-direction: row; flex-wrap: wrap; gap: 12px; border-right: 0; border-bottom: 1px solid var(--hair-soft); }
  .sidebar .side-group:first-child { display: flex; gap: 6px; overflow-x: auto; width: 100%; }
  .sidebar .side-group:first-child h4 { display: none; }
  .side-item { width: auto; white-space: nowrap; }
  .side-group:nth-child(2) { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
  .side-group:nth-child(2) h4 { display: none; }
  .side-x { margin: 0 0 0 auto; }
  .titlebar { flex-wrap: wrap; height: auto; padding: 10px 14px; gap: 10px; }
  .titlebar-mid { order: 3; width: 100%; justify-content: flex-start; }
  .search input { width: 110px; }
}

@media (max-width: 620px) {
  .stage { padding: 46px 10px 120px; }
  .hero-price { text-align: left; }
  .hide-sm { display: none; }
  .dock { gap: 6px; padding: 7px 9px; }
  .dock-app .ico { width: 42px; height: 42px; font-size: 21px; }
  .content { padding: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  .anim { opacity: 1; transform: none; }
  .window, .menubar, .dock { opacity: 1; transform: none; }
  .dock { transform: translate(-50%, 0); }
}


.toast {
  position: fixed; left: 50%; bottom: 96px; translate: -50% 0; z-index: 120;
  padding: 9px 16px; border-radius: 10px; font-size: 13px;
  background: var(--chrome-solid); color: var(--ink);
  border: 1px solid var(--hair); box-shadow: 0 20px 40px -22px rgba(0, 0, 0, .8);
  animation: toastIn .25s ease;
}
@keyframes toastIn { from { opacity: 0; translate: -50% 8px; } }

/* ============ ticker drop ============ */

.game-window {
  width: min(720px, 100%);
  border-radius: 16px; overflow: hidden;
  background: var(--chrome); backdrop-filter: blur(34px) saturate(180%);
  border: 1px solid var(--hair); box-shadow: var(--shadow);
}
.game-bar {
  display: flex; align-items: center; gap: 14px; height: 50px; padding: 0 14px;
  border-bottom: 1px solid var(--hair-soft);
  background: linear-gradient(180deg, var(--surface-2), transparent);
}
.game-bar h2 { font-size: 15px; }
.game-bar .wallet-mini { margin-left: auto; }
.game-sub { font-size: 12.4px; color: var(--ink-3); }

.game-body { display: flex; gap: 18px; padding: 18px; }
.board-wrap { position: relative; flex: none; }
#board {
  display: block; border-radius: 12px; border: 1px solid var(--hair);
  background: var(--surface-2); touch-action: none;
}
.game-over {
  position: absolute; inset: 0; display: grid; align-content: center; justify-items: center; gap: 10px;
  padding: 20px; text-align: center; border-radius: 12px;
  background: color-mix(in srgb, var(--chrome-solid) 86%, transparent);
}
.game-over b { font-size: 19px; }
.game-over span { font-size: 13px; color: var(--ink-2); }

.game-side { flex: 1; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.game-stat {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 0;
  padding: 9px 12px; border-radius: 10px; background: var(--surface-2);
  border-left: 2px solid var(--blue);
}
.game-stat dt { font-size: 10.6px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); }
.game-stat dd { margin: 0; font-family: var(--mono); font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; }

.game-name { margin-top: 0; padding: 7px 12px; }
.game-name input { width: 120px; text-align: left; height: 26px; font-size: 12px; }
.game-slots { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.game-next { padding: 12px 8px; border-radius: 10px; background: var(--surface-2); text-align: center; }
.game-next h4 { font-size: 10.6px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); font-weight: 600; }
.game-next canvas { display: block; margin: 8px auto 6px; }
.game-next span { font-family: var(--mono); font-size: 10.6px; color: var(--ink-2); }

.game-help { display: flex; flex-wrap: wrap; gap: 6px 10px; font-size: 11.4px; color: var(--ink-3); }
.game-help span { display: inline-flex; align-items: center; gap: 3px; white-space: nowrap; }
.game-help-note { width: 100%; color: var(--ink-3); opacity: .8; }
.game-help b {
  font-family: var(--mono); font-size: 10.6px; font-weight: 500; color: var(--ink-2);
  padding: 1px 5px; border-radius: 5px; border: 1px solid var(--hair); background: var(--surface-2);
}
.game-actions { display: flex; gap: 8px; margin-top: auto; }
.game-actions .btn { flex: 1; }

.game-pad { display: none; gap: 8px; padding: 0 18px 18px; }
.game-pad button {
  flex: 1; height: 46px; border-radius: 11px; font-size: 17px;
  background: var(--surface-2); border: 1px solid var(--hair); color: var(--ink);
}
.game-pad button:active { background: var(--blue); color: #fff; }

@media (max-width: 720px) {
  .game-body { flex-direction: column; align-items: center; }
  .game-side { width: 100%; }
  .game-pad { display: flex; }
  .game-sub { display: none; }
}


/* ============ trading ============ */

.trade-bar { display: flex; align-items: center; gap: 8px; }
.trade-bar .btn { height: 32px; padding: 0 16px; font-size: 13px; }
.trade-pos { font-family: var(--mono); font-size: 11.6px; color: var(--ink-3); }

.side-count { margin-left: auto; font-family: var(--mono); font-size: 11px; color: var(--ink-3); }
.side-item.on .side-count { color: rgba(255, 255, 255, .8); }

.ticket-field {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  margin-top: 10px; padding: 9px 14px; border-radius: 12px;
  border: 1px solid var(--hair); background: var(--surface-2);
  font-size: 13px; color: var(--ink-2);
}
.ticket-field input, .ticket-field select {
  width: 150px; height: 30px; padding: 0 8px; border-radius: 8px;
  border: 1px solid var(--hair); background: var(--chrome-solid); color: var(--ink);
  font-family: var(--mono); font-size: 13px; text-align: right;
}
.ticket-field input:focus, .ticket-field select:focus {
  outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue) 22%, transparent);
}
.ticket-quick { display: flex; gap: 6px; margin-top: 8px; }
.ticket-quick button {
  flex: 1; height: 28px; border-radius: 8px; font-family: var(--mono); font-size: 12px;
  border: 1px solid var(--hair); background: var(--surface-2); color: var(--ink-2);
}
.ticket-quick button:hover { color: var(--ink); border-color: var(--blue); }

.folio-window { width: min(860px, 100%); }
.folio-body { max-height: min(66vh, 620px); overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.folio-head { font-size: 12px; text-transform: uppercase; letter-spacing: .09em; color: var(--ink-3); font-weight: 600; margin-top: 6px; }
.folio-body .class-stats { margin-bottom: 0; }
.folio-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 0 18px 18px; }
.folio-empty { padding: 22px; text-align: center; color: var(--ink-3); font-size: 13px; }


/* ============ live coin ============ */

.live-title { display: flex; align-items: center; gap: 10px; font-size: 16.5px; }
.live-title::before { content: none; }   /* the LIVE badge stands in for the class dot */
.live-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px; border-radius: 999px;
  font-family: var(--mono); font-size: 10.4px; font-weight: 700; letter-spacing: .12em;
  color: var(--red); border: 1px solid color-mix(in srgb, var(--red) 45%, transparent);
  background: color-mix(in srgb, var(--red) 12%, transparent);
}
.live-dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--red);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--red) 70%, transparent);
  animation: livePulse 1.6s infinite;
}
@keyframes livePulse {
  70% { box-shadow: 0 0 0 7px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}
.live-seg { flex: none; }

.live-card {
  display: grid; grid-template-columns: minmax(190px, 260px) 1fr; gap: 20px;
  padding: 18px; border: 1px solid var(--hair); border-radius: var(--radius); background: var(--surface);
}
.live-left { display: flex; flex-direction: column; min-width: 0; }
.live-price {
  font-family: var(--mono); font-size: clamp(26px, 3.4vw, 36px); font-weight: 700;
  letter-spacing: -.02em; font-variant-numeric: tabular-nums; transition: color .25s ease;
}
.live-price.tick-up { color: var(--green); }
.live-price.tick-down { color: var(--red); }
.live-change { font-family: var(--mono); font-size: 13px; margin-top: 4px; }
.live-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; margin: 18px 0 0; }
.live-stats dt { font-size: 10.4px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); }
.live-stats dd { margin: 2px 0 0; font-family: var(--mono); font-size: 13px; font-variant-numeric: tabular-nums; }

.live-right { min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.live-chart { width: 100%; height: clamp(120px, 16vw, 150px); display: block; overflow: visible; }
.live-chart #liveLine { stroke: var(--green); }
.live-chart #liveHead { fill: var(--green); }
.live-chart .g-top { stop-color: var(--green); stop-opacity: .28; }
.live-chart .g-bottom { stop-color: var(--green); stop-opacity: 0; }
.live-block.falling .live-chart #liveLine, .live-block.falling .live-chart #liveHead { stroke: var(--red); fill: var(--red); }
.live-block.falling .live-chart #liveLine { fill: none; }
.live-block.falling .live-chart .g-top { stop-color: var(--red); stop-opacity: .28; }
.live-block.falling .live-chart .g-bottom { stop-color: var(--red); stop-opacity: 0; }

.live-tape {
  display: flex; gap: 6px; overflow: hidden; height: 22px;
  font-family: var(--mono); font-size: 10.6px;
}
.live-tape span {
  padding: 2px 7px; border-radius: 6px; white-space: nowrap;
  border: 1px solid var(--hair-soft); background: var(--surface-2); color: var(--ink-2);
  animation: tapeIn .3s ease;
}
.live-tape .up { color: var(--green); }
.live-tape .down { color: var(--red); }
@keyframes tapeIn { from { opacity: 0; transform: translateX(-6px); } }

@media (max-width: 720px) {
  .live-card { grid-template-columns: 1fr; }
  .live-stats { grid-template-columns: 1fr 1fr; }
}
