a.manager-pill, .events-dashboard a.manager-pill {
  display: inline-block;
  color: #fff;
  background: #1565c0;
  text-decoration: none;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: .2px;
  padding: 6px 16px;
  border-radius: 20px;
  box-shadow: 0 2px 6px rgba(21,101,192,.30);
  transition: background .2s, box-shadow .2s;
  white-space: nowrap;
}
a.manager-pill:hover { background: #0d47a1; box-shadow: 0 3px 8px rgba(21,101,192,.45); }
a.manager-pill.event-manager { background: #2e7d32; box-shadow: 0 2px 6px rgba(46,125,50,.30); }
a.manager-pill.event-manager:hover { background: #1b5e20; box-shadow: 0 3px 8px rgba(46,125,50,.45); }
a.manager-pill:focus-visible { outline: 3px solid #24364a; outline-offset: 3px; }
a.manager-pill[hidden] { display: none !important; }
a.manager-pill[data-icon] { display: inline-flex; align-items: center; gap: 7px; }
a.manager-pill > svg { width: 17px; height: 17px; flex: none; }
.qr-glyph { display: inline-block; width: 17px; height: 17px; flex: none; background: currentColor; -webkit-mask: url(/assets/qr-code-svgrepo-com.svg) center / contain no-repeat; mask: url(/assets/qr-code-svgrepo-com.svg) center / contain no-repeat; }

/* Ensure empty court boxes are tall enough for QR code */
.court-empty {
  min-height: 240px;
}
/* Ensure all court boxes are tall enough for QR code */
.court {
  min-height: 240px;
}
.court-box-qr img {
  max-width: 100%;
  max-height: 120px;
  height: auto;
}
.facility-header-row img {
  margin-bottom: 16px;
  margin-left: 24px;
}
/* Queue header row styling (matches facility-header-row) */
.queue-header-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  max-width: 100%;
  margin-left: auto;
  padding-right: 32px;
}
.queue-header-row img {
  margin-bottom: 16px;
  margin-left: 24px;
}
/* Ensure PinModal is always on top */
#pin-modal {
  z-index: 10001 !important;
}
#pin-modal-content {
  z-index: 10002 !important;
}
/* Modal styles for PIN entry */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0,0,0,0.35);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.modal.show {
  display: flex !important;
}
.modal-content {
  background: #fff;
  padding: 24px 20px 18px 20px;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
  min-width: 220px;
  max-width: 340px;
  text-align: center;
}
.modal-title {
  font-size: 1.2em;
  font-weight: bold;
  margin-bottom: 8px;
}
.modal-btn {
  background: var(--primary);
  color: white;
  border: none;
  padding: 8px 18px;
  border-radius: 8px;
  font-size: 1em;
  font-weight: bold;
  cursor: pointer;
  margin-top: 8px;
}
.modal-btn:hover {
  background: #0177b6;
}
    /* Make add-courts-input about 30 characters wide */
    #add-courts-input {
      width: 20ch;
    }
.facility-qr-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 24px;
  margin-bottom: 12px;
  justify-content: flex-start;
}

/* Separator for facility-qr-row cells */
.facility-qr-separator {
  width: 1px;
  background: #d0d0d0;
  align-self: stretch;
  margin: 0 8px;
}

@media (max-width: 600px) {
  .facility-qr-separator {
    width: 100%;
    height: 1px;
    min-height: 1px;
    margin: 12px 0;
    background: #d0d0d0;
    align-self: auto;
  }
}

.heading-right {
  flex: 1;
  display: flex;
  justify-content: flex-end;
  align-items: center;
}

