/* ================================================================
   Norrbotten Språklek — Design System
   Norrländsk känsla: norrsken, snö, fjäll
   ================================================================ */

:root {
  --bg1: #071220;
  --bg2: #0c1928;
  --bg3: #0f2035;
  --card: rgba(255,255,255,.06);
  --card-hover: rgba(255,255,255,.1);
  --border: rgba(255,255,255,.1);
  --text: #ffffff;
  --text-sub: rgba(255,255,255,.6);
  --text-muted: rgba(255,255,255,.3);
  --teal: #3ecfbe;
  --teal-d: rgba(62,207,190,.15);
  --teal-dd: rgba(62,207,190,.08);
  --blue: #4a9eff;
  --gold: #f5c842;
  --red: #ff5f5f;
  --green: #4ade80;
  --yellow: #fbbf24;
  --ff: 'Fraunces', Georgia, serif;
  --fb: 'DM Sans', system-ui, sans-serif;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 8px 32px rgba(0,0,0,.4);
  --nav-h: 60px;
}

[data-theme="light"] {
  --bg1: #e8f0f8;
  --bg2: #f0f6fc;
  --bg3: #ffffff;
  --card: rgba(255,255,255,.9);
  --card-hover: rgba(255,255,255,1);
  --border: rgba(12,25,40,.12);
  --text: #0c1928;
  --text-sub: #526070;
  --text-muted: #9aabb8;
  --shadow: 0 4px 20px rgba(12,25,40,.12);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--fb);
  background: var(--bg1);
  color: var(--text);
  min-height: 100svh;
  -webkit-font-smoothing: antialiased;
}
a { text-decoration: none; color: inherit; }
button { cursor: pointer; font-family: var(--fb); }

/* ── Nav ── */
#main-nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: var(--nav-h);
  background: rgba(7,18,32,.88);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}
[data-theme="light"] #main-nav { background: rgba(240,246,252,.95); }
.nav-inner {
  max-width: 900px; margin: 0 auto;
  padding: 0 16px; height: 100%;
  display: flex; align-items: center; gap: 20px;
}
.nav-logo {
  font-family: var(--ff); font-size: 1.1rem; font-weight: 700;
  color: var(--teal); display: flex; align-items: center; gap: 7px;
  white-space: nowrap;
}
.nav-links { display: flex; gap: 4px; flex: 1; }
.nav-link {
  padding: 6px 12px; border-radius: 8px; font-size: 14px; font-weight: 500;
  color: var(--text-sub); transition: all .15s;
}
.nav-link:hover, .nav-link.active { color: var(--text); background: var(--card); }
.nav-right {
  display: flex; align-items: center; gap: 10px; margin-left: auto;
}
.icon-btn {
  width: 34px; height: 34px; border-radius: 50%;
  background: none; border: 1px solid var(--border);
  color: var(--text-sub); font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  transition: all .15s;
}
.icon-btn:hover { background: var(--card); color: var(--text); }
.xp-pill {
  display: flex; align-items: center; gap: 6px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 100px; padding: 4px 10px;
  font-size: 12px; font-weight: 600; color: var(--teal);
}
.xp-bar-mini { width: 40px; height: 4px; background: rgba(255,255,255,.1); border-radius: 2px; overflow: hidden; }
.xp-bar-mini div { height: 100%; background: var(--teal); border-radius: 2px; transition: width .4s; }
.btn-login {
  padding: 7px 14px; border-radius: 100px;
  background: var(--teal); color: #061018;
  font-size: 13px; font-weight: 700;
  transition: opacity .15s;
  white-space: nowrap;
}
.btn-login:hover { opacity: .88; }
.user-badge { display: flex; align-items: center; gap: 8px; }
.user-ava {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--teal-d); border: 2px solid var(--teal);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: var(--teal);
  overflow: hidden;
}
.user-ava img { width: 100%; height: 100%; object-fit: cover; }

/* ── Main content ── */
#app {
  min-height: 100svh;
  padding-top: var(--nav-h);
}

