:root {
  --surface: #f2f4f7;
  --surface-strong: #e9edf2;
  --ink: #1a1f24;
  --accent: #ffd166;
  --good: #4ef29a;
  --bad: #ff7c7c;
  --shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Space Grotesk", "Trebuchet MS", sans-serif;
  color: var(--ink);
  background: #ffffff;
  display: flex;
  justify-content: center;
  padding: 1rem;
}

.auth-screen {
  position: fixed;
  inset: 0;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.auth-screen[hidden] {
  display: none;
}

.auth-container {
  width: 100%;
  max-width: 320px;
  text-align: center;
}

.auth-container h1 {
  margin: 0 0 2rem 0;
  font-family: "Bangers", "Impact", sans-serif;
  font-size: clamp(2.2rem, 8vw, 3rem);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.auth-form {
  display: grid;
  gap: 1rem;
}

#password-input {
  padding: 0.75rem 1rem;
  font-size: 1rem;
  border: 1px solid rgba(0, 0, 0, 0.2);
  border-radius: 4px;
  font-family: inherit;
  background: #ffffff;
}

#password-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 209, 102, 0.2);
}

.auth-btn {
  padding: 0.75rem 1rem;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: 4px;
  background: var(--accent);
  color: #111111;
  cursor: pointer;
  transition: background-color 150ms ease;
}

.auth-btn:hover,
.auth-btn:focus-visible {
  background: #ffca24;
  outline: none;
}

.auth-error {
  margin: 0;
  font-size: 0.9rem;
  color: var(--bad);
  font-weight: 500;
}

.app-shell {
  width: min(680px, 100%);
  min-height: calc(100vh - 2rem);
  display: grid;
  gap: 0;
  animation: float-in 350ms ease-out;
}

.app-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  padding-top: 0.5rem;
}

.header-brand {
  flex: 1;
  text-align: center;
}

.header-slot {
  flex: 0 0 3.4rem;
  min-width: 3.4rem;
  display: flex;
  gap: 0.25rem;
  justify-content: center;
  align-items: flex-start;
}

.gear-link {
  position: static;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  color: var(--ink);
  text-decoration: none;
  font-size: 2.25rem;
  line-height: 1;
  padding: 0.35rem;
  touch-action: manipulation;
}

.gear-link:focus-visible,
.gear-link:hover {
  background: var(--surface);
  outline: none;
}

.header-icon-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 5rem;
  height: 5rem;
  color: var(--ink);
  text-decoration: none;
  font-size: 6.5rem;
  line-height: 1;
  padding: 0.35rem;
  touch-action: manipulation;
  transition: background-color 150ms ease;
  flex-grow: 1;
}

.back-link {
  width: auto;
  min-width: 3rem;
  font-size: 0.95rem;
  height: auto;
  font-size: 1rem;
  border: 1px solid rgba(0, 0, 0, 0.12);
  background: var(--surface);
  padding: 0.45rem 0.7rem;
}

.app-header h1 {
  margin: 0;
  font-family: "Bangers", "Impact", sans-serif;
  font-size: clamp(1.9rem, 7vw, 2rem);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.kicker {
  margin: 0;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  opacity: 0.85;
}

.attribute-panel {
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 0;
  padding: 0.35rem 1rem;
  backdrop-filter: blur(6px);
  box-shadow: var(--shadow);
  display: grid;
  place-items: center;
}

#current-attribute {
  color: var(--accent);
  font-family: "Bangers", "Impact", sans-serif;
  font-size: clamp(2rem, 12vw, 4rem);
  letter-spacing: 0.08em;
  line-height: 0.82;
  text-transform: uppercase;
}

#current-attribute[data-attribute="FORWARD"] {
  color: #d7263d;
}

#current-attribute[data-attribute="DEFENDER"] {
  color: #1f9d55;
}

#current-attribute[data-attribute="CAPTAIN"] {
  color: #b8860b;
}

