:root {
  --bg: #09111a;
  --bg-elevated: #0f1823;
  --surface: rgba(19, 29, 42, 0.94);
  --surface-strong: rgba(23, 35, 49, 0.98);
  --surface-soft: rgba(16, 24, 36, 0.78);
  --line: rgba(114, 133, 158, 0.2);
  --line-strong: rgba(150, 176, 210, 0.24);
  --text: #eef5ff;
  --muted: #8d9aab;
  --blue: #1692ff;
  --blue-soft: rgba(22, 146, 255, 0.16);
  --green: #28d17c;
  --green-soft: rgba(40, 209, 124, 0.16);
  --red: #ff5f66;
  --red-soft: rgba(255, 95, 102, 0.16);
  --amber: #f7b941;
  --amber-soft: rgba(247, 185, 65, 0.16);
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
  color: var(--text);
  font-family: "IBM Plex Sans", "Avenir Next", "Segoe UI", system-ui, sans-serif;
  text-rendering: optimizeLegibility;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 12% 0%, rgba(22, 146, 255, 0.16), transparent 24rem),
    radial-gradient(circle at 88% 8%, rgba(40, 209, 124, 0.08), transparent 26rem),
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent 28rem),
    var(--bg);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(141, 154, 171, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(141, 154, 171, 0.05) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.35), transparent 72%);
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  display: block;
  max-width: 100%;
}

button,
input {
  font: inherit;
}

.app-shell {
  position: relative;
  z-index: 1;
  width: min(100%, 1920px);
  margin: 0 auto;
  padding: 20px;
  overflow-x: clip;
}

.panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.025), transparent 20%), var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(11, 18, 27, 0.9);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.brand-logo {
  width: 224px;
  max-width: 100%;
  flex: 0 0 auto;
}

.brand-copy {
  display: grid;
  gap: 4px;
  white-space: nowrap;
}

.brand-copy strong {
  font-size: 0.98rem;
}

.brand-kicker,
.eyebrow {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.72rem;
}

.topbar-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  flex: 1;
  min-width: 0;
}

.searchbox {
  position: relative;
  display: grid;
  gap: 6px;
  min-width: 0;
  width: 100%;
  max-width: 580px;
  flex: 1 1 460px;
}

.searchbox span {
  color: var(--muted);
  white-space: nowrap;
}

.searchbox input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(22, 32, 45, 0.92);
  color: var(--text);
  padding: 14px 16px;
}

.searchbox input::placeholder {
  color: rgba(141, 154, 171, 0.8);
}

.action-cluster {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.status-stack {
  display: grid;
  gap: 2px;
  white-space: nowrap;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.03);
}

.status-stack .label,
.secondary {
  color: var(--muted);
}

#status-pill {
  font-size: 0.95rem;
  color: var(--text);
}

.button {
  border: 1px solid transparent;
  border-radius: 16px;
  padding: 12px 16px;
  background: linear-gradient(180deg, #22a4ff, #1679df);
  color: #fff;
  cursor: pointer;
  white-space: nowrap;
}

.button-ghost {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--line);
}

.button:hover,
.button-ghost:hover,
.filter-pill:hover,
.ticker-chip:hover,
.event-card:hover,
.market-switch:hover,
.search-item:hover {
  transform: translateY(-1px);
}

.button:disabled {
  opacity: 0.65;
  cursor: progress;
}

.button,
.button-ghost,
.filter-pill,
.ticker-chip,
.event-card,
.market-switch,
.search-item {
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background-color 160ms ease,
    box-shadow 160ms ease;
}

.button:focus-visible,
.button-ghost:focus-visible,
.filter-pill:focus-visible,
.ticker-chip:focus-visible,
.event-card:focus-visible,
.market-switch:focus-visible,
.search-item:focus-visible,
.searchbox input:focus-visible {
  outline: 2px solid rgba(22, 146, 255, 0.5);
  outline-offset: 2px;
}

.search-results,
.status-banner {
  margin-top: 12px;
}

.search-results {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(11, 18, 27, 0.96);
  box-shadow: var(--shadow);
}

.search-item {
  display: grid;
  gap: 4px;
  width: 100%;
  border: 0;
  padding: 14px 16px;
  text-align: left;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}

.search-item + .search-item {
  border-top: 1px solid var(--line);
}

.status-banner {
  padding: 12px 14px;
  border-radius: 18px;
  border: 1px solid rgba(255, 95, 102, 0.35);
  background: rgba(255, 95, 102, 0.12);
  color: #ffd7d9;
}

.signal-strip {
  margin-top: 18px;
  padding: 14px 16px;
  overflow: hidden;
}

.filter-rail,
.ticker-rail,
.chip-row,
.spotlight-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.filter-rail {
  margin-bottom: 12px;
}

