*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #f3f1ec;
  --bg-accent: #e8e4dc;
  --surface: #ffffff;
  --text: #1c1c1c;
  --text-muted: #6f6c66;
  --text-subtle: #9b978f;
  --accent: #722F37;
  --accent-hover: #5a252c;
  --accent-light: #f3e8e9;
  --accent-shadow: rgba(114, 47, 55, 0.28);
  --plus: #722F37;
  --plus-light: #f3e8e9;
  --border: #ddd9d2;
  --correct: #722F37;
  --correct-bg: #722F37;
  --correct-text: #ffffff;
  --feedback-correct: #2d6a4f;
  --feedback-correct-bg: #2d6a4f;
  --feedback-wrong: #b54848;
  --feedback-wrong-bg: #b54848;
  --wrong: #c45c4e;
  --wrong-bg: #c45c4e;
  --wrong-text: #ffffff;
  --answer-bg: #f0eeea;
  --answer-border: #d5d0c8;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 3px rgba(28, 28, 28, 0.06);
  --shadow-md: 0 4px 16px rgba(28, 28, 28, 0.08);
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: "DM Sans", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  background-image:
    radial-gradient(ellipse at 20% 0%, rgba(114, 47, 55, 0.06) 0%, transparent 55%),
    radial-gradient(ellipse at 80% 100%, rgba(114, 47, 55, 0.04) 0%, transparent 50%);
  color: var(--text);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 1.25rem 2rem;
  line-height: 1.6;
}

/* ── Shared components ── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 300px;
  padding: 0.9375rem 2rem;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-decoration: none;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.btn--primary {
  color: #fff;
  background-color: var(--accent);
  box-shadow: 0 4px 14px var(--accent-shadow);
}

.btn--primary:hover {
  background-color: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px var(--accent-shadow);
}

.btn--primary:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px var(--accent-shadow);
}

.btn--primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn--secondary {
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.btn--secondary:hover {
  background: var(--bg-accent);
  transform: translateY(-1px);
}

.btn--full {
  max-width: none;
  width: 100%;
}

.btn--lg {
  padding: 1.0625rem 2.25rem;
  font-size: 1.0625rem;
  max-width: 340px;
}

.animate-in {
  animation: fadeUp 0.45s ease;
}

.history-locked-note {
  font-size: 0.8125rem;
  color: var(--text-muted);
  text-align: center;
  padding: 0.875rem;
  background: var(--accent-light);
  border-radius: var(--radius-sm);
}

.history-locked-note a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}

.plus-tier__price {
  margin-top: 0.875rem;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--accent);
}

.plus-tier__or {
  font-weight: 400;
  color: var(--text-muted);
  margin: 0 0.25rem;
}

.plus-tier__savings {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.pricing-card__amount {
  margin-bottom: 0.75rem;
}

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

  .plus-comparison {
    grid-template-columns: 1fr;
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
  }

  body {
    padding: 0 1rem 1.5rem;
  }

  .site-nav__links {
    gap: 0.375rem;
  }

  .site-nav__link {
    font-size: 0.75rem;
    padding: 0.3rem 0.4rem;
  }
}

/* ── Site navigation ── */

.site-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 440px;
  padding: 1rem 0 0.75rem;
  margin-bottom: 0.5rem;
}

.site-nav__brand {
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  text-decoration: none;
}

.site-nav__links {
  display: flex;
  align-items: center;
  gap: 0.625rem;
}

.site-nav__link {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  padding: 0.375rem 0.5rem;
  border-radius: 6px;
  transition: color 0.15s ease, background 0.15s ease;
}

.site-nav__link:hover {
  color: var(--text);
  background: var(--bg-accent);
}

.site-nav__link--cta {
  color: var(--accent);
  font-weight: 600;
}

.site-nav__link--plus {
  color: var(--plus);
  font-weight: 600;
}

.site-nav__link--muted {
  color: var(--text-muted);
}

.site-nav__btn {
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.375rem 0.5rem;
  border-radius: 6px;
}

.site-nav__btn:hover {
  color: var(--text);
  background: var(--bg-accent);
}

