/* ============================================================
   TYPEFORGE — COMPONENTS
   Graphite × Technical Precision
   ============================================================ */

/* ── Aurora / Noise (Disabled) ── */
.aurora-container { display: none !important; }
.noise-overlay    { display: none !important; }

/* ── Page Wrapper ── */
.page-content { position: relative; z-index: 2; }

/* ============================================================
   NAVBAR
   ============================================================ */
.navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: var(--z-nav);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-1);
  pointer-events: all;
}

.navbar-inner {
  pointer-events: all;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  max-width: var(--container-xl);
  margin: 0 auto;
  padding: 14px var(--sp-6);
  background: transparent;
}

/* Logo */
.navbar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 17px;
  color: var(--text-1);
  white-space: nowrap;
  transition: opacity var(--duration-base) var(--ease-out);
}
.navbar-logo:hover { opacity: 0.8; }

.navbar-logo-icon {
  width: 30px;
  height: 30px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-2);
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: border-color var(--duration-base) var(--ease-out);
}
.navbar-logo:hover .navbar-logo-icon { border-color: var(--border-3); }

.navbar-logo-text span { color: var(--brand-light); }

/* Center nav links */
.navbar-links {
  display: flex;
  align-items: center;
  gap: 2px;
  list-style: none;
}

.navbar-links li { position: relative; }

.navbar-links a {
  position: relative;
  display: flex;
  align-items: center;
  padding: 7px 14px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-3);
  border-radius: var(--r-sm);
  transition:
    color var(--duration-base) var(--ease-out),
    background var(--duration-base) var(--ease-out);
  white-space: nowrap;
}

.navbar-links a::after {
  content: '';
  position: absolute;
  bottom: 5px;
  left: 14px;
  right: 14px;
  height: 1px;
  background: var(--text-3);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--duration-base) var(--ease-out);
}

.navbar-links a:hover {
  color: var(--text-1);
  background: rgba(255,255,255,0.04);
}
.navbar-links a:hover::after { transform: scaleX(1); }

.navbar-links a.active {
  color: var(--text-1);
  background: rgba(255,255,255,0.04);
}
.navbar-links a.active::after {
  transform: scaleX(1);
  background: var(--brand-light);
}

/* Right: Auth + CTA */
.navbar-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex-shrink: 0;
}

/* Auth state slots */
.nav-auth-signed-out { display: flex; align-items: center; gap: 8px; }
.nav-auth-signed-in  { display: none; align-items: center; gap: 8px; }
.nav-user-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 1px solid var(--border-2);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: var(--text-2);
  cursor: pointer;
  transition: border-color var(--duration-fast);
}
.nav-user-avatar:hover { border-color: var(--border-3); }

/* When signed in */
body.tf-authenticated .nav-auth-signed-out { display: none; }
body.tf-authenticated .nav-auth-signed-in  { display: flex; }

/* Mobile hamburger */
.nav-hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  padding: 8px;
  border-radius: var(--r-sm);
  background: transparent;
  border: 1px solid var(--border-1);
  transition: border-color var(--duration-fast);
}
.nav-hamburger:hover { border-color: var(--border-2); }
.nav-hamburger span {
  display: block;
  width: 18px; height: 1px;
  background: var(--text-2);
  transition: transform var(--duration-base) var(--ease-out),
              opacity var(--duration-base);
}
.nav-hamburger.open span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.nav-hamburger.open span:nth-child(2) { opacity: 0; }
.nav-hamburger.open span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* Mobile bottom-sheet drawer */
.nav-drawer {
  position: fixed;
  bottom: 0;
  left: 0; right: 0;
  transform: translateY(100%);
  visibility: hidden;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-2);
  border-radius: 0;
  padding: 24px var(--sp-6) calc(var(--sp-6) + env(safe-area-inset-bottom));
  z-index: calc(var(--z-nav) - 1);
  transition: transform var(--duration-slow) var(--ease-expo),
              visibility var(--duration-slow) var(--ease-expo);
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
}
.nav-drawer.open { transform: translateY(0); visibility: visible; }

