/* Polytrend — Polymarket-inspired dark theme.
   Polymarket's actual brand uses a deep blue accent on a near-black
   canvas, not the magenta-on-white we shipped first. Switching to a
   black bg + blue primary reads as more "exchange/professional" and
   matches the reference site's contrast. */

:root {
  /* Black canvas with three layered surfaces — true dark UI rhythm.
     Each surface is slightly lighter than the one below so cards
     stand out without needing a hard border. */
  --bg: #0b0f17;
  --surface: #131822;
  --surface-2: #1a2030;
  --surface-3: #232a3d;
  --border: #2a3142;
  --text: #f1f5fb;
  --text-2: #a4afc4;
  --text-3: #6b7589;

  /* Blue primary — Polymarket-style ("electric blue"). The "soft"
     variant is for hovers/tints; the "2" is for pressed/active. */
  --primary: #3b82f6;
  --primary-2: #2563eb;
  --primary-soft: rgba(59, 130, 246, 0.12);

  /* Trade colors — slightly punchier than the light-theme defaults
     so they show through against the dark canvas. */
  --green: #1fd07c;
  --green-bg: rgba(31, 208, 124, 0.14);
  --green-soft: rgba(31, 208, 124, 0.10);
  --red: #ff4d6d;
  --red-bg: rgba(255, 77, 109, 0.14);
  --red-soft: rgba(255, 77, 109, 0.10);

  --blue: #3b82f6;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow: 0 4px 14px rgba(0,0,0,0.35);
  --shadow-lg: 0 12px 32px rgba(0,0,0,0.5);
  --radius: 10px;
  --radius-lg: 16px;
}

* { box-sizing: border-box; }
html, body, #app { height: 100%; }
body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, 'PingFang SC', sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
}
a { color: inherit; text-decoration: none; cursor: pointer; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 14px; }
.mono { font-family: 'SF Mono', Menlo, Consolas, monospace; font-variant-numeric: tabular-nums; }
.up { color: var(--green); }
.down { color: var(--red); }
.green-text { color: var(--green); }
.red-text { color: var(--red); }
.muted { color: var(--text-2); }
.tiny { font-size: 12px; color: var(--text-3); }

/* ---------- Live ticker strip at the very top ---------- */
/* Sits ABOVE the nav, slightly darker than --bg so it reads as a
   discrete strip rather than blending into the page. */
.ticker {
  background: #060912;
  border-bottom: 1px solid var(--border);
  overflow: hidden;
  height: 32px;
}
.ticker-track {
  display: flex; gap: 32px;
  white-space: nowrap;
  animation: ticker-scroll 90s linear infinite;
  padding-left: 16px; padding-right: 16px;
  height: 100%;
  align-items: center;
}
.ticker-track:hover { animation-play-state: paused; }
@keyframes ticker-scroll {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}
.ticker-item {
  display: inline-flex; align-items: center; gap: 8px;
  color: var(--text-2); font-size: 12px; cursor: pointer;
  transition: color 0.12s;
}
.ticker-item:hover { color: var(--text); }
.ticker-item img { width: 16px; height: 16px; border-radius: 50%; }
.t-sym { font-weight: 600; color: var(--text); }
.t-px { color: var(--text-2); font-variant-numeric: tabular-nums; }
.t-d { font-weight: 600; }
.t-d.up { color: var(--green); }
.t-d.down { color: var(--red); }

/* ---------- Top nav ---------- */
.nav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50;
}
.nav-inner {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 24px;
  height: 60px;
  display: flex; align-items: center; gap: 24px;
}
.brand {
  font-size: 22px; font-weight: 800; letter-spacing: -0.5px;
  color: var(--primary);
  display: flex; align-items: center; gap: 6px;
}
.brand .brand-logo {
  width: 26px; height: 26px;
  /* Slight drop shadow gives the hex a subtle lift on the dark nav. */
  filter: drop-shadow(0 1px 2px rgba(59, 130, 246, 0.35));
}
.brand .brand-logo + * { line-height: 1; }
.nav-links { display: flex; gap: 4px; }
.nav-links a {
  padding: 8px 14px; border-radius: 8px; color: var(--text-2);
  font-weight: 500; transition: all 0.12s;
}
.nav-links a.active, .nav-links a:hover {
  color: var(--text); background: var(--surface-2);
}
.nav-spacer { flex: 1; }
.nav-actions { display: flex; align-items: center; gap: 12px; }
.balance-pill {
  padding: 6px 14px; background: var(--surface-2); border-radius: 999px;
  display: flex; align-items: center; gap: 6px;
  cursor: pointer; transition: background 0.12s;
  border: 1px solid var(--border);
}
.balance-pill:hover { background: var(--surface-3); }
.balance-pill .muted { font-size: 11px; }
.balance-pill b { font-variant-numeric: tabular-nums; }

/* Account button (top right). Neutral icon button, not an initial bubble.
   Outlined style on dark surface so it reads as a "settings/account"
   affordance without screaming for attention. */
