@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@400;500;600;700&family=Quicksand:wght@400;500;600;700&display=swap');

:root {
  --pink: #004D40;
  --light-pink: #00695C;
  --pale-pink: #00897B;
  --hot-pink: #4DB6AC;
  --cream: #E0F2F1;
  --white: #FFFFFF;
  --dark: #4A2040;
  --dark-muted: #6B4060;
  --shadow-soft: 0 2px 12px rgba(255, 105, 180, 0.15);
  --shadow-md: 0 4px 20px rgba(255, 105, 180, 0.2);
  --shadow-lg: 0 8px 30px rgba(255, 105, 180, 0.25);
  --radius: 16px;
  --radius-sm: 10px;
  --radius-lg: 24px;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Quicksand', sans-serif;
  background: linear-gradient(135deg, var(--cream) 0%, var(--pale-pink) 50%, var(--light-pink) 100%);
  color: var(--dark);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: var(--hot-pink);
  color: var(--white);
}

/* ============ LOADING ============ */
.loading-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  gap: 16px;
}

.loading-screen p {
  font-family: 'Fredoka', sans-serif;
  font-size: 1.2rem;
  color: var(--pink);
}

.loading-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--pale-pink);
  border-top-color: var(--hot-pink);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ============ ROLE SELECT ============ */
.role-select-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
  gap: 32px;
}

.role-header {
  text-align: center;
  animation: fadeInDown 0.6s ease both;
}

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

.app-title {
  font-family: 'Fredoka', sans-serif;
  font-size: 3rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--hot-pink), var(--pink), var(--light-pink));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: none;
}

.app-subtitle {
  font-size: 1.1rem;
  color: var(--dark-muted);
  margin-top: 4px;
}

.welcome-name {
  font-size: 1rem;
  color: var(--pink);
  margin-top: 12px;
  font-weight: 600;
}

.role-cards {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  justify-content: center;
}

.role-card {
  background: var(--white);
  border: 2px solid var(--pale-pink);
  border-radius: var(--radius-lg);
  padding: 40px 32px;
  width: 260px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: var(--shadow-soft);
  font-family: inherit;
  color: var(--dark);
}

.role-card:nth-child(1) { animation: fadeInUp 0.5s ease 0.1s both; }
.role-card:nth-child(2) { animation: fadeInUp 0.5s ease 0.25s both; }

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

.role-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-lg);
  border-color: var(--pink);
}

.role-icon {
  font-size: 3rem;
}

.role-label {
  font-family: 'Fredoka', sans-serif;
  font-size: 1.4rem;
  font-weight: 600;
}

.role-desc {
  font-size: 0.85rem;
  color: var(--dark-muted);
  text-align: center;
  line-height: 1.4;
}

/* ============ BUTTONS ============ */
.btn-primary {
  background: linear-gradient(135deg, var(--hot-pink), var(--pink));
  color: var(--white);
  border: none;
  border-radius: var(--radius-sm);
  padding: 12px 28px;
  font-family: 'Fredoka', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(255, 20, 147, 0.3);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255, 20, 147, 0.4);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-lg {
  padding: 16px 36px;
  font-size: 1.15rem;
}

