/* ============================================================
   WeightBet — app.css
   All styles for the user-facing SPA (index.html)
   ============================================================ */

/* ── Design Tokens ───────────────────────────────────────── */
:root {
  --espresso:    #0D2F6F;
  --parchment:   #F3F6FB;
  --parch-mid:   #E7ECF5;
  --parch-dark:  #D3DCEA;
  --sienna:      #0B4EA2;
  --sienna-dark: #0D2F6F;
  --forest:      #3DAE2B;
  --forest-lt:   #60BD51;
  --gold:        #3DAE2B;
  --brown-mid:   #445068;
  --brown-lt:    #7C8AA6;
  --ink:         #0D2F6F;
  --ink-soft:    #395489;
  --white:       #FFFFFF;
  --danger:      #C0392B;

  --font-display: 'Poppins', 'Plus Jakarta Sans', system-ui, sans-serif;
  --font-body:    'Plus Jakarta Sans', system-ui, sans-serif;
  --font-hand:    'Poppins', 'Plus Jakarta Sans', system-ui, sans-serif;
  --font-mono:    'JetBrains Mono', monospace;

  --radius-sm:   6px;
  --radius-md:   12px;
  --radius-lg:   16px;

  --shadow-card:
    0 2px 4px rgba(13,47,111,0.06),
    0 8px 24px rgba(13,47,111,0.10);
}

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font-body);
  background: var(--parchment);
  color: var(--ink);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

img { display: block; max-width: 100%; }

/* ── Sticky footer ───────────────────────────────────────── */
#main {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 62px);
}
.page-content {
  flex: 1 0 auto;
}
footer {
  flex-shrink: 0;
}

/* ── Toast ───────────────────────────────────────────────── */
.toast {
  position: fixed;
  top: 1.1rem;
  left: 50%;
  transform: translateX(-50%) translateY(-160%);
  background: var(--espresso);
  color: var(--parchment);
  padding: 0.85rem 1.5rem;
  border-radius: 12px;
  border-left: 4px solid var(--brown-lt);
  font-size: 0.9rem;
  font-weight: 600;
  z-index: 9999;
  max-width: min(90vw, 420px);
  text-align: center;
  white-space: normal;
  box-shadow: 0 10px 28px rgba(13,47,111,0.28);
  pointer-events: none;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.toast.show {
  transform: translateX(-50%) translateY(0);
}
.toast.toast-success { border-left-color: var(--forest); }
.toast.toast-error    { border-left-color: var(--danger); }
.toast.toast-info      { border-left-color: var(--sienna); }

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  padding: 0.5rem 1.2rem;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  border: none;
  transition: opacity 0.15s, transform 0.15s;
  line-height: 1;
}
.btn:hover  { opacity: 0.88; transform: translateY(-1px); }
.btn:active { transform: translateY(0); opacity: 1; }

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--brown-mid);
  color: var(--ink-soft);
}
.btn-forest {
  background: var(--forest);
  color: var(--parchment);
}
.btn-sienna {
  background: var(--sienna);
  color: var(--white);
}
.btn-parchment {
  background: var(--parchment);
  color: var(--espresso);
  font-weight: 700;
}
.btn-danger {
  background: var(--danger);
  color: var(--white);
}
.btn-danger-outline {
  border-color: var(--danger);
  color: var(--danger);
}
.btn-lg {
  font-size: 1rem;
  padding: 0.8rem 1.8rem;
}
.btn-full {
  width: 100%;
  text-align: center;
  display: block;
}

/* ── Nav ─────────────────────────────────────────────────── */
.nav {
  position: sticky;
  top: 0;
  z-index: 200;
  background: var(--parchment);
  border-bottom: 1.5px solid var(--parch-dark);
  padding: 0.5rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 62px;
}

.nav-logo {
  display: flex;
  align-items: center;
  cursor: pointer;
  border: none;
  background: none;
  padding: 0;
}
.nav-logo-img {
  height: 46px;
  width: auto;
  display: block;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.nav-icon-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.nav-icon-btn {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1.5px solid var(--parch-dark);
  background: var(--white);
  color: var(--ink-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
  padding: 0;
}

.nav-icon-badge {
  position: absolute;
  top: -3px;
  right: -3px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--danger);
  color: var(--white);
  font-size: 0.65rem;
  font-weight: 700;
  align-items: center;
  justify-content: center;
  border: 1.5px solid var(--parchment);
}
.nav-icon-btn:hover {
  border-color: var(--sienna);
  color: var(--sienna);
}
.nav-icon-btn svg {
  width: 19px;
  height: 19px;
}

/* Mobile-only logout icon — takes the exact spot .nav-icon-wrap
   occupies on desktop, but hidden there since desktop already has
   logout inside the account dropdown. Swapped with .nav-icon-wrap at
   the ≤768px breakpoint below. */
.nav-mobile-logout-btn {
  display: none;
}

.nav-avatar-btn {
  background: var(--sienna);
  border-color: var(--sienna);
  color: var(--white);
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.nav-avatar-btn:hover {
  opacity: 0.9;
  color: var(--white);
}

.nav-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 240px;
  background: var(--white);
  border: 1.5px solid var(--parch-dark);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  padding: 0.85rem;
  z-index: 250;
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
}
.nav-dropdown.show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.nav-dropdown-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--espresso);
  padding: 0.3rem 0.6rem 0.6rem;
  border-bottom: 1px solid var(--parch-dark);
  margin-bottom: 0.4rem;
}

