/* ── Base ──────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:       #1a1a2e;
  --bg2:      #16213e;
  --bg3:      #0f3460;
  --primary:  #e94560;
  --text:     #ffffff;
  --muted:    rgba(255,255,255,.55);
  --card:     rgba(255,255,255,.07);
  --opt-a:    #e21b3c;
  --opt-b:    #1368ce;
  --opt-c:    #26890c;
  --opt-d:    #d89e00;
  --radius:   14px;
  --shadow:   0 8px 32px rgba(0,0,0,.4);
}

body {
  font-family: 'Nunito', 'Segoe UI', sans-serif;
  background: linear-gradient(135deg, var(--bg), var(--bg2), var(--bg3));
  color: var(--text);
  min-height: 100vh;
}

/* ── Typography ────────────────────────────────────────────────────────────── */
h1 { font-size: clamp(1.6rem, 4vw, 2.8rem); font-weight: 900; }
h2 { font-size: clamp(1.2rem, 3vw, 2rem);   font-weight: 800; }
h3 { font-size: clamp(1rem, 2.5vw, 1.5rem); font-weight: 700; }

/* ── Utility ───────────────────────────────────────────────────────────────── */
.hidden { display: none !important; }
.text-muted { color: var(--muted); }
.text-center { text-align: center; }
.mt-1 { margin-top:  8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }

/* ── Buttons ───────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 28px;
  border: none;
  border-radius: 50px;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  transition: transform .15s, opacity .15s, box-shadow .15s;
  text-decoration: none;
}
.btn:hover  { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,.35); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .4; cursor: not-allowed; transform: none; }

.btn-primary  { background: var(--primary); color: #fff; }
.btn-success  { background: var(--opt-c);   color: #fff; }
.btn-blue     { background: var(--opt-b);   color: #fff; }
.btn-warn     { background: var(--opt-d);   color: #111; }
.btn-danger   { background: #c0392b;        color: #fff; }
.btn-ghost    { background: var(--card); border: 1px solid rgba(255,255,255,.2); color: var(--text); }
.btn-block    { width: 100%; }
.btn-lg       { padding: 18px 36px; font-size: 1.15rem; }
.btn-sm       { padding: 8px 18px;  font-size: .875rem; }

/* ── Card ──────────────────────────────────────────────────────────────────── */
.card {
  background: var(--card);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: var(--radius);
  padding: 24px;
}

/* ── Form ──────────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label { display: block; margin-bottom: 6px; font-weight: 700; font-size: .9rem; color: var(--muted); }
.form-control {
  width: 100%;
  padding: 14px 18px;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 10px;
  color: var(--text);
  font-family: inherit;
  font-size: 1rem;
  transition: border-color .2s, background .2s;
}
.form-control:focus {
  outline: none;
  border-color: var(--primary);
  background: rgba(255,255,255,.15);
}
.form-control::placeholder { color: rgba(255,255,255,.35); }

/* Select nativo – fundo escuro para o dropdown */
select.form-control {
  background-color: #1e2a45;
  appearance: auto;
  cursor: pointer;
}
select.form-control option {
  background-color: #1e2a45;
  color: #fff;
}