/* ── Loading screen ── */
.loading-screen {
  position: fixed; inset: 0; z-index: 999;
  background: var(--bg1);
  display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 24px;
}
.loading-content { text-align: center; position: relative; z-index: 2; }
.loading-logo {
  width: 72px; height: 72px; margin: 0 auto 16px;
  background: var(--teal-d); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--teal); animation: pulse 2s ease-in-out infinite;
}
.loading-content h1 { font-family: var(--ff); font-size: 2rem; color: var(--text); line-height: 1.2; }
.loading-content h1 em { color: var(--teal); font-style: normal; }
.loader-dots { display: flex; gap: 6px; justify-content: center; margin-top: 20px; }
.loader-dots span {
  width: 8px; height: 8px; border-radius: 50%; background: var(--teal);
  animation: dotBounce 1.2s ease-in-out infinite;
}
.loader-dots span:nth-child(2) { animation-delay: .2s; }
.loader-dots span:nth-child(3) { animation-delay: .4s; }
@keyframes dotBounce { 0%,80%,100%{transform:scale(0)} 40%{transform:scale(1)} }
@keyframes pulse { 0%,100%{transform:scale(1)} 50%{transform:scale(1.08)} }

/* Aurora background */
.aurora {
  position: absolute; inset: 0; overflow: hidden; z-index: 1;
  pointer-events: none;
}
.aurora::before, .aurora::after {
  content: ''; position: absolute;
  width: 600px; height: 300px; border-radius: 50%;
  filter: blur(100px); opacity: .12;
  animation: auroraMove 8s ease-in-out infinite alternate;
}
.aurora::before { background: var(--teal); top: -100px; left: -100px; }
.aurora::after  { background: #6b48ff; bottom: -100px; right: -100px; animation-delay: -4s; }
@keyframes auroraMove {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(60px, 30px) scale(1.1); }
}

/* Snowflakes */
.snowflakes {
  position: absolute; top: 0; left: 0; right: 0; pointer-events: none;
  display: flex; justify-content: space-around;
}
.snowflakes span {
  color: rgba(255,255,255,.15); font-size: 20px;
  animation: snowFall linear infinite;
}
.snowflakes span:nth-child(1){animation-duration:6s;animation-delay:0s;}
.snowflakes span:nth-child(2){animation-duration:8s;animation-delay:1s;font-size:14px}
.snowflakes span:nth-child(3){animation-duration:7s;animation-delay:2s;font-size:24px}
.snowflakes span:nth-child(4){animation-duration:9s;animation-delay:0.5s;font-size:12px}
.snowflakes span:nth-child(5){animation-duration:5s;animation-delay:3s;}
@keyframes snowFall { from{transform:translateY(-20px)opacity:1} to{transform:translateY(100vh)opacity:0} }

/* ── Home page ── */
.page-wrap { max-width: 900px; margin: 0 auto; padding: 32px 16px 64px; }
.page-hero { text-align: center; padding: 40px 20px 32px; }
.page-hero h1 { font-family: var(--ff); font-size: clamp(2rem,5vw,3rem); line-height: 1.15; }
.page-hero h1 em { color: var(--teal); font-style: normal; }
.page-hero p { color: var(--text-sub); font-size: 16px; margin-top: 12px; }

/* Daily status bar */
.daily-status {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 18px;
  margin-bottom: 24px; display: flex; align-items: center;
  gap: 12px; flex-wrap: wrap;
}
.daily-dot {
  width: 10px; height: 10px; border-radius: 50%; background: var(--green);
  box-shadow: 0 0 8px var(--green); flex-shrink: 0;
}
.daily-dot.played { background: var(--teal); box-shadow: 0 0 8px var(--teal); }
.daily-countdown { margin-left: auto; font-size: 13px; color: var(--text-muted); font-variant-numeric: tabular-nums; }

/* Game grid */
.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 32px;
}
.game-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px 16px;
  cursor: pointer; transition: all .2s;
  text-align: center; position: relative; overflow: hidden;
}
.game-card::before {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(135deg, var(--teal-dd), transparent);
  opacity: 0; transition: opacity .2s;
}
.game-card:hover { border-color: var(--teal); transform: translateY(-3px); box-shadow: var(--shadow); }
.game-card:hover::before { opacity: 1; }
.game-card.daily-done { border-color: rgba(74,222,128,.3); }
.game-card.daily-done .game-badge { background: rgba(74,222,128,.15); color: var(--green); }
.game-icon { font-size: 2.5rem; margin-bottom: 10px; display: block; }
.game-title { font-family: var(--ff); font-size: 1.1rem; font-weight: 700; margin-bottom: 4px; }
.game-desc { font-size: 12px; color: var(--text-muted); line-height: 1.5; }
.game-badge {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--teal-d); color: var(--teal);
  font-size: 11px; font-weight: 700;
  padding: 3px 8px; border-radius: 100px; margin-top: 8px;
}
.game-badge.done { background: rgba(74,222,128,.15); color: var(--green); }

