:root {
  color-scheme: dark;
  --ink: var(--wc-white);
  --muted: var(--wc-muted);
  --subtle: #8f8b84;
  --charcoal: var(--wc-black);
  --panel: var(--wc-panel);
  --panel-strong: var(--wc-panel-strong);
  --line: var(--wc-line);
  --teal: var(--wc-teal);
  --teal-soft: rgba(73, 245, 210, 0.14);
  --gold: var(--wc-gold);
  --gold-soft: rgba(217, 173, 83, 0.18);
  --electric: var(--wc-blue);
  --magenta: var(--wc-pink);
  --green: #66d28f;
  --green-soft: rgba(102, 210, 143, 0.14);
  --amber: #e6b958;
  --amber-soft: rgba(230, 185, 88, 0.15);
  --coral: #e47c6f;
  --coral-soft: rgba(228, 124, 111, 0.15);
  --violet: #a99cff;
  --violet-soft: rgba(169, 156, 255, 0.13);
  --shadow: 0 22px 80px rgba(0, 0, 0, 0.35);
  --radius: 8px;
  font-family: var(--wc-font-body);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: #090d0c;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 0%, rgba(107, 0, 255, 0.34), transparent 28rem),
    radial-gradient(circle at 90% 10%, rgba(167, 240, 0, 0.22), transparent 24rem),
    radial-gradient(circle at 50% 108%, rgba(255, 75, 11, 0.2), transparent 28rem),
    linear-gradient(135deg, #030303, #09070d 52%, #020306);
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

.backdrop {
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    linear-gradient(90deg, rgba(8, 11, 10, 0.88), rgba(8, 11, 10, 0.45), rgba(8, 11, 10, 0.9)),
    url("../img/stadium-intelligence-backdrop.png") center / cover no-repeat;
  filter: saturate(0.88);
}

.backdrop::after {
  position: absolute;
  inset: 0;
  content: "";
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.65), transparent 74%);
}

.app-shell {
  width: min(1520px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 42px;
}

.app-main .app-shell {
  width: 100%;
  padding: 0;
}

.app-main main {
  margin-top: 0;
}

.topbar,
.status-strip,
.view-tabs,
.match-rail,
.analysis-board,
.saved-layout,
.account-panel {
  border: 1px solid var(--line);
  background: var(--panel);
  backdrop-filter: blur(22px);
  box-shadow: var(--shadow);
}

.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 132px;
  padding: 20px;
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
}

.topbar::before {
  position: absolute;
  inset: 0;
  content: "";
  background:
    radial-gradient(circle at 14% 12%, rgba(167, 240, 0, 0.2), transparent 18rem),
    linear-gradient(90deg, rgba(107, 0, 255, 0.26), transparent 50%),
    linear-gradient(135deg, transparent 58%, rgba(255, 75, 11, 0.18));
  pointer-events: none;
}

.brand-block,
.topbar-actions,
.section-head,
.match-teams,
.match-meta,
.team-row,
.market-head,
.market-factors,
.risk-pill,
.account-actions {
  display: flex;
  align-items: center;
}

.brand-block {
  gap: 14px;
  min-width: 0;
  position: relative;
  z-index: 1;
}

.brand-mark {
  display: none;
}

.eyebrow,
.strip-label {
  margin: 0;
  color: var(--subtle);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 8px;
  font-size: clamp(2.2rem, 7vw, 6.8rem);
  line-height: 0.88;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(1.18rem, 1.5vw, 1.7rem);
  line-height: 1.15;
}

h3 {
  margin-bottom: 0;
  font-size: 1rem;
  line-height: 1.25;
}

.topbar-actions {
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
  position: relative;
  z-index: 1;
}

.ghost-icon,
.account-pill,
.tab-button,
.market-favorite,
.primary-button,
.secondary-button,
.close-button {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.06);
  cursor: pointer;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background 160ms ease;
}

.ghost-icon,
.market-favorite,
.close-button {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
}

.ghost-icon:hover,
.account-pill:hover,
.tab-button:hover,
.market-favorite:hover,
.primary-button:hover,
.secondary-button:hover,
.close-button:hover {
  transform: translateY(-1px);
  border-color: rgba(75, 212, 199, 0.48);
  background: rgba(75, 212, 199, 0.12);
}

.account-pill {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 40px;
  padding: 0 12px 0 6px;
  color: var(--ink);
}

.avatar {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 50%;
  background: var(--gold-soft);
  color: var(--gold);
  font-weight: 800;
}

.status-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  margin-top: 14px;
  overflow: hidden;
  border-radius: var(--radius);
}

.status-strip > div {
  min-width: 0;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.035);
}