/* Drag handle */
.nav-drawer::before {
  content: '';
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  width: 32px; height: 3px;
  border-radius: 999px;
  background: var(--border-2);
}

.nav-drawer a {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 12px var(--sp-4);
  font-size: 15px;
  font-weight: 500;
  color: var(--text-3);
  border-radius: var(--r-sm);
  transition: color var(--duration-fast), background var(--duration-fast);
}
.nav-drawer a:hover {
  color: var(--text-1);
  background: rgba(255,255,255,0.04);
}
.nav-drawer-divider {
  height: 1px;
  background: var(--border-1);
  margin: 4px 0;
}

/* Nav backdrop (mobile) */
.nav-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: calc(var(--z-nav) - 2);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--duration-slow) var(--ease-out);
}
.nav-backdrop.visible { opacity: 1; pointer-events: all; }

@media (max-width: 768px) {
  .navbar-links { display: none; }
  .nav-hamburger { display: flex; }
}


/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: 0 var(--sp-5);
  height: 40px;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 600;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition:
    background var(--duration-base) var(--ease-out),
    border-color var(--duration-base) var(--ease-out),
    color var(--duration-base) var(--ease-out),
    opacity var(--duration-base) var(--ease-out);
  white-space: nowrap;
  text-decoration: none;
  position: relative;
  overflow: hidden;
  letter-spacing: -0.01em;
}

.btn:active { opacity: 0.8; }
.btn:disabled { opacity: 0.35; cursor: not-allowed; pointer-events: none; }

/* Primary: High-contrast white-on-dark */
.btn-primary {
  background: var(--text-1);
  color: var(--bg-base);
  border-color: var(--text-1);
}
.btn-primary:hover {
  background: var(--text-2);
  border-color: var(--text-2);
}

/* Brand: Steel blue */
.btn-gradient {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}
.btn-gradient:hover {
  background: var(--brand-light);
  border-color: var(--brand-light);
  color: var(--bg-base);
}

/* Secondary: Outlined charcoal */
.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text-1);
  border-color: var(--border-2);
}
.btn-secondary:hover {
  border-color: var(--border-3);
  background: var(--bg-card-hover);
}

/* Ghost */
.btn-ghost {
  background: transparent;
  color: var(--text-2);
  border-color: transparent;
}
.btn-ghost:hover {
  color: var(--text-1);
  background: rgba(255,255,255,0.05);
}

/* Outline */
.btn-outline {
  background: transparent;
  color: var(--text-2);
  border-color: var(--border-2);
}
.btn-outline:hover {
  color: var(--text-1);
  border-color: var(--border-3);
  background: rgba(255,255,255,0.03);
}

/* Danger */
.btn-danger {
  background: var(--error-bg);
  color: var(--error);
  border-color: rgba(239, 68, 68, 0.2);
}
.btn-danger:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: var(--error);
}

/* Sizes */
.btn-xs  { height: 28px; padding: 0 var(--sp-3); font-size: var(--text-xs); }
.btn-sm  { height: 34px; padding: 0 var(--sp-4); font-size: var(--text-sm); }
.btn-lg  { height: 48px; padding: 0 var(--sp-8); font-size: var(--text-base); }
.btn-xl  { height: 56px; padding: 0 var(--sp-10); font-size: var(--text-lg); font-weight: 700; }
.btn-icon { width: 40px; padding: 0; }
.btn-icon.btn-sm { width: 34px; }
.btn-icon.btn-lg { width: 48px; }
.btn-wide { width: 100%; }

/* Loading State */
.btn.loading .btn-text { opacity: 0; }
.btn.loading::before {
  content: '';
  position: absolute;
  width: 16px; height: 16px;
  border: 1.5px solid rgba(255,255,255,0.25);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }


/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-1);
  border-radius: var(--r-md);
  padding: var(--sp-6);
  transition:
    background var(--duration-base) var(--ease-out),
    border-color var(--duration-base) var(--ease-out);
}

