:root {
  color-scheme: dark;
  --bg: #06100f;
  --bg-top: #071713;
  --bg-bottom: #030807;
  --surface: rgba(255, 255, 255, 0.072);
  --surface-strong: rgba(255, 255, 255, 0.105);
  --line: rgba(255, 255, 255, 0.12);
  --text: #f5fff8;
  --muted: rgba(245, 255, 248, 0.62);
  --soft: rgba(245, 255, 248, 0.42);
  --accent: #6dffad;
  --cyan: #65d7ff;
  --orange: #ffb168;
  --danger: #ff7777;
  --button-text: #f5fff8;
  --inverse-text: #07130f;
  --shadow: rgba(0, 0, 0, 0.32);
  --card-inner: rgba(255, 255, 255, 0.058);
  --divider: rgba(255, 255, 255, 0.08);
  --refresh-bg: rgba(5, 19, 15, 0.9);
  --radius: 8px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f5f8f3;
  --bg-top: #ffffff;
  --bg-bottom: #edf3ea;
  --surface: rgba(255, 255, 255, 0.78);
  --surface-strong: rgba(255, 255, 255, 0.92);
  --line: rgba(11, 54, 38, 0.13);
  --text: #10251d;
  --muted: rgba(16, 37, 29, 0.68);
  --soft: rgba(16, 37, 29, 0.48);
  --accent: #087f50;
  --cyan: #0874a1;
  --orange: #b96513;
  --danger: #bd3f3f;
  --button-text: #10251d;
  --inverse-text: #ffffff;
  --shadow: rgba(20, 52, 36, 0.12);
  --card-inner: rgba(8, 127, 80, 0.07);
  --divider: rgba(11, 54, 38, 0.09);
  --refresh-bg: rgba(255, 255, 255, 0.94);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  overflow-x: hidden;
}

body {
  min-height: 100svh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 18% -8%, color-mix(in srgb, var(--accent) 18%, transparent), transparent 34rem),
    radial-gradient(circle at 100% 8%, color-mix(in srgb, var(--cyan) 14%, transparent), transparent 28rem),
    linear-gradient(180deg, var(--bg-top) 0%, var(--bg) 44%, var(--bg-bottom) 100%);
}

body.refreshing .pull-refresh {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

body.toast-visible .live-toast {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

button,
input,
select {
  font: inherit;
}

.pull-refresh {
  position: fixed;
  z-index: 20;
  top: calc(env(safe-area-inset-top) + 8px);
  left: 50%;
  min-width: 112px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
  border-radius: 999px;
  color: var(--accent);
  background: var(--refresh-bg);
  box-shadow: 0 12px 40px var(--shadow);
  font-size: 12px;
  font-weight: 900;
  opacity: 0;
  transform: translateX(-50%) translateY(-56px);
  transition: transform 220ms ease, opacity 220ms ease;
  pointer-events: none;
}

.live-toast {
  position: fixed;
  z-index: 19;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom) + 18px);
  width: min(340px, calc(100vw - 24px));
  padding: 12px 14px;
  border: 1px solid color-mix(in srgb, var(--accent) 36%, transparent);
  border-radius: var(--radius);
  color: var(--text);
  background: color-mix(in srgb, var(--bg-top) 88%, transparent);
  box-shadow: 0 16px 48px var(--shadow);
  backdrop-filter: blur(18px);
  opacity: 0;
  transform: translateX(-50%) translateY(20px);
  transition: transform 220ms ease, opacity 220ms ease;
  pointer-events: none;
}

.live-toast strong {
  display: block;
  font-size: 13px;
}

.live-toast span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.app-shell {
  width: min(390px, 100vw);
  max-width: 100%;
  margin: 0;
  padding: calc(env(safe-area-inset-top) + 18px) 16px 32px;
  overflow-x: hidden;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  position: relative;
  padding: 8px 0 18px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  justify-content: flex-end;
  position: absolute;
  z-index: 15;
  top: 0;
  right: 0;
  padding: 4px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--bg-top) 76%, transparent);
  backdrop-filter: blur(14px);
}