.status-strip strong {
  display: block;
  margin-top: 4px;
  overflow: hidden;
  color: var(--ink);
  font-size: 0.95rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.view-tabs {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  padding: 8px;
  border-radius: var(--radius);
}

.tab-button {
  display: flex;
  flex: 1 1 0;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 44px;
  padding: 0 14px;
  color: var(--ink);
  font-weight: 850;
  text-decoration: none;
  text-transform: uppercase;
}

.tab-button span {
  color: var(--subtle);
  font-size: 0.72rem;
  font-weight: 900;
}

.tab-button.active {
  border-color: rgba(167, 240, 0, 0.7);
  color: var(--ink);
  background: linear-gradient(135deg, rgba(107, 0, 255, 0.34), rgba(255, 75, 11, 0.16), rgba(167, 240, 0, 0.14));
}

.library-link {
  border-color: rgba(217, 173, 83, 0.28);
  background: linear-gradient(135deg, rgba(217, 173, 83, 0.12), rgba(49, 88, 255, 0.1));
}

.library-link:hover {
  color: var(--ink);
  border-color: rgba(255, 209, 102, 0.55);
}

main {
  margin-top: 0;
}

.view-panel {
  display: none;
}

.view-panel.active {
  display: block;
}

.layout-grid {
  display: grid;
  grid-template-columns: minmax(300px, 0.74fr) minmax(0, 1.56fr);
  gap: 18px;
  align-items: start;
}

.match-rail,
.analysis-board,
.saved-layout {
  min-height: 640px;
  border-radius: var(--radius);
}

.match-rail,
.analysis-board {
  padding: 16px;
}

.section-head {
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.section-head.wide {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  backdrop-filter: blur(22px);
}

.date-input,
.search-box input {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: rgba(255, 255, 255, 0.05);
}

.date-input {
  min-height: 38px;
  width: 146px;
  padding: 0 10px;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  width: min(440px, 100%);
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.05);
}

.search-box span {
  color: var(--teal);
  font-weight: 900;
}

.search-box input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
}

.match-list,
.saved-list {
  display: grid;
  gap: 10px;
}

.match-card,
.market-card,
.team-signal,
.schedule-card,
.saved-card,
.empty-state,
.model-note {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.055);
}

.match-card {
  width: 100%;
  padding: 13px;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.match-card.selected {
  border-color: rgba(167, 240, 0, 0.58);
  background: linear-gradient(135deg, rgba(107, 0, 255, 0.2), rgba(167, 240, 0, 0.09));
}

.match-meta {
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
  color: var(--subtle);
  font-size: 0.78rem;
  font-weight: 750;
}

.match-teams {
  justify-content: space-between;
  gap: 12px;
}

.team-name {
  overflow-wrap: anywhere;
  font-weight: 850;
}

.versus {
  flex: 0 0 auto;
  color: var(--gold);
  font-size: 0.76rem;
  font-weight: 950;
}

.microcopy {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
}

.analysis-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  min-height: 162px;
  padding: 16px;
  border: 1px solid rgba(167, 240, 0, 0.22);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(107, 0, 255, 0.24), rgba(255, 75, 11, 0.13), rgba(167, 240, 0, 0.08)),
    rgba(255, 255, 255, 0.04);
}

.hero-team {
  min-width: 0;
}

.hero-team.right {
  text-align: right;
}

.team-badge {
  display: inline-grid;
  width: 42px;
  height: 42px;
  place-items: center;
  margin-bottom: 10px;
  border-radius: var(--radius);
  color: var(--wc-white);
  background: linear-gradient(135deg, var(--wc-purple), var(--wc-blue));
  font-weight: 950;
}

.hero-team.right .team-badge {
  background: linear-gradient(135deg, var(--wc-orange), var(--wc-gold));
}

.win-probability {
  text-align: center;
}

.win-probability strong {
  display: block;
  font-size: clamp(2.1rem, 5vw, 4.8rem);
  line-height: 0.95;
}

.win-probability span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
  text-transform: uppercase;
}

.analysis-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.82fr) minmax(0, 1.18fr);
  gap: 14px;
  margin-top: 14px;
}

.team-stack,
.market-stack {
  display: grid;
  gap: 10px;
  align-content: start;
}

.team-signal,
.market-card,
.model-note,
.saved-card {
  padding: 13px;
}

.signal-meter {
  height: 8px;
  margin-top: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.signal-meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--wc-purple), var(--wc-teal), var(--wc-lime));
}

.team-row {
  justify-content: space-between;
  gap: 12px;
}

.team-row small,
.signal-copy,
.market-copy,
.soft-copy {
  color: var(--muted);
  line-height: 1.45;
}