/* ── Wordle ── */
.wordle-wrap { max-width: 420px; margin: 0 auto; padding: 16px; }
.wordle-header { text-align: center; margin-bottom: 20px; }
.wordle-header h2 { font-family: var(--ff); font-size: 1.5rem; }
.wordle-mode-tabs { display: flex; gap: 6px; justify-content: center; margin-top: 10px; }
.mode-tab {
  padding: 6px 16px; border-radius: 100px; font-size: 13px; font-weight: 600;
  background: none; border: 1.5px solid var(--border); color: var(--text-sub); transition: all .15s;
}
.mode-tab.active { background: var(--teal); border-color: var(--teal); color: #061018; }

/* Game board */
.wordle-board {
  display: grid; grid-template-rows: repeat(6, 1fr);
  gap: 6px; margin-bottom: 20px;
}
.wordle-row { display: flex; gap: 6px; justify-content: center; }
.wordle-tile {
  width: 56px; height: 56px; border-radius: 8px;
  border: 2px solid var(--border); background: var(--bg3);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--ff); font-size: 1.5rem; font-weight: 700;
  text-transform: uppercase; color: var(--text);
  transition: border-color .1s;
  position: relative; overflow: hidden;
}
.wordle-tile.has-letter { border-color: rgba(255,255,255,.4); animation: tileScale .1s ease; }
.wordle-tile.correct  { background: #4ade80; border-color: #4ade80; color: #061018; }
.wordle-tile.present  { background: #fbbf24; border-color: #fbbf24; color: #061018; }
.wordle-tile.absent   { background: #374151; border-color: #374151; color: rgba(255,255,255,.5); }
.wordle-tile.reveal { animation: flipTile .5s ease forwards; }
@keyframes tileScale { 0%{transform:scale(1)} 50%{transform:scale(1.08)} 100%{transform:scale(1)} }
@keyframes flipTile {
  0%   { transform: rotateX(0); }
  50%  { transform: rotateX(-90deg); }
  100% { transform: rotateX(0); }
}
.wordle-tile.shake { animation: shakeTile .4s ease; }
@keyframes shakeTile {
  0%,100%{transform:translateX(0)}
  25%{transform:translateX(-6px)}
  75%{transform:translateX(6px)}
}

/* Keyboard */
.wordle-keyboard { display: flex; flex-direction: column; gap: 6px; align-items: center; }
.kb-row { display: flex; gap: 5px; }
.kb-key {
  min-width: 36px; height: 48px; padding: 0 6px;
  border-radius: 6px; font-family: var(--fb); font-size: 13px; font-weight: 700;
  background: var(--bg3); border: 1px solid var(--border); color: var(--text);
  transition: all .1s; -webkit-tap-highlight-color: transparent;
}
.kb-key:hover { background: var(--card-hover); }
.kb-key.wide { min-width: 54px; font-size: 11px; }
.kb-key.correct { background: #4ade80; border-color: #4ade80; color: #061018; }
.kb-key.present { background: #fbbf24; border-color: #fbbf24; color: #061018; }
.kb-key.absent  { background: #1f2937; border-color: #1f2937; color: rgba(255,255,255,.3); }

/* ── Result modal ── */
.result-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.7);
  z-index: 200; display: flex; align-items: flex-end;
  justify-content: center; padding: 16px;
  animation: fadeIn .2s ease;
}
@media(min-width:600px) { .result-overlay { align-items: center; } }
@keyframes fadeIn { from{opacity:0} to{opacity:1} }
.result-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 28px 24px;
  width: 100%; max-width: 420px; text-align: center;
  animation: slideUp .3s cubic-bezier(.34,1.56,.64,1);
}
@keyframes slideUp { from{transform:translateY(30px)opacity:0} to{transform:translateY(0)opacity:1} }
.result-emoji { font-size: 3rem; margin-bottom: 10px; }
.result-title { font-family: var(--ff); font-size: 1.5rem; margin-bottom: 6px; }
.result-word {
  font-family: var(--ff); font-size: 2rem; font-weight: 900;
  color: var(--teal); letter-spacing: 4px; margin: 14px 0 10px;
  text-transform: uppercase;
}
.result-def { font-size: 14px; color: var(--text-sub); line-height: 1.65; margin-bottom: 16px; }
.result-example {
  font-size: 13px; color: var(--text-muted);
  font-style: italic; border-left: 3px solid var(--teal);
  padding-left: 12px; text-align: left; margin-bottom: 20px;
}
.result-xp {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--teal-d); color: var(--teal);
  font-size: 14px; font-weight: 700; padding: 6px 14px;
  border-radius: 100px; margin-bottom: 16px;
}
.result-actions { display: flex; gap: 10px; flex-direction: column; }
.result-row-dots { display: flex; gap: 6px; justify-content: center; margin-bottom: 14px; }
.result-dot { width: 10px; height: 10px; border-radius: 50%; }
.result-dot.correct { background: #4ade80; }
.result-dot.present { background: #fbbf24; }
.result-dot.absent  { background: #374151; }

/* Knapp: TTS */
.tts-btn {
  display: flex; align-items: center; gap: 6px; justify-content: center;
  background: none; border: 1px solid var(--border);
  border-radius: 100px; padding: 8px 16px;
  font-size: 13px; color: var(--text-sub); transition: all .15s;
  width: 100%;
}
.tts-btn:hover { border-color: var(--teal); color: var(--teal); }

/* ── Buttons ── */
.btn-primary {
  background: var(--teal); color: #061018;
  border: none; border-radius: 100px;
  padding: 12px 24px; font-size: 15px; font-weight: 700;
  transition: opacity .15s; width: 100%; text-align: center;
}
.btn-primary:hover { opacity: .88; }
.btn-secondary {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 100px; padding: 12px 24px;
  font-size: 14px; font-weight: 600; color: var(--text);
  transition: all .15s; width: 100%; text-align: center;
}
.btn-secondary:hover { background: var(--card-hover); border-color: var(--teal); color: var(--teal); }

/* ── Hangman ── */
.hangman-wrap { max-width: 460px; margin: 0 auto; padding: 16px; text-align: center; }
.hangman-svg { width: 200px; height: 200px; margin: 0 auto 16px; }
.hangman-word {
  display: flex; gap: 8px; justify-content: center;
  flex-wrap: wrap; margin-bottom: 20px;
}
.hangman-letter {
  width: 36px; height: 42px; border-bottom: 3px solid var(--text);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--ff); font-size: 1.5rem; font-weight: 700;
  text-transform: uppercase;
}
.hangman-hint { font-size: 13px; color: var(--text-muted); margin-bottom: 16px; }
.hangman-lives { display: flex; gap: 4px; justify-content: center; margin-bottom: 16px; }
.hangman-heart { font-size: 18px; transition: all .3s; }
.hangman-heart.lost { filter: grayscale(1); opacity: .3; transform: scale(.8); }
.hangman-keyboard { display: flex; flex-wrap: wrap; gap: 5px; justify-content: center; max-width: 320px; margin: 0 auto; }
.hm-key {
  width: 36px; height: 36px; border-radius: 6px;
  background: var(--bg3); border: 1px solid var(--border);
  color: var(--text); font-weight: 700; font-size: 13px;
  transition: all .1s;
}
.hm-key:hover:not(:disabled) { background: var(--teal-d); border-color: var(--teal); }
.hm-key:disabled { opacity: .3; cursor: default; }
.hm-key.correct { background: rgba(74,222,128,.2); border-color: #4ade80; color: #4ade80; }
.hm-key.wrong   { background: rgba(255,95,95,.1); border-color: #ff5f5f; color: rgba(255,255,255,.3); }

/* ── Quiz ── */
.quiz-wrap { max-width: 520px; margin: 0 auto; padding: 16px; }
.quiz-question {
  font-family: var(--ff); font-size: 1.3rem; font-weight: 700;
  text-align: center; margin-bottom: 24px; line-height: 1.4;
}
.quiz-timer-bar { height: 6px; background: var(--bg3); border-radius: 3px; margin-bottom: 20px; overflow: hidden; }
.quiz-timer-fill { height: 100%; background: var(--teal); border-radius: 3px; transition: width .1s linear; }
.quiz-options, .quiz-opts { display: grid; gap: 10px; }
.quiz-option, .quiz-opt {
  padding: 14px 16px; border-radius: var(--radius-sm);
  background: var(--card); border: 1.5px solid var(--border);
  text-align: left; font-size: 15px; font-weight: 500; width: 100%;
  color: var(--text); cursor: pointer; font-family: var(--fb); transition: all .15s;
}
.quiz-option:hover:not(:disabled), .quiz-opt:hover:not(:disabled) { border-color: var(--teal); background: var(--teal-dd); }
.quiz-option.correct, .quiz-opt.correct { border-color: #4ade80; background: rgba(74,222,128,.12); color: #4ade80; }
.quiz-option.wrong, .quiz-opt.wrong     { border-color: #ff5f5f; background: rgba(255,95,95,.08); color: #ff5f5f; }
.quiz-score { text-align: center; font-size: 2rem; font-weight: 700; color: var(--teal); margin: 16px 0 6px; font-family: var(--ff); }

/* ── Leaderboard ── */
.leaderboard-wrap { max-width: 700px; margin: 0 auto; padding: 20px 16px 64px; }
.lb-tabs { display: flex; gap: 6px; margin-bottom: 20px; flex-wrap: wrap; }
.lb-tab {
  padding: 8px 16px; border-radius: 100px; font-size: 13px; font-weight: 600;
  background: none; border: 1.5px solid var(--border); color: var(--text-sub);
  transition: all .15s;
}
.lb-tab.active { background: var(--teal); border-color: var(--teal); color: #061018; }
.lb-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--card);
  margin-bottom: 8px; transition: all .15s;
}
.lb-row:hover { border-color: rgba(62,207,190,.3); }
.lb-row.me { border-color: var(--teal); background: var(--teal-dd); }
.lb-rank {
  width: 30px; text-align: center; font-size: 13px; font-weight: 700;
  color: var(--text-muted); flex-shrink: 0;
}
.lb-rank.gold   { color: var(--gold); font-size: 16px; }
.lb-rank.silver { color: #b0bec5; font-size: 16px; }
.lb-rank.bronze { color: #cd7f32; font-size: 16px; }
.lb-ava {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--teal-d); border: 2px solid transparent;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: var(--teal);
  overflow: hidden; flex-shrink: 0;
}
.lb-ava img { width: 100%; height: 100%; object-fit: cover; }
.lb-name { flex: 1; font-weight: 600; font-size: 14px; min-width: 0; }
.lb-sub  { font-size: 11px; color: var(--text-muted); }
.lb-xp   { font-weight: 700; color: var(--teal); font-size: 14px; white-space: nowrap; }
.lb-level{ background: var(--teal-d); color: var(--teal); font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 100px; }

/* ── Profile ── */
.profile-wrap { max-width: 700px; margin: 0 auto; padding: 20px 16px 64px; }
.profile-header {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px;
  display: flex; gap: 20px; align-items: flex-start; flex-wrap: wrap;
  margin-bottom: 16px;
}
.profile-ava {
  width: 72px; height: 72px; border-radius: 50%;
  background: var(--teal-d); border: 3px solid var(--teal);
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; font-weight: 700; color: var(--teal);
  overflow: hidden; flex-shrink: 0;
}
.profile-ava img { width: 100%; height: 100%; object-fit: cover; }
.profile-meta { flex: 1; }
.profile-name { font-family: var(--ff); font-size: 1.4rem; font-weight: 700; margin-bottom: 2px; }
.level-badge {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--teal-d); color: var(--teal);
  font-size: 12px; font-weight: 700; padding: 3px 10px;
  border-radius: 100px; margin-bottom: 10px;
}
.xp-bar {
  height: 8px; background: var(--bg1); border-radius: 4px;
  overflow: hidden; margin-bottom: 6px;
}
.xp-bar div { height: 100%; background: var(--teal); border-radius: 4px; transition: width .6s ease; }
.xp-label { font-size: 11px; color: var(--text-muted); }
.stats-grid {
  display: grid; grid-template-columns: repeat(4,1fr); gap: 10px;
  margin-bottom: 16px;
}
@media(max-width:480px) { .stats-grid { grid-template-columns: repeat(2,1fr); } }
.stat-box {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 14px; text-align: center;
}
.stat-n { font-family: var(--ff); font-size: 1.6rem; font-weight: 700; color: var(--teal); display: block; }
.stat-l { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; }

/* Achievements grid */
.ach-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(140px,1fr)); gap: 10px; }
.ach-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 14px; text-align: center;
  transition: all .2s;
}
.ach-card.unlocked { border-color: rgba(245,200,66,.3); }
.ach-card.locked   { opacity: .4; filter: grayscale(1); }
.ach-card:hover.unlocked { transform: translateY(-2px); box-shadow: 0 4px 16px rgba(245,200,66,.15); }
.ach-icon-big { font-size: 2rem; margin-bottom: 6px; display: block; }
.ach-name-sm { font-size: 12px; font-weight: 600; margin-bottom: 3px; }
.ach-desc-sm { font-size: 11px; color: var(--text-muted); line-height: 1.4; }
.ach-rarity { font-size: 10px; font-weight: 700; margin-top: 5px; }
.ach-rarity.common    { color: #9aabb8; }
.ach-rarity.rare      { color: var(--blue); }
.ach-rarity.epic      { color: #a855f7; }
.ach-rarity.legendary { color: var(--gold); }

/* Heatmap */
.heatmap-wrap { overflow-x: auto; padding-bottom: 6px; }
.heatmap {
  display: grid;
  grid-template-columns: repeat(53, 1fr);
  gap: 2px; min-width: 700px;
}
.heatmap-cell {
  width: 12px; height: 12px; border-radius: 2px;
  background: var(--bg3); transition: background .2s;
  cursor: default;
}
.heatmap-cell[data-count="0"] { background: var(--bg3); }
.heatmap-cell[data-count="1"] { background: rgba(62,207,190,.25); }
.heatmap-cell[data-count="2"] { background: rgba(62,207,190,.5); }
.heatmap-cell[data-count="3"] { background: rgba(62,207,190,.75); }
.heatmap-cell[data-count="4"] { background: var(--teal); }

/* Section titles */
.section-title {
  font-family: var(--ff); font-size: 1rem; font-weight: 700;
  color: var(--text-sub); text-transform: uppercase;
  letter-spacing: .08em; margin-bottom: 12px;
  display: flex; align-items: center; gap: 8px;
}
.section-title::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* ── Level up modal ── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.8);
  z-index: 300; display: flex; align-items: center; justify-content: center;
  animation: fadeIn .2s ease;
}
.level-up-card {
  background: var(--bg2); border: 2px solid var(--gold);
  border-radius: var(--radius); padding: 40px 32px; text-align: center;
  max-width: 340px; width: 90%;
  animation: levelUpBounce .5s cubic-bezier(.34,1.56,.64,1);
  box-shadow: 0 0 60px rgba(245,200,66,.3);
}
@keyframes levelUpBounce { from{transform:scale(.5)opacity:0} to{transform:scale(1)opacity:1} }
.level-up-stars { font-size: 1.5rem; margin-bottom: 10px; animation: starSpin 1s ease; }
@keyframes starSpin { from{transform:rotate(-20deg)scale(.8)} to{transform:rotate(0)scale(1)} }
.level-up-badge {
  width: 80px; height: 80px; border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), #f59e0b);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 14px; box-shadow: 0 0 30px rgba(245,200,66,.5);
}
.level-up-num { font-family: var(--ff); font-size: 2rem; font-weight: 900; color: #061018; }
.level-up-card h2 { font-family: var(--ff); font-size: 1.8rem; color: var(--gold); margin-bottom: 8px; }
.level-up-card p { color: var(--text-sub); margin-bottom: 20px; }

/* Achievement popup */
.achievement-popup {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  z-index: 400; animation: slideUpPop .4s cubic-bezier(.34,1.56,.64,1);
}
@keyframes slideUpPop { from{transform:translateX(-50%) translateY(40px)opacity:0} to{transform:translateX(-50%) translateY(0)opacity:1} }
.achievement-popup-inner {
  background: var(--bg2); border: 2px solid var(--gold);
  border-radius: 100px; padding: 12px 20px;
  display: flex; align-items: center; gap: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,.4);
  white-space: nowrap;
}
.ach-label { font-size: 10px; color: var(--gold); font-weight: 700; text-transform: uppercase; letter-spacing: .1em; }
.ach-name  { font-size: 14px; font-weight: 700; }
.ach-icon  { font-size: 1.5rem; }

/* ── Toast ── */
#toast-container { position: fixed; top: 80px; left: 50%; transform: translateX(-50%); z-index: 500; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 100px; padding: 10px 20px; font-size: 14px;
  font-weight: 600; white-space: nowrap;
  box-shadow: var(--shadow); animation: toastIn .3s ease;
  pointer-events: all;
}
.toast.err   { border-color: var(--red); color: var(--red); }
.toast.ok    { border-color: var(--green); color: var(--green); }
.toast.info  { border-color: var(--teal); color: var(--teal); }
@keyframes toastIn { from{opacity:0;transform:translateY(-8px)} to{opacity:1;transform:translateY(0)} }

/* ── Streak badge ── */
.streak-badge {
  display: inline-flex; align-items: center; gap: 4px;
  background: rgba(255,95,0,.15); color: #ff9500;
  font-size: 13px; font-weight: 700; padding: 4px 12px;
  border-radius: 100px; border: 1px solid rgba(255,149,0,.3);
}

/* ── Guest banner ── */
.guest-banner {
  background: var(--teal-dd); border: 1px solid rgba(62,207,190,.2);
  border-radius: var(--radius-sm); padding: 12px 16px;
  display: flex; align-items: center; gap: 10px;
  font-size: 13px; color: var(--text-sub); margin-bottom: 16px;
  flex-wrap: wrap;
}
.guest-banner strong { color: var(--teal); }
.guest-banner a { color: var(--teal); font-weight: 700; text-decoration: underline; }

/* ── Responsive ── */
@media(max-width:480px) {
  .games-grid { grid-template-columns: 1fr 1fr; }
  .wordle-tile { width: 48px; height: 48px; font-size: 1.3rem; }
  .kb-key { min-width: 30px; height: 44px; font-size: 12px; }
  .kb-key.wide { min-width: 46px; }
  .nav-links { display: none; }
}
@media(max-width:340px) {
  .wordle-tile { width: 42px; height: 42px; font-size: 1.1rem; }
  .kb-key { min-width: 27px; }
}

/* ================================================================
   OVERRIDE: Wordle full-page layout, bigger tiles
   ================================================================ */
.wordle-page {
  display: flex;
  flex-direction: column;
  height: calc(100svh - var(--nav-h));
  max-width: 600px;
  margin: 0 auto;
  padding: 12px 16px;
}
.wordle-topbar {
  text-align: center;
  padding-bottom: 8px;
  flex-shrink: 0;
}
.back-btn {
  background: none; border: none;
  color: var(--text-muted); font-size: 13px;
  display: flex; align-items: center; gap: 4px;
  margin-bottom: 6px; cursor: pointer; padding: 0;
}
.back-btn:hover { color: var(--text); }
.wordle-title { font-family: var(--ff); font-size: 1.4rem; margin: 0 0 8px; }

.wordle-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
  min-height: 0;
}

/* Board scales to fill available space */
.wordle-board {
  flex: 1;
  display: grid;
  grid-template-rows: repeat(6, 1fr);
  gap: clamp(4px, 1vw, 8px);
  max-height: 420px;
  margin: 0 auto;
  width: 100%;
}

.wordle-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: clamp(4px, 1vw, 8px);
  max-width: 340px;
  margin: 0 auto;
  width: 100%;
}

