:root {
  --bg: #06120e;
  --panel: #0c2018;
  --panel-2: #10291f;
  --line: #245039;
  --line-strong: #49745a;
  --text: #edf8f1;
  --muted: #9fbcac;
  --green: #66f29d;
  --blue: #7bb7ff;
  --amber: #ffd337;
  --orange: #ff9b4a;
  --red: #ff5a4f;
  --purple: #c481ff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    var(--bg);
  background-size: 28px 28px;
  color: var(--text);
  font-family:
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}

a {
  color: inherit;
}

button,
input,
select {
  font: inherit;
}

button,
.toolbar input,
.toolbar select,
.replay-controls select,
.match-control select {
  background: #10291f;
  color: var(--text);
  border: 1px solid #315942;
  border-radius: 8px;
  padding: 10px 12px;
}

button {
  cursor: pointer;
  transition:
    border-color 0.15s,
    transform 0.15s,
    background 0.15s;
}

button:hover {
  border-color: var(--green);
  transform: translateY(-1px);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 14px;
  vertical-align: top;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #10291f;
  color: #8ff7b5;
}

tr:hover {
  background: #143025;
}

code {
  color: #d6ffe4;
}

.hero {
  padding: 48px 5vw;
  background:
    linear-gradient(135deg, rgba(11, 40, 29, 0.95), rgba(6, 18, 14, 0.9)),
    repeating-linear-gradient(90deg, rgba(102, 242, 157, 0.11) 0 1px, transparent 1px 90px);
  border-bottom: 1px solid var(--line);
}

.lab-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 28px;
  align-items: end;
}

.hero h1 {
  margin: 0 0 10px;
  max-width: 980px;
  font-size: clamp(36px, 6vw, 84px);
  letter-spacing: 0;
  line-height: 0.95;
}

