/* The trading app, in the landing page's style: glassy cards with a hairline inset border,
   pressable pills, the logo's green for long and purple for short. Two themes share every rule
   below; only these tokens change. Dark is the default, light is set by theme.js
   (data-theme="light" on <html>). Fonts and the base .btn come from theme.css. */

:root {
  color-scheme: dark;
  --bg: #07080d;
  --surface: #0d0f14;               /* solid, for things that float: modal, toast */
  --card: rgba(237, 255, 254, 0.035);
  --card-2: rgba(237, 255, 254, 0.06);
  --soft: rgba(237, 255, 254, 0.06);
  --line: rgba(237, 255, 254, 0.09);
  --line-2: rgba(237, 255, 254, 0.06);
  --line-hi: rgba(237, 255, 254, 0.2);
  --ink: #eef6f5;
  --ink-2: #ffffff;
  --heading: #ffffff;
  --text-2: #9aaba9;
  --placeholder: #6f7d7b;

  --long: #14f0b5;
  --long-btn: #14f0b5;
  --long-line: #14f0b5;
  --long-soft: rgba(20, 240, 181, 0.12);
  --long-fill: rgba(20, 240, 181, 0.2);
  --short: #a08afb;
  --short-btn: #6a4bff;
  --short-line: #9b84ff;
  --short-soft: rgba(139, 108, 255, 0.16);
  --short-fill: rgba(139, 108, 255, 0.24);
  --fill-end: rgba(7, 8, 13, 0);
  --danger: #ff5c6a;
  --err-bg: #2a0f14;
  --err-text: #ffd6da;
  --warn: #ffb547;
  --warn-soft: rgba(255, 181, 71, 0.1);

  --top-bg: rgba(10, 16, 16, 0.72);
  --glow: radial-gradient(1000px 420px at 50% -160px, rgba(20, 240, 181, 0.08), rgba(106, 75, 255, 0.05) 50%, transparent 75%);
  --scrim: rgba(3, 4, 7, 0.6);
  --shadow-deep: rgba(0, 0, 0, 0.85);
  --r-card: 22px;
  --raise: inset 0 1px 0 rgba(255, 255, 255, 0.1), inset 0 0 0 1px var(--line);
  --btn-bg: linear-gradient(rgba(237, 255, 254, 0.08), rgba(237, 255, 254, 0.03));
  --teal-grad: linear-gradient(#4ff7cf, #0fd9a2);
  --teal-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55), inset 0 -2px 6px rgba(0, 80, 60, 0.35), 0 14px 34px -14px rgba(20, 240, 181, 0.7);
  --purple-grad: linear-gradient(#9b84ff, #6a4bff);
  --purple-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), inset 0 -2px 6px rgba(40, 20, 140, 0.4), 0 14px 34px -14px rgba(106, 75, 255, 0.8);
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f5f6f8;
  --surface: #ffffff;
  --card: #ffffff;
  --card-2: #f0f2f5;
  --soft: #eef0f3;
  --line: #e3e6ea;
  --line-2: #eceef1;
  --line-hi: #cdd2d8;
  --ink: #0b0d12;
  --ink-2: #000000;
  --heading: #0b0d12;
  --text-2: #5d6470;
  --placeholder: #9aa1ab;

  --long: #00876c;            /* 4.6:1 on white */
  --long-line: #00b38f;
  --long-soft: #e2f8f1;
  --long-fill: rgba(0, 179, 143, 0.16);
  --short: #5b3ff5;
  --short-line: #7a5cff;
  --short-soft: #eeeafe;
  --short-fill: rgba(122, 92, 255, 0.16);
  --fill-end: rgba(255, 255, 255, 0);
  --danger: #c93a40;
  --err-bg: #fdecee;
  --err-text: #8f1d24;
  --warn: #9a6400;
  --warn-soft: #fff4dc;

  --top-bg: rgba(255, 255, 255, 0.82);
  --glow: radial-gradient(1000px 420px at 50% -160px, rgba(20, 240, 181, 0.14), rgba(106, 75, 255, 0.08) 50%, transparent 75%);
  --scrim: rgba(11, 13, 18, 0.35);
  --shadow-deep: rgba(11, 13, 18, 0.18);
  --raise: 0 1px 2px rgba(11, 13, 18, 0.06), inset 0 0 0 1px var(--line);
  --btn-bg: #ffffff;
  --teal-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6), inset 0 -2px 6px rgba(0, 110, 85, 0.25), 0 10px 24px -12px rgba(0, 179, 143, 0.55);
  --purple-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), inset 0 -2px 6px rgba(40, 20, 140, 0.3), 0 10px 24px -12px rgba(106, 75, 255, 0.55);
}

