* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: #0f1117;
  color: #e8eaee;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
  touch-action: manipulation;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

html:has(body.player-page) {
  overflow: hidden;
  height: 100vh;
  height: 100dvh;
}
body.player-page {
  overflow: hidden;
  height: 100vh;
  height: 100dvh;
  min-height: 0;
}

h1, h2, h3 { margin: 0; font-weight: 600; }

button {
  font: inherit;
  border: none;
  border-radius: 12px;
  padding: 14px 22px;
  background: #2a2f3a;
  color: #e8eaee;
  cursor: pointer;
  transition: transform 0.05s ease, background 0.15s ease;
}
button:hover { background: #353b48; }
button:active { transform: scale(0.98); }
button:disabled { opacity: 0.5; cursor: not-allowed; }

button.primary { background: #4f7cff; }
button.primary:hover { background: #5e89ff; }
button.danger { background: #c2384a; }
button.danger:hover { background: #d94459; }

input[type="text"], input[type="number"] {
  font: inherit;
  background: #1a1d25;
  color: #e8eaee;
  border: 1px solid #2a2f3a;
  border-radius: 10px;
  padding: 12px 14px;
  width: 100%;
}
input:focus { outline: none; border-color: #4f7cff; }

.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px;
  width: 100%;
  flex: 1;
}

.card {
  background: #161922;
  border: 1px solid #232733;
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 16px;
}

.row { display: flex; gap: 12px; align-items: center; }
.row > * { flex: 1; }
.stack > * + * { margin-top: 12px; }

.muted { color: #8990a3; font-size: 14px; }

/* ---------- Landing ---------- */
.brand {
  text-align: center;
  padding: 32px 0 16px;
}
.brand h1 { font-size: 42px; letter-spacing: -1px; }
.brand p { color: #8990a3; margin-top: 6px; }

/* ---------- Host ---------- */
.code-banner {
  text-align: center;
  padding: 24px;
  font-size: 14px;
  color: #8990a3;
  letter-spacing: 1px;
  text-transform: uppercase;
}
.code-banner .code {
  font-size: 72px;
  letter-spacing: 12px;
  font-weight: 700;
  color: #fff;
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}

.status-banner {
  text-align: center;
  padding: 16px;
  border-radius: 12px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
}
.status-banner.closed { background: #232733; color: #8990a3; }
.status-banner.open { background: #1f7a3a; color: #fff; animation: pulse 1.2s ease-in-out infinite; }

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(31, 122, 58, 0.7); }
  50% { box-shadow: 0 0 0 16px rgba(31, 122, 58, 0); }
}

.queue, .player-list { list-style: none; padding: 0; margin: 0; }
.queue li, .player-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  background: #1a1d25;
  border-radius: 10px;
  margin-bottom: 8px;
}
.queue li .order {
  display: inline-block;
  background: #4f7cff;
  color: #fff;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  text-align: center;
  line-height: 28px;
  margin-right: 12px;
  font-weight: 700;
}
.queue li.first .order { background: #f5b342; color: #1a1d25; }

.player-list .name { font-weight: 500; }

.team-tag {
  display: inline-block;
  background: #2a2f3a;
  color: #c5c9d4;
  border-radius: 6px;
  padding: 2px 8px;
  margin-left: 8px;
  font-size: 12px;
  letter-spacing: 0.3px;
}
.kick {
  background: transparent;
  color: #c2384a;
  padding: 6px 10px;
  font-size: 13px;
}
.kick:hover { background: #2a1a1d; }

/* ---------- Player ---------- */
.player-screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: 20px;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}
.player-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  color: #8990a3;
  flex: 0 0 auto;
}
.player-info .room-code { font-family: ui-monospace, monospace; }

.buzzer {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 12px 0;
  min-height: 0;
}
.buzz-btn {
  width: min(80vw, 60vh, 360px);
  height: min(80vw, 60vh, 360px);
  border-radius: 50%;
  font-size: clamp(24px, 8vmin, 36px);
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  background: #2a2f3a;
  color: #8990a3;
  transition: background 0.15s ease, transform 0.05s ease, color 0.15s ease;
  user-select: none;
  -webkit-user-select: none;
  padding: 0;
}
.buzz-btn.open {
  background: #1fb04a;
  color: #fff;
  animation: openPulse 0.9s ease-in-out infinite;
}
.buzz-btn.cooldown { background: #b86a1f; color: #fff; }
.buzz-btn.buzzed { background: #4f7cff; color: #fff; }
.buzz-btn.team-locked { background: #5a4f8a; color: #fff; }
.buzz-btn.kicked { background: #c2384a; color: #fff; }
.buzz-btn:active.open { transform: scale(0.96); }

@keyframes openPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(31, 176, 74, 0.6); }
  50% { box-shadow: 0 0 0 30px rgba(31, 176, 74, 0); }
}

.buzz-status {
  text-align: center;
  font-size: 16px;
  color: #c5c9d4;
  min-height: 1.4em;
  flex: 0 0 auto;
}

@media (max-width: 480px) {
  .container { padding: 16px; }
  .code-banner .code { font-size: 56px; letter-spacing: 8px; }
}
