:root {
  --bg: #f6efe7;
  --paper: rgba(255, 252, 247, 0.92);
  --maroon: #500000;
  --maroon-strong: #3a0000;
  --tan: #c7a97b;
  --ink: #231614;
  --muted: #6d5c57;
  --line: rgba(80, 0, 0, 0.12);
  --field-dark: #1d6f42;
  --field-mid: #238a52;
  --field-light: #2ea764;
  --shadow: 0 18px 45px rgba(54, 27, 22, 0.16);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Source Sans 3", sans-serif;
  background:
    radial-gradient(circle at top, rgba(199, 169, 123, 0.28), transparent 32%),
    linear-gradient(180deg, #f9f4ee 0%, var(--bg) 100%);
}

button,
dialog {
  font: inherit;
}

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

.hero,
.formation-card,
.coaches {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 28px;
  box-shadow: var(--shadow);
}

.hero {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.5rem;
  padding: 1.6rem;
  position: relative;
  overflow: hidden;
}

.hero::after {
  content: "";
  position: absolute;
  inset: auto -8rem -7rem auto;
  width: 22rem;
  aspect-ratio: 1;
  background: radial-gradient(circle, rgba(80, 0, 0, 0.12), transparent 62%);
}

.eyebrow,
.formation-card__eyebrow {
  margin: 0 0 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.hero h1,
.section-heading h2,
.formation-card h2 {
  margin: 0;
  font-family: "Bebas Neue", sans-serif;
  letter-spacing: 0.04em;
  font-size: clamp(2.1rem, 5vw, 4.1rem);
  line-height: 0.92;
  color: var(--maroon);
}

.hero__copy,
.formation-card__hint {
  color: var(--muted);
}

.hero__copy {
  max-width: 52rem;
  font-size: 1.04rem;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1rem;
}

.segmented {
  border: 1px solid rgba(80, 0, 0, 0.18);
  background: rgba(255, 255, 255, 0.65);
  color: var(--maroon);
  padding: 0.78rem 1rem;
  border-radius: 999px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 140ms ease, background 140ms ease, color 140ms ease;
}

.segmented:hover,
.segmented:focus-visible {
  transform: translateY(-1px);
  background: rgba(80, 0, 0, 0.08);
  outline: none;
}

.segmented.is-active {
  background: var(--maroon);
  color: #fff;
  border-color: var(--maroon);
}

.hero__crest {
  flex: 0 0 auto;
  width: 8rem;
  height: 8rem;
  display: grid;
  place-items: center;
  border-radius: 28px;
  background: linear-gradient(180deg, rgba(80, 0, 0, 0.08), rgba(80, 0, 0, 0.03));
  border: 1px solid rgba(80, 0, 0, 0.12);
}

.hero__crest img {
  width: 5rem;
  height: 5rem;
  object-fit: contain;
}

.board {
  margin-top: 1rem;
  padding: 1.1rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 28px;
  box-shadow: var(--shadow);
}

.board__header {
  display: block;
  margin-bottom: 0.9rem;
}

.board__toolbar {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.55rem;
}

.board-panel {
  display: grid;
  gap: 0.15rem;
  padding: 0.72rem 0.82rem;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(44, 16, 16, 0.96), rgba(80, 0, 0, 0.98));
  border: 1px solid rgba(80, 0, 0, 0.16);
  color: #fff;
}

.board-panel__label {
  font-size: 0.64rem;
  font-weight: 900;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.68);
}

.board-panel__value {
  font-size: 1.02rem;
  line-height: 1.05;
}

.board-panel__detail {
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.78);
}

.field {
  position: relative;
  min-height: 56rem;
  border-radius: 24px;
  overflow: hidden;
  background: linear-gradient(
    180deg,
    rgba(80, 0, 0, 0.9) 0%,
    rgba(80, 0, 0, 0.9) 8%,
    var(--field-light) 8%,
    var(--field-mid) 50%,
    var(--field-light) 92%,
    rgba(80, 0, 0, 0.9) 92%,
    rgba(80, 0, 0, 0.9) 100%
  );
  border: 1px solid rgba(9, 59, 30, 0.32);
}

.field::before,
.field::after {
  content: "";
  position: absolute;
  inset: 0;
}