.avatar-menu { position: relative; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--surface-2);
  color: var(--text-2);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  transition: all 0.12s; cursor: pointer;
}
.avatar:hover {
  background: var(--surface-3); color: var(--text);
  border-color: var(--text-3);
}
.avatar svg { display: block; }
.dropdown {
  position: absolute; top: 44px; right: 0;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 6px;
  box-shadow: var(--shadow-lg);
  min-width: 220px; z-index: 50;
}
.dd-head { padding: 12px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.dd-name { font-weight: 700; font-size: 14px; }
.dd-email { color: var(--text-3); font-size: 12px; }
.dropdown a {
  display: block; padding: 8px 12px; border-radius: 6px;
  color: var(--text); font-size: 13px;
}
.dropdown a:hover { background: var(--surface-2); }
.dropdown a.danger { color: var(--red); }
.dropdown a.danger:hover { background: var(--red-bg); }
.dd-sep { height: 1px; background: var(--border); margin: 4px 0; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  height: 38px; padding: 0 16px; border-radius: 8px;
  font-weight: 600; border: 1px solid transparent; transition: all 0.12s;
  white-space: nowrap;
}
.btn-sm { height: 28px; padding: 0 10px; font-size: 12px; }
.btn-primary {
  background: var(--primary); color: white; border-color: var(--primary);
}
.btn-primary:hover { background: var(--primary-2); border-color: var(--primary-2); }
.btn-ghost {
  background: transparent; color: var(--text); border-color: var(--border);
}
.btn-ghost:hover { background: var(--surface-2); }
.btn-yes {
  flex: 1; height: 44px; background: var(--green-bg); color: var(--green);
  font-weight: 700; border: 1px solid transparent; border-radius: 8px;
}
.btn-yes:hover, .btn-yes.active { background: var(--green); color: white; }
.btn-no {
  flex: 1; height: 44px; background: var(--red-bg); color: var(--red);
  font-weight: 700; border: 1px solid transparent; border-radius: 8px;
}
.btn-no:hover, .btn-no.active { background: var(--red); color: white; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---------- Layout ---------- */
.page {
  max-width: 1440px; margin: 0 auto; padding: 24px;
}
.h1 { font-size: 28px; font-weight: 800; letter-spacing: -0.5px; margin: 0 0 4px; }
.h2 { font-size: 20px; font-weight: 700; margin: 0 0 16px; letter-spacing: -0.3px; }

/* ---------- Hero / stats strip on home ---------- */
.hero {
  background:
    radial-gradient(ellipse at top right, rgba(59,130,246,0.18), transparent 55%),
    radial-gradient(ellipse at bottom left, rgba(31,208,124,0.08), transparent 50%),
    var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  display: grid; grid-template-columns: 1fr auto;
  gap: 32px; align-items: center;
  margin-bottom: 24px;
  position: relative; overflow: hidden;
}
.hero::after {
  content: ''; position: absolute; right: -120px; top: -120px;
  width: 320px; height: 320px;
  background: radial-gradient(circle, rgba(59,130,246,0.25), transparent 60%);
  pointer-events: none;
}
.hero-eyebrow {
  font-size: 12px; font-weight: 700; color: var(--primary);
  text-transform: uppercase; letter-spacing: 1.5px; margin-bottom: 12px;
}
.hero-title {
  font-size: 36px; font-weight: 800; line-height: 1.15;
  letter-spacing: -1px; margin: 0 0 8px;
  background: linear-gradient(135deg, var(--text) 30%, var(--primary) 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero-sub { color: var(--text-2); margin: 0; max-width: 540px; line-height: 1.5; }

/* Bridge button at the bottom of HomePage that takes the user to the
   full /market list — keeps Home itself short while still linking the
   user into the deeper catalog. */
.home-cta-row { display: flex; justify-content: center; margin-top: 28px; }
.home-cta-row .btn { padding: 0 22px; height: 44px; font-weight: 700; }

/* ---------- Me hub + sub-pages ---------- */
/* Identity card at the top of the Me hub. */
.me-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; padding: 18px 20px;
  margin-bottom: 18px;
}
.me-card-head {
  display: flex; align-items: center; gap: 14px; margin-bottom: 14px;
}
.me-avatar {
  width: 52px; height: 52px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #6366f1);
  color: white; display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 800;
  flex-shrink: 0;
}
.me-name { font-size: 17px; font-weight: 700; }
.me-email { word-break: break-all; }

/* Copyable identity rows in the Me-hub identity card. Each row is a
   button that toasts on click. Address/email gets ellipsis on
   overflow so the row never wraps awkwardly on small screens. */
.me-copy-line {
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: 4px; padding: 2px 8px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 12px; color: var(--text-2);
  cursor: pointer;
  max-width: 100%;
  transition: all 0.12s;
}
.me-copy-line + .me-copy-line { margin-left: 6px; }
.me-copy-line:hover { color: var(--text); border-color: var(--primary); background: var(--primary-soft); }
.me-copy-line:active { transform: scale(0.98); }
.me-copy-line .me-copy-mono {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  letter-spacing: -0.2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 220px;
}
.me-copy-line .me-copy-chain,
.me-copy-line .me-copy-label {
  font-weight: 700; font-size: 10px;
  padding: 1px 6px; border-radius: 4px;
  background: var(--primary); color: white;
  text-transform: uppercase; letter-spacing: 0.5px;
}
.me-copy-line svg { opacity: 0.6; flex-shrink: 0; }
.me-copy-line:hover svg { opacity: 1; }

/* Field-styled copy row used on the Profile sub-page. Sized to match
   a disabled <input> so it lines up with other form fields. */
.copy-input {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
}
.copy-input:hover { border-color: var(--primary); background: var(--primary-soft); }
.copy-input:active { transform: scale(0.997); }
.copy-input .copy-hint {
  font-size: 11px; font-weight: 700;
  padding: 3px 8px; border-radius: 999px;
  background: var(--primary); color: white;
  flex-shrink: 0;
}
.copy-input .mono {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 13px; color: var(--text);
}
.me-balance-row {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
  padding-top: 14px; border-top: 1px solid var(--surface-3);
}
.me-balance { font-size: 24px; font-weight: 800; letter-spacing: -0.5px; }
.me-quick-cta { display: flex; gap: 8px; flex-wrap: wrap; }

/* Menu list rows that link to each sub-page. */
.me-menu {
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; overflow: hidden;
}
.me-row {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 18px; text-decoration: none; color: var(--text);
  border-top: 1px solid var(--surface-3);
  cursor: pointer;
  transition: background 0.12s;
}
.me-row:first-child { border-top: 0; }
.me-row:hover { background: var(--surface-2); }
.me-icon {
  width: 38px; height: 38px; border-radius: 10px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
}
.me-row-text { flex: 1; min-width: 0; }
.me-row-title { font-weight: 600; font-size: 15px; }
.me-row-sub { margin-top: 2px; }
.me-row-chev {
  font-size: 22px; color: var(--text-3); flex-shrink: 0;
  font-weight: 300;
}

/* Transfer modal — from / to side-by-side with a swap button between. */
.xfer-row {
  display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px;
  align-items: end; margin-bottom: 14px;
}
.xfer-side label {
  display: block; font-size: 12px; color: var(--text-2);
  margin-bottom: 6px; font-weight: 600;
}
.xfer-select {
  width: 100%; padding: 10px 12px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text); font-size: 14px;
}
.xfer-swap {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--primary-soft); color: var(--primary);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: transform 0.15s, background 0.12s;
}
.xfer-swap:hover { background: var(--primary); color: white; transform: rotate(180deg); }

/* Sub-page header: back button + title in a row. */
.sub-page-head {
  display: flex; align-items: center; gap: 12px; margin-bottom: 18px;
}
.back-btn {
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text-2); font-weight: 600;
  padding: 8px 14px; border-radius: 10px; cursor: pointer;
  transition: all 0.12s;
}
.back-btn:hover { color: var(--text); border-color: var(--primary); }

/* Toggle rows on Settings page — checkbox aligned to the right. */
.toggle-row {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 0;
  border-top: 1px solid var(--surface-3);
  cursor: pointer;
}
.toggle-row:first-child { border-top: 0; padding-top: 0; }
.toggle-row input[type="checkbox"] {
  width: 18px; height: 18px; accent-color: var(--primary);
  cursor: pointer;
}

/* ---------- HomePage sections ---------- */
/* Each home-section is a vertical block with a heading row and content
   underneath. Margin-top spaces them out without a hard divider. */
.home-section { margin-top: 36px; }
.home-section .section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; margin-bottom: 14px;
}
.home-section .section-head h2 { margin: 0; font-size: 20px; font-weight: 700; }
.home-section .section-head a { text-decoration: none; }
.home-section .section-head a:hover { color: var(--primary); }

