/* ═══════════════════════════════════════════════════
   styles.css  —  Shared styles for all Invenzzle pages
   invent-x / invenzzle.com
═══════════════════════════════════════════════════ */

/* ─── THEME ─────────────────────────────────────── */
:root {
  --green:      #34c759;
  --green-dark: #28a745;
  --green-dim:  rgba(52,199,89,0.15);
  --orange:     #ff9500;
  --red:        #ff3b30;
  --bg:         #f2f2f7;
  --card:       #ffffff;
  --surface:    #f2f2f7;
  --text:       #1c1c1e;
  --text2:      #6e6e73;
  --border:     #d1d1d6;
  --tile-hidden:#8e8e93;
  --radius:     14px;
  --font-head:  'Lilita One', cursive;
  --font-body:  'Nunito', sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:         #1c1c1e;
    --card:       #2c2c2e;
    --surface:    #3a3a3c;
    --text:       #f2f2f7;
    --text2:      #aeaeb2;
    --border:     #48484a;
    --tile-hidden:#636366;
  }
}
[data-theme="dark"] {
  --bg:#1c1c1e; --card:#2c2c2e; --surface:#3a3a3c;
  --text:#f2f2f7; --text2:#aeaeb2; --border:#48484a; --tile-hidden:#636366;
}
[data-theme="light"] {
  --bg:#f2f2f7; --card:#ffffff; --surface:#f2f2f7;
  --text:#1c1c1e; --text2:#6e6e73; --border:#d1d1d6; --tile-hidden:#8e8e93;
}

/* ─── RESET ─────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { width: 100%; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  width: 100%;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}
main  { flex: 1; width: 100%; }
.header, .site-footer { width: 100%; }

/* ─── HEADER ─────────────────────────────────────── */
.header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 8px rgba(0,0,0,0.06);
}
.header-logo {
  font-family: var(--font-head);
  font-size: 1.5rem;
  color: var(--green);
  text-decoration: none;
}
.header-logo span { color: var(--text); }
.header-actions { display: flex; gap: 8px; align-items: center; }
.icon-btn {
  background: none; border: none; cursor: pointer; color: var(--green);
  font-size: 1.3rem; padding: 6px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.2s; line-height: 1;
}
.icon-btn:hover { background: var(--green-dim); }
.sign-in-btn {
  background: var(--green); color: #fff; border: none;
  border-radius: 20px; padding: 7px 16px;
  font-family: var(--font-body); font-weight: 700; font-size: 0.82rem;
  cursor: pointer; transition: background 0.2s; white-space: nowrap;
}
.sign-in-btn:hover { background: var(--green-dark); }

/* Chat icon button with unread badge */
.chat-icon-btn { position: relative; }
.chat-badge {
  position: absolute; top: 0; right: 0;
  background: var(--red); color: #fff;
  font-size: 0.55rem; font-weight: 800;
  width: 16px; height: 16px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  border: 1.5px solid var(--card);
  pointer-events: none;
  font-family: var(--font-body);
}
.user-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--green); color: #fff;
  font-weight: 800; font-size: 0.85rem;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
}

/* ─── FOOTER ─────────────────────────────────────── */
.site-footer {
  background: var(--card);
  border-top: 1px solid var(--border);
  padding: 28px 20px 24px;
  margin-top: auto;
}
.footer-inner {
  max-width: 640px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
/* footer logo removed per design decision */
.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 18px;
}
.footer-links a {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text2);
  text-decoration: none;
  transition: color 0.2s;
}
.footer-links a:hover { color: var(--green); }
.footer-copy {
  font-size: 0.72rem;
  color: var(--text2);
  text-align: center;
  line-height: 1.6;
}