/* ── Homepage ── */

.page {
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 1.5rem;
}

.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.logo {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 0.5rem;
}

.logo-bar {
  display: block;
  height: 6px;
  border-radius: 3px;
  background-color: var(--accent);
}

.logo-bar:nth-child(1) { width: 28px; }
.logo-bar:nth-child(2) { width: 40px; }
.logo-bar:nth-child(3) { width: 22px; }

.title {
  font-size: clamp(2.75rem, 10vw, 3.5rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.tagline {
  font-size: 1.125rem;
  color: var(--text-muted);
}

.description {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  width: 100%;
  box-shadow: var(--shadow-sm);
}

.description p {
  font-size: 1rem;
  color: var(--text-muted);
  line-height: 1.65;
}

.footer p {
  font-size: 0.875rem;
  color: var(--text-subtle);
}

/* ── Site footer ── */

.site-footer {
  width: 100%;
  max-width: 440px;
  margin-top: auto;
  padding: 1.5rem 0 0.5rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.site-footer__links {
  display: flex;
  justify-content: center;
  gap: 1.25rem;
}

.site-footer__links a {
  font-size: 0.8125rem;
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
}

.site-footer__links a:hover {
  color: var(--accent);
}

.site-footer__copy {
  font-size: 0.75rem;
  color: var(--text-subtle);
}

/* ── Legal pages ── */

.page--legal {
  max-width: 640px;
  text-align: left;
  align-items: stretch;
}

.legal-header {
  text-align: center;
  margin-bottom: 0.5rem;
}

.legal-header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.legal-header__updated {
  font-size: 0.8125rem;
  color: var(--text-subtle);
  margin-top: 0.375rem;
}

.legal-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem 1.25rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.legal-content section h2 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--text);
}

.legal-content section p,
.legal-content section li {
  font-size: 0.9375rem;
  color: var(--text-muted);
  line-height: 1.65;
}

.legal-content section ul {
  padding-left: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.legal-content a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}

/* ── Auth extras ── */

.form-field__link {
  align-self: flex-end;
  font-size: 0.8125rem;
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
  margin-top: 0.25rem;
}

.form-field__link:hover {
  text-decoration: underline;
}

.form-success {
  font-size: 0.875rem;
  color: var(--feedback-correct);
  text-align: center;
}

.dev-reset-link {
  font-size: 0.8125rem;
  color: var(--text-muted);
  background: var(--bg);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  text-align: left;
  word-break: break-all;
}

.dev-reset-link a {
  color: var(--accent);
  font-weight: 600;
}

.auth-message {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  width: 100%;
}

/* ── Profile location ── */

.location-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.location-section__hint {
  font-size: 0.8125rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.location-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* ── Leaderboards ── */

.leaderboard-body {
  align-items: center;
}

.page--leaderboard {
  max-width: 520px;
  text-align: center;
}

.leaderboard-header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-top: 0.5rem;
}

.leaderboard-header__subtitle {
  font-size: 0.9375rem;
  color: var(--text-muted);
  margin-top: 0.375rem;
}

.leaderboard-tabs {
  display: flex;
  gap: 0.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.25rem;
  margin-bottom: 1rem;
}

.leaderboard-tabs__btn {
  flex: 1;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.625rem 1rem;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.leaderboard-tabs__btn--active {
  background: var(--accent);
  color: #fff;
}

.leaderboard-location-label {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  text-align: left;
}

.location-prompt {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem;
  margin-bottom: 1rem;
  text-align: left;
}

.location-prompt p {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.location-prompt a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}

.location-quick-form {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.location-quick-form input {
  font-family: inherit;
  font-size: 1rem;
  padding: 0.75rem 0.875rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
}

.btn--compact {
  max-width: none;
  width: auto;
  padding: 0.625rem 1rem;
  font-size: 0.875rem;
}

.leaderboard-loading,
.leaderboard-empty {
  font-size: 0.9375rem;
  color: var(--text-muted);
  padding: 1.5rem 0;
}

.leaderboard-table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.leaderboard-table {
  width: 100%;
  min-width: 320px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.leaderboard-table__head,
.leaderboard-table__row {
  display: grid;
  grid-template-columns: 2.5rem 1fr 3rem 3rem 3.5rem;
  gap: 0.5rem;
  align-items: center;
  padding: 0.75rem 1rem;
  font-size: 0.8125rem;
}

.leaderboard-table__head {
  background: var(--bg);
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.6875rem;
  border-bottom: 1px solid var(--border);
}

.leaderboard-table__row {
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

.leaderboard-table__row:last-child {
  border-bottom: none;
}

.leaderboard-table__row--you {
  background: var(--accent-light);
}

.leaderboard-table__rank {
  font-weight: 700;
  color: var(--accent);
}

.leaderboard-table__name {
  font-weight: 600;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leaderboard-locked__preview {
  position: relative;
  margin-top: 0.5rem;
}

.leaderboard-table--preview {
  filter: blur(0.5px);
  opacity: 0.85;
}

.leaderboard-table__row--blur {
  color: var(--text-subtle);
}

.leaderboard-locked__overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.625rem;
  padding: 1.5rem;
  background: rgba(243, 241, 236, 0.88);
  border-radius: var(--radius-md);
  text-align: center;
}

.leaderboard-locked__icon {
  font-size: 2rem;
}

.leaderboard-locked__overlay h2 {
  font-size: 1.125rem;
  font-weight: 700;
}

.leaderboard-locked__overlay p {
  font-size: 0.875rem;
  color: var(--text-muted);
  max-width: 280px;
}

.leaderboard-locked__count {
  font-size: 0.8125rem;
  color: var(--text-subtle);
}

.leaderboard-locked__overlay .btn {
  max-width: 240px;
}

@media (max-width: 400px) {
  .leaderboard-table__head,
  .leaderboard-table__row {
    grid-template-columns: 2rem 1fr 2.5rem 2.5rem 3rem;
    padding: 0.625rem 0.75rem;
    font-size: 0.75rem;
  }

  .site-nav__links {
    gap: 0.5rem;
  }

  .site-nav__link {
    font-size: 0.8125rem;
  }
}

/* ── Game layout ── */

.game-body {
  align-items: center;
  padding-top: 0;
  padding-bottom: 0;
}

.game {
  width: 100%;
  max-width: 440px;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding-bottom: 1.5rem;
  min-height: 100dvh;
}

.game-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding-bottom: 0.25rem;
}

.game-header__back {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
  transition: background-color 0.15s ease;
}

.game-header__back:hover {
  background: var(--bg-accent);
}

.game-header__top {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.game-header__brand h1 {
  font-size: 1.375rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.game-header__date {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.puzzle-badge {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-light);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
}

/* ── Quiz card ── */

.quiz-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.375rem 1.25rem;
  box-shadow: var(--shadow-sm);
}

.category-badge {
  display: inline-block;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-light);
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  margin-bottom: 0.875rem;
}

.quiz-question {
  font-size: 1.125rem;
  font-weight: 600;
  line-height: 1.45;
  letter-spacing: -0.02em;
}

/* ── Play area ── */

.play-area {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  flex: 1;
}

.play-area--locked .game-board {
  pointer-events: none;
}

.game-board {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem;
  box-shadow: var(--shadow-sm);
}

.game-board__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.875rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.game-board__step {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-subtle);
  flex-shrink: 0;
}

.play-hint {
  font-size: 0.8125rem;
  color: var(--text-muted);
  font-weight: 500;
  text-align: left;
  transition: color 0.25s ease;
}

.game-footer {
  position: sticky;
  bottom: 0;
  padding: 0.75rem 0 max(1rem, env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--bg) 70%, transparent);
  margin: 0 -0.25rem;
  padding-left: 0.25rem;
  padding-right: 0.25rem;
}

.ranking-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  width: 100%;
}

.rank-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.125rem;
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  cursor: grab;
  touch-action: none;
  user-select: none;
  box-shadow: var(--shadow-sm);
  transition:
    background-color 0.45s cubic-bezier(0.4, 0, 0.2, 1),
    border-color 0.45s cubic-bezier(0.4, 0, 0.2, 1),
    color 0.35s ease,
    transform 0.35s cubic-bezier(0.4, 0, 0.2, 1),
    box-shadow 0.35s ease;
}