.eyebrow,
.subhead,
.section-heading p {
  margin: 0;
  color: var(--muted);
}

.eyebrow {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  color: var(--accent);
}

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

h1 {
  margin: 4px 0 8px;
  font-size: clamp(42px, 10vw, 74px);
  line-height: 0.94;
  letter-spacing: 0;
}

.subhead {
  max-width: 560px;
  font-size: 15px;
  line-height: 1.55;
}

.user-strip {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 50px;
  margin: -2px 0 10px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  backdrop-filter: blur(18px);
}

.user-avatar {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--inverse-text);
  background: var(--accent);
  font-weight: 1000;
}

.user-strip span,
.user-strip p {
  margin: 0;
  color: var(--soft);
  font-size: 11px;
  font-weight: 800;
}

.user-strip strong {
  display: block;
  margin: 2px 0;
  font-size: 14px;
}

.user-strip button {
  height: 32px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 10px;
  color: var(--muted);
  background: color-mix(in srgb, var(--surface) 55%, transparent);
  font-size: 12px;
  font-weight: 900;
}

.sync-button,
.theme-toggle,
.simulate-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--button-text);
  background: var(--surface);
}

.theme-toggle {
  min-width: 58px;
  justify-content: center;
  font-weight: 900;
}

.simulate-button {
  min-width: 54px;
  justify-content: center;
  color: var(--inverse-text);
  border-color: transparent;
  background: var(--accent);
  font-weight: 900;
}

body.simulating .simulate-button {
  color: var(--text);
  border-color: color-mix(in srgb, var(--orange) 46%, transparent);
  background: color-mix(in srgb, var(--orange) 16%, var(--surface));
}

.sync-button:active,
.theme-toggle:active,
.simulate-button:active {
  transform: translateY(1px);
}

.sync-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 14px var(--accent);
  animation: pulseDot 1.8s ease-in-out infinite;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 8px 0 0;
  min-width: 0;
}

.fold-section,
.status-grid article,
.control-panel,
.match-card,
.detail-hero,
.data-block {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  backdrop-filter: blur(18px);
}

.fold-section {
  padding: 8px;
  margin-bottom: 10px;
}

.fold-header {
  width: 100%;
  min-height: 38px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  border: 0;
  border-radius: var(--radius);
  padding: 0 10px;
  color: var(--text);
  background: color-mix(in srgb, var(--surface) 48%, transparent);
  text-align: left;
}

.fold-header span,
.fold-header b {
  color: var(--soft);
  font-size: 12px;
  font-weight: 900;
}

.fold-header strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.fold-section.collapsed .status-grid,
.filter-panel.collapsed {
  display: none;
}

.status-grid article {
  min-height: 58px;
  padding: 10px 12px;
}

.status-grid span,
.meta,
.tagline {
  color: var(--soft);
  font-size: 12px;
  font-weight: 700;
}

.status-grid strong {
  display: block;
  margin-top: 5px;
  font-size: 21px;
}

.control-panel {
  display: grid;
  grid-template-columns: 1fr;
  align-items: center;
  gap: 10px;
  padding: 12px;
  margin-bottom: 14px;
  min-width: 0;
}

.filter-panel {
  display: grid;
  gap: 9px;
}

.competition-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.quick-tools {
  display: grid;
  grid-template-columns: minmax(104px, 1fr) repeat(3, auto);
  gap: 8px;
  align-items: center;
}

.sort-box {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface) 55%, transparent);
}

.sort-box span {
  color: var(--soft);
  font-size: 11px;
  font-weight: 900;
}

.sort-box select {
  min-width: 0;
  width: 100%;
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
  font-weight: 800;
}

.tool-toggle,
.tool-reset {
  height: 36px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 10px;
  color: var(--muted);
  background: color-mix(in srgb, var(--surface) 55%, transparent);
  font-size: 12px;
  font-weight: 900;
  transition: transform 160ms ease, border-color 180ms ease, background 180ms ease, color 180ms ease;
}

