/* ══════════════════════════════════════════════════
   WORDMANTICS — Redesign: clean, mobile-first, focused
   ══════════════════════════════════════════════════ */

@font-face {
  font-family: 'Nunito';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url('/fonts/nunito.woff2') format('woff2');
}

/* ── Light theme ── */
:root {
  --bg: #F5F6FA;
  --surface: #ffffff;
  --text: #1a1a2e;
  --muted: #7a7f8e;
  --border: #e2e5ed;
  --shadow: 0 2px 8px rgba(0,0,0,0.05);
  --primary: #2B8A8A;
  --primary-hover: #237272;
  --primary-glow: rgba(43,138,138,0.15);
  --danger: #c0392b;
  --ok: #1f7a47;
  --cold: #5B8DEF;
  --lukewarm: #6BC5B8;
  --cool: #3ABAB4;
  --warm: #F0C040;
  --hot: #F09040;
  --fire: #E06030;
  --max: #E04848;
  --perfect: #C040E0;
  --input-bg: #ffffff;
  --input-border: #d1d5db;
  --input-focus: #2B8A8A;
  --hint-bg: #eef8f7;
  --hint-border: #b2dfdb;
  --radius: 14px;
  --radius-sm: 10px;
}

/* ── Dark theme ── */
[data-theme="dark"] {
  --bg: #0f1629;
  --surface: #1a2248;
  --text: #eef0f6;
  --muted: #8b90a0;
  --border: #2a3362;
  --shadow: 0 2px 12px rgba(0,0,0,0.25);
  --primary: #4ECDC4;
  --primary-hover: #3ABAB4;
  --primary-glow: rgba(78,205,196,0.2);
  --danger: #f87171;
  --ok: #4ade80;
  --cold: #5B8DEF;
  --lukewarm: #6BC5B8;
  --cool: #3ABAB4;
  --warm: #F0C040;
  --hot: #F09040;
  --fire: #E06030;
  --max: #E04848;
  --perfect: #C040E0;
  --input-bg: #1e2750;
  --input-border: #2a3362;
  --input-focus: #4ECDC4;
  --hint-bg: rgba(78,205,196,0.08);
  --hint-border: rgba(78,205,196,0.2);
}

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

.hidden { display: none !important; }

/* ── Loading overlay ── */
.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.4s ease;
}
.loading-overlay.fade-out {
  opacity: 0;
  pointer-events: none;
}
.loading-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.loading-logo {
  border-radius: 50%;
  animation: loadingPulse 1.5s ease-in-out infinite;
}
@keyframes loadingPulse {
  0%, 100% { transform: scale(1); opacity: 0.8; }
  50% { transform: scale(1.1); opacity: 1; }
}
.loading-title {
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: var(--text);
}
.loading-dots {
  display: flex;
  gap: 6px;
}
.loading-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
  animation: loadingBounce 1.2s ease-in-out infinite;
}
.loading-dots span:nth-child(2) { animation-delay: 0.15s; }
.loading-dots span:nth-child(3) { animation-delay: 0.3s; }
@keyframes loadingBounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Nunito", -apple-system, system-ui, sans-serif;
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  transition: background 0.3s, color 0.3s;
}

.hidden { display: none !important; }

/* ── Layout ── */
.app {
  max-width: 560px;
  margin: 0 auto;
  padding: 12px 16px 32px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ── Topbar ── */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
}
.topbar-left {
  display: flex;
  align-items: center;
  gap: 8px;
}
.brand-logo { border-radius: 50%; }
.brand-name {
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.1em;
}
.score-pill {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--primary);
  background: var(--hint-bg);
  border: 1px solid var(--hint-border);
  border-radius: 99px;
  padding: 2px 10px;
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: 4px;
}
.icon-btn {
  background: none;
  border: 1px solid transparent;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  color: var(--text);
}
.icon-btn:hover { background: var(--border); }

