/* =========================================================================
   Specter Wallet — desktop web app
   A wide, glass-panelled trading surface: fixed left rail, translucent top
   bar, centered workspace. Dark, periwinkle-lit, single visual world.
   No product's actual assets, icons, logos, or copy are used here.

   Trading-terminal pass: tighter hairline borders instead of heavy glass
   blur, IBM Plex Sans for UI text and IBM Plex Mono for every number
   (overrides theme.css's system --font, which the html/body rule already
   reads), real per-row data tables in place of plain icon rows. No feature,
   click target or piece of data changed — layout and type only.
   ========================================================================= */

:root{
  --bg:            #0b0c10;
  --bg-2:          #101218;
  --panel:         #14161d;
  --panel-2:       #191c24;
  --glass:         linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,.018));
  --glass-brd:     rgba(255,255,255,.13);
  --glass-shadow:  0 1px 0 rgba(255,255,255,.06) inset, 0 24px 60px -28px rgba(0,0,0,.7);
  --rail-w:        258px;
  --ws-max:        1120px;
  --glow:          0 0 0 1px rgba(171,159,242,.35), 0 0 44px -8px rgba(171,159,242,.55);
  --font:          'IBM Plex Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono:     'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, monospace;
}

html, body{ background: var(--bg); }
body{
  min-height: 100vh;
  background:
    radial-gradient(900px 520px at 12% -8%, rgba(171,159,242,.16), transparent 70%),
    radial-gradient(760px 480px at 100% 0%, rgba(108,92,231,.10), transparent 65%),
    var(--bg);
  background-attachment: fixed;
}

/* subtle film grain over everything */
body::before{
  content:""; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  opacity: .5; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.35'/%3E%3C/svg%3E");
}

/* =======================================================================
   SPLASH
   ======================================================================= */
