* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  font-family: -apple-system, "Segoe UI", Arial, sans-serif;
  user-select: none;
}

#app {
  height: 100vh;
  width: 100vw;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  color: #fff;
  background: linear-gradient(135deg, #6a11cb 0%, #2575fc 55%, #00c9a7 100%);
}

.screen {
  display: none;
  width: 100%;
  max-width: 760px;
  max-height: 100%;
  overflow-y: auto;
  text-align: center;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.screen.active { display: flex; }

.title { font-size: 2.8rem; margin: 0; font-weight: 900; text-shadow: 3px 3px 0 rgba(0,0,0,0.2); }
.subtitle { font-size: 1.15rem; opacity: 0.9; margin: 0 0 6px; font-weight: 600; }

.stack { display: flex; flex-direction: column; gap: 12px; width: 100%; max-width: 380px; margin-top: 6px; }

.big-btn {
  padding: 20px 24px;
  font-size: 1.3rem;
  font-weight: 800;
  border: none;
  border-radius: 20px;
  background: #ffd93d;
  color: #3a2a00;
  cursor: pointer;
  border-bottom: 6px solid #d9a900;
  transition: transform 0.05s ease;
}
.big-btn:active { transform: translateY(4px); border-bottom: 2px solid #d9a900; }
.big-btn:disabled { opacity: 0.5; cursor: default; border-bottom: 6px solid rgba(0,0,0,0.2); }
.big-btn.secondary { background: #4dd8ff; border-bottom: 6px solid #1a9fc7; color: #03303f; }

.text-btn {
  background: none;
  border: none;
  color: #fff;
  opacity: 0.85;
  font-size: 1rem;
  font-weight: 700;
  text-decoration: underline;
  cursor: pointer;
  padding: 8px;
}

.field { width: 100%; max-width: 560px; display: flex; flex-direction: column; gap: 8px; text-align: left; }
.field > span { font-weight: 800; font-size: 1.05rem; opacity: 0.95; }
.field input {
  padding: 16px;
  font-size: 1.2rem;
  border-radius: 14px;
  border: none;
  outline: none;
  font-weight: 700;
}

.choice-row { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.chip {
  padding: 12px 16px;
  border-radius: 30px;
  border: 2px solid rgba(255,255,255,0.45);
  background: rgba(255,255,255,0.1);
  color: #fff;
  font-size: 0.95rem;
  font-weight: 800;
  cursor: pointer;
}
.chip.selected { background: #ffd93d; color: #3a2a00; border-color: #ffd93d; }

.category-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.category-card {
  padding: 14px 6px;
  border-radius: 18px;
  border: 3px solid rgba(255,255,255,0.35);
  background: rgba(255,255,255,0.1);
  color: #fff;
  cursor: pointer;
  font-weight: 800;
  font-size: 0.9rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.category-card .cat-emoji { font-size: 1.8rem; }
.category-card.selected { background: var(--cat-color, #ffd93d); border-color: #fff; color: #1a1a1a; }

.error-text { color: #ffe0e0; font-weight: 800; min-height: 20px; }

.room-code {
  font-size: 3.2rem;
  font-weight: 900;
  letter-spacing: 12px;
  background: rgba(0,0,0,0.25);
  padding: 10px 30px;
  border-radius: 18px;
}
.hint { opacity: 0.85; margin: 0; font-weight: 600; }

.settings-summary {
  background: rgba(255,255,255,0.15);
  padding: 10px 20px;
  border-radius: 14px;
  font-weight: 800;
}

.opponent-status { font-weight: 800; opacity: 0.95; min-height: 24px; }

.countdown-number {
  font-size: 10rem;
  font-weight: 900;
  text-shadow: 4px 4px 0 rgba(0,0,0,0.25);
}

.game-hud {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  gap: 10px;
}
.hud-box {
  flex: 1;
  background: rgba(0,0,0,0.28);
  border-radius: 18px;
  padding: 10px;
}
.hud-label { font-size: 0.8rem; opacity: 0.85; font-weight: 800; text-transform: uppercase; }
.hud-score { font-size: 2rem; font-weight: 900; }
.timer-box { flex: 1.2; }
.hud-timer { font-size: 2.2rem; font-weight: 900; }

.problem-card {
  width: 100%;
  background: rgba(255,255,255,0.97);
  color: #222;
  border-radius: 26px;
  padding: 28px 20px;
  margin-top: 6px;
}
.instructions { font-weight: 800; opacity: 0.65; margin-bottom: 12px; font-size: 1rem; }
.category-badge {
  background: #ffd93d;
  color: #3a2a00;
  font-weight: 800;
  font-size: 0.9rem;
  padding: 6px 16px;
  border-radius: 20px;
  margin-bottom: 12px;
}
.problem { font-size: 1.7rem; font-weight: 800; margin-bottom: 20px; line-height: 1.3; min-height: 66px; display: flex; align-items: center; justify-content: center; }

.answers {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.answer-btn {
  padding: 22px 10px;
  font-size: 1.15rem;
  font-weight: 800;
  border: none;
  border-radius: 18px;
  background: #eef1f5;
  color: #222;
  cursor: pointer;
  border-bottom: 6px solid #c3c9d1;
  min-height: 76px;
}
.answer-btn:active { transform: translateY(4px); border-bottom: 2px solid #c3c9d1; }
.answer-btn:disabled { cursor: default; }
.answer-btn.locked { opacity: 0.45; }
.answer-btn.correct { background: #4caf50; color: #fff; border-bottom: 6px solid #2e7d32; opacity: 1; }
.answer-btn.wrong { background: #e53935; color: #fff; border-bottom: 6px solid #a52622; opacity: 1; }

.feedback { min-height: 30px; font-size: 1.2rem; font-weight: 800; margin-top: 16px; color: #333; }

.end-banner { font-size: 2.4rem; margin: 0; font-weight: 900; }
.end-scores { display: flex; align-items: center; gap: 20px; margin: 10px 0; }
.end-score-card {
  background: rgba(0,0,0,0.28);
  border-radius: 20px;
  padding: 20px 26px;
}
.end-name { font-weight: 800; opacity: 0.9; margin-bottom: 6px; }
.end-score { font-size: 3rem; font-weight: 900; }
.end-vs { font-size: 1.5rem; font-weight: 900; opacity: 0.7; }

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: rgba(0,0,0,0.85);
  color: #fff;
  padding: 12px 24px;
  border-radius: 30px;
  font-weight: 800;
  opacity: 0;
  transition: all 0.3s ease;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 480px) {
  .title { font-size: 2rem; }
  .problem { font-size: 1.3rem; }
  .answer-btn { font-size: 1rem; padding: 18px 8px; }
  .room-code { font-size: 2.4rem; letter-spacing: 8px; }
  .category-grid { grid-template-columns: repeat(2, 1fr); }
}