#current-attribute[data-attribute="GOALKEEPER"] {
  color: #6a0dad;
}

.cards {
  display: grid;
  gap: 0;
  height: 50vh;
  position: relative;
}

.skip-btn {
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 0;
  background: #d6d9de;
  color: var(--ink);
  font-weight: 600;
  font-size: 1.25rem;
  padding: 0.65rem 0.75rem;
  cursor: pointer;
}

.skip-btn:hover,
.skip-btn:focus-visible {
  background: #c6cad1;
  outline: none;
}

.player-card {
  overflow: hidden;
  position: absolute;
  width: 60%;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 0;
  color: inherit;
  text-align: center;
  cursor: default;
  display: grid;
  place-items: center;
  transition: background-color 180ms ease, border-color 180ms ease;
}

.player-name {
  font-weight: 700;
  font-size: clamp(2.07rem, 9vw, 2.7rem);
}

.player-pic {
  width: 100%;
  object-fit: cover;
  object-position: top center;
  display: block;
}

.player-pic[data-is-default="true"] {
  filter: grayscale(100%);
  opacity: 0.7;
}

.vs-chip {
  justify-self: center;
  font-family: "Bangers", "Impact", sans-serif;
  font-weight: 700;
  font-size: clamp(2rem, 9vw, 3.25rem);
  line-height: 1;
  letter-spacing: 0.08em;
  /* Let's make the background a bit foggy so we can still see the players behind
   * it, but it needs to be opaque enough to keep the text legible */
  background: rgba(255, 255, 255, 0.85);
  border-radius: 0;
  padding: 0.05rem 0.45rem;
}

.top-action-row,
.bottom-action-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.top-action-row {
  justify-content: flex-end;
}

.bottom-action-row {
  justify-content: flex-start;
  margin-top: auto;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.action-btn {
  border: 1px solid rgba(255, 255, 255, 0.26);
  border-radius: 0;
  padding: 0.5rem 0.75rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.player-action {
  background: var(--accent);
  color: #1d1d1d;
  font-size: clamp(1.6rem, 5.8vw, 1.95rem);
  height: 120px;
  padding-left: 25px;
  padding-right: 25px;
  z-index: 2;
  box-shadow: 10px 10px lightgray;
  border: none;
}

.action-player-top,
.action-player-bottom {
  gap: 0.5rem;
  width: max-content;
  max-width: 100%;
}

.action-icon {
  font-size: 1.35em;
  line-height: 1;
}

.action-btn:hover,
.action-btn:focus-visible {
  filter: brightness(1.04);
  outline: none;
}

.admin-shell {
  gap: 1rem;
}

.admin-header {
  margin-bottom: 0.5rem;
  position: sticky;
  top: 0;
  z-index: 20;
  background: #ffffff;
  padding-bottom: 0.75rem;
}

.admin-panel {
  display: grid;
  gap: 1rem;
}

.admin-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.admin-toolbar h2 {
  margin: 0;
}

.admin-toolbar-buttons {
  display: flex;
  gap: 0.5rem;
}

.admin-status {
  min-height: 1.5rem;
}

.admin-status[data-error="true"] {
  color: #d7263d;
}

.player-admin-list {
  display: grid;
  gap: 0;
}

.player-admin-table {
  display: grid;
  gap: 0;
  border: 1px solid rgba(0, 0, 0, 0.12);
}

.player-admin-head,
.player-admin-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 200px 100px;
}

.player-admin-head {
  background: #e7ebf0;
  font-weight: 700;
}

.player-admin-head > div,
.player-admin-cell {
  padding: 0.85rem 1rem;
  border-right: 1px solid rgba(0, 0, 0, 0.12);
}

.player-admin-head > div:last-child,
.player-admin-cell:last-child {
  border-right: 0;
}

.player-admin-row {
  background: var(--surface);
  border-top: 1px solid rgba(0, 0, 0, 0.12);
}

.player-admin-cell {
  display: flex;
  align-items: center;
  padding-top: 0;
  padding-bottom: 0;
}

.player-admin-input {
  width: 100%;
  padding: 0.85rem 0.8rem;
  font: inherit;
  background: #fff;
  margin: 0;
  border: none;
  outline: none;
}

.player-admin-input[data-saving="true"] {
  background: #fff7db;
}

.player-admin-select {
  width: 100%;
  padding: 0.85rem 0.8rem;
  font: inherit;
  background: #fff;
  margin: 0;
  border: none;
  outline: none;
  cursor: pointer;
}

.player-admin-select:focus {
  background: #f0f5ff;
}

.player-admin-photo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.player-admin-file {
  display: none;
}

.admin-upload {
  width: 2.8rem;
  min-width: 2.8rem;
  height: 2.8rem;
  padding: 0;
  font-size: 1rem;
}

.admin-upload svg {
  width: 1.35rem;
  height: 1.35rem;
}

.admin-delete {
  width: 2.8rem;
  min-width: 2.8rem;
  height: 2.8rem;
  padding: 0;
  background: #f3d4d8;
  color: #6d1020;
  font-size: 1rem;
}

.admin-delete .material-symbols-outlined {
  font-size: 1.3rem;
  line-height: 1;
}

/* Leaderboard and team management page links. */
span.material-symbols-outlined {
  font-size: 40px !important;
}

.games-header {
  margin-bottom: 0.5rem;
  position: sticky;
  top: 0;
  z-index: 20;
  background: #ffffff;
}

.games-panel {
  display: grid;
  gap: 1rem;
}

.games-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.games-toolbar h2 {
  margin: 0;
}

.toolbar-buttons {
  display: flex;
  gap: 0.5rem;
}

.games-status[data-error="true"] {
  color: #d7263d;
}

.games-list {
  display: grid;
  gap: 1rem;
}

.game-card {
  background: var(--surface);
  border: 1px solid black;
  border-radius: 8px;
  padding: 1.25rem;
  display: grid;
  gap: 1rem;
}

.game-card-cancelled {
  filter: grayscale(100%);
  opacity: 0.6;
}

.games-section {
  display: grid;
  gap: 1rem;
  margin-bottom: 2rem;
}

.games-section-heading {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--ink);
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--accent);
}