@property --gw-hole{ syntax: "<percentage>"; inherits: false; initial-value: 0%; }
#gw-splash{
  position: fixed; inset: 0; z-index: 10000;
  display: grid; place-items: center;
  overflow: hidden;
  background: #08070d;
  --gw-hole: 0%;
  -webkit-mask: radial-gradient(circle at 50% 46%, transparent var(--gw-hole), #000 calc(var(--gw-hole) + .5%));
          mask: radial-gradient(circle at 50% 46%, transparent var(--gw-hole), #000 calc(var(--gw-hole) + .5%));
}
/* exit: an iris opens from the centre onto the app */
#gw-splash.out{
  --gw-hole: 160%;
  pointer-events: none;
  transition: --gw-hole .85s cubic-bezier(.75,0,.2,1), opacity .25s ease .7s;
  opacity: 0;
}
.gw-splash-aurora{
  position: absolute; width: 150vmax; height: 150vmax; left: 50%; top: 46%;
  margin: -75vmax 0 0 -75vmax; border-radius: 50%;
  background: conic-gradient(from 0deg, #6c5ce7, #ab9ff2, #2a1f6e, #8a7ff0, #c8bffb, #3b2d9a, #6c5ce7);
  filter: blur(70px);
  opacity: 0; transform: scale(.4);
  transition: opacity .9s ease, transform 1.4s cubic-bezier(.16,1,.3,1);
  animation: gw-spin 7s linear infinite;
}
#gw-splash.in .gw-splash-aurora{ opacity: .38; transform: scale(1); }
#gw-splash.land .gw-splash-aurora{ opacity: .5; }
@keyframes gw-spin{ to{ rotate: 360deg; } }
.gw-splash-grid{
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(171,159,242,.09) 1px, transparent 1px),
    linear-gradient(90deg, rgba(171,159,242,.09) 1px, transparent 1px);
  background-size: 34px 34px; background-position: center;
  -webkit-mask: radial-gradient(circle at 50% 46%, #000 0, transparent 55%);
          mask: radial-gradient(circle at 50% 46%, #000 0, transparent 55%);
  opacity: 0; transform: scale(1.15);
  transition: opacity 1s ease .1s, transform 1.6s cubic-bezier(.16,1,.3,1);
}
#gw-splash.in .gw-splash-grid{ opacity: 1; transform: scale(1); }
.gw-splash-ring{
  position: absolute; left: 50%; top: 46%;
  width: 180px; height: 180px; margin: -90px 0 0 -90px; border-radius: 50%;
  border: 1.5px solid rgba(200,191,251,.85);
  box-shadow: 0 0 24px rgba(171,159,242,.55), inset 0 0 24px rgba(171,159,242,.35);
  opacity: 0; transform: scale(.35);
}
#gw-splash.land .gw-splash-ring{ animation: gw-ring 1s cubic-bezier(.1,.7,.3,1) forwards; }
#gw-splash.land .gw-splash-ring.r2{ animation-delay: .14s; }
@keyframes gw-ring{
  0%  { opacity: .95; transform: scale(.35); }
  100%{ opacity: 0;   transform: scale(4.2); }
}
.gw-splash-stack{
  position: relative; z-index: 1;
  display: flex; flex-direction: column; align-items: center; gap: 22px;
  margin-top: -8vh;
}
.gw-splash-mark{
  position: relative; width: 92px; height: 92px;
  clip-path: inset(100% 0 0 0);
  transform: translateY(14px) scale(.92);
  transition: clip-path .7s cubic-bezier(.65,0,.35,1) .15s, transform .8s cubic-bezier(.16,1.4,.4,1) .15s;
}
#gw-splash.in .gw-splash-mark{ clip-path: inset(0 0 0 0); transform: none; }
.gw-splash-mark svg{
  display: block;
  filter: drop-shadow(0 0 18px rgba(171,159,242,.75)) drop-shadow(0 10px 28px rgba(20,10,70,.8));
}
#gw-splash.land .gw-splash-mark svg{ animation: gw-pulse .5s ease-out; }
@keyframes gw-pulse{
  0%  { transform: scale(1); }
  35% { transform: scale(1.12); filter: drop-shadow(0 0 34px rgba(200,191,251,1)) drop-shadow(0 10px 28px rgba(20,10,70,.8)); }
  100%{ transform: scale(1); }
}
/* bright scan line that sweeps up as the ghost materialises */
.gw-splash-scan{
  position: absolute; left: -12%; right: -12%; height: 3px; bottom: 0;
  background: linear-gradient(90deg, transparent, #fff 30%, #fff 70%, transparent);
  box-shadow: 0 0 14px 3px rgba(200,191,251,.9);
  border-radius: 3px; opacity: 0;
}
#gw-splash.in .gw-splash-scan{ animation: gw-scan .7s cubic-bezier(.65,0,.35,1) .15s forwards; }
@keyframes gw-scan{
  0%  { bottom: 0;    opacity: 1; }
  90% { opacity: 1; }
  100%{ bottom: 100%; opacity: 0; }
}
.gw-splash-word{
  display: flex; gap: .34em;
  font-size: 15px; font-weight: 600; letter-spacing: 0; color: #e9e5ff;
  text-shadow: 0 0 16px rgba(171,159,242,.7);
}
.gw-splash-word span{
  display: inline-block; opacity: 0; filter: blur(8px); transform: translateY(8px);
  transition: opacity .45s ease, filter .45s ease, transform .55s cubic-bezier(.16,1,.3,1);
}
#gw-splash.in .gw-splash-word span{ opacity: 1; filter: blur(0); transform: none; }
/* exit: the ghost rushes the camera as the iris opens */
#gw-splash.out .gw-splash-mark{
  transform: scale(7); opacity: 0;
  transition: transform .8s cubic-bezier(.7,0,.3,1), opacity .5s ease .25s;
}
#gw-splash.out .gw-splash-word span{ opacity: 0; transform: translateY(-6px); transition-delay: 0s !important; transition-duration: .25s; }
#gw-splash.out .gw-splash-ring{ animation: none; opacity: 0; }

/* =======================================================================
   SHELL
   ======================================================================= */
#screen-app{
  position: relative; z-index: 1;
  display: grid;
  grid-template-columns: var(--rail-w) 1fr;
  min-height: 100vh;
}

/* ---------- left rail ---------- */
.rail{
  position: sticky; top: 0; align-self: start;
  height: 100vh;
  display: flex; flex-direction: column;
  gap: 6px;
  padding: 20px 16px 16px;
  background: linear-gradient(180deg, #101118, #0b0c11 70%);
  border-right: 1px solid rgba(255,255,255,.06);
}
.rail-brand{
  display: flex; align-items: center; gap: 11px;
  padding: 6px 8px 18px;
}
.rail-mark{
  position: relative;
  width: 38px; height: 38px; border-radius: 12px;
  display: grid; place-items: center;
  background: linear-gradient(155deg, var(--accent) 0%, #6c5ce7 100%);
  box-shadow: var(--glow);
  flex-shrink: 0;
}
.rail-mark svg{ width: 22px; height: 22px; }
.rail-mark::after{
  content:""; position: absolute; inset: -10px; border-radius: 20px;
  background: radial-gradient(circle, rgba(171,159,242,.45), transparent 70%);
  z-index: -1; filter: blur(6px);
}
.rail-name{ font-weight: 800; font-size: 16px; letter-spacing: -0.01em; }
.rail-name b{ color: var(--accent); font-weight: 800; }

.nav{ display: flex; flex-direction: column; gap: 3px; }
.nav-sep{ height: 1px; background: rgba(255,255,255,.06); margin: 10px 8px; }
.nav-link{
  display: flex; align-items: center; gap: 12px;
  padding: 11px 12px; border-radius: 11px;
  font-size: 14.5px; font-weight: 600; color: var(--text-dim);
  text-align: left; width: 100%;
  transition: background .14s ease, color .14s ease;
}
.nav-link .ni{ width: 20px; height: 20px; flex-shrink: 0; opacity: .85; }
.nav-link:hover{ background: rgba(255,255,255,.04); color: var(--text); }
.nav-link.on{
  background: var(--accent-soft); color: #efeaff;
  box-shadow: inset 3px 0 0 var(--accent), 0 0 26px -10px rgba(171,159,242,.6);
}
.nav-link.on .ni{ opacity: 1; }

.rail-foot{ margin-top: auto; display: flex; flex-direction: column; gap: 8px; padding-top: 12px; }
.rail-acct{
  display: flex; align-items: center; gap: 10px;
  padding: 10px 11px; border-radius: 12px;
  background: var(--glass); border: 1px solid var(--glass-brd);
  font-weight: 700; font-size: 13.5px; width: 100%; text-align: left;
}
.rail-acct .chev{ margin-left: auto; }
.rail-disc{ font-size: 10.5px; color: var(--text-faint); line-height: 1.5; padding: 0 4px; }

/* ---------- top bar ---------- */
.topbar{
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 14px;
  height: 66px; padding: 0 30px;
  background: rgba(11,12,16,.72);
  backdrop-filter: blur(18px) saturate(1.3);
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.tb-title{ font-size: 17px; font-weight: 700; letter-spacing: -0.01em; }
.tb-spacer{ flex: 1; }
.tb-search{
  display: flex; align-items: center; gap: 9px;
  width: 260px; max-width: 30vw;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 10px; padding: 9px 12px;
  color: var(--text-faint); font-size: 13.5px;
}
.tb-search:focus-within{ border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.tb-search input{ flex: 1; background: none; border: none; color: var(--text); font-size: 13.5px; }
.tb-search input::placeholder{ color: var(--text-faint); }
.tb-btn{
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 15px; border-radius: 10px;
  font-size: 13.5px; font-weight: 700;
  background: var(--panel); border: 1px solid var(--border); color: var(--text);
}
.tb-btn:hover{ border-color: var(--border-2); background: var(--panel-2); }
.tb-btn.accent{ background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.tb-btn.accent:hover{ background: var(--accent-2); box-shadow: var(--glow); }
.tb-acct{
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px 6px 6px; border-radius: 999px;
  background: var(--panel); border: 1px solid var(--border);
  font-weight: 700; font-size: 13px;
}
.tb-acct:hover{ border-color: var(--border-2); }
.tb-acct .acct-avatar{ width: 24px; height: 24px; }

/* ---------- workspace ---------- */
.workspace{ min-width: 0; overflow: visible; }
.view{ display: none; }
.view.active{
  display: block;
  max-width: var(--ws-max);
  margin: 0 auto;
  padding: 30px 34px 60px;
  animation: viewIn .28s ease backwards;   /* not 'both': a lingering transform would trap position:fixed children */
}
@keyframes viewIn{ from{ opacity: 0; transform: translateY(6px); } to{ opacity: 1; transform: none; } }
#view-chats.active{ display: none; }
#view-chats.active{ display: flex; flex-direction: column; height: calc(100vh - 66px); }

/* =======================================================================
   GLASS PRIMITIVE + shared bits
   ======================================================================= */
.glass, .pw-tok-row, .pw-card, .pw-cash-row, .pw-shortcut, .pw-stub,
.pm-card, .swap-card, .td-balance, .pf-stats > div, .promo{
  background: var(--glass);
  border: 1px solid var(--glass-brd);
  box-shadow: var(--glass-shadow);
  backdrop-filter: blur(14px);
}
.glow{ box-shadow: var(--glow); }

.mono{ font-variant-numeric: tabular-nums; font-family: var(--font-mono); }

/* section headings */
.pw-sec-head{
  display: flex; align-items: center; gap: 8px;
  margin: 30px 2px 14px; font-size: 15px; font-weight: 800;
  letter-spacing: .04em; text-transform: uppercase; color: var(--text-dim);
}
.pw-sec-head .arw{ color: var(--text-faint); font-size: 14px; }
.pw-sec-head.tap{ cursor: pointer; }
.pw-sec-head.tap:hover{ color: var(--text); }
.section-label{
  font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
  color: var(--text-faint); margin: 24px 0 10px;
}

/* =======================================================================
   HOME — dashboard
   ======================================================================= */
.home-grid{
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 22px;
  align-items: start;
}
@media (max-width: 940px){ .home-grid{ grid-template-columns: 1fr; } }

.balance-card{
  position: relative; overflow: hidden;
  background: var(--glass); border: 1px solid var(--glass-brd);
  box-shadow: var(--glass-shadow);
  border-radius: 22px; padding: 26px 26px 24px;
}
.balance-card::after{
  content:""; position: absolute; right: -60px; top: -80px;
  width: 260px; height: 260px; border-radius: 50%;
  background: radial-gradient(circle, rgba(171,159,242,.28), transparent 70%);
  pointer-events: none;
}
.bc-label{ font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--text-faint); }
.bc-value{ font-size: 46px; font-weight: 800; letter-spacing: -0.02em; margin: 8px 0 6px; }
.bc-change{ display: inline-flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 700; }
.bc-change .abs{ color: var(--green); }
.bc-change .abs.neg{ color: var(--red); }
.bc-change .pct{ background: var(--green-soft); color: var(--green); padding: 3px 10px; border-radius: 999px; font-size: 13px; }
.bc-change .pct.neg{ background: var(--red-soft); color: var(--red); }
.bc-actions{ display: flex; gap: 10px; margin-top: 22px; }
.bc-actions .btn{ flex: 1; padding: 13px 10px; font-size: 14px; }

.pw-cash-row{
  display: flex; align-items: center; gap: 13px;
  border-radius: 16px; padding: 15px 18px; margin-top: 14px; cursor: pointer;
}
.pw-cash-row:hover{ border-color: var(--accent); }
.pw-cash-row .ic{
  width: 34px; height: 34px; border-radius: 10px; font-size: 15px;
  background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center;
}
.pw-cash-row .lbl{ font-weight: 700; font-size: 14.5px; flex: 1; }
.pw-cash-row .val{ font-weight: 800; font-size: 15px; }
.cash-req{ margin-left: 16px; }
.cash-req:disabled{ opacity: .4; cursor: not-allowed; }

.pw-tok-row{
  display: flex; align-items: center; gap: 14px;
  padding: 11px 14px; cursor: pointer;
  border-bottom: 1px solid var(--glass-brd);
  transition: background .12s ease;
}
.pw-tok-row:last-child{ border-bottom-color: transparent; }
.pw-tok-row:hover{ background: var(--glass); }
.pw-tok-row .row-main{ flex: 1; min-width: 0; }
.pw-tok-row .row-title{ font-weight: 700; font-size: 14.5px; }
.pw-tok-row .row-sub{ color: var(--text-dim); font-size: 12px; margin-top: 2px; }
.pw-tok-row .row-end{ text-align: right; }
.pw-tok-row .row-price{ font-weight: 700; font-size: 14.5px; }
.pw-tok-row .row-chg{ font-size: 12px; margin-top: 2px; }

.pw-hscroll{ display: flex; flex-wrap: wrap; gap: 12px; }
.pw-card{
  flex: 1 1 150px; min-width: 150px;
  border-radius: 16px; padding: 15px; cursor: pointer;
  transition: transform .12s ease, border-color .12s ease;
}
.pw-card:hover{ transform: translateY(-2px); border-color: rgba(171,159,242,.4); }
.pw-card .cm-top{ display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.pw-card .cm-name{ font-weight: 700; font-size: 13.5px; }
.pw-card .cm-lev{ font-size: 10px; font-weight: 800; background: var(--surface-3); padding: 2px 6px; border-radius: 5px; color: var(--text-dim); }
.pw-card .cm-chg{ font-size: 13px; font-weight: 800; margin-top: 4px; }
.pw-card .cm-px{ font-size: 12.5px; font-weight: 600; color: var(--text-dim); }

.pw-shortcut{
  display: flex; align-items: center; gap: 14px;
  border-radius: 14px; padding: 15px; margin-bottom: 8px; cursor: pointer;
}
.pw-shortcut:hover{ border-color: var(--accent); }
.pw-shortcut .ic{ font-size: 19px; width: 26px; text-align: center; color: var(--accent); }
.pw-shortcut .t{ font-weight: 700; font-size: 14px; }
.pw-shortcut .d{ color: var(--text-dim); font-size: 12px; margin-top: 2px; }

.pw-support{ display: flex; flex-direction: column; gap: 2px; }
.pw-support button{
  display: flex; align-items: center; gap: 6px;
  font-size: 14px; font-weight: 700; text-align: left; padding: 11px 2px; color: var(--text);
}
.pw-support button .arw{ color: var(--text-faint); font-size: 12px; }
.pw-disclosure{ color: var(--text-faint); font-size: 12px; margin: 24px 2px 0; display: flex; gap: 6px; }
.pw-stub{ border-radius: 14px; padding: 20px; color: var(--text-dim); font-size: 13px; line-height: 1.6; }
.pw-stub b{ color: var(--text); }

.promo{ position: relative; border-radius: 16px; padding: 15px 40px 15px 15px; margin-bottom: 12px; display: flex; align-items: center; gap: 13px; }
.promo .p-icon{ width: 40px; height: 40px; border-radius: 12px; background: linear-gradient(150deg, var(--accent), #6c5ce7); display: grid; place-items: center; font-size: 20px; flex-shrink: 0; }
.promo .p-text{ font-size: 13px; line-height: 1.45; color: var(--text-dim); }
.promo .p-close{ position: absolute; top: 10px; right: 10px; width: 24px; height: 24px; border-radius: 50%; background: var(--surface-3); color: var(--text-dim); display: grid; place-items: center; font-size: 13px; }
.promo-dots{ display: flex; gap: 5px; justify-content: center; margin: 10px 0 4px; }
.promo-dots i{ width: 6px; height: 6px; border-radius: 50%; background: var(--surface-3); }
.promo-dots i.on{ background: var(--accent); width: 16px; border-radius: 999px; }

/* =======================================================================
   LISTS / ROWS  (markets, explore, watchlist, picker)
   ======================================================================= */
.list-head{ display: flex; align-items: baseline; justify-content: space-between; margin: 8px 2px 14px; }
.list-head h2{ font-size: 22px; margin: 0; letter-spacing: -0.01em; }
.list-head .link{ color: var(--accent); font-size: 13px; font-weight: 700; }

/* table-style header labels above a .row list (Markets, Explore, Watchlist) —
   purely a label strip, the rows beneath are unchanged in function */
.list-table-head{
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 14px 8px; margin-top: 2px;
  font-size: 10px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  color: var(--text-faint);
}

.row{
  display: flex; align-items: center; gap: 14px;
  padding: 11px 14px; cursor: pointer;
  border: 1px solid transparent; border-bottom: 1px solid var(--glass-brd);
  transition: background .12s ease, border-color .12s ease;
}
.row:last-child{ border-bottom-color: transparent; }
.row:hover{ background: var(--glass); border-color: var(--glass-brd); }
.row-main{ flex: 1; min-width: 0; }
.row-title{ font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-sub{ color: var(--text-dim); font-size: 12px; margin-top: 2px; }
.row-spark{ width: 96px; height: 40px; flex-shrink: 0; opacity: .9; }
.row-end{ text-align: right; flex-shrink: 0; }
.row-price{ font-weight: 700; font-size: 13.5px; }
.row-chg{ font-size: 12px; margin-top: 2px; }

.pick-search{
  width: 100%; background: var(--panel); border: 1px solid var(--border-2);
  border-radius: 10px; padding: 11px 14px; color: var(--text); font-size: 14px; margin-bottom: 12px;
}
.pick-search:focus{ border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
#mkt-list, #tokenpick-list{ display: flex; flex-direction: column; gap: 2px; }

/* =======================================================================
   TOKEN DETAIL
   ======================================================================= */
.td-head{ display: flex; align-items: center; gap: 12px; padding: 0 0 8px; }
.td-head .back{
  font-size: 16px; color: var(--text-dim); width: 34px; height: 34px; border-radius: 10px;
  background: var(--panel); border: 1px solid var(--border); display: grid; place-items: center;
}
.td-head .back:hover{ color: var(--text); border-color: var(--border-2); }
.td-head .name{ font-weight: 800; font-size: 20px; flex: 1; letter-spacing: -0.01em; }
.td-head .star{ font-size: 18px; color: var(--text-faint); }
.td-head .star.on{ color: #f5c518; }

.td-price{ font-size: 40px; font-weight: 800; letter-spacing: -0.02em; margin-top: 6px; }
.td-sub{ margin-top: 6px; font-size: 14px; font-weight: 700; }

.chart-wrap{
  margin: 20px 0 8px; padding: 18px;
  background: var(--glass); border: 1px solid var(--glass-brd);
  box-shadow: var(--glass-shadow); border-radius: 18px;
}
.chart-canvas{ width: 100%; height: 300px; display: block; }
.timeframes{ display: flex; gap: 6px; margin-top: 14px; }
.timeframes button{
  flex: 1; padding: 8px 0; border-radius: 9px; font-size: 12px; font-weight: 700;
  color: var(--text-dim); background: transparent;
}
.timeframes button:hover{ color: var(--text); background: rgba(255,255,255,.04); }
.timeframes button.on{ background: var(--accent-soft); color: var(--accent); }

.td-balance{ border-radius: 16px; padding: 18px; margin: 16px 0; display: flex; align-items: center; justify-content: space-between; }
.td-balance .lbl{ font-size: 12px; color: var(--text-dim); }
.td-balance .val{ font-size: 18px; font-weight: 800; margin-top: 3px; }
.td-balance .qty{ font-size: 12.5px; color: var(--text-dim); text-align: right; }

.td-actions{ display: flex; gap: 12px; margin: 18px 0; flex-wrap: wrap; }
.td-actions .btn{ flex: 1; min-width: 96px; max-width: 220px; }

.stat-grid{
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px;
  background: var(--glass-brd); border: 1px solid var(--glass-brd);
  border-radius: 16px; overflow: hidden;
}
@media (max-width: 720px){ .stat-grid{ grid-template-columns: repeat(2, 1fr); } }
.stat-grid .cell{ background: var(--panel); padding: 16px; }
.stat-grid .k{ font-size: 11px; color: var(--text-faint); }
.stat-grid .v{ font-size: 15px; font-weight: 700; margin-top: 4px; }

/* =======================================================================
   SWAP  — Phantom-style routed swap
   ======================================================================= */
#view-swap.active{ max-width: 520px; }
.swap-head{ position: relative; display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.swap-head h2{ font-size: 24px; margin: 0; letter-spacing: -0.01em; }
.swap-gear{
  width: 36px; height: 36px; border-radius: 10px;
  background: var(--panel); border: 1px solid var(--border);
  display: grid; place-items: center; font-size: 15px; color: var(--text-dim); position: relative;
}
.swap-gear:hover{ color: var(--text); }

.slip-pop{
  position: absolute; right: 0; top: 46px; z-index: 25;
  width: 260px; padding: 14px;
  background: var(--panel-2); border: 1px solid var(--border-2);
  border-radius: 14px; box-shadow: 0 24px 60px -20px rgba(0,0,0,.8);
}
.slip-pop h4{ margin: 0 0 4px; font-size: 13px; }
.slip-pop p{ margin: 0 0 10px; font-size: 11.5px; color: var(--text-faint); line-height: 1.5; }
.slip-opts{ display: flex; gap: 6px; }
.slip-opts button{
  flex: 1; padding: 8px 0; border-radius: 9px; font-size: 12px; font-weight: 700;
  background: var(--surface-2); color: var(--text-dim);
}
.slip-opts button.on{ background: var(--accent); color: var(--accent-ink); }
.slip-opts input{
  width: 66px; background: var(--surface); border: 1px solid var(--border-2);
  color: var(--text); border-radius: 9px; padding: 8px; font-size: 12px; text-align: center;
}

.swap-card{ border-radius: 20px; padding: 8px; position: relative; margin: 4px 0 16px; }
.swap-leg{ padding: 18px; border-radius: 15px; }
.swap-leg.to{ margin-top: 6px; background: rgba(255,255,255,.02); }
.swap-leg .leg-top{ display: flex; justify-content: space-between; font-size: 12px; color: var(--text-dim); margin-bottom: 12px; }
.swap-leg .leg-top .link{ color: var(--accent); font-weight: 700; cursor: pointer; }
.swap-leg .leg-body{ display: flex; align-items: center; gap: 12px; }
.swap-token-btn{
  display: flex; align-items: center; gap: 8px; flex-shrink: 0;
  background: var(--surface-2); border: 1px solid var(--border-2);
  border-radius: 999px; padding: 7px 14px 7px 7px; font-weight: 800; font-size: 14px;
}
.swap-token-btn:hover{ border-color: var(--accent); }
.swap-amount{
  flex: 1; width: 100%; background: transparent; border: none; color: var(--text);
  font-size: 27px; font-weight: 800; text-align: right; padding: 0; letter-spacing: -0.01em;
}
.swap-amount::placeholder{ color: var(--text-faint); }
.swap-amount:focus{ box-shadow: none; }
.leg-fiat{ text-align: right; font-size: 11.5px; color: var(--text-faint); margin-top: 6px; }
.swap-flip{
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 40px; height: 40px; border-radius: 13px;
  background: var(--panel-2); border: 4px solid var(--panel);
  display: grid; place-items: center; font-size: 15px; z-index: 2; color: var(--accent);
  transition: transform .18s ease;
}
.swap-flip:hover{ transform: translate(-50%, -50%) rotate(180deg); }

.swap-route{
  display: flex; align-items: center; gap: 8px;
  padding: 12px 14px; margin-bottom: 10px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 13px;
  font-size: 12px; color: var(--text-dim); overflow-x: auto;
}
.swap-route .rk{ font-weight: 800; letter-spacing: .06em; text-transform: uppercase; font-size: 10px; color: var(--text-faint); flex-shrink: 0; }
.route-hop{ display: inline-flex; align-items: center; gap: 6px; font-weight: 700; color: var(--text); flex-shrink: 0; }
.route-hop .coin-icon{ width: 20px; height: 20px; }
.route-arrow{ color: var(--accent); flex-shrink: 0; }
.route-venue{
  flex-shrink: 0; font-size: 10.5px; font-weight: 700; color: var(--accent);
  background: var(--accent-soft); padding: 2px 8px; border-radius: 999px;
}

.swap-meta{ display: flex; justify-content: space-between; font-size: 12.5px; color: var(--text-dim); padding: 7px 4px; }
.swap-meta + .swap-meta{ border-top: 1px solid var(--border); }
.swap-meta .mono.warn{ color: #f5c518; }
.swap-meta .mono.bad{ color: var(--red); }
.swap-metas{ background: var(--panel); border: 1px solid var(--border); border-radius: 13px; padding: 6px 10px; margin-bottom: 16px; }

/* signing overlay */
.sign-anim{
  display: flex; flex-direction: column; align-items: center; gap: 16px;
  padding: 20px 0 8px; text-align: center;
}
.sign-orb{
  width: 78px; height: 78px; border-radius: 50%;
  background: conic-gradient(from 0deg, var(--accent), #6c5ce7, var(--accent));
  -webkit-mask: radial-gradient(circle 30px at center, transparent 98%, #000);
          mask: radial-gradient(circle 30px at center, transparent 98%, #000);
  animation: sign-spin .9s linear infinite;
}
@keyframes sign-spin{ to{ transform: rotate(360deg); } }
.sign-anim.ok .sign-orb{ animation: none; background: var(--green); -webkit-mask: none; mask: none; display: grid; place-items: center; }
.sign-anim .sign-msg{ font-size: 14px; font-weight: 700; }
.sign-anim .sign-sub{ font-size: 12px; color: var(--text-faint); }

/* =======================================================================
   PERPS
   ======================================================================= */
#view-perps.active{ max-width: 640px; }
.perp-head{ display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 6px; }
.perp-head h2{ font-size: 24px; margin: 0; letter-spacing: -0.01em; }
.perp-eq{ font-size: 12.5px; color: var(--text-dim); }
.perp-intro{ color: var(--text-dim); font-size: 12.5px; line-height: 1.6; margin: 0 0 16px; max-width: 60ch; }

.perp-ticket{ border-radius: 18px; padding: 18px; margin-bottom: 20px; }
.perp-mkts{ display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.perp-mkt{
  display: flex; align-items: center; gap: 7px;
  padding: 7px 13px 7px 8px; border-radius: 999px;
  background: var(--panel); border: 1px solid var(--border);
  font-weight: 700; font-size: 13px; color: var(--text-dim);
}
.perp-mkt:hover{ border-color: var(--border-2); }
.perp-mkt.on{ border-color: var(--accent); color: var(--text); }

.perp-side-tog{ display: flex; gap: 8px; margin-bottom: 16px; }
.perp-side-tog button{
  flex: 1; padding: 11px 0; border-radius: 11px; font-size: 14px; font-weight: 800;
  background: var(--panel); border: 1px solid var(--border); color: var(--text-dim);
}
.perp-side-tog button.on.long{ background: var(--green-soft); color: var(--green); border-color: transparent; }
.perp-side-tog button.on.short{ background: var(--red-soft); color: var(--red); border-color: transparent; }

.perp-lbl{
  display: block; font-size: 11px; font-weight: 800; letter-spacing: .05em;
  text-transform: uppercase; color: var(--text-faint); margin: 0 0 8px;
}
.perp-margin{ margin-bottom: 16px; }
.perp-margin input{
  width: 100%; background: var(--panel); border: 1px solid var(--border-2); color: var(--text);
  border-radius: 12px; padding: 13px 15px; font-size: 20px; font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.perp-margin input:focus{ border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.perp-chips{ display: flex; gap: 8px; margin-top: 8px; }
.perp-chips button{
  flex: 1; padding: 8px 0; border-radius: 9px; font-size: 12px; font-weight: 700;
  background: var(--panel); border: 1px solid var(--border); color: var(--text-dim);
}
.perp-chips button:hover{ border-color: var(--accent); }
.perp-levs{ display: flex; gap: 8px; margin-bottom: 16px; }
.perp-levs button{
  flex: 1; padding: 10px 0; border-radius: 10px; font-size: 13px; font-weight: 800;
  background: var(--panel); border: 1px solid var(--border); color: var(--text-dim);
}
.perp-levs button.on{ background: var(--accent); color: var(--accent-ink); border-color: transparent; }

.perp-metas{ background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 4px 12px; margin-bottom: 16px; }
.perp-metas > div{ display: flex; justify-content: space-between; padding: 8px 0; font-size: 12.5px; color: var(--text-dim); }
.perp-metas > div + div{ border-top: 1px solid var(--border); }

.perp-pos{
  background: var(--glass); border: 1px solid var(--glass-brd); box-shadow: var(--glass-shadow);
  border-radius: 16px; padding: 16px; margin-bottom: 12px;
}
.pp-top{ display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.pp-top b{ font-size: 14px; }
.pp-side{ font-size: 10px; font-weight: 800; letter-spacing: .04em; padding: 2px 7px; border-radius: 6px; }
.pp-side.long{ background: var(--green-soft); color: var(--green); }
.pp-side.short{ background: var(--red-soft); color: var(--red); }
.pp-pnl{ margin-left: auto; font-size: 14px; font-weight: 800; }
.pp-grid{ display: grid; grid-template-columns: 1fr 1fr; gap: 8px 18px; font-size: 12.5px; margin-bottom: 12px; }
.pp-grid > div{ display: flex; justify-content: space-between; }
.pp-grid span{ color: var(--text-faint); }
.pp-liqbar{ height: 5px; border-radius: 3px; background: var(--panel); overflow: hidden; margin-bottom: 12px; }
.pp-liqbar > div{ height: 100%; background: linear-gradient(90deg, var(--green), #f5c518 60%, var(--red)); }
.pp-liq{ font-size: 9px; font-weight: 800; letter-spacing: .05em; background: var(--red-soft); color: var(--red); padding: 1px 6px; border-radius: 4px; }
.perp-hist .feed-row{
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 11px 4px; border-bottom: 1px solid var(--border); font-size: 12.5px;
}
.perp-hist .feed-row:last-child{ border-bottom: none; }

/* =======================================================================
   SEND / RECEIVE
   ======================================================================= */
#view-send.active, #view-receive.active{ max-width: 460px; }
.big-input{
  background: transparent; border: none; color: var(--text);
  font-size: 44px; font-weight: 800; text-align: center; width: 100%;
  letter-spacing: -0.02em; margin: 12px 0;
}
.big-input:focus{ box-shadow: none; }
.asset-select{
  display: flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 999px; padding: 8px 16px; font-weight: 800; margin: 0 auto 8px; width: fit-content; cursor: pointer;
}
.asset-select:hover{ border-color: var(--accent); }
.qr-box{
  width: 220px; height: 220px; background: #fff; border-radius: 20px;
  margin: 12px auto 18px; padding: 14px; display: grid; place-items: center;
  box-shadow: var(--glow);
}
.qr-box canvas{ width: 100%; height: 100%; image-rendering: pixelated; }
.addr-box{
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
  padding: 14px 16px; font-size: 13px; word-break: break-all; text-align: center;
  color: var(--text-dim); line-height: 1.6;
}
.review-line{ display: flex; justify-content: space-between; padding: 13px 2px; font-size: 14px; border-bottom: 1px solid var(--border); }
.review-line:last-child{ border-bottom: none; }
.review-line .k{ color: var(--text-dim); }
.review-line .v{ font-weight: 700; text-align: right; max-width: 60%; word-break: break-all; }

/* =======================================================================
   ACTIVITY
   ======================================================================= */
.act-day{ font-size: 11px; font-weight: 800; color: var(--text-faint); margin: 22px 4px 8px; text-transform: uppercase; letter-spacing: .06em; }
.act-row{
  display: flex; align-items: center; gap: 14px; padding: 13px 14px; border-radius: 12px;
}
.act-row:hover{ background: var(--glass); }
.act-ic{
  width: 40px; height: 40px; border-radius: 12px; flex-shrink: 0;
  background: var(--panel); border: 1px solid var(--border);
  display: grid; place-items: center; font-size: 16px;
}
.act-row .row-main .row-title{ white-space: normal; font-weight: 700; }

/* =======================================================================
   SETTINGS / PROFILE
   ======================================================================= */
.set-row{
  display: flex; align-items: center; gap: 12px; padding: 15px 8px;
  border-bottom: 1px solid var(--border); font-size: 14px; cursor: pointer;
}
.set-row:hover{ background: var(--glass); }
.set-row .s-ic{ font-size: 16px; width: 22px; text-align: center; }
.set-row .s-val{ margin-left: auto; color: var(--text-dim); font-size: 13px; }
.divider{ height: 1px; background: var(--border); border: none; margin: 20px 0; }

.pf-card{ display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 20px 0 8px; }
.pf-avatar{
  width: 68px; height: 68px; border-radius: 22px;
  background: linear-gradient(160deg, var(--accent), #6c5ce7);
  display: grid; place-items: center; font-size: 27px; font-weight: 800; color: #fff; margin-bottom: 6px;
  box-shadow: var(--glow);
}
.pf-name{ font-size: 19px; font-weight: 800; }
.pf-email{ font-size: 12.5px; color: var(--text-faint); }
.pf-stats{ display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 18px 0 22px; }
@media (max-width: 720px){ .pf-stats{ grid-template-columns: repeat(2, 1fr); } }
.pf-stats > div{ border-radius: 14px; padding: 14px; }
.pf-stats .k{ font-size: 11px; color: var(--text-faint); }
.pf-stats .v{ font-size: 17px; font-weight: 800; margin-top: 3px; }

/* =======================================================================
   PREDICT
   ======================================================================= */
.pm-intro{ color: var(--text-dim); font-size: 13px; line-height: 1.6; margin: 4px 0 16px; max-width: 620px; }
.pm-stake-row{ display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.pm-stake-row input{
  width: 130px; background: var(--panel); border: 1px solid var(--border-2);
  color: var(--text); border-radius: 10px; padding: 10px 12px; font-size: 14px; font-variant-numeric: tabular-nums;
}
.pm-card{ border-radius: 16px; padding: 18px; margin-bottom: 14px; }
.pm-head{ display: flex; align-items: center; gap: 10px; }
.pm-head b{ font-size: 15px; }
.pm-timer{ margin-left: auto; font-size: 13px; font-weight: 800; background: var(--panel); border: 1px solid var(--border); color: var(--text-dim); padding: 4px 10px; border-radius: 8px; }
.pm-price{ display: flex; align-items: baseline; gap: 10px; margin: 12px 0 10px; }
.pm-price .mono{ font-size: 20px; font-weight: 800; }
.pm-chg{ font-size: 12px; font-weight: 700; }
.pm-bar{ height: 9px; border-radius: 5px; overflow: hidden; background: var(--red-soft); }
.pm-bar-up{ height: 100%; background: var(--green); }
.pm-bar-lbl{ display: flex; justify-content: space-between; font-size: 11px; margin-top: 6px; font-variant-numeric: tabular-nums; }
.pm-bar-lbl .up{ color: var(--green); } .pm-bar-lbl .down{ color: var(--red); }
.pm-mine{ margin-top: 14px; font-size: 13px; color: var(--text-dim); }
.pm-btns{ display: flex; gap: 12px; margin-top: 14px; }
.pm-btns button{ flex: 1; padding: 13px 8px; border-radius: 12px; font-size: 13px; font-weight: 800; display: flex; flex-direction: column; align-items: center; gap: 3px; }
.pm-btns button span{ font-size: 10px; font-weight: 700; opacity: .8; }
.pm-btns .pm-up{ background: var(--green-soft); color: var(--green); }
.pm-btns .pm-down{ background: var(--red-soft); color: var(--red); }
.pm-btns button:hover{ box-shadow: var(--glow); }
#view-predict .feed-row{ display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 4px; border-bottom: 1px solid var(--border); font-size: 12.5px; }
#view-predict .feed-row:last-child{ border-bottom: none; }

/* =======================================================================
   EXPLORE / LEADERBOARD
   ======================================================================= */
.lb-mine-banner{ background: var(--accent-soft); color: var(--accent); border-radius: 12px; padding: 12px 16px; font-size: 13px; margin-bottom: 12px; }
.lb-list{ display: flex; flex-direction: column; }
.lb-row{ display: flex; align-items: center; gap: 14px; padding: 13px 8px; border-bottom: 1px solid var(--border); }
.lb-row:last-child{ border-bottom: none; }
.lb-row.me{ background: var(--accent-soft); border-radius: 10px; border-bottom-color: transparent; }
.lb-rank{ width: 28px; text-align: center; font-weight: 800; font-size: 14px; color: var(--text-dim); font-variant-numeric: tabular-nums; flex-shrink: 0; }
.lb-name{ flex: 1; font-weight: 700; font-size: 13.5px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-you{ font-size: 9px; font-weight: 800; letter-spacing: .05em; background: var(--accent); color: var(--accent-ink); padding: 1px 5px; border-radius: 4px; }
.lb-end{ text-align: right; flex-shrink: 0; }
.lb-ret{ font-size: 13px; font-weight: 800; }
.lb-val{ font-size: 11px; color: var(--text-faint); margin-top: 1px; }

/* =======================================================================
   CHAT
   ======================================================================= */
.chat-note{ font-size: 12px; color: var(--text-faint); padding: 24px 34px 10px; }
.chat-scroll{ flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 4px 34px 12px; max-width: var(--ws-max); margin: 0 auto; width: 100%; }
.chat-msg{ max-width: 60%; align-self: flex-start; }
.chat-msg.mine{ align-self: flex-end; }
.chat-who{ font-size: 10.5px; color: var(--text-faint); margin: 0 0 3px 8px; }
.chat-bubble{ background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 10px 14px; font-size: 13.5px; line-height: 1.4; word-break: break-word; }
.chat-msg.mine .chat-bubble{ background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.chat-bar{ display: flex; gap: 10px; padding: 14px 34px; border-top: 1px solid var(--border); background: var(--bg-2); max-width: var(--ws-max); margin: 0 auto; width: 100%; }
.chat-bar input{ flex: 1; background: var(--panel); border: 1px solid var(--border-2); color: var(--text); border-radius: 12px; padding: 11px 15px; font-size: 14px; }
.td-head + .chat-note{ padding-top: 0; }

.star-btn{ background: transparent; font-size: 20px; color: var(--text-faint); padding: 4px 6px; flex-shrink: 0; }
.star-btn.on{ color: #f5c518; }

/* =======================================================================
   AUTH  — centered glass card on the periwinkle-lit ground
   ======================================================================= */
#screen-auth.onb{
  position: relative; z-index: 1;
  min-height: 100vh;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 40px 20px;
}
#screen-auth.onb > *{ width: 100%; max-width: 400px; }
#screen-auth .onb-top{ display: flex; align-items: center; gap: 11px; justify-content: center; margin-bottom: 26px; }
.brand-mark{
  width: 42px; height: 42px; border-radius: 13px;
  background: linear-gradient(155deg, var(--accent), #6c5ce7);
  display: grid; place-items: center; font-size: 21px; box-shadow: var(--glow);
}
.brand-mark svg{ width: 25px; height: 25px; }
.brand-name{ font-weight: 800; font-size: 18px; }
.brand-name b{ color: var(--accent); }
.onb-hero{ text-align: center; }
.onb-hero .big-mark{
  width: 84px; height: 84px; border-radius: 26px; margin: 0 auto 20px;
  background: linear-gradient(155deg, var(--accent), #6c5ce7);
  display: grid; place-items: center; font-size: 42px; box-shadow: var(--glow);
}
.onb-hero .big-mark svg{ width: 50px; height: 50px; }
.onb-hero h1{ font-size: 26px; line-height: 1.2; margin: 0 0 10px; letter-spacing: -0.02em; }
.onb-hero p{ color: var(--text-dim); font-size: 14px; line-height: 1.6; margin: 0; }
.auth-tabs{ display: flex; gap: 6px; background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 4px; margin-bottom: 18px; }
.auth-tab{ flex: 1; padding: 11px 0; border-radius: 9px; font-size: 14px; font-weight: 800; color: var(--text-dim); }
.auth-tab.on{ background: var(--accent); color: var(--accent-ink); }
#auth-form{
  background: var(--glass); border: 1px solid var(--glass-brd);
  box-shadow: var(--glass-shadow); border-radius: 18px; padding: 20px;
}
.onb-actions{ display: flex; flex-direction: column; gap: 12px; }
.big-mark{ /* offline state */ width: 84px; height: 84px; border-radius: 26px; background: var(--panel); display: grid; place-items: center; font-size: 40px; margin: 0 auto 18px; }

/* ---------- onboarding questionnaire: one-question-at-a-time wizard ---------- */
.apply-progress{ display: flex; gap: 6px; margin: 4px 0 26px; }
.apply-progress i{ flex: 1; height: 4px; border-radius: 999px; background: var(--glass-brd); transition: background .25s; }
.apply-progress i.on{ background: var(--accent); box-shadow: var(--glow); }
.apply-progress i.done{ background: var(--accent); opacity: .5; }

.apply-step{ animation: applyIn .3s ease both; }
@keyframes applyIn{ from{ opacity: 0; transform: translateY(10px); } to{ opacity: 1; transform: none; } }

.apply-back{
  background: none; border: none; padding: 0; margin-bottom: 16px;
  color: var(--text-dim); font-size: 13px; font-weight: 700; cursor: pointer;
}
.apply-back:hover{ color: var(--accent); }

.apply-q{ font-size: 22px; line-height: 1.25; margin: 0 0 20px; letter-spacing: -0.015em; }

.apply-options{ display: flex; flex-direction: column; gap: 10px; }
.apply-opt{
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: left;
  padding: 16px 18px; border-radius: 14px; cursor: pointer;
  background: var(--glass); border: 1px solid var(--glass-brd);
  box-shadow: var(--glass-shadow);
  transition: border-color .15s, transform .12s, box-shadow .15s;
}
.apply-opt:hover{ border-color: var(--accent); transform: translateY(-1px); }
.apply-opt:active{ transform: translateY(0); }
.apply-opt.on{ border-color: var(--accent); box-shadow: var(--glow); }
.apply-opt .ao-txt{ display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 0; }
.apply-opt .ao-txt b{ font-size: 14.5px; font-weight: 700; }
.apply-opt .ao-txt small{ font-size: 12px; color: var(--text-dim); }
/* plain radio indicator — a ring that fills with a solid dot when selected,
   deliberately not a checkmark glyph or any pictographic icon */
.apply-opt .ao-check{
  width: 19px; height: 19px; border-radius: 999px; flex-shrink: 0; position: relative;
  border: 1.5px solid var(--glass-brd); transition: border-color .15s;
}
.apply-opt.on .ao-check{ border-color: var(--accent); }
.apply-opt.on .ao-check::after{
  content: ""; position: absolute; inset: 4px; border-radius: 999px; background: var(--accent);
}

/* =======================================================================
   MENU (account panel) + ACTION menu + SHEETS as centered modals
   ======================================================================= */
.pw-menu-backdrop{
  position: fixed; inset: 0; z-index: 300; background: rgba(0,0,0,.6);
  display: flex; justify-content: flex-end;
  opacity: 0; pointer-events: none; transition: opacity .2s ease;
}
.pw-menu-backdrop.show{ opacity: 1; pointer-events: auto; }
.pw-menu{
  width: 340px; background: var(--bg-2); border-left: 1px solid var(--border);
  height: 100%; padding: 22px; display: flex; flex-direction: column;
  transform: translateX(100%); transition: transform .24s ease; overflow-y: auto;
}
.pw-menu-backdrop.show .pw-menu{ transform: translateX(0); }
.pw-menu-head{ display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.pw-menu-avatar{
  width: 52px; height: 52px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffd76a, #ff8a3d 70%);
  display: grid; place-items: center; font-size: 25px;
}
.pw-menu-handle{ font-size: 20px; font-weight: 800; }
.pw-menu-x{ color: var(--accent); font-weight: 700; font-size: 13px; text-align: left; padding: 10px 0 16px; }
.pw-menu-acct{ display: flex; align-items: center; gap: 10px; background: var(--panel); border: 1px solid var(--border); border-radius: 13px; padding: 12px 14px; font-weight: 800; font-size: 14px; margin-bottom: 8px; width: 100%; }
.pw-menu-list, .pw-menu-foot{ display: flex; flex-direction: column; }
.pw-menu-foot{ margin-top: auto; padding-top: 10px; border-top: 1px solid var(--border); }
.pw-menu-list button, .pw-menu-foot button{ display: flex; align-items: center; gap: 14px; padding: 14px 4px; font-size: 15px; font-weight: 700; text-align: left; color: var(--text); }
.pw-menu-list button span, .pw-menu-foot button span{ font-size: 17px; width: 22px; text-align: center; }
.pw-menu-list button:hover, .pw-menu-foot button:hover{ color: var(--accent); }

.pw-action-backdrop{ position: fixed; inset: 0; z-index: 320; background: rgba(0,0,0,.6); backdrop-filter: blur(3px); display: flex; flex-direction: column; align-items: flex-end; justify-content: flex-end; padding: 0 34px 34px; opacity: 0; pointer-events: none; transition: opacity .18s ease; }
.pw-action-backdrop.show{ opacity: 1; pointer-events: auto; }
.pw-action-list{ display: flex; flex-direction: column; align-items: flex-end; gap: 16px; }
.pw-action-list button{ display: flex; align-items: center; gap: 14px; font-size: 18px; font-weight: 800; color: var(--text); }
.pw-action-ic{ width: 48px; height: 48px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-size: 20px; }
.pw-action-close{ width: 44px; height: 44px; border-radius: 50%; background: var(--panel); color: var(--text-dim); display: grid !important; place-items: center; font-size: 17px; }

/* sheets -> centered modal cards */
.sheet-backdrop{ align-items: center; }
.sheet{
  max-width: 440px; border: 1px solid var(--border-2); border-radius: 22px;
  background: var(--bg-2); transform: scale(.95); max-height: 84vh;
  padding: 22px 22px 24px;
}
.sheet-backdrop.show .sheet{ transform: scale(1); }
.sheet-grip{ display: none; }
.sheet-title h3{ font-size: 18px; }

/* =======================================================================
   SKELETON / SHIMMER
   ======================================================================= */
@keyframes gw-shimmer{ 0%{ background-position: 180% 0; } 100%{ background-position: -80% 0; } }
.sk{
  background: linear-gradient(90deg, rgba(255,255,255,.035) 20%, rgba(255,255,255,.09) 40%, rgba(255,255,255,.035) 60%);
  background-size: 240% 100%;
  animation: gw-shimmer 1.5s ease-in-out infinite;
  border-radius: 12px;
}
.sk-rows{ display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.sk-row{ height: 62px; }
.sk-grid{ display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-top: 8px; }
.sk-card{ height: 92px; }
.sk-hero{ height: 120px; margin-bottom: 12px; }
.sk-line{ height: 16px; }

/* =======================================================================
   BUTTONS (desktop tuning) + misc
   ======================================================================= */
.btn{ border-radius: 12px; transition: transform .1s ease, background .15s ease, box-shadow .2s ease; }
.btn-lg{ padding: 15px 22px; font-size: 15px; border-radius: 14px; }
.btn-primary:hover{ box-shadow: var(--glow); }
.btn:active{ transform: scale(.985); }
.empty-state{ text-align: center; color: var(--text-faint); font-size: 13.5px; line-height: 1.6; padding: 46px 16px; }
.field-error{ color: var(--red); font-size: 12.5px; margin-top: 8px; min-height: 1px; }
.field-hint{ color: var(--text-faint); font-size: 12px; margin-top: 7px; line-height: 1.5; }
.word-bank{ display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.word-chip{ background: var(--panel); border: 1px solid var(--border-2); border-radius: 999px; padding: 8px 14px; font-size: 13px; font-weight: 700; }
.word-chip:hover{ border-color: var(--accent); }

.acct-list-row{ display: flex; align-items: center; gap: 12px; padding: 13px 12px; border-radius: 12px; cursor: pointer; }
.acct-list-row:hover{ background: var(--panel); }
.acct-list-row.on{ background: var(--accent-soft); }
.acct-list-row .a-name{ font-weight: 700; font-size: 14px; }
.acct-list-row .a-addr{ font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.acct-list-row .a-val{ margin-left: auto; font-weight: 700; font-size: 13.5px; }
.acct-list-row .tick{ color: var(--accent); font-weight: 800; margin-left: auto; }
.acct-avatar{
  width: 26px; height: 26px; border-radius: 50%;
  background: linear-gradient(140deg, var(--accent), #6c5ce7);
  display: grid; place-items: center; font-size: 12px; font-weight: 800; color: #fff; flex-shrink: 0;
}
.chev{ color: var(--text-faint); font-size: 11px; }

/* =======================================================================
   MISC (P15) — link button, tiny action button, dimmed row, select
   ======================================================================= */
button.link{ color: var(--accent); font-weight: 700; font-size: 12.5px; background: none; }
button.link:hover{ text-decoration: underline; }
button.link:disabled{ color: var(--text-faint); cursor: not-allowed; text-decoration: none; }
.frozen-banner{
  background: var(--red-soft); color: var(--red); border: 1px solid rgba(252,109,109,.3);
  border-radius: 14px; padding: 13px 16px; font-size: 13.5px; line-height: 1.5; margin-bottom: 18px;
}
.frozen-banner b{ color: var(--red); }
.btn-xs{ padding: 6px 10px; font-size: 11.5px; border-radius: 8px; background: var(--panel); color: var(--text-dim); border: 1px solid var(--border); }
.btn-xs.btn-accent-soft{ border-color: transparent; }
.btn-xs.btn-danger{ border-color: transparent; }
.row-hidden{ opacity: .5; }
.s-select{
  margin-left: auto; background: var(--panel); border: 1px solid var(--border-2); color: var(--text);
  border-radius: 9px; padding: 7px 10px; font-size: 12.5px;
}

/* =======================================================================
   NOTIFICATIONS (P15)
   ======================================================================= */
.tb-bell-wrap{ position: relative; }
.tb-icon-btn{
  position: relative; width: 36px; height: 36px; border-radius: 10px;
  background: var(--panel); border: 1px solid var(--border); color: var(--text-dim);
  display: grid; place-items: center;
}
.tb-icon-btn:hover{ color: var(--text); border-color: var(--border-2); }
.tb-bell-dot{
  position: absolute; top: 6px; right: 7px; width: 7px; height: 7px; border-radius: 50%;
  background: var(--red); box-shadow: 0 0 0 2px var(--bg);
}
.notif-panel{
  position: absolute; right: 0; top: 44px; z-index: 60;
  width: 340px; max-height: 420px; overflow-y: auto;
  background: var(--panel-2); border: 1px solid var(--border-2); border-radius: 16px;
  box-shadow: 0 30px 70px -20px rgba(0,0,0,.7);
}
.notif-head{ display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 10px; }
.notif-head b{ font-size: 14px; }
.notif-row{ display: flex; align-items: flex-start; gap: 10px; padding: 11px 16px; cursor: pointer; border-top: 1px solid var(--border); }
.notif-row:hover{ background: rgba(255,255,255,.03); }
.notif-row.unread{ background: var(--accent-wash, var(--accent-soft)); }
.notif-ic{ font-size: 15px; flex-shrink: 0; margin-top: 1px; }
.notif-body{ flex: 1; min-width: 0; }
.notif-title{ font-size: 13px; font-weight: 700; }
.notif-sub{ font-size: 12px; color: var(--text-dim); margin-top: 1px; }
.notif-time{ font-size: 10.5px; color: var(--text-faint); flex-shrink: 0; white-space: nowrap; }

/* =======================================================================
   AUTO-LOCK OVERLAY (P15)
   ======================================================================= */
.lock-overlay{
  position: fixed; inset: 0; z-index: 9000;
  background: rgba(8,9,12,.92); backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.lock-overlay[hidden]{ display: none; }
.lock-card{ width: 100%; max-width: 340px; text-align: center; }
.lock-mark{
  width: 68px; height: 68px; border-radius: 20px; margin: 0 auto 18px;
  background: linear-gradient(155deg, var(--accent), #6c5ce7);
  display: grid; place-items: center; box-shadow: var(--glow);
}
.lock-mark svg{ width: 40px; height: 40px; }
.lock-card h3{ font-size: 20px; margin: 0 0 6px; }
.lock-card p{ color: var(--text-dim); font-size: 13.5px; margin: 0 0 20px; }
.lock-card input{
  width: 100%; background: var(--panel); border: 1px solid var(--border-2); color: var(--text);
  padding: 13px 15px; border-radius: 12px; font-size: 15px; margin-bottom: 10px; text-align: center;
}
.lock-card .btn-ghost{ margin-top: 10px; }

/* =======================================================================
   STAKING (P15)
   ======================================================================= */
#view-stake.active{ max-width: 560px; }
.stake-pos{
  background: var(--glass); border: 1px solid var(--glass-brd); box-shadow: var(--glass-shadow);
  border-radius: 16px; padding: 16px; margin-bottom: 12px;
}
.sp-top{ display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.sp-top b{ font-size: 14px; }
.sp-apy{ margin-left: auto; font-size: 11px; font-weight: 800; color: var(--accent); background: var(--accent-soft); padding: 2px 8px; border-radius: 999px; }
.sp-grid{ display: grid; grid-template-columns: 1fr 1fr; gap: 8px 18px; font-size: 12.5px; margin-bottom: 12px; }
.sp-grid > div{ display: flex; justify-content: space-between; }
.sp-grid span{ color: var(--text-faint); }

/* =======================================================================
   COLLECTIBLES / NFTs (P15)
   ======================================================================= */
#view-collectibles.active, #view-nft.active{ max-width: 760px; }
.nft-grid{ display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 16px; margin-top: 18px; }
.nft-card{
  border-radius: 16px; overflow: hidden; cursor: pointer;
  background: var(--glass); border: 1px solid var(--glass-brd); box-shadow: var(--glass-shadow);
  transition: transform .14s ease, border-color .14s ease;
}
.nft-card:hover{ transform: translateY(-3px); border-color: rgba(171,159,242,.4); }
.nft-canvas{ width: 100%; aspect-ratio: 1; display: block; }
.nft-meta{ display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; font-size: 12.5px; }
.nft-price{ color: var(--accent); font-weight: 800; }
.nft-canvas-lg{
  width: 100%; max-width: 320px; aspect-ratio: 1; border-radius: 20px; display: block;
  box-shadow: var(--glass-shadow); border: 1px solid var(--glass-brd); margin: 4px auto 0;
}

/* =======================================================================
   RESPONSIVE  — collapse the rail under ~900px
   ======================================================================= */
@media (max-width: 900px){
  :root{ --rail-w: 72px; }
  .rail-name, .rail-acct span:not(.acct-avatar):not(.chev), .rail-disc, .nav-link span.nl{ display: none; }
  .nav-link{ justify-content: center; padding: 12px 0; }
  .rail-brand{ justify-content: center; padding: 6px 0 18px; }
  .rail-acct{ justify-content: center; padding: 10px 0; }
  .tb-search{ display: none; }
  .view.active{ padding: 22px 18px 50px; }
}
@media (max-width: 480px){
  /* .row-spark's fixed 96px width plus the icon and price columns left
     almost no room for the coin name at phone width -- row-title was
     measuring out at ~2px wide, not just tight. The sparkline is the
     least essential element here (the price/% already carries the trend
     direction), so it's what gives up its space, not the name. */
  .row-spark{ display: none; }
}

/* =======================================================================
   TRADING TERMINAL  — coin detail (js/terminal.js)
   Phone-first: one column + a sticky Buy/Sell dock. ≥1100px: chart and
   blotter on the left, ticket and order book in a 340px column.
   ======================================================================= */
#view-token.active{ max-width: 1320px; }
.tm-head{ display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.tm-head .back{ font-size: 20px; color: var(--text-dim); padding: 4px 6px 4px 0; }
.tm-head .star{ font-size: 18px; color: var(--text-faint); }
.tm-head .star.on{ color: #f5c518; }
.tm-title{ min-width: 0; }
.tm-sym{ font-size: 18px; font-weight: 700; letter-spacing: -.01em; }
.tm-sym span{ color: var(--text-faint); font-weight: 500; font-size: 13px; margin-left: 2px; }
.tm-name{ font-size: 12px; color: var(--text-faint); }
.tm-last{ margin-left: auto; text-align: right; }
.tm-price{ font-family: var(--font-mono); font-size: 26px; font-weight: 600; letter-spacing: -.02em; line-height: 1.1; }
.tm-chg{ font-family: var(--font-mono); font-size: 12px; font-weight: 600; margin-top: 2px; }

.tm-stats{
  display: flex; gap: 1px; margin: 14px 0; overflow-x: auto;
  background: var(--border); border: 1px solid var(--border); border-radius: 12px;
  scrollbar-width: none;
}
.tm-stats > div{ flex: 1 0 auto; min-width: 96px; background: var(--panel); padding: 9px 12px; font-family: var(--font-mono); font-size: 12.5px; font-weight: 600; }
.tm-stats span{ display: block; font-family: var(--font); font-size: 10px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--text-faint); margin-bottom: 3px; }

.tm-grid{ display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.tm-main, .tm-side{ display: flex; flex-direction: column; gap: 14px; min-width: 0; }
@media (min-width: 1100px){
  .tm-grid{ grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
  .tm-side{ position: sticky; top: 80px; }
  .tm-dock{ display: none !important; }
}
/* phone: ticket right under the chart, book after the blotter */
@media (max-width: 1099px){
  .tm-main, .tm-side{ display: contents; }
  .tm-chart{ order: 1; } .tm-ticket{ order: 2; } .tm-blotter{ order: 3; } .tm-book{ order: 4; }
}

.tm-chart, .tm-panel{ background: var(--panel); border: 1px solid var(--border); border-radius: 14px; min-width: 0; }
.tm-chart{ padding: 10px 10px 6px; }
.tm-toolbar{ display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.tm-ivs, .tm-inds{ display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; min-width: 0; max-width: 100%; }
.tm-ivs button, .tm-inds button{
  padding: 6px 9px; border-radius: 7px; font-family: var(--font-mono); font-size: 11.5px; font-weight: 600;
  color: var(--text-faint); white-space: nowrap; display: inline-flex; align-items: center; gap: 5px;
}
.tm-ivs button:hover, .tm-inds button:hover{ color: var(--text); background: rgba(255,255,255,.04); }
.tm-ivs button.on{ color: var(--text); background: var(--surface-2); }
.tm-inds button i{ width: 8px; height: 2px; border-radius: 1px; opacity: .35; }
.tm-inds button.on{ color: var(--text); }
.tm-inds button.on i{ opacity: 1; }
.tm-canvas{ width: 100%; height: 400px; display: block; touch-action: pan-y; cursor: crosshair; }

.tm-panel{ padding: 12px; }
.tm-tabs{ display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin: -2px -2px 10px; overflow-x: auto; scrollbar-width: none; }
.tm-tabs button{
  padding: 8px 10px 9px; font-size: 12.5px; font-weight: 600; color: var(--text-faint); white-space: nowrap;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tm-tabs button.on{ color: var(--text); border-bottom-color: var(--accent); }
.tm-tabs button b{ font-family: var(--font-mono); font-size: 10.5px; color: var(--text-dim); background: var(--surface-2); border-radius: 5px; padding: 1px 5px; margin-left: 4px; }
.tm-empty{ color: var(--text-faint); font-size: 12.5px; padding: 18px 4px; text-align: center; line-height: 1.5; }

/* ---- ticket ---- */
.tk-side{ display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 12px; }
.tk-side button{ padding: 11px 0; border-radius: 10px; font-weight: 700; font-size: 14px; background: var(--surface); color: var(--text-dim); }
.tk-side button.on.buy{ background: var(--green); color: #06210f; }
.tk-side button.on.sell{ background: var(--red); color: #2a0707; }
.tk-row{ margin-bottom: 12px; }
.tk-lbl{ display: flex; align-items: center; gap: 6px; font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-faint); margin-bottom: 6px; }
.tk-lbl .faint{ text-transform: none; letter-spacing: 0; font-weight: 500; }
.tk-link{ margin-left: auto; font-size: 11px; text-transform: none; letter-spacing: 0; color: var(--accent); font-weight: 600; }
.tk-seg, .tk-levs{ display: flex; gap: 4px; background: var(--bg-2); border: 1px solid var(--border); border-radius: 10px; padding: 3px; }
.tk-seg button, .tk-levs button{ flex: 1; padding: 8px 0; border-radius: 7px; font-size: 12.5px; font-weight: 600; color: var(--text-dim); font-family: var(--font-mono); }
.tk-seg button{ font-family: var(--font); }
.tk-seg button.on, .tk-levs button.on{ background: var(--surface-3); color: var(--text); }
.tk-levs button.on{ background: var(--accent); color: var(--accent-ink); }
.tk-levs button:disabled{ opacity: .3; cursor: not-allowed; }
.tk-input{
  width: 100%; background: var(--bg-2); border: 1px solid var(--border-2); color: var(--text);
  border-radius: 10px; padding: 11px 12px; font-family: var(--font-mono); font-size: 17px; font-weight: 600;
}
.tk-input.sm{ font-size: 13px; padding: 8px 10px; }
.tk-input:focus{ border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.tk-hint{ font-size: 11px; color: var(--text-faint); margin-top: 5px; line-height: 1.45; }
.tk-chips{ display: flex; gap: 4px; margin-top: 6px; }
.tk-chips button{ flex: 1; padding: 7px 0; border-radius: 7px; font-family: var(--font-mono); font-size: 11.5px; font-weight: 600; background: var(--surface); color: var(--text-dim); }
.tk-chips button:hover{ color: var(--text); }
.tk-tpsl{ display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tk-metas{ background: var(--bg-2); border: 1px solid var(--border); border-radius: 10px; padding: 2px 11px; margin-bottom: 12px; font-family: var(--font-mono); }
.tk-metas > div{ display: flex; justify-content: space-between; padding: 7px 0; font-size: 12px; color: var(--text); }
.tk-metas > div span:first-child{ color: var(--text-faint); font-family: var(--font); }
.tk-metas > div + div{ border-top: 1px solid var(--border); }
.tk-submit{ width: 100%; padding: 14px 10px; border-radius: 11px; font-weight: 700; font-size: 14.5px; }
.tk-submit.buy{ background: var(--green); color: #06210f; }
.tk-submit.sell{ background: var(--red); color: #2a0707; }
.tk-submit:disabled{ opacity: .4; cursor: not-allowed; }

/* ---- order book / tape ---- */
.ob-head, .tp-head, .ob-row, .tp-row{ display: grid; grid-template-columns: 1.1fr 1fr 1fr; gap: 6px; font-size: 11.5px; }
.ob-head, .tp-head{ color: var(--text-faint); font-size: 10px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; padding: 0 6px 6px; }
.ob-head span:not(:first-of-type), .tp-head span:not(:first-of-type), .ob-row span:not(:first-of-type), .tp-row span:not(:first-of-type){ text-align: right; }
.ob-row, .tp-row{ position: relative; padding: 3px 6px; font-family: var(--font-mono); }
.ob-row i{ position: absolute; right: 0; top: 1px; bottom: 1px; border-radius: 2px; }
.ob-row.ask i{ background: rgba(252,109,109,.12); }
.ob-row.bid i{ background: rgba(33,229,111,.12); }
.ob-row.ask span:first-of-type{ color: var(--red); }
.ob-row.bid span:first-of-type{ color: var(--green); }
.ob-row span{ position: relative; }
.ob-mid{ display: flex; align-items: baseline; justify-content: space-between; padding: 8px 6px; margin: 4px 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); font-family: var(--font-mono); }
.ob-mid b{ font-size: 15px; }
.ob-mid span{ font-size: 10.5px; }

/* ---- blotter ---- */
.bl-row{ display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 10px; align-items: center; padding: 10px 2px; border-bottom: 1px solid var(--border); }
.bl-row:last-child{ border-bottom: none; }
.bl-main{ display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13.5px; min-width: 0; }
.bl-sub{ grid-column: 1; display: flex; gap: 12px; flex-wrap: wrap; font-family: var(--font-mono); font-size: 11.5px; color: var(--text-dim); }
.bl-row > .btn{ grid-row: 1 / span 2; grid-column: 2; }
.bl-tag{ font-size: 10px; font-weight: 700; letter-spacing: .04em; padding: 2px 7px; border-radius: 5px; font-family: var(--font-mono); }
.bl-tag.long{ background: var(--green-soft); color: var(--green); }
.bl-tag.short{ background: var(--red-soft); color: var(--red); }
.bl-tag.spot{ background: var(--accent-soft); color: var(--accent); }
.bl-pnl{ margin-left: auto; font-family: var(--font-mono); font-weight: 600; font-size: 13px; }
.bl-trig{ margin-left: auto; font-family: var(--font-mono); font-size: 12.5px; }
.bl-status{ margin-left: auto; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-faint); }
.bl-status.filled{ color: var(--green); }
.bl-status.failed{ color: var(--red); }
.bl-tpsl{ grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr auto auto; gap: 6px; }

.tm-extra{ display: flex; gap: 8px; margin: 16px 0 6px; }
.tm-extra .btn{ flex: 0 0 auto; }

/* ---- phone dock ---- */
.tm-dock{
  position: sticky; bottom: 0; z-index: 20; display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
  margin: 16px -4px 0; padding: 10px 4px calc(10px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, transparent, var(--bg) 30%);
}
.tm-dock button{ padding: 14px 0; border-radius: 12px; font-weight: 700; font-size: 15px; }
.tm-dock-buy{ background: var(--green); color: #06210f; }
.tm-dock-sell{ background: var(--red); color: #2a0707; }

@media (max-width: 480px){
  #view-token.active{ padding-left: 12px; padding-right: 12px; }
  .tm-price{ font-size: 22px; }
  .tm-toolbar{ flex-direction: column; align-items: stretch; }
  .tk-input{ font-size: 16px; }    /* ≥16px stops iOS zooming into the field */
  .tk-input.sm{ font-size: 16px; }
  .bl-tpsl{ grid-template-columns: 1fr 1fr; }
}

/* phones: the top bar's Send/Receive/Withdraw/Swap buttons (all also on
   Home) pushed the page to ~680px wide, so iOS zoomed the whole app out.
   Keep title + bell + avatar only. */
@media (max-width: 640px){
  .topbar{ padding: 0 14px; gap: 10px; }
  .topbar .tb-btn{ display: none; }
  #tb-acct-name, .tb-acct .chev{ display: none; }
  .tb-title{ min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

/* =======================================================================
   PLATFORM SCREENS  — home dashboard, screener, explore, activity, ticker
   (js/screens.js). Shares the terminal's panels (.tm-panel) and mono type.
   ======================================================================= */
.hide-sm, .hide-md{}
@media (max-width: 1100px){ .hide-md{ display: none !important; } }
@media (max-width: 640px){ .hide-sm{ display: none !important; } }
.coin-icon.xs{ width: 22px; height: 22px; font-size: 12px; flex: 0 0 auto; }
.spark-svg{ display: block; }

.panel-h{ display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; font-size: 12px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--text-dim); }
.panel-h b{ font-family: var(--font-mono); font-size: 10.5px; color: var(--text-dim); background: var(--surface-2); border-radius: 5px; padding: 1px 6px; margin-left: 6px; }
.panel-h .link{ text-transform: none; letter-spacing: 0; font-size: 12px; color: var(--accent); font-weight: 600; }
.home-main, .home-side{ display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.home-side .pw-shortcut{ background: var(--bg-2); border: 1px solid var(--border); }

/* account strip (IBKR "Account" window) */
.acct-strip{
  display: flex; gap: 1px; margin-bottom: 14px; overflow-x: auto; scrollbar-width: none;
  background: var(--border); border: 1px solid var(--border); border-radius: 14px;
}
.acct-strip > div{ flex: 1 0 auto; min-width: 128px; background: var(--panel); padding: 12px 14px; font-family: var(--font-mono); font-size: 14px; font-weight: 600; }
.acct-strip > div.big{ font-size: 20px; min-width: 170px; }
.acct-strip span{ display: block; font-family: var(--font); font-size: 10px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-faint); margin-bottom: 4px; }
.acct-strip b{ font-weight: 600; }

/* portfolio chart */
.pf-head{ display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.pf-lbl{ font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-faint); }
.pf-val{ font-family: var(--font-mono); font-size: 28px; font-weight: 600; letter-spacing: -.02em; margin-top: 2px; }
.pf-chg{ font-family: var(--font-mono); font-size: 12.5px; font-weight: 600; margin-top: 2px; }
.pf-chart{ width: 100%; height: 170px; display: block; margin-top: 12px; }
.pf-note{ font-size: 10.5px; margin-top: 4px; }
.pf-panel .bc-actions{ margin-top: 14px; flex-wrap: wrap; }
.pf-panel .bc-actions .btn{ padding: 10px 8px; font-size: 13px; min-width: 76px; }

/* allocation */
.alloc-bar{ display: flex; height: 10px; border-radius: 5px; overflow: hidden; gap: 2px; background: var(--bg-2); }
.alloc-bar i{ display: block; height: 100%; min-width: 2px; }
.alloc-legend{ display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 10px; font-size: 12px; color: var(--text-dim); }
.alloc-legend span{ display: inline-flex; align-items: center; gap: 6px; }
.alloc-legend i{ width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.alloc-legend b{ color: var(--text); font-weight: 600; }

/* data tables (holdings / perps / orders / activity) */
.dt-head, .dt-row{ display: grid; grid-template-columns: 1.4fr repeat(5, minmax(0, 1fr)); gap: 10px; align-items: center; }
.dt-head{ padding: 0 4px 8px; border-bottom: 1px solid var(--border); font-size: 10px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--text-faint); }
.dt-row{ padding: 10px 4px; border-bottom: 1px solid var(--border); font-size: 12.5px; cursor: pointer; }
.dt-row:last-child{ border-bottom: none; }
.dt-row:hover{ background: rgba(255,255,255,.02); }
.dt-head > span:not(:first-child), .dt-row > span:not(:first-child){ text-align: right; }
.dt-row small{ display: block; font-size: 10.5px; opacity: .8; }
.dt-asset{ display: flex; align-items: center; gap: 8px; min-width: 0; }
.dt-asset b{ white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 640px){
  .dt-head, .dt-row{ grid-template-columns: 1.3fr 1fr 1fr; }
}

/* compact list rows (watchlist / movers / explore tables) */
.mini-row{ display: grid; grid-template-columns: 22px minmax(0, 1fr) 54px auto 64px; gap: 10px; align-items: center; padding: 8px 2px; border-bottom: 1px solid var(--border); cursor: pointer; font-size: 12.5px; }
.mini-row:last-child{ border-bottom: none; }
.mini-row:hover{ background: rgba(255,255,255,.02); }
.mini-row b{ overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-row > span:last-child, .mini-row > span.mono{ text-align: right; font-family: var(--font-mono); }

/* screener */
.scr-top{ display: flex; align-items: center; gap: 12px; margin: 4px 0 12px; flex-wrap: wrap; }
.scr-title{ font-size: 22px; margin: 0; letter-spacing: -.01em; }
.scr-search{ flex: 1; min-width: 160px; margin: 0; }
.chip-row{ display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin-bottom: 12px; }
.chip-row button{ padding: 7px 13px; border-radius: 999px; font-size: 12.5px; font-weight: 600; color: var(--text-dim); background: var(--panel); border: 1px solid var(--border); white-space: nowrap; }
.chip-row button:hover{ color: var(--text); border-color: var(--border-2); }
.chip-row button.on{ color: var(--accent-ink); background: var(--accent); border-color: transparent; }
.scr-panel{ padding: 4px 8px; }
.scr-head, .scr-row{ display: grid; grid-template-columns: minmax(150px, 1.6fr) 1fr 0.8fr 1fr 1fr 0.9fr 0.9fr 84px; gap: 10px; align-items: center; }
.scr-head{ padding: 10px 6px; border-bottom: 1px solid var(--border); }
.scr-head button{ font-size: 10px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--text-faint); text-align: right; white-space: nowrap; }
.scr-head button:first-child{ text-align: left; }
.scr-head button.on, .scr-head button:hover{ color: var(--text); }
.scr-row{ padding: 10px 6px; border-bottom: 1px solid var(--border); font-size: 13px; cursor: pointer; }
.scr-row:last-child{ border-bottom: none; }
.scr-row:hover{ background: rgba(255,255,255,.025); }
.scr-row > span:not(:first-child){ text-align: right; }
.scr-row > span:last-child{ display: flex; justify-content: flex-end; }
.scr-asset{ display: flex; align-items: center; gap: 9px; min-width: 0; }
.scr-asset .star-btn{ font-size: 14px; color: var(--text-faint); padding: 0 2px; }
.scr-asset .star-btn.on{ color: #f5c518; }
.scr-names{ display: flex; flex-direction: column; min-width: 0; }
.scr-names b{ font-size: 13px; }
.scr-names small{ font-size: 11px; color: var(--text-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chg-pill{ font-style: normal; font-weight: 600; font-size: 12px; padding: 3px 7px; border-radius: 6px; }
.chg-pill.up{ background: var(--green-soft); }
.chg-pill.down{ background: var(--red-soft); }
@media (max-width: 1100px){ .scr-head, .scr-row{ grid-template-columns: minmax(140px, 1.6fr) 1fr 0.8fr 0.9fr 0.9fr 84px; } }
@media (max-width: 640px){ .scr-head, .scr-row{ grid-template-columns: minmax(0, 1.5fr) 1fr 0.9fr; } }

/* explore heatmap */
.heatmap{ display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); grid-auto-rows: 62px; grid-auto-flow: dense; gap: 4px; }
.hm-tile{ border-radius: 8px; padding: 8px; display: flex; flex-direction: column; justify-content: center; cursor: pointer; overflow: hidden; transition: filter .15s; }
.hm-tile:hover{ filter: brightness(1.25); }
.hm-tile b{ font-size: 13px; }
.hm-tile span{ font-size: 12px; font-weight: 600; }
.hm-tile small{ font-size: 11px; opacity: .8; margin-top: 2px; }
.hm-tile.lg{ grid-column: span 2; }
.hm-tile.xl{ grid-column: span 2; grid-row: span 2; }
.hm-tile.xl b{ font-size: 18px; }
.hm-tile.xl span{ font-size: 15px; }
.ex-grid{ display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-top: 14px; }
@media (max-width: 940px){ .ex-grid{ grid-template-columns: 1fr; } }

/* activity blotter */
.act-cols{ grid-template-columns: 0.9fr 1.2fr 1fr 0.8fr 0.9fr 1fr; }
@media (max-width: 640px){ .act-cols{ grid-template-columns: 0.8fr 1fr 1fr 1fr; } }
.dt-row.act-cols{ cursor: default; }

/* ticker tape */
.ticker{ position: sticky; top: 66px; z-index: 25; overflow: hidden; height: 30px; border-bottom: 1px solid rgba(255,255,255,.06); background: rgba(11,12,16,.82); backdrop-filter: blur(12px); }
.ticker-track{ display: flex; width: max-content; height: 100%; align-items: center; animation: tickerScroll 80s linear infinite; }
.ticker:hover .ticker-track{ animation-play-state: paused; }
.tk-item{ display: inline-flex; align-items: center; gap: 7px; padding: 0 18px; font-size: 11.5px; cursor: pointer; white-space: nowrap; border-right: 1px solid rgba(255,255,255,.05); }
.tk-item b{ font-weight: 600; color: var(--text-dim); }
.tk-item .p{ font-family: var(--font-mono); }
.tk-item .c{ font-family: var(--font-mono); font-size: 11px; }
@keyframes tickerScroll{ from{ transform: translateX(0); } to{ transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce){ .ticker-track{ animation: none; } }
@media (min-width: 1100px){ .tm-side{ top: 108px; } }

/* =======================================================================
   FORMS RESTYLE — Swap / Perps / Stake / Send / Withdraw match the ticket
   ======================================================================= */
.perp-ticket, .swap-leg, .stake-pos, .perp-pos{
  background: var(--panel) !important; border: 1px solid var(--border) !important;
  box-shadow: none !important; border-radius: 14px;
}
.swap-leg.to{ background: var(--bg-2) !important; }
.swap-amount, .big-input, .perp-margin input, .field input{ font-family: var(--font-mono); }
.swap-amount{ font-weight: 600; }
.big-input{ font-weight: 600; letter-spacing: -.02em; }
.perp-margin input, .field input, .field select, .field textarea{ background: var(--bg-2); border-radius: 10px; }
.perp-side-tog{ gap: 6px; }
.perp-side-tog button{ border-radius: 10px; font-weight: 700; background: var(--surface); border-color: transparent; }
.perp-side-tog button.on.long{ background: var(--green); color: #06210f; }
.perp-side-tog button.on.short{ background: var(--red); color: #2a0707; }
.perp-levs, .perp-chips{ background: var(--bg-2); border: 1px solid var(--border); border-radius: 10px; padding: 3px; gap: 4px; }
.perp-levs button, .perp-chips button{ border: none; background: transparent; border-radius: 7px; font-family: var(--font-mono); font-weight: 600; }
.perp-chips button:hover{ background: var(--surface); }
.perp-metas, .swap-metas{ background: var(--bg-2); border-radius: 10px; font-family: var(--font-mono); }
.perp-metas > div span:first-child, .swap-meta span:first-child{ font-family: var(--font); color: var(--text-faint); }
.perp-mkt{ border-radius: 8px; font-family: var(--font-mono); font-weight: 600; }
.perp-lbl, .section-label{ letter-spacing: .06em; }
.review-line .v{ font-family: var(--font-mono); font-weight: 600; }
.addr-box{ font-family: var(--font-mono); background: var(--bg-2); }
.btn-primary.btn-lg, .btn-primary.btn-block{ border-radius: 11px; }
#view-send.active, #view-withdraw.active, #view-swap.active, #view-stake.active{ max-width: 520px; }
@media (max-width: 640px){
  .heatmap{ grid-template-columns: repeat(4, minmax(0, 1fr)); grid-auto-rows: 50px; gap: 3px; }
  .hm-tile{ padding: 5px 6px; }
  .hm-tile b{ font-size: 11px; } .hm-tile span{ font-size: 10.5px; } .hm-tile small{ display: none; }
  .hm-tile.xl b{ font-size: 15px; } .hm-tile.xl span{ font-size: 13px; } .hm-tile.xl small{ display: block; }
}

/* =======================================================================
   PHONE LAYER  — tab bar, slide-up ticket, landscape chart, flashes,
   pull-to-refresh, skeletons (js/phone.js + js/terminal.js)
   ======================================================================= */
:root{ --tabbar-h: 58px; }
.tabbar{ display: none; }
#screen-app.hidden ~ .tabbar{ display: none !important; }

@media (max-width: 760px){
  .rail{ display: none; }
  #screen-app{ grid-template-columns: 1fr; }
  .view.active{ padding-bottom: calc(var(--tabbar-h) + 28px + env(safe-area-inset-bottom)); }
  .tabbar{
    display: grid; grid-template-columns: repeat(5, 1fr);
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
    background: rgba(11,12,16,.92); backdrop-filter: blur(18px) saturate(1.3);
    border-top: 1px solid rgba(255,255,255,.07);
  }
  .tabbar button{ display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--text-faint); font-size: 10.5px; font-weight: 600; }
  .tabbar button svg{ width: 22px; height: 22px; }
  .tabbar button.on{ color: var(--accent); }
  .toast{ bottom: calc(var(--tabbar-h) + 24px + env(safe-area-inset-bottom)) !important; }
  .tm-dock{ bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); }
  /* every sheet becomes a bottom sheet on phones */
  .sheet-backdrop{ align-items: flex-end; }
  .sheet{ max-width: 100%; width: 100%; border-radius: 20px 20px 0 0; transform: translateY(100%); max-height: 86vh;
          padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
  .sheet-backdrop.show .sheet{ transform: translateY(0); }
  .sheet-grip{ display: block; }
}

/* More sheet */
.more-grid{ display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.more-item{ display: flex; align-items: center; gap: 10px; padding: 12px; text-align: left; border-radius: 12px; background: var(--panel); border: 1px solid var(--border); }
.more-item .ic{ width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-size: 15px; flex: 0 0 auto; }
.more-item b{ display: block; font-size: 13.5px; }
.more-item small{ display: block; font-size: 11px; color: var(--text-faint); margin-top: 1px; }

/* ---- slide-up order ticket (below the desktop breakpoint) ---- */
.tk-grip{ display: none; }
.tk-backdrop{ display: none; }
@media (max-width: 1099px){
  .tm-ticket{
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
    max-height: 72vh; overflow-y: auto; overscroll-behavior: contain;
    border-radius: 18px 18px 0 0; border-bottom: none;
    padding: 0 14px calc(16px + env(safe-area-inset-bottom));
    transform: translateY(105%); transition: transform .28s cubic-bezier(.2,.8,.2,1);
    box-shadow: 0 -20px 60px rgba(0,0,0,.55);
  }
  .tm-ticket.open{ transform: translateY(0); }
  .tk-grip{ display: block; position: sticky; top: 0; z-index: 2; height: 30px; margin: 0 -14px 6px; background: var(--panel); cursor: grab; touch-action: none; }
  .tk-grip i{ display: block; width: 40px; height: 4px; border-radius: 3px; background: var(--surface-3); margin: 12px auto 0; }
  .tk-close{ position: absolute; right: 10px; top: 4px; width: 28px; height: 24px; color: var(--text-faint); font-size: 13px; }
  .tk-backdrop{ display: block; position: fixed; inset: 0; z-index: 55; background: rgba(0,0,0,.35); opacity: 0; pointer-events: none; transition: opacity .25s; }
  .tk-backdrop.open{ opacity: 1; pointer-events: auto; }
  .tm-ticket.open ~ .tm-dock, .tk-backdrop.open ~ .tm-dock{ visibility: hidden; }
  .tm-dock{ display: grid; }
}

/* ---- chart extras ---- */
.tm-live{ margin-left: auto; padding: 5px 10px; border-radius: 7px; font-size: 11.5px; font-weight: 700; color: var(--accent-ink); background: var(--accent); }
.tm-fs-title{ display: none; }

/* ---- landscape phone: chart only, edge to edge ---- */
@media (orientation: landscape) and (max-height: 520px){
  body[data-view="token"] .topbar, body[data-view="token"] .ticker, body[data-view="token"] .rail,
  body[data-view="token"] .tabbar, body[data-view="token"] .tm-head, body[data-view="token"] .tm-stats,
  body[data-view="token"] .tm-blotter, body[data-view="token"] .tm-book, body[data-view="token"] .tm-extra,
  body[data-view="token"] .td-about, body[data-view="token"] .tm-dock, body[data-view="token"] .tm-ticket,
  body[data-view="token"] .tk-backdrop{ display: none !important; }
  body[data-view="token"] #screen-app{ grid-template-columns: 1fr; }
  body[data-view="token"] .tm-chart{
    position: fixed; inset: 0; z-index: 70; border-radius: 0; border: none;
    padding: 6px max(10px, env(safe-area-inset-right)) 4px max(10px, env(safe-area-inset-left));
  }
  body[data-view="token"] .tm-toolbar{ flex-direction: row; flex-wrap: nowrap; margin-bottom: 4px; }
  body[data-view="token"] .tm-fs-title{ display: flex; align-items: baseline; gap: 8px; margin-right: 6px; white-space: nowrap; }
  body[data-view="token"] .tm-fs-title b{ font-size: 14px; }
  body[data-view="token"] .tm-fs-title span{ font-family: var(--font-mono); font-size: 13px; }
}

/* ---- price tick flashes ---- */
@keyframes flUp{ 0%{ background: rgba(33,229,111,.28); } 100%{ background: transparent; } }
@keyframes flDn{ 0%{ background: rgba(252,109,109,.28); } 100%{ background: transparent; } }
.fl-up{ animation: flUp .7s ease-out; border-radius: 4px; }
.fl-dn{ animation: flDn .7s ease-out; border-radius: 4px; }
@media (prefers-reduced-motion: reduce){ .fl-up, .fl-dn{ animation: none; } }

/* ---- pull to refresh ---- */
.ptr{
  position: fixed; left: 50%; top: 74px; z-index: 45; width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center; background: var(--panel-2); border: 1px solid var(--border-2);
  transform: translate(-50%, -60px); opacity: 0; pointer-events: none; transition: opacity .15s;
  box-shadow: 0 8px 24px rgba(0,0,0,.4);
}
.ptr.show{ opacity: 1; }
.ptr-spin{ width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--surface-3); border-top-color: var(--accent); }
.ptr.ready .ptr-spin{ border-color: var(--accent); border-top-color: transparent; }
.ptr.spinning{ transition: transform .2s, opacity .15s; }
.ptr.spinning .ptr-spin{ animation: ptrSpin .7s linear infinite; }
@keyframes ptrSpin{ to{ transform: rotate(360deg); } }

/* ---- skeletons shaped like the new screens ---- */
.sk-wrap{ max-width: 1120px; margin: 0 auto; display: flex; flex-direction: column; gap: 12px; }
.sk-strip{ display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.sk-strip .sk{ height: 58px; }
.sk-chart{ height: 190px; }
.sk-chart.tall{ height: 300px; }
@media (max-width: 640px){ .sk-strip{ grid-template-columns: repeat(2, 1fr); } }
/* the sheet lives inside #screen-app's stacking context, the tab bar outside
   it — so sit the sheet on top of the tab bar instead of under it */
@media (max-width: 760px){
  .tm-ticket{ bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); max-height: calc(78vh - var(--tabbar-h)); padding-bottom: 14px; border-bottom: 1px solid var(--border); }
}
