:root {
  color-scheme: light;
  --bg: #ece7df;
  --bg-2: #f6f2eb;
  --panel: rgba(255, 255, 255, 0.72);
  --panel-solid: #fbf8f2;
  --panel-border: rgba(37, 43, 48, 0.1);
  --text: #20262b;
  --muted: #6d767f;
  --accent: #5a6d62;
  --accent-soft: rgba(90, 109, 98, 0.1);
  --field: #364941;
  --field-light: #3f574d;
  --shadow: 0 14px 40px rgba(33, 38, 43, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  font-family: "Inter", system-ui, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.7), transparent 28%),
    linear-gradient(135deg, var(--bg) 0%, var(--bg-2) 100%);
  overflow-x: hidden;
}

.bg-orb {
  position: fixed;
  inset: auto;
  width: 28rem;
  height: 28rem;
  border-radius: 999px;
  filter: blur(36px);
  opacity: 0.45;
  pointer-events: none;
}

.orb-a {
  top: -8rem;
  left: -8rem;
  background: rgba(90, 109, 98, 0.12);
}

.orb-b {
  right: -10rem;
  top: 16rem;
  background: rgba(60, 76, 67, 0.08);
}

.shell {
  width: min(1280px, calc(100vw - 2rem));
  margin: 0 auto;
  padding: 2rem 0 3rem;
}

.view[hidden] {
  display: none !important;
}

.home-view,
.game-view {
  display: grid;
  gap: 1.5rem;
}

.season-view {
  display: grid;
  gap: 1.5rem;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(280px, 0.9fr);
  gap: 1.5rem;
  align-items: end;
  margin-bottom: 1.5rem;
}

.eyebrow,
.panel-kicker {
  margin: 0 0 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--accent);
  font-size: 0.74rem;
  font-weight: 700;
}

h1,
h2,
h3 {
  font-family: "Space Grotesk", "Inter", system-ui, sans-serif;
  margin: 0;
  line-height: 1;
}

h1 {
  max-width: 12ch;
  font-size: clamp(3rem, 6vw, 5.6rem);
}

.lede {
  max-width: 58ch;
  margin: 1rem 0 0;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.6;
}

.hero-card,
.panel,
.control,
button,
select {
  border: 1px solid var(--panel-border);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.hero-card {
  padding: 1.1rem;
  border-radius: 1.25rem;
  display: grid;
  gap: 0.9rem;
}

.hero-home .hero-card {
  align-self: stretch;
}

.stat {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1rem;
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.58);
}

.stat span,
.panel-subtitle {
  color: var(--muted);
}

.stat strong {
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.15rem;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.control {
  min-width: 180px;
  padding: 0.85rem 1rem;
  border-radius: 0.95rem;
  display: grid;
  gap: 0.5rem;
}

.control span {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
}

select,
button {
  border-radius: 0.95rem;
  color: var(--text);
  font: inherit;
}

select {
  width: 100%;
  padding: 0.7rem 0.8rem;
  outline: none;
}

button {
  cursor: pointer;
  padding: 0.95rem 1.25rem;
  font-weight: 700;
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    background 180ms ease;
}

button:hover,
button:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.22);
}

.primary {
  background: var(--text);
  color: #f5f2eb;
  border-color: rgba(32, 38, 43, 0.3);
}

.secondary {
  background: rgba(255, 255, 255, 0.42);
}

.config-panel {
  max-width: 760px;
}

.config-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.play-button {
  min-width: 220px;
}

.game-topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.back-button {
  background: rgba(255, 255, 255, 0.42);
  padding: 0.7rem 1rem;
}

.game-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-end;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
}

.game-meta span {
  padding: 0.45rem 0.7rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.48);
  border: 1px solid rgba(37, 43, 48, 0.08);
}

.season-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 0.95fr);
  gap: 1.5rem;
  align-items: stretch;
}

.season-feed-panel,
.season-table-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.season-feed {
  display: grid;
  gap: 0.55rem;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  max-height: min(62vh, 760px);
  padding: 0 0.2rem 0.5rem 0;
  scrollbar-gutter: stable;
  overscroll-behavior: contain;
  scroll-padding-bottom: 0.75rem;
}

.season-match {
  padding: 0.7rem 0.85rem;
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.38);
  border: 1px solid rgba(37, 43, 48, 0.08);
  display: grid;
  gap: 0.35rem;
}

.season-match.win {
  border-color: rgba(90, 109, 98, 0.25);
  background: rgba(90, 109, 98, 0.1);
}

.season-match.draw {
  border-color: rgba(37, 43, 48, 0.12);
}

.season-match.loss {
  border-color: rgba(111, 63, 63, 0.18);
  background: rgba(111, 63, 63, 0.08);
}

.season-match-meta {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.season-match-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 0.75rem;
}

.season-match-team {
  font-weight: 600;
}