html { background: var(--bg); }
body { font-size: 14.5px; background: var(--glow) no-repeat, var(--bg); }
::selection { background: rgba(45, 240, 207, 0.3); color: var(--heading); }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: var(--btn-bg); box-shadow: var(--raise); color: var(--ink); border-radius: 999px; padding: 8px 16px; min-height: 38px; font-weight: 600; transition: filter .15s ease, background-color .15s ease, transform .1s ease; }
button:hover { filter: brightness(1.15); }
button:active { transform: translateY(1px); }
button:disabled { opacity: .45; cursor: not-allowed; filter: none; transform: none; }
button.primary { background: var(--teal-grad); box-shadow: var(--teal-shadow); color: #00201b; font-weight: 600; }
button.primary:hover { filter: brightness(1.06); }
button.chip { min-height: 34px; padding: 6px 14px; font-weight: 500; color: var(--text-2); background: var(--card); box-shadow: inset 0 0 0 1px var(--line); }
button.chip.on { background: var(--ink); box-shadow: none; color: var(--bg); font-weight: 600; }
input { background: var(--card); border: 0; box-shadow: inset 0 0 0 1px var(--line); border-radius: 14px; padding: 10px 14px; width: 100%; outline: none; color: var(--ink); min-height: 42px; transition: box-shadow .15s ease; }
input::placeholder { color: var(--placeholder); }
input:focus { box-shadow: inset 0 0 0 1px rgba(20, 240, 181, 0.6); }
.mono, .num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.dim { color: var(--text-2); }
.up { color: var(--long); }
.down { color: var(--short); }
.warn { color: var(--warn); }
.btn-ink, .btn-long { background: var(--teal-grad); box-shadow: var(--teal-shadow); color: #00201b; border-radius: 999px; }
.btn-line { background: var(--card); color: var(--ink); border: 0; box-shadow: inset 0 0 0 1px var(--line); border-radius: 999px; }

/* ---------- header: the landing page's floating pill ---------- */
.top { position: sticky; top: 12px; z-index: 10; display: flex; align-items: center; gap: 18px; height: 62px; margin: 12px auto 0; width: min(1320px, calc(100% - 24px)); padding: 0 10px 0 18px;
  border-radius: 999px; background: var(--top-bg); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); box-shadow: inset 0 0 0 1px var(--line), 0 20px 40px -24px var(--shadow-deep); }
.brand { display: flex; align-items: center; gap: 9px; text-decoration: none; font: 700 20px/1 var(--sans); letter-spacing: -0.04em; color: var(--heading); flex: none; }
.mark-tile { width: 30px; height: 30px; background: none; border-radius: 0; }
.mark-tile img { width: 30px; height: 30px; }
nav#nav { display: flex; gap: 2px; flex: none; }
nav#nav a { padding: 9px 14px; border-radius: 999px; text-decoration: none; color: var(--text-2); font-weight: 500; white-space: nowrap; transition: color .15s ease, background-color .15s ease; }
nav#nav a:hover { color: var(--heading); }
nav#nav a.on { color: var(--heading); background: var(--card-2); box-shadow: inset 0 0 0 1px var(--line); }
.search.small { margin-left: auto; display: flex; align-items: center; gap: 8px; flex: 0 1 260px; min-width: 170px; height: 42px; padding: 0 14px; border-radius: 999px; background: var(--card); box-shadow: inset 0 0 0 1px var(--line); color: var(--text-2); }
.search.small input { box-shadow: none; padding: 0; min-height: 0; height: 100%; background: transparent; border-radius: 0; }
.modes { display: flex; padding: 3px; gap: 2px; background: var(--card); box-shadow: inset 0 0 0 1px var(--line); border-radius: 999px; flex: none; }
.modes button { background: transparent; box-shadow: none; min-height: 34px; padding: 4px 14px; color: var(--text-2); font-weight: 600; font-size: 13px; }
.modes button.on { background: var(--card-2); color: var(--heading); box-shadow: var(--raise); }
.modes button[data-mode="paper"].on { color: var(--warn); }
#account { display: flex; gap: 8px; align-items: center; flex: none; }
#account button { min-height: 42px; }
.bal { font: 500 13.5px/1 var(--mono); padding: 13px 16px; border-radius: 999px; text-decoration: none; background: var(--card); box-shadow: inset 0 0 0 1px var(--line); white-space: nowrap; color: var(--ink); }
#banner:not(:empty) { width: min(1320px, calc(100% - 24px)); margin: 12px auto 0; border-radius: 16px; background: var(--warn-soft); color: var(--warn); box-shadow: inset 0 0 0 1px rgba(255, 181, 71, 0.25); padding: 12px 18px; font-size: 13.5px; font-weight: 500; }

/* ---------- page ---------- */
main { max-width: 1320px; margin: 0 auto; padding: 40px clamp(14px, 2.4vw, 28px) 64px; }
h1 { margin: 0 0 8px; font: 600 clamp(34px, 4vw, 54px)/1.03 var(--sans); letter-spacing: -0.045em; color: var(--heading); text-wrap: balance; }
h1 em { font-style: normal; background: linear-gradient(100deg, #14f0b5 10%, #b4ffe8 90%); -webkit-background-clip: text; background-clip: text; color: transparent; }
h2 { margin: 0 0 10px; font: 600 19px/1.25 var(--sans); letter-spacing: -0.02em; color: var(--heading); }
h3 { margin: 0 0 14px; font: 600 16px/1.3 var(--sans); letter-spacing: -0.015em; color: var(--heading); }
.lead { margin: 0; color: var(--text-2); max-width: 640px; font-size: 16px; line-height: 1.6; }
.pill { display: inline-flex; gap: 8px; align-items: center; font-size: 13px; font-weight: 500; color: var(--text-2); background: var(--card); box-shadow: inset 0 0 0 1px var(--line); border-radius: 99px; padding: 6px 13px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--long-line); display: inline-block; box-shadow: 0 0 0 4px rgba(20, 240, 181, 0.15); }
.dot.off { background: var(--danger); box-shadow: 0 0 0 4px rgba(255, 92, 106, 0.15); }

.page-head, .hero { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; margin-bottom: 28px; flex-wrap: wrap; }
.searchbig { display: flex; align-items: center; gap: 8px; width: min(540px, 100%); padding: 5px 5px 5px 8px; border-radius: 999px; background: var(--card); box-shadow: inset 0 0 0 1px var(--line); }
.searchbig input { min-height: 46px; font-size: 15px; padding: 0 12px; background: transparent; box-shadow: none; }
.searchbig .primary { min-height: 46px; padding: 0 24px; white-space: nowrap; }

.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 20px; }
.tile { background: var(--card); box-shadow: inset 0 0 0 1px var(--line); border-radius: var(--r-card); padding: 20px 22px; min-width: 0; }
.tile .k { font-size: 13px; font-weight: 500; color: var(--text-2); }
.tile .v { font: 600 clamp(24px, 2.4vw, 32px)/1.1 var(--sans); font-variant-numeric: tabular-nums; letter-spacing: -0.04em; margin-top: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--heading); }
.tile .s { font-size: 12.5px; color: var(--text-2); margin-top: 4px; }