/* Tiles: square, sized to fill row */
.wordle-tile {
  aspect-ratio: 1;
  width: 100%;
  max-width: 68px;
  border-radius: clamp(6px, 1.5vw, 10px);
  border: 2.5px solid var(--border);
  background: var(--bg3);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--ff);
  font-size: clamp(1.4rem, 4.5vw, 2rem);
  font-weight: 900;
  text-transform: uppercase;
  color: var(--text);
  transition: border-color .1s;
  perspective: 250px;
}

/* Desktop: bigger tiles */
@media (min-width: 500px) {
  .wordle-row { max-width: 380px; }
  .wordle-tile { max-width: 72px; }
}
@media (min-width: 700px) {
  .wordle-row { max-width: 420px; }
  .wordle-tile { max-width: 80px; font-size: 2.2rem; }
  .wordle-board { max-height: 520px; }
}

/* Keyboard fills width */
.wordle-keyboard {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-bottom: 8px;
}
.kb-row {
  display: flex;
  gap: 4px;
  justify-content: center;
}
.kb-key {
  flex: 1;
  max-width: 44px;
  height: 52px;
  border-radius: 8px;
  font-family: var(--fb);
  font-size: 14px;
  font-weight: 700;
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text);
  transition: all .1s;
  -webkit-tap-highlight-color: transparent;
  cursor: pointer;
}
.kb-key.wide { flex: 1.6; max-width: 66px; font-size: 12px; }
.kb-key:active { transform: scale(.94); }