.btn-secondary {
  background: var(--white);
  color: var(--hot-pink);
  border: 2px solid var(--light-pink);
  border-radius: var(--radius-sm);
  padding: 10px 24px;
  font-family: 'Fredoka', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-secondary:hover {
  border-color: var(--hot-pink);
  background: var(--cream);
}

.btn-accent {
  background: linear-gradient(135deg, var(--pink), var(--light-pink));
  color: var(--white);
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px 20px;
  font-family: 'Fredoka', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-accent:hover:not(:disabled) {
  transform: translateY(-1px);
}

.btn-accent:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-sm {
  padding: 8px 16px;
  font-size: 0.85rem;
}

.back-btn {
  align-self: flex-start;
  background: none;
  border: none;
  color: var(--dark-muted);
  font-family: 'Quicksand', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
}

.back-btn:hover {
  color: var(--hot-pink);
  background: rgba(255, 105, 180, 0.08);
}

.remove-btn {
  background: none;
  border: none;
  color: var(--light-pink);
  font-size: 1.1rem;
  cursor: pointer;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.remove-btn:hover {
  background: rgba(255, 20, 147, 0.1);
  color: var(--hot-pink);
}

/* ============ INPUTS ============ */
.input-field {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--pale-pink);
  border-radius: var(--radius-sm);
  font-family: 'Quicksand', sans-serif;
  font-size: 1rem;
  color: var(--dark);
  background: var(--white);
  transition: all 0.2s ease;
  outline: none;
}

.input-field:focus {
  border-color: var(--hot-pink);
  box-shadow: 0 0 0 3px rgba(255, 20, 147, 0.12);
}

.input-field::placeholder {
  color: var(--light-pink);
}

.code-input {
  text-align: center;
  font-family: 'Fredoka', sans-serif;
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 0.3em;
  padding: 16px;
}

.select-field {
  padding: 8px 12px;
  border: 2px solid var(--pale-pink);
  border-radius: var(--radius-sm);
  font-family: 'Quicksand', sans-serif;
  font-size: 0.95rem;
  color: var(--dark);
  background: var(--white);
  outline: none;
  cursor: pointer;
}

.select-field:focus {
  border-color: var(--hot-pink);
}

.error-msg {
  color: #e74c6f;
  font-size: 0.9rem;
  font-weight: 600;
}

.empty-msg {
  color: var(--dark-muted);
  text-align: center;
  padding: 20px;
  font-style: italic;
}

/* ============ HOST CREATE ============ */
.host-create-screen,
.player-join-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
  gap: 24px;
}

.create-room-card,
.join-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 48px 40px;
  text-align: center;
  box-shadow: var(--shadow-md);
  max-width: 400px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
  animation: fadeInUp 0.5s ease both;
}

.create-room-card h2,
.join-card h2 {
  font-family: 'Fredoka', sans-serif;
  font-size: 1.6rem;
  color: var(--dark);
}

.create-room-card p,
.join-card p {
  color: var(--dark-muted);
  font-size: 0.95rem;
}

.create-icon,
.join-icon {
  font-size: 3.5rem;
}

/* ============ HOST SETUP ============ */
.host-setup-screen {
  max-width: 700px;
  margin: 0 auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-height: 100vh;
}

.room-code-banner {
  background: linear-gradient(135deg, var(--hot-pink), var(--pink));
  border-radius: var(--radius-lg);
  padding: 28px;
  text-align: center;
  color: var(--white);
  box-shadow: var(--shadow-md);
  animation: fadeInDown 0.5s ease both;
}

.room-label {
  font-size: 0.85rem;
  opacity: 0.85;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.room-code-display {
  font-family: 'Fredoka', sans-serif;
  font-size: 3rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  margin: 8px 0;
}

.room-hint {
  font-size: 0.9rem;
  opacity: 0.9;
}

/* ============ QUESTION MANAGER ============ */
.question-manager {
  background: var(--white);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-soft);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.qm-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.qm-header h3 {
  font-family: 'Fredoka', sans-serif;
  font-size: 1.2rem;
}

.ai-generate-section {
  display: flex;
  gap: 8px;
}

.ai-generate-section .input-field {
  flex: 1;
}

.question-form {
  background: var(--cream);
  border-radius: var(--radius-sm);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: fadeInUp 0.3s ease both;
}

.options-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.option-input-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.option-input {
  flex: 1;
}

.correct-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid var(--pale-pink);
  background: var(--white);
  color: var(--light-pink);
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.correct-btn.is-correct {
  background: #4ade80;
  border-color: #22c55e;
  color: var(--white);
}

.correct-option .option-input {
  border-color: #4ade80;
}

.form-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.time-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--dark-muted);
}

