/* Markets app. Builds on the tokens and base styles in style.css. */

:root {
  --yes: var(--success);
  --yes-soft: rgba(63, 191, 127, 0.14);
  --no: var(--danger);
  --no-soft: rgba(240, 100, 94, 0.14);
  --app-width: 1240px;
}

a { color: inherit; }

/* ---------- header ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(5, 7, 12, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.topbar-row {
  max-width: var(--app-width);
  margin: 0 auto;
  padding: 14px 20px 10px;
  display: flex;
  align-items: center;
  gap: 28px;
}

.app-nav { display: flex; align-items: center; gap: 22px; }
.nav-link {
  text-decoration: none;
  color: var(--text);
  opacity: 0.78;
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
  padding: 6px 0;
  transition: opacity 0.15s ease, color 0.15s ease;
}
.nav-link:hover { opacity: 1; }
.nav-link.active { opacity: 1; color: var(--accent-strong); }
.live-count { color: var(--danger); margin-left: 2px; }
.live-count[hidden] { display: none; }

.global-search {
  flex: 1;
  min-width: 160px;
  max-width: 420px;
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-dim);
  transition: border-color 0.15s ease;
}
.global-search:focus-within { border-color: var(--accent); }
.global-search input {
  flex: 1;
  min-width: 0;
  background: none;
  border: 0;
  outline: none;
  color: var(--text);
  font: inherit;
  font-size: 15px;
  padding: 10px 0;
}
.global-search input::placeholder { color: var(--text-dim); }

.header-actions { display: flex; align-items: center; gap: 10px; flex: none; }

.balance-chip {
  text-decoration: none;
  font-weight: 700;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--accent-strong);
  white-space: nowrap;
}

.lang-select {
  appearance: none;
  -webkit-appearance: none;
  background: var(--card) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%238a97aa' stroke-width='1.5'/%3E%3C/svg%3E") no-repeat right 12px center;
  border: 1px solid var(--border);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  padding: 8px 28px 8px 12px;
  border-radius: 999px;
  cursor: pointer;
}

.btn-primary {
  background: var(--accent);
  color: var(--on-accent);
  border: 0;
  border-radius: 999px;
  font: inherit;
  font-weight: 800;
  font-size: 14px;
  padding: 10px 18px;
  cursor: pointer;
  white-space: nowrap;
  transition: filter 0.15s ease, transform 0.15s ease;
}
.btn-primary:hover { filter: brightness(1.08); }
.btn-primary:active { transform: scale(0.97); }

.cat-bar {
  max-width: var(--app-width);
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  gap: 24px;
  overflow-x: auto;
  scrollbar-width: none;
}
.cat-bar::-webkit-scrollbar { display: none; }
.cat {
  flex: none;
  text-decoration: none;
  color: var(--text-dim);
  font-size: 15px;
  font-weight: 600;
  padding: 8px 0 12px;
  border-bottom: 2px solid transparent;
}
.cat:hover { color: var(--text); }
.cat.active { color: var(--text); border-bottom-color: var(--accent); }

.demo-banner {
  max-width: var(--app-width);
  margin: 14px auto 0;
  padding: 0 20px;
  color: var(--text-dim);
  font-size: 13px;
}

.app-main {
  max-width: var(--app-width);
  margin: 0 auto;
  padding: 18px 20px 64px;
  min-height: 60vh;
}

/* ---------- shared bits ---------- */

.panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}
.panel h2 { font-size: 16px; margin-bottom: 12px; }
.panel h2 + p { color: var(--text-dim); font-size: 14px; }
.panel p + h2 { margin-top: 20px; }

.crumb { color: var(--text-dim); font-size: 13px; font-weight: 600; }
.crumb a { text-decoration: none; }
.crumb a:hover { color: var(--accent-strong); }

.empty { color: var(--text-dim); padding: 40px 0; text-align: center; }
.empty a { color: var(--accent-strong); }
.muted { color: var(--text-dim); }
.gain { color: var(--yes); font-style: normal; }
.loss { color: var(--no); }