.tool-toggle.active {
  color: var(--inverse-text);
  border-color: transparent;
  background: var(--accent);
}

.tool-toggle:active,
.tool-reset:active {
  transform: translateY(1px);
}

.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  min-height: 36px;
}

.search-box span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.search-box input {
  width: 100%;
  min-width: 0;
  height: 36px;
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
}

.compact-search {
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface) 48%, transparent);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  overflow-x: visible;
  scrollbar-width: none;
}

.chips::-webkit-scrollbar {
  display: none;
}

.chip,
.competition-chip {
  white-space: nowrap;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 12px;
  color: var(--muted);
  background: color-mix(in srgb, var(--surface) 55%, transparent);
}

.chip.active,
.competition-chip.active {
  color: var(--inverse-text);
  border-color: transparent;
  background: var(--accent);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(320px, 0.9fr) minmax(0, 1.35fr);
  gap: 14px;
  align-items: start;
  min-width: 0;
}

.match-list,
.detail-panel {
  min-width: 0;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-end;
  margin: 0 0 12px;
}

.section-heading h2 {
  margin: 0 0 5px;
  font-size: 22px;
}

#refreshCountdown {
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
}

.matches {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.match-card {
  position: relative;
  width: 100%;
  max-width: 100%;
  text-align: left;
  padding: 14px;
  color: var(--text);
  cursor: pointer;
  animation: cardIn 260ms ease both;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.match-card.active {
  border-color: color-mix(in srgb, var(--accent) 72%, transparent);
  background: color-mix(in srgb, var(--accent) 10%, var(--surface));
}

.match-card:active {
  transform: scale(0.992);
}

.match-card:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent) 72%, transparent);
  outline-offset: 2px;
}

body.simulating .match-card.active {
  animation: liveGlow 1.6s ease-in-out infinite;
}

.match-card-header,
.teams-line,
.market-line,
.detail-title,
.block-heading,
.signal-row,
.odds-row,
.lineup-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

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

.favorite-button {
  position: absolute;
  top: 42px;
  right: 12px;
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--soft);
  background: color-mix(in srgb, var(--surface) 70%, transparent);
  font-size: 17px;
  line-height: 1;
  transition: transform 160ms ease, border-color 180ms ease, background 180ms ease, color 180ms ease;
}

.favorite-button.active {
  color: var(--inverse-text);
  border-color: transparent;
  background: var(--accent);
  animation: starPop 220ms ease both;
}

.favorite-button:active {
  transform: scale(0.92);
}

.stage-pill,
.source-pill,
.live-pill {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  font-size: 11px;
  font-weight: 900;
}

.live-pill {
  color: var(--orange);
  background: color-mix(in srgb, var(--orange) 13%, transparent);
}

.teams-line strong {
  min-width: 0;
  font-size: 18px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.market-line {
  margin-top: 12px;
}

.card-rates {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  margin-top: 13px;
}

.card-rate {
  padding: 9px;
  border-radius: var(--radius);
  background: var(--card-inner);
}

.card-rate span,
.highlight-row span {
  display: block;
  color: var(--soft);
  font-size: 11px;
  font-weight: 800;
}

.card-rate strong {
  display: block;
  margin-top: 4px;
  font-size: 18px;
}

.match-highlights {
  display: grid;
  gap: 7px;
  margin-top: 12px;
}

.highlight-row {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 10px;
  align-items: start;
}

.highlight-row strong {
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.enter-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
  padding-top: 11px;
  border-top: 1px solid var(--divider);
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
}

.live-score {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
  margin: 12px 0 14px;
  padding: 12px;
  border-radius: var(--radius);
  background: var(--card-inner);
}

.live-score strong {
  font-size: 22px;
}

.live-score span {
  color: var(--soft);
  font-size: 12px;
  font-weight: 800;
}

.score-number {
  color: var(--accent);
  font-size: 28px;
  font-weight: 1000;
}

.event-list {
  display: grid;
  gap: 9px;
}

.event-row {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid var(--divider);
}

.event-row:first-child {
  border-top: 0;
  padding-top: 0;
  animation: eventFlash 700ms ease both;
}

.event-row span {
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
}

.event-row strong {
  display: block;
  font-size: 13px;
}

.event-row p {
  margin: 3px 0 0;
  color: var(--soft);
  font-size: 12px;
}

.mini-bars {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 5px;
  width: 132px;
}

.mini-bars span {
  height: 7px;
  border-radius: 999px;
  background: var(--divider);
  overflow: hidden;
}

.mini-bars i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 420ms ease;
}