.card-hover:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-2);
}

.card-glow {
  border-color: var(--border-brand);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-4);
  gap: var(--sp-3);
}

.card-title {
  font-family: var(--font-display);
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--text-1);
  letter-spacing: -0.01em;
}

.card-subtitle {
  font-size: var(--text-xs);
  color: var(--text-3);
  margin-top: 2px;
}

/* Glass card (flattened — same as card) */
.glass-card {
  background: var(--bg-card);
  border: 1px solid var(--border-1);
  border-radius: var(--r-md);
  transition:
    background var(--duration-base) var(--ease-out),
    border-color var(--duration-base) var(--ease-out);
}
.glass-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-2);
}

/* Stat Card */
.stat-card {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  padding: var(--sp-5) var(--sp-6);
  background: var(--bg-card);
  border: 1px solid var(--border-1);
  border-radius: var(--r-md);
  transition:
    background var(--duration-base) var(--ease-out),
    border-color var(--duration-base) var(--ease-out);
}
.stat-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-2);
}

.stat-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
  color: var(--text-4);
}

.stat-value {
  font-family: var(--font-display);
  font-size: var(--text-4xl);
  font-weight: 700;
  color: var(--text-1);
  line-height: 1;
  letter-spacing: var(--tracking-tight);
}

.stat-unit {
  font-size: var(--text-base);
  color: var(--text-3);
  font-weight: 400;
  margin-left: 2px;
}

.stat-change {
  font-size: var(--text-xs);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 3px;
}
.stat-change.positive { color: var(--success); }
.stat-change.negative { color: var(--error); }


/* ============================================================
   BADGES & TAGS
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  padding: 2px var(--sp-2);
  font-size: var(--text-xs);
  font-weight: 600;
  border-radius: var(--r-sm);
  white-space: nowrap;
  border: 1px solid transparent;
}

.badge-brand   { background: var(--brand-glow-sm); color: var(--brand-light); border-color: rgba(96, 165, 250, 0.2); }
.badge-coral   { background: var(--coral-glow);    color: var(--coral);       border-color: rgba(239, 68, 68, 0.2); }
.badge-mint    { background: var(--mint-glow);     color: var(--mint);        border-color: rgba(16, 185, 129, 0.2); }
.badge-gold    { background: var(--gold-glow);     color: var(--gold);        border-color: rgba(245, 158, 11, 0.2); }
.badge-success { background: var(--success-bg);    color: var(--success);     border-color: rgba(16, 185, 129, 0.2); }
.badge-warning { background: var(--warning-bg);    color: var(--warning);     border-color: rgba(245, 158, 11, 0.2); }
.badge-error   { background: var(--error-bg);      color: var(--error);       border-color: rgba(239, 68, 68, 0.2); }
.badge-sky     { background: var(--sky-glow);      color: var(--sky);         border-color: rgba(56, 189, 248, 0.2); }
.badge-outline { background: transparent; color: var(--text-2); border-color: var(--border-2); }

.badge-lg { padding: var(--sp-2) var(--sp-3); font-size: var(--text-sm); }

/* Achievement Badge */
.achievement-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-5);
  background: var(--bg-card);
  border: 1px solid var(--border-1);
  border-radius: var(--r-md);
  text-align: center;
  cursor: pointer;
  transition:
    background var(--duration-base) var(--ease-out),
    border-color var(--duration-base) var(--ease-out);
  position: relative;
  overflow: hidden;
}

.achievement-badge:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-2);
}

.achievement-icon {
  font-size: 2rem;
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-elevated);
  border: 1px solid var(--border-1);
  border-radius: var(--r-sm);
  position: relative;
  overflow: hidden;
}

.achievement-icon::after {
  content: '';
  position: absolute;
  top: 0; left: -100%;
  width: 60%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.06), transparent);
  animation: achievement-shine 4s ease-in-out infinite;
}

