:root {
  --bg: #050816;
  --card-bg: #0c142a;
  --panel: #0f172a;
  --text: #e8edf7;
  --muted: #9fb0c7;
  --border: rgba(148, 163, 184, 0.28);
  --shadow: 0 18px 40px rgba(5, 8, 22, 0.7);
  --accent: #38bdf8;
  --accent-2: #a855f7;
  --accent-soft: rgba(56, 189, 248, 0.18);
  --danger: #f87171;
  --radius: 16px;
  --gold: rgba(234, 179, 8, 0.18);
  --silver: rgba(148, 163, 184, 0.18);
  --bronze: rgba(234, 88, 12, 0.18);
  --opt-a: #0ea5e9;
  --opt-b: #22c55e;
  --opt-c: #f59e0b;
  --opt-d: #f97316;
  --card: var(--card-bg);
  --text-soft: var(--muted);
}

[data-theme="light"] {
  --bg: #f7f7fb;
  --card-bg: #ffffff;
  --panel: #ffffff;
  --text: #0f172a;
  --muted: #475569;
  --border: rgba(148, 163, 184, 0.35);
  --shadow: 0 16px 36px rgba(15, 23, 42, 0.08);
  --accent: #2563eb;
  --accent-2: #7c3aed;
  --accent-soft: rgba(37, 99, 235, 0.12);
  --danger: #ef4444;
  --gold: rgba(250, 204, 21, 0.24);
  --silver: rgba(148, 163, 184, 0.22);
  --bronze: rgba(234, 88, 12, 0.18);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: stretch;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text",
    sans-serif;
  background: radial-gradient(circle at 0% 0%, rgba(56, 189, 248, 0.08), transparent 38%),
    radial-gradient(circle at 80% 10%, rgba(168, 85, 247, 0.08), transparent 36%),
    var(--bg);
  color: var(--text);
}

[data-theme="light"] body {
  background: #f7f7fb;
}

a {
  color: var(--accent);
}

.app {
  width: 100%;
  max-width: 1100px;
  padding: 24px 16px 32px;
}

.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  backdrop-filter: blur(18px);
}

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 16px;
}

.header-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-end;
}

.chip-btn {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  box-shadow: none;
  padding: 6px 10px;
  border-radius: 999px;
}

html[data-theme="dark"] #help-btn {
  color: #0b162d;
  background: linear-gradient(135deg, rgba(125, 211, 252, 0.65), rgba(167, 139, 250, 0.7));
  border: 1px solid rgba(125, 211, 252, 0.85);
  box-shadow: 0 0 0 2px rgba(125, 211, 252, 0.25), 0 10px 22px rgba(0, 0, 0, 0.45);
}

[data-theme="light"] .chip-btn {
  background: #eef2ff;
  color: #0f172a;
}

.lang-switch {
  display: flex;
  gap: 6px;
}

.toggle-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.profile-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel);
  cursor: pointer;
  min-width: 140px;
  justify-content: flex-end;
}

.avatar-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  color: #0f172a;
  border: 2px solid rgba(255, 255, 255, 0.2);
}

.profile-chip small {
  color: var(--text-soft);
}

h1 {
  margin: 0;
  font-size: 1.8rem;
}

h2 {
  margin-top: 0;
  margin-bottom: 8px;
}

.subtitle {
  color: var(--text-soft);
  margin: 4px 0 0;
}

.two-cols {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.panel {
  flex: 1 1 280px;
  background: var(--panel);
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 12px 14px 14px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-soft);
  margin: 6px 0 3px;
}

input,
select,
textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-size: 0.95rem;
  outline: none;
  resize: vertical;
}

[data-theme="light"] input,
[data-theme="light"] select,
[data-theme="light"] textarea {
  background: #ffffff;
  border-color: #cbd5e1;
  color: #0f172a;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.4);
}

button {
  border-radius: 999px;
  border: none;
  padding: 10px 16px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  color: #0f172a;
  box-shadow: 0 10px 26px rgba(56, 189, 248, 0.35);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  margin-top: 10px;
}

