:root {
  /* Light tokens — warm, paper-like */
  --bg: #fafaf7;
  --surface: #ffffff;
  --surface-2: #f4f3ee;
  --surface-3: #ecebe4;
  --line: #e7e5dc;
  --line-2: #d9d6c9;
  --ink: #18181a;
  --ink-2: #3a3a3d;
  --ink-3: #6b6b70;
  --ink-4: #9c9ca1;

  /* Brand — Rain yellow + charcoal */
  --rain: #e6f053;        /* signature yellow */
  --rain-deep: #c9d23a;
  --rain-soft: #f6fab2;
  --rain-ink: #18181a;

  /* Trade colors */
  --yes: #1a7f4f;
  --yes-bg: #e6f4ec;
  --yes-bg-2: #d4ecde;
  --no: #c2374a;
  --no-bg: #fbe7ea;
  --no-bg-2: #f6d2d8;

  /* Categories */
  --cat-politics: #5a6cff;
  --cat-sports: #f0a020;
  --cat-crypto: #b25cff;
  --cat-culture: #ff6f5c;
  --cat-finance: #1a7f4f;

  --r-sm: 8px;
  --r: 12px;
  --r-lg: 16px;
  --r-xl: 22px;
  --shadow-sm: 0 1px 0 rgba(20,20,30,0.04), 0 1px 2px rgba(20,20,30,0.04);
  --shadow: 0 1px 0 rgba(20,20,30,0.04), 0 6px 24px -12px rgba(20,20,30,0.10);
  --shadow-lg: 0 1px 0 rgba(20,20,30,0.05), 0 24px 60px -20px rgba(20,20,30,0.18);

  --font-sans: "Helvetica Neue", "HelveticaNeue-Light", Helvetica, Arial, -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --font-serif: "Fraunces", "Iowan Old Style", Georgia, serif;
}

[data-theme="dark"] {
  --bg: #0d0d0f;
  --surface: #16161a;
  --surface-2: #1c1c21;
  --surface-3: #24242a;
  --line: #25252b;
  --line-2: #33333a;
  --ink: #f5f5f0;
  --ink-2: #d2d2cc;
  --ink-3: #8e8e93;
  --ink-4: #5a5a60;

  --yes:   #16a34a;
  --yes-bg: #f1f9f3;
  --yes-bg-2: #e2f3e7;
  --no:    #dc2626;
  --no-bg: #fdf2f3;
  --no-bg-2: #f9e1e3;
  --shadow-sm: 0 1px 0 rgba(0,0,0,0.4);
  --shadow: 0 1px 0 rgba(0,0,0,0.4), 0 6px 24px -12px rgba(0,0,0,0.6);
  --shadow-lg: 0 1px 0 rgba(0,0,0,0.5), 0 24px 60px -20px rgba(0,0,0,0.8);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.45;
  font-weight: 300;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "ss01", "cv11";
  letter-spacing: -0.005em;
}
button { font-family: inherit; cursor: pointer; }
input, textarea { font-family: inherit; }

.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ============ Topbar ============ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(160%) blur(20px);
  -webkit-backdrop-filter: saturate(160%) blur(20px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 14px 28px;
  display: flex;
  align-items: center;
  gap: 24px;
}
.catnav-wrap {
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
}
.catnav {
  max-width: 1400px;
  margin: 0 auto;
  padding: 6px 28px;
  display: flex;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
}
.catnav::-webkit-scrollbar { display: none; }
.catnav-btn {
  border: none;
  background: transparent;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-3);
  letter-spacing: -0.005em;
  white-space: nowrap;
  position: relative;
  transition: color .12s;
}
.catnav-btn:hover { color: var(--ink); }
.catnav-btn.active {
  color: var(--ink);
  font-weight: 600;
}
.catnav-btn.active::after {
  content: "";
  position: absolute;
  left: 12px; right: 12px;
  bottom: -7px;
  height: 2px;
  background: var(--ink);
  border-radius: 2px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 500;
  letter-spacing: -0.03em;
  font-size: 19px;
  color: var(--ink);
  cursor: pointer;
}
.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: url("logo.png") center/cover no-repeat;
}
.search {
  flex: 1;
  max-width: 460px;
  position: relative;
  display: flex;
  align-items: center;
}
.search input {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid transparent;
  border-radius: 999px;
  /* right pad reserves space for ⌘K hint; bumps when clear-x replaces it */
  padding: 10px 44px 10px 38px;
  font-size: 13.5px;
  color: var(--ink);
  outline: none;
  transition: border-color .15s, background .15s;
}
.search:has(.search-clear) input { padding-right: 32px; }
.search input::placeholder { color: var(--ink-3); }
.search input:focus { background: var(--surface); border-color: var(--line-2); }
.search > svg { position: absolute; left: 13px; color: var(--ink-3); pointer-events: none; }
.search kbd {
  position: absolute;
  right: 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-3);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 2px 5px;
}
.search-clear {
  position: absolute;
  right: 14px;
  top: 50%;
  margin-top: 0;
  transform: translateY(-50%);
  width: 22px;
  height: 22px;
  box-sizing: border-box;
  border: 1px solid var(--line-2);
  border-radius: 50%;
  background: var(--surface);
  color: var(--ink-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 12px;
  line-height: 1;
  transition: background .12s ease, color .12s ease, border-color .12s ease, transform .12s ease;
}
.search-clear svg {
  display: block;
  width: 12px;
  height: 12px;
  shape-rendering: geometricPrecision;
}
.search-clear:hover {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
  transform: translateY(-50%) scale(1.06);
}
.search-clear:active { transform: translateY(-50%) scale(0.94); }
.search-clear:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--rain-deep);
}
[data-theme="dark"] .search-clear {
  background: var(--surface-2);
  border-color: var(--line-2);
  color: var(--ink-2);
}
[data-theme="dark"] .search-clear:hover {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}

.nav {
  display: flex;
  align-items: center;
  gap: 4px;
}
.nav-btn {
  padding: 8px 12px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--ink-2);
  font-size: 13.5px;
  font-weight: 500;
  letter-spacing: -0.01em;
}
.nav-btn:hover { background: var(--surface-2); color: var(--ink); }
.nav-btn.active { color: var(--ink); background: var(--surface-2); }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}
.rain-wallet-slot { display: inline-flex; align-items: center; }

/* ============ Footer (rain.one/pred-style) ============ */
.footer {
  margin-top: 56px;
  background: #0d0d10;
  color: #e6e6e1;
  font-family: var(--font-sans);
}
.footer-inner {
  max-width: 1320px;
  margin: 0 auto;
  padding: 36px 28px 22px;
}
.footer-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 40px;
  flex-wrap: wrap;
}
.footer-brand { display: flex; flex-direction: column; gap: 10px; min-width: 280px; }
.footer-logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.footer-logo img {
  width: 134px;
  height: 28px;
  display: block;
}
.footer-beta {
  font-size: 11px;
  font-weight: 600;
  background: #f5f5f0;
  color: #18181a;
  padding: 3px 8px;
  border-radius: 999px;
  letter-spacing: 0.02em;
}
.footer-tag {
  font-size: 13.5px;
  color: #c5c5c0;
  letter-spacing: -0.005em;
  font-weight: 400;
}
.footer-chains {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: #8b8b86;
  margin-top: 6px;
  flex-wrap: wrap;
}
.footer-built { letter-spacing: 0.02em; }
.footer-vert {
  width: 1px;
  height: 18px;
  background: #2a2a2f;
}
.footer-chain-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,0.04);
  padding: 4px 10px 4px 4px;
  border-radius: 999px;
  border: 1px solid #1f1f24;
  color: #d6d6d1;
  font-weight: 500;
  font-size: 12px;
}
.cc {
  display: inline-block;
  width: 22px; height: 22px;
  border-radius: 50%;
  flex-shrink: 0;
  background-position: center;
  background-size: 70%;
  background-repeat: no-repeat;
  background-color: #1c1c21;
  border: 1px solid #2a2a30;
}
.cc-base { background-color: #0052ff; }
.cc-bsc  { background-color: #f3ba2f; }
.cc-eth  { background-color: #6c7cff; }
.cc-icon {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}
.cc-icon img {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 5px;
}
.cc-wordmark {
  display: block;
  height: 18px;
  width: auto;
  flex-shrink: 0;
}
.footer-chain-pill:has(.cc-wordmark) {
  padding: 4px 12px;
}
.cc-img-wrap {
  display: inline-grid;
  place-items: center;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: #1c1c21;
  border: 1px solid #2a2a30;
  overflow: hidden;
  flex-shrink: 0;
}
.cc-img-wrap img { width: 100%; height: 100%; object-fit: cover; }
.footer-chain-pill .cc-img {
  width: 18px; height: 18px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 22px 28px;
  align-items: center;
  font-size: 13px;
}
.footer-nav a {
  color: #d6d6d1;
  text-decoration: none;
  transition: color .12s;
  letter-spacing: -0.005em;
}
.footer-nav a:hover { color: var(--rain); }

.footer-rule {
  border: none;
  border-top: 1px solid #1f1f24;
  margin: 28px 0 18px;
}

.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}
.footer-legal {
  display: flex;
  gap: 24px;
  align-items: center;
  flex-wrap: wrap;
  font-size: 12.5px;
  color: #8b8b86;
}
.footer-legal a {
  color: #c5c5c0;
  text-decoration: none;
  letter-spacing: -0.005em;
}
.footer-legal a:hover { color: var(--rain); }

.footer-socials {
  display: inline-flex;
  gap: 8px;
}
.footer-social {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #1c1c21;
  border: 1px solid #2a2a30;
  display: grid;
  place-items: center;
  color: #c5c5c0;
  text-decoration: none;
  transition: background .12s, color .12s, border-color .12s, transform .12s;
}
.footer-social img {
  width: 14px; height: 14px;
  filter: brightness(0) invert(0.82);
  transition: filter .12s;
}
.footer-social:hover img { filter: none; }
.footer-social:hover {
  background: #25252b;
  color: var(--rain);
  border-color: #3a3a40;
  transform: translateY(-1px);
}

@media (max-width: 760px) {
  .footer-top { flex-direction: column; }
  .footer-bottom { flex-direction: column; align-items: flex-start; }
}

.empty-state {
  border: 1px dashed var(--line-2);
  border-radius: var(--r-lg);
  padding: 56px 24px;
  text-align: center;
  background: color-mix(in srgb, var(--surface-2) 50%, transparent);
}
.empty-state .empty-title {
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin-bottom: 6px;
}
.empty-state .empty-sub {
  font-size: 13px;
  color: var(--ink-3);
}
.btn {
  border: 1px solid var(--line-2);
  background: var(--surface);
  color: var(--ink);
  border-radius: 10px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: transform .08s, background .15s;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--rain);
  color: var(--rain-ink);
  border-color: var(--rain-deep);
}
.btn-primary:hover { background: var(--rain-deep); }
.btn-ghost { border-color: transparent; }
.btn-dark {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}
.btn-dark:hover { background: var(--ink-2); }

.wallet-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 6px 6px 12px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line-2);
  font-size: 13px;
  font-weight: 600;
}
.wallet-pill .balance {
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--ink);
}
.wallet-pill .avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--rain) 0%, #ff8a6b 100%);
}