.grid2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; }
.grid3 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 390px); gap: 18px; align-items: start; }
.card { background: var(--card); box-shadow: inset 0 0 0 1px var(--line); border-radius: var(--r-card); padding: 22px; min-width: 0; }
.card + .card { margin-top: 14px; }
.grid2 > .card + .card, .grid3 > .card + .card, .grid3 > div + .card { margin-top: 0; }

table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12.5px; font-weight: 500; color: var(--text-2); padding: 8px 10px; border-bottom: 1px solid var(--line-2); white-space: nowrap; }
td { padding: 13px 10px; border-bottom: 1px solid var(--line-2); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--card); }
.coin { display: flex; gap: 10px; align-items: center; }
.coin b { font-weight: 600; color: var(--heading); }
.coin img, .coin .ph, .coin-id img, .coin-id .ph { width: 30px; height: 30px; border-radius: 10px; background: var(--card-2); object-fit: cover; flex: none; }
.coin .ph, .coin-id .ph { display: grid; place-items: center; font-size: 10.5px; font-weight: 700; color: var(--long); }
.tag { font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 99px; background: var(--card-2); color: var(--text-2); vertical-align: middle; white-space: nowrap; }
.tag.ok { background: var(--long-soft); color: var(--long); }
.tabs { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }

/* ---------- coin page ---------- */
.coinhead { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin-bottom: 22px; flex-wrap: wrap; }
.coin-id { display: flex; align-items: center; gap: 14px; }
.coin-id img, .coin-id .ph { width: 48px; height: 48px; border-radius: 15px; font-size: 13px; }
.coin-name { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.coin-name b { font-size: 24px; font-weight: 600; letter-spacing: -0.03em; color: var(--heading); }
.coin-name > span:not(.tag) { color: var(--text-2); font-size: 16px; }
.coin-sub { margin-top: 4px; color: var(--text-2); font-size: 13px; }
.coin-price { display: flex; align-items: baseline; gap: 14px; }
.coin-price .price { font: 600 clamp(36px, 4vw, 54px)/1 var(--sans); font-variant-numeric: tabular-nums; letter-spacing: -0.045em; color: var(--heading); }
.coin-price > span:last-child { font: 500 15px var(--mono); }
.chart-card { padding: 22px 22px 18px; }
canvas.chart { width: 100%; height: 360px; display: block; }
.chart-note { margin-top: 6px; font-size: 12.5px; color: var(--text-2); }
.cstats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line-2); }
.cstats .k { font-size: 12.5px; color: var(--text-2); }
.cstats .v { margin-top: 4px; font-size: 14.5px; font-weight: 500; color: var(--heading); }