/* ── Alert ─────────────────────────────────────────────────────────────────── */
.alert {
  padding: 12px 18px;
  border-radius: 10px;
  font-weight: 700;
  font-size: .9rem;
  margin-top: 12px;
}
.alert-error   { background: rgba(226,27,60,.25); border: 1px solid var(--opt-a); color: #ff8fa0; }
.alert-success { background: rgba(38,137,12,.25); border: 1px solid var(--opt-c); color: #7ddb5a; }

/* ── Spinner ───────────────────────────────────────────────────────────────── */
.spinner {
  width: 40px; height: 40px;
  border: 4px solid rgba(255,255,255,.2);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .8s linear infinite;
  margin: 0 auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Pulse badge ───────────────────────────────────────────────────────────── */
.pulse {
  animation: pulse 1.8s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: .5; }
}

/* ── Option Cards (shared between display + play) ──────────────────────────── */
.options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.option-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px 24px;
  border-radius: var(--radius);
  font-weight: 800;
  font-size: clamp(.9rem, 2vw, 1.15rem);
  cursor: pointer;
  border: none;
  color: #fff;
  text-align: left;
  width: 100%;
  transition: transform .15s, opacity .2s, filter .2s;
  box-shadow: var(--shadow);
}
.option-card:hover { transform: scale(1.02); }

.option-card .opt-letter {
  min-width: 38px; height: 38px;
  border-radius: 50%;
  background: rgba(0,0,0,.25);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; font-weight: 900;
}
.option-card.opt-a { background: var(--opt-a); }
.option-card.opt-b { background: var(--opt-b); }
.option-card.opt-c { background: var(--opt-c); }
.option-card.opt-d { background: var(--opt-d); color: #111; }
.option-card.opt-d .opt-letter { color: #111; }

/* Reveal states */
.option-card.correct  { box-shadow: 0 0 0 4px #fff, 0 0 24px 4px var(--opt-c); transform: scale(1.04); }
.option-card.wrong    { opacity: .35; filter: grayscale(80%); transform: scale(.97); }
.option-card.selected { box-shadow: 0 0 0 4px #fff; }

/* ── Timer Bar ─────────────────────────────────────────────────────────────── */
.timer-wrap {
  height: 12px;
  background: rgba(255,255,255,.1);
  border-radius: 6px;
  overflow: hidden;
}
.timer-bar {
  height: 100%;
  border-radius: 6px;
  background: var(--opt-c);
  transition: width .1s linear, background .3s;
}
.timer-bar.warn   { background: var(--opt-d); }
.timer-bar.danger { background: var(--opt-a); }

/* ── Leaderboard ───────────────────────────────────────────────────────────── */
.leaderboard { list-style: none; }
.leaderboard li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-radius: 10px;
  margin-bottom: 8px;
  background: rgba(255,255,255,.06);
  font-weight: 700;
}
.leaderboard li:nth-child(1) { background: rgba(255,215,0,.2); }
.leaderboard li:nth-child(2) { background: rgba(192,192,192,.15); }
.leaderboard li:nth-child(3) { background: rgba(205,127,50,.15); }
.lb-rank   { min-width: 32px; font-size: 1.2rem; text-align: center; }
.lb-name   { flex: 1; }
.lb-score  { font-size: 1.1rem; color: #ffd700; }

/* ── Room Code ─────────────────────────────────────────────────────────────── */
.room-code {
  font-size: clamp(3rem, 10vw, 7rem);
  font-weight: 900;
  letter-spacing: .2em;
  color: var(--primary);
  text-shadow: 0 0 40px rgba(233,69,96,.5);
  line-height: 1;
}

/* ── Display Screen specific ───────────────────────────────────────────────── */
#display-root {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.display-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 32px;
  background: rgba(0,0,0,.3);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.display-header .logo { font-size: 1.4rem; font-weight: 900; color: var(--primary); }
.display-header .meta { font-size: .9rem; color: var(--muted); font-weight: 600; }

.display-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 40px;
  gap: 24px;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

.question-text {
  font-size: clamp(1.3rem, 3.5vw, 2.2rem);
  font-weight: 800;
  text-align: center;
  line-height: 1.3;
  padding: 28px 36px;
  background: rgba(255,255,255,.08);
  border-radius: var(--radius);
  border: 1px solid rgba(255,255,255,.1);
  width: 100%;
}

.round-badge {
  background: var(--primary);
  color: #fff;
  font-weight: 800;
  font-size: .85rem;
  padding: 4px 14px;
  border-radius: 50px;
  letter-spacing: .05em;
  text-transform: uppercase;
}

/* Join URL box */
.join-info {
  background: rgba(255,255,255,.06);
  border: 2px dashed rgba(255,255,255,.2);
  border-radius: var(--radius);
  padding: 20px 32px;
  text-align: center;
}
.join-info .url { font-size: 1.2rem; font-weight: 700; color: #7dd3fc; }

/* ── Admin Screen ──────────────────────────────────────────────────────────── */
#admin-root {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.admin-header {
  background: rgba(0,0,0,.4);
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.admin-body {
  flex: 1;
  padding: 28px;
  max-width: 960px;
  margin: 0 auto;
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 24px;
  align-items: start;
}
@media (max-width: 720px) {
  .admin-body { grid-template-columns: 1fr; }
}
.admin-controls { display: flex; flex-direction: column; gap: 12px; }
.status-badge {
  display: inline-block;
  padding: 4px 14px;
  border-radius: 50px;
  font-size: .8rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.status-waiting  { background: rgba(255,166,2,.25);  color: #ffa602; }
.status-question { background: rgba(19,104,206,.25); color: #60a5fa; }
.status-reveal   { background: rgba(38,137,12,.25);  color: #86efac; }
.status-finished { background: rgba(150,150,150,.2); color: #ccc; }
.status-idle     { background: rgba(150,150,150,.2); color: #999; }

/* ── Play Screen ───────────────────────────────────────────────────────────── */
#play-root {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  max-width: 560px;
  margin: 0 auto;
  padding: 20px 16px 40px;
}

.play-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 16px;
  margin-bottom: 16px;
  border-bottom: 1px solid rgba(255,255,255,.1);
}

.play-score {
  background: rgba(255,215,0,.1);
  border: 1px solid rgba(255,215,0,.3);
  border-radius: 50px;
  padding: 6px 18px;
  font-weight: 800;
  color: #ffd700;
}

.answer-feedback {
  text-align: center;
  padding: 28px;
  border-radius: var(--radius);
  font-weight: 800;
}
.answer-feedback.correct-fb { background: rgba(38,137,12,.25); border: 2px solid var(--opt-c); }
.answer-feedback.wrong-fb   { background: rgba(226,27,60,.2);  border: 2px solid var(--opt-a); }
.answer-feedback .points    { font-size: 2.5rem; color: #ffd700; }

/* ── Join Screen ───────────────────────────────────────────────────────────── */
#join-root {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.join-card {
  width: 100%;
  max-width: 440px;
  background: rgba(255,255,255,.07);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 20px;
  padding: 36px 32px;
}
.join-logo {
  text-align: center;
  margin-bottom: 28px;
}
.join-logo h1 { color: var(--primary); }
.join-logo p  { color: var(--muted); margin-top: 4px; }

/* ── Waiting room ──────────────────────────────────────────────────────────── */
.waiting-animation {
  display: flex;
  gap: 8px;
  justify-content: center;
}
.waiting-animation span {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--primary);
  animation: bounce .9s ease-in-out infinite;
}
.waiting-animation span:nth-child(2) { animation-delay: .15s; }
.waiting-animation span:nth-child(3) { animation-delay: .30s; }

@keyframes bounce {
  0%, 80%, 100% { transform: translateY(0); }
  40%            { transform: translateY(-12px); }
}

/* ── Result / Podium ───────────────────────────────────────────────────────── */
.podium {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 12px;
  margin: 20px 0;
}
.podium-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.podium-block {
  width: 90px;
  border-radius: 10px 10px 0 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
}
.podium-item:nth-child(1) .podium-block { height: 120px; background: rgba(192,192,192,.3); }
.podium-item:nth-child(2) .podium-block { height: 160px; background: rgba(255,215,0,.3); order: -1; }
.podium-item:nth-child(3) .podium-block { height: 90px;  background: rgba(205,127,50,.3); }
.podium-name  { font-weight: 800; font-size: .85rem; text-align: center; max-width: 90px; word-break: break-word; }
.podium-score { color: #ffd700; font-weight: 700; font-size: .85rem; }