/* Live winners marquee. Horizontal scrolling band of recent wins —
   social proof that this site is alive. CSS-only animation, infinite
   loop achieved by duplicating the chip list inline (Vue template). */
.live-dot {
  display: inline-flex; align-items: center; gap: 4px;
  color: var(--green);
}
.winners-section .section-head { margin-bottom: 8px; }
.winners-marquee {
  position: relative; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 10px 0;
  /* Soft fade at the edges so chips don't snap on/off harshly. */
  mask-image: linear-gradient(90deg, transparent 0, #000 5%, #000 95%, transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 5%, #000 95%, transparent);
}
.winners-track {
  display: flex; gap: 18px; width: max-content;
  animation: marquee 60s linear infinite;
}
.winners-marquee:hover .winners-track { animation-play-state: paused; }
.winner-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 6px 14px; font-size: 13px;
  background: var(--surface-2); border-radius: 999px;
  white-space: nowrap;
}
@keyframes marquee {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

/* "How it works" 3-step grid */
.hiw-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px;
}
.hiw-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; padding: 22px;
  position: relative; overflow: hidden;
  transition: transform 0.15s, border-color 0.15s;
}
.hiw-card:hover { transform: translateY(-2px); border-color: var(--primary); }
.hiw-card .hiw-num {
  font-size: 38px; font-weight: 800;
  background: linear-gradient(135deg, var(--primary), #6366f1);
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
  line-height: 1; margin-bottom: 8px;
}
.hiw-card h3 { margin: 0 0 6px; font-size: 16px; }
.hiw-card p  { margin: 0; font-size: 13px; line-height: 1.5; }

/* Featured yield grid — three mini-cards bridging into /finance */
.yield-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.yield-mini {
  display: flex; flex-direction: column; gap: 8px;
  padding: 18px; cursor: pointer; text-align: left;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px;
  transition: transform 0.15s, border-color 0.15s;
}
.yield-mini:hover { transform: translateY(-2px); border-color: var(--primary); }
.yield-mini .yield-tag {
  align-self: flex-start;
  padding: 3px 10px; font-size: 11px; font-weight: 700;
  background: var(--primary-soft); color: var(--primary);
  border-radius: 999px;
}
.yield-mini h3 { margin: 0; font-size: 16px; }
.yield-mini .yield-apr {
  display: flex; align-items: baseline; gap: 8px;
  padding: 10px 12px; border-radius: 10px;
  background: linear-gradient(135deg, rgba(31,163,99,0.12), rgba(59,130,246,0.10));
  border: 1px solid rgba(31,163,99,0.25);
}
.yield-mini .apr-num {
  font-size: 26px; font-weight: 800;
  color: var(--green); letter-spacing: -0.5px;
}
.yield-mini .apr-label { font-size: 12px; color: var(--text-2); }
.yield-mini .yield-meta { display: flex; gap: 6px; }

/* Trust strip — line-art icon + label rows in a flex band */
.trust-strip {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px;
  padding: 22px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px;
}
.trust-item {
  display: flex; align-items: flex-start; gap: 12px;
}
.trust-item svg {
  flex-shrink: 0;
  width: 40px; height: 40px; padding: 9px;
  border-radius: 10px;
  background: var(--primary-soft); color: var(--primary);
  box-sizing: border-box;
}
.trust-item .trust-h { font-weight: 700; font-size: 14px; margin-bottom: 2px; }

/* Mobile collapse */
@media (max-width: 980px) {
  .hiw-grid, .yield-grid { grid-template-columns: 1fr; }
  .trust-strip { grid-template-columns: 1fr 1fr; }
  .home-section .section-head h2 { font-size: 18px; }
  .winners-track { animation-duration: 40s; }
}

.stats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px;
}
.stat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 14px 18px;
  min-width: 120px;
}
.stat-l { font-size: 11px; color: var(--text-3); font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.5px; }
.stat-v { font-size: 20px; font-weight: 800; margin-top: 4px; letter-spacing: -0.5px; }

/* ---------- Hot row (featured cards) ---------- */
.hot-row {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px;
  margin-bottom: 24px;
}
.hot-card {
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; background: var(--surface);
  cursor: pointer; transition: all 0.15s;
  position: relative; overflow: hidden;
}
.hot-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.hot-card::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
}
.hot-card.hot-green::before { background: var(--green); }
.hot-card.hot-red::before   { background: var(--red); }
.hot-card.hot-pink::before  { background: var(--primary); }
.hot-tag {
  font-size: 11px; font-weight: 700; color: var(--text-3);
  text-transform: uppercase; letter-spacing: 0.5px;
}
.hot-mid {
  display: flex; align-items: center; gap: 12px; margin: 8px 0;
}
.hot-sym { font-size: 16px; font-weight: 700; }
.hot-px { font-variant-numeric: tabular-nums; color: var(--text-2); font-size: 13px; }
.hot-foot {
  display: flex; justify-content: space-between; font-weight: 600;
  font-size: 13px;
}

/* ---------- Markets grid ---------- */
.cat-pills {
  display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px;
}
.cat-pills button {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 999px; padding: 8px 14px; font-weight: 600;
  color: var(--text-2); display: inline-flex; align-items: center; gap: 6px;
  transition: all 0.12s;
}
.cat-pills button:hover { color: var(--text); border-color: var(--text-3); }
.cat-pills button.active {
  background: var(--primary); color: white; border-color: var(--primary);
}
/* Numbered step indicators on /help — replaced the per-card emoji
   with a typographic numeral so the page reads like a real product
   walkthrough rather than emoji-spam. */
.step-num {
  font-size: 13px; font-weight: 800;
  color: var(--primary); letter-spacing: 1px;
  margin-bottom: 6px;
}

.tabs {
  display: flex; gap: 4px; margin-bottom: 20px; flex-wrap: wrap;
  border-bottom: 1px solid var(--border); align-items: center;
}
.tabs button {
  background: none; border: 0; padding: 10px 16px; color: var(--text-2);
  font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabs button.active { color: var(--primary); border-bottom-color: var(--primary); }
.search-inline {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 12px; outline: 0; width: 200px;
}
/* (.view-toggle removed — Markets layout is now breakpoint-driven,
   no manual grid/list switch.) */

.grid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px;
  transition: all 0.15s; display: flex; flex-direction: column; gap: 12px;
  cursor: pointer;
}
.card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.card-head { display: flex; align-items: flex-start; gap: 12px; }
.card-icon {
  width: 44px; height: 44px; border-radius: 10px;
  background: linear-gradient(135deg, #3b82f6, #1652f0);
  display: flex; align-items: center; justify-content: center;
  color: white; font-weight: 800; font-size: 16px; flex-shrink: 0;
}
.coin-icon {
  border-radius: 50%; flex-shrink: 0; overflow: hidden;
  background: var(--surface-2);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-2); font-weight: 800; font-size: 14px;
}
.coin-icon img { width: 100%; height: 100%; object-fit: cover; display: block; }
.coin-icon span { letter-spacing: -0.5px; }
.card-title {
  font-weight: 600; line-height: 1.3; font-size: 15px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  /* Always uppercase + always light: trading pairs are an identifier,
     not body copy. CSS-level enforcement covers any future rendering
     site we forget to .toUpperCase() on. */
  text-transform: uppercase; color: var(--text);
}
.hot-sym, .picker-sym, .market-head h1, .quick-markets button {
  text-transform: uppercase; color: var(--text);
}
.orders td:first-child {
  color: var(--text);
  text-transform: uppercase; /* trading pair shown in the first column */
}
.market-table td.cell-sym { color: var(--text); }
.market-table td.cell-sym .tiny { text-transform: uppercase; }
.card-pct {
  font-size: 28px; font-weight: 800; letter-spacing: -1px;
}
.card-meta {
  display: flex; justify-content: space-between;
  font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums;
}