/* ── Hero section ── */
.hero {
  text-align: center;
  padding: 4px 0;
}
.hero-meta {
  font-size: 0.78rem;
  color: var(--muted);
}
.hero-category {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--primary);
  margin-top: 4px;
  padding: 6px 16px;
  background: var(--hint-bg);
  border: 1px solid var(--hint-border);
  border-radius: 99px;
  display: inline-block;
}
.hero-category:empty { display: none; }
.hero-target {
  font-weight: 700;
  color: var(--danger);
  font-size: 1rem;
  margin-top: 6px;
}
.hero-target:empty { display: none; }

/* ── Input section — THE main element ── */
.input-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}
.guess-form {
  display: flex;
  gap: 10px;
}
#guess-input {
  flex: 1;
  border: 2px solid var(--input-border);
  border-radius: 99px;
  padding: 14px 20px;
  font-size: 1.1rem;
  font-family: inherit;
  font-weight: 600;
  background: var(--input-bg);
  color: var(--text);
  transition: border-color 0.2s, box-shadow 0.2s;
}
#guess-input:focus {
  outline: none;
  border-color: var(--input-focus);
  box-shadow: 0 0 0 4px var(--primary-glow);
}
#guess-input:disabled {
  opacity: 0.5;
}
.btn-submit {
  border: none;
  border-radius: 99px;
  padding: 14px 24px;
  font-size: 1rem;
  font-weight: 800;
  font-family: inherit;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.2s;
  white-space: nowrap;
}
.btn-submit:hover {
  box-shadow: 0 4px 16px var(--primary-glow);
  transform: translateY(-1px);
}
.btn-submit:active { transform: scale(0.97); }
.btn-submit:disabled { opacity: 0.5; cursor: not-allowed; }

@keyframes shake {
  0%,100% { transform: translateX(0); }
  20%,60% { transform: translateX(-6px); }
  40%,80% { transform: translateX(6px); }
}
#guess-input.shake { animation: shake 0.35s ease; border-color: var(--danger); }