@keyframes achievement-shine {
  0%   { left: -100%; }
  100% { left: 200%; }
}

.achievement-name { font-size: var(--text-sm); font-weight: 600; color: var(--text-1); }
.achievement-desc { font-size: var(--text-xs); color: var(--text-3); }
.achievement-locked { opacity: 0.4; filter: grayscale(1); }


/* ============================================================
   INPUTS
   ============================================================ */
.input-group {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.input-label {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-2);
}

.input {
  width: 100%;
  height: 44px;
  padding: 0 var(--sp-4);
  background: var(--bg-elevated);
  border: 1px solid var(--border-2);
  border-radius: var(--r-sm);
  color: var(--text-1);
  font-size: var(--text-sm);
  transition:
    border-color var(--duration-fast),
    background var(--duration-fast);
  outline: none;
}
.input::placeholder { color: var(--text-4); }
.input:focus {
  border-color: var(--border-3);
  background: var(--bg-surface);
}
.input:invalid { border-color: var(--error); }

.input-lg { height: 52px; padding: 0 var(--sp-5); font-size: var(--text-base); }

.textarea {
  width: 100%;
  padding: var(--sp-4);
  background: var(--bg-elevated);
  border: 1px solid var(--border-2);
  border-radius: var(--r-sm);
  color: var(--text-1);
  font-size: var(--text-sm);
  resize: vertical;
  outline: none;
  transition: border-color var(--duration-fast);
  line-height: var(--leading-loose);
}
.textarea:focus { border-color: var(--border-3); }

/* Select */
.select {
  height: 44px;
  padding: 0 36px 0 var(--sp-4);
  background: var(--bg-elevated);
  border: 1px solid var(--border-2);
  border-radius: var(--r-sm);
  color: var(--text-1);
  font-size: var(--text-sm);
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%235c5c63' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  outline: none;
  transition: border-color var(--duration-fast);
}
.select:focus { border-color: var(--border-3); }

/* Range Slider */
.slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 3px;
  background: var(--border-2);
  border-radius: var(--r-full);
  outline: none;
  cursor: pointer;
}
.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--text-1);
  border: 2px solid var(--bg-base);
  cursor: pointer;
  transition: transform var(--duration-fast);
}
.slider::-webkit-slider-thumb:hover { transform: scale(1.15); }
.slider::-moz-range-thumb {
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--text-1);
  border: 2px solid var(--bg-base);
  cursor: pointer;
}

/* Radio / Checkbox Cards */
.option-card {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  padding: var(--sp-4) var(--sp-5);
  background: var(--bg-card);
  border: 1px solid var(--border-2);
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: all var(--duration-base) var(--ease-out);
  position: relative;
}
.option-card input { position: absolute; opacity: 0; }
.option-card:hover { border-color: var(--border-3); background: var(--bg-card-hover); }
.option-card:has(input:checked) { border-color: var(--brand); background: var(--brand-glow-sm); }


/* ============================================================
   PROGRESS BARS
   ============================================================ */
.progress-bar {
  width: 100%;
  height: 4px;
  background: var(--border-1);
  border-radius: var(--r-full);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  border-radius: var(--r-full);
  background: var(--brand);
  transition: width 0.8s var(--ease-out);
}
.progress-bar-sm { height: 3px; }
.progress-bar-lg { height: 6px; }
.progress-bar-xl { height: 10px; }
.progress-bar-mint  .progress-fill { background: var(--mint); }
.progress-bar-gold  .progress-fill { background: var(--gold); }
.progress-bar-coral .progress-fill { background: var(--coral); }

/* Circular Progress */
.ring-progress { transform: rotate(-90deg); }
.ring-progress circle {
  fill: none;
  stroke-linecap: round;
  transition: stroke-dashoffset 1s var(--ease-out);
}


/* ============================================================
   TABS
   ============================================================ */