@media (min-width: 500px) {
  .kb-key { height: 58px; font-size: 15px; }
  .kb-key.wide { max-width: 72px; }
}

/* Hangman + Quiz: max width on desktop */
.hangman-wrap, .quiz-wrap {
  max-width: 520px;
  margin: 0 auto;
  padding: 20px 16px 48px;
}
.hangman-svg { width: min(240px, 60vw); height: min(240px, 60vw); margin: 0 auto 16px; }

/* Nav username hidden on small screens */
.user-name-nav { display: none; }
@media (min-width: 500px) { .user-name-nav { display: inline; font-size: 13px; font-weight: 600; } }

/* Nav burger */
.nav__burger {
  display: none;
  flex-direction: column; gap: 5px;
  background: none; border: none; cursor: pointer; padding: 6px;
}
.nav__burger span { width: 22px; height: 2px; background: var(--text-sub); border-radius: 2px; display: block; }
@media (max-width: 600px) {
  .nav-links { display: none; }
  .nav__burger { display: flex; }
}

/* ── Mode pills (daily / practice) ── */
.mode-pill {
  display: inline-flex; align-items: center; font-size: 11px; font-weight: 700;
  padding: 3px 10px; border-radius: 100px; letter-spacing: .05em;
}
.mode-pill.daily   { background: rgba(62,207,190,.15); color: var(--teal); border: 1px solid rgba(62,207,190,.3); }
.mode-pill.practice{ background: rgba(255,255,255,.07); color: var(--text-muted); border: 1px solid var(--border); }

