:root {
  --bg-top: #eef6fb;
  --bg-bottom: #f9fbfd;
  --panel: rgba(255, 255, 255, 0.9);
  --panel-strong: #ffffff;
  --line: rgba(14, 30, 37, 0.12);
  --ink: #102a43;
  --muted: #5d6d7e;
  --navy: #12355b;
  --teal: #0f766e;
  --blue: #1d4ed8;
  --amber: #b45309;
  --brick: #b42318;
  --sand: #f4efe6;
  --shadow: 0 24px 60px rgba(12, 41, 56, 0.12);
  --radius: 22px;
  --accent: #1d4ed8;
  --accent-soft: rgba(29, 78, 216, 0.14);
  --accent-band: rgba(29, 78, 216, 0.16);
  --accent-band-strong: rgba(29, 78, 216, 0.24);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(29, 78, 216, 0.12), transparent 28rem),
    radial-gradient(circle at bottom right, rgba(15, 118, 110, 0.16), transparent 22rem),
    linear-gradient(180deg, var(--bg-top), var(--bg-bottom));
  color: var(--ink);
  font-family: "Avenir Next", "Segoe UI", "Helvetica Neue", sans-serif;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(16rem, 18rem) minmax(0, 1fr);
  gap: 1.15rem;
  width: min(100%, 92rem);
  margin: 0 auto;
  padding: 1rem;
}

.sidebar,
.hero-card,
.probability-card,
.chart-card,
.timeline-card,
.table-card,
.explain-card {
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.62);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.sidebar {
  position: sticky;
  top: 1.5rem;
  align-self: start;
  min-width: 0;
  padding: 1.1rem;
}

.brand-block h1,
.hero-copy h2,
.card-head h3,
.explain-panel h3 {
  margin: 0;
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Palatino, serif;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand-block h1 {
  font-size: 1.7rem;
  line-height: 0.95;
  margin-top: 0.35rem;
}

.brand-copy,
.hero-subtitle,
.metric-copy,
.season-copy,
.snapshot-note,
.explain-copy,
.chart-note,
.athlete-meta,
.athlete-status {
  color: var(--muted);
}

.eyebrow {
  margin: 0;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--teal);
}

.control-group {
  margin-top: 1rem;
}

.control-group label,
.group-label {
  display: block;
  margin-bottom: 0.45rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

input,
select {
  width: 100%;
  padding: 0.85rem 0.95rem;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink);
  font: inherit;
}

input:focus,
select:focus {
  outline: 2px solid rgba(29, 78, 216, 0.18);
  border-color: rgba(29, 78, 216, 0.35);
}

.athlete-list {
  display: grid;
  gap: 0.45rem;
  max-height: 32rem;
  overflow: auto;
  padding-right: 0.2rem;
}

.athlete-button,
.chip {
  border: 1px solid transparent;
  background: rgba(244, 239, 230, 0.72);
  color: var(--ink);
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease, color 160ms ease;
}

.athlete-button {
  width: 100%;
  padding: 0.72rem 0.8rem;
  border-radius: 16px;
  text-align: left;
}

.athlete-button:hover,
.chip:hover {
  transform: translateY(-1px);
  border-color: rgba(18, 53, 91, 0.14);
}

.athlete-button.active,
.chip.active {
  border-color: rgba(18, 53, 91, 0.2);
  background: linear-gradient(135deg, rgba(18, 53, 91, 0.98), rgba(15, 118, 110, 0.94));
  color: #f8fbff;
}

.athlete-button .meta-line,
.athlete-button .status-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.athlete-button .meta-line strong {
  font-size: 0.96rem;
}

.athlete-button .status-line {
  margin-top: 0.35rem;
  font-size: 0.78rem;
}

.main-panel {
  display: grid;
  gap: 1.25rem;
  min-width: 0;
}

.hero-card,
.probability-card,
.chart-card,
.timeline-card,
.table-card,
.explain-card {
  padding: 1.15rem 1.2rem;
}

.hero-card {
  position: relative;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.96);
}