/* ============ Page chrome ============ */
.page {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px 28px 80px;
  width: 100%;
  flex: 1;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 16px;
}
.section-head h2 {
  font-size: 22px;
  font-weight: 400;
  letter-spacing: -0.022em;
  margin: 0;
}
.section-head .meta {
  font-size: 12.5px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

/* ============ Ticker — terminal-grade tape ============ */
.ticker {
  position: relative;
  max-width: 1400px;
  margin: 14px auto 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  height: 44px;
  display: flex;
  align-items: stretch;
  overflow: hidden;
  font-feature-settings: "tnum", "ss01";
}

.ticker-badge {
  position: relative;
  z-index: 3;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 18px 0 20px;
  background: var(--rain);
  color: var(--rain-ink);
  border-right: 1px solid color-mix(in srgb, var(--rain-ink) 20%, transparent);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  box-shadow:
    inset 0 1px 0 color-mix(in srgb, white 40%, transparent),
    inset 0 -1px 0 color-mix(in srgb, var(--rain-ink) 18%, transparent);
}
.ticker-badge::after {
  content: "";
  position: absolute;
  top: 0; right: -16px; bottom: 0;
  width: 16px;
  background: linear-gradient(90deg, var(--rain), transparent);
  pointer-events: none;
}
.ticker-pulse {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--rain-ink);
  flex-shrink: 0;
  animation: ticker-pulse 1.6s ease-in-out infinite;
}
@keyframes ticker-pulse {
  0%, 100% { transform: scale(1);    opacity: 1;   }
  50%      { transform: scale(1.45); opacity: 0.55; }
}
.ticker-badge-label {
  font-size: 11px;
  font-weight: 700;
}
.ticker-badge-sub {
  font-size: 9.5px;
  font-weight: 600;
  opacity: 0.55;
  letter-spacing: 0.22em;
}

.ticker-viewport {
  position: relative;
  flex: 1;
  overflow: hidden;
}
.ticker-track {
  display: inline-flex;
  align-items: center;
  height: 100%;
  white-space: nowrap;
  animation: ticker 90s linear infinite;
  padding-left: 24px;
  will-change: transform;
}
.ticker:hover .ticker-track { animation-play-state: paused; }

.ticker-item {
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
  padding: 0 22px;
  height: 22px;
  border-right: 1px solid var(--line);
}
.ticker-item .sym {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--ink-4);
  text-transform: uppercase;
}
.ticker-item .lbl {
  font-family: var(--font-sans);
  font-weight: 500;
  color: var(--ink);
  letter-spacing: -0.005em;
  font-size: 12.5px;
}
.ticker-item .px {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  font-weight: 600;
  font-size: 12.5px;
  letter-spacing: -0.01em;
}
.ticker-item .delta {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 7px;
  border-radius: 3px;
  letter-spacing: 0.01em;
}
.ticker-item .delta .arrow { font-size: 8px; line-height: 1; }
.ticker-item .delta.up   { color: var(--yes); background: var(--yes-bg); }
.ticker-item .delta.down { color: var(--no);  background: var(--no-bg);  }

@keyframes ticker {
  0%   { transform: translate3d(0, 0, 0); }
  100% { transform: translate3d(-50%, 0, 0); }
}

.ticker-viewport::before,
.ticker-viewport::after {
  content: "";
  position: absolute;
  top: 0; bottom: 0;
  width: 72px;
  z-index: 2;
  pointer-events: none;
}
.ticker-viewport::before { left: 0;  background: linear-gradient(90deg,  var(--surface), transparent); }
.ticker-viewport::after  { right: 0; background: linear-gradient(-90deg, var(--surface), transparent); }

/* ============ Hero / featured ============ */
.hero-feature {
  border-radius: var(--r-xl);
  background: var(--ink);
  color: var(--bg);
  padding: 53px 44px;
  min-height: 266px;
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 40px;
  align-items: center;
  cursor: pointer;
  transition: transform .2s;
  margin-bottom: 24px;
  isolation: isolate;
}
.hero-feature::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("https://images.unsplash.com/photo-1541872703-74c5e44368f9?w=1600&q=80");
  background-size: cover;
  background-position: center;
  filter: blur(2px) brightness(0.45) saturate(1.1);
  transform: scale(1.06);
  z-index: -2;
}
.hero-feature::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(20,20,22,0.78) 0%, rgba(20,20,22,0.62) 50%, rgba(20,20,22,0.85) 100%);
  z-index: -1;
}
.hero-feature:hover { transform: translateY(-1px); }
.hero-feature .eyebrow {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--rain);
  font-weight: 600;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.hero-feature h3 {
  font-family: var(--font-serif);
  font-size: 44px;
  font-weight: 400;
  letter-spacing: -0.025em;
  line-height: 1.1;
  margin: 0 0 16px;
  text-wrap: balance;
  max-width: 1152px;
}
.hero-feature .hero-meta {
  display: flex;
  gap: 12px;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 12px;
  color: rgba(245,245,240,0.55);
  font-variant-numeric: tabular-nums;
}
.hero-feature .hero-meta .sep {
  width: 3px; height: 3px; border-radius: 50%;
  background: rgba(245,245,240,0.3);
}
.hero-feature .hero-right {
  display: flex;
  gap: 8px;
}
.hero-feature .hero-buy {
  border: none;
  border-radius: 14px;
  padding: 22px 26px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  font-family: inherit;
  min-width: 140px;
  transition: transform .12s;
}
.hero-feature .hero-buy:hover { transform: translateY(-1px); }
.hero-feature .hero-buy .lbl {
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 600;
  opacity: .7;
}
.hero-feature .hero-buy .px {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.02em;
}
.hero-feature .hero-buy.yes { background: var(--rain); color: var(--rain-ink); }
.hero-feature .hero-buy.no {
  background: rgba(245,245,240,0.08);
  color: var(--bg);
  border: 1px solid rgba(245,245,240,0.15);
}

/* === Dark mode hero — banner inverts to light bg + dark text === */
[data-theme="dark"] .hero-feature::before {
  filter: blur(2px) brightness(1.1) saturate(0.85);
}
[data-theme="dark"] .hero-feature::after {
  background: linear-gradient(90deg,
    rgba(245,245,240,0.78) 0%,
    rgba(245,245,240,0.55) 50%,
    rgba(245,245,240,0.85) 100%);
}
[data-theme="dark"] .hero-feature .eyebrow { color: #6f7d12; }
[data-theme="dark"] .hero-feature .live-dot { background: #6f7d12; box-shadow: 0 0 0 0 rgba(111,125,18,0.55); }
[data-theme="dark"] .hero-feature .hero-meta { color: rgba(20,20,22,0.6); }
[data-theme="dark"] .hero-feature .hero-meta .sep { background: rgba(20,20,22,0.32); }
[data-theme="dark"] .hero-feature .hero-buy.yes {
  background: var(--rain);
  color: var(--rain-ink);
  box-shadow: 0 1px 0 rgba(20,20,22,0.05), inset 0 1px 0 rgba(255,255,255,0.4);
}
[data-theme="dark"] .hero-feature .hero-buy.no {
  background: rgba(20,20,22,0.06);
  color: var(--bg);
  border: 1px solid rgba(20,20,22,0.18);
}
[data-theme="dark"] .hero-feature .hero-buy.no .lbl { opacity: 0.6; }

.hero-feature .live-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--rain);
  box-shadow: 0 0 0 0 rgba(230,240,83,0.6);
  animation: pulse 1.6s ease-out infinite;
}
@media (max-width: 800px) {
  .hero-feature { grid-template-columns: 1fr; }
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(230,240,83,0.6); }
  100% { box-shadow: 0 0 0 8px rgba(230,240,83,0); }
}

.hero-trending {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.trend-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 14px 16px;
  display: grid;
  grid-template-columns: 32px 1fr auto;
  gap: 12px;
  align-items: center;
  cursor: pointer;
  transition: border-color .15s, transform .15s;
}
.trend-card:hover { border-color: var(--line-2); transform: translateX(2px); }
.trend-rank {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}
.trend-title {
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: -0.01em;
}
.trend-meta {
  font-size: 11px;
  color: var(--ink-3);
  margin-top: 2px;
  font-family: var(--font-mono);
}
.trend-prob {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 15px;
  font-weight: 600;
  text-align: right;
}
.trend-prob .delta {
  font-size: 10.5px;
  font-weight: 500;
  display: block;
  margin-top: 1px;
}
.trend-prob .delta.up { color: var(--yes); }
.trend-prob .delta.down { color: var(--no); }

/* ============ Filter bar ============ */
.filters {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.chip {
  padding: 7px 13px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-2);
  letter-spacing: -0.005em;
  transition: all .12s;
}
.chip:hover { border-color: var(--line-2); color: var(--ink); }
.chip.active {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}
.chip .count {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-3);
  margin-left: 6px;
}
.chip.active .count { color: rgba(245,245,240,0.5); }

.filters-right {
  margin-left: auto;
  display: flex;
  gap: 6px;
  align-items: center;
}
.sort-toggle {
  display: inline-flex;
  background: var(--surface-2);
  border-radius: 8px;
  padding: 3px;
}
.sort-toggle button {
  border: none;
  background: transparent;
  padding: 6px 11px;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-3);
  border-radius: 6px;
}
.sort-toggle button.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

