:root {
  --bg-dominant: #0a0a14;
  --bg-secondary: #14141e;
  --bg-tertiary: #1e1e2a;
  --text-primary: #e0e0e0;
  --text-secondary: #888888;
  --text-disabled: #555555;
  --accent: #4a8aff;
  --accent-hover: #5c9aff;
  --success: #3dcc5a;
  --destructive: #cc3d3d;
  --destructive-hover: #dd4f4f;
  --border: #2a2a3a;
  --border-focus: #4a8aff;
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --team-red: #e63333;
  --team-blue: #3350e6;
  --team-yellow: #e6cc1a;
  --team-purple: #cc33cc;
  --team-teal: #33b3b3;
  --team-orange: #e68a33;
  --team-green: #33b355;
  --team-pink: #e6609a;
}

/* Base styles */
* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg-dominant);
  color: var(--text-primary);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

/* Layout */
.container {
  max-width: 600px;
  margin: 0 auto;
  padding: 48px 16px;
}

@media (min-width: 640px) {
  .container {
    padding: 48px 32px;
  }
}

/* Typography */
.display {
  font-size: 32px;
  font-weight: 600;
  line-height: 1.2;
  margin-bottom: 32px;
}

.card h2 {
  font-size: 24px;
  font-weight: 600;
  line-height: 1.2;
  margin: 0 0 16px;
}

/* Card */
.card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 32px;
}

/* Text Input */
.input {
  display: block;
  width: 100%;
  height: 40px;
  padding: 8px 16px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 16px;
  outline: none;
}

.input::placeholder {
  color: var(--text-secondary);
}

.input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 2px rgba(74, 138, 255, 0.25);
}

/* Form group */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 4px;
  color: var(--text-primary);
}

/* Buttons */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  padding: 8px 24px;
  background: var(--accent);
  border: none;
  border-radius: var(--radius-md);
  color: #ffffff;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 150ms ease;
}

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

.btn-primary:active {
  background: #3a7aef;
}

.btn-primary:disabled {
  background: #2a3a5a;
  color: var(--text-disabled);
  cursor: not-allowed;
}

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

.btn-destructive {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  padding: 8px 24px;
  background: transparent;
  border: 1px solid var(--destructive);
  color: var(--destructive);
  border-radius: var(--radius-md);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 150ms ease;
}

.btn-destructive:hover {
  background: var(--destructive);
  color: #ffffff;
}

.btn-destructive:active {
  background: #aa2a2a;
}

.btn-ready {
  width: 100%;
  height: 48px;
  background: var(--accent);
  border: none;
  border-radius: var(--radius-md);
  color: #ffffff;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 200ms ease;
}

.btn-ready.is-ready {
  background: var(--success);
}

.btn-ready:disabled {
  background: #2a3a5a;
  color: var(--text-disabled);
  cursor: not-allowed;
}

/* Team button */
.btn-team {
  height: 36px;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 150ms ease;
  border-width: 2px;
  border-style: solid;
}

.btn-team.selected {
  border-opacity: 1;
}

/* Color swatch */
.color-swatch {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 150ms ease;
}

.color-swatch:hover {
  transform: scale(1.1);
}

.color-swatch.selected {
  border-color: #ffffff;
}

.color-swatch.taken {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Game list row */
.game-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 44px;
  padding: 8px 16px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: var(--text-primary);
  cursor: pointer;
}

.game-row:hover {
  background: var(--bg-tertiary);
}

.badge-success {
  color: var(--success);
  font-size: 14px;
}

.badge-muted {
  color: var(--text-secondary);
  font-size: 14px;
}

/* Player row */
.player-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

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

.color-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.player-name {
  flex: 1;
  font-size: 14px;
  font-weight: 600;
}

.team-badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
}

.ready-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.ready-dot.is-ready {
  background: var(--success);
}

.ready-dot.not-ready {
  border: 2px solid var(--text-secondary);
  background: transparent;
}

/* Countdown */
.countdown {
  font-size: 24px;
  font-weight: 600;
  color: var(--success);
  text-align: center;
  padding: 16px 0;
}

@keyframes pulse {
  0% { opacity: 0.7; }
  50% { opacity: 1.0; }
  100% { opacity: 0.7; }
}

.countdown.active {
  animation: pulse 1s ease-in-out infinite;
}

/* Error states */
.error-inline {
  color: var(--destructive);
  font-size: 14px;
  margin-top: 8px;
}

.error-page {
  text-align: center;
  padding: 48px 16px;
}

.error-page h2 {
  color: var(--text-primary);
  margin-bottom: 16px;
}

.error-page p {
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.error-page a {
  color: var(--accent);
  text-decoration: none;
}

.error-page a:hover {
  text-decoration: underline;
}

/* Banner */
.banner-warning {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: var(--destructive);
  color: #ffffff;
  text-align: center;
  padding: 8px;
  font-size: 14px;
  font-weight: 600;
  z-index: 1000;
}

/* Utility */
.text-secondary {
  color: var(--text-secondary);
}

.hidden {
  display: none;
}