/* ── Section label ── */
.section-label {
  font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: var(--text-muted); margin: 20px 0 10px; padding: 0 4px;
}

/* ── Hangman letter revealed ── */
.hangman-letter.revealed { color: var(--teal); border-color: var(--teal); }

/* ── Hangman bigger on desktop ── */
@media (min-width: 600px) {
  .hangman-wrap, .quiz-wrap { max-width: 640px; padding: 28px 24px 60px; }
  .hangman-svg { width: 280px; height: 280px; }
  .hangman-word { gap: 10px; }
  .hangman-letter { width: 44px; height: 52px; font-size: 1.8rem; }
  .hm-key { width: 42px; height: 42px; font-size: 14px; }
  .hangman-keyboard { max-width: 400px; gap: 7px; }
}

/* ── Wordle bigger board on desktop ── */
@media (min-width: 600px) {
  .wordle-tile { width: 68px; height: 68px; font-size: 2rem; }
}
@media (min-width: 800px) {
  .wordle-page { max-width: 560px; margin: 0 auto; }
  .wordle-tile { width: 72px; height: 72px; font-size: 2.1rem; }
}

/* ── Quiz bigger on desktop ── */
@media (min-width: 600px) {
  .quiz-wrap { padding: 28px 32px 60px; }
  .quiz-card { padding: 32px; }
  .quiz-q { font-size: 1.3rem; }
  .quiz-opt { padding: 14px 20px; font-size: 16px; }
}