.rank-item:hover:not(.rank-item--locked) {
  border-color: #c8c3bb;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.rank-item:active:not(.rank-item--locked) {
  cursor: grabbing;
}

.rank-item.dragging {
  opacity: 0.65;
  transform: scale(0.98);
  box-shadow: var(--shadow-md);
  z-index: 2;
}

.rank-item--locked {
  cursor: default;
}

.rank-item--revealed.rank-item--correct {
  background: var(--feedback-correct-bg);
  border-color: var(--feedback-correct-bg);
  color: var(--correct-text);
  animation: feedbackReveal 0.45s cubic-bezier(0.34, 1.4, 0.64, 1);
}

.rank-item--revealed.rank-item--wrong {
  background: var(--feedback-wrong-bg);
  border-color: var(--feedback-wrong-bg);
  color: var(--wrong-text);
  animation: feedbackReveal 0.45s cubic-bezier(0.34, 1.4, 0.64, 1);
}

@keyframes feedbackReveal {
  0% {
    transform: scale(1);
  }
  40% {
    transform: scale(1.025);
  }
  100% {
    transform: scale(1);
  }
}

.rank-item__handle {
  color: var(--text-subtle);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  transition: opacity 0.3s ease;
}

.rank-item--locked .rank-item__handle {
  opacity: 0;
  width: 0;
  overflow: hidden;
}