/* ---------- Mobile sort pills (above the market list) ---------- */
.m-sort-row {
  display: flex; gap: 6px; padding: 10px 10px 4px;
  overflow-x: auto; flex-wrap: nowrap;
  border-bottom: 1px solid var(--surface-3);
}
.m-sort-row button {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 999px; padding: 6px 14px; font-size: 12px;
  font-weight: 700; color: var(--text-2);
  white-space: nowrap; cursor: pointer;
  transition: all 0.12s;
}
.m-sort-row button.active {
  background: var(--primary); color: white; border-color: var(--primary);
}

/* ---------- Mobile market list rows ---------- */
.m-rows { display: flex; flex-direction: column; }
.m-row {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 14px;
  background: transparent; border: 0;
  border-bottom: 1px solid var(--surface-3);
  cursor: pointer; text-align: left; width: 100%;
  color: var(--text);
  transition: background 0.12s;
}
.m-row:hover, .m-row:active { background: var(--surface-2); }
.m-row:last-child { border-bottom: 0; }
.m-row-mid { flex: 1; min-width: 0; }
.m-row-sym { font-weight: 700; font-size: 14px; text-transform: uppercase; }
.m-row-px { text-align: right; font-variant-numeric: tabular-nums; }
.m-row-px .mono { font-weight: 600; }

/* ---------- Markets table view (desktop) ---------- */
.market-table {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
}
.market-table table { width: 100%; border-collapse: collapse; }
.market-table th, .market-table td {
  padding: 12px 16px; text-align: left; font-size: 13px;
}
.market-table th {
  color: var(--text-3); font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.5px; font-size: 11px;
  border-bottom: 1px solid var(--border); background: var(--surface-2);
}
.market-table th.ck { cursor: pointer; user-select: none; }
.market-table th.ck:hover { color: var(--text); }
.market-table td { border-bottom: 1px solid var(--surface-3); }
.market-table tr:hover td { background: var(--surface-2); cursor: pointer; }
.market-table tr:last-child td { border-bottom: 0; }
.cell-sym { display: flex; align-items: center; gap: 10px; }

/* ---------- Trade page ---------- */
.trade-page { max-width: 1600px; }
.quick-markets {
  display: flex; gap: 8px; overflow-x: auto; margin-bottom: 16px;
  padding-bottom: 4px;
}
.quick-markets button {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 6px 12px;
  display: inline-flex; align-items: center; gap: 6px;
  font-weight: 600; font-size: 13px;
  white-space: nowrap; transition: all 0.12s;
}
.quick-markets button:hover { border-color: var(--primary); }
.quick-markets button.active { background: var(--primary); color: white; border-color: var(--primary); }
.quick-markets button.active span { color: white !important; }
.quick-markets img { width: 18px; height: 18px; border-radius: 50%; }
.quick-markets span { font-size: 12px; }

.trade-layout3 {
  display: grid; grid-template-columns: 1fr 280px 320px; gap: 16px;
  align-items: start;
}
.trade-main { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.trade-side-l, .trade-side-r {
  display: flex; flex-direction: column; gap: 16px;
  position: sticky; top: 80px;
}
.panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px;
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px;
}
.panel-head h3 { font-size: 13px; margin: 0; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-2); }
.market-head-panel { padding: 20px; }
.market-head { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; }
.market-head h1 { font-size: 22px; margin: 0 0 4px; font-weight: 800; }
.price-big {
  font-size: 32px; font-weight: 800; letter-spacing: -1px; line-height: 1;
  font-variant-numeric: tabular-nums;
}
.price-row { display: flex; align-items: baseline; gap: 12px; }
.delta { font-size: 14px; font-weight: 600; }
.stat-row {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 16px; padding-top: 16px; border-top: 1px solid var(--surface-3);
}
.stat-row > div > .mono { font-size: 14px; font-weight: 600; margin-top: 2px; }

/* Trade product tab strip. Reuses the .finance-tabs visual so both
   pages share one tab idiom. The local tweaks: a margin-bottom that
   separates the strip from the next block, and a slightly stronger
   active state (primary blue) since the trade page has a busier
   header below it. */
.trade-mode-tabs { margin-bottom: 16px; }
.trade-mode-tabs button.active {
  background: var(--primary); color: white;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.35);
}
.trade-mode-tabs button:disabled { opacity: 0.6; cursor: progress; }
.trade-mode-tabs.loading {
  /* Subtle pulse on the whole strip so the user sees that *something*
     is happening even before the panel below repaints. */
  animation: tab-strip-pulse 1.4s ease-in-out infinite;
}
@keyframes tab-strip-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0); }
  50%      { box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.12); }
}

/* Form-area skeleton — shown for ~380ms while switching trade
   products, fades out as the real form fades in. The shimmer band
   makes it read as "data being fetched" rather than "broken layout". */