button.secondary {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  box-shadow: none;
}

button.small {
  padding: 6px 12px;
  font-size: 0.8rem;
}

button[disabled] {
  opacity: 0.5;
  cursor: default;
  box-shadow: none;
}

button:active {
  transform: translateY(1px) scale(0.99);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
}

.error {
  margin-top: 4px;
  font-size: 0.8rem;
  color: var(--danger);
}

.hint {
  margin-top: 4px;
  font-size: 0.85rem;
  color: var(--text-soft);
}

.label {
  font-size: 0.8rem;
  color: var(--text-soft);
  margin-right: 4px;
}

.hidden {
  display: none !important;
}

.status-pill {
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text);
  background: linear-gradient(120deg, rgba(56, 189, 248, 0.16), rgba(168, 85, 247, 0.12));
  font-size: 0.9rem;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

/* ROOM */

.room-header {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 12px;
}

.room-info-box {
  flex: 1 1 260px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 10px 12px;
}

.participants {
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 0.95rem;
}

.participants li {
  padding: 6px 8px;
  border-radius: 8px;
  border-bottom: 1px dashed rgba(30, 64, 175, 0.8);
}

.participants li:last-child {
  border-bottom: none;
}

.participant-me {
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.4);
}

.participant-host {
  border-left: 3px solid #f59e0b;
}

.room-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.host-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.room-main {
  margin-top: 4px;
}

.collect-header,
.play-top,
.results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

/* QUESTIONS */

.question-form textarea {
  min-height: 80px;
  font-size: 1rem;
}

.options-stack {
  background: rgba(255, 255, 255, 0.04);
  padding: 6px 8px;
  border-radius: 12px;
  border: 1px solid var(--border);
}

.option-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 6px 0;
}

.option-label {
  width: 28px;
  height: 28px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.3), rgba(59, 130, 246, 0.2));
  border: 1px solid rgba(56, 189, 248, 0.5);
  font-weight: 700;
  color: var(--text);
}

.tf-box {
  background: rgba(255, 255, 255, 0.04);
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid var(--border);
}

.question-lists {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.pill {
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-size: 0.8rem;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03);
}

.question-list {
  list-style: none;
  padding: 0;
  margin: 6px 0 0;
  max-height: 260px;
  overflow-y: auto;
  font-size: 0.95rem;
}

.question-list.small {
  font-size: 0.85rem;
}

.question-list li {
  padding: 6px 8px;
  border-radius: 10px;
  border: 1px solid var(--border);
  margin-bottom: 6px;
  background: rgba(255, 255, 255, 0.03);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

[data-theme="light"] .question-list li {
  background: #f8fafc;
}

.question-list li span.meta {
  display: block;
  font-size: 0.78rem;
  color: var(--text-soft);
}

.question-meta-block {
  flex: 1;
}

.delete-btn {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fca5a5;
  box-shadow: none;
  padding: 6px 10px;
}

/* PLAY VIEW */

#timer-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  position: relative;
}

.play-question-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

#timer-circle-wrapper {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
}

.timer-circle {
  position: relative;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.95rem;
  background:
    conic-gradient(var(--timer-color, #22c55e) calc(var(--timer-progress, 1) * 360deg),
                   rgba(148, 163, 184, 0.2) 0deg);
}

.timer-circle::before {
  content: "";
  position: absolute;
  inset: 6px;
  border-radius: 50%;
  background: var(--card-bg, #020617);
}

#timer-circle-label {
  position: relative;
  z-index: 1;
  color: var(--text);
}

#timer-bar {
  flex: 1;
  height: 10px;
  border-radius: 999px;
  background: rgba(30, 64, 175, 0.6);
  overflow: hidden;
}

#timer-bar-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(to right, #22c55e, #f59e0b, #ef4444);
  transition: width 0.2s linear;
}

#timer-display {
  min-width: 52px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-size: 1rem;
  color: var(--text-soft);
}