.question-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.question-card {
  background: var(--cream);
  border-radius: var(--radius-sm);
  padding: 16px;
  border-left: 4px solid var(--pink);
  animation: fadeInUp 0.3s ease both;
}

.qc-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.qc-number {
  font-family: 'Fredoka', sans-serif;
  font-weight: 700;
  color: var(--hot-pink);
  font-size: 0.9rem;
}

.qc-text {
  font-weight: 600;
  margin-bottom: 10px;
  line-height: 1.4;
}

.qc-options {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.qc-opt {
  background: var(--white);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.8rem;
  border: 1px solid var(--pale-pink);
}

.qc-correct {
  background: #dcfce7;
  border-color: #86efac;
  color: #166534;
  font-weight: 600;
}

.qc-time {
  font-size: 0.8rem;
  color: var(--dark-muted);
  margin-top: 8px;
  display: inline-block;
}

.start-section {
  text-align: center;
  padding: 16px 0;
}

.btn-start {
  width: 100%;
  max-width: 400px;
}

/* ============ GAMEPLAY (HOST) ============ */
.gameplay-screen {
  max-width: 700px;
  margin: 0 auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  align-items: center;
}

.gp-topbar {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
}

.gp-progress-label {
  font-family: 'Fredoka', sans-serif;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--hot-pink);
  white-space: nowrap;
}

.gp-progress-bar {
  flex: 1;
  height: 8px;
  background: var(--pale-pink);
  border-radius: 4px;
  overflow: hidden;
}

.gp-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--hot-pink), var(--pink));
  border-radius: 4px;
  transition: width 0.4s ease;
}

.gp-room-code {
  font-family: 'Fredoka', sans-serif;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--white);
  background: var(--pink);
  padding: 4px 12px;
  border-radius: 20px;
}

.gp-timer-ring {
  position: relative;
  width: 100px;
  height: 100px;
}

.timer-svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.timer-track {
  fill: none;
  stroke: var(--pale-pink);
  stroke-width: 6;
}

.timer-fill {
  fill: none;
  stroke: var(--hot-pink);
  stroke-width: 6;
  stroke-linecap: round;
  transition: stroke-dasharray 1s linear;
}

.timer-urgent {
  stroke: #ef4444;
  animation: pulse 0.5s ease infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.timer-number {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: 'Fredoka', sans-serif;
  font-size: 2rem;
  font-weight: 700;
  color: var(--hot-pink);
}

.timer-urgent-text {
  color: #ef4444;
}

.gp-question-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 32px;
  width: 100%;
  box-shadow: var(--shadow-md);
  animation: fadeInUp 0.4s ease both;
}

.gp-question-text {
  font-family: 'Fredoka', sans-serif;
  font-size: 1.5rem;
  text-align: center;
  margin-bottom: 24px;
  line-height: 1.4;
  color: var(--dark);
}

.gp-options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.gp-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  background: var(--cream);
  border: 2px solid var(--pale-pink);
  transition: all 0.3s ease;
}

.gp-option-correct {
  background: #dcfce7;
  border-color: #22c55e;
}

.gp-option-wrong {
  opacity: 0.5;
}

.gp-option-letter {
  font-family: 'Fredoka', sans-serif;
  font-weight: 700;
  color: var(--hot-pink);
  font-size: 1.1rem;
}

.gp-option-text {
  flex: 1;
  font-weight: 600;
}

.gp-option-count {
  background: var(--white);
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--dark-muted);
}

.gp-actions {
  display: flex;
  gap: 12px;
}

.gp-answer-count {
  font-size: 0.9rem;
  color: var(--dark-muted);
  font-weight: 600;
}

/* ============ PLAYER LOBBY ============ */
.player-lobby-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
  gap: 20px;
}

.lobby-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 40px;
  text-align: center;
  box-shadow: var(--shadow-md);
  max-width: 400px;
  width: 100%;
  animation: fadeInUp 0.5s ease both;
}