.ticker-rail {
  overflow-x: auto;
  flex-wrap: nowrap;
  max-width: 100%;
  padding-bottom: 2px;
  scrollbar-width: thin;
}

.filter-pill,
.ticker-chip,
.meta-chip,
.heat-chip,
.tone-chip {
  white-space: nowrap;
}

.filter-pill,
.ticker-chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--text);
  cursor: pointer;
}

.filter-pill {
  padding: 10px 14px;
}

.filter-pill.is-active {
  background: var(--blue-soft);
  border-color: rgba(22, 146, 255, 0.55);
  color: #dff1ff;
}

.ticker-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
}

.ticker-chip.is-active {
  border-color: rgba(22, 146, 255, 0.55);
  background: rgba(22, 146, 255, 0.12);
}

.ticker-track,
.ticker-prob {
  color: var(--muted);
  font-size: 0.85rem;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(390px, 0.8fr);
  gap: 20px;
  margin-top: 18px;
}

.main-column,
.detail-column {
  min-width: 0;
  display: grid;
  gap: 20px;
  align-content: start;
}

.detail-column {
  position: sticky;
  top: 16px;
  height: fit-content;
}

.spotlight-panel,
.card-grid-panel,
.detail-panel {
  padding: 18px;
}

.spotlight-media-shell {
  position: relative;
  min-height: 360px;
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: linear-gradient(135deg, rgba(22, 146, 255, 0.16), rgba(255, 255, 255, 0.03));
}

.spotlight-image,
.spotlight-placeholder {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.spotlight-image {
  object-fit: cover;
}

.spotlight-placeholder {
  display: grid;
  place-items: center;
  font-size: 2rem;
  color: rgba(255, 255, 255, 0.45);
}

.spotlight-overlay {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(8, 12, 18, 0.86) 0%, rgba(8, 12, 18, 0.6) 42%, rgba(8, 12, 18, 0.18) 100%),
    linear-gradient(180deg, transparent 50%, rgba(8, 12, 18, 0.68) 100%);
}

.spotlight-copy {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 14px;
  max-width: 54%;
  padding: 26px;
}

.spotlight-copy h1,
.section-head h2,
.detail-hero h2 {
  margin: 0;
  letter-spacing: -0.04em;
  line-height: 0.96;
}

.spotlight-copy h1 {
  font-size: clamp(2.2rem, 4vw, 4.1rem);
}

.spotlight-copy p,
.detail-copy,
.event-card-body p,
.intel-row p {
  margin: 0;
  color: #d2dced;
  line-height: 1.55;
}

.probability-pair {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.probability-pair-large {
  max-width: 420px;
}

.probability-box {
  display: grid;
  gap: 4px;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid transparent;
}

.probability-box span {
  color: rgba(255, 255, 255, 0.74);
}

.probability-box strong {
  font-size: 1.35rem;
}

.probability-box-yes {
  background: var(--green-soft);
  border-color: rgba(40, 209, 124, 0.28);
  color: #dffff1;
}

.probability-box-no {
  background: var(--red-soft);
  border-color: rgba(255, 95, 102, 0.28);
  color: #ffe6e7;
}

.inline-link {
  color: #8fd4ff;
}

.spotlight-stats,
.detail-stat-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 16px;
}

.stat-tile,
.detail-stat {
  display: grid;
  gap: 5px;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.025);
}

.stat-tile span,
.detail-stat span,
.section-meta,
.meta-chip,
.heat-chip {
  color: var(--muted);
}

.stat-tile strong,
.detail-stat strong {
  font-size: 1.3rem;
}

.stat-tile small {
  color: #b6c1d2;
}

.section-head,
.detail-hero-head,
.market-switch-top,
.row-head,
.odds-card-head,
.table-row,
.ledger-row {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}

.section-head {
  margin-bottom: 16px;
}

.section-head-tight {
  margin-bottom: 12px;
}

.market-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.event-card {
  overflow: hidden;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface-strong);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.event-card.is-selected {
  border-color: rgba(22, 146, 255, 0.55);
  box-shadow: 0 0 0 1px rgba(22, 146, 255, 0.18), 0 20px 40px rgba(0, 0, 0, 0.25);
}

.event-card-media {
  position: relative;
  height: 172px;
  overflow: hidden;
  background: linear-gradient(135deg, rgba(22, 146, 255, 0.22), rgba(247, 185, 65, 0.12));
}

.event-card-media img,
.event-card-fallback {
  width: 100%;
  height: 100%;
}

.event-card-media img {
  object-fit: cover;
}

.event-card-fallback {
  display: grid;
  place-items: center;
  color: rgba(255, 255, 255, 0.45);
  font-size: 1.5rem;
}

.event-card-gradient {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 28%, rgba(7, 11, 17, 0.85) 100%);
}