.form-skeleton {
  position: relative;
  display: flex; flex-direction: column; gap: 12px;
  min-height: 280px;
  animation: skeleton-fade-in 0.18s ease-out;
}
.form-skeleton .sk-line {
  height: 14px; border-radius: 6px;
  background: linear-gradient(
    90deg,
    var(--surface-2) 0%,
    var(--surface-3) 50%,
    var(--surface-2) 100%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.2s linear infinite;
}
.form-skeleton .sk-line.w90 { width: 90%; }
.form-skeleton .sk-line.w80 { width: 80%; }
.form-skeleton .sk-line.w70 { width: 70%; }
.form-skeleton .sk-line.w60 { width: 60%; }
.form-skeleton .sk-line.w50 { width: 50%; }
.form-skeleton .sk-line.w40 { width: 40%; }
.form-skeleton .sk-spinner {
  width: 28px; height: 28px; border-radius: 50%;
  margin: 0 auto 12px;
  border: 3px solid var(--surface-3);
  border-top-color: var(--primary);
  animation: sk-spin 0.8s linear infinite;
}
@keyframes sk-spin { to { transform: rotate(360deg); } }
@keyframes skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
@keyframes skeleton-fade-in { from { opacity: 0; } to { opacity: 1; } }

/* Real form fades in after the skeleton — slight upward slide gives
   the swap a sense of momentum without being theatrical. */
.form-fade { animation: form-fade-in 0.24s ease-out; }
@keyframes form-fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Market / Limit selector for spot form */
.ot-tabs {
  display: flex; gap: 4px; padding: 4px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 10px; margin-bottom: 14px;
}
.ot-tabs button {
  flex: 1; background: transparent; border: 0;
  padding: 8px 12px; font-size: 13px; font-weight: 700;
  color: var(--text-2); border-radius: 6px; cursor: pointer;
  transition: all 0.12s;
}
.ot-tabs button:hover:not(.active) { color: var(--text); }
.ot-tabs button.active {
  background: var(--primary); color: white;
}

/* "Balance: X · ⇄ Transfer" label — the Transfer button is anchored
   to the right edge of the row so the balance text wraps naturally
   on narrow widths instead of getting eaten by the button. */
.bal-label {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; flex-wrap: wrap;
}
.xfer-mini {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 999px; padding: 4px 12px;
  font-size: 11px; font-weight: 700; color: var(--text-2);
  cursor: pointer; transition: all 0.12s; line-height: 1;
  white-space: nowrap;
}
.xfer-mini:hover { border-color: var(--primary); color: var(--text); background: var(--surface); }

/* Mobile orders list — compact tappable cards. Each row shows just
   enough to scan (direction / pair / status / pnl) with the rest
   reachable via the detail modal. Replaces the cramped 7-column
   table that overflowed on narrow screens. */
.mobile-orders { display: flex; flex-direction: column; gap: 8px; padding: 8px 0; }
.m-order-row {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 12px 14px;
  cursor: pointer; transition: background 0.12s, border-color 0.12s;
}
.m-order-row:hover, .m-order-row:active { background: var(--surface-2); border-color: var(--primary); }
.m-order-l { display: flex; align-items: center; gap: 12px; min-width: 0; flex: 1; }
.m-order-meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.m-order-sym { font-weight: 700; font-size: 14px; color: var(--text); }
.m-order-r {
  display: flex; flex-direction: column; align-items: flex-end; gap: 4px;
  margin-left: 8px; flex-shrink: 0;
}
.m-order-pnl { font-size: 13px; font-weight: 700; }

/* Order detail modal — large readable rows, color-coded P&L. */
.od-head {
  display: flex; align-items: center; gap: 10px;
  padding-bottom: 14px; margin-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.od-sym { flex: 1; font-size: 16px; font-weight: 700; color: var(--text); }
.od-grid { display: flex; flex-direction: column; gap: 10px; }
.od-row {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 14px; color: var(--text-2);
}
.od-row .mono { color: var(--text); }
.od-row.up   span:last-child { color: var(--green); }
.od-row.down span:last-child { color: var(--red); }
.od-actions {
  display: flex; gap: 10px; margin-top: 18px;
}
.od-actions .btn { flex: 1; height: 44px; }

/* "Your spot holdings" quick-switch chips, shown under the spot
   sell input when the user has 0 of the current market base coin
   but holds other coins. */
.spot-holdings { margin-top: 12px; }
.holding-chip {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 999px; padding: 6px 12px;
  font-size: 12px; font-weight: 600; color: var(--text-2);
  cursor: pointer; transition: all 0.12s;
}
.holding-chip:hover { border-color: var(--primary); color: var(--text); }
.holding-chip.active {
  background: var(--primary); border-color: var(--primary); color: white;
}

/* Leverage chip selector for perpetual form */
.lev-chips { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.lev-chips button {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 0;
  font-size: 13px; font-weight: 700; color: var(--text-2);
  cursor: pointer; transition: all 0.12s;
}
.lev-chips button:hover { border-color: var(--primary); color: var(--text); }
.lev-chips button.active {
  background: var(--primary-soft); border-color: var(--primary);
  color: var(--primary);
}

.kline-periods {
  display: flex; gap: 4px; padding: 4px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; width: fit-content;
}
.kline-periods button {
  background: transparent; border: 0; padding: 4px 12px;
  font-size: 12px; font-weight: 600; color: var(--text-2);
  border-radius: 6px;
}
.kline-periods button.active { background: var(--primary); color: white; }
.chart-box {
  height: 460px; position: relative;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
}
.kline-host { width: 100%; height: 100%; position: absolute; inset: 0; }

/* ---------- Order book ---------- */
.ob-cols {
  display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 4px;
  font-size: 11px; color: var(--text-3); font-weight: 600;
  padding: 0 4px 8px; border-bottom: 1px solid var(--surface-3);
  text-transform: uppercase; letter-spacing: 0.4px;
}
.ob-rows { display: flex; flex-direction: column; }
.ob-asks { padding: 6px 0; }
.ob-bids { padding: 6px 0; }
.ob-row {
  position: relative; display: grid; grid-template-columns: 1fr 1fr 1fr;
  gap: 4px; padding: 3px 4px; font-size: 12px;
  font-variant-numeric: tabular-nums; cursor: default;
}
.ob-bg {
  position: absolute; right: 0; top: 0; bottom: 0;
  opacity: 0.35; pointer-events: none;
}
.ob-bg.green { background: linear-gradient(90deg, transparent, var(--green-soft)); }
.ob-bg.red   { background: linear-gradient(90deg, transparent, var(--red-soft)); }
.ob-mid {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 8px; border-top: 1px solid var(--surface-3);
  border-bottom: 1px solid var(--surface-3); margin: 4px 0;
  font-variant-numeric: tabular-nums; font-weight: 700;
  background: var(--surface-2);
}
.ob-mid .green-text { font-size: 14px; }

/* ---------- Recent trades ---------- */
.trade-tape {
  max-height: 260px; overflow-y: auto;
}
.trade-row {
  display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 4px;
  padding: 3px 4px; font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.trade-row:hover { background: var(--surface-2); }

/* ---------- Order form ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 12px; color: var(--text-2); font-weight: 600; }
.field input, .field select {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px 12px; outline: none;
  color: var(--text);          /* user-typed text on dark surface */
  transition: border-color 0.12s;
}
.field input::placeholder { color: var(--text-3); }
.field input:focus, .field select:focus { border-color: var(--primary); }
.field input[disabled] { background: var(--surface-3); color: var(--text-3); }
/* Same precaution for other free inputs: search box, picker search,
   anywhere outside .field that the browser would default to black text. */
input, select, textarea { color: var(--text); }
input::placeholder, textarea::placeholder { color: var(--text-3); }
.amounts {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 6px;
}
.amounts button {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 6px; padding: 6px 0; font-size: 12px; font-weight: 600;
  color: var(--text-2);
}
.amounts button.active, .amounts button:hover { border-color: var(--primary); color: var(--primary); }
.cycles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.cycles button {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 6px; padding: 8px; font-size: 13px; font-weight: 600;
  color: var(--text); display: flex; flex-direction: column; gap: 2px;
}
.cycles button.active {
  border-color: var(--primary); color: var(--primary); background: var(--primary-soft);
}
.cycles button .pct { font-size: 11px; color: var(--text-3); }
.cycles button.active .pct { color: var(--primary); }

.summary {
  background: var(--surface-2); border-radius: 8px; padding: 12px;
  display: flex; flex-direction: column; gap: 6px; font-size: 13px;
}
.summary .row { display: flex; justify-content: space-between; }
.summary .row .v { font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.summary .row.profit .v { color: var(--green); font-size: 18px; }

/* ---------- Orders list ---------- */
.orders {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
}
.orders table { width: 100%; border-collapse: collapse; }
.orders th, .orders td { padding: 12px 16px; text-align: left; font-size: 13px; }
.orders th {
  color: var(--text-3); font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.5px; font-size: 11px;
  border-bottom: 1px solid var(--border); background: var(--surface-2);
}
.orders td { border-bottom: 1px solid var(--surface-3); font-variant-numeric: tabular-nums; }
.orders tr:last-child td { border-bottom: 0; }
.pill {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 700;
}
.pill.green { background: var(--green-bg); color: var(--green); }
.pill.red { background: var(--red-bg); color: var(--red); }
.pill.gray { background: var(--surface-2); color: var(--text-2); }

/* ---------- Mobile order cards (Activity page) ---------- */
/* Replaces the 8-column desktop table on phones. Each order
   becomes a stacked card so all fields stay visible without
   horizontal scroll. */
.order-cards {
  display: flex; flex-direction: column; gap: 10px;
}
.order-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px;
  display: flex; flex-direction: column; gap: 8px;
}
.oc-head {
  display: flex; align-items: center; gap: 8px;
  flex-wrap: wrap;
}
.oc-sym {
  font-weight: 700; font-size: 15px; flex: 1;
  text-transform: uppercase;
}
.oc-meta {
  display: flex; gap: 6px; font-size: 12px; color: var(--text-2);
  align-items: center;
}
.oc-meta b {
  color: var(--text); font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.oc-prices {
  display: grid; grid-template-columns: 1fr auto 1fr;
  gap: 12px; align-items: center;
  padding: 8px 10px; background: var(--surface-2);
  border-radius: 8px;
}
.oc-arrow { color: var(--text-3); font-size: 16px; }
.oc-prices .mono { font-weight: 600; }
.oc-pnl {
  display: flex; justify-content: space-between; align-items: center;
  padding-top: 6px; border-top: 1px solid var(--surface-3);
  font-size: 14px;
}
.oc-pnl .mono { font-weight: 700; font-size: 15px; }

/* ---------- Portfolio ---------- */
.portfolio-hero {
  background:
    radial-gradient(ellipse at top right, rgba(59,130,246,0.20), transparent 55%),
    var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 28px;
  display: flex; justify-content: space-between; align-items: flex-start;
  flex-wrap: wrap; gap: 16px;
}
.hero-balance {
  font-size: 40px; font-weight: 800; letter-spacing: -1px; line-height: 1;
  margin-top: 6px; font-variant-numeric: tabular-nums;
}
.bucket-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}
.bucket-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  padding-bottom: 10px; border-bottom: 1px solid var(--surface-3); margin-bottom: 6px;
}
.bucket-head + table td { padding: 6px 0; }

/* ---------- Login ---------- */
.auth-wrap {
  min-height: calc(100vh - 92px);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.auth-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; padding: 32px; width: 100%; max-width: 400px;
  box-shadow: var(--shadow);
}
.auth-card h2 { margin: 0 0 4px; font-size: 24px; font-weight: 800; }
.auth-card .sub { color: var(--text-2); margin-bottom: 20px; font-size: 14px; }
.auth-tabs {
  display: flex; gap: 4px; background: var(--surface-2); padding: 4px;
  border-radius: 10px; margin-bottom: 20px;
}
.auth-tabs button {
  flex: 1; background: transparent; border: 0; padding: 8px;
  border-radius: 6px; font-weight: 600; color: var(--text-2);
}
.auth-tabs button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* Wallet sign-in button (MetaMask / EVM injected provider). Distinct
   neutral surface styling so it doesn't compete with the primary
   email submit. */
.btn-wallet {
  width: 100%; height: 46px; margin-bottom: 16px;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text); font-weight: 700; font-size: 14px;
  cursor: pointer; transition: all 0.12s;
}
.btn-wallet:hover {
  border-color: var(--primary);
  background: var(--surface-3);
}
.btn-wallet:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-wallet svg { flex-shrink: 0; }
.auth-divider {
  text-align: center; margin: 4px 0 16px;
  position: relative; color: var(--text-3); font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.8px;
}
.auth-divider::before {
  content: ''; position: absolute; left: 0; right: 0; top: 50%;
  height: 1px; background: var(--border); z-index: 0;
}
.auth-divider span {
  position: relative; z-index: 1; padding: 0 12px;
  background: var(--surface);
}

/* Support page cards */
.support-card {
  display: flex; flex-direction: column; gap: 4px;
  text-align: left; cursor: pointer;
  transition: all 0.15s;
}
.support-card:hover { transform: translateY(-2px); border-color: var(--primary); }
/* Each support card now opens with an inline SVG glyph (line-art
   icon) — replaces the emoji that read as AI-generated. */
.support-card .support-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: 10px;
  background: var(--primary-soft); color: var(--primary);
  margin-bottom: 8px;
}
.support-card h3 { margin: 0; font-size: 16px; }
.support-card p { margin: 0; font-size: 13px; }