.nav-dropdown-empty {
  font-size: 0.82rem;
  color: var(--brown-lt);
  padding: 0.4rem 0.6rem 0.7rem;
  line-height: 1.5;
}

.nav-dropdown-link {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--ink-soft);
  padding: 0.55rem 0.6rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.12s;
}
.nav-dropdown-link:hover {
  background: var(--parchment);
}

.nav-dropdown-divider {
  height: 1px;
  background: var(--parch-dark);
  margin: 0.4rem 0;
}

.nav-dropdown-notif {
  padding: 0.5rem 0.6rem;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  color: var(--ink-soft);
  line-height: 1.4;
}
.nav-dropdown-notif-unread {
  background: var(--parchment);
}
.nav-dropdown-notif-time {
  font-size: 0.72rem;
  color: var(--brown-lt);
  margin-top: 0.15rem;
}

/* ── Notifications page ──────────────────────────────────── */
.notif-row {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--parchment);
  border-radius: var(--radius-sm);
}
.notif-row-unread {
  background: var(--parch-mid);
}
.notif-row-icon {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--white);
  color: var(--sienna);
  display: flex;
  align-items: center;
  justify-content: center;
}
.notif-row-icon svg { width: 17px; height: 17px; }
.notif-row-body { flex: 1; }
.notif-row-message {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--ink-soft);
}
.notif-row-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--sienna);
  flex-shrink: 0;
  margin-top: 0.4rem;
}

.nav-link {
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink-soft);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.4rem 0.2rem;
  transition: color 0.15s;
}
.nav-link:hover { color: var(--sienna); }

/* ── Hero ────────────────────────────────────────────────── */
.hero {
  max-width: 1180px;
  margin: 0 auto;
  padding: 5rem 2rem 4rem;
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 3rem;
  align-items: center;
}

.hero-kicker {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--forest);
  background: rgba(45, 80, 22, 0.1);
  padding: 0.3rem 0.85rem;
  border-radius: 100px;
  margin-bottom: 1.4rem;
}

.hero-headline {
  font-family: var(--font-display);
  font-size: clamp(2.6rem, 5vw, 4rem);
  line-height: 1.08;
  color: var(--espresso);
  margin-bottom: 1.25rem;
  max-width: 560px;
}
.hero-headline em {
  font-style: italic;
  color: var(--sienna);
}

.hero-body {
  font-size: 1.05rem;
  color: var(--ink-soft);
  line-height: 1.75;
  max-width: 480px;
  margin-bottom: 2rem;
}

.hero-cta {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* ── Challenge card (hero element) ───────────────────────── */
.challenge-card-demo {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow-card), 4px 4px 0 var(--parch-dark);
  transform: rotate(1.5deg);
  position: relative;
}

.card-demo-tag {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--brown-lt);
  margin-bottom: 0.6rem;
  display: block;
}

.card-demo-title {
  font-family: var(--font-hand);
  font-size: 1.7rem;
  color: var(--espresso);
  margin-bottom: 1.25rem;
  line-height: 1.2;
}

.card-demo-members {
  display: flex;
  margin-bottom: 1.25rem;
}

.member-bubble {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--white);
  margin-right: -8px;
  flex-shrink: 0;
}
.mb-1    { background: #1F7A6C; }
.mb-2    { background: var(--forest); }
.mb-3    { background: #8B4A9C; }
.mb-4    { background: #2A6B8C; }
.mb-more { background: var(--parch-mid); color: var(--brown-mid); }

.card-demo-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 1rem;
  margin-top: 0.5rem;
}

.card-demo-stat-label {
  font-size: 0.72rem;
  color: var(--brown-lt);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 0.2rem;
}

.card-demo-stat-val {
  font-family: var(--font-mono);
  font-size: 1.4rem;
  font-weight: 500;
  color: var(--espresso);
}
.card-demo-stat-val.gold { color: var(--sienna); }

.card-demo-progress-bar {
  height: 6px;
  background: var(--parch-mid);
  border-radius: 3px;
  overflow: hidden;
}
.card-demo-progress-fill {
  height: 100%;
  width: 62%;
  background: var(--forest);
  border-radius: 3px;
}
.card-demo-progress-label {
  font-size: 0.72rem;
  color: var(--brown-lt);
  margin-top: 0.4rem;
}

/* ── Trust bar ───────────────────────────────────────────── */
.trust-bar {
  border-top: 1.5px solid var(--parch-dark);
  border-bottom: 1.5px solid var(--parch-dark);
  padding: 1.25rem 2rem;
  display: flex;
  justify-content: center;
  gap: 3rem;
  flex-wrap: wrap;
}

.trust-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--ink-soft);
}
.trust-item strong {
  font-family: var(--font-mono);
  font-size: 1rem;
  color: var(--espresso);
}

