/* Material Design 3 – Green Tie League theme (contrasty palette) */

:root {
  /* Primary – forest green */
  --md-sys-color-primary: #1b5e20;
  --md-sys-color-on-primary: #ffffff;
  --md-sys-color-primary-container: #a5d6a7;
  --md-sys-color-on-primary-container: #003300;
  /* Secondary – warm amber accent */
  --md-sys-color-secondary: #e65100;
  --md-sys-color-on-secondary: #ffffff;
  --md-sys-color-secondary-container: #ffcc80;
  --md-sys-color-on-secondary-container: #2d1b00;
  /* Error */
  --md-sys-color-error: #b71c1c;
  --md-sys-color-on-error: #ffffff;
  /* Surfaces – dark base, lighter cards */
  --md-sys-color-surface: #0a0f0d;
  --md-sys-color-on-surface: #e8f5e9;
  --md-sys-color-surface-variant: #1e3328;
  --md-sys-color-on-surface-variant: #b8ddc4;
  --md-sys-color-surface-container: #243d30;
  --md-sys-color-on-surface-container: #c5e6d0;
  /* Outline */
  --md-sys-color-outline: #4a7c5e;
  --md-sys-color-outline-variant: #2d4a38;
}

* {
  box-sizing: border-box;
}

body {
  font-family: 'Roboto', system-ui, sans-serif;
  margin: 0;
  background: var(--md-sys-color-surface);
  color: var(--md-sys-color-on-surface);
  min-height: 100vh;
}

/* Top app bar */
nav {
  background: var(--md-sys-color-primary);
  padding: 0 1rem;
  min-height: 64px;
  display: flex;
  align-items: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

nav.nav-admin {
  background: var(--md-sys-color-secondary);
}

nav a {
  color: var(--md-sys-color-on-primary);
  text-decoration: none;
  margin-right: 1rem;
  font-weight: 500;
}

nav.nav-admin a {
  color: var(--md-sys-color-on-secondary);
}

nav a:hover {
  text-decoration: underline;
}

nav.nav-flex {
  justify-content: space-between;
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.nav-left .link-sep {
  margin: 0 0.15rem;
}

.nav-profile-wrap {
  position: relative;
  margin-left: 1rem;
}

.nav-profile-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  background: transparent;
  border: none;
  color: var(--md-sys-color-on-primary);
  cursor: pointer;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
}

nav.nav-admin .nav-profile-btn {
  color: var(--md-sys-color-on-secondary);
}

.nav-profile-btn:hover {
  background: rgba(255, 255, 255, 0.15);
}

.nav-profile-btn[aria-expanded="true"] {
  background: rgba(255, 255, 255, 0.2);
}

.nav-profile-icon {
  font-size: 1.25rem;
  vertical-align: middle;
}

.nav-profile-name {
  font-size: 0.9rem;
}

.nav-profile-chevron {
  font-size: 1.2rem;
  transition: transform 0.2s;
}

.nav-profile-btn[aria-expanded="true"] .nav-profile-chevron {
  transform: rotate(180deg);
}

.nav-profile-menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 0.25rem;
  min-width: 160px;
  background: var(--md-sys-color-surface-container);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  padding: 0.5rem 0;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity 0.2s, visibility 0.2s, transform 0.2s;
  z-index: 100;
}

.nav-profile-menu.nav-profile-menu-open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.nav-profile-menu a,
.nav-profile-menu-form {
  display: block;
}

.nav-profile-menu a {
  color: var(--md-sys-color-on-surface-container);
  text-decoration: none;
  padding: 0.6rem 1rem;
  font-size: 0.9rem;
}

.nav-profile-menu a:hover {
  background: rgba(255, 255, 255, 0.08);
}

.nav-profile-menu-form {
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--md-sys-color-outline-variant);
}

.nav-profile-menu-form .btn-text {
  width: 100%;
  text-align: left;
  padding: 0.6rem 1rem;
  color: var(--md-sys-color-on-surface-container);
  border-radius: 0;
}

.nav-profile-menu-form .btn-text:hover {
  background: rgba(255, 255, 255, 0.08);
  text-decoration: none;
}

nav .nav-spaced {
  margin-left: 1rem;
}