/* ---------- Finance page ---------- */
.finance-page .finance-tabs {
  display: inline-flex; gap: 6px; padding: 4px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 12px; margin-bottom: 18px;
}
.finance-tabs button {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 16px; border: 0; background: transparent;
  color: var(--text-2); font-weight: 600; font-size: 14px;
  border-radius: 8px; cursor: pointer;
  transition: all 0.12s;
}
.finance-tabs button.active {
  background: var(--surface-3); color: var(--text);
}
.finance-tabs button:hover:not(.active) { color: var(--text); }
.finance-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.finance-card {
  display: flex; flex-direction: column; gap: 12px;
  padding: 18px;
  transition: transform 0.15s, border-color 0.15s;
}
.finance-card:hover { transform: translateY(-2px); border-color: var(--primary); }
.finance-card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.finance-card-head h3 { margin: 0; font-size: 16px; }
.finance-desc { margin: 0; font-size: 13px; line-height: 1.5; min-height: 38px; }
.finance-apr {
  display: flex; align-items: baseline; gap: 8px;
  padding: 12px 14px; border-radius: 10px;
  background: linear-gradient(135deg, rgba(31,163,99,0.12), rgba(59,130,246,0.10));
  border: 1px solid rgba(31,163,99,0.25);
}
.finance-apr .apr-num {
  font-size: 28px; font-weight: 800;
  color: var(--green); letter-spacing: -0.5px;
}
.finance-apr .apr-label { font-size: 12px; color: var(--text-2); }
.finance-meta {
  display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px;
  font-size: 13px;
}
.finance-meta > div { display: flex; justify-content: space-between; gap: 8px; }
.finance-meta b { font-weight: 700; color: var(--text); }
.finance-stake { width: 100%; height: 42px; }