/* ══════════════════════════════════════════════════════════════
   CROSSWORD
   ══════════════════════════════════════════════════════════════ */
:root { --cw-cell-size: 34px; }
@media (min-width: 480px) { :root { --cw-cell-size: 38px; } }
@media (min-width: 700px) { :root { --cw-cell-size: 44px; } }

.cw-wrap {
  max-width: 900px;
  margin: 0 auto;
  padding: 20px 16px 60px;
}

#cw-main {
  gap: 24px;
  align-items: flex-start;
}

.cw-grid {
  display: grid;
  gap: 2px;
  background: var(--border);
  border: 2px solid var(--border);
  border-radius: 8px;
  padding: 2px;
  flex-shrink: 0;
}

.cw-cell {
  width: var(--cw-cell-size);
  height: var(--cw-cell-size);
  background: var(--bg3);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  border-radius: 3px;
  border: 1px solid var(--border);
  transition: background .1s;
  outline: none;
}

.cw-cell.black {
  background: rgba(0,0,0,.6);
  cursor: default;
  border-color: transparent;
}

.cw-cell.hl   { background: rgba(62,207,190,.15); border-color: rgba(62,207,190,.4); }
.cw-cell.sel  { background: rgba(62,207,190,.35); border-color: var(--teal); }
.cw-cell.correct { background: rgba(74,222,128,.2); border-color: var(--green); }
.cw-cell.wrong   { background: rgba(255,95,95,.15); border-color: var(--red); }