/* ── Sections ────────────────────────────────────────────── */
.section {
  max-width: 1180px;
  margin: 0 auto;
  padding: 5rem 2rem;
}

.section-eyebrow {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--brown-lt);
  margin-bottom: 0.6rem;
}

.section-title {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 3.5vw, 2.6rem);
  line-height: 1.12;
  color: var(--espresso);
  max-width: 520px;
  margin-bottom: 3rem;
}

/* ── Why WeightBet feature grid ───────────────────────────── */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
}
.feature-card {
  background: var(--white);
  border: 1.5px solid var(--parch-dark);
  border-radius: var(--radius-md);
  padding: 1.75rem;
}
.feature-icon {
  font-size: 1.6rem;
  display: block;
  margin-bottom: 1rem;
}
.feature-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  color: var(--espresso);
  margin-bottom: 0.5rem;
}
.feature-desc {
  font-size: 0.85rem;
  color: var(--ink-soft);
  line-height: 1.6;
}

@media (max-width: 900px) {
  .feature-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .feature-grid { grid-template-columns: 1fr; }
}

/* ── Recent winners ────────────────────────────────────────
   Populated from real game_results rows (see loadHomeStats() /
   renderRecentWinners() in app.js) — shows an honest empty state
   rather than placeholder names when nothing has been won yet. */
.winners-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
}
.winner-card {
  background: var(--white);
  border: 1.5px solid var(--parch-dark);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  text-align: center;
}
.winner-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--sienna);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
  margin: 0 auto 0.85rem;
}
.winner-name {
  font-family: var(--font-display);
  font-size: 1rem;
  color: var(--espresso);
  margin-bottom: 0.2rem;
}
.winner-game {
  font-size: 0.76rem;
  color: var(--brown-lt);
  margin-bottom: 0.5rem;
}
.winner-amount {
  font-family: var(--font-mono);
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--forest);
}

/* Subtle staggered entrance as the homepage's recent-winners grid
   scrolls into view (see observeWinnerCardsEntrance() in app.js) —
   scoped to .winners-grid specifically so the lobby sidebar's
   compact winners list (.winners-list-compact .winner-card) is
   unaffected. Respects prefers-reduced-motion via the blanket
   transition override at the bottom of this file. */
.winners-grid .winner-card {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}
.winners-grid .winner-card.in-view {
  opacity: 1;
  transform: translateY(0);
}
.winners-grid .winner-card:nth-child(1).in-view { transition-delay: 0s; }
.winners-grid .winner-card:nth-child(2).in-view { transition-delay: 0.08s; }
.winners-grid .winner-card:nth-child(3).in-view { transition-delay: 0.16s; }
.winners-grid .winner-card:nth-child(4).in-view { transition-delay: 0.24s; }

.winners-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 2.5rem 1.5rem;
  color: var(--brown-lt);
  font-size: 0.92rem;
  background: var(--white);
  border: 1.5px dashed var(--parch-dark);
  border-radius: var(--radius-md);
}

@media (max-width: 900px) {
  .winners-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .winners-grid { grid-template-columns: 1fr; }
}

/* Avatar stack on a lobby/homepage game card — only rendered when
   the game actually has real joined members (see gameCardHTML()).
   Sits in the card's bottom row (see .game-list-bottom-row), not
   stacked above anything else, so no margin here. */
.game-list-avatars {
  display: flex;
}

/* ── How it works grid ───────────────────────────────────── */
.how-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border: 1.5px solid var(--parch-dark);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.how-step {
  padding: 2rem 1.75rem;
  border-right: 1.5px solid var(--parch-dark);
}
.how-step:last-child { border-right: none; }

.how-step-icon {
  font-size: 1.5rem;
  margin-bottom: 1rem;
  display: block;
}

.how-step-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  color: var(--espresso);
  margin-bottom: 0.5rem;
}

.how-step-desc {
  font-size: 0.85rem;
  color: var(--ink-soft);
  line-height: 1.65;
}

/* ── CTA strip ───────────────────────────────────────────── */
.cta-strip {
  background: var(--sienna);
  padding: 4.5rem 2rem;
  text-align: center;
}

.cta-strip h2 {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  color: var(--white);
  margin-bottom: 0.75rem;
  line-height: 1.1;
}
.cta-strip h2 em {
  font-style: italic;
  color: var(--gold);
}

.cta-strip p {
  font-size: 1rem;
  color: rgba(255, 255, 255, 0.8);
  margin-bottom: 2rem;
}

/* ── Footer ──────────────────────────────────────────────── */
footer {
  background: var(--espresso);
  color: var(--parch-dark);
  padding: 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.footer-logo-img {
  height: 24px;
  width: auto;
  display: block;
}

footer small {
  font-size: 0.78rem;
  color: var(--brown-lt);
}

/* ── Auth views ──────────────────────────────────────────── */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  background: var(--parchment);
}

.auth-card {
  background: var(--white);
  border: 1.5px solid var(--parch-dark);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-card);
}

.auth-logo {
  display: flex;
  justify-content: center;
  margin-bottom: 0.6rem;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  padding: 0;
}
.auth-logo img {
  height: 34px;
  width: auto;
}

.auth-sub {
  text-align: center;
  font-size: 0.88rem;
  color: var(--brown-lt);
  margin-bottom: 2rem;
}

