:root {
  --bg: #14151a;
  --panel: #1e2028;
  --panel-raised: #24273250;
  --border: #333644;
  --text: #f2f2f5;
  --muted: #9a9ba5;
  --accent: #6c8bff;
  --accent-bright: #8aa1ff;
  --correct: #3ecf8e;
  --incorrect: #ff6b6b;
  font-size: 18px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background:
    radial-gradient(ellipse 900px 500px at 50% -10%, #2a2f4d 0%, transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

#app {
  width: 100%;
  max-width: 640px;
}

.screen { display: none; }
.screen.active { display: block; }

h1 { margin: 0 0 0.25rem; }
h2 { margin: 0 0 0.5rem; }
.subtitle { color: var(--muted); margin-top: 0; }
.hidden { display: none !important; }
.error { color: var(--incorrect); min-height: 1.2em; text-align: center; margin: 0.75rem 0 0; font-size: 0.95rem; font-weight: 600; }

.input-error { border-color: var(--incorrect) !important; box-shadow: 0 0 0 3px rgba(255, 107, 107, 0.25) !important; }

@keyframes shake {
  10%, 90% { transform: translateX(-1px); }
  20%, 80% { transform: translateX(2px); }
  30%, 50%, 70% { transform: translateX(-4px); }
  40%, 60% { transform: translateX(4px); }
}
.shake { animation: shake 0.4s ease; }

label {
  display: block;
  margin: 0 0 0.35rem;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

input, select, button {
  font-size: 1rem;
  font-family: inherit;
}

input, select {
  width: 100%;
  padding: 0.7rem 0.8rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(108, 139, 255, 0.25);
}

input::placeholder { color: #5c5e6b; }

button {
  padding: 0.75rem 1.2rem;
  border-radius: 10px;
  border: none;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.1s ease, filter 0.15s ease, background 0.15s ease;
}

button:hover { filter: brightness(1.08); }
button:active { transform: scale(0.98); }
button:disabled { opacity: 0.5; cursor: default; transform: none; }

.btn-primary {
  width: 100%;
  background: linear-gradient(135deg, var(--accent), var(--accent-bright));
  color: #10111a;
  padding: 0.85rem 1.2rem;
  font-size: 1.05rem;
  box-shadow: 0 6px 20px -6px rgba(108, 139, 255, 0.6);
}

.btn-secondary {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { border-color: var(--accent); }

/* ---------- Join screen ---------- */

.join-card {
  background: linear-gradient(180deg, var(--panel-raised), transparent), var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 2.25rem 2rem;
  box-shadow: 0 20px 50px -20px rgba(0, 0, 0, 0.6);
  text-align: center;
}

.join-logo { font-size: 2.5rem; margin-bottom: 0.25rem; }

.join-card h1 { font-size: 1.75rem; }
.join-card .subtitle { margin-bottom: 1.75rem; }
.join-card label { text-align: left; margin-top: 0; }
.join-card #join-name { margin-bottom: 0.25rem; }
.join-card .btn-primary { margin-top: 1.25rem; }

.divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1.5rem 0 1.25rem;
  color: var(--muted);
  font-size: 0.8rem;
}
.divider::before, .divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.join-row { display: flex; gap: 0.6rem; }
.code-input {
  flex: 1;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.3em;
  font-weight: 700;
  font-family: "SF Mono", "Cascadia Code", Consolas, monospace;
}
.join-row .btn-secondary { flex-shrink: 0; padding-left: 1.5rem; padding-right: 1.5rem; }

#lobby-players {
  list-style: none;
  padding: 0;
  margin: 1rem 0;
}
#lobby-players li {
  padding: 0.5rem 0.75rem;
  background: var(--panel);
  border-radius: 8px;
  margin-bottom: 0.4rem;
}

.round-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
  color: var(--muted);
}

#round-timer-bar {
  flex: 1;
  height: 8px;
  background: var(--panel);
  border-radius: 4px;
  overflow: hidden;
}
#round-timer-fill {
  height: 100%;
  width: 100%;
  background: var(--accent);
  transition: width 0.1s linear;
}

#round-quote {
  font-size: 1.6rem;
  line-height: 1.4;
  margin: 0 0 2rem;
  padding: 1.25rem;
  background: var(--panel);
  border-radius: 12px;
  border-left: 4px solid var(--accent);
}

.choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
}

.choice-btn {
  background: var(--panel);
  color: var(--text);
  border: 1px solid #333644;
  padding: 1rem;
  text-align: left;
}
.choice-btn.selected { border-color: var(--accent); background: #262a3a; }

#reveal-guesses, #reveal-scores, #final-scores {
  list-style: none;
  padding: 0;
}
#reveal-scores, #final-scores { list-style: decimal inside; }

#reveal-guesses li {
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
  margin-bottom: 0.3rem;
}
#reveal-guesses li.correct { background: rgba(62, 207, 142, 0.15); }
#reveal-guesses li.incorrect { background: rgba(255, 107, 107, 0.1); }

#reveal-scores li, #final-scores li {
  padding: 0.35rem 0;
}

@media (max-width: 480px) {
  .choices { grid-template-columns: 1fr; }
}