.games-section-cancelled .games-section-heading {
  border-bottom-color: rgba(0, 0, 0, 0.2);
  color: rgba(0, 0, 0, 0.6);
}

.game-header {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: end;
}

.game-datetime {
  flex-grow: 1;
  display: flex;
  gap: 10px;
  min-width: 300px;
}

.game-date {
  font-weight: 600;
  font-size: 1.1rem;
}

.game-time {
  font-size: 0.9rem;
  color: var(--ink);
  opacity: 0.75;
}

.game-body {
  display: flex;
}

.registration-count {
  display: flex;
  flex-grow: 1;
  align-items: center;
  font-weight: 600;
  color: var(--accent);
  white-space: nowrap;
}

.signup-status {
  font-size: 1.2rem;
}

.registrations-list {
  display: grid;
  gap: 1rem;
  border-top: 1px solid rgba(0, 0, 0, 0.12);
  padding-top: 1rem;
}

.no-registrations {
  font-style: italic;
  color: rgba(0, 0, 0, 0.5);
  padding: 0.5rem 0;
}

.teams-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.team-column {
  display: grid;
  gap: 0.5rem;
}

.team-header {
  margin: 0 0 0.5rem 0;
  font-size: 1rem;
  font-weight: 600;
  display: flex;
  justify-content: center;
}

.team-lights .team-header {
  color: #000;
  border: 2px solid #000;
  background: #fff;
}

.team-darks .team-header {
  color: #fff;
  background: #000;
}