.tabs {
  display: flex;
  gap: 2px;
  padding: 3px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-1);
  border-radius: var(--r-sm);
  width: fit-content;
}
.tab {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 6px var(--sp-4);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-3);
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: all var(--duration-base) var(--ease-out);
  border: 1px solid transparent;
  background: transparent;
  white-space: nowrap;
}
.tab:hover { color: var(--text-2); background: rgba(255,255,255,0.03); }
.tab.active {
  color: var(--text-1);
  background: var(--bg-surface);
  border-color: var(--border-1);
}
.tab.active .tab-icon { color: var(--brand-light); }
.tabs-full { width: 100%; }
.tabs-full .tab { flex: 1; justify-content: center; }


/* ============================================================
   MODAL / OVERLAY
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  z-index: var(--z-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-4);
  animation: fade-in var(--duration-base) var(--ease-out) both;
}
.modal-overlay.hidden { display: none; }

.modal {
  background: var(--bg-elevated);
  border: 1px solid var(--border-2);
  border-radius: var(--r-md);
  padding: var(--sp-8);
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  animation: scale-up 0.3s var(--ease-out) both;
  position: relative;
}

.modal-close {
  position: absolute;
  top: var(--sp-4); right: var(--sp-4);
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--r-sm);
  background: var(--bg-card);
  border: 1px solid var(--border-1);
  color: var(--text-3);
  cursor: pointer;
  transition: all var(--duration-fast);
}
.modal-close:hover { color: var(--text-1); border-color: var(--border-2); }


/* ============================================================
   TOAST / NOTIFICATIONS
   ============================================================ */
.toast-container {
  position: fixed;
  bottom: var(--sp-6);
  right: var(--sp-6);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  background: var(--bg-elevated);
  border: 1px solid var(--border-2);
  border-radius: var(--r-sm);
  pointer-events: all;
  min-width: 260px;
  max-width: 360px;
  animation: slide-in-right 0.3s var(--ease-out) both;
}
.toast.exit { animation: slide-out-right 0.25s var(--ease-in) both; }

@keyframes slide-in-right  { from { opacity: 0; transform: translateX(12px); } to { opacity: 1; transform: translateX(0); } }
@keyframes slide-out-right { from { opacity: 1; transform: translateX(0); }   to { opacity: 0; transform: translateX(12px); } }

.toast-icon   { font-size: 1rem; flex-shrink: 0; }
.toast-content { flex: 1; }
.toast-title   { font-size: var(--text-sm); font-weight: 600; color: var(--text-1); }
.toast-desc    { font-size: var(--text-xs); color: var(--text-3); }

.toast.success { border-color: rgba(16, 185, 129, 0.25); }
.toast.error   { border-color: rgba(239, 68, 68, 0.25);  }
.toast.warning { border-color: rgba(245, 158, 11, 0.25); }
.toast.info    { border-color: rgba(59, 130, 246, 0.25); }


/* ============================================================
   TOOLTIPS
   ============================================================ */
[data-tooltip] { position: relative; }
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  padding: 5px var(--sp-3);
  background: var(--bg-elevated);
  border: 1px solid var(--border-2);
  border-radius: var(--r-sm);
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--text-1);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--duration-fast);
  z-index: var(--z-30);
}
[data-tooltip]:hover::after { opacity: 1; }


/* ============================================================
   FOOTER
   ============================================================ */
.footer {
  border-top: 1px solid var(--border-1);
  padding: var(--sp-16) 0 var(--sp-8);
  position: relative;
  z-index: 2;
  margin-top: var(--sp-12);
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.8fr repeat(3, 1fr);
  gap: var(--sp-12);
  margin-bottom: var(--sp-16);
}

.footer-brand p {
  font-size: var(--text-sm);
  color: var(--text-3);
  margin-top: var(--sp-3);
  line-height: var(--leading-loose);
  max-width: 260px;
}

.footer-col-title {
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 700;
  color: var(--text-4);
  margin-bottom: var(--sp-4);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
}

