@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;600;700;900&family=Inter:wght@400;600;700;800&display=swap');

:root {
  --bg-dark: #0f0c29;
  --bg-gradient: radial-gradient(circle at 50% 20%, #240b36 0%, #0f0c29 100%);
  --bg-card: rgba(30, 24, 60, 0.85);
  --red: #e21b3c;
  --blue: #1368ce;
  --yellow: #ffa602;
  --green: #26890c;
  --purple-glow: #8a2be2;
  --text-light: #ffffff;
  --text-muted: #b0a8d9;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: 'Outfit', 'Inter', sans-serif;
  background: var(--bg-gradient);
  color: var(--text-light);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow-x: hidden;
}

.container {
  width: 100%;
  max-width: 1100px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

/* Glassmorphic Cards */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 28px;
  padding: 36px 30px;
  width: 100%;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  animation: slideUp 0.4s ease-out;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}

h1 {
  font-size: 2.6rem;
  font-weight: 900;
  margin-bottom: 12px;
  background: linear-gradient(135deg, #ff7eb3, #7afcff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

p.subtitle {
  font-size: 1.2rem;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.badge {
  display: inline-block;
  padding: 6px 16px;
  border-radius: 50px;
  font-size: 0.9rem;
  font-weight: 700;
  background: rgba(138, 43, 226, 0.3);
  border: 1px solid rgba(138, 43, 226, 0.5);
  color: #7afcff;
  margin-bottom: 16px;
}

/* Buttons */
.btn {
  background: linear-gradient(135deg, #8a2be2, #4a00e0);
  color: white;
  border: none;
  padding: 16px 36px;
  font-size: 1.25rem;
  font-weight: 700;
  border-radius: 50px;
  cursor: pointer;
  box-shadow: 0 10px 25px rgba(138, 43, 226, 0.4);
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 10px;
  font-family: inherit;
}

.btn:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 15px 35px rgba(138, 43, 226, 0.6);
}

.btn:active {
  transform: translateY(1px);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: none;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.2);
}

.input-field {
  width: 100%;
  max-width: 380px;
  padding: 18px 24px;
  font-size: 1.4rem;
  text-align: center;
  border-radius: 16px;
  border: 2px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  color: white;
  outline: none;
  margin-bottom: 16px;
  font-family: inherit;
  transition: all 0.3s;
}

.input-field:focus {
  border-color: #7afcff;
  background: rgba(255, 255, 255, 0.15);
  box-shadow: 0 0 20px rgba(122, 252, 255, 0.3);
}

/* PIN Display */
.pin-box {
  background: white;
  color: black;
  font-size: 3.8rem;
  font-weight: 900;
  padding: 16px 36px;
  border-radius: 20px;
  letter-spacing: 10px;
  display: inline-block;
  margin: 16px 0;
  box-shadow: 0 12px 35px rgba(255, 255, 255, 0.35);
  font-family: 'Outfit', sans-serif;
}

/* Player Grid in Lobby */
.player-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  margin: 20px 0;
  max-height: 280px;
  overflow-y: auto;
  padding: 10px;
}

.player-tag {
  background: rgba(255, 255, 255, 0.15);
  padding: 12px;
  border-radius: 14px;
  font-weight: 700;
  font-size: 1.1rem;
  animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

@keyframes popIn {
  0% { transform: scale(0); }
  100% { transform: scale(1); }
}

/* Question Header & Timer */
.question-header {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.timer-circle {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--purple-glow);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  font-weight: 900;
  font-family: 'Outfit', sans-serif;
  box-shadow: 0 0 25px rgba(138, 43, 226, 0.7);
  border: 4px solid white;
}

.question-title {
  font-size: 1.7rem;
  font-weight: 800;
  line-height: 1.4;
  margin: 16px 0 24px 0;
  background: rgba(0, 0, 0, 0.35);
  padding: 20px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Kahoot Options Grid (Host View) */
.options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  width: 100%;
  margin-top: 10px;
}

.option-btn {
  padding: 22px 20px;
  border-radius: 18px;
  font-size: 1.25rem;
  font-weight: 700;
  color: white;
  display: flex;
  align-items: center;
  gap: 15px;
  border: none;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
  text-align: left;
}

.opt-0 { background-color: var(--red); }
.opt-1 { background-color: var(--blue); }
.opt-2 { background-color: var(--yellow); }
.opt-3 { background-color: var(--green); }

.shape-icon {
  font-size: 2rem;
  width: 45px;
  height: 45px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 12px;
  flex-shrink: 0;
}

/* Mobile Player Controls */
.student-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 16px;
  width: 100%;
  height: 65vh;
  max-height: 500px;
}

.student-btn {
  border: none;
  border-radius: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 4.5rem;
  color: white;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  transition: transform 0.1s, filter 0.2s;
}

.student-btn:active {
  transform: scale(0.92);
  filter: brightness(1.25);
}

/* Leaderboard */
.leaderboard-list {
  width: 100%;
  margin: 20px 0;
}

.lb-item {
  background: rgba(255, 255, 255, 0.1);
  padding: 16px 24px;
  border-radius: 16px;
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 1.3rem;
  font-weight: 700;
  border-left: 8px solid var(--purple-glow);
}

.lb-item:nth-child(1) { border-left-color: #ffd700; background: rgba(255, 215, 0, 0.2); }
.lb-item:nth-child(2) { border-left-color: #c0c0c0; background: rgba(192, 192, 192, 0.2); }
.lb-item:nth-child(3) { border-left-color: #cd7f32; background: rgba(205, 127, 50, 0.2); }

/* Result Banner */
.result-banner {
  font-size: 3rem;
  font-weight: 900;
  margin-bottom: 16px;
}

.correct-bg { color: #4eff91; }
.wrong-bg { color: #ff5252; }

@media (max-width: 768px) {
  .options-grid { grid-template-columns: 1fr; }
  .question-title { font-size: 1.25rem; }
  h1 { font-size: 2rem; }
  .pin-box { font-size: 2.6rem; letter-spacing: 6px; padding: 12px 24px; }
}