.nav-form-inline {
  display: inline;
  margin-left: 1rem;
}

.btn-text {
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  background: transparent;
  border: none;
  color: var(--md-sys-color-on-primary);
  cursor: pointer;
  padding: 0.5rem;
}

.btn-text:hover {
  text-decoration: underline;
}

/* Main */
main {
  max-width: 700px;
  margin: 0 auto;
  padding: 1.5rem;
}

main.main-wide {
  max-width: 900px;
}

main.main-dashboard {
  max-width: 800px;
}

h1 {
  font-size: 1.75rem;
  font-weight: 500;
  color: var(--md-sys-color-on-surface);
  margin-bottom: 1.5rem;
}

h2 {
  font-size: 1.25rem;
  font-weight: 500;
  color: var(--md-sys-color-on-surface);
  margin-bottom: 1rem;
}

/* Material Web button overrides for theme */
md-filled-button,
md-filled-tonal-button,
md-outlined-button,
md-text-button,
md-elevated-button {
  --md-sys-color-primary: var(--md-sys-color-primary);
  --md-sys-color-on-primary: var(--md-sys-color-on-primary);
}

/* Badges – Material chips style */
.badge {
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.25rem 0.5rem;
  border-radius: 8px;
  margin-left: 0.5rem;
}

.badge-draft {
  background: rgba(255, 255, 255, 0.12);
  color: var(--md-sys-color-on-surface-variant);
}

.badge-live {
  background: var(--md-sys-color-secondary);
  color: var(--md-sys-color-on-secondary);
}

.badge-locked {
  background: var(--md-sys-color-error);
  color: var(--md-sys-color-on-error);
}

.badge-archived {
  background: rgba(255, 255, 255, 0.2);
  color: var(--md-sys-color-on-surface-variant);
}

.badge-past {
  background: rgba(255, 152, 0, 0.3);
  color: #e65100;
  border: 1px solid rgba(230, 81, 0, 0.5);
}

/* Forms – Material filled text field style */
form {
  margin-top: 1.5rem;
}

label {
  display: block;
  margin-bottom: 0.25rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--md-sys-color-on-surface-container);
}

input,
textarea,
select {
  font-family: inherit;
  font-size: 1rem;
  padding: 1rem;
  border: none;
  border-radius: 4px 4px 0 0;
  background: var(--md-sys-color-surface-variant);
  color: var(--md-sys-color-on-surface);
  border-bottom: 2px solid var(--md-sys-color-outline);
  width: 100%;
  margin-bottom: 1rem;
  transition: border-color 0.2s, background 0.2s;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-bottom-color: var(--md-sys-color-primary);
  background: rgba(45, 106, 79, 0.08);
}

select.select-inline {
  width: auto;
  min-width: 8rem;
  padding: 0.5rem 2rem 0.5rem 0.75rem;
  margin: 0;
  margin-bottom: 0;
  cursor: pointer;
}

select.select-inline:focus {
  border-bottom-color: var(--md-sys-color-primary);
}

select option {
  background: var(--md-sys-color-surface-container);
  color: var(--md-sys-color-on-surface-container);
}

textarea {
  min-height: 120px;
  resize: vertical;
}

.form-inline-spaced {
  margin-left: 0.5rem;
}

.schedule-form {
  margin-bottom: 1rem;
}

.schedule-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.schedule-row label {
  min-width: 5rem;
  margin: 0;
}

.schedule-row input[type="datetime-local"] {
  width: auto;
  min-width: 12rem;
  margin-bottom: 0;
}

.inline-form {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* Login – Material card */
body.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card {
  background: var(--md-sys-color-surface-container);
  padding: 2rem;
  border-radius: 16px;
  border: 1px solid var(--md-sys-color-outline);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  width: 100%;
  max-width: 360px;
}

.login-card h1 {
  margin: 0 0 1.5rem;
  font-size: 1.5rem;
}

.login-error {
  background: rgba(183, 28, 28, 0.3);
  color: #ffcdd2;
  padding: 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  font-size: 0.875rem;
  border: 1px solid var(--md-sys-color-error);
}

.quick-login-panel {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--md-sys-color-outline);
}