.rank-item__position {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  background: var(--surface);
  border: 1.5px solid var(--border);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  flex-shrink: 0;
  transition: background-color 0.35s ease, border-color 0.35s ease, color 0.35s ease;
}

.rank-item--correct .rank-item__position,
.rank-item--wrong .rank-item__position {
  background: rgba(255, 255, 255, 0.2);
  border-color: transparent;
  color: inherit;
}

.rank-item__label {
  flex: 1;
  font-size: 1rem;
  font-weight: 600;
  text-align: left;
  letter-spacing: -0.01em;
  line-height: 1.3;
}

.rank-item__status {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  font-size: 0.875rem;
  font-weight: 700;
  opacity: 0;
  transform: scale(0.5);
  transition: opacity 0.3s ease 0.1s, transform 0.35s cubic-bezier(0.34, 1.4, 0.64, 1) 0.1s;
  flex-shrink: 0;
}

.rank-item--revealed .rank-item__status {
  opacity: 1;
  transform: scale(1);
}

.game-submit {
  max-width: none;
  width: 100%;
  padding: 1.0625rem 2rem;
  font-size: 1.0625rem;
  border-radius: var(--radius-md);
}

/* ── Results ── */

.results {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  animation: fadeUp 0.4s ease;
}

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

.score-card {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-md);
}

.score-card--perfect {
  border-color: var(--feedback-correct);
  background: linear-gradient(135deg, #edf5f0 0%, var(--surface) 100%);
}

.score-card__ring {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 5rem;
  height: 5rem;
  border-radius: 50%;
  border: 3px solid var(--accent);
  flex-shrink: 0;
}

.score-card--perfect .score-card__ring {
  border-color: var(--feedback-correct);
  background: #edf5f0;
}

.score-card__value {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--accent);
}

.score-card--perfect .score-card__value {
  color: var(--feedback-correct);
}