.auth-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--espresso);
  margin-bottom: 1.5rem;
}

/* ── Forms ───────────────────────────────────────────────── */
.form-group { margin-bottom: 1.1rem; }

.form-checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}

.form-checkbox-label input[type="checkbox"] {
  margin-top: 0.2rem;
  width: 1.05rem;
  height: 1.05rem;
  flex-shrink: 0;
  cursor: pointer;
}

.form-hint {
  margin-top: 0.4rem;
  font-size: 0.8rem;
  color: var(--brown-lt);
  line-height: 1.5;
}

.form-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-soft);
  margin-bottom: 0.4rem;
}

.form-input {
  width: 100%;
  padding: 0.65rem 0.9rem;
  border: 1.5px solid var(--parch-dark);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--espresso);
  background: var(--parchment);
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}
.form-input:focus {
  border-color: var(--forest);
  background: var(--white);
}
.form-input::placeholder { color: var(--brown-lt); }

.form-divider {
  text-align: center;
  font-size: 0.78rem;
  color: var(--brown-lt);
  margin: 1.25rem 0;
  position: relative;
}
.form-divider::before,
.form-divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 38%;
  height: 1px;
  background: var(--parch-dark);
}
.form-divider::before { left: 0; }
.form-divider::after  { right: 0; }

/* ── Log progress page: form + history side by side ──────── */
.log-page-wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 3rem 2rem;
  display: grid;
  grid-template-columns: 420px 1fr;
  gap: 2.5rem;
  align-items: start;
}

.log-form-card {
  margin: 0;
}

.log-history-card {
  background: var(--white);
  border: 1.5px solid var(--parch-dark);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-card);
}

/* Fixed-height wrapper so Chart.js's responsive canvas doesn't grow
   unbounded — hidden entirely (see renderLogHistoryChart() in app.js)
   until there are at least 2 approved logs to plot a trend from. */
.log-history-chart-wrap {
  height: 220px;
  margin-bottom: 1.5rem;
}

.log-history-row {
  padding: 1rem 0;
  border-bottom: 1px solid var(--parch-dark);
}
.log-history-row:last-child { border-bottom: none; padding-bottom: 0; }
.log-history-row:first-child { padding-top: 0; }

.log-history-main {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 0.35rem;
}
.log-history-value {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--espresso);
}
.log-history-date {
  font-size: 0.8rem;
  color: var(--brown-lt);
}
.log-history-note {
  font-size: 0.88rem;
  color: var(--ink-soft);
  margin-bottom: 0.6rem;
}
.log-history-thumb-link {
  display: inline-block;
}
.log-history-thumb {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--parch-dark);
}

@media (max-width: 860px) {
  .log-page-wrap {
    grid-template-columns: 1fr;
    padding: 2rem 1.5rem;
  }
  .log-form-card {
    max-width: 100%;
  }
}

/* ── Game lobby ───────────────────────────────────────────── */
.lobby-wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 3rem 2rem;
}

.lobby-title {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 3vw, 2.4rem);
  color: var(--espresso);
  margin-bottom: 0.5rem;
}

.lobby-sub {
  font-size: 0.95rem;
  color: var(--ink-soft);
  margin-bottom: 1.75rem;
}

/* ── Lobby layout: hottest game + games list + sidebar ───────
   Named grid areas (not DOM order or `order:`) place each piece —
   this is what lets the hottest-game card lead on mobile while
   still sitting at the top of the right-hand column on desktop,
   without duplicating any markup. */
.lobby-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  grid-template-areas:
    "main hero"
    "main sidebar";
  gap: 2rem;
  align-items: start;
}

.lobby-hottest-wrap { grid-area: hero; }
.lobby-main          { grid-area: main; }
.lobby-sidebar       { grid-area: sidebar; }

.lobby-sidebar {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  position: sticky;
  top: calc(62px + 1.5rem);
}

/* Elevated card, not a plain bordered box — shadow alone carries the
   separation from the page background, no border needed. */
.lobby-sidebar-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow:
    0 4px 10px rgba(13, 47, 111, 0.07),
    0 14px 32px rgba(13, 47, 111, 0.12);
}

/* ── Account page ────────────────────────────────────────── */
.account-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  align-items: start;
}

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

.account-danger-zone {
  grid-column: 1 / -1;
  border: 1.5px solid rgba(192, 57, 43, 0.3);
}

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

.account-history-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 1rem;
  background: var(--parchment);
  border-radius: var(--radius-sm);
}

/* Only game-history rows navigate to the game on click — payment
   rows are read-only, so they stay a plain (non-pointer) row. */
.account-history-row[data-game-id] {
  cursor: pointer;
}

.account-history-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink-soft);
}

.account-history-meta {
  font-size: 0.78rem;
  color: var(--brown-lt);
  margin-top: 0.15rem;
}

.account-history-amount {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink-soft);
  margin-bottom: 0.25rem;
}

@media (max-width: 1000px) {
  .lobby-layout {
    grid-template-columns: 1fr;
    grid-template-areas:
      "hero"
      "main"
      "sidebar";
  }
  .lobby-sidebar { position: static; }
}