.quick-login-title {
  font-size: 0.75rem;
  color: var(--md-sys-color-on-surface-container);
  opacity: 0.8;
  margin-bottom: 0.75rem;
}

.quick-login-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.quick-login-item {
  margin: 0;
}

.btn-quick {
  font-family: inherit;
  font-size: 0.8rem;
  padding: 0.4rem 0.75rem;
  border: 1px solid var(--md-sys-color-outline);
  border-radius: 8px;
  background: transparent;
  color: var(--md-sys-color-on-surface-container);
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.btn-quick:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--md-sys-color-secondary);
}

.admin-badge {
  font-size: 0.65rem;
  opacity: 0.9;
  margin-left: 0.25rem;
}

.btn-full {
  width: 100%;
  margin-top: 0.5rem;
}

/* Native Material-style buttons (for form compatibility) */
.btn-filled {
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 20px;
  background: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
  cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s;
}

.btn-filled:hover {
  background: #2e7d32;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.btn-filled:active {
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.btn-tonal {
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 20px;
  background: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
  cursor: pointer;
  transition: background 0.2s;
}

.btn-tonal:hover {
  background: #ffb74d;
}

.btn-outlined {
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.75rem 1.5rem;
  border: 2px solid var(--md-sys-color-outline);
  border-radius: 20px;
  background: transparent;
  color: var(--md-sys-color-on-surface);
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.btn-outlined:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--md-sys-color-secondary);
}

.btn-danger {
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 20px;
  background: var(--md-sys-color-error);
  color: var(--md-sys-color-on-error);
  cursor: pointer;
  transition: background 0.2s;
}

.btn-danger:hover {
  background: #c62828;
}

/* Dashboard – heading row with the live clock */
.dashboard-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  margin-bottom: 1.5rem;
}

.dashboard-head h1 {
  margin-bottom: 0;
}

.now-clock {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin: 0;
  font-size: 0.95rem;
  color: var(--md-sys-color-on-surface-container);
}

.now-date {
  opacity: 0.8;
}

.now-time {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--md-sys-color-secondary-container);
}

/* Dashboard – Material cards */
.game-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.game-item {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.countdown-panel {
  background: var(--md-sys-color-surface-variant);
  padding: 0.5rem 1.25rem;
  border-radius: 8px;
  margin-top: 0.5rem;
  margin-left: 4px;
  margin-right: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
}

.countdown-label {
  color: var(--md-sys-color-on-surface-variant);
}

.countdown-timer {
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  color: var(--md-sys-color-secondary-container);
}


.game-card {
  background: var(--md-sys-color-surface-container);
  padding: 1.5rem 1.75rem;
  border-radius: 12px;
  display: flex;
  flex-wrap: wrap;
  row-gap: 0.75rem;
  justify-content: space-between;
  align-items: center;
  border-left: 4px solid var(--md-sys-color-primary);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  transition: box-shadow 0.2s;
}

.game-card:hover {
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.game-card a {
  color: var(--md-sys-color-secondary-container);
  text-decoration: none;
  font-weight: 500;
}

.game-card > div > a,
.game-card .game-name-disabled {
  font-size: 1.35rem;
  font-weight: 600;
  line-height: 1.2;
}

.game-card-foot {
  flex: 1 0 100%;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin: 0;
  padding-top: 0.75rem;
  border-top: 1px solid var(--md-sys-color-outline-variant);
  font-size: 0.875rem;
  color: var(--md-sys-color-on-surface-container);
}

.game-card-foot .pred-state-note {
  margin-left: 0;
  opacity: 0.85;
}

.game-card a:hover {
  text-decoration: underline;
}

.game-card-disabled {
  opacity: 0.8;
  box-shadow: none;
}

.game-card-disabled:hover {
  box-shadow: none;
}

.game-card-disabled .game-name-disabled {
  color: var(--md-sys-color-on-surface-container);
}

.game-card-disabled .game-action-disabled {
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.9rem;
}

.meta {
  font-size: 0.875rem;
  color: var(--md-sys-color-on-surface-container);
  opacity: 0.95;
}

.meta-notice {
  font-style: italic;
  opacity: 0.9;
}

/* Dashboard – has the player predicted yet? */
.game-card-predicted {
  border-left-color: var(--md-sys-color-primary-container);
}

.game-card-unpredicted {
  border-left-color: var(--md-sys-color-secondary);
  background: var(--md-sys-color-surface-variant);
}

.pred-state {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 500;
  border: 1px solid transparent;
}

.pred-state-yes {
  background: rgba(165, 214, 167, 0.18);
  border-color: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-primary-container);
}

.pred-state-no {
  background: rgba(255, 204, 128, 0.18);
  border-color: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-secondary-container);
}