.mini-bars span:nth-child(2) i {
  background: var(--cyan);
}

.mini-bars span:nth-child(3) i {
  background: var(--orange);
}

.detail-hero {
  padding: 18px;
  margin-bottom: 14px;
  overflow: hidden;
}

.detail-title {
  align-items: flex-start;
  margin-bottom: 18px;
}

.detail-title h2 {
  margin: 0;
  font-size: clamp(28px, 7vw, 42px);
  line-height: 1;
}

.detail-title p {
  margin: 8px 0 0;
  color: var(--muted);
}

.win-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}

.win-cell {
  padding: 13px;
  border-radius: var(--radius);
  background: var(--card-inner);
}

.win-cell span {
  display: block;
  color: var(--soft);
  font-size: 12px;
  font-weight: 800;
}

.win-cell strong {
  display: block;
  margin-top: 6px;
  font-size: 28px;
}

.probability-track {
  display: grid;
  gap: 10px;
}

.track-line {
  display: grid;
  grid-template-columns: minmax(74px, max-content) 1fr 48px;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.track-line .track {
  height: 9px;
  border-radius: 999px;
  background: var(--divider);
  overflow: hidden;
}

.track-line .fill {
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 420ms ease;
}

.track-line:nth-child(2) .fill {
  background: var(--cyan);
}

.track-line:nth-child(3) .fill {
  background: var(--orange);
}

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

.detail-tabs {
  display: flex;
  gap: 8px;
  margin: 0 0 14px;
  overflow-x: auto;
  scrollbar-width: none;
}

.detail-tabs::-webkit-scrollbar {
  display: none;
}

.detail-tab {
  flex: 0 0 auto;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  background: color-mix(in srgb, var(--surface) 55%, transparent);
}

.detail-tab.active {
  color: var(--inverse-text);
  border-color: transparent;
  background: var(--accent);
}

.single-column {
  grid-template-columns: 1fr;
}

.data-block {
  padding: 15px;
}

.ai-card {
  border-color: color-mix(in srgb, var(--accent) 36%, var(--line));
}

.decision-card {
  border-color: color-mix(in srgb, var(--cyan) 34%, var(--line));
}

.review-card {
  border-color: color-mix(in srgb, var(--orange) 34%, var(--line));
}

.decision-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  padding: 12px;
  border-radius: var(--radius);
  background: var(--card-inner);
}

.decision-head span,
.decision-grid span {
  display: block;
  color: var(--soft);
  font-size: 11px;
  font-weight: 900;
}

.decision-head strong {
  display: block;
  margin-top: 4px;
  font-size: 18px;
}

.decision-head b {
  min-width: 74px;
  padding: 8px 10px;
  border-radius: var(--radius);
  color: var(--inverse-text);
  background: var(--accent);
  font-size: 13px;
  text-align: center;
}

.decision-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.decision-grid div {
  padding: 10px;
  border-radius: var(--radius);
  background: var(--card-inner);
}

.decision-grid strong {
  display: block;
  margin-top: 5px;
  font-size: 18px;
}

.ai-connector {
  display: grid;
  gap: 9px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--divider);
}

.ai-connector label {
  display: grid;
  gap: 6px;
}

.ai-connector label span,
.ai-connector p {
  color: var(--soft);
  font-size: 12px;
  font-weight: 800;
}