#bulk-input {
  margin-top: 10px;
}

#play-scoreboard {
  margin-top: 12px;
}

#leaderboard-reveal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  background: radial-gradient(circle at 20% 20%, rgba(56, 189, 248, 0.08), transparent 38%),
    radial-gradient(circle at 80% 10%, rgba(168, 85, 247, 0.08), transparent 36%),
    rgba(4, 6, 15, 0.68);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 20;
}

#leaderboard-reveal.show {
  opacity: 1;
  pointer-events: auto;
}

.lb-card {
  width: min(640px, 94vw);
  max-height: 86vh;
  background: var(--card-bg);
  border-radius: 18px;
  border: 1px solid var(--border);
  box-shadow: 0 22px 48px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.03);
  padding: 14px;
  backdrop-filter: blur(10px);
  transform: translateY(14px);
  transition: transform 0.36s ease, opacity 0.36s ease;
  opacity: 0.96;
}

#leaderboard-reveal.show .lb-card {
  transform: translateY(0);
  opacity: 1;
}

.lb-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.lb-label {
  font-size: 0.9rem;
  color: var(--text-soft);
}

.lb-title {
  margin: 4px 0 2px;
}

.lb-progress {
  min-width: 160px;
  text-align: right;
}

.lb-countdown {
  font-size: 0.9rem;
  color: var(--text-soft);
}

.lb-progress-bar {
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.25);
  overflow: hidden;
  margin-top: 6px;
}

.lb-progress-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #22c55e, #38bdf8, #a855f7);
}

.lb-rows {
  margin-top: 10px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(255, 255, 255, 0.02);
}

.lb-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
  transition: background 0.3s ease, transform 0.3s ease, opacity 0.3s ease;
}

.lb-row:last-child {
  border-bottom: none;
}

.lb-row.lb-top {
  background: radial-gradient(circle at 12% 10%, rgba(56, 189, 248, 0.08), transparent 46%),
    rgba(255, 255, 255, 0.02);
}

.lb-rank {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(56, 189, 248, 0.14);
  font-weight: 700;
  color: #e2e8f0;
}

.lb-row.rank-1 .lb-rank {
  background: var(--gold);
  color: #facc15;
}

.lb-row.rank-2 .lb-rank {
  background: var(--silver);
  color: #cbd5e1;
}

.lb-row.rank-3 .lb-rank {
  background: var(--bronze);
  color: #fb923c;
}

.lb-body {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.lb-name {
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lb-score {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-variant-numeric: tabular-nums;
}

.lb-score-value {
  font-weight: 800;
  letter-spacing: 0.2px;
}

.lb-delta {
  font-size: 0.9rem;
  color: var(--text-soft);
}

.lb-delta.positive {
  color: #22c55e;
}

.lb-movement {
  font-size: 1rem;
  font-weight: 700;
  width: 26px;
  text-align: center;
  color: var(--text-soft);
}

.lb-row.lb-up {
  animation: lbGlowUp 1s ease;
}

.lb-row.lb-down .lb-movement {
  color: #f87171;
}

.lb-row.lb-down {
  animation: lbRowDown 0.45s ease;
}

.lb-row.lb-up .lb-movement {
  color: #22c55e;
  transform: translateY(-2px);
}

.lb-row-enter {
  animation: lbRowEnter 0.4s ease;
}

.lb-more {
  padding: 10px 14px 6px;
  color: var(--text-soft);
  text-align: center;
}

.scoreboard-section {
  margin-bottom: 10px;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(56, 189, 248, 0.04);
}

.score-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid rgba(148, 163, 184, 0.15);
  gap: 8px;
}

.score-row:last-child {
  border-bottom: none;
}

.score-name {
  font-weight: 600;
}

.score-stats {
  display: flex;
  gap: 10px;
  font-size: 0.9rem;
}

.question-text {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 12px;
  flex: 1;
}

.options-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  margin-top: 8px;
}