/* ============ Market grid ============ */
.market-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}
.market-grid.dense { grid-template-columns: repeat(5, 1fr); }
@media (max-width: 1280px) { .market-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 820px) { .market-grid { grid-template-columns: repeat(2, 1fr); } }

.mcard {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  cursor: pointer;
  transition: border-color .15s, transform .15s, box-shadow .2s;
  position: relative;
  min-height: 220px;
}
.mcard:hover {
  border-color: var(--line-2);
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}
.mcard-head {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.mcard-icon {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: -0.02em;
  background: var(--surface-2);
  color: var(--ink);
  position: relative;
  overflow: hidden;
}
.mcard-icon.has-stripe::before {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(135deg, transparent 0, transparent 4px, rgba(0,0,0,0.04) 4px, rgba(0,0,0,0.04) 5px);
}
.mcard-title {
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.012em;
  line-height: 1.32;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-wrap: pretty;
  word-break: break-word;
}

.binary-bar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.bbtn {
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 9px 10px;
  font-size: 12.5px;
  font-weight: 600;
  text-align: left;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-variant-numeric: tabular-nums;
  transition: all .12s;
}
.bbtn .pct { font-family: var(--font-mono); font-size: 13px; }
.bbtn-yes { background: var(--yes-bg); color: var(--yes); }
.bbtn-yes:hover { background: var(--yes-bg-2); }
.bbtn-no { background: var(--no-bg); color: var(--no); }
.bbtn-no:hover { background: var(--no-bg-2); }

.multi-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.mc-stack-bar {
  height: 6px;
  border-radius: 4px;
  background: var(--surface-2);
  overflow: hidden;
  display: flex;
  gap: 2px;
}
.mc-stack-seg {
  height: 100%;
  border-radius: 2px;
}
.mcard-rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.mcard-title-wrap {
  flex: 1;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.mc-pct-inline {
  text-align: right;
  flex-shrink: 0;
  line-height: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.mc-pct-ring {
  width: 38px;
  height: 38px;
  position: relative;
  display: grid;
  place-items: center;
}
.mc-pct-ring svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.mc-pct-ring .num {
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  letter-spacing: -0.02em;
}
.mc-pct-inline .lbl {
  font-size: 9.5px;
  color: var(--ink-3);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 600;
}
.mc-binary-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.mc-up, .mc-down {
  border: none;
  border-radius: 8px;
  padding: 11px 14px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.005em;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  transition: background .12s;
}
.mc-up .lbl, .mc-down .lbl { font-weight: 600; }
.mc-up .px, .mc-down .px {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  font-weight: 500;
  opacity: .85;
}
.mc-up { background: var(--yes-bg); color: var(--yes); }
.mc-up:hover { background: var(--yes-bg-2); }
.mc-down { background: var(--no-bg); color: var(--no); }
.mc-down:hover { background: var(--no-bg-2); }
.mc-row {
  display: grid;
  grid-template-columns: 10px 1fr auto auto;
  gap: 10px;
  align-items: center;
  font-size: 13px;
}
.mc-row .multi-dot { width: 8px; height: 8px; border-radius: 50%; }
.mc-name {
  font-weight: 500;
  color: var(--ink-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.005em;
}
.mc-pct {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--ink);
  font-size: 12.5px;
  min-width: 30px;
  text-align: right;
}
.mc-yn-inline {
  display: inline-flex;
  gap: 4px;
}
.mc-yes, .mc-no {
  border: none;
  font-family: var(--font-sans);
  font-size: 11.5px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 6px;
  text-align: center;
  letter-spacing: 0.01em;
  transition: background .12s;
  min-width: 42px;
}
.mc-yes { background: var(--yes-bg); color: var(--yes); }
.mc-yes:hover { background: var(--yes-bg-2); }
.mc-no { background: var(--no-bg); color: var(--no); }
.mc-no:hover { background: var(--no-bg-2); }
.mc-more {
  font-size: 12px;
  color: var(--ink-3);
  margin-top: 4px;
  padding-left: 18px;
}
.multi-row {
  display: grid;
  grid-template-columns: 14px 1fr auto auto;
  gap: 8px;
  align-items: center;
  font-size: 12.5px;
}
.multi-dot {
  width: 8px; height: 8px; border-radius: 50%;
  margin: 0 3px;
}
.multi-name {
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.005em;
}
.multi-pct {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  font-size: 12.5px;
  color: var(--ink-2);
}
.multi-buy {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--ink);
}
.multi-buy.yes { background: var(--yes-bg); color: var(--yes); }
.multi-buy.no { background: var(--no-bg); color: var(--no); }
.multi-more {
  font-size: 11.5px;
  color: var(--ink-3);
  padding-left: 22px;
}

.mcard-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 10px;
  margin-top: auto;
  border-top: 1px solid var(--line);
  font-size: 11.5px;
  font-family: var(--font-mono);
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}
.mcard-foot .left { display: flex; gap: 12px; align-items: center; }
.mcard-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-sans);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 3px 7px;
  border-radius: 5px;
}
.tag-politics { color: var(--cat-politics); background: color-mix(in srgb, var(--cat-politics) 12%, transparent); }
.tag-sports { color: var(--cat-sports); background: color-mix(in srgb, var(--cat-sports) 14%, transparent); }
.tag-crypto { color: var(--cat-crypto); background: color-mix(in srgb, var(--cat-crypto) 12%, transparent); }
.tag-culture { color: var(--cat-culture); background: color-mix(in srgb, var(--cat-culture) 14%, transparent); }
.tag-finance { color: var(--cat-finance); background: color-mix(in srgb, var(--cat-finance) 14%, transparent); }
.tag-tech { color: #4a5cff; background: color-mix(in srgb, #4a5cff 12%, transparent); }
.tag-ent { color: #d04ea8; background: color-mix(in srgb, #d04ea8 12%, transparent); }

.spark {
  height: 24px;
  width: 64px;
  flex-shrink: 0;
}

/* ============ Detail page ============ */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 24px;
  align-items: start;
}
.crumb {
  display: flex;
  gap: 6px;
  align-items: center;
  font-size: 12.5px;
  color: var(--ink-3);
  margin-bottom: 12px;
  font-family: var(--font-mono);
}
.crumb a { color: var(--ink-3); text-decoration: none; cursor: pointer; }
.crumb a:hover { color: var(--ink); }

.detail-head {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 18px;
}
.detail-head .mcard-icon { width: 56px; height: 56px; border-radius: 12px; font-size: 22px; }
.detail-title {
  font-family: var(--font-serif);
  font-size: 30px;
  font-weight: 400;
  letter-spacing: -0.028em;
  line-height: 1.18;
  margin: 0 0 8px;
  text-wrap: balance;
}
.detail-meta {
  display: flex;
  gap: 14px;
  align-items: center;
  font-size: 12.5px;
  color: var(--ink-3);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}
.detail-meta .sep { width: 3px; height: 3px; border-radius: 50%; background: var(--ink-4); }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 18px;
}
.card.tight { padding: 14px; }
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.card-head h4 {
  margin: 0;
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: -0.005em;
}
.card-head .small {
  font-size: 11.5px;
  color: var(--ink-3);
  font-family: var(--font-mono);
}

.range-toggle {
  display: inline-flex;
  background: var(--surface-2);
  padding: 3px;
  border-radius: 8px;
  gap: 0;
}
.range-toggle button {
  border: none;
  background: transparent;
  padding: 5px 11px;
  font-size: 11.5px;
  font-weight: 600;
  font-family: var(--font-mono);
  color: var(--ink-3);
  border-radius: 6px;
}
.range-toggle button.active {
  background: var(--ink);
  color: var(--bg);
}

.chart-wrap {
  position: relative;
  height: 280px;
  margin-top: 4px;
  cursor: crosshair;
  overflow: hidden;
}
.chart-wrap svg { display: block; width: 100%; height: 100%; overflow: hidden; }
/* Hover chips — polymarket-style anchored labels at each line's value */
.chart-chip {
  position: absolute;
  transform: translate(10px, -50%);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px 3px 5px;
  background: var(--ink);
  color: var(--bg);
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
  border-radius: 3px;
  border-left: 3px solid var(--chipColor, var(--ink-3));
  box-shadow: 0 4px 12px rgba(0,0,0,0.18);
  pointer-events: none;
  z-index: 4;
  transition: top .08s ease-out;
}
.chart-chip.flip-left {
  transform: translate(calc(-100% - 10px), -50%);
  border-left: none;
  border-right: 3px solid var(--chipColor, var(--ink-3));
}
.chart-chip .arrow {
  font-size: 10px;
  line-height: 1;
  color: var(--chipColor, var(--bg));
  font-weight: 700;
}
.chart-chip .nm {
  font-family: var(--font-sans);
  font-weight: 500;
  color: color-mix(in srgb, var(--bg) 85%, transparent);
  letter-spacing: -0.005em;
}
.chart-chip .val {
  color: var(--bg);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.chart-time {
  position: absolute;
  top: 6px;
  transform: translateX(-50%);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--ink-2);
  background: var(--surface);
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 3px;
  pointer-events: none;
  z-index: 4;
  white-space: nowrap;
}
.chart-legend {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 6px;
  font-size: 12px;
}
.chart-legend .item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-variant-numeric: tabular-nums;
}
.chart-legend .item .dot { width: 9px; height: 9px; border-radius: 50%; }
.chart-legend .item .v { font-family: var(--font-mono); font-weight: 600; }