.ai-connector input {
  width: 100%;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 10px;
  color: var(--text);
  background: color-mix(in srgb, var(--surface) 52%, transparent);
  outline: 0;
}

.provider-toggles {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
}

.provider-toggles button {
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  background: color-mix(in srgb, var(--surface) 55%, transparent);
  font-size: 12px;
  font-weight: 900;
}

.provider-toggles button.active {
  color: var(--inverse-text);
  border-color: transparent;
  background: var(--accent);
}

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

.client-panel div {
  min-width: 0;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface) 50%, transparent);
}

.client-panel div.active {
  border-color: color-mix(in srgb, var(--accent) 42%, transparent);
}

.client-panel span {
  display: block;
  color: var(--soft);
  font-size: 11px;
  font-weight: 900;
}

.client-panel strong {
  display: block;
  margin-top: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

.client-panel p {
  margin: 4px 0 0;
  color: var(--soft);
  font-size: 11px;
}

.consensus-panel {
  display: grid;
  gap: 8px;
  padding: 10px;
  border-radius: var(--radius);
  background: var(--card-inner);
}

.consensus-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.consensus-head span,
.provider-results span {
  color: var(--soft);
  font-size: 11px;
  font-weight: 900;
}

.consensus-head strong {
  color: var(--accent);
  font-size: 13px;
}

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

.provider-results div {
  min-width: 0;
  padding: 8px;
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface) 50%, transparent);
}

.provider-results strong {
  display: block;
  margin-top: 4px;
  font-size: 13px;
}

.provider-results p,
.consensus-panel > p {
  margin: 4px 0 0;
  color: var(--soft);
  font-size: 11px;
  line-height: 1.35;
}

.connector-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.connector-actions button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  background: color-mix(in srgb, var(--surface) 55%, transparent);
  font-size: 12px;
  font-weight: 900;
}

.connector-actions button:last-child {
  color: var(--inverse-text);
  border-color: transparent;
  background: var(--accent);
}

.connector-actions button:disabled {
  opacity: 0.62;
}

.ai-connector p {
  margin: 0;
  line-height: 1.45;
}

.ai-verdict {
  margin: 0 0 10px;
  color: var(--text);
  font-size: 18px;
  line-height: 1.45;
  font-weight: 900;
}

.block-heading {
  margin-bottom: 12px;
}

.block-heading h3 {
  margin: 0;
  font-size: 16px;
}

.block-heading span {
  color: var(--soft);
  font-size: 12px;
  font-weight: 800;
}

.signal-list,
.odds-list,
.lineup-list,
.summary-list {
  display: grid;
  gap: 10px;
}

.signal-row,
.odds-row,
.lineup-row,
.summary-row {
  padding: 11px 0;
  border-top: 1px solid var(--divider);
}

.signal-row:first-child,
.odds-row:first-child,
.lineup-row:first-child,
.summary-row:first-child {
  border-top: 0;
  padding-top: 0;
}

.signal-row strong,
.odds-row strong,
.lineup-row strong,
.summary-row strong {
  display: block;
  font-size: 13px;
}

.signal-row p,
.odds-row p,
.lineup-row p,
.summary-row p {
  margin: 4px 0 0;
  color: var(--soft);
  font-size: 12px;
}

.watch-item {
  margin: 0 0 6px;
  color: var(--muted);
  line-height: 1.45;
}

.watch-item:last-child {
  margin-bottom: 0;
}

.summary-row {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 12px;
}

.summary-row span {
  color: var(--soft);
  font-size: 12px;
  font-weight: 800;
}

.impact-up {
  color: var(--accent);
}

.impact-down {
  color: var(--orange);
}

.empty {
  padding: 30px 14px;
  color: var(--muted);
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}

@media (max-width: 860px) {
  .control-panel,
  .workspace,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .chips {
    padding-bottom: 2px;
  }

}

