:root {
  --bg: #0f172a;
  --card: #1e293b;
  --cyan: #22d3ee;
  --gold: #fbbf24;
  --pink: #f472b6;
  --green: #4ade80;
  --ink: #f8fafc;
  --muted: #94a3b8;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: linear-gradient(145deg, #0f172a 0%, #1e1b4b 50%, #0f172a 100%);
  color: var(--ink);
}

#app {
  max-width: 520px;
  margin: 0 auto;
  padding: 24px 16px 40px;
}

h1 {
  font-size: 1.75rem;
  margin: 0 0 8px;
  letter-spacing: -0.02em;
}

.mode-tag {
  color: var(--cyan);
  font-size: 0.8rem;
  margin: 0 0 8px;
  min-height: 1.1em;
}

.tag {
  color: var(--gold);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin: 0 0 4px;
}

.lead {
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.45;
  margin: 0 0 20px;
}

.panel {
  background: var(--card);
  border-radius: 16px;
  padding: 20px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

label {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 6px;
}

input,
select,
textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 2px solid rgba(255, 255, 255, 0.12);
  background: #0f172a;
  color: var(--ink);
  font-size: 1rem;
  margin-bottom: 14px;
}

.code-input {
  font-family: ui-monospace, monospace;
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-align: center;
  text-transform: uppercase;
}

.optional {
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  color: var(--muted);
}

textarea {
  min-height: 88px;
  font-family: ui-monospace, monospace;
  font-size: 0.8rem;
}

.btn {
  display: block;
  width: 100%;
  border: 0;
  border-radius: 12px;
  padding: 14px;
  font-weight: 800;
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  cursor: pointer;
  margin-bottom: 10px;
}

.btn-primary {
  background: linear-gradient(180deg, var(--gold), #d97706);
  color: #1c1917;
}

.btn-secondary {
  background: linear-gradient(180deg, var(--cyan), #0891b2);
  color: #042f2e;
}

.btn-ghost {
  background: transparent;
  border: 2px solid rgba(255, 255, 255, 0.2);
  color: var(--muted);
}

.err {
  color: #fb7185;
  font-size: 0.9rem;
  min-height: 1.2em;
}

.note {
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.45;
  margin-top: 12px;
}

.code-display {
  font-family: ui-monospace, monospace;
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: 0.2em;
  text-align: center;
  color: var(--gold);
  margin: 12px 0;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 12px 0;
  font-size: 0.9rem;
}

.check-row input {
  width: auto;
  margin: 0;
}

.hidden {
  display: none !important;
}

.question-text {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0 0 16px;
  line-height: 1.35;
}

.timer {
  text-align: center;
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--cyan);
  margin-bottom: 16px;
}

.choices {
  display: grid;
  gap: 10px;
}

.choice {
  border: 0;
  border-radius: 12px;
  padding: 14px 16px;
  text-align: left;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  color: #0f172a;
}

.choice:nth-child(1) {
  background: #f87171;
}
.choice:nth-child(2) {
  background: #60a5fa;
}
.choice:nth-child(3) {
  background: #fbbf24;
}
.choice:nth-child(4) {
  background: #4ade80;
}

.choice:disabled {
  opacity: 0.55;
  cursor: default;
}

.choice.reveal-wrong {
  opacity: 0.45;
}
.choice.reveal-correct {
  outline: 4px solid #fff;
}

.leaderboard {
  margin-top: 16px;
  font-size: 0.9rem;
}

.leaderboard li {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.leaderboard li.you {
  color: var(--green);
  font-weight: 600;
}

.leaderboard li.rank-first span:first-child {
  color: var(--gold);
}

.ver {
  text-align: center;
  font-size: 0.7rem;
  color: var(--muted);
  margin-top: 20px;
}