.pred-state-note {
  margin-left: 0.4rem;
  opacity: 0.85;
}

/* Prediction cards */
.sortable-list.sortable-touch-dragging {
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

.sortable-list.sortable-touch-dragging .pred-card {
  -webkit-touch-callout: none;
}

.sortable-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 1rem 0;
}

.pred-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--md-sys-color-surface-container);
  border-radius: 12px;
  cursor: grab;
  border: 2px solid transparent;
  border-left: 4px solid var(--md-sys-color-secondary);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  transition: border-color 0.15s, opacity 0.15s, box-shadow 0.15s;
}

.pred-card:hover {
  border-color: var(--md-sys-color-outline);
}

.pred-card.dragging {
  opacity: 1;
  cursor: grabbing;
  transform: scale(1.02);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  z-index: 10;
  position: relative;
}

.pred-card.dimmed {
  opacity: 0.35;
  transition: opacity 0.3s;
}

.pred-card.selected {
  border-color: var(--md-sys-color-primary);
  box-shadow: 0 0 0 2px var(--md-sys-color-primary);
}

.pred-card-self {
  background: #2d4a3a;
  border-left-width: 6px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
  font-weight: 600;
}

.drag-handle {
  color: var(--md-sys-color-on-surface-container);
  font-size: 1.2rem;
  cursor: grab;
  user-select: none;
}

.pred-card .position-badge {
  min-width: 1.75rem;
  height: 1.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
  border-radius: 50%;
  font-weight: 500;
  font-size: 0.875rem;
}

.pred-card .name {
  flex: 1;
}

/* Full name – lighter tint wherever shown alongside nickname */
.name-full {
  font-weight: 400;
  opacity: 0.7;
}

.pred-card .name-full {
  font-weight: 400;
  opacity: 0.7;
}

.pred-card .move-btns {
  display: flex;
  flex-direction: row;
  align-self: stretch;
  gap: 2px;
}

.pred-card .move-btns button {
  flex: 1;
  min-width: 2.25rem;
  font-size: 0.9rem;
  padding: 0.25rem;
  border: 1px solid var(--md-sys-color-outline);
  border-radius: 8px;
  background: var(--md-sys-color-surface-container);
  color: var(--md-sys-color-on-surface-container);
  cursor: pointer;
  transition: background 0.2s;
}

/* Touch devices leave :hover stuck on the last tapped element, so after a
   move an arrow stayed lit where the card used to be. Only hover-capable
   pointers get the hover state; keyboards get a focus ring instead. */
@media (hover: hover) {
  .pred-card .move-btns button:hover:not(:disabled) {
    background: var(--md-sys-color-secondary);
    color: var(--md-sys-color-on-secondary);
  }
}

.pred-card .move-btns button:focus-visible {
  outline: 2px solid var(--md-sys-color-primary-container);
  outline-offset: 1px;
}

.pred-card .move-btns button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.pred-card-readonly {
  cursor: default;
  padding-left: 1rem;
}

.pred-card-readonly:hover {
  border-color: transparent;
}

.pred-card-actual {
  font-size: 0.85rem;
  color: var(--md-sys-color-on-surface-container);
  opacity: 0.9;
  white-space: nowrap;
}

.locked-msg {
  color: #ffcdd2;
  margin-top: 1rem;
}

.results {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--md-sys-color-outline);
}

.leaderboard-panel {
  text-align: center;
  padding: 2rem;
  margin: 1.5rem 0;
  border-radius: 16px;
  background: var(--md-sys-color-surface-container);
  border: 2px solid var(--md-sys-color-outline-variant);
}

.leaderboard-panel-emoji {
  font-size: 4rem;
  line-height: 1;
  margin-bottom: 0.5rem;
}