@media (max-width: 520px) {
  .app-shell {
    padding-inline: 12px;
    padding-top: calc(env(safe-area-inset-top) + 18px);
  }

  .topbar {
    display: block;
    padding-right: 174px;
  }

  .top-actions {
    top: 0;
    right: 0;
    justify-content: flex-end;
  }

  .sync-button,
  .theme-toggle,
  .simulate-button {
    height: 34px;
    padding-inline: 8px;
    font-size: 12px;
  }

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

  .quick-tools {
    grid-template-columns: 1fr 1fr;
  }

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

  .provider-toggles,
  .provider-results {
    grid-template-columns: 1fr 1fr;
  }

  .win-cell:last-child {
    grid-column: 1 / -1;
  }

  .status-grid article {
    min-height: 54px;
    padding: 9px 10px;
  }

  .status-grid span {
    font-size: 11px;
  }

  .status-grid strong {
    font-size: 20px;
  }
}

@keyframes pulseDot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.45); opacity: 0.68; }
}

@keyframes cardIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes liveGlow {
  0%, 100% { box-shadow: 0 0 0 color-mix(in srgb, var(--accent) 0%, transparent); }
  50% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
}

@keyframes eventFlash {
  from { background: color-mix(in srgb, var(--accent) 18%, transparent); }
  to { background: transparent; }
}

@keyframes starPop {
  0% { transform: scale(0.82); }
  70% { transform: scale(1.12); }
  100% { transform: scale(1); }
}

/* ============================================================
   Loading skeletons — shown on first paint until data renders.
   ============================================================ */