.hero-controls {
  display: grid;
  gap: 1rem;
  margin-top: 1.2rem;
}

.pill-group {
  display: grid;
  gap: 0.45rem;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.chip {
  padding: 0.65rem 0.95rem;
  border-radius: 999px;
  font-size: 0.92rem;
  font-weight: 700;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.9rem;
  margin-top: 1.2rem;
}

.probability-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.9rem;
  margin-top: 1rem;
}

.metric {
  padding: 1rem;
  border-radius: 18px;
  border: 1px solid rgba(18, 53, 91, 0.08);
  background: rgba(255, 255, 255, 0.8);
}

.metric.accent {
  border-color: rgba(0, 0, 0, 0.02);
  background: linear-gradient(135deg, var(--accent-soft), rgba(255, 255, 255, 0.92));
}

.probability-tile {
  padding: 1rem;
  border-radius: 18px;
  border: 1px solid rgba(18, 53, 91, 0.08);
  background: rgba(255, 255, 255, 0.82);
}

.probability-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
}

.probability-label {
  display: block;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.probability-value {
  display: block;
  margin-top: 0.45rem;
  font-size: 1.55rem;
  font-weight: 700;
}

.probability-bar {
  margin-top: 0.75rem;
  width: 100%;
  height: 0.55rem;
  border-radius: 999px;
  background: rgba(18, 53, 91, 0.08);
  overflow: hidden;
}

.probability-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
}

.metric-label {
  display: block;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.metric-value {
  display: block;
  margin-top: 0.45rem;
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.05;
}

.metric-copy {
  margin: 0.35rem 0 0;
  font-size: 0.84rem;
}

.snapshot-note,
.chart-note {
  margin: 0.9rem 0 0;
  font-size: 0.9rem;
  line-height: 1.45;
}

.explain-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 1rem;
}

.explain-panel {
  padding: 1rem 1.05rem;
  border-radius: 18px;
  border: 1px solid rgba(18, 53, 91, 0.08);
  background: rgba(255, 255, 255, 0.82);
}

.explain-copy {
  margin: 0.7rem 0 0;
  line-height: 1.55;
}

.definition-list,
.method-list {
  margin: 0.85rem 0 0;
  padding-left: 1.1rem;
}

.definition-item,
.method-list li {
  margin-top: 0.5rem;
  line-height: 1.5;
}

.definition-term {
  font-weight: 700;
  color: var(--ink);
}

.card-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
}

.chart-root {
  margin-top: 1rem;
  min-height: 24rem;
  max-width: 100%;
  overflow-x: auto;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  font-size: 0.82rem;
  color: var(--muted);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.legend-swatch {
  width: 0.8rem;
  height: 0.8rem;
  border-radius: 999px;
}

.season-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  gap: 0.85rem;
  margin-top: 1rem;
}

.season-card {
  padding: 0.95rem 1rem;
  border-radius: 18px;
  border: 1px solid rgba(18, 53, 91, 0.1);
  background: rgba(255, 255, 255, 0.84);
}

.season-card.selected {
  border-color: var(--accent-soft);
  box-shadow: inset 0 0 0 1px var(--accent-soft);
}

.season-head,
.season-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
}

.season-head {
  margin-bottom: 0.7rem;
}

.status-stack {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.45rem;
}

.season-year {
  font-weight: 700;
}

.season-time-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
  margin-top: 0.4rem;
}

.season-time-block {
  padding: 0.7rem 0.75rem;
  border-radius: 14px;
  background: rgba(244, 239, 230, 0.58);
}

.season-time-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.season-time-value {
  display: block;
  margin-top: 0.3rem;
  font-size: 1rem;
  font-weight: 700;
}

.season-copy {
  margin: 0.6rem 0 0.75rem;
  font-size: 0.84rem;
  line-height: 1.45;
}

.season-foot {
  font-size: 0.82rem;
}