/* Suggestions */
.suggestions-wrap {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.suggestions-list {
  list-style: none;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.suggestion-btn {
  border: 1px solid var(--border);
  border-radius: 99px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.85rem;
  font-family: inherit;
  padding: 5px 14px;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.1s;
}
.suggestion-btn:hover { border-color: var(--input-focus); transform: scale(1.03); }

/* Status */
.status { min-height: 20px; margin-top: 8px; font-weight: 700; font-size: 0.9rem; }
.status.error { color: var(--danger); }
.status.ok { color: var(--ok); }

/* Next game banner */
.next-game-banner {
  margin-top: 12px;
  padding: 14px 16px;
  background: var(--hint-bg);
  border: 1px solid var(--hint-border);
  border-radius: 12px;
  text-align: center;
}
.next-game-msg {
  font-size: 0.95rem;
  margin-bottom: 6px;
}
.next-game-countdown {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  color: var(--primary);
}

/* ── Dashboard: progress + stats ── */
.dashboard {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.progress-area {
  display: flex;
  align-items: center;
  gap: 10px;
}
.progress-bar-wrap {
  flex: 1;
  height: 10px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  border-radius: 99px;
  width: 0%;
  transition: width 0.6s cubic-bezier(.4,0,.2,1), background 0.4s;
}
.progress-bar-fill.heat-cold { background: var(--cold); }
.progress-bar-fill.heat-lukewarm { background: var(--lukewarm); }
.progress-bar-fill.heat-cool { background: var(--cool); }
.progress-bar-fill.heat-warm { background: var(--warm); }
.progress-bar-fill.heat-hot  { background: var(--hot); }
.progress-bar-fill.heat-fire { background: var(--fire); }
.progress-bar-fill.heat-max  { background: var(--max); }
.progress-bar-fill.heat-perfect { background: var(--perfect); }
.progress-label {
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--muted);
  min-width: 48px;
  text-align: right;
}
.quick-stats {
  display: flex;
  justify-content: space-around;
}
.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.stat-val {
  font-size: 1.4rem;
  font-weight: 800;
}
.stat-lbl {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ── Action row ── */
.action-row {
  display: flex;
  gap: 10px;
}
.btn-action {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 10px 16px;
  font-size: 0.85rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  background: var(--surface);
  color: var(--text);
  transition: transform 0.1s, background 0.15s;
}
.btn-action:hover { background: var(--border); }
.btn-action:active { transform: scale(0.97); }
.btn-danger { color: var(--danger); border-color: var(--danger); background: transparent; }
.btn-danger:hover { background: rgba(192,57,43,0.06); }
.btn-danger:disabled { opacity: 0.35; pointer-events: none; }
.btn-share { color: var(--primary); border-color: var(--primary); background: transparent; }
.btn-share:hover { background: var(--hint-bg); }

/* ── History ── */
.history-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}
.history-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.history-head h2 { font-size: 1rem; font-weight: 800; }
.muted { color: var(--muted); font-size: 0.78rem; }
.history-wrap {
  display: grid;
  gap: 8px;
  max-height: 55vh;
  overflow-y: auto;
}
.history-empty {
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 20px;
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
}

/* ── Guess rows ── */
.guess-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
  align-items: center;
  border: 1px solid var(--border);
  border-left: 5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  position: relative;
  overflow: hidden;
  transition: transform 0.15s, box-shadow 0.15s;
}
.guess-row:hover { transform: translateX(2px); box-shadow: 0 2px 10px rgba(0,0,0,0.06); }
.guess-row::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: var(--score-width, 0%);
  opacity: 0.06;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  transition: width 0.5s cubic-bezier(.4,0,.2,1);
  pointer-events: none;
}
.guess-row.heat-cold { border-left-color: var(--cold); }
.guess-row.heat-lukewarm { border-left-color: var(--lukewarm); }
.guess-row.heat-cool { border-left-color: var(--cool); }
.guess-row.heat-warm { border-left-color: var(--warm); }
.guess-row.heat-hot  { border-left-color: var(--hot); }
.guess-row.heat-fire { border-left-color: var(--fire); }
.guess-row.heat-max  { border-left-color: var(--max); }
.guess-row.heat-perfect { border-left-color: var(--perfect); }
.guess-row.heat-cold::before { background: var(--cold); }
.guess-row.heat-lukewarm::before { background: var(--lukewarm); }
.guess-row.heat-cool::before { background: var(--cool); }
.guess-row.heat-warm::before { background: var(--warm); }
.guess-row.heat-hot::before  { background: var(--hot); }
.guess-row.heat-fire::before { background: var(--fire); }
.guess-row.heat-max::before  { background: var(--max); }
.guess-row.heat-perfect::before { background: var(--perfect); }
.guess-row.best { box-shadow: 0 0 0 2px var(--primary-glow) inset; }
.guess-word { font-size: 1rem; font-weight: 700; position: relative; z-index: 1; }
.guess-meta { color: var(--muted); font-size: 0.75rem; position: relative; z-index: 1; }
.hint-row { opacity: 0.75; }
.hint-row .guess-word { font-style: italic; }

@keyframes slideIn {
  from { opacity: 0; transform: translateY(-10px) scale(0.98); }
  to   { opacity: 1; transform: none; }
}
.guess-row.new-entry { animation: slideIn 0.3s ease-out; }
@keyframes flashHighlight {
  0%   { background: var(--primary-glow); }
  100% { background: transparent; }
}
.guess-row.flash { animation: flashHighlight 0.6s ease-out; }

/* Badges */
.badge {
  border-radius: 99px;
  color: #fff;
  padding: 4px 10px;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  position: relative;
  z-index: 1;
}
@keyframes badgePop {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.2); }
  100% { transform: scale(1); }
}
.badge.pop { animation: badgePop 0.3s ease; }
.badge.heat-cold { background: var(--cold); }
.badge.heat-lukewarm { background: var(--lukewarm); }
.badge.heat-cool { background: var(--cool); }
.badge.heat-warm { background: var(--warm); }
.badge.heat-hot  { background: var(--hot); }
.badge.heat-fire { background: var(--fire); }
.badge.heat-max  { background: var(--max); color: #1F2937; }
.badge.heat-perfect { background: var(--perfect); }

/* Win */
@keyframes winPulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(224,72,72,0.3); }
  50%     { box-shadow: 0 0 0 10px rgba(224,72,72,0); }
}
.win-glow { animation: winPulse 1.2s ease 2; border-color: var(--max); }
#win-canvas {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 9999;
}

