:root {
  color-scheme: dark;
  --bg: #000000;
  --surface: #121212;
  --text: #f0f0f0;
  --muted: #9a9a9a;
  --accent: #2a9d8f;
  --border: #2a2a2a;
  --danger: #ff6b6b;
}

* {
  box-sizing: border-box;
}

html {
  font-size: clamp(16px, 1vw + 12px, 22px);
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.page {
  max-width: 60rem;
  margin: 0 auto;
  padding: clamp(1rem, 4vw, 3rem);
}

h1 {
  font-size: clamp(1.75rem, 3vw + 1rem, 3.5rem);
  margin: 0 0 1rem;
}

h2 {
  font-size: clamp(1.25rem, 1.5vw + 0.75rem, 2rem);
  margin-top: 0;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: clamp(1rem, 3vw, 2rem);
  margin-bottom: 1.5rem;
}

form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 1rem;
  font-weight: 600;
}

input[type="text"],
input[type="number"] {
  font-size: 1.1rem;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 0.6rem;
  min-height: 3rem;
  background: var(--surface);
  color: var(--text);
}

.btn {
  font-size: 1.1rem;
  font-weight: 700;
  padding: 0.9rem 1.5rem;
  border-radius: 0.75rem;
  border: none;
  cursor: pointer;
  min-height: 3rem;
}

.btn-primary {
  background: var(--accent);
  color: white;
}

.btn-primary:active {
  transform: scale(0.98);
}

.error {
  color: var(--danger);
  font-weight: 600;
}

.team-colors {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.team-color-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  font-size: 1rem;
  font-weight: 600;
}

.swatches {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.swatch {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 50%;
  border: 2px solid var(--border);
  cursor: pointer;
  padding: 0;
}

.color-input {
  width: 3rem;
  height: 2.5rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  padding: 0;
  cursor: pointer;
}

/* Room page */

.room-header {
  text-align: center;
  margin-bottom: 1.5rem;
}

.teams-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  gap: clamp(0.75rem, 2vw, 1.5rem);
  margin-bottom: 2rem;
}

.team-tile {
  aspect-ratio: 1;
  border-radius: 1.25rem;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 0 0 3px rgba(0, 0, 0, 0.15);
  cursor: pointer;
  padding: 0;
}

.team-tile:active {
  transform: scale(0.98);
}

.team-tile-selected {
  box-shadow: inset 0 0 0 4px rgba(0, 0, 0, 0.15), 0 0 0 4px var(--accent);
}

.team-points {
  font-size: clamp(2.5rem, 8vw, 8rem);
  font-weight: 800;
  color: white;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
}

.score-panel form {
  flex-direction: row;
  align-items: stretch;
  flex-wrap: wrap;
}

.score-panel input[type="number"] {
  flex: 1 1 6rem;
  font-size: clamp(1.5rem, 4vw, 2.5rem);
  text-align: center;
  font-weight: 700;
}

.score-buttons {
  display: flex;
  gap: 0.75rem;
  flex: 1 1 100%;
}

.btn-score {
  flex: 1;
  font-size: clamp(1.75rem, 5vw, 3rem);
  font-weight: 800;
  min-height: 4rem;
  line-height: 1;
}

.btn-plus {
  background: var(--accent);
  color: white;
}

.btn-minus {
  background: var(--danger);
  color: white;
}

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

.participants li {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.4rem 0.9rem;
  font-size: 1rem;
}

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

.log-toggle {
  width: 100%;
  margin-bottom: 1.5rem;
}

.log-panel ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.log-entry {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: clamp(1.25rem, 3.5vw, 2.75rem);
}

.log-color-dot {
  width: 1em;
  height: 1em;
  border-radius: 50%;
  flex-shrink: 0;
}