.registration-item {
  display: grid;
  grid-template-columns: 2rem 1fr;
  gap: 0.75rem;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.registration-item:last-child {
  border-bottom: 0;
}

.registration-number {
  font-weight: 600;
  text-align: center;
  font-size: 0.9rem;
}

.registration-player {
  font-weight: 500;
  font-size: 0.95rem;
}

.substitutes-section {
  display: grid;
  gap: 0.5rem;
  grid-column: 1 / -1;
  padding-top: 0.5rem;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.substitutes-items {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.5rem;
}

.substitutes-items .registration-item {
  padding: 0.25rem 0;
}

.no-games {
  text-align: center;
  padding: 2rem 1rem;
  color: rgba(0, 0, 0, 0.5);
  font-style: italic;
}

@media (max-width: 720px) {
  .teams-container {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .player-admin-head,
  .player-admin-row {
    grid-template-columns: 1fr;
  }

  .player-admin-head {
    display: none;
  }

  .player-admin-cell {
    border-right: 0;
  }

  .player-admin-row {
    border-top: 1px solid rgba(0, 0, 0, 0.12);
  }
}

.who-btn {
  border: none;
  border-bottom: 2px dashed #999999;
  background: transparent;
  color: #999999;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.2rem 0.3rem;
  cursor: pointer;
  white-space: nowrap;
  transition: color 150ms ease, border-color 150ms ease;
}

.who-btn:hover,
.who-btn:focus-visible {
  color: #666666;
  border-bottom-color: #666666;
  outline: none;
}

.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 100;
}

.modal:not([hidden]) {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: -1;
}

.modal-content {
  background: #ffffff;
  border-radius: 8px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
  padding: 2rem;
  max-width: 100%;
  animation: modal-slide-up 250ms ease-out;
  width: 600px;
  max-height: 100vh;
  height: 900px;
}

.modal-body {
  position: relative;
  min-height: 240px;
  display: flex;
  flex-direction: column;
  margin-bottom: 1.5rem;
  overflow: hidden;
  border-radius: 4px;
}

#modal-question {
  position: absolute;
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
  color: #ffffff;
  text-align: center;
  z-index: 2;
  padding: 1rem;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
  max-width: 90%;
}

.modal-pic {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  z-index: 1;
}

.modal-actions {
  display: flex;
  gap: 0.75rem;
}

.modal-btn {
  flex: 1;
  padding: 0.75rem 1rem;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 4px;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: background-color 150ms ease, color 150ms ease;
}

.modal-yes-btn {
  background: #e8f5e9;
  color: #1b5e20;
  border-color: #a5d6a7;
}

/* Signup Modal */
#signup-modal .modal-body {
  min-height: auto;
  display: block;
  padding: 0;
  overflow: visible;
}

#new-player-modal .modal-body {
  min-height: auto;
  display: block;
  padding: 0;
  overflow: visible;
}

.player-search-input {
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  border: 1px solid rgba(0, 0, 0, 0.2);
  border-radius: 4px;
  font-family: inherit;
  background: #ffffff;
  margin-bottom: 1rem;
}

.player-search-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 209, 102, 0.2);
}

.player-name-input {
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  border: 1px solid rgba(0, 0, 0, 0.2);
  border-radius: 4px;
  font-family: inherit;
  background: #ffffff;
}

.player-name-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 209, 102, 0.2);
}

.player-dropdown {
  display: grid;
  gap: 0.5rem;
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 4px;
  background: #ffffff;
}

