/* Кольори та розміри в одному місці: змінюєте тут — змінюється вся гра. */
:root {
  --bg: #f6f3ee;
  --surface: #ffffff;
  --surface-2: #efeae2;
  --text: #1d1b24;
  --muted: #6b6676;
  --border: #e2dcd2;
  --accent: #5b4bdb;
  --accent-text: #ffffff;
  --accent-soft: #ebe8ff;
  --right: #1f9d63;
  --right-soft: #e2f6ec;
  --wrong: #d9473f;
  --wrong-soft: #fde9e7;
  --fire: #ff7a1a;
  --radius: 18px;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.04), 0 6px 20px rgb(30 20 60 / 0.06);
  --font: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #17151f;
    --surface: #221f2d;
    --surface-2: #2b2838;
    --text: #f2f0f7;
    --muted: #a49fb3;
    --border: #363246;
    --accent: #8b7dff;
    --accent-text: #120f1f;
    --accent-soft: #2e2850;
    --right: #3ccf8e;
    --right-soft: #173a2b;
    --wrong: #ff6b62;
    --wrong-soft: #45201e;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 8px 24px rgb(0 0 0 / 0.25);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.5;
  -webkit-tap-highlight-color: transparent;
}

button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: default; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.app {
  max-width: 680px;
  margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right))
    max(24px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  min-height: 100dvh;
}

.screen { display: flex; flex-direction: column; gap: 16px; animation: fade 0.25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } }
@media (prefers-reduced-motion: reduce) { .screen { animation: none; } }

.loading, .note { color: var(--muted); text-align: center; margin: 0; }

.warning {
  background: var(--wrong-soft);
  color: var(--text);
  border: 1px solid var(--wrong);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 12px;
}

/* ---- Статистика і вибір мови ---- */
.top-row { display: flex; gap: 8px; align-items: flex-start; }
.top-row .stats { flex: 1; }
.stats { display: flex; gap: 8px; flex-wrap: wrap; }

.lang-switch {
  display: flex; flex: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px;
}
.lang-option {
  border: 0; background: transparent;
  padding: 4px 10px; border-radius: 999px;
  font-size: 13px; font-weight: 650; color: var(--muted);
}
.lang-option.is-active { background: var(--accent); color: var(--accent-text); }
.stat {
  display: flex; align-items: center; gap: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 15px;
}
.stat-icon { filter: grayscale(1); opacity: 0.6; }
.stat-icon.is-lit { filter: none; opacity: 1; } /* ⭐ and 🧊 are always in colour; 🔥 only when the streak is alive */
.stat-level { flex: 1 1 160px; }
.bar {
  flex: 1; height: 8px; min-width: 60px;
  background: var(--surface-2);
  border-radius: 999px; overflow: hidden;
}
.bar > span { display: block; height: 100%; background: var(--accent); border-radius: inherit; transition: width 0.4s ease; }

/* ---- Головний ---- */
.hero h1 { font-size: clamp(28px, 6vw, 40px); line-height: 1.15; margin: 12px 0 4px; letter-spacing: -0.02em; }
.hero p { margin: 0; color: var(--muted); }

.mix-button {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  width: 100%;
  padding: 20px 22px;
  border: 0; border-radius: var(--radius);
  background: var(--accent); color: var(--accent-text);
  box-shadow: var(--shadow);
  text-align: left;
  transition: transform 0.1s ease;
}
.mix-button:active { transform: scale(0.98); }
.mix-title { font-size: 22px; font-weight: 700; }
.mix-sub { opacity: 0.85; font-size: 15px; }

.section-title { font-size: 15px; font-weight: 600; color: var(--muted); margin: 8px 0 0; text-transform: uppercase; letter-spacing: 0.04em; }

.topics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.topic-card {
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-align: left;
  transition: transform 0.1s ease, border-color 0.15s ease;
}
.topic-card:hover:not(:disabled) { border-color: var(--accent); }
.topic-card:active:not(:disabled) { transform: scale(0.98); }
.topic-card:disabled { opacity: 0.5; }
.topic-emoji { font-size: 30px; line-height: 1; }
.topic-name { font-weight: 650; line-height: 1.25; }
.topic-meta { font-size: 13px; color: var(--muted); }