/* Risk pill colors. green/red are reused from order-direction pills;
   yellow only appears here so we define it inline. */
.pill.yellow { background: rgba(234, 179, 8, 0.18); color: #facc15; }
.pill.blue   { background: rgba(96, 165, 250, 0.16); color: #93c5fd; }

/* Activity-page tab strip — same look as the Earn finance-tabs but
   with smaller buttons since we have 5 tabs to fit. */
.activity-tabs button {
  padding: 8px 14px; font-size: 13px;
}

/* Announcement Center — list of platform notices / market news.
   Same compact tappable row pattern as the mobile orders list, with
   a slight extra preview line so the user can scan content. */
.announce-list { display: flex; flex-direction: column; gap: 8px; }
.announce-row {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 14px;
  cursor: pointer; transition: background 0.12s, border-color 0.12s;
}
.announce-row:hover { background: var(--surface-2); border-color: var(--primary); }
.announce-row-l { flex: 1; min-width: 0; }
.announce-title {
  font-weight: 700; color: var(--text); font-size: 14px;
  margin-bottom: 4px; line-height: 1.3;
}
.announce-preview {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; line-height: 1.4;
}
.announce-row-r {
  display: flex; align-items: center; gap: 10px; flex-shrink: 0;
}
/* Detail-modal body: the seed corpus ships HTML, so we let it render
   but tighten the line-height + spacing so it doesn't look like a
   1990s news page. */
.announce-body { font-size: 14px; line-height: 1.65; color: var(--text-2); }
.announce-body p { margin: 0 0 12px; }
.announce-body strong, .announce-body b { color: var(--text); }
.announce-body img { max-width: 100%; border-radius: 8px; margin: 8px 0; }

/* Home-page announcement ribbon — three latest items teaser. */
.announce-ribbon {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; overflow: hidden;
}
.announce-ribbon-row {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background 0.12s;
}
.announce-ribbon-row:last-child { border-bottom: 0; }
.announce-ribbon-row:hover { background: var(--surface-2); }
.announce-ribbon-title {
  flex: 1; min-width: 0; font-size: 13px; font-weight: 600;
  color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Earn pool asset filter — horizontal pill row above the LP grid.
   Lets the user narrow 28+ pools to a single coin in one tap. */
.earn-asset-filter {
  display: flex; gap: 6px; flex-wrap: wrap; margin: -4px 0 16px;
}
.earn-asset-filter button {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 999px; padding: 6px 12px;
  font-size: 12px; font-weight: 700; color: var(--text-2);
  cursor: pointer; transition: all 0.12s;
}
.earn-asset-filter button:hover { border-color: var(--primary); color: var(--text); }
.earn-asset-filter button.active {
  background: var(--primary); border-color: var(--primary); color: white;
}
.earn-asset-filter img { width: 16px; height: 16px; border-radius: 50%; }

/* ---------- Modal ---------- */
/* Centered card on desktop; slides up as a bottom sheet on mobile. */
.modal-bg {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 200; padding: 20px;
  backdrop-filter: blur(2px);
}
.modal {
  background: var(--surface); border-radius: var(--radius-lg);
  padding: 0; width: 100%; max-width: 480px;
  max-height: 90vh; display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.modal.wide { max-width: 600px; }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 24px 12px;
  border-bottom: 1px solid var(--surface-3);
}
.modal-head h3 { margin: 0; font-size: 18px; font-weight: 800; }
.modal-x {
  background: transparent; border: 0; font-size: 18px; color: var(--text-3);
  width: 32px; height: 32px; border-radius: 50%; cursor: pointer;
}
.modal-x:hover { background: var(--surface-2); color: var(--text); }
.modal-body { padding: 18px 24px 24px; overflow-y: auto; flex: 1; }

.modal-fade-enter-active, .modal-fade-leave-active { transition: opacity 0.2s; }
.modal-fade-enter-from, .modal-fade-leave-to { opacity: 0; }
.modal-fade-enter-active .modal, .modal-fade-leave-active .modal {
  transition: transform 0.22s cubic-bezier(.2,.8,.2,1);
}
.modal-fade-enter-from .modal, .modal-fade-leave-to .modal {
  transform: translateY(20px) scale(0.98);
}

/* ---------- Market picker ---------- */
.picker-search {
  width: 100%; padding: 12px 14px; font-size: 15px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 10px; outline: none;
}
.picker-search:focus { border-color: var(--primary); }
.picker-list {
  max-height: 50vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: 4px;
}
.picker-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; background: transparent; border: 0;
  border-radius: 10px; cursor: pointer; text-align: left;
  transition: background 0.12s;
}
.picker-row:hover { background: var(--surface-2); }
.picker-info { flex: 1; min-width: 0; }
.picker-sym { font-weight: 700; font-size: 14px; }
.picker-px { text-align: right; font-variant-numeric: tabular-nums; }
.picker-px .mono { font-weight: 600; }

/* ---------- Trade page market-switch button ---------- */
.market-switch {
  background: transparent; border: 0; padding: 0; cursor: pointer;
  display: flex; align-items: center; gap: 14px; flex: 1; min-width: 0;
  border-radius: 10px;
  transition: background 0.12s;
}
.market-switch:hover { background: var(--surface-2); padding: 6px; margin: -6px; }
.market-switch h1 .chev {
  font-size: 16px; color: var(--text-3); margin-left: 6px;
  display: inline-block; transition: transform 0.12s;
}
.market-switch:hover h1 .chev { color: var(--primary); transform: translateY(2px); }
.price-block { text-align: right; }
.price-block .price-big { font-size: 28px; }
.price-block .delta { font-size: 14px; font-weight: 700; }

/* ---------- Mobile tabs (under chart on mobile) ---------- */
.m-tabs {
  display: flex; gap: 4px; padding: 4px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px;
}
.m-tabs button {
  flex: 1; background: transparent; border: 0; padding: 10px 8px;
  border-radius: 6px; font-size: 13px; font-weight: 600;
  color: var(--text-2);
}
.m-tabs button.active {
  background: var(--primary); color: white;
}

/* ---------- Mobile bottom nav (5 tabs, center FAB) ---------- */
/* Layout: Markets · Activity · ⓢ TRADE (raised FAB) · 客服 · Me
   The bar has overflow-visible so the center FAB can sit above the
   top edge while the rest of the nav stays at the bottom. */
.mnav {
  position: fixed; left: 0; right: 0; bottom: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: grid; grid-template-columns: repeat(5, 1fr);
  z-index: 80;
  padding-bottom: env(safe-area-inset-bottom);
  box-shadow: 0 -4px 20px rgba(0,0,0,0.4);
  overflow: visible;
}
.mnav button {
  background: transparent; border: 0; cursor: pointer;
  padding: 8px 4px 6px;
  display: flex; flex-direction: column; align-items: center;
  gap: 3px; color: var(--text-3);
  transition: color 0.12s;
  position: relative;
}
.mnav button.active { color: var(--primary); }
.mnav button:hover  { color: var(--text-2); }
.mnav button.active:hover { color: var(--primary); }
.mnav span { font-size: 10px; font-weight: 600; letter-spacing: 0.2px; }
.mnav svg { display: block; }
/* Center TRADE FAB — raised bubble overlapping the bar's top edge.
   Always blue regardless of active state, with extra shadow so it
   looks 3D against the otherwise-flat bar. The label below stays
   styled like the others. */
.mnav-fab .fab-bubble {
  width: 52px; height: 52px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: white;
  display: flex; align-items: center; justify-content: center;
  margin-top: -22px;
  box-shadow:
    0 8px 20px rgba(59, 130, 246, 0.45),
    0 2px 6px rgba(0,0,0,0.3);
  border: 3px solid var(--surface);
  transition: transform 0.12s, box-shadow 0.12s;
}
.mnav-fab:active .fab-bubble { transform: scale(0.94); }
.mnav-fab.active .fab-bubble {
  box-shadow:
    0 4px 12px rgba(59, 130, 246, 0.6),
    0 0 0 4px rgba(59, 130, 246, 0.25);
}
.mnav-fab span { color: var(--primary); font-weight: 700; }

/* ---------- Mobile inline single-button trade CTA ---------- */
/* Replaces the earlier twin LONG/SHORT buttons. Lives in the document
   flow right under the K-line chart. One tap opens the trade modal
   where the LONG vs SHORT pair lives — keeps the trade-page lean and
   the directional choice still happens before the user types a stake. */
.m-trade-cta-single {
  display: flex; align-items: center; gap: 12px;
  width: calc(100% - 24px);
  margin: 12px 12px 16px;
  padding: 0 18px;
  height: 54px; border: 0; border-radius: 14px;
  /* Brand-blue gradient — neutral about direction (vs the previous
     red/green pair that visually committed before the user did),
     and ties the CTA to the rest of the polymarket-style accent. */
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-2) 100%);
  color: white; font-weight: 800; letter-spacing: 0.3px;
  box-shadow:
    0 6px 18px rgba(59, 130, 246, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
  transition: transform 0.08s, filter 0.12s, box-shadow 0.12s;
}
.m-trade-cta-single:active {
  transform: scale(0.985);
  filter: brightness(1.08);
  box-shadow: 0 3px 10px rgba(59, 130, 246, 0.3);
}
.m-trade-cta-single .m-cta-label { font-size: 17px; }
.m-trade-cta-single .m-cta-meta {
  margin-left: auto; font-size: 12px; font-weight: 700;
  background: rgba(255, 255, 255, 0.20);
  padding: 4px 10px; border-radius: 999px;
}
.m-trade-cta-single .m-cta-chev { opacity: 0.8; flex-shrink: 0; }

/* ---------- Toasts / overlays ---------- */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--surface-3); color: var(--text);
  border: 1px solid var(--border);
  padding: 12px 20px;
  border-radius: 999px; box-shadow: var(--shadow-lg); font-weight: 500;
  z-index: 100; opacity: 0; transition: opacity 0.18s, transform 0.18s;
  pointer-events: none;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.toast.kind-success { background: var(--green); }