.status-tag {
  display: inline-flex;
  align-items: center;
  padding: 0.3rem 0.55rem;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.status-ahead {
  color: #065f46;
  background: rgba(16, 185, 129, 0.14);
}

.status-inside {
  color: #1d4ed8;
  background: rgba(29, 78, 216, 0.14);
}

.status-behind {
  color: #b45309;
  background: rgba(245, 158, 11, 0.18);
}

.table-wrap {
  margin-top: 1rem;
  width: 100%;
  max-width: 100%;
  overflow-x: visible;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
}

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

th,
td {
  padding: 0.8rem 0.65rem;
  border-bottom: 1px solid rgba(18, 53, 91, 0.08);
  text-align: left;
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
  vertical-align: top;
  line-height: 1.32;
  font-size: 0.84rem;
}

th {
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.table-wrap .status-tag {
  justify-content: center;
  text-align: center;
  white-space: normal;
  line-height: 1.2;
  padding: 0.22rem 0.42rem;
  font-size: 0.64rem;
}

.table-wrap th:nth-child(1),
.table-wrap td:nth-child(1) {
  width: 6rem;
}

.table-wrap th:nth-child(2),
.table-wrap td:nth-child(2) {
  width: 5rem;
}

.table-wrap th:nth-child(3),
.table-wrap td:nth-child(3) {
  width: 12rem;
}

.table-wrap th:nth-child(4),
.table-wrap td:nth-child(4) {
  width: 12.5rem;
}

.table-wrap th:nth-child(5),
.table-wrap td:nth-child(5) {
  width: 12rem;
}

.table-wrap th:nth-child(6),
.table-wrap td:nth-child(6) {
  width: 11rem;
}

.table-detail-stack {
  display: grid;
  gap: 0.45rem;
}

.table-detail-line {
  display: grid;
  grid-template-columns: minmax(0, 5.3rem) minmax(0, 1fr);
  align-items: start;
  gap: 0.55rem;
}

.table-detail-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.table-detail-value {
  color: var(--ink);
}

.table-detail-line .status-tag {
  justify-self: start;
}

.table-detail-stack.range .table-detail-line {
  grid-template-columns: minmax(0, 5.8rem) minmax(0, 1fr);
}

.table-detail-stack.lane-summary .table-detail-line {
  grid-template-columns: minmax(0, 4.7rem) minmax(0, 1fr);
}

.empty-state {
  padding: 2.6rem 1rem;
  text-align: center;
  color: var(--muted);
}

.subtle {
  color: var(--muted);
}

.chart-svg text {
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  fill: var(--muted);
}

.chart-svg {
  display: block;
  width: 100%;
  height: auto;
}

.chart-svg .axis-line,
.chart-svg .grid-line {
  stroke: rgba(18, 53, 91, 0.12);
  stroke-width: 1;
}

.chart-svg .median-line {
  stroke-width: 2;
  stroke-dasharray: 7 6;
  fill: none;
}

.chart-svg .athlete-line {
  stroke: var(--navy);
  stroke-width: 3;
  fill: none;
}

.chart-svg .point-ahead {
  fill: var(--teal);
}

.chart-svg .point-inside {
  fill: var(--accent);
}

.chart-svg .point-behind {
  fill: var(--amber);
}

.chart-svg .point-latest {
  stroke: #ffffff;
  stroke-width: 3;
}

.chart-svg .clip-marker {
  fill: var(--amber);
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

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

@media (max-width: 820px) {
  .metric-grid,
  .probability-grid,
  .explain-grid,
  .season-time-grid {
    grid-template-columns: 1fr;
  }

  .card-head {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 720px) {
  .app-shell {
    width: min(100%, 100rem);
    padding: 0.9rem;
  }

  .season-strip {
    grid-template-columns: 1fr;
  }

  .hero-card,
  .chart-card,
  .timeline-card,
  .table-card,
  .sidebar,
  .explain-card {
    padding: 1rem;
  }

  th,
  td {
    padding: 0.65rem 0.45rem;
    font-size: 0.78rem;
  }

  .table-detail-line {
    grid-template-columns: 1fr;
    gap: 0.2rem;
  }
}