.delta { font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; }
.delta.up { color: var(--yes); }
.delta.down { color: var(--no); }
.delta.flat { color: var(--text-dim); }

@keyframes flash { from { background: rgba(var(--accent-rgb), 0.35); } to { background: transparent; } }
.flash { animation: flash 0.9s ease-out; border-radius: 4px; }

.star {
  background: none;
  border: 0;
  color: var(--text-dim);
  font-size: 18px;
  line-height: 1;
  padding: 4px;
  cursor: pointer;
  border-radius: 6px;
}
.star:hover, .star.on { color: var(--accent-strong); }

.btn-yes, .btn-no, .mini-yes, .mini-no {
  text-decoration: none;
  font-weight: 700;
  font-size: 14px;
  text-align: center;
  border-radius: 8px;
  padding: 9px 10px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.btn-yes, .mini-yes { background: var(--yes-soft); color: var(--yes); }
.btn-no, .mini-no { background: var(--no-soft); color: var(--no); }
.btn-yes:hover, .btn-yes.active, .mini-yes:hover { background: var(--yes); color: var(--on-success); }
.btn-no:hover, .btn-no.active, .mini-no:hover { background: var(--no); color: var(--on-danger); }
.mini-yes, .mini-no { font-size: 12px; padding: 5px 9px; border-radius: 6px; }

.seg {
  display: flex;
  gap: 2px;
  padding: 3px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.seg button {
  flex: 1;
  background: transparent;
  border: 0;
  color: var(--text-dim);
  font: inherit;
  font-weight: 700;
  font-size: 14px;
  padding: 8px 10px;
  border-radius: 7px;
  cursor: pointer;
}
.seg button:hover { color: var(--text); }
.seg button.active { background: var(--card); color: var(--text); box-shadow: 0 0 0 1px var(--border); }
.seg.small button { font-size: 12px; padding: 6px 8px; }

.chip {
  display: inline-block;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  color: var(--text);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  padding: 6px 10px;
  border-radius: 999px;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}
.chip:hover { border-color: var(--accent); }

button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- home ---------- */

.home {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 24px;
  align-items: start;
  margin-bottom: 40px;
}
.home-main { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.home-side { display: flex; flex-direction: column; gap: 14px; }

.hero-market {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 22px 24px 24px;
}
.hero-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.hero-cat {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.hero-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--bg-alt);
  display: grid;
  place-items: center;
  font-size: 19px;
  letter-spacing: 0;
}
.pager { display: inline-flex; align-items: center; gap: 12px; font-size: 14px; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.pager-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0 0 2px;
}
.pager-btn:hover { border-color: var(--accent); }
.hero-title {
  display: block;
  margin: 16px 0 20px;
  font-family: "Space Grotesk", sans-serif;
  font-weight: 600;
  font-size: clamp(22px, 2.6vw, 30px);
  line-height: 1.15;
  text-decoration: none;
}
.hero-title:hover { color: var(--accent-strong); }
.hero-body { display: grid; grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr); gap: 28px; align-items: start; }
.hero-row { display: grid; grid-template-columns: minmax(0, 1fr) 62px 88px; align-items: center; gap: 12px; }
.hero-row + .hero-row { margin-top: 12px; }
.hero-head { font-size: 12px; color: var(--text-dim); }
.hero-head span:not(:first-child) { text-align: center; }
.hero-name { display: flex; flex-direction: column; gap: 7px; min-width: 0; text-decoration: none; }
.hero-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hero-label i { flex: none; width: 8px; height: 8px; border-radius: 50%; }
.hero-name:hover .hero-label { color: var(--accent-strong); }
.hero-bar { display: block; height: 3px; border-radius: 2px; max-width: 100%; transition: width 0.4s ease; }
.hero-payout { text-align: center; color: var(--text-dim); font-size: 14px; font-variant-numeric: tabular-nums; }
.odds-pill {
  display: block;
  text-align: center;
  text-decoration: none;
  font-weight: 800;
  font-size: 16px;
  font-variant-numeric: tabular-nums;
  padding: 9px 0;
  border-radius: 999px;
  border: 1.5px solid rgba(var(--accent-rgb), 0.55);
  transition: background-color 0.15s ease, border-color 0.15s ease;
}
.odds-pill:hover { background: rgba(var(--accent-rgb), 0.12); border-color: var(--accent); }
.hero-foot {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px dashed var(--border);
  color: var(--text-dim);
  font-size: 13px;
}
.hero-foot a { color: var(--text-dim); text-decoration: none; }
.hero-foot a:hover { color: var(--text); }
.hero-chart-wrap { min-width: 0; }
.hero-chart-wrap .legend { font-size: 13px; }

.legend-item i, .chart-tip i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }

.info-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.info-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 18px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  text-decoration: none;
  transition: border-color 0.15s ease;
}
.info-card:hover { border-color: #2d3b52; }
.info-icon {
  flex: none;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: var(--accent);
  background: rgba(var(--accent-rgb), 0.12);
}
.info-card b { display: block; font-size: 15px; line-height: 1.3; }
.info-card b + span { display: block; margin-top: 3px; color: var(--text-dim); font-size: 13px; line-height: 1.4; }

.hub {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px;
  border-radius: 16px;
  border: 1px solid var(--border);
  text-decoration: none;
  background: linear-gradient(120deg, rgba(var(--tint), 0.2), var(--card) 55%);
  transition: border-color 0.15s ease;
}
.hub:hover { border-color: rgba(var(--tint), 0.6); }
.hub-0 { --tint: var(--accent-rgb); }
.hub-1 { --tint: var(--magenta-rgb); }
.hub-2 { --tint: 242, 194, 107; }
.hub b { display: block; font-size: 17px; }
.hub b + span { color: var(--text-dim); font-size: 14px; font-variant-numeric: tabular-nums; }
.chev { color: var(--text-dim); font-size: 22px; line-height: 1; }

.trend-box {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px 20px 6px;
}
.trend-box h2 { font-size: 18px; padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.trend-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; padding: 14px 0; text-decoration: none; }
.trend-row + .trend-row { border-top: 1px solid rgba(29, 37, 51, 0.6); }
.trend-text b { display: block; font-size: 14px; font-weight: 600; line-height: 1.35; }
.trend-row:hover .trend-text b { color: var(--accent-strong); }
.trend-text span { color: var(--text-dim); font-size: 13px; }
.trend-num { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; font-weight: 800; font-variant-numeric: tabular-nums; }

.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.section-head h2 { font-size: 22px; }

.select, .field input {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  border-radius: 10px;
  padding: 9px 12px;
}
.select { cursor: pointer; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

.card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}
.card:hover { background: var(--card-hover); border-color: #2d3b52; transform: translateY(-2px); }
.card-head { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: start; }
.card-icon, .event-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--bg-alt);
  font-size: 20px;
}
.card-title { font-weight: 700; font-size: 15px; line-height: 1.35; text-decoration: none; }
.card-title:hover { color: var(--accent-strong); }