.skeleton-card,
.skeleton-detail {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.skeleton-detail {
  padding: 22px;
}

.sk {
  height: 13px;
  border-radius: 7px;
  background: linear-gradient(90deg, var(--card-inner) 25%, var(--surface-strong) 50%, var(--card-inner) 75%);
  background-size: 200% 100%;
  animation: skShimmer 1.3s linear infinite;
}

.sk-lg { height: 22px; }
.sk-xl { height: 32px; }
.sk-tall { height: 56px; }
.sk-cell { width: 100%; height: 46px; border-radius: var(--radius); }
.sk-w30 { width: 30%; }
.sk-w35 { width: 35%; }
.sk-w45 { width: 45%; }
.sk-w55 { width: 55%; }
.sk-w60 { width: 60%; }
.sk-w65 { width: 65%; }
.sk-w70 { width: 70%; }
.sk-w75 { width: 75%; }
.sk-w80 { width: 80%; }
.sk-w85 { width: 85%; }
.sk-w90 { width: 90%; }

.sk-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

@keyframes skShimmer {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}

/* ============================================================
   Mobile / tablet match-detail overlay (<1024px)
   The detail panel is hidden behind the list and opens as a
   fullscreen sheet instead of sitting at the bottom of the page.
   ============================================================ */
.detail-topbar {
  display: none;
}

@media (max-width: 1023px) {
  .detail-panel {
    display: none;
  }

  body.detail-open {
    overflow: hidden;
  }

  body.detail-open .detail-panel {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 80;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background:
      radial-gradient(circle at 18% -8%, color-mix(in srgb, var(--accent) 13%, transparent), transparent 30rem),
      linear-gradient(180deg, var(--bg-top) 0%, var(--bg) 44%, var(--bg-bottom) 100%);
    padding: 0 14px calc(env(safe-area-inset-bottom) + 30px);
    animation: detailSlideUp 300ms cubic-bezier(0.2, 0.8, 0.2, 1);
  }

  body.detail-open .detail-topbar {
    display: flex;
    align-items: center;
    gap: 10px;
    position: sticky;
    top: 0;
    z-index: 5;
    margin: 0 -14px 12px;
    padding: calc(env(safe-area-inset-top) + 10px) 14px 10px;
    background: color-mix(in srgb, var(--bg-top) 86%, transparent);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--line);
  }

  .detail-topbar button {
    flex: 0 0 auto;
    height: 34px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    color: var(--text);
    background: var(--surface);
    font-size: 13px;
    font-weight: 900;
  }

  .detail-topbar strong {
    flex: 1;
    min-width: 0;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

@keyframes detailSlideUp {
  from { transform: translateY(26px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* ============================================================
   Tablet / narrow-window range (768px - 1023px)
   Too narrow for the two-pane dashboard, but the phone column
   would strand content on the left. Center a single readable
   column instead.
   ============================================================ */
@media (min-width: 768px) and (max-width: 1023px) {
  .app-shell {
    width: 100%;
    max-width: 720px;
    margin: 0 auto;
    padding: 28px 28px 44px;
  }

  .workspace {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .filter-panel {
    display: grid;
    grid-template-columns: minmax(200px, 1fr) minmax(0, 1.6fr);
    gap: 12px 16px;
    align-items: start;
  }
}

/* ============================================================
   Desktop layout (>=1024px)
   Real master-detail dashboard. The whole shell fills the
   viewport; the top region (brand, stats, filters) is fixed and
   the two panes — match list and detail — each scroll on their
   own. The outer page itself does not scroll, so the detail pane
   always stays in view while you browse the list.
   ============================================================ */
@media (min-width: 1024px) {
  html,
  body {
    height: 100%;
    overflow: hidden;
  }

  body {
    min-height: 0;
    height: 100vh;
  }

  .app-shell {
    width: 100%;
    max-width: 1380px;
    height: 100vh;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 26px 40px 22px;
  }

  /* --- Fixed top region --- */
  .topbar,
  .user-strip,
  .fold-section,
  .control-panel {
    flex: 0 0 auto;
  }

  .topbar {
    padding: 2px 0 16px;
  }

  .topbar h1 {
    font-size: clamp(36px, 3.4vw, 52px);
  }

  .user-strip {
    max-width: none;
  }

  .control-panel {
    padding: 2px 0;
  }

  /* Filters open inline on desktop; search + quick tools share a row. */
  .filter-panel {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) minmax(0, 2fr);
    gap: 14px 18px;
    align-items: start;
  }

  .quick-tools {
    grid-template-columns: auto auto auto auto;
    justify-content: start;
    gap: 10px;
  }

  /* --- The two-pane workspace fills the remaining height --- */
  .workspace {
    flex: 1 1 auto;
    min-height: 0;
    margin-top: 12px;
    grid-template-columns: minmax(360px, 0.82fr) minmax(0, 1.45fr);
    gap: 24px;
    align-items: stretch;
  }

  /* Left pane: heading stays put, match cards scroll within the column. */
  .match-list {
    min-height: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
  }

  .match-list .section-heading {
    flex: 0 0 auto;
  }

  .match-list .matches {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 2px 8px 8px 2px;
    scrollbar-width: thin;
    scrollbar-color: color-mix(in srgb, var(--accent) 45%, transparent) transparent;
  }

  /* Right pane: detail scrolls internally for long content. */
  .detail-panel {
    min-height: 0;
    height: 100%;
    overflow-y: auto;
    padding-right: 6px;
    scrollbar-width: thin;
    scrollbar-color: color-mix(in srgb, var(--accent) 45%, transparent) transparent;
  }

  .match-list .matches::-webkit-scrollbar,
  .detail-panel::-webkit-scrollbar {
    width: 8px;
  }

  .match-list .matches::-webkit-scrollbar-thumb,
  .detail-panel::-webkit-scrollbar-thumb {
    background: color-mix(in srgb, var(--accent) 38%, transparent);
    border-radius: 8px;
  }

  /* Give the detail multi-column room for its inner grids on wide screens. */
  .detail-grid,
  .win-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .decision-grid,
  .provider-toggles,
  .provider-results {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .detail-panel .empty {
    display: grid;
    place-items: center;
    min-height: 320px;
  }
}

/* Extra-wide screens: let the detail breathe a little more. */
@media (min-width: 1500px) {
  .app-shell {
    max-width: 1520px;
  }

  .workspace {
    grid-template-columns: minmax(380px, 0.78fr) minmax(0, 1.6fr);
  }
}