/* Score animation */
@keyframes scoreFlash {
  0% { color: var(--danger); transform: scale(1.15); }
  100% { color: var(--primary); transform: scale(1); }
}
.score-change { animation: scoreFlash 0.4s ease-out; display: inline-block; }

/* ── Hints section (inline) ── */
.hints-inline {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.hints-locked {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px;
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
}
.hints-locked.hidden { display: none !important; }
.hint-revealed { display: none; }
.hint-list { display: none; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(-3px); } to { opacity: 1; transform: none; } }

/* LLM hints */
.llm-section { }
.llm-locked {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
  flex-wrap: wrap;
}
.llm-locked.hidden { display: none !important; }
.llm-bar-wrap {
  width: 100%;
  max-width: 200px;
  height: 4px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
}
.llm-bar {
  height: 100%;
  border-radius: 99px;
  background: var(--primary);
  width: 0%;
  transition: width 0.4s ease;
}
.llm-buttons {
  display: flex;
  gap: 8px;
  justify-content: center;
}
.btn-llm {
  background: var(--surface);
  border: 2px solid var(--border);
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
  padding: 10px 18px;
  border-radius: 99px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
  flex: 1;
  text-align: center;
}
.btn-llm:not(:disabled) {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--hint-bg);
  box-shadow: 0 0 0 1px var(--primary-glow);
  animation: hintPulse 2s ease-in-out infinite;
}
@keyframes hintPulse {
  0%, 100% { box-shadow: 0 0 0 1px var(--primary-glow); }
  50% { box-shadow: 0 0 0 6px var(--primary-glow); }
}
.btn-llm:not(:disabled):hover {
  transform: scale(1.04);
  box-shadow: 0 4px 16px var(--primary-glow);
  animation: none;
}
.btn-llm:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-llm.used {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  opacity: 1;
  cursor: default;
  animation: none;
  box-shadow: none;
}
.btn-llm.loading { opacity: 0.6; cursor: wait; animation: none; }
.llm-texts { display: grid; gap: 6px; }
.llm-hint-bubble {
  background: var(--hint-bg);
  border: 1px solid var(--hint-border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 0.88rem;
  line-height: 1.5;
  animation: fadeIn 0.3s ease-out;
}
.llm-hint-bubble .llm-hint-label {
  font-weight: 800;
  color: var(--primary);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 3px;
}

/* ── Overlays ── */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.15s ease-out;
}
.overlay.hidden { display: none !important; }
.overlay-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  width: min(520px, calc(100% - 32px));
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 8px 40px rgba(0,0,0,0.2);
}
.overlay-sm { max-width: 380px; }
.overlay-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.overlay-header h2 { font-size: 1rem; font-weight: 800; }
.close-btn {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 30px;
  height: 30px;
  font-size: 14px;
  cursor: pointer;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.close-btn:hover { background: var(--border); color: var(--text); }

/* Leaderboard tabs */
.lb-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
}
.lb-tab {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 5px 12px;
  font-size: 0.8rem;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  color: var(--muted);
  transition: all 0.15s;
}
.lb-tab.active { background: var(--primary); color: #fff; border-color: transparent; }
.lb-tab:hover:not(.active) { background: var(--border); color: var(--text); }
.lb-content { min-height: 80px; }
.lb-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.lb-table th {
  text-align: left;
  font-weight: 700;
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 4px 8px 8px;
  border-bottom: 1px solid var(--border);
}
.lb-table td { padding: 6px 8px; border-bottom: 1px solid var(--border); }
.lb-table tr:last-child td { border-bottom: none; }
.lb-table .lb-rank { width: 36px; font-weight: 700; color: var(--muted); }
.lb-table .lb-name { font-weight: 600; }
.lb-table .lb-score { font-weight: 800; color: var(--primary); text-align: right; }
.lb-table .lb-date { font-size: 0.75rem; color: var(--muted); text-align: right; }
.lb-table .lb-highlight { background: var(--hint-bg); }
.lb-empty { color: var(--muted); font-size: 0.85rem; padding: 16px 0; text-align: center; }

/* Settings */
.settings-body { padding: 4px 0; }
.settings-auth-status {
  font-size: 0.82rem;
  color: var(--muted);
  padding: 8px 12px;
  background: var(--hint-bg);
  border: 1px solid var(--hint-border);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
}
.settings-label { display: block; font-size: 0.8rem; font-weight: 700; color: var(--muted); margin-bottom: 6px; }
.settings-row { display: flex; gap: 8px; }
.input-field {
  flex: 1;
  padding: 10px 14px;
  border-radius: 99px;
  border: 1px solid var(--input-border);
  background: var(--input-bg);
  color: var(--text);
  font-size: 0.9rem;
  font-family: inherit;
}
.input-field:focus { outline: none; border-color: var(--input-focus); box-shadow: 0 0 0 3px var(--primary-glow); }
.msg-error { color: var(--danger); font-size: 0.8rem; min-height: 1.2em; margin-top: 4px; }
.msg-ok { color: var(--ok); font-size: 0.8rem; min-height: 1.2em; }

/* Info section in settings */
.info-section {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.info-section h3 {
  font-size: 0.85rem;
  font-weight: 800;
  margin-bottom: 4px;
  margin-top: 10px;
}
.info-section h3:first-child { margin-top: 0; }
.info-section p {
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.5;
}
.info-section strong { color: var(--text); }

/* Auth */
.auth-area { display: flex; align-items: center; gap: 4px; }
.user-menu { display: flex; align-items: center; gap: 6px; }
.user-name-tag {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--primary);
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.btn-provider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 10px 16px;
  margin-bottom: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 99px;
  font-size: 0.85rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  color: var(--text);
  transition: background 0.15s, transform 0.1s;
}
.btn-provider:hover { background: var(--hint-bg); transform: scale(1.01); }
.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 8px 16px;
  font-size: 0.85rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  color: var(--text);
  transition: background 0.15s;
}
.btn-ghost:hover { background: var(--border); }