.toast.kind-error { background: var(--red); }

/* ---------- Empty / loading ---------- */
.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 0%, var(--border) 50%, var(--surface-2) 100%);
  background-size: 200% 100%; animation: shimmer 1.4s infinite;
  border-radius: 8px;
}
@keyframes shimmer { 0% { background-position: 200% 0 } 100% { background-position: -200% 0 } }
.empty {
  text-align: center; padding: 48px 24px; color: var(--text-3);
}

/* ---------- Responsive ---------- */
@media (max-width: 1280px) {
  .trade-layout3 { grid-template-columns: 1fr 320px; }
  .trade-side-l { grid-row: span 2; }
}
@media (max-width: 980px) {
  /* Reserve scroll space at the bottom of every page so the mobile
     nav bar doesn't cover the last page row. */
  .page { padding: 16px 16px 88px; }
  .trade-layout3 { grid-template-columns: 1fr; gap: 12px; }
  .trade-side-l, .trade-side-r { position: static; display: none; }
  .hero { grid-template-columns: 1fr; padding: 24px; }
  .hero-title { font-size: 26px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .hot-row { grid-template-columns: 1fr; }
  .nav-links { display: none; }
  .balance-pill { display: none; }
  .nav-inner { padding: 0 16px; gap: 12px; }
  .brand { font-size: 18px; }
  /* Trade page mobile-specific: the market switch becomes a full-width
     row with the price stacked next to the icon, no quick-markets row,
     compact stats, smaller chart. */
  .quick-markets { display: none; }
  .market-head { flex-direction: row; gap: 10px; }
  .market-head h1 { font-size: 17px; }
  .price-block { text-align: right; }
  .price-block .price-big { font-size: 22px; }
  .stat-row { grid-template-columns: repeat(2, 1fr); gap: 10px; padding-top: 12px; }
  .market-head-panel { padding: 14px; }
  .chart-box { height: 320px; }
  .orders th, .orders td { padding: 8px 6px; font-size: 12px; }
  /* Modal goes full-width bottom-sheet on mobile */
  .modal-bg { padding: 0; align-items: flex-end; }
  .modal {
    border-radius: 18px 18px 0 0;
    max-width: 100%;
    max-height: 92vh;
  }
  .modal.wide { max-width: 100%; }
  /* Drag handle hint at the top of mobile sheets */
  .modal::before {
    content: ''; display: block; width: 40px; height: 4px;
    background: var(--surface-3); border-radius: 999px;
    margin: 8px auto 0;
  }
  .modal-fade-enter-from .modal, .modal-fade-leave-to .modal {
    transform: translateY(60px);
  }
  /* Picker rows are taller on mobile for easier tap targets */
  .picker-row { padding: 14px 12px; }
  .picker-list { max-height: 60vh; }
}
@media (max-width: 480px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stat { padding: 10px 12px; }
  .stat-v { font-size: 16px; }
  .grid { grid-template-columns: 1fr; }
  .cat-pills button { padding: 6px 10px; font-size: 13px; }
  .auth-card { padding: 24px 20px; }
  .nav-inner { height: 56px; }
  .ticker { height: 28px; }
  .ticker-item { font-size: 11px; }
}
