:root {
  color-scheme: light;
  font-family: "DM Sans", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --page: #f7f5f6;
  --surface: #ffffff;
  --text: #201d22;
  --muted: #77717a;
  --border: #e9e5e9;
  --primary: #f199a2;
  --primary-hover: #df616e;
  --secondary: #201d22;
  --soft: #fff0f5;
  --success: #21865b;
  --pointed: #21865b;
  --icon-selected: #174a70;
  --player-marker: var(--primary-hover);
  --danger: #c83c3c;
  --shadow: 0 16px 48px rgb(34 23 31 / 6%);
}

:root[data-theme="terrain"] {
  --page: #f5fafc;
  --surface: #ffffff;
  --text: #172b3b;
  --muted: #607783;
  --border: #dce8ed;
  --primary: #2672a6;
  --primary-hover: #1d5e8d;
  --secondary: #187452;
  --soft: #e9f4f0;
  --success: #187452;
  --player-marker: var(--success);
  --shadow: 0 16px 48px rgb(23 53 42 / 7%);
}

* {
  box-sizing: border-box;
}

body {
  min-width: 0;
  min-height: 100vh;
  margin: 0;
  background: var(--page);
  color: var(--text);
  transition:
    background-color 180ms ease,
    color 180ms ease;
}

button,
input,
select {
  font: inherit;
}

button,
select {
  cursor: pointer;
}

.app-shell {
  width: min(100% - 40px, 840px);
  min-height: 100vh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
}

.topbar {
  min-height: 82px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--border);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--text);
  text-decoration: none;
}

.brand-mark {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: var(--secondary);
  color: white;
  font-family: "Space Grotesk", sans-serif;
  font-size: 13px;
  font-weight: 700;
}

.brand-name {
  font-family: "Space Grotesk", sans-serif;
  font-size: 16px;
  font-weight: 700;
}