/* ─── SHARED BUTTON STYLES ───────────────────────── */
.btn-full {
  width: 100%; border: none; border-radius: 12px; padding: 14px;
  font-family: var(--font-body); font-weight: 800; font-size: 0.95rem;
  cursor: pointer; transition: opacity 0.2s; margin-bottom: 8px; display: block;
}
.btn-full:last-child { margin-bottom: 0; }
.btn-full:active { transform: scale(0.98); }
.btn-green   { background: var(--green); color: #fff; }
.btn-green:hover { opacity: 0.9; }
.btn-outline { background: transparent; border: 2px solid var(--green) !important; color: var(--green); }
.btn-outline:hover { background: var(--green-dim); }
.btn-ghost   { background: var(--surface); color: var(--text2); border: 1px solid var(--border) !important; }
.btn-ghost:hover { background: var(--border); }

/* ─── MODALS (shared base) ───────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  z-index: 1000; display: flex;
  align-items: flex-end; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity 0.3s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal-overlay.centered { align-items: center; }
.modal-sheet {
  background: var(--card); border-radius: 20px 20px 0 0;
  padding: 20px 20px 36px; width: 100%; max-width: 560px;
  max-height: 90vh; overflow-y: auto;
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(.4,0,.2,1);
  position: relative;
}
.modal-overlay.open .modal-sheet { transform: translateY(0); }
.modal-handle {
  width: 40px; height: 4px; background: var(--border);
  border-radius: 2px; margin: 0 auto 16px;
}
.modal-title {
  font-family: var(--font-head); font-size: 1.4rem;
  color: var(--green); text-align: center; margin-bottom: 4px;
}
.modal-title.fail { color: var(--red); }
.modal-subtitle { text-align: center; color: var(--text2); font-size: 0.82rem; margin-bottom: 18px; }
.modal-close {
  position: absolute; top: 16px; right: 16px;
  background: var(--surface); border: none; border-radius: 50%;
  width: 30px; height: 30px; font-size: 1rem; cursor: pointer;
  color: var(--text2); display: flex; align-items: center; justify-content: center;
}
.modal-divider { border: none; border-top: 1px solid var(--border); margin: 16px 0; }
.alert-box {
  background: var(--card); border-radius: 16px;
  padding: 24px 20px; max-width: 340px; width: 90%;
  margin: auto; text-align: center;
  transform: scale(0.9); transition: transform 0.25s;
}
.modal-overlay.open .alert-box { transform: scale(1); }
.alert-box h3 { font-family: var(--font-head); color: var(--green); margin-bottom: 10px; font-size: 1.2rem; }
.alert-box p  { font-size: 0.88rem; color: var(--text2); margin-bottom: 18px; line-height: 1.6; }

/* ─── TOAST ─────────────────────────────────────── */
.toast {
  position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%);
  background: #333; color: #fff; padding: 10px 22px; border-radius: 24px;
  font-size: 0.88rem; font-weight: 600; z-index: 5000;
  opacity: 0; transition: opacity 0.3s; white-space: nowrap; pointer-events: none;
}
.toast.show { opacity: 1; }

/* ─── SPINNER ────────────────────────────────────── */
.spinner-wrap { text-align: center; padding: 40px 20px; }
.spinner {
  width: 44px; height: 44px; border: 4px solid var(--border);
  border-top-color: var(--green); border-radius: 50%;
  animation: spin 0.8s linear infinite; margin: 0 auto 12px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── SHAKE ──────────────────────────────────────── */
@keyframes shake {
  0%,100% { transform: translateX(0); }
  20%,60%  { transform: translateX(-6px); }
  40%,80%  { transform: translateX(6px); }
}
.shake { animation: shake 0.35s ease; }

/* ─── STAT ROWS (shared between stats modal + profile) ── */
.stat-row-item {
  display: flex; justify-content: space-between;
  align-items: center; padding: 11px 0;
  border-bottom: 1px solid var(--border);
}
.stat-row-item:last-child { border-bottom: none; }
.stat-key { font-size: 0.88rem; color: var(--text); font-weight: 600; }
.stat-val { font-size: 0.88rem; font-weight: 800; color: var(--green); }
.stat-val.red { color: var(--red); }
.stat-loading { text-align: center; padding: 28px; color: var(--text2); font-size: 0.9rem; }

/* ─── RESULT SHARED ──────────────────────────────── */
.result-stat-line { font-size: 0.88rem; color: var(--text2); margin: 4px 0; line-height: 1.6; }
.result-stat-line strong { color: var(--text); }
.guess-list {
  background: var(--surface); border-radius: 10px;
  padding: 10px 14px; margin: 8px 0; font-size: 0.84rem; line-height: 1.8;
}
.guess-item::before { content: "• "; color: var(--green); font-weight: 700; }
.fun-fact-block {
  margin-top: 12px; background: var(--green-dim);
  border-radius: 10px; padding: 10px 12px;
  font-size: 0.84rem; color: var(--green-dark);
  font-weight: 600; line-height: 1.5;
}
@media (prefers-color-scheme: dark) { .fun-fact-block { color: var(--green); } }
[data-theme="dark"] .fun-fact-block  { color: var(--green); }

/* ─── MOBILE ─────────────────────────────────────── */
@media (max-width: 400px) {
  .header-logo { font-size: 1.2rem; }
}


/* ═══════════════════════════════════════════════════
   INDEX / PUZZLE PAGE
═══════════════════════════════════════════════════ */

/* ─── ADS ────────────────────────────────────────── */
.ad-banner {
  background: var(--surface); border: 1px dashed var(--border);
  text-align: center; padding: 8px;
  font-size: 0.72rem; color: var(--text2); display: none;
}
.ad-banner.visible { display: block; }
.bottom-ad {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--surface); border-top: 1px dashed var(--border);
  text-align: center; padding: 8px;
  font-size: 0.72rem; color: var(--text2);
  display: none; z-index: 90;
}
.bottom-ad.visible { display: block; }