.leaderboard-panel-message {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0.5rem 0;
}

.leaderboard-panel-rank {
  font-size: 0.95rem;
  color: var(--md-sys-color-on-surface-container);
  opacity: 0.9;
  margin: 0.25rem 0 0;
}

.leaderboard-panel-gold { border-color: #ffd700; background: rgba(255, 215, 0, 0.1); }
.leaderboard-panel-silver { border-color: #c0c0c0; background: rgba(192, 192, 192, 0.1); }
.leaderboard-panel-bronze { border-color: #cd7f32; background: rgba(205, 127, 50, 0.1); }
.leaderboard-panel-last { border-color: #8b4513; background: rgba(139, 69, 19, 0.08); }
.leaderboard-panel-mid { border-color: var(--md-sys-color-outline-variant); }
.leaderboard-panel-warning { border-color: #e65100; background: rgba(230, 81, 0, 0.12); }

/* Smaller sibling of the leaderboard panel – entries still open */
.closes-panel {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1.1rem;
  margin: 1rem 0 1.5rem;
  border-radius: 999px;
  background: rgba(165, 214, 167, 0.1);
  border: 1px solid rgba(165, 214, 167, 0.35);
}

.closes-panel-icon {
  font-size: 1.5rem;
  line-height: 1;
}

.closes-panel-text {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.closes-panel-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.closes-panel-hint {
  margin: 0;
  font-size: 0.85rem;
  color: var(--md-sys-color-on-surface-container);
  opacity: 0.85;
}

/* Lighter companion panel – who is in and who is still to predict */
.pred-status-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 2rem;
  padding: 0.75rem 1rem;
  margin: 1.5rem 0 0;
  border-radius: 12px;
  background: transparent;
  border: 1px solid var(--md-sys-color-outline-variant);
  font-size: 0.875rem;
}

.pred-status-group {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  flex: 1 1 14rem;
}

.pred-status-heading {
  font-weight: 600;
  color: var(--md-sys-color-on-surface-variant);
}

.pred-status-names {
  color: var(--md-sys-color-on-surface-container);
  opacity: 0.85;
}

.leaderboard {
  list-style: none;
  padding: 0;
}

.leaderboard li {
  padding: 0.5rem 0;
  display: flex;
  justify-content: space-between;
}

.leaderboard .name-full {
  font-weight: 400;
  opacity: 0.7;
}

.leaderboard-self {
  background: rgba(230, 81, 0, 0.15);
  margin: 0 -0.5rem;
  padding: 0.5rem 0.5rem !important;
  border-radius: 8px;
  border-left: 4px solid var(--md-sys-color-secondary);
}

.your-score {
  background: var(--md-sys-color-surface-container);
  padding: 1rem;
  border-radius: 12px;
  margin-bottom: 1rem;
  border-left: 4px solid var(--md-sys-color-primary);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.your-pred-list {
  margin: 0.5rem 0 0;
  padding-left: 1.25rem;
}

/* Admin */
.actions {
  margin-bottom: 1.5rem;
}

.actions a {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  background: var(--md-sys-color-secondary);
  color: var(--md-sys-color-on-secondary);
  text-decoration: none;
  border-radius: 20px;
  font-weight: 500;
  transition: background 0.2s, box-shadow 0.2s;
}

.actions a:hover {
  background: #ff6f00;
  box-shadow: 0 2px 8px rgba(230, 81, 0, 0.4);
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
  background: var(--md-sys-color-surface-container);
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--md-sys-color-outline);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

th,
td {
  padding: 1rem;
  text-align: left;
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
}

th {
  font-weight: 500;
  color: var(--md-sys-color-on-primary);
  background: var(--md-sys-color-primary);
}

tr:last-child td {
  border-bottom: none;
}

.section {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--md-sys-color-outline);
}

.help {
  font-size: 0.875rem;
  color: var(--md-sys-color-on-surface-container);
  margin-bottom: 0.5rem;
  opacity: 0.95;
}

.mobile-hint {
  font-size: 0.85rem;
  color: var(--md-sys-color-on-surface-container);
  font-style: italic;
}

@media (min-width: 768px) {
  .mobile-hint {
    display: none;
  }
}

.muted {
  color: var(--md-sys-color-on-surface-container);
  font-style: italic;
}

.player-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.player-list li {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
}

.player-list li:last-child {
  border-bottom: none;
}

.player-list li.player-self {
  background: rgba(230, 81, 0, 0.4) !important;
  border: 6px solid #e8f5e9 !important;
  padding: 0.5rem 0.75rem !important;
  margin: 0.5rem 0 !important;
  border-radius: 8px !important;
  font-weight: 600 !important;
  box-shadow: 0 2px 8px rgba(232, 245, 233, 0.5) !important;
}

.you-badge {
  display: inline-block;
  margin-left: 0.5rem;
  padding: 0.15rem 0.5rem;
  background: var(--md-sys-color-secondary);
  color: var(--md-sys-color-on-secondary);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-radius: 4px;
}

nav a.active {
  font-weight: 700;
  text-decoration: underline;
}

.submenu {
  margin: 0.5rem 0 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.submenu a {
  color: var(--md-sys-color-primary-container);
  text-decoration: none;
  font-weight: 500;
}

.submenu a:hover {
  text-decoration: underline;
}

/* Table action links (Edit, Predictions) */
table td a {
  color: var(--md-sys-color-primary-container);
  text-decoration: none;
  font-weight: 500;
}

table td a:hover {
  text-decoration: underline;
}

.link-sep {
  color: var(--md-sys-color-outline);
  font-weight: 400;
  pointer-events: none;
}

.result-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.result-label {
  min-width: 200px;
  margin: 0;
}

.result-input {
  width: 80px;
  margin-bottom: 0;
}

.results-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1rem;
}

.player-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.player-checkbox-label {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

/* Rename form on the game editor */
.name-form {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.name-form input[type="text"] {
  flex: 1 1 18rem;
  max-width: 28rem;
  margin: 0;
}

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

.player-assign-list {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
  max-width: 400px;
}

.player-assign-list li {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
}

.player-assign-list li:last-child {
  border-bottom: none;
}

.player-assign-list .player-checkbox-label {
  font-size: 1rem;
}

.player-assign-list input[type="checkbox"] {
  width: 1.1rem;
  height: 1.1rem;
  margin: 0;
  cursor: pointer;
}

.players-form-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 1rem;
}

.players-count {
  font-size: 0.95rem;
  color: var(--md-sys-color-on-surface-container);
}

/* Footer */
.pred-footer .btn-footer {
  padding: 0.75rem 2rem;
  font-size: 1rem;
  background: var(--md-sys-color-on-primary);
  color: var(--md-sys-color-primary);
}

.pred-footer .btn-footer:hover {
  background: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-primary-container);
}

.pred-footer .btn-footer:disabled {
  opacity: 0.9;
  cursor: default;
}

.pred-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--md-sys-color-primary);
  padding: 1rem 1.5rem;
  border-top: 2px solid var(--md-sys-color-secondary-container);
  display: flex;
  justify-content: center;
  gap: 1rem;
  z-index: 100;
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.4);
}

.pred-footer .btn-tonal.btn-footer {
  background: rgba(255, 255, 255, 0.2);
  color: var(--md-sys-color-on-primary);
}

.pred-footer .btn-tonal.btn-footer:hover {
  background: rgba(255, 255, 255, 0.35);
}

body.has-pred-footer {
  padding-bottom: 5rem;
}

/* Ephemeral modal – Material dialog style */
.ephemeral-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--md-sys-color-surface-container);
  color: var(--md-sys-color-on-surface);
  padding: 1.5rem 2rem;
  border-radius: 16px;
  border: 2px solid var(--md-sys-color-secondary);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  font-size: 1rem;
  font-weight: 500;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
}