.cw-cell:hover:not(.black) { background: var(--card-hover); }
.cw-cell.hl:hover  { background: rgba(62,207,190,.22); }
.cw-cell.sel:hover { background: rgba(62,207,190,.4); }

.cw-num {
  position: absolute;
  top: 2px;
  left: 3px;
  font-size: 9px;
  font-weight: 700;
  color: var(--text-muted);
  line-height: 1;
  pointer-events: none;
}

.cw-letter {
  font-size: calc(var(--cw-cell-size) * .45);
  font-weight: 700;
  color: var(--text);
  pointer-events: none;
  line-height: 1;
}

.cw-clues {
  flex: 1;
  min-width: 200px;
  max-width: 320px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.cw-clue-group {}

.cw-clue-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--teal);
  margin-bottom: 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}

.cw-clue-item {
  padding: 6px 8px;
  font-size: 13px;
  color: var(--text-sub);
  border-radius: 6px;
  cursor: pointer;
  line-height: 1.4;
  transition: background .1s, color .1s;
}

.cw-clue-item:hover { background: var(--card); color: var(--text); }
.cw-clue-item.active {
  background: rgba(62,207,190,.12);
  color: var(--teal);
  font-weight: 600;
}

[data-theme="light"] .cw-cell { background: #fff; border-color: rgba(0,0,0,.15); }
[data-theme="light"] .cw-cell.black { background: #1a1a2e; }
[data-theme="light"] .cw-letter { color: #0c1928; }
[data-theme="light"] .cw-num { color: #888; }