.lobby-card h2 {
  font-family: 'Fredoka', sans-serif;
  font-size: 1.5rem;
  margin: 12px 0 8px;
}

.lobby-card p {
  color: var(--dark-muted);
  margin-bottom: 20px;
}

.lobby-icon {
  font-size: 3rem;
  animation: bounce 1.5s ease infinite;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.lobby-players {
  text-align: left;
  border-top: 1px solid var(--pale-pink);
  padding-top: 16px;
  margin-top: 12px;
}

.lobby-players h4 {
  font-family: 'Fredoka', sans-serif;
  font-size: 0.95rem;
  color: var(--dark-muted);
  margin-bottom: 10px;
}

.lobby-player {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  font-weight: 600;
}

.lobby-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4ade80;
  flex-shrink: 0;
}

/* ============ PLAYER GAME ============ */
.player-game-screen {
  max-width: 600px;
  margin: 0 auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-height: 100vh;
}

.pg-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--white);
  border-radius: var(--radius);
  padding: 12px 20px;
  box-shadow: var(--shadow-soft);
}

.pg-qnum {
  font-family: 'Fredoka', sans-serif;
  font-weight: 700;
  color: var(--dark-muted);
}

.pg-timer {
  font-family: 'Fredoka', sans-serif;
  font-weight: 700;
  font-size: 1.3rem;
  color: var(--hot-pink);
  transition: color 0.3s;
}

.pg-timer-urgent {
  color: #ef4444;
  animation: pulse 0.5s ease infinite;
}

.pg-score {
  font-family: 'Fredoka', sans-serif;
  font-weight: 700;
  color: var(--pink);
}

.pg-question {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-md);
  text-align: center;
  animation: fadeInUp 0.4s ease both;
}

.pg-question h2 {
  font-family: 'Fredoka', sans-serif;
  font-size: 1.4rem;
  line-height: 1.4;
}

.pg-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.pg-option {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 20px;
  border-radius: var(--radius);
  border: 2px solid transparent;
  font-family: 'Quicksand', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s ease;
  color: var(--white);
}

.pg-option:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.pg-option:disabled {
  cursor: default;
}