/* Real highest-pot open game, not a fabricated ticking jackpot —
   see renderHottestGame() in app.js. */
.hottest-game-card {
  background: linear-gradient(160deg, var(--espresso), var(--sienna-dark));
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  color: var(--white);
  cursor: pointer;
  box-shadow:
    0 4px 10px rgba(13, 47, 111, 0.12),
    0 14px 32px rgba(13, 47, 111, 0.18);
}
.hottest-game-tag {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: rgba(255,255,255,0.15);
  padding: 0.3rem 0.7rem;
  border-radius: 100px;
  margin-bottom: 0.9rem;
}
.hottest-game-name {
  font-family: var(--font-display);
  font-size: 1.2rem;
  margin-bottom: 0.2rem;
}
.hottest-game-tagline {
  font-size: 0.82rem;
  color: rgba(255,255,255,0.75);
  font-style: italic;
  margin-bottom: 1.1rem;
}
.hottest-game-pot {
  font-family: var(--font-mono);
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--forest-lt);
  line-height: 1;
}
.hottest-game-pot-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: rgba(255,255,255,0.6);
  margin-bottom: 1rem;
}
.hottest-game-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  color: rgba(255,255,255,0.85);
}

/* Compact 2-up winners grid for the lobby sidebar — same data and
   same renderRecentWinners() as the homepage's full grid, just a
   denser tile layout for a narrower column. Still initials-only
   avatars, never a real name or photo. */
.winners-list-compact {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}
.winners-list-compact .winner-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.3rem;
  padding: 0.85rem 0.5rem;
  border: none;
  border-radius: var(--radius-md);
  background: var(--parchment);
}
.winners-list-compact .winner-avatar {
  width: 42px;
  height: 42px;
  font-size: 0.8rem;
  margin: 0;
  flex-shrink: 0;
}
.winners-list-compact .winner-name,
.winners-list-compact .winner-game,
.winners-list-compact .winner-amount {
  text-align: center;
}
.winners-list-compact .winners-empty {
  grid-column: 1 / -1;
  font-size: 0.85rem;
  padding: 1rem;
}

/* 2x2 stat-tile grid — icon-in-circle + bold real number + short
   label, denser and more visual than a plain text list. */
.stat-tile-grid,
#lobby-mini-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}
.stat-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.3rem;
  padding: 1rem 0.5rem;
  background: var(--parchment);
  border-radius: var(--radius-md);
}
.stat-tile-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
}
.stat-tile-value {
  font-family: var(--font-mono);
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--espresso);
  line-height: 1.1;
}
.stat-tile-label {
  font-size: 0.7rem;
  color: var(--brown-lt);
  line-height: 1.3;
}
.mini-stat-empty {
  font-size: 0.85rem;
  color: var(--brown-lt);
}

.lobby-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 2rem;
}