.footer-links {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

.footer-links a {
  font-size: var(--text-sm);
  color: var(--text-3);
  transition: color var(--duration-fast);
}
.footer-links a:hover { color: var(--text-1); }

.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: var(--sp-8);
  border-top: 1px solid var(--border-1);
  gap: var(--sp-4);
}

.footer-bottom p { font-size: var(--text-sm); color: var(--text-4); }

.footer-social { display: flex; gap: var(--sp-3); }
.footer-social a {
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-elevated);
  border: 1px solid var(--border-1);
  border-radius: var(--r-sm);
  color: var(--text-3);
  font-size: var(--text-sm);
  transition: all var(--duration-fast);
}
.footer-social a:hover { color: var(--text-1); border-color: var(--border-2); }


/* ============================================================
   SECTION TITLES
   ============================================================ */
.section-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
  color: var(--text-3);
  margin-bottom: var(--sp-4);
}

.section-title {
  font-size: var(--text-5xl);
  font-weight: 700;
  letter-spacing: var(--tracking-tight);
  line-height: var(--leading-tight);
}

.section-desc {
  font-size: var(--text-lg);
  color: var(--text-2);
  max-width: 540px;
  margin-top: var(--sp-4);
  line-height: var(--leading-loose);
}


/* ============================================================
   CHIP / TAG
   ============================================================ */
.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  padding: 3px 10px;
  border-radius: var(--r-sm);
  font-size: var(--text-xs);
  font-weight: 500;
  background: var(--bg-elevated);
  border: 1px solid var(--border-2);
  color: var(--text-2);
  cursor: default;
  transition: all var(--duration-fast);
}
.chip:hover { border-color: var(--border-3); color: var(--text-1); }
.chip-active { border-color: var(--brand); color: var(--brand-light); background: var(--brand-glow-sm); }


/* ============================================================
   AVATAR
   ============================================================ */
.avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 1px solid var(--border-2);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: var(--text-sm);
  color: var(--text-2);
  flex-shrink: 0;
}
.avatar-sm { width: 28px; height: 28px; font-size: var(--text-xs); }
.avatar-lg { width: 48px; height: 48px; font-size: var(--text-lg); }
.avatar-xl { width: 72px; height: 72px; font-size: var(--text-2xl); }


/* ============================================================
   DIVIDER WITH TEXT
   ============================================================ */
.divider-text {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  color: var(--text-4);
  font-size: var(--text-sm);
}
.divider-text::before,
.divider-text::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-1);
}


/* ============================================================
   XP BAR (LEVEL DISPLAY)
   ============================================================ */
.xp-bar-container {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}
.xp-bar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.xp-level-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-1) var(--sp-3);
  background: var(--bg-elevated);
  border: 1px solid var(--border-2);
  border-radius: var(--r-sm);
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--text-1);
  font-family: var(--font-mono);
}
.xp-text { font-size: var(--text-xs); color: var(--text-3); }


/* ============================================================
   KEYBOARD HEATMAP
   ============================================================ */
.keyboard-row {
  display: flex;
  gap: 4px;
  margin-bottom: 4px;
  justify-content: center;
}

.key {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-2);
  border-radius: var(--r-sm);
  font-size: 10px;
  font-weight: 600;
  color: var(--text-3);
  cursor: default;
  transition: background var(--duration-base), border-color var(--duration-base), color var(--duration-base);
  position: relative;
}
.key-wide  { min-width: 50px; }
.key-xl    { min-width: 76px; }
.key-space { min-width: 220px; }