.field::before {
  background:
    linear-gradient(180deg, transparent 49.6%, rgba(255, 255, 255, 0.72) 49.6%, rgba(255, 255, 255, 0.72) 50.4%, transparent 50.4%),
    repeating-linear-gradient(
      180deg,
      transparent 0 8.3%,
      rgba(255, 255, 255, 0.18) 8.3% 8.7%,
      transparent 8.7% 16.6%
    ),
    repeating-linear-gradient(
      90deg,
      transparent 0 6.8%,
      rgba(255, 255, 255, 0.12) 6.8% 7.1%,
      transparent 7.1% 13.6%
    );
  opacity: 0.8;
}

.field::after {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.12), transparent 20%, transparent 80%, rgba(0, 0, 0, 0.12)),
    url("https://a.espncdn.com/i/teamlogos/ncaa/500/245.png") center / 24rem no-repeat;
  opacity: 0.16;
}

.field__surface {
  position: absolute;
  inset: 0;
  z-index: 3;
}

.field__zone,
.field__line {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  font-family: "Bebas Neue", sans-serif;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.86);
}

.field__zone {
  font-size: 1.2rem;
}

.field__zone--defense {
  top: 1rem;
  z-index: 5;
}

.field__zone--offense {
  bottom: 0.45rem;
  z-index: 5;
}

.field__line {
  top: calc(50% - 0.65rem);
  font-size: 0.76rem;
  color: rgba(255, 255, 255, 0.72);
}

.coach-overlay {
  position: absolute;
  top: 3.3rem;
  left: 0.9rem;
  right: 0.9rem;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
  z-index: 4;
}

.field-player {
  position: absolute;
  width: clamp(5.55rem, 8vw, 6.05rem);
  padding: 0.48rem 0.5rem;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.42);
  background: rgba(255, 250, 245, 0.88);
  box-shadow: 0 12px 28px rgba(16, 43, 26, 0.22);
  transform: translate(-50%, -50%);
  cursor: pointer;
  z-index: 2;
  text-align: left;
}

.field-player--defense {
  background: rgba(247, 245, 241, 0.92);
}

.field-player--offense {
  background: rgba(255, 249, 243, 0.94);
}

.field-player__top {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 0.4rem;
}

.field-player__pos {
  font-size: 0.66rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.13em;
  color: var(--muted);
}

.field-player__name {
  margin: 0.16rem 0;
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--maroon);
  line-height: 1.03;
}

.field-player__meta {
  margin: 0;
  color: var(--muted);
  font-size: 0.63rem;
  line-height: 1.1;
}

.field-player__rating {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.55rem;
  min-height: 1.8rem;
  padding: 0.12rem 0.36rem;
  border-radius: 999px;
  background: var(--maroon);
  color: #fff;
  font-size: 0.88rem;
  font-weight: 900;
  line-height: 1;
}

.coach-card {
  appearance: none;
  text-align: left;
  cursor: pointer;
  border-radius: 18px;
  padding: 0.36rem 0.5rem;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(255, 252, 247, 0.82);
  transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease;
}

.coach-card:hover,
.coach-card:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(80, 0, 0, 0.24);
  outline: none;
}

.coach-card__header {
  display: flex;
  gap: 0.6rem;
  align-items: center;
}

.coach-card__headshot {
  width: 1.8rem;
  height: 1.8rem;
  border-radius: 10px;
  object-fit: cover;
  background: rgba(80, 0, 0, 0.06);
}

.coach-card__name {
  margin: 0;
  color: var(--maroon);
  font-size: 0.78rem;
}

.coach-card__role {
  margin: 0.15rem 0 0;
  color: var(--muted);
  font-size: 0.58rem;
}

.coach-card__bio {
  margin: 0.22rem 0 0;
  color: var(--muted);
  font-size: 0.62rem;
  line-height: 1.15;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.player-modal {
  width: min(56rem, calc(100vw - 1rem));
  border: none;
  padding: 0;
  border-radius: 28px;
  background: rgba(255, 252, 247, 0.98);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.3);
}

.player-modal::backdrop {
  background: rgba(24, 14, 12, 0.68);
  backdrop-filter: blur(6px);
}

.player-modal__close {
  position: absolute;
  top: 0.8rem;
  right: 0.8rem;
  z-index: 2;
  border: none;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 999px;
  background: rgba(80, 0, 0, 0.08);
  color: var(--maroon);
  font-size: 1.6rem;
  cursor: pointer;
}