/* Email auth modal */
.ea-input { width: 100%; margin-bottom: 8px; }
.ea-btn { width: 100%; margin-bottom: 6px; text-align: center; }
.ea-info { font-size: 0.85rem; color: var(--muted); margin-bottom: 10px; line-height: 1.5; }
.ea-info strong { color: var(--text); }

/* ── Legal footer ── */
.legal-footer {
  text-align: center;
  padding: 16px 0 8px;
  font-size: 0.72rem;
  color: var(--muted);
}
.legal-footer a { color: var(--muted); text-decoration: none; }
.legal-footer a:hover { color: var(--primary); text-decoration: underline; }
.legal-footer span { margin: 0 6px; opacity: 0.5; }
.legal-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 0.72rem;
  font-family: inherit;
  cursor: pointer;
  padding: 0;
}
.legal-btn:hover { color: var(--primary); text-decoration: underline; }

/* ── Cookie banner ── */
.cookie-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 2000;
  background: var(--surface);
  border-top: 1px solid var(--border);
  box-shadow: 0 -4px 24px rgba(0,0,0,0.12);
  animation: slideUp 0.3s ease-out;
}
@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}
.cookie-inner {
  max-width: 560px;
  margin: 0 auto;
  padding: 16px 20px;
}
.cookie-title { font-size: 1rem; font-weight: 800; margin-bottom: 6px; }
.cookie-text { font-size: 0.82rem; color: var(--muted); line-height: 1.5; margin-bottom: 10px; }
.cookie-text a { color: var(--primary); text-decoration: underline; }
.cookie-options { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.cookie-opt {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}
.cookie-opt input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--primary); }
.cookie-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.cookie-actions .btn-submit,
.cookie-actions .btn-action,
.cookie-actions .btn-ghost { flex: 1; min-width: 120px; text-align: center; }

