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

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.panel-header h2 {
  font-size: 1.05rem;
  margin: 0;
}

.hint {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin: 0.6rem 0 0;
}

/* Players */

.player-list {
  list-style: none;
  margin: 0 0 0.9rem;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.player-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--accent-soft);
  color: var(--text);
  border-radius: 999px;
  padding: 0.35rem 0.4rem 0.35rem 0.8rem;
  font-size: 0.92rem;
  font-weight: 600;
}

.player-chip button {
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0.2rem 0.35rem;
  border-radius: 999px;
}

.player-chip button:hover,
.player-chip button:focus-visible {
  color: var(--danger);
  background: var(--danger-soft);
}

.add-player-form {
  display: flex;
  gap: 0.5rem;
}

.add-player-form input {
  flex: 1;
  min-width: 0;
}

input[type="text"],
input[type="number"] {
  font-family: inherit;
  font-size: 1rem;
  padding: 0.55rem 0.7rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
}

input[type="text"]:focus-visible,
input[type="number"]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* Round entry */

.round-entry-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 0.75rem 1rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--border);
}

.round-entry-row:last-child {
  border-bottom: none;
}

.round-entry-name {
  font-weight: 600;
  min-width: 0;
  overflow-wrap: anywhere;
}

.stepper-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  align-items: flex-start;
}

.stepper-field-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stepper {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.stepper button {
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-raised);
  color: var(--text);
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
  line-height: 1;
}

.stepper button:hover,
.stepper button:focus-visible {
  border-color: var(--accent);
}

.stepper button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.stepper input {
  width: 3.4rem;
  text-align: center;
  padding: 0.5rem 0.3rem;
}

.round-entry-preview {
  grid-column: 1 / -1;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.round-entry-preview strong {
  color: var(--text);
}

.round-panel-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}

.round-panel-actions .spacer {
  flex: 1;
}

/* Leaderboard */

.target-score-field {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.target-score-field input {
  width: 5.5rem;
}

.winner-banner {
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 10px;
  padding: 0.7rem 0.9rem;
  font-weight: 700;
  margin: 0 0 1rem;
}

.leaderboard {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.leaderboard-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 0.85rem;
  border-radius: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
}

.leaderboard-row.is-leader {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.leaderboard-rank {
  font-weight: 700;
  color: var(--text-muted);
  width: 1.6rem;
  text-align: center;
}

.leaderboard-row.is-leader .leaderboard-rank {
  color: var(--accent);
}

.leaderboard-name {
  flex: 1;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.leaderboard-total {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-size: 1.1rem;
}

/* Round history table */

.table-scroll {
  overflow-x: auto;
}

.rounds-table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.9rem;
}

.rounds-table th,
.rounds-table td {
  padding: 0.55rem 0.75rem;
  text-align: center;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}

.rounds-table th:first-child,
.rounds-table td:first-child {
  text-align: left;
}

.rounds-table thead th {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.rounds-table tbody tr:hover {
  background: var(--accent-soft);
  cursor: pointer;
}

.rounds-table td.total-cell {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.rounds-table td.score-negative {
  color: var(--danger);
}

/* Edit modal */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20, 20, 15, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 50;
}

.modal-backdrop[hidden] {
  display: none;
}

.modal {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
}

@media (max-width: 520px) {
  .round-entry-row {
    grid-template-columns: 1fr;
  }
}