.player-modal__content {
  padding: 1.4rem;
}

.modal-card__header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 1rem;
  align-items: center;
}

.modal-card__headshot {
  width: 6rem;
  height: 6rem;
  border-radius: 22px;
  object-fit: cover;
  background: rgba(80, 0, 0, 0.06);
}

.modal-card__depth,
.modal-card__meta,
.modal-card__bio {
  color: var(--muted);
}

.bio-block {
  margin-top: 1rem;
}

.modal-card__name {
  margin: 0.2rem 0;
  font-size: 2rem;
  line-height: 0.95;
  color: var(--maroon);
  font-family: "Bebas Neue", sans-serif;
  letter-spacing: 0.05em;
}

.badge-row,
.link-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.62rem;
  border-radius: 999px;
  background: rgba(80, 0, 0, 0.08);
  color: var(--maroon);
  font-size: 0.82rem;
  font-weight: 800;
}

.badge--soft {
  border-radius: 16px;
  white-space: normal;
  align-items: start;
}

.rating-pill {
  min-width: 8rem;
  padding: 0.8rem 0.9rem;
  text-align: center;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(80, 0, 0, 0.94), rgba(58, 0, 0, 0.96));
  color: #fff;
}

.rating-pill span {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.rating-pill strong {
  font-size: 2rem;
}

.bio-toggle {
  margin-top: 0.5rem;
  border: none;
  padding: 0;
  background: transparent;
  color: var(--maroon);
  font-weight: 800;
  cursor: pointer;
}

.bio-toggle:hover,
.bio-toggle:focus-visible {
  text-decoration: underline;
  outline: none;
}

.stat-block h4 {
  margin-bottom: 0.65rem;
  color: var(--maroon);
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr));
  gap: 0.7rem;
}

.tendency-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.stat-chip {
  border-radius: 18px;
  background: rgba(80, 0, 0, 0.05);
  border: 1px solid rgba(80, 0, 0, 0.08);
  padding: 0.75rem;
}

.stat-chip__label {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.stat-chip__value {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--maroon);
}

.stat-chip__detail {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.72rem;
  color: var(--muted);
}

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

  .board__header {
    display: block;
  }

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

  .coach-overlay {
    grid-template-columns: 1fr;
    top: 3.6rem;
  }

  .field {
    min-height: 62rem;
  }
}

@media (max-width: 640px) {
  .page-shell {
    width: min(100vw - 1rem, 100%);
  }

  .hero,
  .board {
    border-radius: 22px;
  }

  .field-player {
    width: clamp(5.2rem, 18vw, 5.9rem);
    padding: 0.42rem 0.45rem;
  }

  .field-player__name {
    font-size: 0.71rem;
  }

  .field-player__pos,
  .field-player__meta {
    font-size: 0.58rem;
  }

  .field-player__rating {
    min-width: 2.1rem;
    min-height: 1.6rem;
    font-size: 0.76rem;
  }

  .field {
    min-height: 60rem;
  }

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

@media (max-width: 700px) and (orientation: portrait) {
  .field {
    min-height: 70rem;
  }

  .field__zone--defense {
    top: 0.8rem;
  }

  .field__zone--offense {
    bottom: 0.2rem;
  }

  .coach-overlay {
    top: 3.75rem;
    left: 0.6rem;
    right: 0.6rem;
    gap: 0.35rem;
  }

  .coach-card {
    padding: 0.28rem 0.4rem;
  }

  .coach-card__header {
    gap: 0.4rem;
  }

  .coach-card__headshot {
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 8px;
  }

  .coach-card__name {
    font-size: 0.68rem;
  }

  .coach-card__role {
    font-size: 0.5rem;
  }

  .coach-card__bio {
    display: none;
  }

  .field-player {
    width: 3.2rem;
    padding: 0.24rem 0.24rem 0.28rem;
    border-radius: 12px;
  }

  .field-player__top {
    gap: 0.2rem;
  }

  .field-player__pos {
    font-size: 0.44rem;
    letter-spacing: 0.08em;
  }

  .field-player__name {
    margin: 0.1rem 0;
    font-size: 0.55rem;
    line-height: 1.05;
  }

  .field-player__meta {
    display: none;
  }

  .field-player__rating {
    min-width: 1.45rem;
    min-height: 1.2rem;
    padding: 0.08rem 0.24rem;
    font-size: 0.58rem;
  }
}
