:root {
  --bg: #111111;
  --surface: #2d2d2d;
  --text: #f5f5fa;
  --muted: #9a9baa;
  --accent: #555555;
  --correct: #2ecc71;
  --incorrect: #e74c3c;
  --choice-0: #555555;
  --choice-1: #555555;
  --choice-2: #555555;
  --choice-3: #555555;
}

* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
  margin: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Jura", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

#app {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 24px 16px;
}

.hidden {
  display: none !important;
}

.logo {
  text-align: center;
  font-size: 2rem;
  margin: 8px 0 24px;
  color: var(--accent);
}

.muted {
  color: var(--muted);
}

.error {
  color: var(--incorrect);
  font-weight: 600;
}

/* ---- join screen ---- */

#join-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 360px;
  margin: 0 auto;
  width: 100%;
}

#join-form label {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 8px;
}

#join-form input {
  font-family: "Jura", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 1.4rem;
  padding: 14px;
  border-radius: 10px;
  border: 2px solid transparent;
  background: var(--surface);
  color: var(--text);
  text-transform: uppercase;
}

input#name-input {
  text-transform: none;
}

#join-form input:focus {
  outline: none;
  border-color: var(--accent);
}

button {
  font-family: "Jura", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 1.2rem;
  font-weight: 700;
  padding: 16px;
  border-radius: 12px;
  border: none;
  background: var(--accent);
  color: white;
  cursor: pointer;
  margin-top: 16px;
}

button:active {
  transform: scale(0.98);
}

/* ---- lobby screen ---- */

#lobby-screen {
  align-items: center;
  justify-content: center;
  text-align: center;
}

.big-check {
  font-size: 4rem;
  color: var(--correct);
  margin: 0;
}

/* ---- question screen ---- */

.question-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.pill-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-start;
  min-width: 0;
}

.category-pill {
  background: var(--surface);
  color: var(--muted);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.timer {
  font-size: 1.4rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.timer-bar-track {
  height: 6px;
  border-radius: 3px;
  background: var(--surface);
  margin: 12px 0 20px;
  overflow: hidden;
}

.timer-bar-fill {
  height: 100%;
  width: 100%;
  background: var(--accent);
  transition: width 0.15s linear;
}

#question-prompt {
  font-size: 1.5rem;
  line-height: 1.3;
  margin: 0 0 24px;
  flex-shrink: 0;
}

.choices {
  display: grid;
  /* mobile: one full-width choice per row; rows share the height of the
     tallest choice (1fr on an auto-sized grid), no stretching to fill the
     screen */
  grid-template-columns: 1fr;
  grid-auto-rows: 1fr;
  gap: 12px;
  align-content: start;
}

/* wide displays (tablet/desktop/big screen): back to a 2x2 grid */
@media (min-width: 600px) {
  .choices {
    grid-template-columns: 1fr 1fr;
  }
}

.choice {
  border-radius: 14px;
  font-size: 1.1rem;
  min-height: 56px; /* comfortable tap target even for one-word answers */
  padding: 14px 16px;
  margin: 0;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  transition: opacity 0.2s, transform 0.2s;
}

.choice-0 { background: var(--choice-0); }
.choice-1 { background: var(--choice-1); }
.choice-2 { background: var(--choice-2); }
.choice-3 { background: var(--choice-3); }

.choices.locked .choice {
  opacity: 0.35;
  pointer-events: none;
}

.choices.locked .choice.selected {
  opacity: 1;
  transform: scale(1.03);
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.4);
}

.choices.locked .choice.correct {
  opacity: 1;
  box-shadow: 0 0 0 3px white, 0 0 0 7px var(--correct);
}

.choices.locked .choice.incorrect.selected {
  box-shadow: 0 0 0 3px white, 0 0 0 7px var(--incorrect);
}

#question-status {
  text-align: center;
  margin-top: 16px;
  font-size: 1.1rem;
}

#question-status.correct {
  color: var(--correct);
  font-weight: 700;
}

#question-status.incorrect {
  color: var(--incorrect);
  font-weight: 700;
}

/* ---- leaderboard / gameover ---- */

.ranking-list {
  list-style: none;
  padding: 0;
  margin: 0;
  max-width: 480px;
  width: 100%;
  margin: 0 auto;
}

.ranking-list li {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  padding: 14px 16px;
  border-radius: 12px;
  margin-bottom: 8px;
  font-size: 1.05rem;
}

.ranking-list li.me {
  box-shadow: 0 0 0 2px var(--accent);
}

.rank-number {
  font-weight: 800;
  color: var(--muted);
  min-width: 28px;
}

.rank-name {
  flex: 1;
  font-weight: 600;
}

.rank-score {
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

/* ---- reconnect banner ---- */

.banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: var(--incorrect);
  color: white;
  text-align: center;
  padding: 8px;
  font-weight: 700;
  z-index: 100;
}