.card-binary { display: flex; flex-direction: column; gap: 12px; margin-top: auto; }
.gauge { position: relative; flex: none; width: 64px; text-align: center; margin-top: -2px; }
.gauge svg { display: block; width: 64px; height: 36px; }
.gauge-track, .gauge-fill { fill: none; stroke-width: 6; stroke-linecap: round; }
.gauge-track { stroke: var(--border); }
.gauge-fill { stroke: var(--success); transition: stroke-dasharray 0.4s ease; }
.gauge.low .gauge-fill { stroke: var(--danger); }
.gauge b { position: absolute; left: 0; right: 0; top: 15px; font-size: 14px; font-variant-numeric: tabular-nums; }
.gauge small { display: block; margin-top: -1px; font-size: 10px; color: var(--text-dim); }
.yn { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.card-outcomes { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.card-outcomes li { display: grid; grid-template-columns: 1fr auto auto auto; align-items: center; gap: 6px; }
.oc-label { text-decoration: none; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
a.oc-label:hover { color: var(--accent-strong); }
.oc-pct { font-weight: 700; font-variant-numeric: tabular-nums; min-width: 3ch; text-align: right; }
.more { color: var(--text-dim); font-size: 13px; margin-top: -4px; }

.foot-end { display: inline-flex; align-items: center; gap: 6px; }
.card-foot .star { font-size: 16px; padding: 0 2px; margin: -4px -2px; }
.card-foot {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--text-dim);
  font-size: 12px;
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

/* ---------- chart ---------- */

.chart { position: relative; width: 100%; min-height: 120px; }
.chart svg { display: block; touch-action: pan-y; }
.chart .gridline { stroke: var(--border); stroke-width: 1; stroke-dasharray: 2 4; }
.chart .axis { fill: var(--text-dim); font-size: 11px; font-family: "Manrope", sans-serif; }
.chart .hover-line { stroke: var(--text-dim); stroke-width: 1; }
.chart-tip {
  position: absolute;
  top: 6px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 12px;
  pointer-events: none;
  white-space: nowrap;
}
.chart-tip[hidden] { display: none; }
.chart-tip span { display: flex; align-items: center; gap: 6px; }

.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-bottom: 10px; font-size: 14px; }
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.ranges { display: flex; gap: 4px; margin-top: 8px; }
.range {
  background: none;
  border: 0;
  color: var(--text-dim);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 6px;
  cursor: pointer;
}
.range:hover { color: var(--text); }
.range.active { background: var(--bg-alt); color: var(--text); }

/* ---------- event page ---------- */

.back { display: inline-block; color: var(--text-dim); text-decoration: none; font-size: 14px; margin-bottom: 16px; }
.back:hover { color: var(--text); }

.event-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  grid-template-areas:
    "head trade"
    "chart trade"
    "outcomes trade"
    "book trade"
    "rules trade"
    "related related";
  grid-template-rows: auto auto auto auto 1fr auto;
  gap: 16px 24px;
  align-items: start;
}
.event-head { grid-area: head; display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: start; }
.event-head .event-icon { width: 52px; height: 52px; font-size: 28px; border-radius: 14px; }
.event-head h1 { font-size: clamp(1.4rem, 3vw, 1.9rem); line-height: 1.2; margin: 2px 0 6px; }
.event-head .meta { color: var(--text-dim); font-size: 13px; }
.chart-panel { grid-area: chart; }
.outcomes { grid-area: outcomes; padding: 6px 18px; }
.book-panel { grid-area: book; }
.rules-panel { grid-area: rules; }
.related { grid-area: related; margin-top: 12px; }
.related h2 { font-size: 18px; margin-bottom: 12px; }

.outcomes table { width: 100%; border-collapse: collapse; }
.outcomes th { text-align: left; color: var(--text-dim); font-size: 12px; font-weight: 600; padding: 10px 0 6px; }
.outcomes td { padding: 10px 0; border-top: 1px solid var(--border); }
.outcomes td a:not(.btn-yes):not(.btn-no) { text-decoration: none; font-weight: 600; }
.outcomes tr.selected td:first-child a { color: var(--accent-strong); }
.outcomes .oc-pct { text-align: left; white-space: nowrap; }
.oc-buttons { display: flex; justify-content: flex-end; gap: 6px; }
.oc-buttons a { min-width: 84px; }

.panel-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; }
.panel-head h2 { margin: 0; }