.lobby-tabs {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.lobby-tab {
  font-family: var(--font-body);
  font-size: 0.84rem;
  font-weight: 600;
  padding: 0.5rem 1rem;
  border-radius: 100px;
  border: 1.5px solid var(--parch-dark);
  background: var(--white);
  color: var(--ink-soft);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.lobby-tab:hover { border-color: var(--sienna); }
.lobby-tab.active {
  background: var(--forest);
  border-color: var(--forest);
  color: var(--parchment);
}

.lobby-search {
  flex: 0 1 260px;
  padding: 0.6rem 1.1rem;
  border: 1.5px solid var(--parch-dark);
  border-radius: 100px;
  font-family: var(--font-body);
  font-size: 0.88rem;
  background: var(--white);
  color: var(--espresso);
  outline: none;
  transition: border-color 0.15s;
}
.lobby-search:focus { border-color: var(--forest); }
.lobby-search::placeholder { color: var(--brown-lt); }

@media (max-width: 600px) {
  .lobby-controls { flex-direction: column; align-items: stretch; }
  .lobby-search   { flex: 1; }
}

/* Multi-column tile grid, not a single-column stacked list — this is
   what actually makes the lobby read as dense/marketplace-like; the
   card redesign below matters far less without this. */
.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
  align-items: stretch;
}

/* ── Tile-style game card (lobby/search/homepage) ─────────── */
.game-list-card {
  display: flex;
  flex-direction: column;
  background: var(--white);
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  box-shadow:
    0 2px 6px rgba(13, 47, 111, 0.06),
    0 8px 20px rgba(13, 47, 111, 0.08);
  transition: box-shadow 0.2s, transform 0.2s;
}
.game-list-card:hover {
  transform: translateY(-3px);
  box-shadow:
    0 4px 10px rgba(13, 47, 111, 0.09),
    0 14px 32px rgba(13, 47, 111, 0.14);
}

/* Full-width banner, not a corner thumbnail — a real cover photo
   fills it edge to edge; the illustration case (see gameCardHTML())
   gets a solid tint block behind a fixed-size icon (below) so the
   icon doesn't stretch thin across a wide banner. */
.game-list-thumb {
  width: 100%;
  height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.game-list-thumb-photo {
  object-fit: cover;
  display: block;
}
.game-list-thumb-illustration-icon {
  width: 96px;
  height: 96px;
}
.game-list-thumb-illustration-icon svg {
  display: block;
  width: 100%;
  height: 100%;
}

.game-list-content {
  flex: 1;
  min-width: 0;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
}

.game-list-tagline {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-style: normal;
  color: var(--sienna);
  margin-bottom: 0.15rem;
}

.game-list-duration {
  font-size: 0.78rem;
  color: var(--brown-lt);
  margin-bottom: 0.5rem;
}

.game-list-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  color: var(--espresso);
  margin-bottom: 0.15rem;
  line-height: 1.25;
}

.game-list-desc {
  font-size: 0.85rem;
  color: var(--ink-soft);
  margin-bottom: 0.75rem;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.game-list-stats {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 0.75rem;
}
.game-list-stat {
  display: flex;
  flex-direction: column;
  font-size: 0.7rem;
  color: var(--brown-lt);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.game-list-stat strong {
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 500;
  color: var(--espresso);
  text-transform: none;
  letter-spacing: normal;
}

/* Money gets its own, bigger, louder treatment — the actual pot and
   entry fee are what makes this a betting app, so they're sized to
   read before anything else on the card, not sitting at the same
   visual weight as the player count. A grid (not flex-with-gaps)
   keeps all three columns evenly aligned across every card in the
   row, regardless of how many digits each value has. */
.game-list-money-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  align-items: end;
  gap: 0.6rem;
  margin-bottom: 1rem;
}
.game-list-money-item {
  display: flex;
  flex-direction: column;
  font-size: 0.68rem;
  color: var(--brown-lt);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}
.game-list-money-item strong {
  font-family: var(--font-mono);
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--espresso);
  text-transform: none;
  letter-spacing: normal;
  line-height: 1.15;
}
.game-list-money-item strong.pot {
  color: var(--forest);
  font-size: 1.6rem;
}

/* Chip background around the pot figure specifically — widens the
   existing pot-vs-entry-fee hierarchy now that cards carry a full
   illustrated banner above them. */
.game-list-money-item.pot-chip {
  background: rgba(61, 174, 43, 0.12);
  padding: 0.4rem 0.6rem;
  border-radius: var(--radius-sm);
}

.badge-joined {
  background: rgba(61, 174, 43, 0.14);
  color: var(--forest);
}

/* Timing badge (left) + avatar stack (right) share one row at the
   bottom of the card instead of stacking on separate lines. */
.game-list-bottom-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: auto;
}

.game-card {
  background: var(--white);
  border: 1.5px solid var(--parch-dark);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.2s;
}
.game-card:hover {
  border-color: var(--sienna);
  transform: translateY(-2px);
}

.game-card-type {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--brown-lt);
  margin-bottom: 0.5rem;
}

.game-card-name {
  font-family: var(--font-display);
  font-size: 1.25rem;
  color: var(--espresso);
  margin-bottom: 1rem;
}

/* ── Dashboard game cards ("My games") ───────────────────── */
.dashboard-game-card {
  cursor: default;
  margin-bottom: 1.25rem;
}
.dashboard-game-card:hover {
  border-color: var(--parch-dark);
  transform: none;
}

.dashboard-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}
.dashboard-card-header .game-card-name { margin-bottom: 0; flex: 1; min-width: 0; }

.dashboard-card-thumb {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  flex-shrink: 0;
}

.dashboard-card-members {
  display: flex;
  margin-bottom: 1.1rem;
}

.dashboard-card-players {
  font-size: 0.85rem;
  color: var(--brown-lt);
  margin-bottom: 1.1rem;
}

.game-card-meta {
  display: flex;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.game-card-stat-label {
  font-size: 0.7rem;
  color: var(--brown-lt);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 0.2rem;
}

.game-card-stat-val {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  color: var(--espresso);
}
.game-card-stat-val.pot { color: var(--sienna); }

.game-card-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.25rem 0.7rem;
  border-radius: 100px;
}
.badge-status-upcoming { background: rgba(45, 80, 22, 0.1);  color: var(--forest); }
.badge-status-active   { background: rgba(212, 98, 42, 0.14); color: var(--sienna-dark); }
.badge-status-ended    { background: rgba(107, 78, 42, 0.12); color: var(--brown-mid); }

.badge-status-pending  { background: rgba(124, 138, 166, 0.18); color: var(--brown-mid); }
.badge-status-approved { background: rgba(45, 80, 22, 0.1);     color: var(--forest); }
.badge-status-rejected { background: rgba(192, 57, 43, 0.12);   color: var(--danger); }
.badge-status-winner   { background: rgba(61, 174, 43, 0.14);   color: var(--forest); }

/* ── Game detail page ─────────────────────────────────────── */
.game-detail-back {
  margin-bottom: 1.25rem;
}

.game-detail-cover {
  display: block;
  width: 100%;
  height: 280px;
  object-fit: cover;
  border-radius: var(--radius-md);
  margin-bottom: 1.25rem;
}

@media (max-width: 560px) {
  .game-detail-cover { height: 180px; }
}

.game-detail-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 2.5rem;
  align-items: start;
}