.ephemeral-modal.ephemeral-modal-visible {
  opacity: 1;
  visibility: visible;
}

/* Confirm modal – dialog with backdrop */
.confirm-modal {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.25s, visibility 0.25s;
}

.confirm-modal.confirm-modal-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.confirm-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  cursor: pointer;
}

.confirm-modal-content {
  position: relative;
  background: var(--md-sys-color-surface-container);
  color: var(--md-sys-color-on-surface);
  padding: 1.5rem;
  border-radius: 16px;
  border: 2px solid var(--md-sys-color-outline);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  max-width: 360px;
  width: 100%;
}

.confirm-modal-title {
  margin: 0 0 0.75rem;
  font-size: 1.25rem;
}

.confirm-modal-message {
  margin: 0 0 1.5rem;
  color: var(--md-sys-color-on-surface-container);
  font-size: 0.95rem;
}

.confirm-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

.confirm-modal-actions .inline-form {
  margin: 0;
  padding: 0;
}

/* Game data summary table */
.data-summary-table {
  max-width: 400px;
}

.data-summary-table th {
  text-align: left;
  font-weight: 500;
  padding-right: 1.5rem;
}

/* Danger zone – admin edit page */
.danger-zone {
  border: 2px solid var(--md-sys-color-error);
  border-radius: 12px;
  background: rgba(183, 28, 28, 0.06);
}