.book { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.book th { text-align: right; color: var(--text-dim); font-weight: 600; padding: 4px 8px; }
.book th:first-child, .book td:first-child { text-align: left; }
.book td { text-align: right; padding: 4px 8px; }
.book .bar-cell { position: relative; font-weight: 700; }
.book .bar { position: absolute; left: 0; top: 2px; bottom: 2px; border-radius: 3px; z-index: -1; }
.book .ask .bar { background: var(--no-soft); }
.book .bid .bar { background: var(--yes-soft); }
.book .ask .bar-cell { color: var(--no); }
.book .bid .bar-cell { color: var(--yes); }
.book .bar-cell { isolation: isolate; }
.book .spread td, .book .book-label td { text-align: center; color: var(--text-dim); font-size: 12px; padding: 6px; }
.book .spread td { border-top: 1px dashed var(--border); border-bottom: 1px dashed var(--border); }
.book .book-label td { text-align: left; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; font-size: 11px; }

.timeline { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 0; }
.timeline div { background: var(--bg-alt); border-radius: 10px; padding: 10px 12px; }
.timeline dt { color: var(--text-dim); font-size: 12px; }
.timeline dd { margin: 2px 0 0; font-weight: 600; font-size: 14px; }

/* ---------- trade panel ---------- */

.trade-panel {
  grid-area: trade;
  position: sticky;
  top: 132px; /* clears the pinned header */
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.tp-outcome { font-weight: 700; font-size: 15px; line-height: 1.3; }
.sides { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.sides button {
  font: inherit;
  font-weight: 700;
  font-size: 15px;
  padding: 11px;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
  font-variant-numeric: tabular-nums;
}
.sides .side-yes { background: var(--yes-soft); color: var(--yes); }
.sides .side-no { background: var(--no-soft); color: var(--no); }
.sides .side-yes.active { background: var(--yes); color: var(--on-success); }
.sides .side-no.active { background: var(--no); color: var(--on-danger); }

.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--text-dim); font-weight: 600; }
.field input { width: 100%; font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }
.input-row { display: flex; gap: 8px; align-items: center; }
.chips { display: flex; gap: 6px; }
.hold { font-size: 14px; }
.hint { color: var(--text-dim); font-size: 12px; }
.hint:empty, .trade-error:empty { display: none; }

.summary { margin: 0; display: grid; gap: 6px; font-size: 14px; }
.summary div { display: flex; justify-content: space-between; gap: 10px; }
.summary dt { color: var(--text-dim); }
.summary dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.trade-error { color: var(--no); font-size: 13px; font-weight: 600; }

.submit {
  font: inherit;
  font-weight: 800;
  font-size: 16px;
  padding: 14px;
  border: 0;
  border-radius: 10px;
  cursor: pointer;
  transition: filter 0.15s ease, transform 0.15s ease;
}
.submit.side-yes { background: var(--yes); color: var(--on-success); }
.submit.side-no { background: var(--no); color: var(--on-danger); }
.submit:hover:not(:disabled) { filter: brightness(1.08); }
.submit:active:not(:disabled) { transform: scale(0.98); }
.submit:disabled { opacity: 0.4; cursor: not-allowed; }

/* ---------- portfolio ---------- */

.portfolio-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; }
.portfolio-head h1 { font-size: 28px; }
.link-button { background: none; border: 0; color: var(--text-dim); font: inherit; font-size: 14px; cursor: pointer; text-decoration: underline; }
.link-button:hover { color: var(--no); }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 20px; }
.stat { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 4px; }
.stat span { color: var(--text-dim); font-size: 13px; }
.stat b { font-family: "Space Grotesk", sans-serif; font-size: 24px; font-variant-numeric: tabular-nums; }