@media (max-width: 600px) {
  .facility-qr-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .facility-header-row {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    margin-top: 24px;
    margin-bottom: 12px;
    width: 100%;
    max-width: 1400px;
    box-sizing: border-box;
    position: relative;
    margin-left: auto;
    padding-right: 32px;
  }
  .heading-left {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    width: auto;
  }
  .qr-right {
    display: flex;
    align-items: center;
    margin-left: 16px;
    width: auto;
  }
  /* Removed stray margin-bottom property outside selector */
}
.queue-group-position {
  margin: 0;
  padding: 6px 12px;
  display: inline-block;
  font-size: 1.08em;
}
.queue-group-lock {
  margin-right: 0;
  margin-left: 0;
  display: flex;
  align-items: center;
}
.queue-group-meta-row {
  margin-top: 4px;
  color: #444;
  display: flex;
  gap: 18px;
  align-items: center;
  font-size: 0.98em;
}
.btn-lock, .btn-unlock {
  border: none;
  background: transparent;
  padding: 4px 6px;
  font-size: 1.5em;
  outline: none;
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.2s, transform 0.1s;
}
.btn-lock:hover, .btn-unlock:hover {
  opacity: 1;
  transform: scale(1.15);
}
/* Delta bar edge lines */
.delta-edge {
  display: inline-block;
  width: 2px;
  height: 14px;
  background: #bbb;
  vertical-align: middle;
  margin: 0 2px;
}
/* Delta bar visual styles */
.delta-bar {
  display: inline-block;
  height: 12px;
  border-radius: 6px;
  vertical-align: middle;
}
.delta-above {
  background: #2e7d32;
}
.delta-below {
  background: #d32f2f;
}
.delta-neutral {
  background: #757575;
}
/* Delta visual indicator styles */
.queue-player-delta.delta-above {
  color: #2e7d32; /* green for above average */
  font-weight: bold;
}
.queue-player-delta.delta-below {
  color: #d32f2f; /* red for below average */
  font-weight: bold;
}
.queue-player-delta.delta-neutral {
  color: #757575; /* gray for neutral */
}
/* Balance Queue button style */
.btn-balance {
  background: var(--info);
  color: white;
  border: none;
  padding: 8px 18px;
  border-radius: 8px;
  font-size: 1em;
  font-weight: bold;
  cursor: pointer;
  margin-top: 8px;
}
.btn-balance:hover {
  background: #0177b6;
}
/* Prevent long player names from causing button overlap in queue rows */
.queue-player-name {
  font-weight: 700;
  color: #000;
  font-size: 1.2em;
  text-align: left !important;
  word-break: break-word;
  overflow-wrap: break-word;
}
/* Make queue groups stack left-to-right and wrap like courts */
.queue-groups {
  display: flex;
  flex-wrap: wrap;
  gap: 28px;
  margin-bottom: 32px;
  width: 100%;
  box-sizing: border-box;
}
.queue-group {
  background: #ffffff;
  border-radius: 12px;
  padding: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  border: 3px solid var(--primary);
  margin: 0;
  box-sizing: border-box;
  flex: 0 0 350px;
}
/* Highlight new queue players (joined from form, not end-game) */
.queue-player-new {
  background: linear-gradient(135deg, #fff9c4 0%, #ffeb3b 100%);
  animation: pulse-player-new 1.5s ease-in-out infinite;
}
.queue-player-new td {
  font-weight: 600;
}
@keyframes pulse-player-new {
  0%, 100% { 
    background: linear-gradient(135deg, #fff9c4 0%, #ffeb3b 100%);
  }
  50% { 
    background: linear-gradient(135deg, #fffde7 0%, #fdd835 100%);
  }
}
/* Match queue group table to court size and style */
.queue-group-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: #f9f9f9;
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
  margin-top: 8px;
  margin-bottom: 8px;
  overflow: hidden;
  table-layout: auto; /* Allow table to adjust dynamically */
  word-wrap: break-word; /* Prevent overflow issues */
}
.queue-group-table th, .queue-group-table td {
  padding: 6px 4px;
  text-align: center;
  border-bottom: 1px solid #e0e0e0;
  font-size: 0.9em;
  word-break: break-word;
  overflow-wrap: break-word;
}

/* Placeholder rows: make them visually compact */
.queue-group-table tr.placeholder-row td {
  min-height: 30px; /* compact placeholder height */
  height: 30px;
  padding-top: 6px;
  padding-bottom: 6px;
  vertical-align: middle;
  background: rgba(0,0,0,0); /* keep transparent unless styled */
}

/* Ensure table cells enforce a compact minimum height so placeholders match player rows */
.queue-group-table td {
  min-height: 44px;
  padding: 6px 8px;
  vertical-align: middle;
  box-sizing: border-box;
}

.queue-group-table tr.queue-team-boundary td {
  border-bottom: 2px solid var(--primary);
}

/* Placeholder text styling */
.queue-group-table tr.placeholder-row .placeholder-text {
  color: #777;
  font-style: italic;
  display: inline-block;
  line-height: 1em;
  font-size: 0.95em;
  opacity: 0.9;
}

.partner-badge { font-size: 1em; line-height: 1em; }

/* Normalize action buttons so their intrinsic metrics don't change row height */
.queue-player-actions button {
  height: 28px;
  line-height: 28px;
  padding: 2px 6px;
  font-size: 1em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.queue-group-table th {
  background: #e1f5fe;
  color: var(--primary);
  font-weight: 600;
  font-size: 1em;
}
.queue-group-table tr:last-child td {
  border-bottom: none;
}
.queue-player-actions button {
  margin: 0 4px;
}
:root {
      --primary: #4a7c59;
      --light: #f0f8f4;
      --dark: #1a3c34;
      --accent: #a8d5ba;
      --danger: #d32f2f;
      --warning: #f57c00;
      --trade: #FF9800;
      --info: #0288d1;
      --success: #2e7d32;
    }
    body {
      font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
      background: #f0f4f8;
      color: var(--dark);
      margin: 0;
      padding: 20px;
    }
    .container {
      width: 100%;
      margin: 0;
      padding: 12px;
    }
    h1 {
      text-align: center;
      color: var(--dark);
      margin-bottom: 10px;
    }
    .status-bar {
      text-align: center;
      margin: 15px 0;
      padding: 12px;
      background: #e8f5e9;
      border-radius: 8px;
      font-weight: 500;
      color: var(--dark);
      font-size: 1.1em;
    }

    .join-form {
      background: white;
      padding: 20px;
      border-radius: 12px;
      box-shadow: 0 4px 12px rgba(0,0,0,0.1);
      margin-bottom: 20px;
      display: flex;
      gap: 12px;
      flex-wrap: wrap;
      align-items: center;
      justify-content: center;
    }
    .join-form input, .join-form select, .join-form button {
      padding: 10px 14px;
      font-size: 1em;
      border: 1px solid #ccc;
      border-radius: 8px;
    }
    .join-form input { width: 180px; }
    .join-form select { width: 100px; }
    .join-form button {
      background: var(--primary);
      color: white;
      border: none;
      cursor: pointer;
      font-weight: bold;
    }
    .join-form button:hover { background: #3a5f47; }

    .add-courts {
      background: #e8f5e9;
      padding: 16px;
      border-radius: 12px;
      margin-bottom: 20px;
      text-align: center;
    }
    .add-courts input {
      width: 260px;
      padding: 10px;
      font-size: 1em;
      border: 1px solid #ccc;
      border-radius: 8px;
    }
    .add-courts button {
      background: var(--success);
      color: white;
      border: none;
      padding: 10px 16px;
      border-radius: 8px;
      font-weight: bold;
      cursor: pointer;
      margin-left: 8px;
    }
    .add-courts button:hover { background: #1b5e20; }
    .add-courts button:disabled, .add-courts button[disabled] {
      background: #cfe9d0; /* lighter green */
      color: #ffffff;
      cursor: not-allowed;
      opacity: 0.8;
    }

    .courts-container {
      display: flex;
      flex-wrap: wrap;
      gap: 28px;
      margin-bottom: 40px;
      align-items: flex-start;
    }
    .court {
      background: #ffffff;
      border-radius: 12px;
      padding: 16px;
      box-shadow: 0 4px 12px rgba(0,0,0,0.1);
      border: 3px solid var(--primary);
      position: relative;
      overflow: hidden;
    }
    .court-new {
      background: linear-gradient(135deg, #fff9c4 0%, #ffeb3b 100%);
      border: 4px solid #fbc02d;
      box-shadow: 0 6px 20px rgba(251, 192, 45, 0.6);
      animation: pulse-new 1.5s ease-in-out infinite;
    }
    .court-new .court-header {
      color: #f57f17;
      font-weight: 900;
      text-shadow: 0 1px 2px rgba(0,0,0,0.1);
    }
    @keyframes pulse-new {
      0%, 100% {
        box-shadow: 0 6px 20px rgba(251, 192, 45, 0.6);
      }
      50% {
        box-shadow: 0 8px 30px rgba(251, 192, 45, 0.9);
      }
    }
    .court-header {
      font-weight: bold;
      font-size: 1.2em;
      margin-bottom: 8px;
      color: var(--primary);
      text-align: center;
      display: flex;
      justify-content: space-between;
      align-items: center;
    }
    /* Court timer and avg wait styling - visually consistent */
    .timer {
      text-align: left;
      color: var(--primary); /* Use primary color for timer */
      font-weight: 600;
      font-size: 1em;
      margin-bottom: 6px;
      margin-top: 4px;
      background: #e1f5fe;
      padding: 4px 8px;
      border-radius: 6px;
      display: inline-block;
      margin-right: 60px; /* Add space to prevent collision with QR code */
    }
    .court-avg-wait {
      text-align: left;
      color: var(--primary); /* Match timer color */
      font-weight: 600;
      font-size: 1em;
      margin-bottom: 10px;
      margin-top: 4px;
      background: #e1f5fe;
      padding: 4px 8px;
      border-radius: 6px;
      display: inline-block;
      margin-right: 60px; /* Add space to prevent collision with QR code */
    }

    .court-actions {
      display: flex;
      gap: 6px;
      justify-content: center;
      margin-top: 10px;
    }
    .btn-end, .btn-close, .btn-open {
      background: var(--danger);
      color: white;
      border: none;
      padding: 6px 10px;
      border-radius: 6px;
      font-size: 0.8em;
      cursor: pointer;
    }
    .btn-end:hover { background: #b71c1c; }
    .btn-close { background: var(--warning); }
    .btn-close:hover { background: #e65100; }
    .btn-open { background: var(--success); }
    .btn-open:hover { background: #1b5e20; }

    .close-btn {
      background: var(--warning);
      color: white;
      border: none;
      padding: 6px 10px;
      border-radius: 6px;
      font-size: 0.8em;
      cursor: pointer;
    }
    .close-btn:hover { background: #e65100; }

    .players-grid {
      display: flex;
      flex-direction: column;
      gap: 0;
    }
    .player {
      background: #f9f9f9;
      padding: 12px;
      border-bottom: 1px solid #e0e0e0;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
    }
    .player:first-child {
      border-radius: 8px 8px 0 0;
    }
    .player:last-child {
      border-radius: 0 0 8px 8px;
      border-bottom: none;
    }
    .player-name {
      font-weight: 500;
      font-size: 0.95em;
      word-wrap: break-word;
      overflow-wrap: break-word;
      word-break: break-word;
    }

    /* Release button styling */
    .btn-release {
      background: #2e7d32; /* green */
      color: #fff;
      border: none;
      padding: 10px 18px;
      border-radius: 10px;
      font-weight: 700;
      box-shadow: 0 2px 0 rgba(0,0,0,0.12);
      cursor: pointer;
    }
    .btn-release:hover { background: #25692a; }
    .btn-release:disabled { opacity: 0.5; cursor: not-allowed; }

    /* Consistent buttons inside release card */
    .card.actions button,
    .partner-actions button,
    .modal-actions button,
    .actions button,
    #confirm-modal .modal-actions button {
      background: #2e7d32;
      color: #fff;
      border: none;
      padding: 8px 14px;
      border-radius: 8px;
      font-weight: 700;
      cursor: pointer;
      margin-right: 8px;
    }
    .partner-actions button { padding: 8px 12px; }
    .partner-actions-row { display:flex; justify-content:space-between; align-items:center; margin:8px 0 12px 0; }
    .partner-explainer { margin-left:12px; font-size:0.95em; }
    /* Ensure match-results action row keeps explainer inline with buttons */
    .results-actions-row { display:flex; align-items:center; gap:12px; flex-wrap:nowrap; margin:8px 0 12px 0; }
    /* Keep explainer text on a single line and vertically centered next to buttons */
    .partner-explainer { display: inline-flex; align-items: center; white-space: nowrap; }

/* Subtitle under the main title on the Release page */
#subtitle {
  text-align: center;
  font-size: 1.03rem;
  font-weight: 600;
  color: var(--dark);
  margin-top: 6px;
  margin-bottom: 4px;
}
    .actions button#cancelBtn,
    .modal-actions button[id$="-cancel"] {
      background: #e0e0e0;
      color: #111;
      box-shadow: none;
    }
    .partner-actions button[disabled], .actions button[disabled], .modal-actions button[disabled] { opacity: 0.6; cursor: not-allowed; }
    .player-rating {
      flex-shrink: 0;
    }

/* Responsive court card and 2x2 player grid */
.court-card {
  box-sizing: border-box;
  /* Fixed preferred card size for desktop to avoid shrinking/overlap */
  flex: 0 0 420px;
  width: 420px;
  min-width: 340px;
  max-width: 100%;
}

/* Mobile: allow cards to be full-width and stack */
@media (max-width: 700px) {
  .courts-container { gap: 16px; }
  .court-card {
    flex: 1 1 100%;
    width: 98vw;
    min-width: 300px; /* Match queue card min-width */
    max-width: 99vw;
    overflow-x: auto;
  }
  .players-grid-2x2, .players-grid {
    min-width: 200px;
    overflow-x: auto;
    display: block;
    white-space: nowrap;
  }
  .player-cell, .player {
    min-width: 160px;
    max-width: 100vw;
    overflow-x: auto;
    white-space: nowrap;
  }
  .player-name, .queue-player-name {
    min-width: 80px;
    width: 100%;
    max-width: none;
    white-space: normal;
    word-break: break-word;
    overflow-wrap: break-word;
    text-overflow: initial;
    display: block;
  }
}

.players-grid-2x2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  align-items: start;
  width: 100%;
  box-sizing: border-box;
}

.column-heading { font-weight:700; padding:4px 10px; }

.player-cell {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  border-radius: 6px;
  background: #fff;
  border: 1px solid #eee;
  min-width: 0; /* allow inner text to ellipsize */
}

.player-cell-inner {
  display:flex;
  align-items:center;
  gap:8px;
  min-width:0;
  flex:1 1 0;
}

.player-name {
  font-weight:600;
  flex:1 1 0;
  min-width:80px;
  max-width:180px;
  white-space: normal;
  word-break: break-word;
  overflow-wrap: break-word;
}

.player-rating { flex:0 0 auto; margin-left:8px; }

/* Court Release specific layout tweaks */
#results-form { display:flex; flex-direction:column; gap:12px; }
.games-container { display:flex; flex-direction:column; gap:10px; }
.games-container .game-row { display:flex; align-items:center; gap:12px; padding:10px; border-radius:8px; background:#fafafa; border:1px solid #f0f0f0; }
.games-container .game-row + .game-row { margin-top:6px; }
.game-row .team { flex:1 1 0; min-width:0; }
.game-row .team .team-players-inline { font-size:0.96em; color:#222; }
.game-row .score-col { display:flex; gap:8px; align-items:center; justify-content:center; width:180px; }
.game-row .score-col input[type=number] { width:68px; padding:8px 6px; border-radius:6px; border:1px solid #ddd; font-size:1.05em; text-align:center; }
.game-row.locked { opacity:0.6; }

/* Totals and final panel spacing */
.totals-area { margin-top:8px; padding:8px; background:#fff; border-radius:8px; border:1px solid #f2f2f2; }
#finalPanel { margin-top:8px; font-size:0.95em; }

/* Release-action selector styling */
#release-action-container { display:block; margin-top:8px; }
#release-action-container .muted { margin-bottom:6px; }
#release-action-container label { display:inline-flex; align-items:center; gap:8px; padding:8px 10px; border-radius:8px; background:#f6f6f6; margin-right:8px; cursor:pointer; border:1px solid #eee; }
#release-action-container input[type=radio] { width:auto; margin:0; }

/* Toggle button for Enter Results - match release-action label styling */
#results-toggle-btn {
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:8px 10px;
  border-radius:8px;
  background:#f6f6f6;
  margin-right:8px;
  cursor:pointer;
  border:1px solid #eee;
  color:var(--dark);
}

/* Assign controls (A/B) header and columns */
.assign-headers { display:flex; padding:6px 10px; gap:8px; align-items:center; }
.assign-headers-inner { display:flex; gap:12px; width:120px; justify-content:flex-start; }
.assign-headers .assign-col { width:32px; text-align:center; font-weight:700; }
.assign-headers .team-col { width:48px; font-weight:700; margin-right:6px; }
.assign-controls { display:flex; gap:12px; width:120px; justify-content:flex-start; margin-right:10px; }
.assign-controls label { display:inline-flex; align-items:center; justify-content:center; width:32px; height:28px; }
.player.compact { display:flex; align-items:center; gap:10px; padding:8px 10px; }
.player.compact .player-name { flex:1 1 auto; }

.court-release-team-summary {
  margin: 16px 0;
  padding: 16px;
  border: 1px solid #d7e1ef;
  border-radius: 8px;
  background: #fff;
}
.court-release-team-summary[hidden] { display: none; }
.court-release-team-summary > h2 { margin: 0 0 12px; }
.court-release-team-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.court-release-team-card {
  min-width: 0;
  padding: 12px;
  border: 1px solid #d7e1ef;
  border-radius: 6px;
  background: #f8fafc;
}
.court-release-team-card h3 { margin: 0 0 8px; }
.court-release-team-card ul { margin: 0; padding-left: 20px; }
.court-release-team-a h3 { color: #1976d2; }
.court-release-team-b h3 { color: #6a1b9a; }
@media (max-width: 520px) {
  .court-release-team-grid { grid-template-columns: 1fr; }
}
.player-team { width:48px; text-align:center; font-weight:600; }

/* Step indicators (1/2 -> checkmark when complete) */
.step-indicator { display:inline-block; width:28px; height:28px; line-height:28px; text-align:center; border-radius:50%; background:#e9eef0; color:#333; font-weight:700; margin-right:8px; }
.step-indicator.complete { background:#2e7d32; color:#fff; }
.step-indicator.complete::after { content: '✓'; }

/* Actions area: align Release to right and make buttons consistent */
.actions { display:flex; justify-content:flex-end; gap:8px; margin-top:14px; }
.actions button { min-width:92px; }

/* Modal tweaks for confirm fallback and PinModal */
#confirm-modal .modal-content, #pin-modal #pin-modal-content { max-width:420px; width:92%; box-sizing:border-box; }
#confirm-modal .modal-content input, #pin-modal-input { width:140px; }

@media (max-width:520px) {
  .game-row .score-col { width:140px; }
  .game-row .score-col input[type=number] { width:56px; }
  #release-action-container label { display:block; margin-bottom:8px; }
}

    /* DUPR Rating Colors */
    .rating-2-0 { background: #FFD700; color: #333; }
    .rating-2-5 { background: #CCAC00; color: white; }
    .rating-3-0 { background: #00CED1; color: #333; }
    .rating-3-5 { background: #008B8B; color: white; }
    .rating-4-0 { background: #32CD32; color: #333; }
    .rating-4-5 { background: #228B22; color: white; }
    .rating-5-0 { background: #FF4500; color: white; }
    .rating-5-5 { background: #CC3700; color: white; }

    .rating-badge {
      display: inline-block;
      font-weight: bold;
      padding: 4px 10px;
      border-radius: 12px;
      font-size: 0.85em;
      margin-left: 6px;
      box-shadow: 0 1px 0 rgba(0,0,0,0.05) inset;
      -webkit-font-smoothing: antialiased;
      background-clip: padding-box;
    }

/* Ensure rating badges inside tables keep rounded corners and spacing */
.queue-group-table td .rating-badge,
.trade-candidate-table td .rating-badge,
.player .rating-badge {
  display: inline-block;
  border-radius: 10px;
  padding: 4px 10px;
}

/* Style for trade modal candidate table (match queue group table) */
.trade-candidate-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: #f9f9f9;
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
  margin-top: 8px;
  margin-bottom: 8px;
  overflow: hidden;
}
.trade-candidate-table th, .trade-candidate-table td {
  padding: 10px 8px;
  text-align: center;
  border-bottom: 1px solid #e0e0e0;
}

    .queue-section {
      width: 100%;
      box-sizing: border-box;
    }
    .queue-header {
      font-size: 1.3em;
      font-weight: bold;
      color: var(--dark);
      margin-bottom: 16px;
      text-align: center;
    }
    .queue-groups {
      display: grid;
      /* ensure groups are at least as wide as courts */
      grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
      gap: 20px;
      margin-bottom: 40px;
      margin-top: 16px;
      width: 100%;
      box-sizing: border-box;
    }
    /* horizontal wrapper for tables inside queue groups */
    .table-scroll {
      width: 100%;
      -webkit-overflow-scrolling: touch;
    }

    /* Prevent wrapping for rating, delta, wait, and actions columns; give them fixed widths */
    .queue-group-table th:nth-child(2), .queue-group-table td.queue-player-rating,
    .queue-group-table th:nth-child(3), .queue-group-table td.queue-player-wait,
    .queue-group-table th:nth-child(4), .queue-group-table td.queue-player-actions {
      white-space: nowrap;
      word-break: normal;
      overflow-wrap: normal;
    }

    .queue-group-table th:nth-child(2), .queue-group-table td.queue-player-rating { width: 64px; }
    .queue-group-table th:nth-child(3), .queue-group-table td.queue-player-wait { width: 64px; }
    .queue-group-table th:nth-child(4), .queue-group-table td.queue-player-actions { width: 130px; }

    /* Ensure action buttons have fixed sizes and don't cause wrapping */
    .queue-player-actions { white-space: nowrap; }
    .queue-player-actions .btn-trade, .queue-player-actions .btn-leave {
      min-width: auto;
      padding: 2px;
      box-sizing: border-box;
      font-size: 1.5em;
      line-height: 1;
    }
    .queue-group {
      background: #ffffff;
      border-radius: 12px;
      padding: 12px; /* Reduce padding for smaller screens */
      box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
      border: 3px solid var(--primary);
      margin-bottom: 20px;
    }
    .group-title {
      font-weight: 600;
      color: var(--dark);
      margin-bottom: 10px;
      font-size: 1.1em;
    }
    .group-players {
      display: grid;
      grid-template-columns: repeat(2, 1fr);
      gap: 10px;
    }
    .queue-player {
      background: #ffffff;
      padding: 10px;
      border-radius: 8px;
      text-align: center;
      box-shadow: 0 2px 6px rgba(0,0,0,0.05);
      font-size: 0.9em;
    }
    .wait-time {
      font-size: 0.8em;
      color: #d32f2f;
      font-weight: 500;
      margin-top: 4px;
    }
    .stuck-warning {
      color: var(--warning);
      font-weight: bold;
      font-size: 0.75em;
    }
    .player-actions {
      margin-top: 6px;
      display: flex;
      gap: 4px;
      justify-content: center;
    }
    .btn-trade, .btn-leave {
      font-size: 1.5em;
      padding: 4px;
      border: none;
      background: transparent;
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      line-height: 1;
      min-height: auto;
      min-width: auto;
      opacity: 0.6;
      transition: opacity 0.2s, transform 0.1s;
    }
    .btn-trade:hover, .btn-leave:hover {
      opacity: 1;
      transform: scale(1.15);
    }

    /* Trade Modal */
    .trade-modal {
      position: fixed;
      top: 0; left: 0; right: 0; bottom: 0;
      background: rgba(0,0,0,0.7);
      display: flex;
      align-items: center;
      justify-content: center;
      z-index: 10000;
      visibility: hidden;
      opacity: 0;
      transition: all 0.3s;
      overflow: auto;
      pointer-events: none;
    }
    .trade-modal.show { 
      visibility: visible; 
      opacity: 1;
      pointer-events: auto;
    }
    .trade-modal.show:focus {
      outline: none;
    }
    .trade-content {
      background: white;
      padding: 24px;
      border-radius: 16px;
      width: 90%;
      max-width: 500px;
      max-height: 80vh;
      overflow-y: auto;
      box-shadow: 0 10px 30px rgba(0,0,0,0.3);
      pointer-events: auto;
      z-index: 10001;
      position: relative;
    }
    .trade-title {
      font-size: 1.3em;
      font-weight: bold;
      color: var(--primary);
      margin-bottom: 16px;
      text-align: center;
    }
    .trade-group {
      margin-bottom: 16px;
      padding-bottom: 12px;
      border-bottom: 1px solid #eee;
    }
    .trade-group-title {
      font-weight: bold;
      color: var(--info);
      margin-bottom: 8px;
      font-size: 0.95em;
    }
    .trade-candidate {
      background: #f0f8f4;
      padding: 10px;
      border-radius: 8px;
      cursor: pointer;
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 6px;
    }
    .trade-candidate:hover {
      background: #d0e8d4;
    }
    .trade-btn-close {
      background: var(--danger);
      color: white;
      border: none;
      padding: 10px 20px;
      border-radius: 8px;
      font-size: 1em;
      cursor: pointer;
      width: 100%;
      margin-top: 12px;
    }

    /* Trade modal column layout */
    .trade-candidate-list { display: block; margin-top: 8px; }
    .trade-player-info {
      background: linear-gradient(135deg, #f0f8f4 0%, #e3f2e8 100%);
      padding: 16px;
      border-radius: 12px;
      margin: 16px 0;
      border: 2px solid #4a7c59;
    }
    .trade-player-name {
      font-size: 1.2em;
      font-weight: bold;
      color: #2d5a3d;
      margin-bottom: 10px;
    }
    .trade-player-rating {
      display: flex;
      align-items: center;
      gap: 8px;
    }
    .trade-header, .trade-row {
      display: grid;
      grid-template-columns: 1fr 72px 110px 86px;
      gap: 12px;
      padding: 6px 8px;
      align-items: center;
    }
    .trade-header { font-weight: bold; border-bottom: 1px solid #ddd; }
    .trade-row { cursor: pointer; border-bottom: 1px solid #f3f3f3; }
    .trade-row:hover { background: #fafafa; }
    .trade-col { padding: 2px 4px; }
    .trade-col-name { text-align: left; }
    .trade-col-rating { text-align: right; }
    .trade-col-competitiveness { text-align: right; }
    .trade-col-group { text-align: center; }

    .modal {
      position: fixed;
      top: 0; left: 0; right: 0; bottom: 0;
      background: rgba(0,0,0,0.7);
      display: flex;
      align-items: center;
      justify-content: center;
      z-index: 1000;
      visibility: hidden;
      opacity: 0;
      transition: all 0.3s;
    }
    .modal.show { visibility: visible; opacity: 1; }
    .modal-content {
      background: white;
      padding: 24px;
      border-radius: 16px;
      width: 90%;
      max-width: 400px;
      text-align: center;
      box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    }
    .modal-title {
      font-size: 1.4em;
      font-weight: bold;
      color: var(--primary);
      margin-bottom: 16px;
    }
    .modal-players {
      display: grid;
      grid-template-columns: 1fr;
      gap: 10px;
      margin-bottom: 20px;
    }
    .modal-player {
      background: #f0f8f4;
      padding: 10px;
      border-radius: 10px;
      font-weight: 500;
    }
    .modal-btn {
      background: var(--primary);
      color: white;
      border: none;
      padding: 12px 24px;
      border-radius: 8px;
      font-size: 1em;
      font-weight: bold;
      cursor: pointer;
    }
    .modal-btn:hover { background: #3a5f47; }

    @media (max-width: 768px) {
      .join-form, .add-courts { flex-direction: column; }
      .join-form input, .join-form select, .add-courts input { width: 100%; }
      .group-players, .players-grid { grid-template-columns: 1fr; }
    }

/* Your existing block — keep it */
button, [onclick] {
  touch-action: manipulation !important;
  cursor: pointer !important;
  pointer-events: auto !important;
  -webkit-appearance: none;
  appearance: none;
  min-height: 44px;
  min-width: 44px;
}
    
#join-qr {
  margin-right: 40px;
}

/* THIS IS THE REAL FIX */
.court-actions,
.court-actions button,
.btn-end,
.btn-close {
  position: relative !important;
  z-index: 9999 !important;
  pointer-events: auto !important;
}

.court::before,
.court::after,
.court-actions::before,
.court-actions::after {
  content: none !important;
  display: none !important;
}

/* Style queue groups like courts */
/* Match .queue-group to .court exactly */
.queue-group {
  background: #ffffff;
  border-radius: 12px;
  padding: 12px; /* Reduce padding for smaller screens */
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  border: 3px solid var(--primary);
  margin-bottom: 40px;
  display: flex;
  flex-direction: column;
}
.queue-group .court-header {
  font-weight: bold;
  font-size: 1.2em;
  margin-bottom: 8px;
  color: var(--primary);
  text-align: center;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.queue-group .players-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
}
.queue-group .player {
  background: #f9f9f9;
  padding: 10px;
  border-radius: 8px;
  text-align: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}
.queue-group .player-name {
  font-weight: 500;
  font-size: 0.95em;
}
.queue-group .player-rating,
.queue-group .player-delta {
  font-size: 0.85em;
  color: #555;
}

/* DUPr Color Scheme for Player Ratings */
.rating-low {
  color: #ff0000; /* Red for low ratings */
}
.rating-mid {
  color: #ffa500; /* Orange for mid ratings */
}
.rating-high {
  color: #008000; /* Green for high ratings */
}
.rating-elite {
  color: #0000ff; /* Blue for elite ratings */
}

/* Ensure Trade and Leave buttons are subtle icon-only buttons */
.btn-trade, .btn-leave {
  height: auto;
  padding: 4px;
  font-size: 1.5em;
  border: none;
  background: transparent;
  display: inline-flex;
  align-items: center;
  opacity: 0.6;
  transition: opacity 0.2s, transform 0.1s;
}
.btn-trade:hover, .btn-leave:hover {
  opacity: 1;
  transform: scale(1.15);
}
/* Registration readiness badge shared by T-signup and My Events */
.readiness-badge { display: inline-flex; align-items: center; gap: 5px; border-radius: 20px; padding: 2px 10px; font-size: .78rem; font-weight: 700; white-space: nowrap; border: 1px solid transparent; }
.readiness-badge.readiness-complete { background: #e3f4e8; color: #17643a; border-color: #8fcfa6; }
.readiness-badge.readiness-action { background: #fff0d5; color: #805100; border-color: #e2b25c; }
.readiness-badge.readiness-waiting { background: #eaf2fb; color: #285f97; border-color: #8bb1da; }
.readiness-badge.readiness-pending, .readiness-badge.readiness-waitlisted { background: #f1f3f6; color: #44546a; border-color: #c7d0db; }
.payment-badge { display: inline-flex; align-items: center; gap: 5px; border-radius: 20px; padding: 2px 10px; font-size: .78rem; font-weight: 700; white-space: nowrap; border: 1px solid transparent; }
.payment-badge.payment-paid { background: #17643a; color: #fff; border-color: #17643a; }
.payment-badge.payment-free { background: #e3f4e8; color: #17643a; border-color: #8fcfa6; }
.payment-badge.payment-refund { background: #f3ebfb; color: #5b2d8a; border-color: #b99ad9; }
.payment-badge.payment-pending { background: #f1f3f6; color: #44546a; border-color: #c7d0db; }
.payment-badge.payment-unpaid { background: #fff0d5; color: #805100; border-color: #e2b25c; }
.payment-summary { margin: 12px 0; padding: 10px 14px; border: 1px solid #8fcfa6; border-left: 5px solid #17643a; border-radius: 8px; background: #f4fbf6; }
.payment-summary.payment-refund_pending, .payment-summary.payment-refunded, .payment-summary.payment-partially_refunded { border-color: #b99ad9; border-left-color: #5b2d8a; background: #faf6fd; }
.payment-summary.payment-payment_pending, .payment-summary.payment-simulated { border-color: #c7d0db; border-left-color: #44546a; background: #f7f8fa; }
.payment-summary-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.payment-summary-head h3 { margin: 0; font-size: 1rem; }
.payment-summary p { margin: 6px 0 0; }
.payment-policy summary { cursor: pointer; font-size: .85rem; margin-top: 6px; }
.refund-terms { margin: 6px 0 0; padding-left: 20px; font-size: .9rem; }
.refund-terms li { margin: 3px 0; }
.payment-history ul { list-style: none; padding: 0 16px; margin: 0 0 8px; background: #fff; border: 1px solid #dbe4ed; border-radius: 10px; }
.payment-history-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 12px 0; border-top: 1px solid #e3e7ec; }
.payment-history-row:first-child { border-top: 0; }
.payment-history-row > div { display: flex; flex-direction: column; gap: 2px; }
.payment-history-row .card-meta, .payment-history-row .section-hint { margin: 0; }

@media (max-width: 600px) {
  body.player-forms input:not([type=checkbox]):not([type=radio]),
  body.player-forms select,
  body.player-forms textarea { font-size: 16px; }
  .player-forms .form-footer a,
  .player-forms .otp-resend a,
  .player-forms .links a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 4px; }
}