.game-detail-sidebar {
  position: sticky;
  top: calc(62px + 1.5rem);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.game-stats-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.1rem;
  padding: 1.5rem;
  background: var(--white);
  border: 1.5px solid var(--parch-dark);
  border-radius: var(--radius-md);
}

@media (max-width: 900px) {
  .game-detail-layout {
    grid-template-columns: 1fr;
    margin-bottom: 5rem;
  }
  .game-detail-sidebar {
    position: static;
  }
}

.game-stat {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.game-join-box {
  background: var(--white);
  border: 1.5px solid var(--parch-dark);
  border-radius: var(--radius-md);
  padding: 1.75rem;
}
.game-join-box p {
  font-size: 0.95rem;
  color: var(--ink-soft);
  margin-bottom: 0.5rem;
}
.game-join-box .form-group {
  margin-top: 1rem;
  margin-bottom: 0;
}
.game-join-box.joined {
  background: rgba(45, 80, 22, 0.06);
  border-color: var(--forest);
}
.game-join-box.ended {
  background: rgba(107, 78, 42, 0.06);
  border-color: var(--parch-dark);
}
.game-join-box.won {
  background: rgba(61, 174, 43, 0.08);
  border-color: var(--forest);
}

/* ── How-it-works mini explainer (game detail page) ──────── */
.game-howto {
  margin: 2rem 0;
  padding: 1.5rem;
  background: var(--parchment);
  border-radius: var(--radius-md);
}
.game-howto-steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  margin-top: 1rem;
}
.game-howto-step h4 {
  font-family: var(--font-display);
  font-size: 0.95rem;
  color: var(--espresso);
  margin: 0.6rem 0 0.3rem;
}
.game-howto-step p {
  font-size: 0.82rem;
  color: var(--ink-soft);
  line-height: 1.5;
}
.game-howto-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--forest);
  color: var(--white);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.9rem;
}

@media (max-width: 640px) {
  .game-howto-steps { grid-template-columns: 1fr; gap: 1rem; }
}

/* ── Verification blurb (game detail page) ───────────────── */
.game-verify-blurb {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  margin-bottom: 2rem;
  padding: 1.1rem 1.25rem;
  background: var(--white);
  border: 1.5px solid var(--parch-dark);
  border-radius: var(--radius-md);
}
.game-verify-icon {
  flex-shrink: 0;
  color: var(--sienna);
  margin-top: 0.1rem;
}
.game-verify-icon svg { width: 20px; height: 20px; }
.game-verify-blurb p {
  font-size: 0.88rem;
  color: var(--ink-soft);
  line-height: 1.55;
}
.game-verify-blurb .nav-link {
  font-size: inherit;
  font-weight: 600;
  color: var(--sienna);
  vertical-align: baseline;
}

/* ── FAQ accordion (game detail page) ─────────────────────── */
.game-faq {
  margin-bottom: 2rem;
}
.game-faq-item {
  border-bottom: 1px solid var(--parch-dark);
}
.game-faq-item:first-of-type {
  border-top: 1px solid var(--parch-dark);
}
.game-faq-question {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.95rem 0.1rem;
  background: none;
  border: none;
  text-align: left;
  font-family: var(--font-body);
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--espresso);
  cursor: pointer;
}
.game-faq-chevron {
  flex-shrink: 0;
  font-size: 1.1rem;
  color: var(--brown-lt);
  transition: transform 0.2s ease;
}
.game-faq-item.open .game-faq-chevron {
  transform: rotate(180deg);
}
.game-faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.25s ease;
}
.game-faq-item.open .game-faq-answer {
  max-height: 200px;
}
.game-faq-answer p {
  font-size: 0.85rem;
  color: var(--ink-soft);
  line-height: 1.6;
  padding: 0 0.1rem 1rem;
}

/* ── Sticky mobile join bar ────────────────────────────────── */
.mobile-join-bar {
  display: none;
}

@media (max-width: 900px) {
  .mobile-join-bar {
    display: block;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 0.85rem 1rem;
    background: var(--white);
    border-top: 1.5px solid var(--parch-dark);
    box-shadow: 0 -4px 16px rgba(13,47,111,0.08);
    z-index: 250;
  }
}

@media (max-width: 768px) {
  .mobile-join-bar {
    bottom: 4.1rem;
  }
}

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

.player-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 1rem;
  background: var(--white);
  border: 1.5px solid var(--parch-dark);
  border-radius: var(--radius-sm);
}

.player-row-eliminated {
  opacity: 0.6;
}
.player-row-eliminated .player-name {
  text-decoration: line-through;
  text-decoration-color: var(--brown-lt);
}

.player-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--forest);
  color: var(--parchment);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
}

.player-name {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--ink-soft);
}

.leaderboard-rank {
  width: 1.75rem;
  flex-shrink: 0;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--brown-lt);
  text-align: center;
}

.leaderboard-rank-none {
  opacity: 0.5;
}

.player-progress {
  margin-left: auto;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--forest);
  white-space: nowrap;
}

.player-progress-none {
  font-weight: 400;
  font-style: italic;
  color: var(--brown-lt);
}