.signal-copy,
.market-copy,
.soft-copy {
  margin-bottom: 0;
  font-size: 0.9rem;
}

.model-note {
  display: grid;
  gap: 8px;
  background: rgba(169, 156, 255, 0.08);
}

.source-status {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.source-status span {
  min-width: 0;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
  font-size: 0.78rem;
}

.market-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 38px;
}

.market-tools h3 {
  font-size: 1.1rem;
}

.market-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.filter-chip {
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.05);
  cursor: pointer;
}

.filter-chip.active {
  border-color: rgba(213, 173, 85, 0.48);
  color: var(--ink);
  background: var(--gold-soft);
}

.market-card {
  position: relative;
  overflow: hidden;
}

.market-card.saved-focus {
  border-color: rgba(233, 30, 99, 0.72);
  background:
    radial-gradient(circle at 82% 18%, rgba(233, 30, 99, 0.2), transparent 18rem),
    var(--panel);
  box-shadow:
    0 0 0 1px rgba(233, 30, 99, 0.32),
    0 22px 70px rgba(233, 30, 99, 0.18);
}

.market-card::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  content: "";
  background: var(--risk-color, var(--teal));
}

.market-head {
  justify-content: space-between;
  gap: 14px;
}

.market-title {
  min-width: 0;
}

.market-title h4 {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 1rem;
}

.market-title span {
  color: var(--subtle);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
}

.market-score {
  min-width: 82px;
  text-align: right;
}

.market-score strong {
  display: block;
  color: var(--risk-color, var(--teal));
  font-size: 1.38rem;
  line-height: 1;
}

.market-score span {
  color: var(--subtle);
  font-size: 0.72rem;
  font-weight: 850;
  text-transform: uppercase;
}

.market-factors {
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.risk-pill,
.factor-pill {
  min-height: 26px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.045);
  font-size: 0.75rem;
  font-weight: 800;
}

.risk-pill {
  color: var(--risk-color, var(--teal));
  border-color: color-mix(in srgb, var(--risk-color, var(--teal)) 45%, transparent);
  background: var(--risk-bg, var(--teal-soft));
}

.market-favorite {
  position: absolute;
  right: 10px;
  bottom: 10px;
  width: 34px;
  height: 34px;
  color: var(--muted);
}

.market-favorite.active {
  color: var(--coral);
  border-color: rgba(228, 124, 111, 0.5);
  background: var(--coral-soft);
}

.schedule-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.schedule-card {
  min-height: 164px;
  padding: 13px;
}

.schedule-card.placeholder {
  border-style: dashed;
  opacity: 0.74;
}

.schedule-card .match-meta {
  margin-bottom: 12px;
}

.saved-layout {
  display: grid;
  grid-template-columns: minmax(260px, 0.44fr) minmax(0, 1fr);
  gap: 18px;
  padding: 20px;
}

.saved-card {
  display: grid;
  gap: 8px;
}

.saved-card strong {
  color: var(--teal);
}

.empty-state {
  display: grid;
  min-height: 330px;
  place-content: center;
  padding: 26px;
  text-align: center;
}

.empty-state p {
  color: var(--muted);
}

.account-panel {
  width: min(480px, calc(100% - 28px));
  border-radius: var(--radius);
  color: var(--ink);
  padding: 22px;
}

.account-panel::backdrop {
  background: rgba(0, 0, 0, 0.58);
}

.close-button {
  float: right;
}

.primary-button,
.secondary-button {
  min-height: 42px;
  padding: 0 14px;
}

.primary-button {
  border-color: rgba(75, 212, 199, 0.42);
  background: var(--teal-soft);
}

.secondary-button {
  background: rgba(255, 255, 255, 0.045);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 1120px) {
  .layout-grid,
  .analysis-grid,
  .saved-layout {
    grid-template-columns: 1fr;
  }

  .match-rail,
  .analysis-board,
  .saved-layout {
    min-height: auto;
  }

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

@media (max-width: 760px) {
  .app-shell {
    width: min(100% - 18px, 1520px);
    padding-top: 10px;
  }

  .topbar,
  .section-head {
    align-items: stretch;
    grid-template-columns: 1fr;
  }

  .topbar-actions {
    justify-content: flex-start;
  }

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

  .view-tabs {
    overflow-x: visible;
    gap: 6px;
  }

  .tab-button {
    min-width: 0;
    padding: 0 8px;
  }

  .analysis-hero {
    grid-template-columns: 1fr;
    text-align: left;
  }

  .hero-team.right {
    text-align: left;
  }

  .win-probability {
    text-align: left;
  }

  .source-status,
  .schedule-grid {
    grid-template-columns: 1fr;
  }

  .date-input,
  .search-box {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