/* ─── GAME WRAPPER ───────────────────────────────── */
.game-wrapper { max-width: 540px; margin: 0 auto; padding: 12px 14px 60px; }
.puzzle-date {
  text-align: center; font-size: 0.78rem; color: var(--text2);
  font-weight: 600; margin-bottom: 10px;
  letter-spacing: 0.5px; text-transform: uppercase;
}

/* ─── STAT ROW ───────────────────────────────────── */
.stat-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.stat-pill {
  font-weight: 700; font-size: 0.88rem; color: var(--green);
  background: var(--green-dim); border-radius: 20px; padding: 4px 12px;
}
.attempts-dots { display: flex; gap: 5px; }
.attempt-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--green); transition: background 0.3s; }
.attempt-dot.used { background: var(--red); }

/* ─── CLUE GRID ──────────────────────────────────── */
.clue-grid { display: grid; gap: 8px; margin-bottom: 10px; }
.clue-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.clue-grid.cols-2 { grid-template-columns: repeat(2, 1fr); }

/* ─── CLUE TILE ──────────────────────────────────── */
.clue-tile-wrap { perspective: 800px; cursor: pointer; }
.clue-tile-inner {
  position: relative; width: 100%; padding-bottom: 78%;
  transform-style: preserve-3d;
  transition: transform 0.55s cubic-bezier(.4,0,.2,1);
}
.clue-tile-wrap.flipped .clue-tile-inner { transform: rotateY(180deg); }
.clue-tile-front, .clue-tile-back {
  position: absolute; inset: 0; border-radius: 12px;
  backface-visibility: hidden;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 8px 6px; text-align: center;
}
.clue-tile-front { background: var(--tile-hidden); color: #fff; }
.clue-tile-front .tile-label { font-weight: 800; font-size: 0.85rem; margin-bottom: 3px; }
.clue-tile-front .tile-pts   { font-size: 0.7rem; opacity: 0.8; }
.clue-tile-back {
  background: var(--green); color: #fff; transform: rotateY(180deg);
  font-weight: 700; font-size: 0.78rem; line-height: 1.35; overflow: hidden;
}
.clue-tile-back.long-text      { font-size: 0.68rem; }
.clue-tile-back.very-long-text { font-size: 0.6rem; }

/* ─── INSTRUCTION TEXT ───────────────────────────── */
.instruction-text {
  text-align: center; color: var(--green);
  font-size: 0.82rem; font-weight: 600;
  margin-bottom: 8px; min-height: 18px;
}

/* ─── CONTROLS ───────────────────────────────────── */
.input-row    { margin-bottom: 8px; }
.btn-row      { display: flex; gap: 8px; margin-bottom: 12px; }
.answer-input {
  display: block; width: 100%;
  border: 2px solid var(--border); border-radius: 12px;
  padding: 13px 14px; font-family: var(--font-body); font-size: 1rem;
  background: var(--card); color: var(--text); outline: none;
  transition: border-color 0.2s;
}
.answer-input:focus   { border-color: var(--green); }
.answer-input:disabled{ opacity: 0.5; cursor: not-allowed; }
.submit-btn {
  background: var(--green); color: #fff; border: none;
  border-radius: 12px; padding: 12px 10px; width: 100%;
  font-family: var(--font-body); font-weight: 800; font-size: 0.95rem;
  cursor: pointer; transition: background 0.2s;
}
.submit-btn:hover    { background: var(--green-dark); }
.submit-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.reveal-btn {
  flex: 1; background: var(--orange); color: #fff; border: none;
  border-radius: 12px; padding: 12px 10px;
  font-family: var(--font-body); font-weight: 700; font-size: 0.88rem;
  cursor: pointer; transition: background 0.2s;
}
.reveal-btn:hover    { background: #e68900; }
.reveal-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.giveup-btn {
  flex: 1; background: var(--red); color: #fff; border: none;
  border-radius: 12px; padding: 12px 10px;
  font-family: var(--font-body); font-weight: 700; font-size: 0.88rem;
  cursor: pointer; transition: background 0.2s;
}
.giveup-btn:hover    { background: #cc2f26; }
.giveup-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.controls-disabled   { opacity: 0.45; pointer-events: none; }

/* ─── STATS MODAL ────────────────────────────────── */
.stats-tabs {
  display: flex; background: var(--surface);
  border-radius: 10px; padding: 3px; margin-bottom: 18px; gap: 2px;
}
.stats-tab {
  flex: 1; border: none; background: transparent;
  border-radius: 8px; padding: 9px 4px;
  font-family: var(--font-body); font-weight: 700; font-size: 0.82rem;
  cursor: pointer; color: var(--text2); transition: all 0.2s;
}
.stats-tab.active { background: var(--card); color: var(--green); box-shadow: 0 1px 4px rgba(0,0,0,0.08); }
.stats-section { display: none; }
.stats-section.active { display: block; }

/* ─── HOW TO PLAY ────────────────────────────────── */
.htp-item { margin-bottom: 10px; padding-left: 12px; border-left: 3px solid var(--green); }
.htp-text { font-size: 0.88rem; line-height: 1.5; color: var(--text); }
.htp-text strong { color: var(--green); }
.modal-auth-note { text-align: center; font-size: 0.82rem; color: var(--text2); margin-bottom: 12px; line-height: 1.5; }
.modal-auth-note strong { color: var(--text); }

/* ─── INLINE RESULT ──────────────────────────────── */
.inline-result {
  display: none; background: var(--card);
  border-radius: var(--radius); border: 1.5px solid var(--green);
  padding: 18px 16px; margin-top: 10px;
  animation: slideUp 0.4s ease;
}
.inline-result.fail    { border-color: var(--red); }
.inline-result.visible { display: block; }
@keyframes slideUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
.inline-result-title {
  font-family: var(--font-head); font-size: 1.2rem;
  color: var(--green); text-align: center; margin-bottom: 10px;
}
.inline-result-title.fail { color: var(--red); }
.inline-result-actions { display: flex; gap: 8px; margin-top: 14px; }
.inline-result-actions button {
  flex: 1; border: none; border-radius: 10px; padding: 11px;
  font-family: var(--font-body); font-weight: 700; font-size: 0.85rem; cursor: pointer;
}
.inline-share-btn  { background: var(--green); color: #fff; }
.inline-signup-btn { background: var(--surface); color: var(--text); border: 1px solid var(--border) !important; }

/* ─── MODALS (page-specific) ─────────────────────── */
.htp-modal-box {
  background: var(--card); border-radius: 16px;
  padding: 20px 22px 22px; width: 92%; max-width: 440px;
  max-height: 82vh; overflow-y: auto;
  margin: 40px auto auto;
  transform: scale(0.9); transition: transform 0.25s;
}
.modal-overlay.open .htp-modal-box { transform: scale(1); }
.htp-modal-box .htp-item { margin-bottom: 8px; }
.htp-modal-box .htp-text { font-size: 0.86rem; }

.result-modal-box {
  background: var(--card); border-radius: 16px;
  padding: 22px 22px 24px; width: 92%; max-width: 480px;
  max-height: 82vh; overflow-y: auto;
  margin: 40px auto auto;
  transform: scale(0.9); transition: transform 0.25s;
}
.modal-overlay.open .result-modal-box { transform: scale(1); }

.stats-modal-box {
  background: var(--card); border-radius: 16px;
  padding: 20px 20px 24px; width: 92%; max-width: 480px;
  max-height: 82vh; overflow-y: auto;
  margin: 40px auto auto;
  transform: scale(0.9); transition: transform 0.25s;
  position: relative;
}
.modal-overlay.open .stats-modal-box { transform: scale(1); }

/* ─── PROFILE DROPDOWN ───────────────────────────── */
.profile-dropdown-wrap { position: relative; }
.profile-dropdown {
  position: absolute; top: calc(100% + 10px); right: 0;
  width: 300px; background: var(--card);
  border-radius: 16px; box-shadow: 0 8px 40px rgba(0,0,0,0.18);
  border: 1px solid var(--border); z-index: 500;
  overflow: hidden; display: none;
  animation: dropIn 0.2s ease;
  max-height: calc(100vh - 80px);
  overflow-y: auto;
}
.profile-dropdown.open { display: block; }
@keyframes dropIn {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.pd-header {
  padding: 16px 16px 12px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
}
.pd-avatar-lg {
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--green); color: #fff;
  font-weight: 800; font-size: 1.1rem;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.pd-name  { font-weight: 800; font-size: 0.95rem; color: var(--text); }
.pd-email { font-size: 0.75rem; color: var(--text2); margin-top: 1px; word-break: break-all; }
.pd-section { padding: 10px 14px; border-bottom: 1px solid var(--border); }
.pd-section:last-child { border-bottom: none; }
.pd-section-title {
  font-size: 0.68rem; font-weight: 800; color: var(--text2);
  text-transform: uppercase; letter-spacing: 0.6px; margin-bottom: 8px;
}
.pd-stat-row { display: flex; justify-content: space-between; align-items: center; padding: 3px 0; font-size: 0.82rem; }
.pd-stat-key { color: var(--text2); font-weight: 600; }
.pd-stat-val { font-weight: 800; color: var(--green); }
.pd-stat-val.red { color: var(--red); }
.pd-badges-row { display: flex; flex-wrap: wrap; gap: 6px; padding: 4px 0; }
.pd-badge-item { display: flex; flex-direction: column; align-items: center; gap: 2px; width: 58px; cursor: pointer; }
.pd-badge-img  { width: 40px; height: 40px; object-fit: contain; }
.pd-badge-img.locked { filter: grayscale(1) opacity(0.4); }
.pd-badge-name { font-size: 0.6rem; font-weight: 700; color: var(--text2); text-align: center; line-height: 1.2; }
.pd-badge-count { font-size: 0.65rem; font-weight: 800; color: var(--green); }
.pd-action-btn {
  width: 100%; background: none; border: none; text-align: left;
  padding: 9px 14px; font-family: var(--font-body); font-size: 0.88rem;
  font-weight: 700; cursor: pointer; color: var(--text);
  display: flex; align-items: center; gap: 8px; transition: background 0.15s;
}
.pd-action-btn:hover { background: var(--surface); }
.pd-action-btn.red   { color: var(--red); }
.pd-empty { font-size: 0.8rem; color: var(--text2); text-align: center; padding: 6px 0; }
.pd-view-all {
  font-size: 0.75rem; color: var(--green); font-weight: 700;
  cursor: pointer; background: none; border: none;
  font-family: var(--font-body); padding: 4px 0 0; display: block;
}

/* ─── CONFETTI ───────────────────────────────────── */
#confetti-canvas { position: fixed; inset: 0; pointer-events: none; z-index: 9999; display: none; }

/* ─── MOBILE ─────────────────────────────────────── */
@media (max-width: 400px) { .clue-tile-back { font-size: 0.65rem; } }


/* ═══════════════════════════════════════════════════
   AUTH PAGE (login / sign up)
═══════════════════════════════════════════════════ */

/* Auth page uses .page-auth on <body> to scope these overrides */
body.page-auth {
  align-items: center;
  justify-content: center;
  padding: 20px 16px 40px;
}

.auth-card {
  background: var(--card);
  border-radius: 20px;
  padding: 32px 24px 28px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.10);
}

/* ─── Logo ─── */
.auth-logo { text-align: center; margin-bottom: 6px; }
.auth-logo .wordmark {
  font-family: var(--font-head);
  font-size: 2rem;
  color: var(--green);
}
.auth-logo .wordmark span { color: var(--text); }
.auth-tagline { text-align: center; font-size: 0.82rem; color: var(--text2); margin-bottom: 24px; }

/* ─── Segment ─── */
.segment-wrap {
  display: flex; background: var(--surface);
  border-radius: 10px; padding: 3px; margin-bottom: 22px; gap: 2px;
}
.segment-btn {
  flex: 1; border: none; background: transparent; border-radius: 8px;
  padding: 10px; font-family: var(--font-body); font-weight: 700; font-size: 0.9rem;
  cursor: pointer; color: var(--text2); transition: all 0.2s;
}
.segment-btn.active {
  background: var(--card); color: var(--green);
  box-shadow: 0 1px 4px rgba(0,0,0,0.10);
}

/* ─── Fields ─── */
.field-group { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.auth-input {
  width: 100%; border: 2px solid var(--border); border-radius: 12px;
  padding: 13px 14px; font-family: var(--font-body); font-size: 0.95rem;
  background: var(--surface); color: var(--text); outline: none;
  transition: border-color 0.2s;
}
.auth-input:focus   { border-color: var(--green); background: var(--card); }
.auth-input::placeholder { color: var(--text2); }
.auth-input.hidden-field { display: none; }

/* ─── Buttons ─── */
.auth-btn {
  width: 100%; border: none; border-radius: 12px; padding: 14px;
  font-family: var(--font-body); font-weight: 800; font-size: 1rem;
  cursor: pointer; transition: opacity 0.2s, transform 0.1s;
  margin-bottom: 10px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.auth-btn:active { transform: scale(0.98); }
.auth-btn.primary { background: var(--green); color: #fff; }
.auth-btn.primary:hover { opacity: 0.9; }
.auth-btn.primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.auth-btn.ghost  { background: transparent; color: var(--text2); font-size: 0.88rem; font-weight: 600; margin-bottom: 0; }
.auth-btn.ghost:hover { color: var(--text); }
.auth-btn.forgot { background: transparent; color: var(--green); font-size: 0.84rem; font-weight: 600; margin-bottom: 12px; }
.auth-btn.forgot:hover { opacity: 0.8; }

/* ─── Spinner inside button ─── */
.btn-spinner {
  width: 18px; height: 18px;
  border: 3px solid rgba(255,255,255,0.4);
  border-top-color: #fff; border-radius: 50%;
  animation: spin 0.7s linear infinite; display: none;
}
.btn-spinner.show { display: block; }

/* ─── Messages ─── */
.auth-error {
  background: rgba(255,59,48,0.10); border: 1px solid rgba(255,59,48,0.3);
  border-radius: 10px; padding: 10px 12px;
  font-size: 0.84rem; color: var(--red);
  margin-bottom: 14px; display: none; line-height: 1.5;
}
.auth-error.show { display: block; }
.auth-success {
  background: var(--green-dim); border: 1px solid rgba(52,199,89,0.3);
  border-radius: 10px; padding: 10px 12px;
  font-size: 0.84rem; color: var(--green-dark);
  margin-bottom: 14px; display: none; line-height: 1.5;
}
.auth-success.show { display: block; }
@media (prefers-color-scheme: dark) { .auth-success { color: var(--green); } }
[data-theme="dark"] .auth-success { color: var(--green); }

/* ─── Password strength ─── */
.pw-strength {
  height: 4px; border-radius: 2px; background: var(--border);
  margin-top: -6px; margin-bottom: 4px; overflow: hidden; display: none;
}
.pw-strength-bar { height: 100%; border-radius: 2px; width: 0%; transition: width 0.3s, background 0.3s; }

.auth-divider { border: none; border-top: 1px solid var(--border); margin: 16px 0; }

/* ─── Forgot Password Modal ─── */
.forgot-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  z-index: 2000; display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity 0.25s;
}
.forgot-overlay.open { opacity: 1; pointer-events: all; }
.forgot-box {
  background: var(--card); border-radius: 16px;
  padding: 24px 20px; width: 90%; max-width: 360px;
  transform: scale(0.9); transition: transform 0.25s;
}
.forgot-overlay.open .forgot-box { transform: scale(1); }
.forgot-title {
  font-family: var(--font-head); font-size: 1.1rem;
  color: var(--green); text-align: center; margin-bottom: 6px;
}
.forgot-subtitle { font-size: 0.82rem; color: var(--text2); text-align: center; margin-bottom: 16px; line-height: 1.5; }


/* ═══════════════════════════════════════════════════
   PROFILE PAGE
═══════════════════════════════════════════════════ */

.page-wrap { max-width: 600px; margin: 0 auto; padding: 20px 14px 60px; }

/* ─── Profile header card ─── */
.profile-card {
  background: var(--card); border-radius: 16px;
  padding: 20px; margin-bottom: 14px;
  display: flex; align-items: center; gap: 16px;
}
.avatar-circle {
  width: 72px; height: 72px; border-radius: 50%;
  background: var(--green); color: #fff;
  font-family: var(--font-head); font-size: 1.8rem;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.profile-info { flex: 1; min-width: 0; }
.profile-name  { font-weight: 800; font-size: 1.15rem; color: var(--text); margin-bottom: 2px; }
.profile-email { font-size: 0.8rem; color: var(--text2); word-break: break-all; }
.profile-since { font-size: 0.75rem; color: var(--text2); margin-top: 4px; }

/* ─── Section cards ─── */
.section-card { background: var(--card); border-radius: 16px; padding: 16px; margin-bottom: 14px; }
.section-title {
  font-weight: 800; font-size: 0.78rem; color: var(--text2);
  text-transform: uppercase; letter-spacing: 0.6px;
  margin-bottom: 12px; border-bottom: 1px solid var(--border); padding-bottom: 8px;
}
.loading-text { text-align: center; padding: 20px; color: var(--text2); font-size: 0.9rem; }

/* ─── Badges grid ─── */
.badges-toolbar {
  display: flex; justify-content: space-between;
  align-items: center; margin-bottom: 12px;
}
.sort-select {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 6px 10px;
  font-family: var(--font-body); font-size: 0.8rem;
  color: var(--text); cursor: pointer; outline: none;
}
.badges-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 10px;
}
.badge-cell {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 10px 6px; background: var(--surface); border-radius: 12px;
  cursor: pointer; transition: transform 0.15s, box-shadow 0.15s;
  border: 1.5px solid transparent;
}
.badge-cell:hover    { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.10); }
.badge-cell.unlocked { border-color: var(--green-dim); }
.badge-cell.locked   { opacity: 0.45; }
.badge-cell.newly-earned {
  animation: wiggle 0.4s ease 3, badgeglow 1.2s ease 3;
  border-color: var(--green);
}
@keyframes wiggle {
  0%,100% { transform: rotate(0deg); }
  25%      { transform: rotate(-5deg); }
  75%      { transform: rotate(5deg); }
}
@keyframes badgeglow {
  0%,100% { box-shadow: 0 0 0 0 rgba(52,199,89,0); }
  50%      { box-shadow: 0 0 12px 4px rgba(52,199,89,0.5); }
}
.badge-img   { width: 56px; height: 56px; object-fit: contain; }
.badge-emoji { font-size: 2.2rem; line-height: 1; }
.badge-name  { font-size: 0.68rem; font-weight: 700; color: var(--text); text-align: center; line-height: 1.2; }
.badge-count { font-size: 0.72rem; font-weight: 800; color: var(--green); }
.badge-locked-icon { font-size: 1.4rem; }

/* ─── Badge detail modal ─── */
.badge-modal-box {
  background: var(--card); border-radius: 16px;
  padding: 24px 20px; max-width: 320px; width: 90%; text-align: center;
  transform: scale(0.9); transition: transform 0.25s;
}
.modal-overlay.open .badge-modal-box { transform: scale(1); }
.bm-img   { width: 80px; height: 80px; object-fit: contain; margin: 0 auto 10px; display: block; }
.bm-emoji { font-size: 3rem; margin-bottom: 8px; display: block; }
.bm-name  { font-family: var(--font-head); font-size: 1.1rem; color: var(--green); margin-bottom: 6px; }
.bm-desc  { font-size: 0.84rem; color: var(--text2); line-height: 1.6; margin-bottom: 10px; }
.bm-count { font-size: 0.88rem; font-weight: 800; color: var(--green); margin-bottom: 16px; }
.bm-ok {
  width: 100%; background: var(--green); color: #fff; border: none;
  border-radius: 12px; padding: 12px;
  font-family: var(--font-body); font-weight: 800; font-size: 0.95rem; cursor: pointer;
}

/* ─── Settings rows ─── */
.settings-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 0; border-bottom: 1px solid var(--border); cursor: pointer;
}
.settings-row:last-child { border-bottom: none; }
.settings-row:hover { opacity: 0.8; }
.settings-label { font-size: 0.9rem; font-weight: 700; color: var(--text); }
.settings-label.red { color: var(--red); }
.settings-value { font-size: 0.82rem; color: var(--text2); }
.settings-arrow { color: var(--text2); font-size: 0.9rem; }

/* ─── Sign out / delete ─── */
.danger-btn {
  width: 100%; background: none; border: 1.5px solid var(--red);
  border-radius: 12px; padding: 13px;
  font-family: var(--font-body); font-weight: 800; font-size: 0.95rem;
  color: var(--red); cursor: pointer; transition: background 0.2s; margin-bottom: 10px;
}
.danger-btn:hover { background: rgba(255,59,48,0.08); }
.signout-btn {
  width: 100%; background: none; border: 1.5px solid var(--border);
  border-radius: 12px; padding: 13px;
  font-family: var(--font-body); font-weight: 800; font-size: 0.95rem;
  color: var(--text2); cursor: pointer; transition: background 0.2s; margin-bottom: 10px;
}
.signout-btn:hover { background: var(--surface); }

/* ─── Header back button ─── */
.header-back {
  background: none; border: none; cursor: pointer;
  font-family: var(--font-body); font-weight: 700;
  font-size: 0.88rem; color: var(--green);
  display: flex; align-items: center; gap: 4px;
}

/* ─── Theme modal ─── */
.theme-opt-btn {
  display: block; width: 100%; border: none; background: none;
  font-family: var(--font-body); font-weight: 700; font-size: 0.95rem;
  color: var(--green); padding: 12px; cursor: pointer;
  border-radius: 8px; transition: background 0.15s;
}
.theme-opt-btn:hover { background: var(--surface); }

@media (max-width: 400px) {
  .badges-grid { grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); }
}

/* Modal scale-in for theme + delete modals */
.modal-overlay.open #themeModalBox,
.modal-overlay.open #deleteModalBox { transform: scale(1); }

/* ── Notification bell + hover preview ────────── */
.notif-bell-wrap { position: relative; }
.notif-preview {
  display: none;
  position: absolute; top: calc(100% + 8px); right: 0;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 14px; box-shadow: 0 4px 20px rgba(0,0,0,0.14);
  min-width: 280px; max-width: 320px; overflow: hidden;
  z-index: 600;
}
/* Only show preview on hover if it has content */
.notif-bell-wrap:hover .notif-preview:not(:empty),
.notif-preview:not(:empty):hover { display: block; }
.notif-preview-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 14px; cursor: pointer; transition: background 0.15s;
  border-bottom: 1px solid var(--border);
}
.notif-preview-item:last-child { border-bottom: none; }
.notif-preview-item:hover { background: var(--surface); }
.notif-preview-icon {
  font-size: 1rem; flex-shrink: 0; width: 24px; text-align: center; margin-top: 2px;
}
.notif-preview-title {
  font-weight: 800; font-size: 0.82rem; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.notif-preview-body {
  font-size: 0.75rem; color: var(--text2); line-height: 1.3;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ── Highlight animation for chat messages ─────── */
@keyframes highlightPulse {
  0%   { background: rgba(52,199,89,0.25); }
  50%  { background: rgba(52,199,89,0.10); }
  100% { background: transparent; }
}
@keyframes wiggle {
  0%,100% { transform: translateX(0); }
  20%      { transform: translateX(-4px); }
  40%      { transform: translateX(4px); }
  60%      { transform: translateX(-3px); }
  80%      { transform: translateX(3px); }
}
.notif-highlight {
  animation: highlightPulse 2s ease forwards, wiggle 0.5s ease 0.1s;
  border-radius: 8px;
}