.score-card__meta {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.score-card__label {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
}

.score-card__detail {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.results-section__title {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-subtle);
  margin-bottom: 0.625rem;
}

.result-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.result-list--animated .result-row {
  animation: fadeUp 0.4s ease backwards;
}

.result-list--animated .result-row:nth-child(1) { animation-delay: 0.05s; }
.result-list--animated .result-row:nth-child(2) { animation-delay: 0.1s; }
.result-list--animated .result-row:nth-child(3) { animation-delay: 0.15s; }
.result-list--animated .result-row:nth-child(4) { animation-delay: 0.2s; }
.result-list--animated .result-row:nth-child(5) { animation-delay: 0.25s; }

.result-row {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  border-radius: var(--radius-sm);
  border: 1.5px solid transparent;
}

.result-row--correct {
  background: var(--feedback-correct-bg);
  border-color: var(--feedback-correct-bg);
  color: var(--correct-text);
}

.result-row--wrong {
  background: var(--feedback-wrong-bg);
  border-color: var(--feedback-wrong-bg);
  color: var(--wrong-text);
}

.result-row--answer {
  background: var(--answer-bg);
  border-color: var(--answer-border);
  color: var(--text);
}

.result-row__position {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.625rem;
  height: 1.625rem;
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 0.1rem;
}

.result-row--correct .result-row__position,
.result-row--wrong .result-row__position {
  background: rgba(255, 255, 255, 0.2);
}

.result-row--answer .result-row__position {
  background: var(--surface);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.result-row__content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.result-row__label {
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.3;
}

.result-row__stat {
  font-size: 0.8125rem;
  line-height: 1.4;
  opacity: 0.9;
}

.result-row--answer .result-row__stat {
  color: var(--text-muted);
}

.result-row__stat-label {
  font-weight: 500;
}

.btn--primary:disabled,
.btn--disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
  transform: none;
  box-shadow: none;
}

/* ── Homepage streak & archive ── */

.streak-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.125rem 1.5rem;
  width: 100%;
  box-shadow: var(--shadow-sm);
}

.streak-card__icon {
  font-size: 1.75rem;
  line-height: 1;
}

.streak-card__meta {
  display: flex;
  align-items: baseline;
  gap: 0.375rem;
}

.streak-card__value {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--accent);
  line-height: 1;
}

.streak-card__label {
  font-size: 0.9375rem;
  color: var(--text-muted);
  font-weight: 500;
}

.home-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
}

.today-status {
  font-size: 0.875rem;
  color: var(--text-muted);
  font-weight: 500;
}

.archive {
  width: 100%;
  text-align: left;
}

.archive__title {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-subtle);
  margin-bottom: 0.75rem;
}

.archive-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.archive-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.archive-item:hover {
  border-color: #c8c3bb;
  transform: translateY(-1px);
}

.archive-item--today {
  border-color: var(--accent);
  background: linear-gradient(135deg, #faf5f5 0%, var(--surface) 100%);
}

.archive-item--completed .archive-item__score {
  color: var(--accent);
}

.archive-item__left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.archive-item__number {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-subtle);
  flex-shrink: 0;
  width: 1.75rem;
}

.archive-item__info {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.archive-item__date {
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.3;
}

.archive-item__category {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.archive-item__score {
  font-size: 1rem;
  font-weight: 700;
  flex-shrink: 0;
  min-width: 2rem;
  text-align: right;
}

.archive-item__score--empty {
  color: var(--text-subtle);
  font-weight: 500;
}

.archive-empty {
  font-size: 0.875rem;
  color: var(--text-muted);
  text-align: center;
  padding: 1rem;
}

.archive-locked-note {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  margin-bottom: 0.625rem;
}

.archive-locked-note a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}

.archive-item--locked {
  opacity: 0.65;
  cursor: not-allowed;
  pointer-events: none;
  background: var(--bg-accent);
}

.archive-item__lock {
  font-size: 0.875rem;
  flex-shrink: 0;
}

/* ── Auth pages ── */

.page--auth {
  padding-top: 1rem;
}

.auth-header {
  text-align: center;
  width: 100%;
}

.auth-header__title {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.375rem;
}

.auth-header__subtitle {
  font-size: 0.9375rem;
  color: var(--text-muted);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  text-align: left;
}

.form-field label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-muted);
}

.form-field input {
  font-family: inherit;
  font-size: 1rem;
  padding: 0.75rem 0.875rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  transition: border-color 0.15s ease;
}

.form-field input:focus {
  outline: none;
  border-color: var(--accent);
}

.form-error {
  font-size: 0.875rem;
  color: var(--wrong);
  text-align: center;
}

.auth-footer {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.auth-footer a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}

/* ── Profile ── */