/* .player-row packs 5 children (rank, avatar, name, progress, status
   badge) on one non-wrapping line — fine on desktop, but their
   combined content width alone is close to a 390px viewport before
   any padding, and a flex item's default min-width:auto means none
   of them will shrink below their own content size. Below 640px
   (matching the admin verification-card breakpoint), let the row
   wrap to two lines — identity (rank/avatar/name) on top, stats
   (progress/badges) right-aligned below via .player-progress's
   existing margin-left:auto, which applies per flex line so it still
   works after wrapping. .player-name additionally gets min-width:0 +
   ellipsis so a genuinely long username truncates gracefully instead
   of being the thing that refuses to shrink and reintroduces the
   overflow this is fixing. */
@media (max-width: 640px) {
  .player-row {
    flex-wrap: wrap;
    row-gap: 0.35rem;
  }
  .player-name {
    min-width: 0;
    flex: 1 1 auto;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

/* ── Modal ─────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(13, 47, 111, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  z-index: 10000;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.modal-backdrop.show { opacity: 1; }

.modal-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 2.25rem;
  max-width: 440px;
  width: 100%;
  position: relative;
  box-shadow: 0 16px 48px rgba(13, 47, 111, 0.3);
  transform: translateY(12px) scale(0.97);
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.modal-backdrop.show .modal-card {
  transform: translateY(0) scale(1);
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1.1rem;
  background: none;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--brown-lt);
  cursor: pointer;
  padding: 0.25rem;
}
.modal-close:hover { color: var(--espresso); }

.modal-title {
  font-family: var(--font-display);
  font-size: 1.4rem;
  color: var(--espresso);
  margin-bottom: 1rem;
  padding-right: 1.5rem;
  line-height: 1.25;
}

.modal-body {
  font-size: 0.95rem;
  color: var(--ink-soft);
  line-height: 1.6;
  margin-bottom: 0.85rem;
}

.modal-hint {
  font-size: 0.85rem;
  color: var(--brown-lt);
  line-height: 1.55;
  margin-bottom: 1.5rem;
}

.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

@media (max-width: 480px) {
  .modal-card { padding: 1.75rem; }
}

/* ── Loading state ───────────────────────────────────────── */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 40vh;
  font-size: 0.9rem;
  color: var(--brown-lt);
}

/* ── Empty state ─────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--brown-lt);
}
.empty-state p { font-size: 0.95rem; margin-top: 0.5rem; }

/* ── Rules / how-it-works page ───────────────────────────── */
.rules-section {
  margin-bottom: 2.5rem;
}
.rules-section:last-child { margin-bottom: 0; }

.rules-heading {
  font-family: var(--font-display);
  font-size: 1.3rem;
  color: var(--espresso);
  margin-bottom: 0.85rem;
}

.rules-text {
  font-size: 0.95rem;
  color: var(--ink-soft);
  line-height: 1.7;
  max-width: 720px;
  margin-bottom: 0.85rem;
}
.rules-text:last-child { margin-bottom: 0; }

.rules-grid {
  grid-template-columns: repeat(4, 1fr);
}

/* ── Bottom tab bar (mobile only) ─────────────────────────── */
.bottom-nav {
  display: none;
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 960px) {
  .hero {
    grid-template-columns: 1fr;
    text-align: center;
    padding: 3rem 1.5rem 2.5rem;
  }
  .hero-headline { max-width: 100%; }
  .hero-body     { max-width: 100%; }
  .hero-cta      { justify-content: center; }
  .challenge-card-demo { max-width: 340px; margin: 0 auto; }
  .how-grid { grid-template-columns: repeat(2, 1fr); }
  .how-step { border-right: none; border-bottom: 1.5px solid var(--parch-dark); }
  .how-step:nth-child(odd)  { border-right: 1.5px solid var(--parch-dark); }
  .how-step:last-child      { border-bottom: none; }
  .trust-bar { gap: 1.5rem; }
}

@media (max-width: 600px) {
  .nav { padding: 0 1rem; }
  .how-grid { grid-template-columns: 1fr; }
  .how-step { border-right: none !important; }
  .how-step:nth-child(odd) { border-right: none !important; }
  .section { padding: 3rem 1.25rem; }
  footer { flex-direction: column; text-align: center; }
}

@media (max-width: 768px) {
  .nav-mygames-btn { display: none; }
  .nav-icon-wrap { display: none; }
  .nav-mobile-logout-btn { display: flex; }
  footer { display: none; }

  .bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 300;
    background: var(--white);
    border-top: 1.5px solid var(--parch-dark);
    padding: 0.35rem 0 calc(0.35rem + env(safe-area-inset-bottom, 0px));
  }

  .bottom-nav-tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
    background: none;
    border: none;
    padding: 0.4rem 0.2rem;
    cursor: pointer;
    color: var(--brown-lt);
  }
  .bottom-nav-tab.active { color: var(--sienna); }
  .bottom-nav-icon  { display: flex; line-height: 1; }
  .bottom-nav-icon svg { width: 22px; height: 22px; }
  .bottom-nav-label {
    font-size: 0.66rem;
    font-weight: 600;
    white-space: nowrap;
  }

  #main { padding-bottom: 4.25rem; }
}

@media (max-width: 380px) {
  .bottom-nav-label { font-size: 0.58rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}