.season-match-score {
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.2rem;
}

.season-table-wrap {
  overflow: auto;
  flex: 1;
  min-height: 0;
}

.season-placeholder {
  padding: 1rem;
  color: var(--muted);
}

.season-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.season-table th,
.season-table td {
  padding: 0.6rem 0.55rem;
  border-bottom: 1px solid rgba(37, 43, 48, 0.08);
  text-align: left;
  white-space: nowrap;
}

.season-table thead th {
  position: sticky;
  top: 0;
  background: var(--panel-solid);
  z-index: 1;
}

.season-table tbody tr.highlight {
  background: rgba(90, 109, 98, 0.08);
}

.content {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 1.5rem;
}

.panel {
  border-radius: 1.35rem;
  padding: 1.1rem;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1rem;
}

.panel-header h2 {
  font-size: 1.8rem;
  margin-bottom: 0.35rem;
}

.roster-grid {
  display: grid;
  gap: 0.45rem;
}

.player-card {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.8rem;
  width: 100%;
  padding: 0.75rem 0.25rem;
  border: 0;
  border-bottom: 1px solid rgba(32, 38, 43, 0.08);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  text-align: left;
}

.player-card:hover,
.player-card:focus-visible {
  transform: none;
  border-color: rgba(32, 38, 43, 0.12);
  background: rgba(255, 255, 255, 0.28);
}

.player-card.selected {
  background: rgba(90, 109, 98, 0.08);
  box-shadow: none;
  border-color: rgba(90, 109, 98, 0.18);
}

.player-card.unavailable {
  opacity: 0.38;
  color: rgba(32, 38, 43, 0.45);
  cursor: not-allowed;
}

.player-card.unavailable .player-meta {
  color: rgba(109, 118, 127, 0.72);
}

.player-name {
  font-weight: 600;
}

.player-meta {
  color: var(--muted);
  font-size: 0.9rem;
  white-space: nowrap;
}

.pitch {
  min-height: 760px;
  padding: 1rem;
  border-radius: 1.25rem;
  background:
    linear-gradient(180deg, rgba(54, 73, 65, 0.95), rgba(46, 63, 56, 0.98)),
    radial-gradient(circle at 50% 18%, rgba(255, 255, 255, 0.08), transparent 25%),
    linear-gradient(90deg, transparent 49%, rgba(255, 255, 255, 0.14) 50%, transparent 51%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: var(--shadow);
}

.pitch-grid {
  position: relative;
  height: 100%;
  min-height: 720px;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  grid-template-rows: repeat(5, minmax(0, 1fr));
  gap: 0.85rem;
}

.pitch-grid::before,
.pitch-grid::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.pitch-grid::before {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 1rem;
}

.pitch-grid::after {
  inset: 25% 0 25% 0;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.slot {
  width: 92px;
  height: 92px;
  border-radius: 999px;
  padding: 0.55rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.2rem;
  text-align: left;
  color: var(--text);
  place-self: center;
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    background 180ms ease,
    box-shadow 180ms ease;
}

.slot:hover:not(:disabled),
.slot:focus-visible:not(:disabled) {
  transform: translateY(-2px) scale(1.01);
  border-color: rgba(255, 255, 255, 0.4);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

.slot:disabled {
  opacity: 0.56;
  cursor: not-allowed;
}

.slot.empty {
  background: rgba(255, 255, 255, 0.05);
}

.slot.filled {
  background: rgba(255, 255, 255, 0.15);
}

.slot.target {
  border-color: rgba(255, 255, 255, 0.42);
  background: rgba(255, 255, 255, 0.12);
}

.slot-label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.slot-player {
  display: none;
}

.slot-bubble {
  width: 3.6rem;
  height: 3.6rem;
  margin: 0 auto;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.24);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1;
  text-align: center;
  padding: 0.35rem;
  word-break: break-word;
}

.roster-empty {
  color: var(--muted);
  font-size: 0.95rem;
  padding: 1rem 0.25rem;
}

.empty-card {
  cursor: default;
}

@media (max-width: 1080px) {
  .hero,
  .content {
    grid-template-columns: 1fr;
  }

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

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

  .season-feed {
    max-height: 52vh;
  }
}

@media (max-width: 720px) {
  .shell {
    width: min(100vw - 1rem, 1280px);
    padding-top: 1rem;
  }

  h1 {
    max-width: none;
    font-size: clamp(2.4rem, 11vw, 4rem);
  }

  .controls {
    display: grid;
    grid-template-columns: 1fr;
  }

  .pitch {
    min-height: 620px;
  }

  .pitch-grid {
    min-height: 580px;
    gap: 0.6rem;
  }

  .slot {
    width: 80px;
    height: 80px;
  }

  .slot-bubble {
    width: 3rem;
    height: 3rem;
    font-size: 0.6rem;
  }
}