/* Heatmap — blue scale */
.key[data-heat="0"] { background: var(--bg-elevated); }
.key[data-heat="1"] { background: rgba(59, 92, 143, 0.20); color: var(--brand-light); }
.key[data-heat="2"] { background: rgba(59, 92, 143, 0.38); color: var(--brand-light); }
.key[data-heat="3"] { background: rgba(59, 92, 143, 0.58); color: #e8f0fe; }
.key[data-heat="4"] { background: rgba(194, 88, 59, 0.38); color: #ffe0d5; }
.key[data-heat="5"] { background: rgba(194, 88, 59, 0.65); color: #fff; border-color: var(--error); }


/* ============================================================
   SHARED APP SIDEBAR
   ============================================================ */
.app-sidebar {
  width: 64px;
  background: var(--bg-surface);
  border-right: 1px solid var(--border-1);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--sp-4) 0;
  position: fixed;
  left: 0; top: 0; bottom: 0;
  z-index: var(--z-20);
  transition: width var(--duration-slow) var(--ease-out);
}
.app-sidebar:hover { width: 196px; }
.app-sidebar:hover .sidebar-label { opacity: 1; width: auto; }

.sidebar-logo {
  width: 36px; height: 36px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-2);
  border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  margin-bottom: var(--sp-6);
  flex-shrink: 0;
  text-decoration: none;
  color: var(--text-1);
  transition: border-color var(--duration-fast);
}
.sidebar-logo:hover { border-color: var(--border-3); }

.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
  padding: 0 var(--sp-2);
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3);
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: all var(--duration-fast);
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  position: relative;
}
.sidebar-item:hover { background: var(--bg-elevated); color: var(--text-2); }
.sidebar-item.active { background: var(--bg-elevated); color: var(--text-1); }
.sidebar-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 6px; bottom: 6px;
  width: 2px;
  background: var(--brand-light);
  border-radius: 0 2px 2px 0;
}

.sidebar-icon {
  font-size: 1rem;
  flex-shrink: 0;
  width: 20px;
  text-align: center;
}
.sidebar-label {
  font-size: var(--text-sm);
  font-weight: 500;
  opacity: 0;
  width: 0;
  overflow: hidden;
  transition: opacity var(--duration-base), width var(--duration-base);
}
.sidebar-bottom {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
  padding: 0 var(--sp-2);
}

@media (max-width: 768px) {
  .app-sidebar {
    position: fixed;
    left: 0; right: 0;
    bottom: 0; top: auto;
    width: 100% !important;
    height: calc(60px + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    flex-direction: row;
    justify-content: space-around;
    padding-left: 0; padding-right: 0;
    padding-top: 0;
    border-right: none;
    border-top: 1px solid var(--border-1);
    z-index: var(--z-nav);
    display: flex !important;
  }
  .sidebar-logo { display: none !important; }
  .sidebar-nav {
    flex-direction: row;
    width: auto; flex: 1;
    justify-content: space-around;
    margin: 0; padding: 0;
  }
  .sidebar-bottom {
    display: flex;
    flex-direction: row;
    width: auto;
    margin: 0; padding: 0;
    justify-content: space-around;
    border-left: 1px solid var(--border-1);
  }
  .sidebar-item {
    flex-direction: column;
    gap: 3px;
    padding: 6px 4px;
    min-height: 44px; min-width: 44px;
    width: auto; flex: 1;
    justify-content: center;
    align-items: center;
    border-radius: 0;
    margin: 0;
  }
  .sidebar-item.active::before { display: none; }
  .sidebar-item.active::after {
    content: '';
    position: absolute;
    top: 0; left: 25%; right: 25%;
    height: 2px;
    background: var(--brand-light);
    border-radius: 0 0 var(--r-sm) var(--r-sm);
  }
  .sidebar-icon { font-size: 18px !important; width: auto !important; }
  .sidebar-label {
    font-size: 9px !important;
    opacity: 0.7 !important;
    width: auto !important;
    display: block !important;
    overflow: visible !important;
    white-space: nowrap;
  }
  #sidebar-profile, [data-auth-signout], .app-sidebar [data-auth-signout] {
    display: none !important;
  }
  .app-main {
    margin-left: 0 !important;
    padding: var(--sp-6) var(--sp-4) calc(80px + env(safe-area-inset-bottom)) !important;
  }
  .cookie-banner {
    bottom: calc(76px + env(safe-area-inset-bottom));
    left: 16px; right: 16px;
    max-width: none;
  }
  .tip-toast {
    left: 16px; right: 16px;
    bottom: calc(76px + env(safe-area-inset-bottom));
    max-width: none;
  }
  .toast-container {
    bottom: calc(76px + env(safe-area-inset-bottom));
    right: 16px; left: 16px;
  }
}