.profile-body {
  align-items: center;
}

.profile-page {
  width: 100%;
  max-width: 440px;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  padding-top: 0.5rem;
}

.profile-guest {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 2rem 0;
}

.profile-guest h1 {
  font-size: 1.5rem;
  font-weight: 700;
}

.profile-guest p {
  color: var(--text-muted);
  max-width: 280px;
}

.profile-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
}

.profile-header__info h1 {
  font-size: 1.375rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.25rem;
}

.profile-header__email {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.profile-header__joined {
  font-size: 0.75rem;
  color: var(--text-subtle);
  margin-top: 0.25rem;
}

.membership-badge {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.35rem 0.625rem;
  border-radius: 4px;
  background: var(--bg-accent);
  color: var(--text-muted);
  flex-shrink: 0;
}

.membership-badge--plus {
  background: var(--plus-light);
  color: var(--plus);
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.625rem;
}

.stat-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem 0.75rem;
  box-shadow: var(--shadow-sm);
}

.stat-card--inline {
  padding: 0.875rem;
}

.stat-card__value {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--accent);
  line-height: 1.2;
}

.stat-card__label {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-subtle);
  margin-top: 0.25rem;
}

.section-title {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-subtle);
  margin-bottom: 0.75rem;
}

.advanced-stats {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
}

.advanced-stats__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.625rem;
  margin-bottom: 1rem;
}