.opt-a { background: linear-gradient(135deg, #FF69B4, #FF85C8); }
.opt-b { background: linear-gradient(135deg, #FF1493, #FF4DA6); }
.opt-c { background: linear-gradient(135deg, #FFB6C1, #FFCDD5); color: var(--dark); }
.opt-d { background: linear-gradient(135deg, #E91E7B, #FF69B4); }

.pg-opt-letter {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Fredoka', sans-serif;
  font-weight: 700;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.pg-opt-text {
  flex: 1;
}

.pg-opt-correct {
  border: 3px solid #22c55e;
  box-shadow: 0 0 20px rgba(34, 197, 94, 0.4);
}

.pg-opt-wrong {
  border: 3px solid #ef4444;
  opacity: 0.7;
}

.pg-opt-reveal {
  border: 3px solid #22c55e;
  box-shadow: 0 0 20px rgba(34, 197, 94, 0.4);
}

.pg-feedback {
  text-align: center;
  padding: 16px 20px;
  border-radius: var(--radius);
  font-family: 'Fredoka', sans-serif;
  font-size: 1.1rem;
  font-weight: 600;
  animation: fadeInUp 0.3s ease both;
}

.pg-fb-correct {
  background: #dcfce7;
  color: #166534;
}

.pg-fb-wrong {
  background: #fef2f2;
  color: #991b1b;
}

.pg-already {
  text-align: center;
  padding: 24px;
  background: var(--white);
  border-radius: var(--radius);
  font-weight: 600;
  color: var(--dark-muted);
}

/* ============ LEADERBOARD ============ */
.leaderboard {
  width: 100%;
  background: var(--white);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-soft);
}

.lb-title {
  font-family: 'Fredoka', sans-serif;
  font-size: 1.1rem;
  text-align: center;
  margin-bottom: 12px;
  color: var(--dark);
}

.lb-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.lb-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
  animation: fadeInUp 0.3s ease both;
}

.lb-row:nth-child(1) { animation-delay: 0s; }
.lb-row:nth-child(2) { animation-delay: 0.05s; }
.lb-row:nth-child(3) { animation-delay: 0.1s; }
.lb-row:nth-child(4) { animation-delay: 0.15s; }
.lb-row:nth-child(5) { animation-delay: 0.2s; }

.lb-top {
  background: var(--cream);
}

.lb-first {
  background: linear-gradient(135deg, rgba(255, 20, 147, 0.08), rgba(255, 105, 180, 0.08));
  border: 1px solid var(--pale-pink);
}

.lb-highlight {
  background: linear-gradient(135deg, rgba(255, 20, 147, 0.12), rgba(255, 105, 180, 0.12));
  border: 2px solid var(--pink);
}

.lb-rank {
  font-family: 'Fredoka', sans-serif;
  font-weight: 700;
  font-size: 1rem;
  min-width: 36px;
  text-align: center;
}

.lb-name {
  flex: 1;
  font-weight: 600;
}

.lb-score {
  font-family: 'Fredoka', sans-serif;
  font-weight: 700;
  color: var(--hot-pink);
}

/* ============ FINISHED ============ */
.finished-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
  gap: 20px;
}

.finished-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 40px;
  text-align: center;
  box-shadow: var(--shadow-md);
  max-width: 500px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 20px;
  align-items: center;
  animation: fadeInUp 0.5s ease both;
}

.finished-card h2 {
  font-family: 'Fredoka', sans-serif;
  font-size: 2rem;
  background: linear-gradient(135deg, var(--hot-pink), var(--pink));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.final-leaderboard {
  width: 100%;
}

.your-rank {
  font-family: 'Fredoka', sans-serif;
  font-size: 1.2rem;
  color: var(--hot-pink);
  font-weight: 600;
}

/* ============ RESPONSIVE ============ */
@media (max-width: 640px) {
  .app-title {
    font-size: 2.2rem;
  }

  .role-cards {
    flex-direction: column;
    align-items: center;
  }

  .role-card {
    width: 100%;
    max-width: 300px;
    padding: 28px 24px;
  }

  .room-code-display {
    font-size: 2.2rem;
  }

  .gp-options-grid {
    grid-template-columns: 1fr;
  }

  .gp-question-card {
    padding: 20px;
  }

  .gp-question-text {
    font-size: 1.2rem;
  }

  .code-input {
    font-size: 1.5rem;
  }

  .pg-question h2 {
    font-size: 1.15rem;
  }

  .create-room-card,
  .join-card,
  .lobby-card,
  .finished-card {
    padding: 28px 20px;
  }

  .host-setup-screen {
    padding: 16px;
  }

  .question-manager {
    padding: 16px;
  }

  .ai-generate-section {
    flex-direction: column;
  }
}
```

<!-- WALKTHROUGH_SCRIPT:
[
  {"step": 1, "narration": "Welcome to Trivia Party! You can host a game or join one as a player.", "view": "role-select", "highlight_selector": ".role-cards", "wait_for": "user_interaction"},
  {"step": 2, "narration": "As a host, tap 'Host a Game' to create a new trivia room.", "view": "host", "highlight_selector": ".host-card", "wait_for": "user_interaction"},
  {"step": 3, "narration": "Your unique room code is shown at the top. Share it with your players!", "view": "host-setup", "highlight_selector": ".room-code-banner", "wait_for": "tap_to_continue"},
  {"step": 4, "narration": "Add questions manually or enter a topic and tap 'AI Generate' to auto-create trivia questions.", "view": "host-setup", "highlight_selector": ".ai-generate-section", "wait_for": "user_interaction"},
  {"step": 5, "narration": "For manual questions, fill in the question text, four options, and mark the correct answer with the checkmark.", "view": "host-setup", "highlight_selector": ".question-form", "wait_for": "user_interaction"},
  {"step": 6, "narration": "Once you have questions ready, hit 'Start Game' to begin!", "view": "host-setup", "highlight_selector": ".btn-start", "wait_for": "user_interaction"},
  {"step": 7, "narration": "During the game, the timer counts down. You can reveal the answer early or wait for time to expire.", "view": "gameplay", "highlight_selector": ".gp-timer-ring", "wait_for": "tap_to_continue"},
  {"step": 8, "narration": "Players see colorful answer buttons and earn points based on speed. The leaderboard updates in real-time!", "view": "player-game", "highlight_selector": ".pg-options", "wait_for": "tap_to_continue"},
  {"step": 9, "narration": "At the end, everyone sees the final leaderboard with the winner crowned!", "view": "finished", "highlight_selector": ".finished-card", "wait_for": "tap_to_continue"}
]
-->

/* ============ REACTIONS ============ */
.player-room-shell {
  position: relative;
  min-height: 100vh;
}

.player-reaction-dock {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 18px;
  display: flex;
  justify-content: center;
  padding: 0 16px;
  pointer-events: none;
  z-index: 20;
}

.reaction-bar {
  display: inline-flex;
  gap: 8px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 182, 193, 0.6);
  border-radius: 999px;
  box-shadow: var(--shadow-md);
  pointer-events: auto;
  max-width: 100%;
  overflow-x: auto;
}

.reaction-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  background: var(--cream);
  color: var(--dark);
  border-radius: 999px;
  padding: 8px 12px;
  font-family: 'Fredoka', sans-serif;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  white-space: nowrap;
}

.reaction-btn:hover:not(:disabled) {
  transform: translateY(-1px) scale(1.03);
  box-shadow: var(--shadow-soft);
  background: #fff;
}

.reaction-btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.reaction-emoji {
  font-size: 1.05rem;
}

.reaction-count {
  font-size: 0.9rem;
  color: var(--hot-pink);
}

.reaction-feed {
  position: sticky;
  top: 12px;
  z-index: 15;
  width: min(720px, calc(100% - 32px));
  margin: 12px auto 0;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 182, 193, 0.7);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  padding: 12px 14px;
}

.reaction-feed-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.reaction-feed-title {
  font-family: 'Fredoka', sans-serif;
  font-weight: 700;
  color: var(--dark);
}

.reaction-feed-total {
  font-size: 0.85rem;
  color: var(--dark-muted);
  font-weight: 600;
}

.reaction-feed-items {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.reaction-feed-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 6px 10px;
  background: linear-gradient(135deg, rgba(255, 105, 180, 0.1), rgba(255, 182, 193, 0.18));
  border: 1px solid rgba(255, 105, 180, 0.18);
}

.reaction-feed-emoji {
  font-size: 1rem;
}

.reaction-feed-count {
  font-family: 'Fredoka', sans-serif;
  font-weight: 700;
  color: var(--hot-pink);
}

.reaction-feed-empty {
  color: var(--dark-muted);
  font-size: 0.92rem;
  font-weight: 600;
}

@media (max-width: 640px) {
  .player-reaction-dock {
    bottom: 10px;
    padding: 0 10px;
  }

  .reaction-bar {
    width: 100%;
    justify-content: space-between;
  }

  .reaction-btn {
    padding: 8px 10px;
    font-size: 0.9rem;
  }

  .reaction-feed {
    width: calc(100% - 20px);
    margin-top: 10px;
  }
}

.presence-panel {
  width: 100%;
  background: var(--cream);
  border: 1px solid rgba(255, 182, 193, 0.75);
  border-radius: var(--radius);
  padding: 14px 16px;
  text-align: left;
  box-shadow: var(--shadow-soft);
}

.presence-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.presence-panel-header h4 {
  font-family: 'Fredoka', sans-serif;
  font-size: 0.98rem;
  color: var(--dark);
}

.presence-count {
  font-family: 'Fredoka', sans-serif;
  font-weight: 700;
  color: var(--hot-pink);
  background: rgba(255, 105, 180, 0.12);
  padding: 2px 10px;
  border-radius: 999px;
}

.presence-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.presence-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: var(--dark);
}

.presence-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 0 4px rgba(74, 222, 128, 0.15);
  flex-shrink: 0;
}

.presence-dot-away {
  background: #f59e0b;
  box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.14);
}

.presence-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.presence-empty {
  color: var(--dark-muted);
  font-size: 0.92rem;
  font-weight: 600;
}

.player-presence-wrap {
  width: 100%;
}

@media (max-width: 640px) {
  .presence-panel {
    padding: 12px 14px;
  }
}

.ai-controls {
  display: flex;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.ai-controls .select-field {
  min-width: 120px;
}

.ai-status-msg {
  color: var(--dark-muted);
  font-size: 0.92rem;
  font-weight: 600;
}

.ai-success-msg {
  color: #166534;
  font-size: 0.92rem;
  font-weight: 700;
}

@media (max-width: 640px) {
  .ai-controls {
    flex-direction: column;
  }
}

.player-report-wrap {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.player-report-card {
  width: 100%;
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-md);
  border: 1px solid rgba(255, 182, 193, 0.55);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.player-report-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  flex-wrap: wrap;
}

.player-report-title {
  font-family: 'Fredoka', sans-serif;
  font-size: 1.25rem;
  color: var(--dark);
}

.player-report-subtitle {
  color: var(--dark-muted);
  font-size: 0.92rem;
  margin-top: 4px;
}

.player-report-meta {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.player-report-placement,
.player-report-score {
  font-family: 'Fredoka', sans-serif;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--cream);
  color: var(--hot-pink);
}

.player-report-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.player-report-stat {
  background: rgba(255, 182, 193, 0.18);
  border: 1px solid rgba(255, 105, 180, 0.14);
  border-radius: var(--radius-sm);
  padding: 12px;
  text-align: center;
}

.player-report-stat-label {
  display: block;
  font-size: 0.8rem;
  color: var(--dark-muted);
  margin-bottom: 4px;
  font-weight: 700;
}

.player-report-stat-value {
  font-family: 'Fredoka', sans-serif;
  font-size: 1.1rem;
  color: var(--dark);
  font-weight: 700;
}

.player-report-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.player-report-answers {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 320px;
  overflow: auto;
  padding-right: 4px;
}

.player-report-answer {
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  background: var(--cream);
  border: 1px solid rgba(255, 182, 193, 0.65);
  display: grid;
  gap: 4px;
}

.player-report-answer.is-correct {
  border-color: #22c55e;
  background: #f0fdf4;
}

.player-report-answer.is-wrong {
  border-color: #ef4444;
  background: #fef2f2;
}

.player-report-answer-q {
  font-family: 'Fredoka', sans-serif;
  color: var(--hot-pink);
  font-weight: 700;
}

.player-report-answer-text {
  font-weight: 600;
  color: var(--dark);
}

.player-report-answer-meta {
  font-size: 0.9rem;
  color: var(--dark-muted);
  font-weight: 600;
}

.player-report-pdf {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  left: 0;
  top: 0;
  width: 800px;
  background: white;
}

.player-report-pdf-inner {
  padding: 24px;
  font-family: Arial, sans-serif;
  color: #222;
}

.player-report-pdf-inner h1 {
  font-size: 24px;
  margin-bottom: 8px;
}

.player-report-pdf-section {
  margin-top: 18px;
}

.player-report-pdf-section h2 {
  font-size: 18px;
  margin-bottom: 10px;
}

.player-report-pdf-row {
  padding: 10px 0;
  border-bottom: 1px solid #ddd;
  font-size: 14px;
}

@media (max-width: 640px) {
  .player-report-stats {
    grid-template-columns: 1fr;
  }

  .player-report-actions {
    flex-direction: column;
  }
}