.option-btn {
  width: 100%;
  justify-content: flex-start;
  padding: 12px 14px;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.05),
    rgba(56, 189, 248, 0.07)
  );
  border: 2px solid var(--border);
  color: var(--text);
  transition: transform 0.14s ease, box-shadow 0.14s ease,
    background-color 0.14s ease, border-color 0.14s ease, opacity 0.14s ease;
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.option-btn::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.08), transparent 45%);
  opacity: 0.16;
  pointer-events: none;
}

.option-btn.option-a,
.option-btn.option-b,
.option-btn.option-c,
.option-btn.option-d {
  border-left: 6px solid rgba(255, 255, 255, 0.12);
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.06),
    rgba(56, 189, 248, 0.08)
  );
}

.option-btn:hover:not([disabled]) {
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.28), 0 0 0 1px rgba(56, 189, 248, 0.2);
  transform: translateY(-1px);
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.08),
    rgba(56, 189, 248, 0.12)
  );
}

.option-btn.selected {
  border-color: var(--accent);
  transform: translateY(-1px) scale(1.01);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.32), 0 14px 30px rgba(56, 189, 248, 0.28);
  background: linear-gradient(
    135deg,
    rgba(56, 189, 248, 0.2),
    rgba(168, 85, 247, 0.18)
  );
}

.option-btn.correct {
  background: linear-gradient(
    135deg,
    rgba(56, 189, 248, 0.22),
    rgba(168, 85, 247, 0.2)
  );
  border-color: rgba(56, 189, 248, 0.9);
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.32), 0 0 18px rgba(56, 189, 248, 0.28);
}

.option-btn.correct::after {
  content: "✔";
  position: absolute;
  right: 12px;
  font-weight: 800;
  color: #0f172a;
  background: rgba(56, 189, 248, 0.9);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  box-shadow: 0 0 0 5px rgba(56, 189, 248, 0.16);
}

.option-btn.incorrect {
  opacity: 0.78;
  background: linear-gradient(
    135deg,
    rgba(148, 163, 184, 0.14),
    rgba(15, 23, 42, 0.12)
  );
  border-color: rgba(148, 163, 184, 0.65);
}

.option-btn.incorrect::after {
  content: "✖";
  position: absolute;
  right: 12px;
  font-weight: 800;
  color: rgba(226, 232, 240, 0.9);
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(148, 163, 184, 0.35);
  box-shadow: 0 0 0 4px rgba(148, 163, 184, 0.16);
}

.option-letter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid var(--border);
  font-size: 0.9rem;
  font-weight: 700;
}

/* RESULTS */

#results-summary {
  margin-bottom: 8px;
  font-weight: 700;
}

#results-list table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.podium {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.podium-spot {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
  text-align: center;
  background: linear-gradient(180deg, rgba(56, 189, 248, 0.12), rgba(15, 23, 42, 0.3));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
  transform-origin: bottom;
}

.podium-spot.place-2 {
  transform: translateY(12px);
}

.podium-spot.place-3 {
  transform: translateY(18px);
}

.podium-name {
  font-weight: 700;
  margin-top: 6px;
}

.podium-score {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--accent);
}

.podium-rank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--accent-soft);
  margin: 0 auto 6px;
  font-weight: 800;
}

#results-list th,
#results-list td {
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid rgba(30, 64, 175, 0.6);
}

#results-list tr.rank-1 {
  background: var(--gold);
}

#results-list tr.rank-2 {
  background: var(--silver);
}

#results-list tr.rank-3 {
  background: var(--bronze);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.stat-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
  background: var(--panel);
}

.badge-list {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.badge-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--text);
}

.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.5);
  z-index: 20;
}

.modal-content {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  width: min(460px, 95vw);
  color: var(--text);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.avatar-grid,
.color-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(60px, 1fr));
  gap: 8px;
  margin: 10px 0;
}

.avatar-option,
.color-option {
  border: 1px solid var(--border);
  padding: 10px;
  border-radius: 12px;
  text-align: center;
  cursor: pointer;
  background: var(--card);
}