.event-card-topline {
  position: absolute;
  inset: 12px 12px auto 12px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.event-card-body {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.event-card-head {
  display: grid;
  gap: 6px;
}

.event-card-head strong {
  font-size: 1.15rem;
  line-height: 1.2;
}

.event-card-foot,
.market-switch-foot,
.table-row-meta,
.ledger-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--muted);
  align-items: center;
  justify-content: space-between;
}

.meta-chip,
.heat-chip,
.tone-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.035);
}

.heat-chip {
  background: rgba(247, 185, 65, 0.08);
  border-color: rgba(247, 185, 65, 0.18);
}

.tone-chip.is-live {
  color: #d6fff0;
  background: var(--green-soft);
  border-color: rgba(40, 209, 124, 0.28);
}

.tone-chip.is-muted {
  color: #e7f4ff;
  background: var(--blue-soft);
  border-color: rgba(22, 146, 255, 0.26);
}

.tone-chip.is-closed {
  color: #ffe9bb;
  background: var(--amber-soft);
  border-color: rgba(247, 185, 65, 0.25);
}

.runs-root,
.detail-root {
  min-width: 0;
}

.ledger-list,
.table-stack,
.intel-list,
.market-switch-list {
  display: grid;
  gap: 10px;
}

.ledger-row,
.table-row,
.market-switch,
.intel-row,
.diagnostic-card,
.odds-card,
.detail-section,
.detail-hero {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.025);
}

.ledger-row,
.diagnostic-card,
.detail-section,
.detail-hero {
  padding: 14px;
}

.market-switch {
  width: 100%;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  padding: 14px;
}

.market-switch.is-selected {
  border-color: rgba(22, 146, 255, 0.45);
  background: rgba(22, 146, 255, 0.1);
}

.market-switch-top strong {
  line-height: 1.35;
}

.detail-root {
  display: grid;
  gap: 14px;
}

.detail-hero,
.detail-section {
  display: grid;
  gap: 14px;
}

.odds-grid,
.detail-dual {
  display: grid;
  gap: 12px;
}

.odds-grid {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.detail-dual {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.odds-card {
  padding: 14px;
}

.odds-pair {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.odds-pair div {
  display: grid;
  gap: 4px;
}

.sparkline-shell {
  min-height: 120px;
  padding: 8px 0 4px;
}

.sparkline {
  width: 100%;
  height: 112px;
}

.sparkline-guide {
  fill: none;
  stroke: rgba(141, 154, 171, 0.18);
  stroke-width: 1.2;
  stroke-dasharray: 2.6 3.2;
}

.sparkline-line {
  fill: none;
  stroke: #39a0ff;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.8;
}

.iframe-shell {
  overflow: hidden;
  border-radius: 16px;
  border: 1px solid var(--line);
}

.iframe-shell iframe {
  width: 100%;
  max-width: 100%;
  display: block;
  background: #10161f;
}

.intel-row,
.table-row {
  padding: 12px 14px;
}

.row-head {
  margin-bottom: 8px;
}

.diagnostic-row + .diagnostic-row {
  margin-top: 10px;
}

.compact-empty {
  padding: 14px 6px;
}

.empty-state,
.error-state {
  display: grid;
  gap: 10px;
  place-items: start;
  padding: 16px;
  border: 1px dashed var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.02);
}

.empty-state h2,
.empty-state h3,
.error-state h2,
.diagnostic-card h3,
.section-head h2,
.section-head h3 {
  margin: 0;
}

.error-state {
  border-color: rgba(255, 95, 102, 0.3);
  background: rgba(255, 95, 102, 0.08);
}

.mono {
  font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
}

@media (max-width: 1480px) {
  .workspace {
    grid-template-columns: minmax(0, 1fr);
  }

  .detail-column {
    position: static;
  }

  .spotlight-copy {
    max-width: 70%;
  }
}

@media (max-width: 1160px) {
  .topbar {
    flex-direction: column;
    align-items: stretch;
  }

  .topbar-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .searchbox {
    max-width: none;
    flex: initial;
  }

  .spotlight-copy {
    max-width: 100%;
  }

  .spotlight-stats,
  .detail-stat-grid,
  .detail-dual {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .app-shell {
    padding: 14px;
  }

  .brand-lockup,
  .brand-copy,
  .action-cluster {
    white-space: normal;
  }

  .brand-lockup {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .brand-copy {
    min-width: 0;
  }

  .brand-logo {
    width: 190px;
  }

  .spotlight-media-shell {
    min-height: 420px;
  }

  .spotlight-copy {
    padding: 18px;
  }

  .spotlight-stats,
  .detail-stat-grid,
  .detail-dual,
  .probability-pair,
  .odds-pair {
    grid-template-columns: 1fr;
  }

  .market-grid {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .button,
  .button-ghost,
  .filter-pill,
  .ticker-chip,
  .event-card,
  .market-switch,
  .search-item {
    transition: none;
  }
}
