* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg: #1a1a2e;
  --surface: #16213e;
  --primary: #e94560;
  --primary-glow: rgba(233, 69, 96, 0.4);
  --gold: #ffd700;
  --silver: #c0c0c0;
  --bronze: #cd7f32;
  --text: #eee;
  --text-dim: #888;
  --success: #4ade80;
  --danger: #ef4444;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
  -webkit-text-size-adjust: 100%;
}

/* ---- Join Screen ---- */
.join-screen {
  text-align: center;
  padding: 2rem;
}

.join-screen h1 {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.join-screen p {
  color: var(--text-dim);
  margin-bottom: 2rem;
}

.join-screen input {
  display: block;
  width: 100%;
  max-width: 300px;
  margin: 0 auto 1rem;
  padding: 1rem;
  font-size: 1.2rem;
  border: 2px solid #333;
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  text-align: center;
  outline: none;
}

.join-screen input:focus {
  border-color: var(--primary);
}

.join-screen button {
  padding: 1rem 3rem;
  font-size: 1.2rem;
  font-weight: 700;
  border: none;
  border-radius: 12px;
  background: var(--primary);
  color: white;
  cursor: pointer;
  transition: transform 0.1s;
}

.join-screen button:active {
  transform: scale(0.95);
}

/* ---- Buzzer Screen ---- */
.buzzer-screen {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100dvh;
  width: 100%;
  padding: 2rem;
  text-align: center;
}

.buzzer-screen .player-name {
  font-size: 1.2rem;
  color: var(--text-dim);
  margin-bottom: 1rem;
}

.buzz-btn {
  width: 220px;
  height: 220px;
  border-radius: 50%;
  border: 6px solid var(--primary);
  background: radial-gradient(circle at 35% 35%, #ff6b81, var(--primary), #c0392b);
  box-shadow: 0 0 0 0 var(--primary-glow), 0 8px 32px rgba(0, 0, 0, 0.5);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: 900;
  color: white;
  text-transform: uppercase;
  letter-spacing: 2px;
  transition: transform 0.1s, box-shadow 0.2s;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
  position: relative;
}

.buzz-btn img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  position: absolute;
  top: 0;
  left: 0;
  image-orientation: from-image;
}

.buzz-btn:active {
  transform: scale(0.92);
}

.buzz-btn.pulsing {
  animation: pulse 1.5s infinite;
}

.buzz-btn.buzzed {
  background: radial-gradient(circle at 35% 35%, #666, #444, #333);
  border-color: #555;
  animation: none;
}

.buzz-btn.locked {
  opacity: 0.5;
  pointer-events: none;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 var(--primary-glow); }
  70% { box-shadow: 0 0 0 20px rgba(233, 69, 96, 0); }
  100% { box-shadow: 0 0 0 0 rgba(233, 69, 96, 0); }
}

.buzzer-status {
  margin-top: 2rem;
  font-size: 1.5rem;
  font-weight: 700;
  min-height: 2em;
}

.buzzer-status.first {
  color: var(--gold);
}

.buzzer-status.not-first {
  color: var(--text-dim);
}

.buzzer-status.waiting {
  color: var(--text-dim);
  font-weight: 400;
}

/* ---- Display Page ---- */
.display-page {
  height: 100dvh;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem;
}

.display-page h1 {
  font-size: 3rem;
  margin-bottom: 0.5rem;
}

.display-page .subtitle {
  color: var(--text-dim);
  font-size: 1.2rem;
  margin-bottom: 3rem;
}

.display-page .player-count {
  position: absolute;
  top: 2rem;
  right: 2rem;
  font-size: 1.1rem;
  color: var(--text-dim);
}

.buzz-list {
  list-style: none;
  width: 100%;
  max-width: 600px;
}

.buzz-list li {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.2rem 2rem;
  margin-bottom: 0.8rem;
  border-radius: 16px;
  background: var(--surface);
  font-size: 1.8rem;
  font-weight: 700;
  animation: slideIn 0.3s ease-out;
}

.buzz-list li .rank {
  font-size: 2rem;
  min-width: 50px;
  text-align: center;
}

.buzz-list li:nth-child(1) {
  background: linear-gradient(135deg, #2d2000, #1a1200);
  border: 2px solid var(--gold);
  font-size: 2.5rem;
}

.buzz-list li:nth-child(1) .rank { color: var(--gold); }
.buzz-list li:nth-child(2) .rank { color: var(--silver); }
.buzz-list li:nth-child(3) .rank { color: var(--bronze); }

.waiting-display {
  text-align: center;
}

.waiting-display .big-icon {
  font-size: 5rem;
  margin-bottom: 1rem;
  animation: pulse-slow 2s infinite;
}

.waiting-display p {
  font-size: 1.5rem;
  color: var(--text-dim);
}

@keyframes pulse-slow {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

@keyframes slideIn {
  from { transform: translateX(-30px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ---- Admin Page ---- */
.admin-page {
  padding: 2rem;
  width: 100%;
  max-width: 500px;
}

.admin-page h1 {
  font-size: 2rem;
  margin-bottom: 2rem;
  text-align: center;
}

.admin-actions {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.admin-btn {
  padding: 1.2rem 2rem;
  font-size: 1.3rem;
  font-weight: 700;
  border: none;
  border-radius: 16px;
  cursor: pointer;
  transition: transform 0.1s;
  color: white;
}

.admin-btn:active {
  transform: scale(0.95);
}

.admin-btn.reset {
  background: var(--primary);
}

.admin-btn.unlock {
  background: var(--success);
  color: #000;
}

.admin-btn.lock {
  background: var(--danger);
}

.admin-status {
  margin-top: 2rem;
  padding: 1.5rem;
  background: var(--surface);
  border-radius: 16px;
}

.admin-status h2 {
  font-size: 1.2rem;
  margin-bottom: 1rem;
  color: var(--text-dim);
}

.admin-status .status-item {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 0;
  border-bottom: 1px solid #ffffff10;
}

.admin-status .status-item:last-child {
  border-bottom: none;
}

.admin-buzz-list {
  margin-top: 1.5rem;
}

.admin-buzz-list h2 {
  font-size: 1.2rem;
  margin-bottom: 0.8rem;
  color: var(--text-dim);
}

.admin-buzz-list ol {
  padding-left: 1.5rem;
}

.admin-buzz-list li {
  padding: 0.4rem 0;
  font-size: 1.1rem;
}

.admin-players-list {
  margin-top: 1.5rem;
}

.admin-players-list h2 {
  font-size: 1.2rem;
  margin-bottom: 0.8rem;
  color: var(--text-dim);
}

.admin-players-list ul {
  list-style: none;
}

.admin-players-list li {
  padding: 0.3rem 0;
  color: var(--text-dim);
}

/* Locked indicator */
.lock-indicator {
  display: inline-block;
  padding: 0.3rem 0.8rem;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 700;
}

.lock-indicator.locked {
  background: var(--danger);
}

.lock-indicator.unlocked {
  background: var(--success);
  color: #000;
}

/* Mobile optimizations */
@media (max-width: 600px) {
  .display-page h1 { font-size: 2rem; }
  .buzz-list li { font-size: 1.3rem; padding: 1rem 1.5rem; }
  .buzz-list li:nth-child(1) { font-size: 1.8rem; }
}