/* ── Legal pages ── */
.legal-page {
  position: relative;
  z-index: 1;
  max-width: 560px;
  margin: 0 auto;
  padding: 24px 20px 40px;
}
.legal-page h1 { font-size: 1.5rem; font-weight: 800; margin-bottom: 4px; }
.legal-page h2 { font-size: 1.05rem; font-weight: 700; margin-top: 28px; margin-bottom: 8px; color: var(--primary); }
.legal-page h3 { font-size: 0.9rem; font-weight: 700; margin-top: 16px; margin-bottom: 6px; }
.legal-page p { font-size: 0.88rem; line-height: 1.65; margin-bottom: 8px; }
.legal-page ul { font-size: 0.88rem; line-height: 1.65; padding-left: 20px; margin-bottom: 10px; }
.legal-page a { color: var(--primary); }
.legal-back {
  display: inline-block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--primary);
  text-decoration: none;
  margin-bottom: 16px;
}
.legal-back:hover { opacity: 0.7; }

/* ── Mobile tweaks ── */
@media (max-width: 480px) {
  .app { padding: 8px 12px 24px; gap: 12px; }
  #guess-input { padding: 12px 16px; font-size: 1rem; }
  .btn-submit { padding: 12px 18px; font-size: 0.9rem; }
  .stat-val { font-size: 1.2rem; }
  .cookie-actions { flex-direction: column; }

  .topbar {
    flex-wrap: wrap;
    gap: 4px;
  }
  .topbar-left {
    flex: 1 1 100%;
    justify-content: center;
  }
  .topbar-right {
    flex: 1 1 100%;
    justify-content: center;
  }
  .guess-form {
    flex-wrap: wrap;
  }
  .guess-form #guess-input {
    flex: 1 1 100%;
  }
  .guess-form .btn-submit {
    flex: 1 1 100%;
  }
}

/* ── Tutorial overlay ── */
.tutorial-overlay {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: rgba(0, 0, 0, 0.55);
  animation: fadeIn 0.25s ease-out;
}
.tutorial-highlight {
  position: absolute;
  border-radius: var(--radius);
  box-shadow: 0 0 0 4000px rgba(0, 0, 0, 0.55), 0 0 0 4px var(--primary);
  pointer-events: none;
  transition: all 0.35s cubic-bezier(.4, 0, .2, 1);
  z-index: 9001;
}
.tutorial-tooltip {
  position: absolute;
  width: 300px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
  z-index: 9002;
  animation: fadeIn 0.2s ease-out;
}
.tutorial-tooltip-center {
  transform: translate(-50%, -50%);
  text-align: center;
}
.tutorial-arrow {
  position: absolute;
  width: 14px;
  height: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  left: 50%;
  transform: translateX(-50%) rotate(45deg);
}
.tutorial-arrow-up {
  top: -8px;
  border-right: none;
  border-bottom: none;
}
.tutorial-arrow-down {
  bottom: -8px;
  border-left: none;
  border-top: none;
}
.tutorial-text {
  font-size: 0.92rem;
  line-height: 1.55;
  color: var(--text);
  margin-bottom: 14px;
}
.tutorial-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.tutorial-counter {
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 600;
}
.tutorial-btns {
  display: flex;
  gap: 8px;
}
.tutorial-btn-skip {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 6px 14px;
  font-size: 0.8rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  color: var(--muted);
  transition: background 0.15s;
}
.tutorial-btn-skip:hover { background: var(--border); color: var(--text); }
.tutorial-btn-next {
  background: var(--primary);
  border: none;
  border-radius: 99px;
  padding: 6px 18px;
  font-size: 0.8rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  color: #fff;
  transition: transform 0.1s, box-shadow 0.2s;
}
.tutorial-btn-next:hover {
  box-shadow: 0 4px 12px var(--primary-glow);
  transform: translateY(-1px);
}