/* ============ Outcomes table ============ */
.otable { display: flex; flex-direction: column; }
.orow {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.orow:last-child { border-bottom: none; }
.orow .orow-head {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
  min-width: 0;
}
.orow .orow-buys { display: flex; gap: 6px; flex-shrink: 0; }
.orow .name { font-weight: 600; font-size: 14px; letter-spacing: -0.01em; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.orow .pct { text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-weight: 600; min-width: 56px; }
.orow .dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.orow .buy-yes, .orow .buy-no { width: 90px; }
.buy-yes, .buy-no {
  border: none;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 12.5px;
  font-weight: 600;
  padding: 9px 0;
  border-radius: 8px;
  text-align: center;
}
.buy-yes { background: var(--yes-bg); color: var(--yes); }
.buy-yes:hover { background: var(--yes-bg-2); }
.buy-no { background: var(--no-bg); color: var(--no); }
.buy-no:hover { background: var(--no-bg-2); }

/* ============ Right sidebar ============ */
.side {
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: sticky;
  top: 80px;
}

.trade-panel { padding: 16px; }
.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--surface-2);
  padding: 3px;
  border-radius: 9px;
  margin-bottom: 14px;
}
.tabs button {
  border: none;
  background: transparent;
  padding: 8px 0;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-3);
  border-radius: 7px;
  letter-spacing: -0.005em;
}
.tabs button.active.yes { background: var(--yes); color: white; }
.tabs button.active.no { background: var(--no); color: white; }

.outcome-pick {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}
.outcome-pick .label {
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 600;
  margin-bottom: 4px;
}
.outcome-opt {
  display: grid;
  grid-template-columns: 14px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: transparent;
  text-align: left;
  font-family: inherit;
  font-size: 13px;
}
.outcome-opt.selected {
  border-color: var(--ink);
  background: var(--surface-2);
}
.outcome-opt .nm { font-weight: 600; }
.outcome-opt .pct {
  font-family: var(--font-mono);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.amount-card {
  background: var(--surface-2);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 12px;
}
.amount-card .label-row {
  display: flex;
  justify-content: space-between;
  font-size: 11.5px;
  color: var(--ink-3);
  margin-bottom: 6px;
}
.amount-card .balance {
  font-family: var(--font-mono);
}
.amount-input-wrap {
  display: flex;
  align-items: baseline;
  gap: 4px;
}
.amount-prefix {
  font-family: var(--font-sans);
  font-size: 28px;
  font-weight: 400;
  letter-spacing: -0.025em;
  color: var(--ink-3);
  line-height: 1;
}
.amount-input {
  flex: 1;
  width: 100%;
  border: none;
  background: transparent;
  font-family: var(--font-sans);
  font-size: 28px;
  font-weight: 400;
  letter-spacing: -0.025em;
  color: var(--ink);
  outline: none;
  font-variant-numeric: tabular-nums;
  padding: 0;
}
.amount-input::-webkit-outer-spin-button,
.amount-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.amount-input { -moz-appearance: textfield; }
.preset-row {
  display: flex;
  gap: 6px;
  margin-top: 10px;
}
.preset-row button {
  flex: 1;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 8px;
  padding: 6px 0;
  font-size: 11.5px;
  font-weight: 600;
  font-family: var(--font-mono);
  color: var(--ink-2);
}
.preset-row button:hover { background: var(--surface-3); border-color: var(--line-2); }
.preset-row button.max { color: var(--rain-ink); background: var(--rain); border-color: var(--rain-deep); }

.summary-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 12.5px;
  margin: 12px 0;
}
.summary-list .line {
  display: flex;
  justify-content: space-between;
  font-variant-numeric: tabular-nums;
}
.summary-list .k { color: var(--ink-3); }
.summary-list .v {
  font-family: var(--font-mono);
  font-weight: 500;
  color: var(--ink);
}
.summary-list .v.win { color: var(--yes); font-weight: 600; }

.cta {
  width: 100%;
  border: none;
  border-radius: 12px;
  padding: 14px 0;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.005em;
  background: var(--ink);
  color: var(--bg);
  transition: transform .08s;
}
.cta:hover { background: var(--ink-2); }
.cta:active { transform: scale(0.99); }
.cta.yes { background: var(--yes); color: white; }
.cta.no { background: var(--no); color: white; }
.cta:disabled { background: var(--surface-3); color: var(--ink-4); cursor: not-allowed; }

.mini-foot {
  margin-top: 10px;
  font-size: 11px;
  color: var(--ink-3);
  text-align: center;
  font-family: var(--font-mono);
}

/* ============ Order book ============ */
.book {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
}
.book-head {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
  padding: 4px 0;
  border-bottom: 1px solid var(--line);
  margin-bottom: 4px;
  font-family: var(--font-sans);
  font-weight: 600;
}
.book-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  padding: 4px 0;
  position: relative;
  z-index: 1;
}
.book-row::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: 4px;
  opacity: 0.5;
}
.book-row.bid::before { background: var(--yes-bg); transform-origin: right; }
.book-row.ask::before { background: var(--no-bg); transform-origin: left; }
.book-row .px { font-weight: 600; }
.book-row.bid .px { color: var(--yes); }
.book-row.ask .px { color: var(--no); }
.book-mid {
  text-align: center;
  font-size: 12.5px;
  font-weight: 600;
  padding: 8px 0;
  background: var(--surface-2);
  border-radius: 6px;
  margin: 6px 0;
  letter-spacing: -0.01em;
}
.book-mid .spread {
  font-size: 10.5px;
  color: var(--ink-3);
  font-weight: 500;
  margin-left: 6px;
}

/* Activity */
.act-list { display: flex; flex-direction: column; }
.act-row {
  display: grid;
  grid-template-columns: 24px 1fr auto auto;
  gap: 10px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 12.5px;
}
.act-row:last-child { border: none; }
.act-row .who {
  width: 24px; height: 24px; border-radius: 50%;
  background: linear-gradient(135deg, var(--surface-3), var(--surface-2));
  font-size: 10px; font-weight: 600;
  display: grid; place-items: center;
  color: var(--ink-2);
}
.act-row .desc { letter-spacing: -0.005em; }
.act-row .desc .b { font-weight: 600; }
.act-row .desc .yes { color: var(--yes); font-weight: 600; }
.act-row .desc .no { color: var(--no); font-weight: 600; }
.act-row .amt { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-weight: 500; }
.act-row .when { font-family: var(--font-mono); font-size: 11px; color: var(--ink-3); }

/* ============ Modal (Create flow) ============ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15,15,18,0.4);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: grid;
  place-items: center;
  z-index: 50;
  animation: fadeIn .2s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--surface);
  border-radius: 18px;
  width: 540px;
  max-width: calc(100vw - 40px);
  max-height: calc(100vh - 40px);
  overflow: auto;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--line);
  animation: slideUp .25s cubic-bezier(.2,.9,.3,1);
}
@keyframes slideUp { from { transform: translateY(12px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px 8px;
}
.modal-head h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.015em;
}
.modal-close {
  width: 30px; height: 30px;
  border-radius: 8px;
  border: none;
  background: var(--surface-2);
  color: var(--ink-2);
  display: grid; place-items: center;
}
.modal-close:hover { background: var(--surface-3); color: var(--ink); }

.steps {
  display: flex;
  gap: 6px;
  padding: 0 22px 14px;
}
.step-bar {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: var(--surface-2);
  overflow: hidden;
}
.step-bar.done { background: var(--ink); }
.step-bar.active { background: var(--rain); }

.modal-body {
  padding: 8px 22px 22px;
}
.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--ink-3);
  margin-bottom: 6px;
}
.field input, .field textarea, .field select {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 10px;
  padding: 11px 13px;
  font-size: 14px;
  color: var(--ink);
  outline: none;
  font-family: inherit;
  letter-spacing: -0.005em;
  transition: border-color .12s, box-shadow .12s;
}
.field input:focus, .field textarea:focus, .field select:focus {
  border-color: var(--ink);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--ink) 8%, transparent);
}
.field textarea { resize: vertical; min-height: 84px; line-height: 1.5; }
.field-help { font-size: 12px; color: var(--ink-3); margin-top: 6px; }

.outcome-builder { display: flex; flex-direction: column; gap: 6px; }
.outcome-builder .row {
  display: grid;
  grid-template-columns: 14px 1fr 70px 28px;
  gap: 8px;
  align-items: center;
}
.outcome-builder input { padding: 9px 11px; font-size: 13px; border-radius: 8px; }
.outcome-builder .pct-input { text-align: right; font-family: var(--font-mono); }
.outcome-builder .remove {
  width: 28px; height: 28px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--ink-3);
}
.outcome-builder .remove:hover { background: var(--surface-2); color: var(--no); }
.outcome-builder .add-btn {
  margin-top: 4px;
  border: 1px dashed var(--line-2);
  background: transparent;
  border-radius: 8px;
  padding: 8px;
  font-size: 12.5px;
  color: var(--ink-3);
  font-weight: 500;
}
.outcome-builder .add-btn:hover { border-color: var(--ink); color: var(--ink); }

.modal-foot {
  padding: 14px 22px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  position: sticky;
  bottom: 0;
}
.modal-foot .hint { font-size: 12px; color: var(--ink-3); }
.modal-foot .hint kbd {
  font-family: var(--font-mono);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 2px 5px;
  font-size: 10.5px;
  margin: 0 2px;
}

/* AI generate panel */
.gen-card {
  background: linear-gradient(135deg, var(--rain-soft) 0%, color-mix(in srgb, var(--rain-soft) 50%, var(--surface)) 100%);
  border: 1px solid var(--rain-deep);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 14px;
  display: flex;
  gap: 12px;
}
.gen-card .icon {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: var(--ink);
  color: var(--rain);
  display: grid; place-items: center;
  font-weight: 800;
  font-size: 13px;
  flex-shrink: 0;
}
.gen-card .body {
  font-size: 12.5px;
  color: var(--ink-2);
  line-height: 1.45;
}
.gen-card .body strong { color: var(--ink); }

/* ============ Portfolio ============ */
.port-head {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 14px;
  margin-bottom: 22px;
}
.section-head .btn { white-space: nowrap; }
.port-stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 18px;
}
.port-stat .k {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-3);
  margin-bottom: 8px;
  font-weight: 600;
}
.port-stat .v {
  font-family: var(--font-sans);
  font-size: 30px;
  font-weight: 500;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}
.port-stat .v.win { color: var(--yes); }
.port-stat .delta {
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  margin-top: 4px;
}
.port-stat .delta.up { color: var(--yes); }
.port-stat .delta.down { color: var(--no); }
.port-stat .spark { width: 100%; height: 36px; margin-top: 10px; }

