:root {
  --ink: #101925;
  --navy: #0d1622;
  --navy-2: #142234;
  --paper: #f4f6f8;
  --white: #ffffff;
  --muted: #627087;
  --line: #d8dee7;
  --dark-line: #2a3a4f;
  --orange: #f46a24;
  --blue: #2777b9;
  --red: #c6383d;
  --green: #168266;
  --radius: 6px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  line-height: 1.45;
}
button, input, select { font: inherit; }
a { color: inherit; text-decoration: none; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 58px;
  padding: 0 28px;
  border-bottom: 1px solid var(--dark-line);
  background: rgba(13, 22, 34, 0.97);
  color: var(--white);
}
.brand, .topbar-meta { display: flex; align-items: center; gap: 12px; }
.brand { font-size: 15px; font-weight: 800; }
.brand-mark { width: 14px; height: 14px; border: 3px solid var(--orange); border-radius: 50%; }
.topbar-meta { color: #aab7c8; font-size: 12px; }
.topbar-meta a { color: var(--white); font-weight: 750; }

.app-shell {
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr);
  min-height: calc(100vh - 58px);
}
.setup-panel {
  position: sticky;
  top: 58px;
  align-self: start;
  min-height: calc(100vh - 58px);
  padding: 32px 26px;
  border-right: 1px solid var(--dark-line);
  background: var(--navy);
  color: var(--white);
}
.setup-heading { margin-bottom: 30px; }
.setup-heading h1 { margin: 4px 0 12px; font-size: 30px; line-height: 1.05; letter-spacing: 0; }
.setup-heading p:last-child { margin: 0; color: #aebacc; font-size: 14px; }
.kicker, .module-label {
  margin: 0 0 7px;
  color: var(--orange);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.field-label, legend, .range-label {
  display: block;
  margin-bottom: 8px;
  color: #c4cfdd;
  font-size: 12px;
  font-weight: 750;
}
select {
  width: 100%;
  height: 44px;
  margin-bottom: 24px;
  padding: 0 12px;
  border: 1px solid #405068;
  border-radius: var(--radius);
  background: var(--navy-2);
  color: var(--white);
}
fieldset { margin: 0 0 24px; padding: 0; border: 0; }
.segmented { display: grid; grid-template-columns: repeat(3, 1fr); }
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; }
.segmented span {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 38px;
  border: 1px solid #405068;
  color: #aebacc;
  font-size: 12px;
  font-weight: 750;
  cursor: pointer;
}
.segmented label:first-child span { border-radius: var(--radius) 0 0 var(--radius); }
.segmented label:last-child span { border-radius: 0 var(--radius) var(--radius) 0; }
.segmented label + label span { border-left: 0; }
.segmented input:checked + span { background: var(--orange); color: #151b23; border-color: var(--orange); }
.exposure-list { display: grid; gap: 8px; }
.exposure-list label { display: flex; align-items: center; gap: 10px; color: #dce3ec; font-size: 13px; cursor: pointer; }
.exposure-list input { width: 16px; height: 16px; accent-color: var(--orange); }
.range-label { display: flex; justify-content: space-between; }
.range-label output { color: var(--white); }
input[type="range"] { width: 100%; margin: 0 0 26px; accent-color: var(--orange); }
.primary-button, .secondary-button, .icon-button {
  border: 0;
  border-radius: var(--radius);
  font-weight: 800;
  cursor: pointer;
}
.primary-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 46px;
  padding: 0 15px;
  background: var(--orange);
  color: #151b23;
}

.analysis-panel { min-width: 0; padding: 34px clamp(22px, 4vw, 58px) 56px; scroll-margin-top: 58px; }
.matchup-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 30px; margin-bottom: 24px; }
.matchup-header h2 { margin: 2px 0 6px; font-size: clamp(30px, 4vw, 46px); line-height: 1; letter-spacing: 0; }
.matchup-header p:last-child { margin: 0; color: var(--muted); }
.risk-badge {
  display: grid;
  grid-template-columns: auto auto;
  gap: 1px 18px;
  min-width: 210px;
  padding: 14px 16px;
  border-left: 4px solid var(--orange);
  background: var(--white);
}
.risk-badge span { color: var(--muted); font-size: 12px; font-weight: 750; }
.risk-badge strong { grid-row: 1 / 3; grid-column: 2; align-self: center; font-size: 31px; line-height: 1; font-variant-numeric: tabular-nums; }
.risk-badge small { font-weight: 800; }
.risk-badge[data-tier="high"] { border-left-color: var(--red); }
.risk-badge[data-tier="standard"] { border-left-color: var(--green); }

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(380px, 0.95fr);
  gap: 16px;
  align-items: stretch;
}
.module, .postgame-panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--white); }
.module { padding: 20px; }
.module-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.module-heading h3, .postgame-panel h3 { margin: 0; font-size: 18px; letter-spacing: 0; }
.unit-note { color: var(--muted); font-size: 11px; font-weight: 700; white-space: nowrap; }
.fingerprint-bars { display: grid; gap: 11px; }
.fingerprint-row { display: grid; grid-template-columns: 132px minmax(0, 1fr) 46px; align-items: center; gap: 10px; }
.fingerprint-row > span { color: #4e5c70; font-size: 12px; font-weight: 700; }
.fingerprint-row strong { text-align: right; font-size: 12px; font-variant-numeric: tabular-nums; }
.fingerprint-scale { position: relative; height: 20px; background: linear-gradient(to right, #e5eaf0 0 49.7%, #8c99aa 49.7% 50.3%, #e5eaf0 50.3%); }
.fingerprint-fill { position: absolute; top: 0; height: 100%; }
.fingerprint-fill.positive { left: 50%; background: var(--orange); }
.fingerprint-fill.negative { right: 50%; background: var(--blue); }

.fingerprint-module, .court-module { min-height: 252px; }
.queue-module { min-height: 348px; }
.court-module { grid-row: span 2; display: flex; flex-direction: column; }
.court-wrap { max-width: 560px; margin: 0 auto; }
.court { position: relative; aspect-ratio: 50 / 47; overflow: hidden; border-radius: 3px; background: #121b2a; }
.heat-zone { position: absolute; border-radius: 50%; background: radial-gradient(circle, rgba(244, 106, 36, 0.98) 0, rgba(244, 106, 36, 0.50) 38%, rgba(244, 106, 36, 0) 72%); }
.heat-left { width: 45%; height: 38%; left: -4%; top: 36%; }
.heat-right { width: 45%; height: 38%; right: -4%; top: 36%; }
.heat-rim { width: 44%; height: 38%; left: 28%; bottom: -2%; }
.heat-top { width: 42%; height: 32%; left: 29%; top: 7%; background: radial-gradient(circle, rgba(39, 119, 185, 0.85) 0, rgba(39, 119, 185, 0.32) 42%, rgba(39, 119, 185, 0) 73%); }
.court-arc, .court-lane, .court-circle, .court-rim { position: absolute; left: 50%; transform: translateX(-50%); border: 3px solid rgba(255, 255, 255, 0.92); }
.court-arc { bottom: -5%; width: 91%; height: 64%; border-bottom: 0; border-radius: 55% 55% 0 0; }
.court-lane { bottom: 0; width: 33%; height: 38%; }
.court-circle { bottom: 29%; width: 24%; aspect-ratio: 1; border-radius: 50%; }
.court-rim { bottom: 13%; width: 18px; height: 18px; border-radius: 50%; }
.zone-label { position: absolute; z-index: 2; color: #fff; font-size: 11px; font-weight: 800; }
.zone-left { left: 5%; top: 52%; }
.zone-right { right: 5%; top: 52%; }
.zone-rim { left: 50%; bottom: 6%; transform: translateX(-50%); }
.zone-top { left: 50%; top: 10%; transform: translateX(-50%); }
.court-read { margin: 11px 0 0; color: var(--muted); font-size: 12px; }

.icon-button { min-width: 58px; min-height: 34px; border: 1px solid var(--line); background: var(--white); color: #344257; font-size: 12px; }
.film-queue { display: grid; gap: 1px; background: var(--line); }
.queue-item { display: grid; grid-template-columns: 36px minmax(0, 1fr) 58px; gap: 12px; align-items: center; padding: 13px 12px; background: var(--white); }
.queue-rank { color: var(--orange); font-size: 12px; font-weight: 900; }
.queue-copy > div { display: flex; align-items: baseline; gap: 9px; }
.queue-copy h4 { margin: 0; font-size: 14px; }
.queue-copy span { color: var(--muted); font-size: 11px; }
.queue-copy p { margin: 4px 0 0; color: #536176; font-size: 12px; }
.queue-time { text-align: right; font-size: 13px; font-variant-numeric: tabular-nums; }

.allocation-module { grid-column: 1 / -1; }
.allocation-compare { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
.allocation-caption { display: flex; justify-content: space-between; gap: 16px; margin-bottom: 6px; font-size: 12px; }
.allocation-track { height: 15px; background: #e4e9ef; }
.allocation-track span { display: block; height: 100%; background: #96a3b4; }
.allocation-track.targeted span { background: var(--orange); }
.allocation-compare small { display: block; margin-top: 5px; color: var(--muted); }

.postgame-panel { display: grid; grid-template-columns: minmax(220px, 0.7fr) minmax(480px, 1.3fr); gap: 24px; align-items: end; margin-top: 16px; padding: 20px; }
.postgame-copy p:last-child { margin: 8px 0 0; color: var(--muted); font-size: 12px; }
.postgame-form { display: grid; grid-template-columns: repeat(3, minmax(110px, 1fr)) auto; gap: 10px; align-items: end; }
.postgame-form label { position: relative; color: #536176; font-size: 11px; font-weight: 700; }
.postgame-form input { width: 100%; height: 38px; margin-top: 5px; padding: 0 25px 0 9px; border: 1px solid var(--line); border-radius: var(--radius); }
.postgame-form label span { position: absolute; right: 9px; bottom: 10px; color: var(--muted); }
.secondary-button { min-height: 38px; padding: 0 14px; background: var(--navy); color: var(--white); }
.postgame-result { grid-column: 1 / -1; padding: 13px 15px; border-left: 4px solid var(--green); background: #edf7f3; }
.postgame-result[data-status="missed"] { border-left-color: var(--orange); background: #fff4ed; }
.postgame-result strong { font-size: 13px; }
.postgame-result p { margin: 3px 0 0; color: #4e5c70; font-size: 12px; }

footer { display: flex; justify-content: space-between; gap: 24px; padding: 20px 28px; border-top: 1px solid var(--dark-line); background: var(--navy); color: #9eabbd; font-size: 11px; }

@media (max-width: 1120px) {
  .app-shell { grid-template-columns: 290px minmax(0, 1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .court-module { grid-row: auto; }
  .fingerprint-module, .queue-module, .court-module { min-height: auto; }
  .allocation-compare { grid-template-columns: 1fr; }
  .court-wrap { max-width: 500px; }
  .postgame-panel { grid-template-columns: 1fr; }
}

@media (max-width: 780px) {
  .topbar { position: static; padding: 0 18px; }
  .topbar-meta span { display: none; }
  .app-shell { display: block; }
  .setup-panel { position: static; min-height: auto; padding: 26px 20px; }
  .analysis-panel { padding: 28px 18px 42px; }
  .matchup-header { align-items: stretch; flex-direction: column; }
  .risk-badge { min-width: 0; }
  .postgame-form { grid-template-columns: 1fr 1fr; }
  footer { flex-direction: column; }
}

@media (max-width: 500px) {
  .brand { font-size: 13px; }
  .setup-heading h1 { font-size: 28px; }
  .matchup-header h2 { font-size: 34px; }
  .fingerprint-row { grid-template-columns: 110px minmax(0, 1fr) 42px; gap: 7px; }
  .queue-item { grid-template-columns: 28px minmax(0, 1fr); }
  .queue-time { grid-column: 2; text-align: left; color: var(--orange); }
  .queue-copy > div { align-items: flex-start; flex-direction: column; gap: 2px; }
  .postgame-form { grid-template-columns: 1fr; }
}

@media print {
  .topbar, .setup-panel, footer, .postgame-panel, .icon-button { display: none; }
  .app-shell { display: block; }
  .analysis-panel { padding: 0; }
  .module { break-inside: avoid; }
}