@media (max-width: 360px) { .topics { grid-template-columns: 1fr; } }

/* ---- Питання ---- */
.q-header { display: flex; align-items: center; gap: 12px; }
.icon-button {
  width: 40px; height: 40px; flex: none;
  border-radius: 50%; border: 1px solid var(--border);
  background: var(--surface);
}
.dots { flex: 1; display: flex; gap: 6px; }
.dot { flex: 1; height: 8px; border-radius: 999px; background: var(--surface-2); }
.dot.is-current { background: var(--accent); opacity: 0.45; }
.dot.is-right { background: var(--right); }
.dot.is-wrong { background: var(--wrong); }
.q-score { font-weight: 650; white-space: nowrap; }

.q-tags { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { font-size: 14px; padding: 4px 10px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.chip-review { background: var(--accent-soft); color: var(--accent); }

.q-text { font-size: clamp(22px, 4.6vw, 28px); line-height: 1.3; margin: 4px 0 8px; letter-spacing: -0.01em; }

.options { display: grid; gap: 10px; }
@media (min-width: 620px) { .options { grid-template-columns: 1fr 1fr; } }

.option {
  display: flex; align-items: center; gap: 12px;
  min-height: 60px;
  padding: 12px 14px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 14px;
  text-align: left;
  transition: border-color 0.15s ease, background 0.15s ease, opacity 0.2s ease;
}
.option:hover:not(:disabled) { border-color: var(--accent); }
.option-key {
  flex: none; width: 30px; height: 30px; display: grid; place-items: center;
  border-radius: 8px; background: var(--surface-2); font-size: 14px; font-weight: 700; color: var(--muted);
}
.option.is-right { border-color: var(--right); background: var(--right-soft); }
.option.is-right .option-key { background: var(--right); color: #fff; }
.option.is-wrong { border-color: var(--wrong); background: var(--wrong-soft); }
.option.is-wrong .option-key { background: var(--wrong); color: #fff; }
.option.is-dim { opacity: 0.5; }

.explain {
  padding: 16px 18px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 6px solid var(--accent);
  box-shadow: var(--shadow);
  animation: fade 0.25s ease;
}
.explain.is-right { border-left-color: var(--right); }
.explain.is-wrong { border-left-color: var(--wrong); }
.explain p { margin: 0 0 8px; }
.explain-title { font-weight: 700; font-size: 19px; }
.explain.is-right .explain-title { color: var(--right); }
.explain.is-wrong .explain-title { color: var(--wrong); }
.source { display: inline-block; color: var(--muted); font-size: 14px; margin-bottom: 14px; }

.primary, .secondary {
  display: block; width: 100%;
  padding: 14px 18px;
  border-radius: 14px;
  font-weight: 650;
  border: 2px solid var(--accent);
}
.primary { background: var(--accent); color: var(--accent-text); }
.secondary { background: transparent; color: var(--accent); }

/* ---- Результат ---- */
.result-card {
  text-align: center;
  padding: 28px 16px;
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.result-cheer { font-size: 22px; font-weight: 700; margin: 0; }
.result-score { font-size: 56px; line-height: 1.1; margin: 8px 0 4px; }
.result-score b { color: var(--accent); }
.result-points { margin: 0; color: var(--muted); font-weight: 600; }

.mistakes ul { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 8px; }
.mistakes li {
  display: flex; flex-direction: column; gap: 2px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.mistakes li b { color: var(--right); }

.result-actions { display: grid; gap: 10px; margin-top: 8px; }
@media (min-width: 620px) { .result-actions { grid-template-columns: 1fr 1fr; } }

/* ---- Поділитися, спливаючі повідомлення, конфеті ---- */
.share-button {
  display: block; width: 100%;
  padding: 14px 18px;
  border-radius: 14px;
  border: 2px dashed var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 650;
}

.toast {
  position: fixed; left: 50%; bottom: max(24px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  max-width: calc(100% - 32px);
  padding: 12px 18px;
  border-radius: 999px;
  background: var(--text); color: var(--bg);
  font-weight: 650;
  box-shadow: var(--shadow);
  z-index: 20;
  animation: toast-in 0.25s ease;
  transition: opacity 0.4s ease;
}
.toast.is-celebrate { background: var(--accent); color: var(--accent-text); font-size: 19px; }
.toast.is-leaving { opacity: 0; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 12px); } }

.confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 10; }
.confetti span {
  position: absolute; top: -40px;
  font-size: 24px;
  animation: confetti-fall linear forwards;
}
@keyframes confetti-fall {
  to { transform: translateY(110vh) rotate(540deg); opacity: 0.3; }
}

/* ---- Рейтинг тижня ---- */
.leaderboard-button {
  display: block; width: 100%;
  padding: 16px 18px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow);
  font-weight: 700; font-size: 18px;
  text-align: left;
}
.leaderboard-button:hover { border-color: var(--accent); }

.lb-title { font-size: clamp(20px, 4.4vw, 26px); margin: 0; line-height: 1.2; }
.lb-note { text-align: left; font-size: 15px; }

.lb-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.lb-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.lb-row.is-me { border: 2px solid var(--accent); background: var(--accent-soft); }
.lb-rank { width: 32px; text-align: center; font-weight: 700; color: var(--muted); font-size: 18px; }
.lb-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.lb-name small { color: var(--muted); font-weight: 400; }
.lb-score { font-weight: 700; font-variant-numeric: tabular-nums; }
.lb-me { font-weight: 650; margin: 4px 0; }

.card {
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: grid; gap: 10px;
}
.card h2 { margin: 0; font-size: 19px; }
.card p { margin: 0; }
.join-row { display: flex; gap: 8px; }
.join-row input {
  flex: 1; min-width: 0;
  font: inherit; color: var(--text);
  padding: 12px 14px;
  border: 2px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
}
.join-row input:focus { outline: none; border-color: var(--accent); }
.join-row .primary { width: auto; }
.form-error { color: var(--wrong); font-weight: 600; }
.small-print { font-size: 14px; color: var(--muted); }

.lb-line { margin: 10px 0 0; font-weight: 600; color: var(--accent); min-height: 1.5em; }
.link-button { border: 0; background: none; color: var(--accent); font-weight: 650; text-decoration: underline; padding: 0; }

/* ---- Ліги друзів ---- */
.leagues { display: grid; gap: 10px; margin-top: 8px; }
.league-list { display: grid; gap: 8px; }
.league-card {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  width: 100%;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  text-align: left;
}
.league-card:hover { border-color: var(--accent); }
.league-name { font-weight: 700; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.league-meta { color: var(--muted); font-size: 14px; white-space: nowrap; }
.mini-form label { font-weight: 650; }
.code-card { justify-items: center; text-align: center; }
.league-code { font-size: 34px; font-weight: 800; letter-spacing: 0.12em; font-variant-numeric: tabular-nums; }
.code-card .primary { width: 100%; }
.leave-button { justify-self: center; color: var(--muted); margin-top: 8px; }
.league .lb-body { display: grid; gap: 10px; }
.invite-note { background: var(--accent-soft); border-color: var(--accent); font-weight: 600; }

/* ---- Дуелі ---- */
.challenge-button {
  display: block; width: 100%;
  padding: 14px 18px;
  border-radius: 14px;
  border: 2px solid var(--fire);
  background: transparent;
  color: var(--text);
  font-weight: 650;
}
.duel .lb-body, .duels-section { display: grid; gap: 10px; }
.duel-list { display: grid; gap: 8px; }
.duel-intro { text-align: center; justify-items: center; }
.duel-intro .primary { width: 100%; }
.duel-from { font-size: 20px; }
.duel-to-beat { font-size: 18px; }
.duel-result-title { font-size: 24px; font-weight: 800; margin: 0; }
.duel-score { font-size: 18px; font-weight: 650; color: var(--muted); margin: 0; }
.duel-outcome { text-align: center; justify-items: center; }
.duel-outcome .secondary { width: 100%; }

.compare-head, .compare-row { display: grid; grid-template-columns: 1fr 52px 52px; gap: 8px; align-items: center; }
.compare-head { font-size: 13px; font-weight: 650; color: var(--muted); text-align: center; }
.compare-head span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.compare-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.compare-row { padding: 12px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; }
.compare-q p { margin: 0; }
.compare-mark { text-align: center; font-size: 20px; }

/* ---- Рейтинг і випадковий суперник поруч ---- */
.social-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.social-row .leaderboard-button { font-size: 16px; }
@media (max-width: 360px) { .social-row { grid-template-columns: 1fr; } }

/* ---- Гра компанією ---- */
.social-row { grid-template-columns: 1fr 1fr; }
.social-row .group-button { grid-column: 1 / -1; background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
body.is-host-screen .app { max-width: 1200px; }
.room-menu select, .code-input {
  font: inherit; color: var(--text);
  padding: 12px 14px; border: 2px solid var(--border); border-radius: 12px; background: var(--bg);
}
.code-input { font-size: 26px; font-weight: 800; letter-spacing: 0.3em; text-transform: uppercase; text-align: center; }
.mini-form .primary { width: 100%; }
.join-row .primary { width: auto; }
.room-banner { background: var(--wrong-soft); border: 1px solid var(--wrong); border-radius: 12px; padding: 10px 14px; margin-bottom: 12px; font-weight: 600; }

.room-top { display: flex; align-items: center; gap: 12px; justify-content: space-between; color: var(--muted); font-weight: 600; }
.room-code-small { font-weight: 800; letter-spacing: 0.15em; color: var(--accent); }
.room-me { flex: 1; text-align: right; }
.room-lobby { display: grid; gap: 14px; justify-items: center; text-align: center; padding-top: 2vh; }
.room-join-at { font-size: clamp(18px, 2.4vw, 28px); margin: 0; }
.room-big-code { font-size: clamp(64px, 14vw, 180px); font-weight: 900; letter-spacing: 0.15em; margin: 0; color: var(--accent); line-height: 1; }
.room-chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; max-width: 900px; }
.room-chip { padding: 8px 14px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); font-weight: 650; font-size: clamp(15px, 1.8vw, 22px); animation: fade 0.3s ease; }
.room-count { font-weight: 700; margin: 0; }
.room-main-button { max-width: 420px; justify-self: center; font-size: 20px; }

.room-question { font-size: clamp(24px, 3.6vw, 48px); line-height: 1.2; margin: 8px 0; text-align: center; }
.timer-row { display: flex; align-items: center; gap: 10px; }
.timer-bar { flex: 1; height: 10px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.timer-bar > span { display: block; height: 100%; background: var(--fire); border-radius: inherit; transition: width 0.2s linear; }
.timer-secs { font-weight: 800; min-width: 2ch; text-align: right; font-variant-numeric: tabular-nums; }

.room-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.room-tile, .room-answer {
  position: relative; overflow: hidden;
  display: flex; align-items: center; gap: 12px;
  padding: 18px 20px; border-radius: 16px; border: 0;
  color: #fff; font-weight: 700; font-size: clamp(17px, 2.2vw, 30px); text-align: left;
  min-height: 72px;
}
.tile-a { background: #d9473f; } .tile-b { background: #2f6fde; } .tile-c { background: #1f9d63; } .tile-d { background: #c98a00; }
.tile-num { flex: none; width: 1.6em; height: 1.6em; display: grid; place-items: center; border-radius: 10px; background: rgb(255 255 255 / 0.25); font-weight: 800; }
.tile-text { flex: 1; position: relative; z-index: 1; }
.tile-count { position: relative; z-index: 1; font-weight: 800; }
.tile-bar { position: absolute; left: 0; top: 0; bottom: 0; background: rgb(255 255 255 / 0.18); }
.room-tile.is-dim { opacity: 0.35; }
.room-tile.is-right { outline: 5px solid var(--text); outline-offset: -5px; }
.room-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-weight: 650; }
.room-footer .secondary { width: auto; }
.room-reveal { display: grid; grid-template-columns: 1.3fr 1fr; gap: 12px; }
.room-why p { font-size: clamp(16px, 1.8vw, 24px); }
.room-scores { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.room-scores li { display: flex; align-items: center; gap: 10px; padding: 6px 4px; border-bottom: 1px solid var(--border); }
.room-scores li.is-me { font-weight: 800; color: var(--accent); }
.room-scores li.is-away { opacity: 0.5; }
.room-plus { color: var(--right); font-weight: 700; font-size: 14px; }
.podium { display: flex; justify-content: center; align-items: flex-end; gap: 12px; }
.podium-step { display: grid; justify-items: center; gap: 6px; padding: 16px 12px; border-radius: 16px 16px 0 0; background: var(--accent-soft); min-width: 120px; }
.step-1 { padding-top: 40px; } .step-2 { padding-top: 24px; }
.podium-medal { font-size: 44px; } .podium-name { font-weight: 800; font-size: 20px; } .podium-score { font-weight: 700; color: var(--muted); }
.room-learned { margin: 0; padding-left: 1.2em; display: grid; gap: 6px; }

.room-player .q-text { text-align: center; }
.room-answer-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.room-answer { min-height: 110px; flex-direction: column; justify-content: center; text-align: center; font-size: 18px; }
.room-answer.is-picked { outline: 4px solid var(--text); }
.room-answer:disabled:not(.is-picked) { opacity: 0.45; }
.room-wait { text-align: center; justify-items: center; }
.room-big-emoji { font-size: 56px; margin: 0; }
.room-result { text-align: center; border-left: 6px solid var(--right); }
.room-result.is-wrong { border-left-color: var(--wrong); }
.room-result-title { font-size: 26px; font-weight: 800; }
.room-place { text-align: center; font-size: 18px; }
@media (max-width: 700px) {
  .room-reveal { grid-template-columns: 1fr; }
  .room-tiles { grid-template-columns: 1fr; }
}
/* Host buttons always visible, even on small laptop screens */
.room-host .room-main-button, .room-host .room-footer { position: sticky; bottom: 12px; z-index: 5; }
.room-host .room-footer { background: var(--bg); padding: 8px 0; }
.room-host .room-main-button { box-shadow: var(--shadow); width: 100%; }

/* Second line under a question (e.g. Ukrainian translation of an English citizenship question) */
.q-translation { display: block; margin-top: 6px; font-size: 0.7em; font-weight: 500; color: var(--muted); line-height: 1.35; }

/* Citizenship test: the "📍 your state" link under the topics */
.state-link { justify-self: start; margin-top: -4px; font-size: 15px; }
.mini-form select { font: inherit; color: var(--text); padding: 12px 14px; border: 2px solid var(--border); border-radius: 12px; background: var(--bg); }
.mini-form input { font: inherit; color: var(--text); padding: 12px 14px; border: 2px solid var(--border); border-radius: 12px; background: var(--bg); }

/* ---- ⚙️ Settings ---- */
.top-row .settings-button { flex: none; font-size: 20px; }
.settings .card h2 { font-size: 17px; }
.choice-row { display: flex; gap: 8px; flex-wrap: wrap; }
.choice {
  flex: 1; min-width: 64px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 2px solid var(--border);
  background: var(--bg);
  font-weight: 700;
}
.choice.is-active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.secondary.danger { border-color: var(--wrong); color: var(--wrong); }
/* Keep form rows inside their card on narrow phones */
.card > * { min-width: 0; }
.join-row input { width: 100%; }
.join-row .primary { flex: none; }

/* ---- 👋 Welcome (first visit) ---- */
.welcome .hero { text-align: center; }
.welcome .mini-form label h2 { margin: 0; font-size: 17px; }
.welcome-note { text-align: center; }

/* ---- Front screen: two big doors ---- */
.home .hero { text-align: center; }
.door-button {
  display: flex; align-items: center; gap: 16px;
  width: 100%;
  padding: 22px 20px;
  border-radius: var(--radius);
  border: 0;
  box-shadow: var(--shadow);
  text-align: left;
  transition: transform 0.1s ease;
}
.door-button:active { transform: scale(0.98); }
.door-daily { background: var(--accent); color: var(--accent-text); }
.door-group { background: var(--surface); border: 2px solid var(--accent); }
.door-emoji { font-size: 40px; line-height: 1; }
.door-text { display: grid; gap: 2px; }
.door-title { font-size: 22px; font-weight: 800; }
.door-sub { font-size: 15px; opacity: 0.85; }
.home .social-row { margin-top: 4px; }
.dice { width: auto; flex: none; font-size: 20px; padding: 10px 14px; }
.welcome .choice-row { justify-content: center; }

/* ---- 🎤 Interview practice ---- */
.door-interview { background: var(--surface); border: 2px solid var(--right); }
.interview-steps { margin: 8px 0 0; padding-left: 1.2em; display: grid; gap: 6px; }
.check-row { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; }
.check-row input { width: 22px; height: 22px; flex: none; margin-top: 2px; }
.interview-count { flex: 1; text-align: right; font-weight: 650; color: var(--muted); }
.interview-question .q-text { margin: 4px 0 8px; }
.interview-question .secondary { width: auto; justify-self: start; }
.interview-main-answer { font-size: 22px; font-weight: 800; color: var(--right); margin: 4px 0; }
.interview .card { display: grid; gap: 8px; }
.interview-answer { display: grid; gap: 10px; }


/* ---- 🚩 Report a mistake: a quiet flag in the corner ---- */
.explain, .interview-answer .card { position: relative; }
.report-flag {
  position: absolute; top: 10px; right: 10px;
  width: 32px; height: 32px; border-radius: 50%;
  border: 0; background: transparent;
  font-size: 15px; opacity: 0.45;
  transition: opacity 0.15s ease, background 0.15s ease;
}
.report-flag:hover, .report-flag:focus-visible { opacity: 1; background: var(--surface-2); }
.report-flag:disabled { opacity: 0.8; color: var(--right); font-weight: 800; }
.explain .explain-title { padding-right: 36px; }
.report-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }
.report-chip {
  padding: 6px 12px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface-2);
  font-size: 14px; color: var(--muted);
}
.report-chip:hover { border-color: var(--wrong); color: var(--text); }
.report-thanks { font-size: 14px; color: var(--right); margin: 0 0 12px; }

/* ---- Home: daily round first, progress always on top ---- */
.home-head { display: flex; align-items: center; gap: 8px; }
.home-title { flex: 1; min-width: 0; margin: 0; font-size: 26px; letter-spacing: -0.02em; }
.home-icons { display: flex; gap: 4px; flex: none; }
.home-icons .icon-button { font-size: 20px; }
.progress-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 10px 12px;
}
.progress-card .stat { border: 0; background: transparent; padding: 4px 6px; }
.civics-line { display: block; padding: 4px 6px 0; font-size: 14px; text-align: left; }
.today-card {
  display: grid; gap: 4px;
  background: var(--accent); color: var(--accent-text);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 22px 20px 14px;
}
.today-title { margin: 0; font-size: 24px; font-weight: 800; }
.today-sub { margin: 0; font-size: 15px; opacity: 0.85; }
.today-start {
  margin-top: 12px; padding: 15px;
  border: 0; border-radius: 12px;
  background: var(--accent-text); color: var(--accent);
  font-size: 20px; font-weight: 800;
  transition: transform 0.1s ease;
}
.today-start:active { transform: scale(0.98); }
.today-topics { justify-self: center; color: var(--accent-text); opacity: 0.9; padding: 8px; }
.home .social-row .leaderboard-button { font-size: 15px; }

/* ---- 📊 My stats ---- */
.stat-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.stat-tile { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; }
.stat-tile b { display: block; font-size: 26px; line-height: 1.2; }
.stat-tile span { font-size: 13px; color: var(--muted); }
.civics-big { margin: 0 0 8px; font-weight: 700; }
.big-bar { display: block; height: 12px; }
.tstats { display: grid; }
.tstat { display: grid; gap: 6px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.tstat .bar { display: block; }
.tstat-head { display: flex; justify-content: space-between; gap: 4px 10px; flex-wrap: wrap; }
.tstat-name { font-weight: 650; }
.tstat-meta { font-size: 14px; color: var(--muted); }
.tstat.is-empty { opacity: 0.55; }

/* ---- Flag pictures above a question ---- */
.q-image {
  display: block; margin: 4px auto 12px;
  max-width: min(100%, 300px); max-height: 180px;
  border: 1px solid var(--border); border-radius: 6px;
  background: #fff;
}
.room-image { max-width: min(100%, 520px); max-height: 32vh; }

/* ---- 🔁 Review ladder note ---- */
.review-note { margin: 0 0 8px; font-size: 15px; font-weight: 650; color: var(--right); }

/* ---- 🎯 Custom game ---- */
.door-custom { background: var(--surface); border: 2px solid var(--accent); }
.pick-row { display: flex; flex-wrap: wrap; gap: 8px; }
.pick-chip {
  padding: 8px 12px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface);
  font-size: 15px; color: var(--text);
}
.pick-chip.is-on { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.pick-chip.is-some { border-color: var(--accent); border-style: dashed; }
.pick-count { font-size: 12px; opacity: 0.7; margin-left: 2px; }
.continent { display: grid; gap: 8px; }
.continent-row { display: flex; align-items: center; gap: 6px; }
.continent-open { width: 36px; height: 36px; font-size: 16px; }
.countries { padding-left: 12px; }
.custom-footer {
  position: sticky; bottom: 0; display: grid; gap: 8px;
  padding: 12px 0 calc(12px + env(safe-area-inset-bottom));
  background: var(--bg);
  border-top: 1px solid var(--border);
}
.custom-count { margin: 0; font-weight: 700; }

.custom-buttons { display: grid; grid-template-columns: auto 1fr; gap: 8px; }
.custom-buttons .secondary { white-space: nowrap; }
.one-topic { font-size: 15px; }

/* ---- 🃏 Flashcards ---- */
.card-front { font-size: clamp(24px, 6vw, 32px); text-align: center; margin: 24px 0 8px; }
.card-type { display: grid; gap: 10px; }
.card-type input { font-size: 20px; padding: 14px 16px; border-radius: 12px; border: 2px solid var(--border); background: var(--surface); color: var(--text); text-align: center; }
.card-type input:focus { border-color: var(--accent); outline: none; }
.card-type .link-button { justify-self: center; }
.card-back { animation: card-flip 0.35s ease; transform-origin: center; }
@keyframes card-flip { from { transform: perspective(800px) rotateY(80deg); opacity: 0.3; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .card-back { animation: none; } }
.card-answer { font-size: 24px; font-weight: 800; margin: 4px 0; }
.card-typed { margin: 0 0 8px; font-weight: 650; }

/* Hidden parts of a card stay hidden even though these blocks use display: grid */
.options[hidden], .card-type[hidden] { display: none; }

/* ---- 🎮 Mini-games / 🧠 Find the pair ---- */
.social-row .mini-games-button { grid-column: 1 / -1; }
.door-soon { opacity: 0.55; background: var(--surface); border: 2px dashed var(--border); cursor: default; }
.pairs-levels { display: grid; gap: 10px; }
.pairs-level { background: var(--surface); border: 2px solid var(--accent); }
.pairs-stats { flex: 1; margin: 0; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.pairs-countdown { display: flex; align-items: baseline; justify-content: center; gap: 10px; font-size: 18px; font-weight: 700; color: var(--accent); }
.pairs-countdown b { font-size: 34px; }
.pairs-board {
  display: grid; gap: 8px;
  grid-template-columns: repeat(var(--cols), 1fr);
  width: min(100%, calc((100dvh - 190px) / var(--rows) * var(--cols)), 520px);
  margin: 0 auto;
}
.pair-card {
  position: relative; aspect-ratio: 1; padding: 0;
  border: 0; border-radius: 14px; background: transparent;
  perspective: 600px;
}
.pair-face {
  position: absolute; inset: 0; display: grid; place-items: center;
  border-radius: 14px; backface-visibility: hidden;
  transition: transform 0.3s ease;
}
.pair-back { background: var(--accent); color: var(--accent-text); font-size: 26px; font-weight: 800; box-shadow: var(--shadow); }
.pair-front { background: var(--surface); border: 2px solid var(--border); font-size: clamp(28px, 9vw, 44px); transform: rotateY(180deg); }
.pair-card.is-open .pair-back { transform: rotateY(180deg); }
.pair-card.is-open .pair-front { transform: rotateY(0deg); }
.pair-card.is-done .pair-front { border-color: var(--right); background: color-mix(in srgb, var(--right) 12%, var(--surface)); }
@media (prefers-reduced-motion: reduce) { .pair-face { transition: none; } }
.pairs-result { text-align: center; }
.pairs-stars { font-size: 40px; margin: 24px 0 0; letter-spacing: 4px; }
.pairs-newbest { font-weight: 800; color: var(--right); }

/* ---- 😀 Guess by emoji ---- */
.q-header-fill { flex: 1; }
.emoji-row { font-size: clamp(44px, 14vw, 72px); text-align: center; margin: 20px 0 8px; letter-spacing: 6px; line-height: 1.2; }
.emoji-hints { display: grid; gap: 6px; text-align: center; }
.emoji-hint { margin: 0; font-size: 16px; color: var(--muted); }
.emoji-pattern { letter-spacing: 2px; color: var(--text); }
.emoji-stars { margin-left: 6px; }
.emoji-summary { text-align: center; }
.emoji-squares { font-size: 40px; letter-spacing: 6px; margin: 12px 0 4px; }
.pattern-word { white-space: nowrap; display: inline-block; margin: 0 6px; }

/* 🧊 streak freezes next to the 🔥 */
.stat-freeze { flex: none; }

/* 🧩 question style badge */
.chip-style { background: var(--surface); border: 1px solid var(--border); color: var(--text); }

/* ---- Progress strip on every screen ---- */
.statusbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--bg);
  padding: max(8px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 6px max(16px, env(safe-area-inset-left));
  border-bottom: 1px solid var(--border);
}
.statusbar-inner {
  display: flex; align-items: center; gap: 14px;
  width: 100%; max-width: 648px; margin: 0 auto; padding: 4px 2px;
  border: 0; background: transparent; color: var(--text);
  font-size: 15px; font-variant-numeric: tabular-nums; text-align: left;
}
.statusbar-inner .is-off { filter: grayscale(1); opacity: 0.6; }
.statusbar-level { display: flex; align-items: center; gap: 6px; flex: 1; min-width: 0; white-space: nowrap; }
.statusbar-level .bar { min-width: 40px; }
body.has-statusbar .app { padding-top: 12px; }
.statusbar-row { display: flex; align-items: center; gap: 8px; max-width: 648px; margin: 0 auto; }
.statusbar-row .statusbar-inner { flex: 1; min-width: 0; margin: 0; }
.statusbar-settings { flex: none; width: 36px; height: 36px; font-size: 18px; }

/* the strip now uses the home-screen progress card (scrolls with the page) */
.statusbar { position: static; background: transparent; border-bottom: 0; padding-bottom: 0; }
.statusbar-row { align-items: flex-start; }
.statusbar-card { flex: 1; min-width: 0; cursor: pointer; }
.statusbar-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.statusbar-settings { margin-top: 6px; }

/* ---- One shared top on every screen ---- */
.statusbar { padding-bottom: 0; }
.topbar { max-width: 648px; margin: 0 auto; display: grid; gap: 10px; }
.topbar-row { display: flex; align-items: center; gap: 8px; }
.topbar-title { flex: 1; min-width: 0; margin: 0; font-size: 22px; line-height: 1.2; overflow-wrap: anywhere; }
.topbar-title.is-home { font-size: 26px; letter-spacing: -0.02em; }
.app-logo { width: 34px; height: 34px; flex: none; }
.welcome-logo { display: block; width: 88px; height: 88px; margin: 0 auto 8px; }
.q-header.is-moved, body.has-statusbar .home-head { display: none; }