.pos-table { width: 100%; }
.pos-table th, .pos-table td {
  text-align: left;
  padding: 12px 10px;
  font-size: 13px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.pos-table th {
  font-weight: 600;
  color: var(--ink-3);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--line-2);
}
.pos-table td.num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.pos-table th.num { text-align: right; }
.pos-table tr:hover td { background: var(--surface-2); }
.pos-table .pos-name {
  display: flex;
  gap: 10px;
  align-items: center;
}
.pos-table .pos-name .icon {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: var(--surface-2);
  display: grid; place-items: center;
  font-weight: 700;
  font-size: 13px;
}
.pos-table .pos-name .lbl { font-weight: 500; letter-spacing: -0.01em; }
.pos-table .pos-name .sub { font-size: 11px; color: var(--ink-3); margin-top: 2px; }
.side-yes { color: var(--yes); font-weight: 600; }
.side-no { color: var(--no); font-weight: 600; }
.gain { color: var(--yes); }
.loss { color: var(--no); }

/* Empty state */
.empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--ink-3);
}
.empty .ill {
  width: 56px; height: 56px;
  margin: 0 auto 14px;
  border-radius: 14px;
  background: var(--surface-2);
  display: grid; place-items: center;
  color: var(--ink-3);
}
.empty h4 { margin: 0 0 4px; color: var(--ink); font-size: 16px; font-weight: 600; }
.empty p { margin: 0 0 14px; font-size: 13px; }