.avatar-option.selected,
.color-option.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

.actions-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.help-modal-content {
  max-width: 520px;
}

.help-steps {
  display: grid;
  gap: 8px;
  font-size: 0.95rem;
  color: var(--text);
}

.help-steps p {
  margin: 0;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
}

.context-hint {
  margin: 6px 0 2px;
  padding: 10px 12px;
  border-radius: 12px;
  background: linear-gradient(120deg, rgba(56, 189, 248, 0.16), rgba(34, 197, 94, 0.08));
  border: 1px solid var(--border);
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 10px 26px rgba(5, 8, 22, 0.25);
}

#timer-cue {
  font-size: 0.9rem;
  color: var(--text);
  min-width: 140px;
  text-align: right;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

#timer-cue.visible {
  opacity: 1;
  transform: translateY(-2px);
}

#timer-big-countdown {
  position: absolute;
  right: 12px;
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--text);
  opacity: 0;
  pointer-events: none;
}

.countdown-pop {
  animation: countdownPop 0.45s ease;
}

@keyframes countdownPop {
  0% {
    opacity: 0;
    transform: translateY(6px) scale(0.9);
  }
  30% {
    opacity: 1;
    transform: translateY(0) scale(1.08);
  }
  100% {
    opacity: 0;
    transform: translateY(-4px) scale(0.92);
  }
}

.timer-pulse-soft {
  animation: timerPulse 1s ease infinite;
}

.timer-pulse-strong {
  animation: timerPulseStrong 0.9s ease infinite;
}

@keyframes timerPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(56, 189, 248, 0.25);
  }
  100% {
    box-shadow: 0 0 0 12px rgba(56, 189, 248, 0);
  }
}

@keyframes timerPulseStrong {
  0% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.35);
  }
  100% {
    box-shadow: 0 0 0 14px rgba(239, 68, 68, 0);
  }
}

.timer-shake {
  animation: timerShake 0.6s ease;
}

@keyframes lbGlowUp {
  0% {
    box-shadow: 0 0 0 rgba(34, 197, 94, 0.05);
  }
  40% {
    box-shadow: 0 0 0 12px rgba(34, 197, 94, 0.08);
  }
  100% {
    box-shadow: 0 0 0 rgba(34, 197, 94, 0.01);
  }
}

@keyframes lbRowEnter {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes lbRowDown {
  0% {
    transform: translateY(0);
  }
  30% {
    transform: translateY(3px);
  }
  60% {
    transform: translateY(-2px);
  }
  100% {
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  #leaderboard-reveal {
    transition: opacity 0.2s ease !important;
  }

  .lb-card,
  .lb-row,
  .lb-progress-fill {
    transition: none !important;
    animation: none !important;
    transform: none !important;
  }
}

@keyframes timerShake {
  0% {
    transform: translateX(0);
  }
  20% {
    transform: translateX(-3px);
  }
  40% {
    transform: translateX(3px);
  }
  60% {
    transform: translateX(-2px);
  }
  80% {
    transform: translateX(2px);
  }
  100% {
    transform: translateX(0);
  }
}

.ui-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 4, 15, 0.55);
  backdrop-filter: blur(8px);
  z-index: 22;
}

.overlay-card {
  padding: 16px 20px;
  border-radius: 16px;
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  text-align: center;
  min-width: 240px;
}

/* Confetti */
#confetti-container {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 10;
}

.confetti-piece {
  position: absolute;
  width: 8px;
  height: 14px;
  background: #38bdf8;
  opacity: 0.8;
  animation: confetti-fall 3s linear forwards;
  border-radius: 2px;
}

@keyframes confetti-fall {
  0% {
    transform: translateY(-10%) rotate(0deg);
  }
  100% {
    transform: translateY(110vh) rotate(720deg);
    opacity: 0;
  }
}

@media (max-width: 768px) {
  .card {
    padding: 16px;
  }

  .app-header {
    flex-direction: column;
  }
}