/* Profile, forgot password and the identity block in the nav menu */
.nav-profile-who {
  display: flex;
  flex-direction: column;
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
  margin-bottom: 0.25rem;
}

.nav-profile-who-nickname {
  font-weight: 600;
  color: var(--md-sys-color-on-surface);
}

.nav-profile-who-name {
  font-size: 0.85rem;
  color: var(--md-sys-color-on-surface-container);
  opacity: 0.8;
}

.login-alt {
  margin-top: 1rem;
  text-align: center;
  font-size: 0.9rem;
}

.login-alt a {
  color: var(--md-sys-color-secondary-container);
  text-decoration: none;
  font-weight: 500;
}

.login-alt a:hover {
  text-decoration: underline;
}

.stacked-form label {
  display: block;
  margin-top: 0.75rem;
  font-size: 0.9rem;
  font-weight: 500;
}

.stacked-form input {
  display: block;
  width: 100%;
  max-width: 24rem;
}

.stacked-form input:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.stacked-form button {
  margin-top: 1.25rem;
}

.save-notice {
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  border-radius: 8px;
  background: rgba(165, 214, 167, 0.12);
  border: 1px solid var(--md-sys-color-primary-container);
  color: var(--md-sys-color-primary-container);
  font-size: 0.9rem;
}

.dev-code-notice {
  padding: 0.75rem 1rem;
  margin: 1rem 0;
  border-radius: 8px;
  background: rgba(230, 81, 0, 0.12);
  border: 1px dashed var(--md-sys-color-secondary);
  font-size: 0.85rem;
}

.dev-code {
  margin: 0.25rem 0 0;
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 0.3em;
  font-variant-numeric: tabular-nums;
  color: var(--md-sys-color-secondary-container);
}

.code-input {
  font-size: 2rem;
  letter-spacing: 0.5em;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

/* App footer – the view name is a debugging aid, so it is desktop only.
   On mobile it sat flush to the viewport edge, outdenting the main panel. */
.app-footer {
  display: none;
  margin-top: 2rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--md-sys-color-outline-variant);
  font-size: 0.85rem;
  color: var(--md-sys-color-on-surface-container);
  opacity: 0.8;
}

.app-footer-view {
  font-style: italic;
}

@media (min-width: 768px) {
  .app-footer {
    display: block;
  }
}

/* Admin games toolbar – filter chips + sort toggle */
.games-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.filter-group {
  display: inline-flex;
  gap: 0.5rem;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.4rem 1rem;
  border: 1px solid var(--md-sys-color-outline);
  border-radius: 20px;
  color: var(--md-sys-color-on-surface-variant);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.filter-chip:hover {
  background: var(--md-sys-color-surface-variant);
}

.filter-chip-active {
  background: var(--md-sys-color-primary-container);
  border-color: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
}

.sort-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--md-sys-color-on-surface-variant);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
}

.sort-toggle:hover {
  text-decoration: underline;
}

.sort-toggle .material-symbols-outlined {
  font-size: 1.125rem;
}

/* Duplicate action sits inline with the table's Actions links */
table td .inline-form {
  display: inline;
}

table td .btn-text {
  color: var(--md-sys-color-primary-container);
  padding: 0;
  font-size: inherit;
}