/* ============ Misc ============ */
.spinner {
  width: 12px; height: 12px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin .8s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Drawer (mobile-like trade) */
.drawer-backdrop {
  position: fixed; inset: 0;
  background: rgba(15,15,18,0.35);
  z-index: 40;
  animation: fadeIn .15s;
}
.drawer {
  position: fixed;
  right: 16px;
  top: 80px;
  bottom: 16px;
  width: 380px;
  background: var(--surface);
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--line);
  z-index: 41;
  overflow: auto;
  animation: drawerIn .25s cubic-bezier(.2,.9,.3,1);
}
@keyframes drawerIn { from { transform: translateX(20px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.drawer-head { padding: 16px 18px 8px; display: flex; justify-content: space-between; align-items: center; }
.drawer-head h3 { font-size: 14px; font-weight: 700; margin: 0; letter-spacing: -0.01em; }

/* Toast */
.toast-wrap {
  position: fixed;
  top: 80px;
  right: 24px;
  z-index: 60;
  display: flex; flex-direction: column; gap: 8px;
}
.toast {
  background: var(--ink);
  color: var(--bg);
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: slideIn .25s cubic-bezier(.2,.9,.3,1);
  display: flex; align-items: center; gap: 10px;
  letter-spacing: -0.005em;
}
.toast .ok { color: var(--rain); font-weight: 700; }
@keyframes slideIn { from { transform: translateX(20px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ====================================================================== */
/*  MOBILE / RESPONSIVE                                                   */
/*  All adaptations live below this line so they can be reverted by       */
/*  truncating from this header. No selector class names are renamed.     */
/* ====================================================================== */

/* iOS Safari: 16px on inputs disables auto-zoom on focus.                */
@media (max-width: 720px) {
  input, textarea, select {
    font-size: 16px !important;
  }
}

/* Hamburger button (visible only when nav collapses).                    */
.topbar-burger {
  display: none;
  border: 1px solid var(--line-2);
  background: var(--surface);
  color: var(--ink);
  width: 38px;
  height: 38px;
  border-radius: 10px;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
}
.topbar-burger:hover { background: var(--surface-2); }
.topbar-burger svg { display: block; }

/* Mobile sheet (slides down from topbar).                                */
.topbar-sheet {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  z-index: 50;
  padding: 14px 18px 18px;
  flex-direction: column;
  gap: 12px;
  max-height: 100dvh;
  overflow: auto;
}
.topbar-sheet.open { display: flex; }
.topbar-sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 4px;
}
.topbar-sheet-head .brand { font-size: 17px; }
.topbar-sheet .search { max-width: 100%; }
.topbar-sheet .nav { flex-direction: column; align-items: stretch; gap: 2px; }
.topbar-sheet .nav-btn {
  text-align: left;
  padding: 12px 14px;
  font-size: 15px;
  border-radius: 10px;
}
.topbar-sheet-actions {
  display: flex;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}
.topbar-sheet-actions .btn { flex: 1; justify-content: center; }
.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.32);
  z-index: 49;
  display: none;
  animation: fadeIn .2s ease;
}
.sheet-backdrop.open { display: block; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
[data-theme="dark"] .sheet-backdrop { background: rgba(0,0,0,0.6); }

/* === Tablet (≤1024px): 3-col grid, narrower hero =================== */
@media (max-width: 1024px) {
  .market-grid { grid-template-columns: repeat(3, 1fr) !important; }
  .market-grid.dense { grid-template-columns: repeat(4, 1fr) !important; }
  .topbar-inner { padding: 12px 20px; gap: 16px; }
  .page { padding: 20px 20px 64px; }
  .hero-feature h3 { font-size: 32px; }
}

/* === Wide phone / small tablet (≤860px) ============================== */
@media (max-width: 860px) {
  /* Topbar: hide search + nav inline, swap to hamburger */
  .topbar-inner > .search,
  .topbar-inner > .nav,
  .topbar-inner > .topbar-right .btn-ghost,
  .topbar-inner > .topbar-right .btn:not(.btn-primary):not(#rain-wallet-mount *) {
    display: none;
  }
  .topbar-inner { gap: 12px; padding: 12px 16px; }
  .topbar-burger { display: inline-flex; }
  .rain-wallet-slot { transform: scale(0.92); transform-origin: right center; }

  /* Catnav: tighter padding so chips don't crowd the edge */
  .catnav { padding: 4px 16px; }
  .catnav-btn { padding: 9px 10px; font-size: 12.5px; }

  /* Portfolio summary: stack 3 stat cards vertically */
  .port-head { grid-template-columns: 1fr !important; }
  .port-stat { padding: 18px; }

  /* Detail head: wrap, drop alert/share buttons to next row */
  .detail-head { flex-wrap: wrap; gap: 12px; }
  .detail-head .btn { padding: 7px 11px; font-size: 12.5px; }
}

/* === Phone (≤720px) ================================================== */
@media (max-width: 720px) {
  /* Ticker shrinks */
  .ticker { height: 36px; margin: 10px 12px 0; border-radius: 10px; }
  .ticker-badge { padding: 0 12px 0 14px; }
  .ticker-badge-label { font-size: 9.5px; }
  .ticker-badge-sub { display: none; }
  .ticker-pulse { width: 7px; height: 7px; }
  .ticker-item .sym { display: none; }
  .ticker-item .lbl { max-width: 220px; }

  /* Hero stacks vertical */
  .hero-feature {
    grid-template-columns: 1fr !important;
    padding: 28px 20px;
    min-height: 0;
    gap: 18px;
    border-radius: 18px;
  }
  .hero-feature h3 { font-size: 24px; line-height: 1.18; }
  .hero-feature .hero-meta { font-size: 11.5px; gap: 8px; flex-wrap: wrap; }
  .hero-feature .hero-right { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; width: 100%; }
  .hero-feature .hero-buy {
    width: 100%;
    min-width: 0;
    padding: 14px 16px;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
  }
  .hero-feature .hero-buy .lbl { font-size: 11px; }
  .hero-feature .hero-buy .px { font-size: 18px; }

  /* Section head + filters */
  .section-head { flex-direction: column; align-items: flex-start; gap: 6px; }
  .filters {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
  }
  .filters::-webkit-scrollbar { display: none; }
  .filters .filters-right { display: none; }

  /* Detail grid: stack chart + side panel */
  .detail-grid { grid-template-columns: 1fr !important; gap: 14px; }
  .detail-grid > div:nth-child(1) { order: 1; }
  .detail-grid > .side { order: 2; }
  .detail-title { font-size: 22px !important; line-height: 1.2; }
  .detail-meta { font-size: 11.5px; flex-wrap: wrap; gap: 8px; }
  .chart-wrap svg { aspect-ratio: 16 / 11; height: auto; }
  .chart-tooltip { display: none; }

  /* Order book + activity stack */
  .detail-grid > div:nth-child(1) > div[style*="grid-template-columns:1fr 1fr"],
  .detail-grid > div:nth-child(1) > div[style*="grid-template-columns: 1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }

  /* Trade panel: full width, sticky CTA */
  .trade-panel { padding: 16px; }
  .trade-panel .outcome-pick {
    max-height: 240px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .amount-input { font-size: 28px !important; }

  /* Modal: fullscreen on phones */
  .modal-backdrop { padding: 0 !important; align-items: stretch !important; }
  .modal {
    max-width: 100% !important;
    width: 100% !important;
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0 !important;
    display: flex;
    flex-direction: column;
  }
  .modal-body {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .modal-foot { padding: 12px 16px; flex-wrap: wrap; gap: 8px; }
  .modal-foot .hint { display: none; }
  .modal-foot > div:last-child { flex: 1; justify-content: flex-end; }
  /* Step bar shrinks to dots */
  .steps { gap: 6px; }
  .step-bar { height: 4px; }

  /* Portfolio: positions table → card list */
  .pos-table thead { display: none; }
  .pos-table, .pos-table tbody, .pos-table tr, .pos-table td { display: block; }
  .pos-table tr {
    border: 1px solid var(--line);
    border-radius: 14px;
    margin-bottom: 10px;
    padding: 14px;
    background: var(--surface);
  }
  .pos-table td {
    border: none;
    padding: 5px 0;
    text-align: left;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
  }
  /* Market cell spans full width as the card heading */
  .pos-table td:first-child {
    border-bottom: 1px solid var(--line);
    margin-bottom: 6px;
    padding-bottom: 10px;
  }
  .pos-table td .pos-name { width: 100%; }
  .pos-table td:nth-child(2)::before { content: "Side"; color: var(--ink-3); font-size: 11.5px; letter-spacing: 0.04em; text-transform: uppercase; font-weight: 600; }
  .pos-table td:nth-child(3)::before { content: "Shares"; color: var(--ink-3); font-size: 11.5px; letter-spacing: 0.04em; text-transform: uppercase; font-weight: 600; }
  .pos-table td:nth-child(4)::before { content: "Avg"; color: var(--ink-3); font-size: 11.5px; letter-spacing: 0.04em; text-transform: uppercase; font-weight: 600; }
  .pos-table td:nth-child(5)::before { content: "Mark"; color: var(--ink-3); font-size: 11.5px; letter-spacing: 0.04em; text-transform: uppercase; font-weight: 600; }
  .pos-table td:nth-child(6)::before { content: "Value"; color: var(--ink-3); font-size: 11.5px; letter-spacing: 0.04em; text-transform: uppercase; font-weight: 600; }
  .pos-table td:nth-child(7)::before { content: "P&L"; color: var(--ink-3); font-size: 11.5px; letter-spacing: 0.04em; text-transform: uppercase; font-weight: 600; }
  .pos-table td:last-child { justify-content: flex-end; padding-top: 10px; border-top: 1px solid var(--line); margin-top: 6px; }

  /* Footer: stack everything */
  .footer-top { flex-direction: column; gap: 24px; }
  .footer-nav { flex-wrap: wrap; gap: 12px 18px; }
  .footer-bottom { flex-direction: column; align-items: flex-start; gap: 14px; }
  .footer-legal { flex-wrap: wrap; gap: 8px 14px; font-size: 12px; }
  .footer-socials { flex-wrap: wrap; }
  .footer-chains { font-size: 11px; }

  /* Toast: bottom on phones */
  .toast-wrap { top: auto; bottom: 80px; right: 12px; left: 12px; align-items: stretch; }
  .toast { font-size: 12.5px; padding: 11px 14px; }

  /* Tweaks panel: smaller */
  .tweaks-fab { right: 12px !important; bottom: 12px !important; }
  .tweaks-panel { right: 0 !important; left: 0 !important; bottom: 0 !important; max-width: 100% !important; border-radius: 18px 18px 0 0 !important; }

  /* Page padding */
  .page { padding: 16px 14px 64px; }
}

/* === Small phone (≤640px): tightest grid + tighter cards ============= */
@media (max-width: 640px) {
  .market-grid,
  .market-grid.dense { grid-template-columns: 1fr !important; gap: 10px; }
  .mcard { padding: 12px; min-height: 0; }
  .mcard-title { font-size: 14px; -webkit-line-clamp: 3; }
  .mcard-foot { font-size: 10.5px; gap: 6px; flex-wrap: wrap; }
  .mc-binary-row { gap: 6px; }
  .mc-up, .mc-down { padding: 9px 11px; font-size: 13px; }
  .mc-row { grid-template-columns: 8px 1fr auto auto !important; gap: 6px; }
  .mc-yes, .mc-no { padding: 4px 9px; min-width: 36px; font-size: 11px; }

  /* Topbar gets even tighter */
  .topbar-inner { padding: 10px 12px; gap: 10px; }
  .brand span { font-size: 16px; }
  .brand-mark { width: 24px; height: 24px; }

  /* Section head meta: hide refresh timer on tiny screens */
  .section-head .meta .meta-time { display: none; }

  /* Detail head buttons */
  .detail-head .btn span:not(.lbl):not(.px) { display: none; }
}

/* === iPhone-narrow (≤380px): kill remaining overflows =============== */
@media (max-width: 380px) {
  .topbar-inner { gap: 8px; padding: 10px 10px; }
  .brand span { display: none; }
  .ticker { margin: 8px 8px 0; }
  .page { padding: 14px 10px 56px; }
  .hero-feature { padding: 22px 16px; }
  .hero-feature h3 { font-size: 21px; }
  .hero-feature .hero-buy .px { font-size: 16px; }
}

/* === Touch device niceties (any width) =============================== */
@media (hover: none) {
  .mcard:hover { transform: none; box-shadow: none; }
  .hero-feature:hover { transform: none; }
}

/* Respect viewport-height units on iOS Safari for full-bleed modals.   */
@supports (height: 100dvh) {
  @media (max-width: 720px) {
    .modal { height: 100dvh; max-height: 100dvh; }
    .topbar-sheet { max-height: 100dvh; }
  }
}

/* ====================================================================== */
/*  MOBILE DETAIL PAGE                                                    */
/*  Trade-first reorder, sticky CTA bar, slide-up trade sheet.            */
/* ====================================================================== */

/* Default desktop two-col grid for OB + activity (replaces inline style). */
.detail-twocol {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

/* Sticky bottom trade bar — phones only. Hidden by default. */
.detail-trade-bar { display: none; }
.trade-sheet-close { display: none; }
.trade-sheet-backdrop { display: none; }

@media (max-width: 720px) {
  /* === Crumb / detail head ============================================ */
  .crumb { font-size: 11.5px; flex-wrap: nowrap; overflow: hidden; }
  .crumb a, .crumb span { white-space: nowrap; }
  .crumb > span:last-child { overflow: hidden; text-overflow: ellipsis; min-width: 0; }

  .detail-head { gap: 12px; align-items: flex-start; }
  .detail-head .mcard-icon { width: 44px !important; height: 44px !important; flex-shrink: 0; }
  .detail-title { font-size: 20px !important; line-height: 1.22; letter-spacing: -0.018em; }
  .detail-meta { font-size: 11px; gap: 6px 10px; row-gap: 4px; }
  .detail-meta .sep { display: none; }

  /* === Reorder cards — trade-first =================================== */
  .detail-grid { display: flex; flex-direction: column; gap: 12px; }
  .detail-main { gap: 12px !important; }
  .detail-main { display: contents !important; }
  /* By using display:contents on the inner wrapper, all cards become
     direct flex children of .detail-grid → we can re-order with CSS. */
  .outcomes-card    { order: 1; }
  .chart-card       { order: 2; }
  .detail-twocol    { order: 4; }   /* OB + activity sit below trade panel */
  .resolution-card  { order: 5; }
  .side             { order: 3; }   /* trade panel inline below chart */

  /* === Chart card ===================================================== */
  .chart-card .card-head { flex-wrap: wrap; gap: 8px; }
  .chart-legend {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    scrollbar-width: none;
    padding-bottom: 4px;
  }
  .chart-legend::-webkit-scrollbar { display: none; }
  .chart-legend .item { flex-shrink: 0; font-size: 11.5px; }
  .range-toggle {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 4px;
  }
  .range-toggle button { padding: 7px 0; font-size: 11.5px; }
  .chart-wrap svg { aspect-ratio: 16 / 10; height: auto; max-height: 220px; }
  .chart-tooltip { display: none !important; }

  /* === Outcomes card — vertical stack rows =========================== */
  .outcomes-card .otable { gap: 6px; }
  .outcomes-card .orow {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px 10px 12px;
    border-radius: 12px;
    background: var(--surface-2);
  }
  .outcomes-card .orow .orow-head {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 0 0 auto;
  }
  .outcomes-card .orow .dot { width: 10px; height: 10px; flex-shrink: 0; }
  .outcomes-card .orow .name {
    font-size: 13.5px;
    font-weight: 500;
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .outcomes-card .orow .pct {
    font-family: var(--font-mono);
    font-weight: 600;
    font-size: 13px;
    min-width: auto;
    flex-shrink: 0;
  }
  .outcomes-card .orow .orow-buys {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .outcomes-card .orow .orow-buys .buy-yes,
  .outcomes-card .orow .orow-buys .buy-no {
    width: auto;
    min-width: 0;
    padding: 9px 10px;
    font-size: 12.5px;
    font-weight: 600;
    text-align: center;
  }

  /* === detail-twocol: stack always on mobile ========================= */
  .detail-twocol { grid-template-columns: 1fr !important; gap: 12px; }

  /* === Order book — drop Total column ================================ */
  .book .book-head { grid-template-columns: 1fr auto !important; }
  .book .book-head > span:last-child { display: none; }
  .book .book-row {
    display: grid;
    grid-template-columns: 1fr auto !important;
    gap: 8px;
    align-items: center;
  }
  .book .book-row > span:last-child { display: none; }

  /* === Activity — two-line rows ====================================== */
  .act-list .act-row {
    display: grid !important;
    grid-template-columns: 28px 1fr auto;
    grid-template-areas:
      "who desc desc"
      ".   amt  when";
    column-gap: 10px;
    row-gap: 2px;
    align-items: center;
    padding: 10px 12px;
  }
  .act-row .who  { grid-area: who; }
  .act-row .desc { grid-area: desc; font-size: 12.5px; }
  .act-row .amt  { grid-area: amt; font-size: 12.5px; }
  .act-row .when { grid-area: when; font-size: 11.5px; }

  /* === Trade sheet — slide up bottom drawer on phones ================ */
  .trade-sheet {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    max-height: 86dvh;
    background: var(--surface);
    border-top: 1px solid var(--line);
    border-top-left-radius: 22px;
    border-top-right-radius: 22px;
    box-shadow: var(--shadow-lg);
    transform: translateY(100%);
    transition: transform .26s cubic-bezier(.2,.9,.3,1);
    z-index: 60;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding: 14px 0 0;
  }
  .trade-sheet::before {
    /* drag handle */
    content: "";
    position: absolute;
    top: 7px; left: 50%;
    width: 44px; height: 4px;
    background: var(--line-2);
    border-radius: 999px;
    transform: translateX(-50%);
  }
  .trade-sheet.open { transform: translateY(0); }
  .trade-sheet { width: 100vw !important; max-width: 100vw !important; }
  .trade-sheet > .card.trade-panel {
    margin: 4px 12px 12px;
    width: auto;
    max-width: calc(100% - 24px);
    box-sizing: border-box;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .trade-sheet .card-head { flex-wrap: wrap; gap: 6px; }
  .trade-sheet .tabs { width: 100%; }
  .trade-sheet .outcome-pick {
    max-height: 200px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .trade-sheet .outcome-opt { padding: 9px 12px; }
  .trade-sheet .outcome-opt .nm {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
  }
  .trade-sheet .summary-list .line { font-size: 12.5px; }
  .trade-sheet .cta {
    font-size: 14px;
    padding: 14px 16px;
    white-space: normal;
    line-height: 1.25;
  }
  .trade-sheet .preset-row { flex-wrap: wrap; }
  .trade-sheet .preset-row button { flex: 1 1 0; min-width: 60px; }
  .trade-sheet-close {
    display: inline-flex !important;
    position: absolute;
    top: 8px; right: 12px;
    z-index: 1;
    border: none;
    background: var(--surface-2);
    color: var(--ink-3);
    width: 30px; height: 30px;
    border-radius: 50%;
    align-items: center;
    justify-content: center;
    padding: 0;
    cursor: pointer;
  }
  .trade-sheet-close:hover { background: var(--line); color: var(--ink); }
  .trade-sheet-backdrop {
    display: block !important;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease;
    z-index: 59;
  }
  .trade-sheet-backdrop.open { opacity: 1; pointer-events: auto; }
  [data-theme="dark"] .trade-sheet-backdrop { background: rgba(0,0,0,0.7); }

  /* === Sticky CTA bar at bottom of viewport ========================== */
  .detail-trade-bar {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    position: fixed;
    left: 0; right: 0; bottom: 0;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px));
    background: color-mix(in srgb, var(--bg) 92%, transparent);
    backdrop-filter: saturate(160%) blur(20px);
    -webkit-backdrop-filter: saturate(160%) blur(20px);
    border-top: 1px solid var(--line);
    z-index: 40;
  }
  .detail-trade-bar.hidden { display: none !important; }
  .detail-trade-bar .dt-yes,
  .detail-trade-bar .dt-no {
    border: none;
    border-radius: 12px;
    padding: 13px 14px;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: -0.005em;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    cursor: pointer;
    transition: transform .1s ease;
  }
  .detail-trade-bar .dt-yes:active,
  .detail-trade-bar .dt-no:active { transform: scale(0.98); }
  .detail-trade-bar .dt-yes { background: var(--rain); color: var(--rain-ink); }
  .detail-trade-bar .dt-no  { background: var(--ink); color: var(--bg); }
  .detail-trade-bar .px { font-family: var(--font-mono); font-size: 13px; opacity: 0.9; }
  .detail-trade-bar .lbl {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* Page padding bottom: leave space for sticky bar so resolution card
     never gets covered by the CTA. */
  .page[data-screen-label="02 Market Detail"] { padding-bottom: 96px; }

  /* TradePanel inside sheet: shrink some sizes */
  .trade-sheet .trade-panel { padding: 14px; }
  .trade-sheet .amount-input { font-size: 24px !important; }
  .trade-sheet .outcome-pick { max-height: 220px; overflow-y: auto; }
}

/* === ≤540px: detail head buttons icon-only ============================ */
@media (max-width: 540px) {
  .detail-head .btn {
    padding: 8px;
    width: 36px;
    height: 36px;
    justify-content: center;
  }
  .detail-head .btn > *:not(svg) { display: none; }
  .detail-trade-bar .lbl { font-size: 12.5px; }
}

/* === ≤390px: tightest sizing ========================================== */
@media (max-width: 390px) {
  .detail-trade-bar { padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0px)); gap: 6px; }
  .detail-trade-bar .dt-yes,
  .detail-trade-bar .dt-no { padding: 12px 12px; }
  .outcomes-card .orow .name { font-size: 12.5px; }
  .outcomes-card .orow { padding: 9px 10px 11px; }
}

/* ====================================================================== */
/*  MOBILE DETAIL — POLYMARKET-PATTERN PASS                               */
/*  Override the earlier mobile detail styles for a cleaner list look.    */
/* ====================================================================== */
@media (max-width: 720px) {
  /* === Detail head: split text + actions ============================ */
  .detail-head { gap: 10px; align-items: flex-start; }
  .detail-head .mcard-icon { width: 40px !important; height: 40px !important; flex-shrink: 0; }
  .detail-head-text { flex: 1; min-width: 0; }
  .detail-head-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex-shrink: 0;
  }
  .detail-head-actions .btn.icon-btn {
    width: 32px; height: 32px;
    padding: 0;
    border-radius: 999px;
    justify-content: center;
  }
  .detail-head-actions .btn.icon-btn .lbl-text { display: none; }
  .detail-title { font-size: 22px !important; line-height: 1.2; letter-spacing: -0.02em; }
  .detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 8px;
    margin-top: 8px;
    align-items: center;
  }
  .detail-meta .sep { display: inline-block !important; width: 3px; height: 3px; border-radius: 50%; background: var(--ink-3); opacity: .5; }

  /* === Outcomes card: drop card chrome, list-style rows ============= */
  .outcomes-card {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
  }
  .outcomes-card .card-head {
    padding: 0 4px 10px;
    border-bottom: 1px solid var(--line);
    margin-bottom: 4px;
  }
  .outcomes-card .card-head h4 { font-size: 15px; font-weight: 600; }
  .outcomes-card .card-head .small { font-size: 12px; color: var(--ink-3); }

  .outcomes-card .otable { display: flex; flex-direction: column; gap: 0; }
  .outcomes-card .orow {
    display: grid;
    grid-template-columns: 22px 1fr auto;
    grid-template-areas:
      "dot name pct"
      "buys buys buys";
    gap: 8px 10px;
    padding: 14px 4px;
    border-radius: 0;
    background: transparent;
    border-bottom: 1px solid var(--line);
  }
  .outcomes-card .orow:last-child { border-bottom: none; }
  .outcomes-card .orow .dot { grid-area: dot; align-self: center; width: 10px; height: 10px; }
  .outcomes-card .orow .name {
    grid-area: name;
    font-size: 14.5px;
    font-weight: 500;
    letter-spacing: -0.005em;
    color: var(--ink);
    align-self: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .outcomes-card .orow .pct {
    grid-area: pct;
    font-family: var(--font-sans);
    font-weight: 700;
    font-size: 16px;
    letter-spacing: -0.01em;
    color: var(--ink);
    align-self: center;
  }
  .outcomes-card .orow .buy-yes,
  .outcomes-card .orow .buy-no {
    grid-row: 2;
    padding: 11px 12px;
    font-size: 13.5px;
    font-weight: 600;
    border-radius: 10px;
    letter-spacing: -0.005em;
    border: none;
    text-align: center;
    margin-top: 4px;
  }
  .outcomes-card .orow .buy-yes { grid-column: 1 / 3; min-width: 0; }
  .outcomes-card .orow .buy-no  { grid-column: 3; min-width: 0; }
  /* Reset earlier orow style override so new rules apply cleanly */
  .outcomes-card .orow .buy-yes,
  .outcomes-card .orow .buy-no { width: auto; }

  /* === Tighten chart card on mobile ================================ */
  .chart-card { padding: 14px; }
  .chart-card .card-head { padding-bottom: 8px; }

  /* === Order book + activity: condense ============================= */
  .detail-twocol .card.tight { padding: 12px; }
  .book-mid { font-size: 12px; padding: 6px 0; }
  .act-list .act-row { padding: 9px 10px; font-size: 12px; }
  .act-row .who { width: 26px; height: 26px; font-size: 10px; }

  /* === Resolution body smaller ===================================== */
  .resolution-card p { font-size: 12.5px !important; line-height: 1.55; }

  /* === Crumb truncation ============================================ */
  .crumb {
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
    overflow: hidden;
    white-space: nowrap;
    font-size: 11.5px;
    margin-bottom: 10px;
  }
  .crumb > * { flex-shrink: 0; }
  .crumb > span:last-child { flex-shrink: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
}

/* === ≤480px: extra tightening ========================================= */
@media (max-width: 480px) {
  .outcomes-card .orow .name { font-size: 13.5px; }
  .outcomes-card .orow .pct  { font-size: 15px; }
  .detail-meta { font-size: 10.5px; }
  .detail-meta .mcard-tag { font-size: 9.5px; padding: 2px 6px; }
}

/* === ≤390px ============================================================ */
@media (max-width: 390px) {
  .detail-head .mcard-icon { width: 36px !important; height: 36px !important; }
  .detail-title { font-size: 19px !important; }
  .outcomes-card .card-head h4 { font-size: 14px; }
  .outcomes-card .orow { padding: 12px 2px; }
}

/* ====================================================================== */
/*  MOBILE DETAIL — POLYMARKET-PATTERN v2                                 */
/*  Branch by market shape:                                               */
/*    .detail-grid.is-binary          → chart-first, big Yes/No CTA       */
/*    .detail-grid.is-multi           → outcomes list only                */
/*    .detail-grid.is-multi.is-drilled → drilled card w/ chart for one    */
/* ====================================================================== */

/* Hide branching elements outside mobile + by default. */
.binary-cta { display: none; }
.outcome-drilled { display: none; }

@media (max-width: 720px) {
  /* === BINARY mode ==================================================== */
  .detail-grid.is-binary .outcomes-card { display: none; }
  .detail-grid.is-binary .binary-cta { display: grid !important; }
  .detail-grid.is-binary .chart-card {
    /* chart goes first via order; full-bleed inside container */
    order: 1;
    margin: 0 -14px;
    border-radius: 0;
    border-left: none;
    border-right: none;
    padding: 14px 14px 18px;
  }
  .detail-grid.is-binary .binary-cta {
    order: 2;
    /* Hug chart-card directly above — cancel the flex-gap between them. */
    margin-top: -16px;
    padding-top: 0;
  }
  /* Also collapse the gap between drilled buttons and the per-outcome chart. */
  .detail-grid.is-multi.is-drilled .chart-card { margin-top: -16px; }
  .detail-grid.is-multi.is-drilled .outcome-drilled { margin-bottom: 0; }
  .detail-grid.is-binary .detail-twocol { order: 4; }
  .detail-grid.is-binary .resolution-card { order: 5; }
  .detail-grid.is-binary .side { order: 3; }
  /* Hide the sticky bar entirely on mobile — the inline binary-cta and the
     per-outcome buttons in the multi list cover the same need without overlap. */
  .detail-trade-bar { display: none !important; }
  /* Drop the page bottom-padding reservation that was for the sticky bar. */
  .page[data-screen-label="02 Market Detail"] { padding-bottom: 24px !important; }

  /* === MULTI mode (list view) ========================================= */
  .detail-grid.is-multi .chart-card { display: none; }
  .detail-grid.is-multi .binary-cta { display: none; }
  .detail-grid.is-multi.is-drilled .outcomes-card { display: none; }
  .detail-grid.is-multi.is-drilled .outcome-drilled { display: block !important; }

  /* === Big Yes/No CTA buttons (used in binary + drilled) ============= */
  .binary-cta {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin: 0 0 6px;
  }
  .binary-cta-yes,
  .binary-cta-no {
    border: none;
    border-radius: 14px;
    padding: 14px 16px;
    height: 56px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
    gap: 2px;
    font-family: var(--font-sans);
    cursor: pointer;
    transition: transform .08s ease;
  }
  .binary-cta-yes:active,
  .binary-cta-no:active { transform: scale(0.98); }
  .binary-cta-yes {
    background: var(--yes);
    color: white;
  }
  .binary-cta-no {
    background: var(--no);
    color: white;
  }
  .binary-cta-yes .lbl,
  .binary-cta-no .lbl {
    font-size: 12px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    opacity: 0.85;
    font-weight: 600;
  }
  .binary-cta-yes .px,
  .binary-cta-no .px {
    font-family: var(--font-sans);
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.02em;
  }

  /* === Outcome row click affordance + selected state ================= */
  .outcomes-card .orow { cursor: pointer; transition: background .12s ease; }
  .outcomes-card .orow:hover { background: var(--surface-2); }
  .outcomes-card .orow.selected {
    background: color-mix(in srgb, var(--rain) 12%, var(--surface));
  }

  /* === Drilled view ================================================== */
  .outcome-drilled {
    border: none !important;
    background: transparent !important;
    padding: 0 !important;
    box-shadow: none !important;
    order: 1;  /* sits above chart in flex order so chart stays below it */
    animation: drillIn .18s ease;
  }
  @keyframes drillIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
  }
  .outcome-drilled-head {
    display: grid;
    grid-template-columns: 32px 12px 1fr auto;
    align-items: center;
    gap: 10px;
    padding: 4px 0 14px;
  }
  .outcome-back {
    width: 32px;
    height: 32px;
    border-radius: 999px;
    border: 1px solid var(--line-2);
    background: var(--surface);
    color: var(--ink);
    display: grid;
    place-items: center;
    padding: 0;
    cursor: pointer;
    transition: background .12s;
  }
  .outcome-back:hover { background: var(--surface-2); }
  .outcome-drilled-head .dot { width: 12px; height: 12px; border-radius: 50%; }
  .outcome-drilled-head .name {
    font-size: 17px;
    font-weight: 600;
    letter-spacing: -0.012em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--ink);
  }
  .outcome-drilled-head .pct {
    font-family: var(--font-sans);
    font-weight: 700;
    font-size: 18px;
    color: var(--ink);
  }
  .outcome-drilled-buys {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 14px;
  }
  .outcome-drilled-buys .binary-cta-yes,
  .outcome-drilled-buys .binary-cta-no { /* inherit cta styles */ }

  /* When drilled, show the chart-card from the multi market (with filtered series) */
  .detail-grid.is-multi.is-drilled .chart-card {
    display: block !important;
    order: 2;
    margin: 0 -14px;
    border-radius: 0;
    border-left: none;
    border-right: none;
    padding: 14px 14px 18px;
  }

  /* === Range toggle: equal-width pill row =========================== */
  .range-toggle {
    display: grid !important;
    grid-template-columns: repeat(5, 1fr);
    gap: 4px;
    background: var(--surface-2);
    padding: 3px;
    border-radius: 999px;
    width: 100%;
    margin-top: 10px;
  }
  .range-toggle button {
    border: none;
    background: transparent;
    padding: 7px 0;
    font-size: 12px;
    font-weight: 600;
    color: var(--ink-3);
    border-radius: 999px;
    transition: background .12s, color .12s;
    letter-spacing: 0.02em;
  }
  .range-toggle button.active {
    background: var(--surface);
    color: var(--ink);
    box-shadow: var(--shadow-sm);
  }

  /* === Chart card on mobile: bigger, full-bleed ===================== */
  .chart-card { padding: 14px; }
  .chart-card .card-head { flex-direction: column; align-items: stretch; gap: 8px; padding-bottom: 10px; }
  .chart-card .chart-legend { width: 100%; }
  .chart-wrap svg { aspect-ratio: 16 / 11; height: auto; max-height: 280px; min-height: 220px; }

  /* Ensure animated drilled chart isn't clipped at the edges */
  .chart-wrap { overflow: hidden; }
}

/* ====================================================================== */
/*  TABLET PORTRAIT (721-980px) — collapse detail-grid to single column   */
/*  so the page is full-width even before the phone-specific redesign.    */
/* ====================================================================== */
@media (max-width: 980px) {
  .detail-grid {
    display: flex !important;
    flex-direction: column;
    grid-template-columns: 1fr !important;
    align-items: stretch !important;  /* override desktop `start` so flex items fill cross-axis */
    gap: 16px;
  }
  .detail-grid > .side:not(.trade-sheet) {
    width: 100%;
    align-self: stretch;
    position: static;
    top: auto;
  }
  .detail-grid > .detail-main {
    width: 100%;
    align-self: stretch;
    min-width: 0;
  }
  /* Direct children that may show up via display:contents on .detail-main */
  .detail-grid > * {
    width: 100%;
    align-self: stretch;
    box-sizing: border-box;
    min-width: 0;
  }
  .detail-grid .chart-card,
  .detail-grid .outcomes-card,
  .detail-grid .resolution-card,
  .detail-grid .detail-twocol,
  .detail-grid .binary-cta,
  .detail-grid .outcome-drilled {
    width: 100%;
    align-self: stretch;
    box-sizing: border-box;
  }
}

/* ====================================================================== */
/*  TABLET PORTRAIT — outcome rows: vertical stack + 50/50 buttons        */
/*  Apply the polymarket-pattern row layout up to 980px so phones AND     */
/*  tablets (Eurovision case at ~810px) get the same clean rows.          */
/* ====================================================================== */
@media (max-width: 980px) {
  .outcomes-card .orow {
    display: flex !important;
    flex-direction: column;
    gap: 10px;
    padding: 12px 12px 14px;
    border-radius: 12px;
    background: var(--surface-2);
    border-bottom: none;
  }
  .outcomes-card .orow .orow-head {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 0 0 auto;
    width: 100%;
  }
  .outcomes-card .orow .dot { width: 10px; height: 10px; flex-shrink: 0; }
  .outcomes-card .orow .name {
    font-size: 14px;
    font-weight: 500;
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .outcomes-card .orow .pct {
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
    min-width: auto;
    text-align: right;
  }
  .outcomes-card .orow .orow-buys {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 8px;
    width: 100%;
  }
  .outcomes-card .orow .orow-buys .buy-yes,
  .outcomes-card .orow .orow-buys .buy-no {
    grid-column: auto !important;
    grid-row: auto !important;
    width: auto !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 11px 10px;
    font-size: 13px;
    font-weight: 600;
    text-align: center;
    box-sizing: border-box;
  }
  .outcomes-card .orow .orow-buys .buy-yes { grid-column: 1 !important; }
  .outcomes-card .orow .orow-buys .buy-no  { grid-column: 2 !important; }
}

/* ====================================================================== */
/*  TRADE SHEET — polymarket-style compact bottom drawer (mobile)         */
/* ====================================================================== */
@media (max-width: 720px) {
  /* Sheet hugs its content, capped at 80dvh. No huge empty area.
     top: auto needed because .side sets top: 80px globally — without
     the override, fixed sheet anchors at top:80, leaving a gap above
     viewport bottom. */
  .trade-sheet {
    top: auto !important;
    bottom: 0 !important;
    height: auto !important;
    max-height: 80dvh !important;
    padding-top: 18px !important;
  }
  .trade-sheet > .card.trade-panel {
    margin: 8px 18px 14px !important;
    padding: 0 !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    max-height: calc(80dvh - 32px);
  }
  .trade-sheet .trade-panel .card-head {
    padding: 0 44px 10px 0 !important;  /* right padding clears close X */
    margin-bottom: 10px !important;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
  .trade-sheet .trade-panel .card-head h4 {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -0.01em;
    margin: 0;
  }
  .trade-sheet .trade-panel .card-head .small {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--ink-2);
  }

  /* Selected outcome chip (compact mode) */
  .trade-sheet .trade-selected {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    margin: 0 0 12px;
    border-radius: 12px;
    background: var(--surface-2);
    border: 1px solid var(--line);
  }
  .trade-sheet .trade-selected .dot {
    width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;
  }
  .trade-sheet .trade-selected .nm {
    flex: 1; min-width: 0;
    font-weight: 600;
    font-size: 14px;
    color: var(--ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .trade-sheet .trade-selected .pct {
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 14px;
    color: var(--ink);
  }

  /* Tabs full width inside sheet */
  .trade-sheet .trade-panel .tabs {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    margin-bottom: 14px;
  }
  .trade-sheet .trade-panel .tabs button {
    padding: 12px 0;
    font-size: 14px;
    font-weight: 600;
    border-radius: 999px;
  }

  /* Amount input prominent */
  .trade-sheet .trade-panel .amount-card {
    background: var(--surface-2);
    padding: 14px;
    border-radius: 14px;
    margin-bottom: 12px;
  }
  .trade-sheet .trade-panel .amount-input {
    font-size: 28px !important;
    font-weight: 700;
    letter-spacing: -0.02em;
  }
  .trade-sheet .trade-panel .amount-prefix {
    font-size: 22px;
    font-weight: 600;
  }

  /* Summary tightened */
  .trade-sheet .trade-panel .summary-list {
    padding: 10px 0;
    margin-bottom: 8px;
  }
  .trade-sheet .trade-panel .summary-list .line {
    font-size: 12.5px;
    padding: 4px 0;
  }

  /* CTA — full width, big tap target */
  .trade-sheet .trade-panel .cta {
    width: 100%;
    padding: 15px 16px !important;
    font-size: 15px !important;
    font-weight: 700;
    border-radius: 999px;
    margin-top: 4px;
  }

  .trade-sheet .trade-panel .mini-foot {
    text-align: center;
    margin-top: 10px;
    font-size: 11px;
    color: var(--ink-3);
  }
}