.tabs { max-width: 420px; margin-bottom: 12px; }
.table-panel { padding: 4px 16px; overflow-x: auto; }
.data { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.data th { text-align: left; color: var(--text-dim); font-size: 12px; font-weight: 600; padding: 12px 10px 8px 0; white-space: nowrap; }
.data td { padding: 12px 10px 12px 0; border-top: 1px solid var(--border); white-space: nowrap; }
.data td:first-child { white-space: normal; min-width: 220px; }
.data td a:not(.chip) { text-decoration: none; font-weight: 600; }
.data td a:not(.chip):hover { color: var(--accent-strong); }
.badge { font-size: 12px; font-weight: 800; padding: 3px 8px; border-radius: 6px; }
.badge.yes { background: var(--yes-soft); color: var(--yes); }
.badge.no { background: var(--no-soft); color: var(--no); }

/* ---------- toasts ---------- */

.toasts {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 50;
  width: min(420px, calc(100vw - 32px));
}
.toast {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-left: 4px solid var(--yes);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  animation: toast-in 0.2s ease-out;
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.toast.out { opacity: 0; transform: translateY(8px); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ---------- waitlist ---------- */

.waitlist-band {
  margin-top: 48px;
  padding: 44px 24px 36px;
  text-align: center;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: radial-gradient(70% 120% at 50% 0%, rgba(var(--accent-rgb), 0.1), transparent 70%), var(--card);
}
.waitlist-band h2 { font-size: clamp(30px, 4.4vw, 46px); line-height: 1.1; }
.waitlist-band > p { max-width: 560px; margin: 12px auto 0; color: var(--text-dim); }

.link-button.inline { color: var(--accent-strong); font-size: inherit; padding: 0; }
.link-button.inline:hover { color: var(--text); }

.dialog {
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--card);
  color: var(--text);
  padding: 30px 26px 22px;
  width: min(460px, calc(100vw - 32px));
  text-align: center;
}
.dialog::backdrop { background: rgba(0, 0, 0, 0.65); }
.dialog h2 { font-size: 24px; }
.dialog-text { margin-top: 8px; color: var(--text-dim); }
.dialog-close {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text-dim);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}
.dialog-close:hover { color: var(--text); background: var(--bg-alt); }

/* ---------- live & how it works ---------- */

.page-head { margin: 6px 0 20px; }
.page-head h1 { font-size: 30px; display: flex; align-items: center; gap: 12px; }
.page-head p { color: var(--text-dim); margin-top: 6px; }
.live-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--danger);
  box-shadow: 0 0 0 0 rgba(242, 96, 90, 0.6);
  animation: live-pulse 1.6s ease-out infinite;
}
@keyframes live-pulse { to { box-shadow: 0 0 0 10px rgba(242, 96, 90, 0); } }

.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.step, .why-grid li { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px 22px; }
.step-num {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(var(--accent-rgb), 0.14);
  color: var(--accent-strong);
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 14px;
}
.step h3, .why-grid h3 { font-size: 17px; margin-bottom: 8px; }
.step p, .why-grid p { color: var(--text-dim); font-size: 14px; }
.why { margin-top: 44px; }
.why h2 { font-size: 24px; }
.why-lead { color: var(--text-dim); margin-top: 8px; max-width: 620px; }
.why-grid { list-style: none; margin: 18px 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }

/* ---------- responsive ---------- */

@media (max-width: 1080px) {
  .topbar-row { gap: 18px; }
  .app-nav { gap: 16px; }
  .home { grid-template-columns: minmax(0, 1fr); }
  .home-side { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .trend-box { grid-column: 1 / -1; }
}

@media (max-width: 960px) {
  .topbar-row { flex-wrap: wrap; row-gap: 10px; }
  .global-search { order: 5; flex-basis: 100%; max-width: none; margin-left: 0; }
  .header-actions { margin-left: auto; }
  .event-layout {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "head" "chart" "outcomes" "trade" "book" "rules" "related";
    grid-template-rows: none;
  }
  .trade-panel { position: static; }
  .hero-body { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 720px) {
  .info-cards, .steps, .why-grid, .home-side { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 640px) {
  /* A three-row header would eat too much of a phone screen if it stayed pinned. */
  .topbar { position: static; }
  .topbar-row { padding: 12px 16px 8px; }
  .topbar .brand-logo { height: 34px; width: auto; } /* keeps logo + language + sign-up on one row */
  .app-nav { order: 4; flex-basis: 100%; overflow-x: auto; scrollbar-width: none; gap: 18px; }
  .balance-chip { display: none; }
  .cat-bar { padding: 0 16px; }
  .demo-banner, .app-main { padding-left: 16px; padding-right: 16px; }
  .hero-market { padding: 18px 16px 20px; }
  .hero-row { grid-template-columns: minmax(0, 1fr) 54px 76px; gap: 8px; }
  .stats, .timeline { grid-template-columns: minmax(0, 1fr); }
  .oc-buttons a { min-width: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .flash, .toast { animation: none; }
  .card:hover { transform: none; }
  .gauge-fill, .hero-bar { transition: none; }
  .live-dot { animation: none; }
}