.trade { padding: 22px; display: flex; flex-direction: column; gap: 6px; }
.trade label { display: block; font-size: 13px; font-weight: 600; margin: 10px 0 6px; color: var(--heading); }
.trade .row { display: flex; gap: 8px; align-items: center; }
.trade .row > * { flex: 1; min-width: 0; }
.side-seg { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border-radius: 999px; background: var(--card); box-shadow: inset 0 0 0 1px var(--line); }
.side-seg button { background: transparent; box-shadow: none; min-height: 44px; color: var(--text-2); font-weight: 700; font-size: 15px; }
.side-seg button.long.on { background: var(--long-soft); color: var(--long); box-shadow: inset 0 0 0 1px rgba(20, 240, 181, 0.35); }
.side-seg button.short.on { background: var(--short-soft); color: var(--short); box-shadow: inset 0 0 0 1px rgba(139, 108, 255, 0.45); }
.stake-box { display: flex; align-items: center; gap: 10px; height: 60px; padding: 0 18px; border-radius: 18px; background: var(--card); box-shadow: inset 0 0 0 1px var(--line-hi); transition: box-shadow .15s ease; }
.stake-box:focus-within { box-shadow: inset 0 0 0 1px rgba(20, 240, 181, 0.6); }
.stake-box input { box-shadow: none; background: transparent; padding: 0; min-height: 0; font: 600 26px var(--sans); font-variant-numeric: tabular-nums; letter-spacing: -0.03em; color: var(--heading); }
.stake-box span { color: var(--text-2); font-weight: 500; }
.quick { margin-top: 8px; }
.quick .chip { min-height: 32px; padding: 4px 0; font-size: 13px; }
#levs .chip { min-height: 42px; font-weight: 600; font-size: 14px; }
.summary { display: flex; flex-direction: column; gap: 9px; margin: 14px 0 6px; padding: 16px 18px; border-radius: 18px; background: rgba(237, 255, 254, 0.025); box-shadow: inset 0 0 0 1px var(--line-2); }
.kv { display: flex; justify-content: space-between; gap: 12px; font-size: 13.5px; padding: 0; }
.kv > span:first-child { color: var(--text-2); }
.big { width: 100%; min-height: 56px; font-size: 16px; font-weight: 700; border-radius: 999px; margin-top: 8px; }
.big.long, .big.long.on { background: var(--teal-grad); box-shadow: var(--teal-shadow); color: #00201b; }
.big.short, .big.short.on { background: var(--purple-grad); box-shadow: var(--purple-shadow); color: #fff; }
.why { margin-top: 10px; font-size: 12.5px; line-height: 1.5; color: var(--text-2); text-align: center; }

/* ---------- other pages ---------- */
.rounds { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; align-items: start; }
.rounds > .card + .card { margin-top: 0; }
.rules-pills { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.rules-pills b { color: var(--heading); font-weight: 600; }
.round { display: flex; flex-direction: column; gap: 0; }
.r-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.r-head .coin .ph { width: 38px; height: 38px; border-radius: 12px; font-size: 12px; }
.r-head .coin b { font-size: 17px; letter-spacing: -0.02em; }
.r-sub { font-size: 12.5px; margin-top: 1px; }
.r-move { font: 500 12.5px var(--mono); white-space: nowrap; }
.round .px { font: 600 36px/1 var(--sans); font-variant-numeric: tabular-nums; letter-spacing: -0.045em; margin: 20px 0 10px; color: var(--heading); min-height: 36px; }
.round .px.loading { font-size: 15px; font-weight: 500; letter-spacing: 0; color: var(--text-2); display: flex; align-items: center; gap: 10px; }
.round .px.loading::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--warn); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }
.spark { display: block; width: 100%; height: 56px; margin-bottom: 8px; }
.round label { display: block; font-size: 13px; font-weight: 600; margin: 10px 0 8px; color: var(--heading); }
.round .stake-box { height: 54px; }
.round .stake-box input { font-size: 22px; }
.round .row { display: flex; gap: 8px; }
.round .row > * { flex: 1; min-width: 0; }
.round .summary { margin: 14px 0 4px; }
.r-calls { margin-top: 8px; }
.r-calls .big { margin-top: 0; min-height: 52px; }
.r-lists { margin-top: 14px; }
.r-left { width: 130px; }
.r-left .bar { margin-top: 6px; }
.tag.bad { background: var(--short-soft); color: var(--short); }
.bar { height: 5px; background: var(--card-2); border-radius: 99px; overflow: hidden; margin-top: 6px; }
.bar > div { height: 100%; background: var(--long-line); border-radius: 99px; }
.rules dt { font-weight: 600; margin-top: 20px; color: var(--heading); }
.rules dd { margin: 6px 0 0; color: var(--text-2); line-height: 1.6; }
.steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin: 24px 0 32px; }
.steps .card p { line-height: 1.55; color: var(--text-2); }
.steps .n { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 11px; background: var(--teal-grad); box-shadow: var(--teal-shadow); font: 700 13px var(--sans); color: #00201b; margin-bottom: 14px; }

/* ---------- overlays ---------- */
#toast { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 40; }
#toast div { background: var(--surface); color: var(--ink); border-radius: 16px; padding: 13px 18px; max-width: 380px; font-size: 14px; box-shadow: inset 0 0 0 1px var(--line), 0 18px 40px -16px var(--shadow-deep); }
#toast div.err { background: var(--err-bg); color: var(--err-text); box-shadow: inset 0 0 0 1px rgba(255, 92, 106, 0.45), 0 18px 40px -16px var(--shadow-deep); }
#modal { position: fixed; inset: 0; background: var(--scrim); backdrop-filter: blur(6px); display: grid; place-items: center; z-index: 50; padding: 16px; }
#modal[hidden] { display: none; }
#modal .box { background: var(--surface); border-radius: 24px; padding: 26px; width: min(440px, 100%); box-shadow: inset 0 0 0 1px var(--line), 0 30px 70px -24px var(--shadow-deep); }
.share { background: radial-gradient(120% 90% at 50% 0%, rgba(20, 240, 181, 0.12), transparent 70%), var(--card); border-radius: 20px; padding: 28px; text-align: center; box-shadow: inset 0 0 0 1px var(--line); }
.share .roi { font: 600 60px/1 var(--sans); letter-spacing: -0.05em; color: var(--long); margin: 10px 0; }
.empty { color: var(--text-2); padding: 22px 8px; text-align: center; }
.scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.app-foot { max-width: 1320px; margin: 0 auto; padding: 22px clamp(14px, 2.4vw, 28px) 36px; display: flex; gap: 20px; flex-wrap: wrap; font-size: 13.5px; color: var(--text-2); border-top: 1px solid var(--line-2); }
.app-foot a { color: var(--text-2); text-decoration: none; font-weight: 500; }
.app-foot a:hover { color: var(--heading); }
.app-foot span { margin-left: auto; }

/* ---------- responsive ---------- */
/* the search gives way first, then the nav drops to its own row */
@media (max-width: 1340px) {
  .search.small { display: none; }
  .modes { margin-left: auto; }
}
/* the header has room for everything on one line only on wide screens; below that the nav
   drops to its own scrolling row */
@media (max-width: 1180px) {
  .top { flex-wrap: wrap; height: auto; padding: 10px 10px 0 16px; gap: 10px 12px; border-radius: 24px; }
  nav#nav { order: 5; width: calc(100% + 26px); margin: 0 -10px 0 -16px; padding: 0 10px 10px; overflow-x: auto; scrollbar-width: none; }
  nav#nav::-webkit-scrollbar { display: none; }
}
@media (max-width: 920px) {
  .grid2, .grid3, .rounds, .steps { grid-template-columns: minmax(0, 1fr); }
  .tiles, .cstats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid3 > .trade { order: -1; }
  main { padding-top: 26px; }
}
@media (max-width: 520px) {
  #appName { display: none; }
  /* logo, book switch and account share one row */
  .top { gap: 8px 4px; padding: 8px 8px 0 10px; }
  .modes button { padding: 4px 8px; font-size: 12px; min-height: 30px; }
  .top .theme-btn { width: 34px; height: 34px; min-height: 34px; }
  .top .theme-btn svg { width: 16px; height: 16px; }
  #account { gap: 5px; }
  #account button { min-height: 34px; padding: 6px 10px; font-size: 13px; }
  .bal { padding: 10px 7px; font-size: 10.5px; letter-spacing: -0.02em; }
  nav#nav { width: calc(100% + 20px); margin: 0 -8px 0 -12px; }
  .card, .trade { padding: 16px; }
  .tile { padding: 15px 16px; }
  .tile .v { font-size: clamp(18px, 5.4vw, 24px); }
  .searchbig { border-radius: 22px; flex-direction: column; align-items: stretch; padding: 6px; }
  .searchbig .primary { width: 100%; }
  canvas.chart { height: 240px; }
  .app-foot span { margin-left: 0; }
}
/* the narrowest phones: the balance stays on Portfolio and in every trade form */
@media (max-width: 370px) {
  .bal { display: none; }
}

/* big balance in the sans */
#pbal { font-family: var(--sans); font-weight: 600; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; color: var(--heading); }

/* theme switch (sun in dark, moon in light) */
.theme-btn { display: inline-grid; place-items: center; width: 42px; height: 42px; min-height: 42px; padding: 0; flex: none; }
.theme-btn svg { width: 18px; height: 18px; }
.theme-btn .i-moon, :root[data-theme="light"] .theme-btn .i-sun { display: none; }
:root[data-theme="light"] .theme-btn .i-moon { display: block; }