.category-stats__title {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.category-stats__list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.category-stat {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.75rem;
  background: var(--bg);
  border-radius: var(--radius-sm);
}

.category-stat__name {
  font-size: 0.875rem;
  font-weight: 600;
}

.category-stat__detail {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.history-section {
  width: 100%;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.history-item:hover {
  border-color: #c8c3bb;
  transform: translateY(-1px);
}

.history-item__info {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.history-item__date {
  font-size: 0.875rem;
  font-weight: 600;
}

.history-item__meta {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.history-item__score {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--accent);
}

.history-empty {
  font-size: 0.875rem;
  color: var(--text-muted);
  text-align: center;
  padding: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.history-empty a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}

.dev-panel {
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
}

.dev-panel__note {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-bottom: 0.875rem;
}

.toggle-label {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
}

.toggle-label input {
  width: 1.125rem;
  height: 1.125rem;
  accent-color: var(--accent);
}

.toggle-label__text {
  font-size: 0.9375rem;
  font-weight: 500;
}

/* ── Rankd+ page ── */

.page--plus {
  padding-top: 0.5rem;
}

.plus-hero {
  text-align: center;
  width: 100%;
}

.plus-hero__badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--plus);
  background: var(--plus-light);
  padding: 0.375rem 0.75rem;
  border-radius: 4px;
  margin-bottom: 1rem;
}

.plus-hero__title {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 0.5rem;
}

.plus-hero__subtitle {
  font-size: 1rem;
  color: var(--text-muted);
  line-height: 1.5;
  max-width: 340px;
  margin: 0 auto;
}

.plus-comparison {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.625rem;
  width: 100%;
}

.plus-tier {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.125rem;
  text-align: left;
  box-shadow: var(--shadow-sm);
}

.plus-tier--highlight {
  border-color: var(--accent);
  background: linear-gradient(135deg, #faf5f5 0%, var(--surface) 100%);
}

.plus-tier h2 {
  font-size: 0.9375rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
}

.plus-tier ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.plus-tier li {
  font-size: 0.8125rem;
  color: var(--text-muted);
  padding-left: 1rem;
  position: relative;
}

.plus-tier li::before {
  content: "✓";
  position: absolute;
  left: 0;
  color: var(--accent);
  font-weight: 700;
  font-size: 0.75rem;
}

.plus-features {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: 100%;
}

.plus-feature {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.125rem;
  text-align: left;
  box-shadow: var(--shadow-sm);
}

.plus-feature__icon {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
}

.plus-feature h3 {
  font-size: 0.9375rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.plus-feature p {
  font-size: 0.8125rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.plus-cta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  text-align: center;
}

.plus-cta__text {
  font-size: 0.875rem;
  color: var(--text-muted);
  max-width: 300px;
}

.plus-cta__active {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  background: var(--plus-light);
  border: 1px solid var(--accent);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  width: 100%;
}

.plus-cta__check {
  font-size: 1.5rem;
  color: var(--plus);
}

.plus-cta__active p {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--plus);
}

/* ── Upgrade gate ── */

.upgrade-gate {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 1rem;
  padding: 2rem 0;
}

.upgrade-gate__icon {
  font-size: 2.5rem;
}

.upgrade-gate h2 {
  font-size: 1.25rem;
  font-weight: 700;
}

.upgrade-gate p {
  font-size: 0.9375rem;
  color: var(--text-muted);
  max-width: 300px;
  line-height: 1.5;
}

/* ── Game states ── */

.game--hidden {
  display: none;
}

.not-found {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 1rem;
  padding: 2rem 0;
}

.not-found h2 {
  font-size: 1.25rem;
  font-weight: 700;
}

.not-found p {
  color: var(--text-muted);
  font-size: 0.9375rem;
}

.results__review-note {
  font-size: 0.8125rem;
  color: var(--text-muted);
  text-align: center;
  padding: 0.5rem 0.75rem;
  background: var(--bg-accent);
  border-radius: var(--radius-sm);
}

.score-card__streak {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--accent);
  margin-top: 0.25rem;
}

/* ── Pricing ── */

.page--pricing {
  padding-top: 0.5rem;
}

.pricing-hero {
  text-align: center;
  width: 100%;
}

.pricing-hero__title {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 0.5rem;
}

.pricing-hero__subtitle {
  font-size: 1rem;
  color: var(--text-muted);
  line-height: 1.5;
  max-width: 360px;
  margin: 0 auto;
}

.pricing-notice {
  font-size: 0.875rem;
  color: var(--text-muted);
  background: var(--bg-accent);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  width: 100%;
  text-align: center;
}

.pricing-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  width: 100%;
}

.pricing-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  text-align: left;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.pricing-card--featured {
  border-color: var(--accent);
  background: linear-gradient(135deg, #faf5f5 0%, var(--surface) 100%);
}

.pricing-card__badge {
  position: absolute;
  top: -0.5rem;
  right: 0.75rem;
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #fff;
  background: var(--accent);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
}

.pricing-card__plan {
  font-size: 0.9375rem;
  font-weight: 700;
}

.pricing-card__price {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--accent);
  line-height: 1.1;
}

.pricing-card__interval {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.pricing-card__savings {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent);
  margin-top: -0.25rem;
  margin-bottom: 0.5rem;
}

.pricing-card__features {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  margin-bottom: 0.75rem;
  flex: 1;
}

.pricing-card__features li {
  font-size: 0.75rem;
  color: var(--text-muted);
  padding-left: 0.875rem;
  position: relative;
}

.pricing-card__features li::before {
  content: "✓";
  position: absolute;
  left: 0;
  color: var(--accent);
  font-weight: 700;
  font-size: 0.6875rem;
}

.pricing-secure {
  font-size: 0.8125rem;
  color: var(--text-subtle);
  text-align: center;
}

.pricing-login-prompt {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  text-align: center;
}

.pricing-login-prompt p {
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* ── Success page ── */

.page--success {
  padding-top: 2rem;
}

.success-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem 1.5rem;
  width: 100%;
  box-shadow: var(--shadow-md);
}

.success-card--error {
  border-color: var(--wrong);
}

.success-card__icon {
  font-size: 2.5rem;
  color: var(--accent);
}

.success-card h1 {
  font-size: 1.375rem;
  font-weight: 700;
}

.success-card p {
  font-size: 0.9375rem;
  color: var(--text-muted);
  line-height: 1.5;
  max-width: 300px;
}

/* ── Subscription section ── */

.subscription-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.subscription-status {
  font-size: 0.9375rem;
  color: var(--text-muted);
}

@media (min-width: 480px) {
  .page {
    gap: 1.75rem;
  }

  .game {
    gap: 1.25rem;
  }

  .quiz-question {
    font-size: 1.125rem;
  }
}