.hero p {
  max-width: 880px;
  color: #b8d8c6;
  font-size: 18px;
  line-height: 1.55;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.legacy-links,
.nav,
.toolbar,
.replay-controls,
.legend {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.legacy-links a,
.badge {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 6px 11px;
  color: #d7f7e2;
  text-decoration: none;
  background: rgba(16, 41, 31, 0.75);
}

.legacy-links a:hover {
  border-color: var(--green);
}

.wrap {
  padding: 28px 5vw;
}

.app-shell {
  display: grid;
  gap: 18px;
}

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

.panel,
.card {
  background: rgba(12, 32, 24, 0.94);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 18px 64px rgba(0, 0, 0, 0.32);
}

.card {
  display: block;
  min-width: 260px;
  flex: 1;
  padding: 24px;
  text-decoration: none;
  transition: 0.15s;
}

.card:hover {
  transform: translateY(-3px);
  border-color: var(--green);
}

.card h2 {
  margin: 0 0 8px;
  color: var(--green);
}

.metric {
  padding: 18px;
}

.metric b {
  display: block;
  color: var(--green);
  font-size: 32px;
  line-height: 1;
}

.metric span,
.muted {
  color: var(--muted);
}

.small {
  font-size: 12px;
}

.match-panel {
  display: grid;
  grid-template-columns: minmax(240px, 360px) minmax(0, 1fr) minmax(220px, 300px);
  gap: 18px;
  align-items: center;
  padding: 18px;
}

.match-control {
  display: grid;
  gap: 8px;
}

.match-control label {
  color: #cdebd7;
  font-size: 13px;
  font-weight: 700;
}

.match-control select {
  width: 100%;
}

.match-summary h2,
.section-title h2 {
  margin: 0;
}

.scoreboard {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.score-team {
  display: grid;
  min-width: 138px;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  background: #0a1812;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.score-team b {
  color: #fff;
  font-size: 26px;
}

.caveat {
  margin: 0;
  color: #d7c99d;
  font-size: 13px;
  line-height: 1.45;
}

.lab-grid,
.two {
  display: grid;
  grid-template-columns: minmax(0, 1.32fr) minmax(340px, 0.68fr);
  gap: 18px;
}

.side-stack {
  display: grid;
  gap: 18px;
}

.replay-panel,
.simulation-panel,
.discipline-panel,
.event-panel {
  padding: 18px;
}

.section-title {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.primary-btn {
  color: #062014;
  background: var(--green);
  border-color: var(--green);
  font-weight: 800;
}

.replay-controls {
  align-items: center;
  margin-bottom: 14px;
}

.replay-controls label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #cdebd7;
}

.scrubber-label {
  flex: 1 1 280px;
}

.scrubber-label input {
  width: 100%;
  accent-color: var(--green);
}

.pitch {
  position: relative;
  width: 100%;
  aspect-ratio: 105 / 68;
  overflow: hidden;
  border: 3px solid #dfffe8;
  border-radius: 8px;
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.045) 0 7.69%, transparent 7.69% 15.38%),
    linear-gradient(90deg, #1b7339, #24904b);
}

.pitch::before {
  content: "";
  position: absolute;
  inset: 8%;
  border: 2px solid rgba(223, 255, 232, 0.9);
  pointer-events: none;
}

.pitch::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  border-left: 2px solid rgba(223, 255, 232, 0.9);
  pointer-events: none;
}

.point {
  position: absolute;
  z-index: 2;
  width: 14px;
  height: 14px;
  padding: 0;
  border: 2px solid white;
  border-radius: 50%;
  box-shadow: 0 2px 10px #000;
  transform: translate(-50%, -50%);
}

.point.active {
  z-index: 3;
  width: 22px;
  height: 22px;
  outline: 3px solid rgba(255, 255, 255, 0.66);
  outline-offset: 2px;
}

.goal {
  background: #32ff7e;
}

.cardpt {
  background: var(--amber);
}

.redpt {
  background: var(--red);
}

.foul {
  background: var(--orange);
}

.attempt {
  background: var(--blue);
}

.assist {
  background: #a7ffcf;
}

.savept {
  background: #55d8ff;
}

.other {
  background: #d7d7d7;
}

.simpt {
  background: var(--purple);
  border-style: dashed;
  box-shadow: 0 0 0 4px rgba(196, 129, 255, 0.18), 0 0 20px rgba(196, 129, 255, 0.85);
}

.timeline {
  display: flex;
  gap: 4px;
  height: 46px;
  align-items: end;
  border-bottom: 1px solid var(--line-strong);
  margin: 16px 0;
}

.bar {
  flex: 1;
  min-width: 5px;
  min-height: 6px;
  border-radius: 5px 5px 0 0;
  background: #35664a;
}

.bar.past {
  background: var(--green);
}

.bar.current {
  background: var(--amber);
}

.latest-event {
  min-height: 48px;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0a1812;
  color: #dfffe8;
}

.legend {
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend i {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  border: 1px solid #fff;
}

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

.sim-score-grid div,
.discipline-card {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0a1812;
}

.sim-score-grid span,
.discipline-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.sim-score-grid b,
.discipline-card b {
  display: block;
  margin-top: 4px;
  font-size: 24px;
}

.button-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 12px 0;
}

.button-grid .wide {
  grid-column: 1 / -1;
}

.tilt-control {
  display: grid;
  grid-template-columns: 1fr minmax(120px, 180px) 32px;
  gap: 10px;
  align-items: center;
  color: #cdebd7;
  font-size: 13px;
}

.tilt-control input {
  width: 100%;
  accent-color: var(--purple);
}

.probabilities {
  display: grid;
  gap: 8px;
  margin: 14px 0;
}

.probabilities div {
  display: grid;
  grid-template-columns: 86px 1fr;
  gap: 8px;
  align-items: center;
  color: #dcefe4;
  font-size: 12px;
}

.probabilities i {
  display: block;
  height: 10px;
  border-radius: 999px;
  background: var(--green);
}

#drawProbBar {
  background: var(--amber);
}

#awayProbBar {
  background: var(--blue);
}

.sim-events,
.mini-log {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.mini-item {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0a1812;
  color: #dcefe4;
}

.pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 8px;
  background: #183b2b;
}

.warn {
  background: #4a3510;
  color: #ffd887;
}

.danger {
  background: #4a1515;
  color: #ffaaa4;
}

.sim-pill {
  background: rgba(196, 129, 255, 0.17);
  color: #ead8ff;
  border: 1px dashed rgba(196, 129, 255, 0.9);
}

.sim-row {
  background: rgba(196, 129, 255, 0.08);
}

.table-wrap {
  max-height: 520px;
  overflow: auto;
}

.source {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.skeleton {
  opacity: 0.75;
}

@media (max-width: 980px) {
  .lab-hero,
  .match-panel,
  .lab-grid,
  .two {
    grid-template-columns: 1fr;
  }

  .legacy-links {
    justify-content: flex-start;
  }
}

@media (max-width: 620px) {
  .hero {
    padding: 34px 20px;
  }

  .wrap {
    padding: 20px;
  }

  .sim-score-grid,
  .discipline-grid,
  .button-grid {
    grid-template-columns: 1fr;
  }

  .button-grid .wide {
    grid-column: auto;
  }

  .tilt-control {
    grid-template-columns: 1fr;
  }
}