@media (max-width: 480px) {
  .cookie-banner {
    left: 16px; right: 16px;
    bottom: calc(76px + env(safe-area-inset-bottom));
    max-width: none;
  }
  .tip-toast {
    left: 16px; right: 16px;
    bottom: calc(76px + env(safe-area-inset-bottom));
    max-width: none;
  }
}

/* ============================================================
   RESPONSIVE HELPERS
   ============================================================ */
@media (max-width: 1024px) {
  .footer-grid { grid-template-columns: 1fr 1fr; gap: var(--sp-8); }
  .footer-brand { grid-column: 1 / -1; }
}

@media (max-width: 768px) {
  .footer-grid { grid-template-columns: 1fr; gap: var(--sp-6); }
  .footer-brand { grid-column: auto; }
  .footer-bottom { flex-direction: column; text-align: center; }
  .section-title { font-size: var(--text-4xl); }
  .section-desc { font-size: var(--text-base); }
  .modal { padding: var(--sp-6); }
  .tabs { flex-wrap: wrap; }
}


/* ============================================================
   CREATOR CREDITS
   ============================================================ */
.creator-link {
  color: var(--brand-light) !important;
  text-decoration: none;
  font-weight: 600;
  transition: color var(--duration-fast);
  border-bottom: 1px solid var(--border-2);
}
.creator-link:hover { color: var(--text-1) !important; border-color: var(--text-1); }


/* ============================================================
   COOKIE CONSENT
   ============================================================ */
.cookie-banner {
  position: fixed;
  bottom: 24px; right: 24px;
  max-width: 360px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-2);
  border-radius: var(--r-md);
  padding: 20px;
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: 14px;
  transform: translateY(8px);
  opacity: 0;
  pointer-events: none;
  transition: transform var(--duration-slow) var(--ease-out), opacity var(--duration-slow);
}
.cookie-banner.visible {
  transform: translateY(0);
  opacity: 1;
  pointer-events: all;
}
.cookie-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  color: var(--text-1);
}
.cookie-body { font-size: 13px; color: var(--text-2); line-height: 1.6; }
.cookie-actions { display: flex; gap: 8px; }


/* Tip Toast */
.tip-toast {
  position: fixed;
  bottom: 24px; left: 24px;
  max-width: 320px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-2);
  border-radius: var(--r-md);
  padding: 14px;
  z-index: var(--z-toast);
  display: flex;
  gap: 12px;
  transform: translateY(8px);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.35s var(--ease-out), opacity 0.35s;
}
.tip-toast.visible { transform: translateY(0); opacity: 1; pointer-events: all; }
.tip-icon {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  color: var(--brand-light);
  background: var(--bg-card);
  border: 1px solid var(--border-2);
  border-radius: var(--r-sm);
  padding: 3px 6px;
  height: max-content;
  flex-shrink: 0;
}
.tip-content { flex: 1; }
.tip-title { font-weight: 700; font-size: 13px; color: var(--text-1); margin-bottom: 3px; }
.tip-desc  { font-size: 12px; color: var(--text-2); line-height: 1.5; }
.tip-close { cursor: pointer; color: var(--text-4); font-size: 14px; transition: color var(--duration-fast); align-self: flex-start; }
.tip-close:hover { color: var(--text-1); }

@media (max-width: 480px) {
  .cookie-banner { left: 16px; right: 16px; bottom: 16px; max-width: none; }
  .tip-toast     { left: 16px; right: 16px; bottom: 96px; max-width: none; }
}

/* ============================================================
   GLOW UTILITIES (Flattened — No Color Glow)
   ============================================================ */
.glow-brand { border-color: var(--border-2); }
.glow-teal  { border-color: var(--border-2); }
.glass      { background: var(--bg-card); border: 1px solid var(--border-1); }