.dropdown-item {
  padding: 0.75rem 1rem;
  cursor: pointer;
  transition: background-color 150ms ease;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.dropdown-item[data-player-id]:hover {
  background-color: var(--surface);
}

.dropdown-item.no-match {
  padding: 1rem;
  text-align: center;
  color: rgba(0, 0, 0, 0.5);
  cursor: default;
  font-style: italic;
}

.signup-btn {
  white-space: nowrap;
}

.signup-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.game-action-buttons {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.icon-btn {
  background: transparent;
  border: none;
  padding: 0.25rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink);
  border-radius: 4px;
  transition: background-color 150ms ease, color 150ms ease;
}

.icon-btn:hover:not(:disabled) {
  background-color: rgba(0, 0, 0, 0.08);
}

.icon-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.icon-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.icon-btn .material-symbols-outlined {
  font-size: 1.5rem;
}

.cancel-game-btn {
  color: #d32f2f;
}

.cancel-game-btn:hover:not(:disabled) {
  background-color: rgba(211, 47, 47, 0.1);
  color: #b71c1c;
}

.schedule-btn {
  color: #3baf3b;
}

.schedule-btn:hover:not(:disabled) {
  background-color: rgba(255, 209, 102, 0.15);
  color: #b8860b;
}

.refresh-btn:hover:not(:disabled) {
  background-color: rgba(0, 0, 0, 0.12);
  transform: rotate(180deg);
  transition: background-color 150ms ease, transform 500ms ease;
}

.modal-yes-btn:hover,
.modal-yes-btn:focus-visible {
  background: #c8e6c9;
  outline: none;
}

.modal-no-btn {
  background: #ffebee;
  color: #b71c1c;
  border-color: #ef9a9a;
}

.modal-no-btn:hover,
.modal-no-btn:focus-visible {
  background: #ffcdd2;
  outline: none;
}

@keyframes modal-slide-up {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Form Styles */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.form-group label {
  font-weight: 500;
  font-size: 0.95rem;
}

.form-group input,
.form-group select {
  padding: 0.75rem;
  font-size: 1rem;
  border: 1px solid rgba(0, 0, 0, 0.2);
  border-radius: 4px;
  font-family: inherit;
  background: #ffffff;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 209, 102, 0.2);
}

.select-input {
  padding: 0.75rem;
  font-size: 1rem;
  border: 1px solid rgba(0, 0, 0, 0.2);
  border-radius: 4px;
  font-family: inherit;
  background: #ffffff;
  cursor: pointer;
}

.select-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 209, 102, 0.2);
}

@media (min-width: 720px) {
  .cards {
    grid-template-columns: 1fr auto 1fr;
    align-items: stretch;
  }
}

.middle-stack {
  z-index: 1;
  text-align: center;
  position: absolute;
  left: 0;
  right: 0;
  align-self: end;
}


@keyframes float-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

#bottom-card {
  left: 0;
  bottom: 0;
  top: 5vh;
  transform: rotate(-20deg);
}

#top-card {
  right: 0;
  top: 0;
  bottom: 5vh;
  transform: rotate(20deg);
}
.leaderboard-panel {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
}
.leaderboard-pic {
  width: 60px;
  height: 60px;
  object-fit: cover;
  object-position: top center;
  border-radius: 60px;
  margin-left: 10px;
  margin-right: 10px;
}
.leaderboard-item {
  display: flex;
  align-items: center;
}
.leaderboard-info {
  flex-grow: 1;
  text-align: center;
  margin-left: 7px;
}
.leaderboard-rank {
  font-family: "Bangers", "Impact", sans-serif;
  background-color: #ffffff;
  padding: 0.25rem 0.5rem;
  width: 40px;
  height: 40px;
  border-radius: 40px;
  font-size: 1.1rem;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
}

.leaderboard-section {
  flex-grow: 1;
  min-width: 40%;
}
.leaderboard-list {
  margin-left: 20px;
  margin-right: 20px;
  padding-left: 20px;
  padding-right: 20px;
  padding-top: 10px;
  padding-bottom: 10px;
  border-radius: 20px;
}
.leaderboard-list .leaderboard-item:not(:last-child) {
  margin-bottom: 4px;
}
#goalkeeper-list {
  background: rgba(106, 13, 173, 0.4);
}
#defending-list {
  background: rgba(31, 157, 85, 0.4);
}
#attacking-list {
  background: rgba(215, 38, 61, 0.4);
}
#captain-list {
  background: rgba(184, 134, 11, 0.4);
}
h2 {
  text-align: center;
  font-family: "Bangers", "Impact", sans-serif;
  font-size: clamp(1.0rem, 3.8vw, 1.7rem);
}