.theme-picker {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.workflow-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.players-heading-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.button-secondary {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
}

.button-secondary:hover {
  background: var(--soft);
}

.selection-status {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.button:disabled,
.driver-toggle:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.back-link {
  display: inline-block;
  margin-bottom: 24px;
  color: var(--primary);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.back-link:hover {
  text-decoration: underline;
}

.arrival-count {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.arrival-toggle,
.departure-toggle {
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.status-present[aria-pressed="true"],
.arrival-toggle[aria-pressed="true"],
.departure-toggle[aria-pressed="true"] {
  border-color: var(--pointed);
  background: var(--pointed);
  color: #ffffff;
}

.arrival-column-headings,
.arrival-player-list .player-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 145px 110px 260px;
  align-items: center;
  gap: 8px;
}

.arrival-column-headings {
  padding: 0 14px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-align: center;
}

.arrival-column-headings[hidden] {
  display: none;
}

.mobile-column-label {
  display: none;
}

.arrival-column-headings span:first-child {
  text-align: left;
}

.arrival-player-list .player-row {
  padding: 10px 13px;
}

.arrival-identity {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.arrival-identity .player-name {
  flex: 0 1 auto;
}

.transport-toggle {
  width: 36px;
  height: 36px;
  justify-self: center;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  color: var(--muted);
}

.driver-toggle svg,
.jersey-toggle svg,
.transport-toggle svg,
.driver-indicator svg,
.jersey-indicator svg {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.driver-toggle svg,
.jersey-toggle svg,
.driver-indicator svg,
.jersey-indicator svg {
  width: 19px;
  height: 19px;
}

.driver-toggle svg,
.driver-indicator svg,
.jersey-indicator svg {
  width: 21px;
  height: 21px;
  stroke-width: 2;
}

.transport-toggle svg {
  width: 20px;
  height: 20px;
}

.arrival-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

.driver-indicator,
.jersey-indicator {
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 1px solid var(--player-marker);
  border-radius: 9px;
  background: var(--player-marker);
  color: #ffffff;
}

.theme-picker select {
  max-width: 190px;
  padding: 9px 30px 9px 11px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font-size: 12px;
}

main {
  flex: 1;
  padding: 48px 0 56px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--primary);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.5px;
}

h1,
h2,
p {
  margin-top: 0;
}

h1,
h2 {
  font-family: "Space Grotesk", sans-serif;
  letter-spacing: -0.7px;
}

h1 {
  margin-bottom: 9px;
  font-size: clamp(30px, 6vw, 42px);
  line-height: 1.12;
}

.intro-copy {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 14px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 21px;
  margin-top: 21px;
}

.section-heading .eyebrow {
  margin-bottom: 5px;
}

h2 {
  margin-bottom: 0;
  font-size: 20px;
  color: var(--primary);
}

.add-player-form input {
  width: 100%;
  min-height: 44px;
  padding: 0 13px;
  border: 1px solid var(--border);
  border-radius: 10px;
  outline: none;
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  transition:
    border-color 150ms ease,
    box-shadow 150ms ease;
}

.add-player-form input:focus,
.theme-picker select:focus-visible {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 16%, transparent);
}

.players-section {
  margin-top: 0;
}

.players-heading {
  margin-bottom: 16px;
}

.attendance-count {
  margin-bottom: 0;
  padding: 8px 11px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
}

.add-player-form {
  display: flex;
  gap: 10px;
}

.button {
  min-height: 44px;
  padding: 0 18px;
  border: 0;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  transition:
    background-color 150ms ease,
    transform 150ms ease;
}

.button:active {
  transform: translateY(1px);
}

.button-primary {
  flex: 0 0 auto;
  background: var(--primary);
  color: white;
}

.button-primary:hover {
  background: var(--primary-hover);
}

.empty-state {
  margin: 15px 0 0;
  padding: 30px 16px;
  border: 1px dashed var(--border);
  border-radius: 12px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.player-list {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 9px;
  margin: 15px 0 0;
  padding: 0;
  list-style: none;
  min-width: 0;
}

.player-row {
  min-height: 64px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 13px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  min-width: 0;
}

.player-identity {
  min-width: 0;
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  gap: 5px;
}

.player-name {
  flex: 1;
  overflow: hidden;
  min-width: 0;
  font-size: 14px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.driver-toggle,
.jersey-toggle {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  color: var(--muted);
}

.driver-toggle[aria-pressed="true"],
.jersey-toggle[aria-pressed="true"],
.transport-toggle[aria-pressed="true"] {
  border-color: var(--icon-selected);
  background: var(--icon-selected);
  color: #ffffff;
}

.availability-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 5px;
}

.status-toggle {
  min-height: 34px;
  padding: 0 9px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.status-absent[aria-pressed="true"] {
  border-color: var(--danger);
  background: var(--danger);
  color: #ffffff;
}

.remove-player {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
}

.remove-player:hover {
  background: var(--soft);
  color: var(--primary);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  clip-path: inset(50%);
}

.footer {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 11px;
}

@media (max-width: 760px) {
  .arrival-column-headings,
  .arrival-player-list .player-row {
    grid-template-columns: minmax(0, 1fr) 32px 32px 92px;
    gap: 8px;
  }

  .arrival-column-headings {
    font-size: 10px;
    padding: 0 14px;
  }

  .arrival-player-list .player-row {
    min-height: 52px;
  }

  .desktop-column-label {
    display: none;
  }

  .mobile-column-label {
    display: inline;
  }

  .arrival-column-headings span:nth-child(2),
  .arrival-column-headings span:nth-child(3) {
    text-align: center;
    white-space: nowrap;
  }

  .arrival-actions {
    justify-content: flex-end;
    flex-wrap: nowrap;
    gap: 3px;
  }

  .arrival-identity {
    min-width: 0;
    gap: 4px;
  }

  .transport-toggle {
    width: 32px;
    height: 32px;
  }

  .arrival-toggle,
  .departure-toggle {
    min-height: 32px;
    padding: 0 4px;
    font-size: 10px;
    white-space: nowrap;
  }

  .driver-indicator,
  .jersey-indicator {
    width: 24px;
    height: 24px;
  }

  .driver-indicator svg,
  .jersey-indicator svg {
    width: 18px;
    height: 18px;
    stroke-width: 1.5;
  }

  .arrival-identity .player-name {
    flex: 0 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 12px;
  }
}

@media (max-width: 560px) {
  .arrival-column-headings,
  .arrival-player-list .player-row {
    grid-template-columns: minmax(0, 1fr) 30px 30px 84px;
    gap: 6px;
  }

  .arrival-column-headings {
    padding: 0 9px;
  }

  .arrival-player-list .player-row {
    min-height: 48px;
    padding: 8px;
  }

  .app-shell {
    width: min(100% - 28px, 840px);
  }

  .topbar {
    min-height: 72px;
  }

  .brand-name {
    font-size: 14px;
  }

  .theme-picker {
    gap: 6px;
  }

  .theme-picker select {
    max-width: 148px;
    padding-right: 22px;
    font-size: 11px;
  }

  .player-row {
    gap: 5px;
    padding: 8px;
  }

  .transport-toggle {
    width: 30px;
    height: 30px;
  }

  .players-heading {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .players-heading-actions {
    max-width: 100%;
    flex-wrap: nowrap;
    justify-content: flex-end;
    gap: 6px;
    margin-left: auto;
  }

  .reset-button {
    max-width: 100%;
    padding: 6px 8px;
    font-size: 11px;
    line-height: 1.2;
    white-space: normal;
  }

  .status-toggle {
    padding: 0 6px;
    font-size: 10px;
  }

  .driver-toggle,
  .jersey-toggle,
  .remove-player {
    width: 30px;
    height: 30px;
  }

  .driver-toggle svg,
  .jersey-toggle svg {
    width: 17px;
    height: 17px;
  }

  .driver-toggle svg {
    width: 20px;
    height: 20px;
  }

  main {
    padding: 36px 0 42px;
  }

  .footer {
    align-items: flex-start;
    justify-content: center;
    flex-direction: column;
    padding: 14px 0;
  }
}

@media (max-width: 430px) {
  .topbar {
    gap: 2px;
  }

  .brand {
    gap: 6px;
  }

  .brand-mark {
    width: 30px;
    height: 30px;
  }

  .brand-name {
    font-size: 12px;
  }

  .theme-picker {
    gap: 0;
  }

  .theme-picker label {
    display: none;
  }

  .theme-picker select {
    width: 138px;
    max-width: 138px;
    min-width: 0;
    padding-right: 16px;
    padding-left: 7px;
    font-size: 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
