/* ============================================================
   StudyForge — PREMIUM GAMING DASHBOARD CSS
   "High-end gaming interface meets modern SaaS"
   Glassmorphic panels, animated borders, immersive depth.
   ============================================================ */

/* ================================================================
   DESIGN TOKENS
   ================================================================ */
:root {
  /* ── Surfaces ── */
  --bg:        #08080c;
  --bg-2:      #0e0e14;
  --panel:     rgba(16, 16, 24, 0.7);
  --panel-2:   rgba(22, 22, 34, 0.6);
  --line:      rgba(255, 255, 255, 0.06);
  --line-soft: rgba(255, 255, 255, 0.03);

  /* ── Text ── */
  --text:      #eef0f6;
  --text-dim:  #8b8fa4;
  --text-mute: #4e5268;

  /* ── Accent & Semantic ── */
  --accent:    #7B61FF;
  --accent-ink:#08080c;
  --hl:        #7B61FF;
  --gold:      #FFD166;
  --blue:      #6C8CFF;
  --good:      #34D399;
  --bad:       #FF4D6A;
  --warn:      #FFD166;

  /* ── Shape ── */
  --radius:    16px;
  --radius-sm: 10px;
  --radius-xs: 6px;

  /* ── Depth ── */
  --shadow:    0 16px 48px rgba(0,0,0,.5);
  --shadow-sm: 0 4px 16px rgba(0,0,0,.4);
  --ring:      0 0 0 2px color-mix(in srgb, var(--accent) 50%, transparent);

  /* ── Typography ── */
  --font-display: 'Space Grotesk', 'Inter', system-ui, -apple-system, sans-serif;
  --font-body:    'Geist', 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono:    'JetBrains Mono', ui-monospace, monospace;

  /* ── Spacing Scale ── */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;

  /* ── Glassmorphism ── */
  --glass-bg:      rgba(16, 16, 24, 0.65);
  --glass-border:  rgba(255, 255, 255, 0.08);
  --glass-blur:    blur(20px) saturate(1.4);
  --glass-blur-webkit: -webkit-blur(20px) saturate(1.4);
  --glass-shadow:  0 24px 64px rgba(0,0,0,0.5);

  /* ── Layout ── */
  --maxw: 1140px;

  /* ── Sidebar ── */
  --sb-w: 248px;       /* expanded width */
  --sb-w-min: 76px;    /* collapsed width */
  --sb-gap: 18px;      /* gap between sidebar and content */
  --sb-px: 12px;       /* shared horizontal inset for every sidebar row */

  /* ── Transitions ── */
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --duration: 200ms;
}

/* ── Per-Subject Color Palette ──
   Assigned by discipline category. Each subject gets one hue
   used consistently for: left card border, icon badge bg/border,
   and level/board tag tint. Set via --c on each .subject-card.
   
   Humanities (warm):
     Psychology      #7c6cff  (violet — cognition/thought)
     Religious St.   #e0a23b  (amber — tradition/warmth)
     Sociology       #ef7a85  (rose — society/people)
   
   Sciences (cool):
     Physics         #5b9bff  (sky blue — space/force)
     Chemistry       #3fb98a  (teal — reactions/elements)
     Biology (AS)    #5fd17a  (green — life/growth)
     Biology (A-Lev) #2fb6a0  (cyan-teal — marine/deep life)
   
   Law/Business (neutral-cool):
     Law             #4db6ac  (sage — justice/balance)
     Corporate Law   #6f8cf5  (steel blue — commerce)
     Management      #e0923b  (burnt orange — leadership)
   ─────────────────────────── */

/* ================================================================
   RESET & BASE
   ================================================================ */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "cv02", "cv03", "cv04", "cv11";
  position: relative;
  overflow-x: hidden;
}
/* Hide the native cursor ONLY when the JS custom cursor is actually active.
   mousefx.js adds .has-custom-cursor after it creates the cursor element.
   Under prefers-reduced-motion (or if mousefx fails to load) the class is
   never added, so the normal system cursor is kept — previously the page
   forced cursor:none unconditionally and reduced-motion users saw no
   cursor at all. */
body.has-custom-cursor { cursor: none; }

/* ── Subtle Ambient Background (single desaturated layer, no blobs) ── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(80vw 60vh at 20% 20%, rgba(123, 97, 255, 0.04), transparent 70%),
    radial-gradient(70vw 50vh at 80% 80%, rgba(108, 140, 255, 0.03), transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* subtle noise texture overlay for depth */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 256px 256px;
  pointer-events: none;
  z-index: 0;
  opacity: 0.4;
}

/* respect reduced motion — kill background animation */
@media (prefers-reduced-motion: reduce) {
  body::before, body::after { animation: none !important; }
}

/* ================================================================
   FOCUS & INTERACTION STATES
   ================================================================ */
*:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent) 70%, transparent);
  outline-offset: 2px;
  border-radius: var(--radius-xs);
}

button:focus-visible, a:focus-visible, .tab:focus-visible, .option:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent) 70%, transparent);
  outline-offset: 2px;
}

/* disabled state consistency */
[disabled], .disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}

/* ================================================================
   SKELETON LOADERS
   ================================================================ */
@keyframes skeleton-shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.skeleton {
  background: linear-gradient(90deg, var(--bg-2) 25%, var(--panel) 50%, var(--bg-2) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.6s ease-in-out infinite;
  border-radius: var(--radius-xs);
  pointer-events: none;
}

.skeleton-text {
  height: 1em;
  border-radius: 4px;
  margin-bottom: 8px;
}

.skeleton-text:last-child { width: 60%; }

.skeleton-card {
  height: 120px;
  border-radius: var(--radius);
}

.skeleton-circle {
  width: 48px;
  height: 48px;
  border-radius: 50%;
}

/* ================================================================
   ICON SYSTEM (replaces emoji)
   ================================================================ */
.icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1em;
  height: 1em;
  flex-shrink: 0;
}

.icon-sm  { width: 16px; height: 16px; }
.icon-md  { width: 22px; height: 22px; }
.icon-lg  { width: 32px; height: 32px; }
.icon-xl  { width: 48px; height: 48px; }

/* Subject icon badge (replaces emoji in cards) */
.subject-icon {
  width: 48px;
  height: 48px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: color-mix(in srgb, var(--c, var(--accent)) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--c, var(--accent)) 18%, transparent);
  box-shadow: 0 0 16px color-mix(in srgb, var(--c, var(--accent)) 8%, transparent);
  position: relative;
}

.subject-icon svg {
  width: 24px;
  height: 24px;
  color: var(--c, var(--accent));
  stroke-width: 1.5;
}

/* Sidebar icon (replaces emoji in nav) */
.sb-ico svg {
  width: 18px;
  height: 18px;
  color: currentColor;
  stroke-width: 2;
}

/* Tab icon */
.tab-icon svg {
  width: 16px;
  height: 16px;
  color: currentColor;
  stroke-width: 2;
}


/* ================================================================
   TYPOGRAPHY
   ================================================================ */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  line-height: 1.15;
  margin: 0;
  font-weight: 600;
  letter-spacing: -0.025em;
  color: var(--text);
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }

/* ── Accent Text Utility ──
   Was a gold→violet→blue tri-gradient — read as generic AI landing
   page. One restrained accent keeps hierarchy without the rainbow. */
.grad {
  color: var(--accent);
  background: none;
  -webkit-text-fill-color: currentColor;
}

/* ── Page transition animation ── */
@keyframes pageIn {
  from { opacity: 0; transform: translateY(10px) scale(0.985); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.app.page-in { animation: pageIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) both; }

@keyframes pageOut {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to   { opacity: 0; transform: translateY(-6px) scale(0.985); }
}
.app.page-out {
  animation: pageOut 0.18s cubic-bezier(0.4, 0, 1, 1) both;
  pointer-events: none;
}

/* respect prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
  .app.page-in, .app.page-out { animation: none !important; opacity: 1; transform: none; }
}

/* ================================================================
   SKELETON SCREENS — used during async data loading
   ================================================================ */
.skeleton-screen {
  padding: 24px;
}
.skeleton-screen .skeleton-card { margin-bottom: 16px; }
.skeleton-screen .skeleton-text { max-width: 80%; margin-bottom: 12px; }

/* ================================================================
   SIDENAV — Glassmorphic collapsible left navigation
   ================================================================ */
.sidenav {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sb-w);
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px 14px;
  /* glassmorphism */
  background: linear-gradient(180deg, rgba(20, 20, 30, 0.72), rgba(12, 12, 20, 0.62));
  backdrop-filter: blur(28px) saturate(1.7);
  -webkit-backdrop-filter: blur(28px) saturate(1.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-left: none;
  border-radius: 0;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.05) inset,
    1px 0 0 rgba(255, 255, 255, 0.04) inset,
    0 24px 64px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  transition: width 320ms var(--ease), transform 320ms var(--ease), opacity 320ms var(--ease);
}

/* faint inner sheen along the top-right edge */
.sidenav::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent 5%, rgba(255, 255, 255, 0.08) 50%, transparent 95%);
  pointer-events: none;
}

/* — Head: brand + collapse toggle — */
.sb-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 4px var(--sb-px) 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  margin-bottom: 6px;
  min-height: 44px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
}

/* StudyForge logo image — brand shows the logo only, no wordmark */
.brand-logo {
  height: 36px;
  width: auto;
  max-width: 160px;
  object-fit: contain;
  flex-shrink: 0;
  display: block;
}
body.sb-collapsed .brand-logo {
  height: 30px;
  max-width: 44px;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  flex-shrink: 0;
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  color: var(--accent);
  font-size: 14px;
  font-weight: 800;
}
.brand-mark svg { width: 18px; height: 18px; display: block; }

.brand-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  transition: opacity 200ms var(--ease);
}

.sb-toggle {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  color: var(--text-dim);
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.02);
  transition: color var(--duration) ease, background var(--duration) ease, transform 320ms var(--ease), border-color var(--duration) ease;
  padding: 0;
  line-height: 0;
}
.sb-toggle svg { display: block; }
.sb-toggle:hover { color: var(--text); background: rgba(255, 255, 255, 0.06); border-color: rgba(255,255,255,0.12); }

/* — Nav list — */
.sb-nav {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.1) transparent;
  padding-right: 2px;
}
.sb-nav::-webkit-scrollbar { width: 6px; }
.sb-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 6px; }

/* ── Sidebar section groups ── */
.sb-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sb-group + .sb-group {
  margin-top: 12px;
}
.sb-group-label {
  padding: 10px var(--sb-px) 4px;
  display: flex;
  align-items: center;
}
.sb-group-text {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-mute);
  transition: opacity 200ms var(--ease);
}
/* collapsed: hide label text, show thin divider instead */
body.sb-collapsed .sb-group-label {
  padding: 8px 0 6px;
  justify-content: center;
}
body.sb-collapsed .sb-group-text {
  opacity: 0;
  width: 0;
  overflow: hidden;
}
body.sb-collapsed .sb-group-label::after {
  content: '';
  width: 20px;
  height: 1px;
  background: rgba(255, 255, 255, 0.06);
}

.sb-nav a {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 14px;
  color: var(--text-dim);
  white-space: nowrap;
  transition: color var(--duration) ease, background var(--duration) ease, box-shadow var(--duration) ease;
}

.sb-nav a .sb-ico {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  display: inline-flex;
  justify-content: center;
  align-items: center;
}

.sb-nav a .sb-ico svg {
  width: 18px;
  height: 18px;
  color: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.8;
  transition: opacity 200ms ease;
}

.sb-nav a:hover .sb-ico svg,
.sb-nav a.active .sb-ico svg {
  opacity: 1;
}


.sb-nav a .sb-label {
  transition: opacity 200ms var(--ease);
}

.sb-nav a:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
}

.sb-nav a.active {
  color: var(--text);
  font-weight: 600;
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 30%, transparent);
}

/* notification dot lives on the right when expanded */
.nav-dot {
  position: absolute;
  top: 50%;
  right: 10px;
  transform: translateY(-50%);
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--bad);
  box-shadow: 0 0 8px var(--bad);
  animation: navDotPulse 1.6s ease infinite;
}

/* ── Vertical active indicator (slides between items) ── */
.nav-indicator {
  position: absolute;
  left: 0;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
  opacity: 0;
  transition: top 320ms var(--ease), height 320ms var(--ease), opacity 260ms ease;
  pointer-events: none;
}

/* ================================================================
   COLLAPSED STATE
   ================================================================ */
body.sb-collapsed .sidenav { width: var(--sb-w-min); padding: 16px 6px; }
body.sb-collapsed .brand-name,
body.sb-collapsed .sb-label { opacity: 0; width: 0; overflow: hidden; pointer-events: none; }
body.sb-collapsed .sb-nav { padding-right: 0; }
body.sb-collapsed .sb-nav a { justify-content: center; padding: 10px 0; border-radius: 10px; }
body.sb-collapsed .sb-nav a .sb-ico { margin: 0 auto; }
body.sb-collapsed .nav-dot { right: 4px; top: 4px; transform: none; }
body.sb-collapsed .sb-toggle svg { transform: rotate(180deg); }
body.sb-collapsed .sb-head { justify-content: center; padding-left: 0; padding-right: 0; }
body.sb-collapsed .sb-group-label { padding-left: 0; padding-right: 0; }
body.sb-collapsed .sb-music-btn { justify-content: center; padding: 10px 0; border-radius: 10px; }
body.sb-collapsed .sb-music-btn .sb-ico { margin: 0 auto; }

/* ================================================================
   SIDEBAR MUSIC BUTTON (lo-fi toggle)
   ================================================================ */
/* Developer nav link — hidden unless signed-in user is a dev */
.sb-dev-link { display: none !important; }
body.is-dev .sb-dev-link { display: flex !important; }

/* ================================================================
   DEVELOPER TAG — exclusive badge
   ================================================================ */
.dev-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  white-space: nowrap;
}
.dev-tag.sm {
  font-size: 9.5px;
  padding: 2px 7px;
}
.dev-tag-icon {
  font-size: 0.95em;
  opacity: 0.95;
}
.dev-tag-inline {
  margin-left: 6px;
  vertical-align: middle;
}

/* dev field rows in the console */
.dev-field {
  display: grid;
  grid-template-columns: 140px 160px 1fr;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line-soft);
}
.dev-field-label {
  font-weight: 600;
  font-size: 13.5px;
}
@media (max-width: 640px) {
  .dev-field { grid-template-columns: 1fr; gap: 4px; }
}
.sb-music-btn {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 14px;
  color: var(--text-dim);
  cursor: pointer;
  user-select: none;
  transition: color 200ms var(--ease), background 200ms var(--ease);
}
.sb-music-btn:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
}
.sb-music-btn .sb-ico {
  width: 22px;
  height: 22px;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  flex-shrink: 0;
}

.sb-music-btn .sb-ico svg {
  width: 18px;
  height: 18px;
  color: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.8;
}
.sb-music-dot {
  margin-left: auto;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  transition: all 250ms var(--ease);
  flex-shrink: 0;
}
.sb-music-dot.active {
  background: #7B61FF;
  box-shadow: 0 0 8px rgba(123, 97, 255, 0.8);
  animation: musicPulse 1.6s ease infinite;
}
body.sb-collapsed .sb-music-dot { display: none; }
@keyframes musicPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(0.85); }
}

/* ================================================================
   MOBILE: burger + slide-over drawer
   ================================================================ */
.sb-burger { display: none; }
.sb-scrim {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity 260ms var(--ease);
  z-index: 59;
}

/* ================================================================
   LAYOUT — the fixed sidebar reserves space on <body> via padding;
   .app and .footer stay centered within the remaining column.
   ================================================================ */
	body {
	  padding-left: var(--sb-w);
	  transition: padding-left 320ms var(--ease);
	}
	body.sb-collapsed {
	  padding-left: var(--sb-w-min);
	}

.app {
  flex: 1;
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(20px, 4vw, 40px);
  position: relative;
  z-index: 1;
}

.footer {
  text-align: center;
  color: var(--text-mute);
  font-size: 13px;
  padding: 32px 16px 64px;
  border-top: 1px solid var(--line-soft);
  margin-top: 40px;
  position: relative;
  z-index: 1;
}

/* legacy aliases kept for any code still referencing them */
.topnav a { position: relative; }

/* ================================================================
   LAYOUT HELPERS
   ================================================================ */
.credit {
  position: fixed;
  left: calc(var(--sb-w) + 20px);
  bottom: 12px;
  z-index: 40;
  max-width: 44vw;
  font-size: 11px;
  line-height: 1.4;
  color: var(--text-mute);
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-xs);
  padding: 6px 10px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  pointer-events: none;
  user-select: none;
  transition: left 320ms var(--ease);
}
body.sb-collapsed .credit { left: calc(var(--sb-w-min) + 20px); }

@media (max-width: 640px) {
  .credit { font-size: 10px; max-width: 68vw; left: 8px; bottom: 8px; }
}
@media (max-width: 820px) {
  .credit { left: 8px; }
}

/* ================================================================
   BUTTONS — Gaming Style
   ================================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
  padding: 10px 18px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--line);
  background: var(--panel);
  backdrop-filter: blur(12px) saturate(1.3);
  -webkit-backdrop-filter: blur(12px) saturate(1.3);
  color: var(--text);
  font-weight: 500;
  font-size: 14px;
  cursor: pointer;
  transition: all var(--duration) var(--ease);
  white-space: nowrap;
  position: relative;
  min-height: 40px;
}

.btn:hover {
  border-color: rgba(255, 255, 255, 0.12);
  background: var(--panel-2);
  transform: translateY(-1px) scale(1.01);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

/* FIX 7: Tactile press-down — scales slightly for physical feedback */
.btn:active {
  transform: translateY(0) scale(0.97);
  background: var(--panel);
}

/* Primary CTA — flat accent, no gradient, restrained hover */
.btn.primary {
  background: var(--accent);
  color: #fff;
  border-color: transparent;
  font-weight: 600;
  font-size: 14px;
  padding: 11px 22px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.btn.primary:hover {
  filter: brightness(1.08);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3);
  transform: translateY(-1px);
  border-color: transparent;
  background: var(--accent);
}

/* FIX 7: Primary tactile press-down — brightness dip + scale */
.btn.primary:active {
  filter: brightness(0.95);
  transform: translateY(0) scale(0.97);
}

.btn.ghost {
  background: transparent;
  border-color: var(--line);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.btn.ghost:hover {
  border-color: color-mix(in srgb, var(--accent) 50%, var(--line));
  background: color-mix(in srgb, var(--accent) 4%, transparent);
  box-shadow: 0 0 12px color-mix(in srgb, var(--accent) 10%, transparent);
}

.btn.sm {
  padding: 6px 12px;
  font-size: 13px;
  border-radius: var(--radius-xs);
  min-height: 32px;
}

.btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  transform: none !important;
  filter: none !important;
  box-shadow: none !important;
}

.back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-dim);
  font-weight: 500;
  font-size: 14px;
  margin-bottom: 20px;
  cursor: pointer;
  transition: color var(--duration) ease, transform var(--duration) ease;
}

.back:hover {
  color: var(--accent);
  transform: translateX(-2px);
}

/* ================================================================
   HERO
   ================================================================ */
.hero {
  margin-bottom: 36px;
}

/* Compact page headline — big enough to anchor the page, small
   enough to feel like a tool rather than a marketing splash. */
.hero h1 {
  font-size: clamp(24px, 4vw, 36px);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.12;
}

/* icon sitting beside a hero headline — inline so text flows naturally */
.hero h1 .icon {
  display: inline-flex;
  width: 0.85em;
  height: 0.85em;
  color: var(--accent);
  margin-right: 10px;
  vertical-align: -0.08em;
}
.hero h1 .icon svg { width: 100%; height: 100%; }

.hero h1 .grad {
  position: relative;
  display: inline-block;
  color: var(--accent);
  background: none;
  -webkit-text-fill-color: currentColor;
}

/* FIX 4d: Hero subtitle — explicit weight + breathing room */
.hero p {
  color: var(--text-dim);
  max-width: 580px;
  font-size: 15px;
  font-weight: 400;
  line-height: 1.65;
  margin-top: 12px;
}

/* ================================================================
   SUBJECT GRID — Floating Rooms
   ================================================================ */
.grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
}

.subject-card {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(120% 90% at 100% 0%, color-mix(in srgb, var(--c, var(--accent)) 6%, transparent), transparent 60%),
    var(--panel);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  /* FIX 5a: Layered shadow + hairline border for real depth */
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius);
  padding: 24px;
  cursor: pointer;
  transition: transform 300ms var(--ease), border-color var(--duration) ease, box-shadow 300ms var(--ease);
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 190px; /* FIX 1: uniform card height across grid */
  will-change: transform;
  box-shadow: 
    0 1px 0 rgba(255, 255, 255, 0.04) inset,
    0 2px 4px rgba(0, 0, 0, 0.2),
    0 8px 24px rgba(0, 0, 0, 0.15);
}

/* ── Left accent border — flat, no glow ── */
.subject-card::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 3px;
  background: var(--c, var(--accent));
  border-radius: 0 3px 3px 0;
  opacity: 0.7;
}

.subject-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.14);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.06) inset,
    0 4px 8px rgba(0, 0, 0, 0.3),
    0 16px 40px rgba(0, 0, 0, 0.25);
}

.subject-card .sc-top {
  display: flex;
  align-items: center;
  gap: 14px;
  position: relative;
  z-index: 2;
}

.subject-card .sc-icon {
  width: 48px;
  height: 48px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: color-mix(in srgb, var(--c, var(--accent)) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--c, var(--accent)) 18%, transparent);
  position: relative;
}

.subject-card .sc-icon svg {
  width: 24px;
  height: 24px;
  color: var(--c, var(--accent));
  stroke-width: 1.5;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}


.subject-card h3 {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
  position: relative;
  z-index: 2;
}

.subject-card .sc-sub {
  color: var(--text-mute);
  font-size: 13px;
  margin-top: 2px;
  /* FIX 1: line-clamp to prevent description wrap inconsistency */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

.subject-card .sc-meta {
  margin-top: auto;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  position: relative;
  z-index: 2;
}

/* ── Progress bar on subject cards ── */
.sc-progress {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  position: relative;
  z-index: 2;
}
.sc-progress-bar {
  flex: 1;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}
.sc-progress-bar i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--c, var(--accent));
  transition: width 0.6s var(--ease);
}
.sc-progress span {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-mute);
  min-width: 28px;
  text-align: right;
  font-family: var(--font-mono);
}

/* ── Filter chips row above subject grid ── */
.filter-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.badge {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--c, var(--accent)) 10%, transparent);
  color: color-mix(in srgb, var(--c, var(--accent)) 80%, white);
  border: 1px solid color-mix(in srgb, var(--c, var(--accent)) 18%, transparent);
}

.badge.plain {
  background: var(--panel-2);
  color: var(--text-dim);
  border-color: var(--line);
}

/* ================================================================
   SUBJECT HEADER
   ================================================================ */
.subject-head {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 28px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line-soft);
}

.subject-head .sh-icon {
  width: 60px;
  height: 60px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 18%, transparent);
  box-shadow: 0 0 20px color-mix(in srgb, var(--accent) 10%, transparent);
}

.subject-head .sh-icon svg {
  width: 30px;
  height: 30px;
  color: var(--accent);
  stroke-width: 1.5;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}


.subject-head h1 {
  font-size: clamp(22px, 4vw, 34px);
  letter-spacing: -0.025em;
}

.subject-head .sh-meta {
  color: var(--text-dim);
  margin-top: 6px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ================================================================
   TOPIC LIST — Floating with Depth
   ================================================================ */
/* FIX 4c: Clearer eyebrow label — smaller, bolder, wider tracking */
.section-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-mute);
  margin: 8px 0 14px;
}

.topic-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
}

.topic-card {
  position: relative;
  overflow: hidden;
  background: var(--panel);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 20px;
  cursor: pointer;
  transition: transform 300ms var(--ease), border-color var(--duration) ease, box-shadow 300ms var(--ease);
  display: flex;
  flex-direction: column;
  gap: 8px;
  will-change: transform;
}

.topic-card:hover {
  border-color: color-mix(in srgb, var(--accent) 40%, var(--line));
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.topic-card h4 {
  font-size: 15px;
  font-weight: 600;
}

.topic-card .tc-stats {
  display: flex;
  gap: 12px;
  color: var(--text-mute);
  font-size: 12.5px;
  margin-top: 6px;
  font-family: var(--font-mono);
}

.topic-card .tc-stats b {
  color: var(--accent);
  font-weight: 600;
}

.topic-card .tc-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.topic-card .tc-top h3 {
  font-size: 16px;
  font-weight: 600;
  margin: 0;
}
.topic-card .tc-desc {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.45;
  margin: 0;
}

/* ── Topic card progress bar (mirrors subject-card style) ── */
.topic-card .tc-progress {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}
.topic-card .tc-progress-bar {
  flex: 1;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}
.topic-card .tc-progress-bar i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
  transition: width 0.6s var(--ease);
}
.topic-card .tc-progress span {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

/* ================================================================
   TABS
   ================================================================ */
.tabs {
  display: flex;
  gap: 2px;
  flex-wrap: wrap;
  margin: 8px 0 28px;
  padding: 3px;
  background: var(--bg-2);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  width: fit-content;
}

.tab {
  padding: 7px 16px;
  border-radius: var(--radius-xs);
  font-weight: 500;
  font-size: 13px;
  color: var(--text-dim);
  cursor: pointer;
  transition: all var(--duration) ease;
}

.tab:hover { color: var(--text); }

.tab.active {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* tabs with a leading icon */
.tab .icon { width: 15px; height: 15px; margin-right: 6px; vertical-align: -2px; }
.tab { display: inline-flex; align-items: center; }

/* ================================================================
   PANEL — Glassmorphic Base
   ================================================================ */
.panel {
  position: relative;
  background: var(--panel);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(18px, 3vw, 28px);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.04) inset,
    0 2px 6px rgba(0, 0, 0, 0.2),
    0 12px 36px rgba(0, 0, 0, 0.25);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.panel-2 {
  background: var(--panel-2);
  backdrop-filter: blur(16px) saturate(1.3);
  -webkit-backdrop-filter: blur(16px) saturate(1.3);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
}

.muted { color: var(--text-dim); }
.center { text-align: center; }
.mono { font-family: var(--font-mono); }
.empty { text-align: center; color: var(--text-mute); padding: 48px 20px; }

/* ================================================================
   FLASHCARDS — Premium Flip
   ================================================================ */
.fc-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

.flashcard {
  width: 100%;
  max-width: 560px;
  height: 340px;
  perspective: 1200px;
  cursor: pointer;
}

.flashcard-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 600ms var(--ease);
  transform-style: preserve-3d;
}

.flashcard.flipped .flashcard-inner {
  transform: rotateY(180deg);
}

/* ── Glow ring around card when flipped ── */
.flashcard.flipped {
  filter: drop-shadow(0 0 20px color-mix(in srgb, var(--accent) 20%, transparent));
}

.fc-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  border-radius: var(--radius);
  padding: 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  border: 1px solid var(--line);
}

.fc-front {
  background: var(--panel);
  box-shadow: var(--shadow), 0 0 0 1px rgba(255,255,255,0.02) inset;
}

/* ── Accent top bar ── */
.fc-front::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent);
  border-radius: var(--radius) var(--radius) 0 0;
  opacity: 0.5;
}

.fc-back {
  background: linear-gradient(160deg, color-mix(in srgb, var(--accent) 8%, var(--panel)), var(--panel));
  transform: rotateY(180deg);
  border-color: color-mix(in srgb, var(--accent) 25%, var(--line));
  box-shadow: var(--shadow), 0 0 16px color-mix(in srgb, var(--accent) 10%, transparent);
}

.fc-tag {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-mute);
  margin-bottom: 16px;
}

.fc-text {
  font-size: clamp(16px, 2.5vw, 20px);
  font-weight: 500;
  line-height: 1.5;
}

.fc-back .fc-text { font-size: clamp(14px, 2.2vw, 18px); }

.fc-hint {
  color: var(--text-mute);
  font-size: 12px;
  margin-top: 20px;
}

.fc-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.fc-count {
  color: var(--text-dim);
  font-size: 14px;
  min-width: 70px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono);
}

/* ================================================================
   QUIZ — Gaming Options
   ================================================================ */
.quiz-wrap { max-width: 660px; margin: 0 auto; }

.quiz-progress {
  height: 5px;
  border-radius: 999px;
  background: var(--bg-2);
  overflow: hidden;
  margin-bottom: 24px;
  border: 1px solid var(--line-soft);
}

.quiz-progress > i {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
  transition: width 300ms var(--ease);
}

.qmeta {
  display: flex;
  justify-content: space-between;
  color: var(--text-dim);
  font-size: 13px;
  margin-bottom: 14px;
}

.qtext {
  font-size: clamp(17px, 3vw, 21px);
  font-weight: 600;
  line-height: 1.45;
  margin-bottom: 24px;
}

.options { display: flex; flex-direction: column; gap: 10px; }

.option {
  text-align: left;
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--panel);
  backdrop-filter: blur(12px) saturate(1.3);
  -webkit-backdrop-filter: blur(12px) saturate(1.3);
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  transition: all var(--duration) var(--ease);
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 50px;
  position: relative;
  overflow: hidden;
}

.option:hover:not(:disabled) {
  border-color: color-mix(in srgb, var(--accent) 40%, var(--line));
  background: color-mix(in srgb, var(--accent) 4%, var(--panel));
  box-shadow: 0 0 12px color-mix(in srgb, var(--accent) 10%, transparent);
  transform: translateX(4px);
}

.option .opt-key {
  width: 30px;
  height: 30px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: var(--radius-xs);
  background: var(--bg-2);
  font-weight: 600;
  font-size: 12px;
  color: var(--text-dim);
  border: 1px solid var(--line-soft);
  transition: all var(--duration) ease;
  font-family: var(--font-mono);
}

.option:hover:not(:disabled) .opt-key {
  border-color: color-mix(in srgb, var(--accent) 30%, var(--line));
  color: var(--accent);
}

.option.correct {
  border-color: var(--good);
  background: color-mix(in srgb, var(--good) 6%, var(--panel));
  box-shadow: 0 0 16px color-mix(in srgb, var(--good) 15%, transparent);
  animation: correctBurst 0.6s var(--ease);
}

.option.correct .opt-key {
  background: var(--good);
  color: #052e16;
  border-color: var(--good);
  box-shadow: 0 0 8px color-mix(in srgb, var(--good) 30%, transparent);
}

.option.correct::after {
  content: '✓';
  position: absolute;
  right: 16px;
  font-weight: 700;
  color: var(--good);
  font-size: 16px;
}

.option.wrong {
  border-color: var(--bad);
  background: color-mix(in srgb, var(--bad) 6%, var(--panel));
  box-shadow: 0 0 16px color-mix(in srgb, var(--bad) 15%, transparent);
  animation: wrongShake 0.4s var(--ease);
}

.option.wrong .opt-key {
  background: var(--bad);
  color: #2a0808;
  border-color: var(--bad);
  box-shadow: 0 0 8px color-mix(in srgb, var(--bad) 30%, transparent);
}

.option.wrong::after {
  content: '✗';
  position: absolute;
  right: 16px;
  font-weight: 700;
  color: var(--bad);
  font-size: 16px;
}

.option:disabled { cursor: default; }

@keyframes correctBurst {
  0%   { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.4); }
  70%  { box-shadow: 0 0 0 12px rgba(52, 211, 153, 0); }
  100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0); }
}

@keyframes wrongShake {
  0%, 100% { transform: translateX(0); }
  20%  { transform: translateX(-8px); }
  40%  { transform: translateX(8px); }
  60%  { transform: translateX(-4px); }
  80%  { transform: translateX(4px); }
}

.explain {
  margin-top: 18px;
  padding: 16px 18px;
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--accent) 4%, var(--bg-2));
  border: 1px solid color-mix(in srgb, var(--accent) 15%, var(--line-soft));
  font-size: 14px;
  color: var(--text-dim);
  line-height: 1.6;
}

.explain b { color: var(--text); }

.quiz-foot { display: flex; justify-content: flex-end; margin-top: 20px; }

.score-ring {
  font-size: 54px;
  font-weight: 700;
  font-family: var(--font-display);
  color: var(--accent);
}

.score-ring small {
  display: block;
  font-size: 15px;
  color: var(--text-dim);
  font-weight: 500;
  font-family: var(--font-body);
  margin-top: 4px;
  -webkit-text-fill-color: var(--text-dim);
}

/* ================================================================
   REVISION NOTES
   ================================================================ */
.notes-panel { max-width: 800px; }

.note-toc {
  background: var(--panel);
  backdrop-filter: blur(12px) saturate(1.3);
  -webkit-backdrop-filter: blur(12px) saturate(1.3);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin: 8px 0 28px;
}

.toc-links { display: flex; flex-wrap: wrap; gap: 8px; }

.toc-link {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-dim);
  cursor: pointer;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--panel-2);
  border: 1px solid var(--line-soft);
  transition: all var(--duration) ease;
}

.toc-link:hover {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 35%, var(--line));
  box-shadow: 0 0 8px color-mix(in srgb, var(--accent) 10%, transparent);
}

.notes { display: flex; flex-direction: column; gap: 28px; }

.note-sec { scroll-margin-top: 80px; }

.note-h {
  font-size: 18px;
  font-weight: 600;
  padding-bottom: 10px;
  border-bottom: 2px solid color-mix(in srgb, var(--accent) 25%, transparent);
  margin-bottom: 16px;
}

.note-h strong { color: var(--accent); font-weight: 700; }

.note-intro {
  color: var(--text-dim);
  margin: 0 0 14px;
  font-size: 15px;
  line-height: 1.65;
}

.note-list {
  margin: 0;
  padding-left: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.note-list li {
  position: relative;
  padding-left: 20px;
  font-size: 15px;
  line-height: 1.65;
  color: var(--text);
}

.note-list li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 10px;
  width: 5px;
  height: 5px;
  border-radius: 2px;
  background: var(--accent);
  opacity: 0.6;
}

.note-list li strong { color: #fff; font-weight: 600; }

.note-foot {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.note-foot p { margin: 0; }

/* ================================================================
   DIAGRAMS (inline SVG, theme-aware)
   ================================================================ */
.dgm-fig { margin: 16px 0 4px; }

.dgm {
  background: var(--bg-2);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  padding: 16px;
  overflow-x: auto;
}

.dgm svg { width: 100%; height: auto; display: block; max-width: 560px; margin: 0 auto; }
.dgm-cap { color: var(--text-mute); font-size: 13px; text-align: center; margin-top: 8px; }

/* SVG helper classes */
.dgm .d-box   { fill: var(--panel); stroke: var(--line); stroke-width: 1.5; }
.dgm .d-box-a { fill: color-mix(in srgb, var(--accent) 10%, var(--panel)); stroke: var(--accent); stroke-width: 1.5; }
.dgm .d-stroke{ stroke: var(--accent); stroke-width: 2; fill: none; }
.dgm .d-line  { stroke: var(--text-mute); stroke-width: 1.5; fill: none; }
.dgm .d-fill  { fill: var(--accent); }
.dgm .d-fill2 { fill: var(--text-mute); }
.dgm .d-dash  { stroke: var(--text-mute); stroke-width: 1.5; fill: none; stroke-dasharray: 4 4; }
.dgm .d-lbl   { fill: var(--text); font: 600 13px 'Inter', sans-serif; }
.dgm .d-lbl-a { fill: var(--accent); font: 700 13px 'Inter', sans-serif; }
.dgm .d-sub   { fill: var(--text-mute); font: 11px 'Inter', sans-serif; }
.dgm .d-axis  { stroke: var(--text-dim); stroke-width: 1.5; }

/* ================================================================
   PAST PAPERS
   ================================================================ */
.link-list { display: flex; flex-direction: column; gap: 8px; }

.link-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  background: var(--panel-2);
  backdrop-filter: blur(12px) saturate(1.3);
  -webkit-backdrop-filter: blur(12px) saturate(1.3);
  border: 1px solid var(--line-soft);
  transition: all var(--duration) ease;
}

.link-row:hover {
  border-color: color-mix(in srgb, var(--accent) 35%, var(--line));
  background: color-mix(in srgb, var(--accent) 3%, var(--panel-2));
  box-shadow: 0 0 12px color-mix(in srgb, var(--accent) 8%, transparent);
}

.link-row .lr-main { display: flex; align-items: center; gap: 12px; min-width: 0; }
.link-row .lr-ico { font-size: 18px; }
.link-row .lr-title { font-weight: 600; }
.link-row .lr-sub { color: var(--text-mute); font-size: 12.5px; }
.link-row .arrow { color: var(--text-mute); transition: all var(--duration) ease; }
.link-row:hover .arrow { color: var(--accent); transform: translate(2px, -2px); }

/* ================================================================
   BATTLE
   ================================================================ */
.battle-wrap { max-width: 720px; margin: 0 auto; }

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.field label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-dim);
}

.input {
  padding: 10px 14px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  transition: border-color var(--duration) ease, box-shadow var(--duration) ease;
  width: 100%;
}

.input:hover {
  border-color: color-mix(in srgb, var(--accent) 25%, var(--line));
}

.input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--ring), 0 0 12px color-mix(in srgb, var(--accent) 15%, transparent);
}

.input.code {
  letter-spacing: 0.35em;
  text-transform: uppercase;
  font-weight: 700;
  text-align: center;
  font-size: 22px;
  font-family: var(--font-mono);
}

.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 140px; }
/* Buttons, labels and inline text must keep their natural size — the
   grow rule above is meant for inputs/fields, not controls. Without
   this, any button sharing a .row with an input balloons to fill the
   leftover width (the recurring "massive button" bug). */
.row > .btn, .row > button, .row > label, .row > span, .row > code, .row > h3, .row > select,
.row > input[type="checkbox"], .row > input[type="radio"] {
  flex: 0 0 auto;
  /* "auto" (not 0): flex min-width auto = the element's content size.
     Many buttons carry inline flex:0 (basis 0%) — a 0 floor lets them
     collapse to zero width and pile on top of each other. */
  min-width: auto;
}

.divider-or {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--text-mute);
  font-size: 13px;
  margin: 24px 0;
}
.divider-or::before, .divider-or::after { content: ""; height: 1px; flex: 1; background: var(--line-soft); }

.vs-board {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 14px;
  align-items: stretch;
  margin-bottom: 24px;
}

.vs-side {
  background: var(--panel);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  transition: all var(--duration) ease;
}

.player-card {
  background: var(--panel);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  transition: all var(--duration) ease;
}

.player-card.me {
  border-color: color-mix(in srgb, var(--accent) 40%, var(--line));
  box-shadow: 0 0 16px color-mix(in srgb, var(--accent) 10%, transparent);
}
.player-card.lead {
  box-shadow: 0 0 0 2px var(--good) inset, 0 0 16px color-mix(in srgb, var(--good) 10%, transparent);
}
.player-card .pc-name { font-weight: 600; font-size: 16px; display: flex; align-items: center; justify-content: center; gap: 7px; }
.player-card .pc-score { font-size: 44px; font-weight: 700; font-family: var(--font-display); margin: 8px 0; }
.player-card .pc-status { font-size: 12.5px; color: var(--text-mute); min-height: 16px; }

.vs-mid { display: grid; place-items: center; font-weight: 700; color: var(--text-mute); font-family: var(--font-display); font-size: 14px; }
.vs-name { font-weight: 600; font-size: 14px; }
.vs-score { font-family: var(--font-mono); font-weight: 700; font-size: 20px; }

.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-mute); display: inline-block; }
.dot.on { background: var(--good); box-shadow: 0 0 8px var(--good); }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 14px;
  border-radius: 999px;
  background: var(--bg-2);
  border: 1px solid var(--line-soft);
  font-size: 13px;
  font-weight: 600;
}

.room-code-show {
  font-family: var(--font-mono);
  font-weight: 700;
  letter-spacing: 0.3em;
  color: var(--accent);
  text-shadow: 0 0 12px color-mix(in srgb, var(--accent) 30%, transparent);
}

.config-warn {
  background: color-mix(in srgb, var(--warn) 6%, var(--panel));
  border: 1px solid color-mix(in srgb, var(--warn) 20%, transparent);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  margin-bottom: 20px;
  font-size: 14px;
  color: var(--text);
}
.config-warn b { color: var(--warn); }
.config-warn code { background: var(--bg); padding: 2px 6px; border-radius: 4px; font-size: 13px; font-family: var(--font-mono); }

/* ================================================================
   TOAST
   ================================================================ */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--panel);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  border: 1px solid var(--line);
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 8px 32px rgba(0, 0, 0, 0.4), 0 0 20px color-mix(in srgb, var(--accent) 12%, transparent);
  font-size: 14px;
  z-index: 100;
  opacity: 0;
  transform: translateX(-50%) translateY(8px);
  transition: opacity 300ms var(--ease), transform 300ms var(--ease);
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ================================================================
   ADD-CARD EDITOR
   ================================================================ */
.editor { margin-top: 24px; border-top: 1px solid var(--line); padding-top: 20px; }
.editor textarea.input { resize: vertical; min-height: 64px; font-family: var(--font-body); }

details.editor-d summary {
  cursor: pointer;
  font-weight: 500;
  color: var(--text-dim);
  list-style: none;
  transition: color var(--duration) ease;
}
details.editor-d summary:hover { color: var(--text); }
details.editor-d summary::-webkit-details-marker { display: none; }
details.editor-d summary::before { content: "+ "; color: var(--accent); font-weight: 600; }
details.editor-d[open] summary::before { content: "− "; }

/* ================================================================
   DIFFICULTY CHIPS + BADGES
   ================================================================ */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }

.chip {
  padding: 5px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text-dim);
  font-weight: 500;
  font-size: 13px;
  cursor: pointer;
  transition: all var(--duration) ease;
}

.chip:hover {
  color: var(--text);
  border-color: color-mix(in srgb, var(--accent) 35%, var(--line));
  box-shadow: 0 0 8px color-mix(in srgb, var(--accent) 10%, transparent);
}

.chip.active {
  background: var(--accent);
  color: #fff;
  border-color: transparent;
  font-weight: 600;
}

.chip.edge-easy:not(.active)   { box-shadow: inset 3px 0 0 var(--good); }
.chip.edge-medium:not(.active) { box-shadow: inset 3px 0 0 var(--warn); }
.chip.edge-hard:not(.active)   { box-shadow: inset 3px 0 0 var(--bad); }

.lvl-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text-dim);
}

.lvl-badge {
  position: absolute;
  top: 14px;
  right: 16px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
}

.lvl-easy   { color: var(--good); border-color: color-mix(in srgb, var(--good) 30%, transparent); background: color-mix(in srgb, var(--good) 8%, transparent); }
.lvl-medium { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 30%, transparent); background: color-mix(in srgb, var(--warn) 8%, transparent); }
.lvl-hard   { color: var(--bad);  border-color: color-mix(in srgb, var(--bad) 30%, transparent);  background: color-mix(in srgb, var(--bad) 8%, transparent); }

.btn.rate-good { border-color: color-mix(in srgb, var(--good) 35%, var(--line)); color: var(--good); }
.btn.rate-good:hover { background: color-mix(in srgb, var(--good) 8%, transparent); border-color: color-mix(in srgb, var(--good) 55%, var(--line)); box-shadow: 0 0 12px color-mix(in srgb, var(--good) 15%, transparent); }
.btn.rate-bad  { border-color: color-mix(in srgb, var(--bad) 35%, var(--line)); color: var(--bad); }
.btn.rate-bad:hover { background: color-mix(in srgb, var(--bad) 8%, transparent); border-color: color-mix(in srgb, var(--bad) 55%, var(--line)); box-shadow: 0 0 12px color-mix(in srgb, var(--bad) 15%, transparent); }

/* ================================================================
   DASHBOARD
   ================================================================ */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
}

.stat-card {
  position: relative;
  overflow: hidden;
  background: var(--panel);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 22px;
  transition: border-color var(--duration) ease, transform var(--duration) var(--ease), box-shadow 300ms var(--ease);
}

.stat-card::after {
  content: '';
  position: absolute;
  top: -20px;
  right: -20px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--accent) 8%, transparent), transparent 70%);
  pointer-events: none;
}

.stat-card:hover {
  border-color: color-mix(in srgb, var(--accent) 25%, var(--line));
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3), 0 0 12px color-mix(in srgb, var(--accent) 8%, transparent);
}

.stat-big {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 30px;
  letter-spacing: -0.02em;
  color: var(--text);
}

.stat-label {
  color: var(--text-mute);
  font-size: 11px;
  margin-top: 6px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}

.dash-list { display: flex; flex-direction: column; }

.dash-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: background var(--duration) ease;
}

.dash-row:hover { background: var(--panel-2); }
.dash-row-main { display: flex; align-items: center; gap: 12px; min-width: 0; }
.dash-ico { font-size: 20px; }
.dash-topic { font-weight: 600; font-size: 14px; }
.dash-sub { color: var(--text-mute); font-size: 12.5px; }
.dash-row-right { display: flex; align-items: center; gap: 12px; flex: 0 0 auto; }

/* ================================================================
   MASTERY / PROGRESS BARS — Animated Fill
   ================================================================ */
.mbar {
  width: 120px;
  height: 6px;
  border-radius: 999px;
  background: var(--bg-2);
  overflow: hidden;
  border: 1px solid var(--line-soft);
}

.mbar-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  transition: width 600ms var(--ease);
}

.band-low .mbar-fill, .mbar-fill.band-low {
  background: linear-gradient(90deg, var(--bad), color-mix(in srgb, var(--bad) 60%, var(--warn)));
  box-shadow: 0 0 6px color-mix(in srgb, var(--bad) 30%, transparent);
}
.band-mid .mbar-fill, .mbar-fill.band-mid {
  background: linear-gradient(90deg, var(--warn), color-mix(in srgb, var(--warn) 60%, var(--good)));
  box-shadow: 0 0 6px color-mix(in srgb, var(--warn) 30%, transparent);
}
.band-high .mbar-fill, .mbar-fill.band-high {
  background: linear-gradient(90deg, var(--good), color-mix(in srgb, var(--good) 70%, #6ee7b7));
  box-shadow: 0 0 8px color-mix(in srgb, var(--good) 30%, transparent);
}
.band-none { background: var(--line); color: var(--text-mute); }
.band-low  { color: var(--bad); }
.band-mid  { color: var(--warn); }
.band-high { color: var(--good); }

.dash-pct {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  font-size: 13px;
  min-width: 42px;
  text-align: right;
  font-family: var(--font-mono);
}

.dash-sub-block {
  background: var(--panel);
  backdrop-filter: blur(16px) saturate(1.3);
  -webkit-backdrop-filter: blur(16px) saturate(1.3);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-bottom: 12px;
}

.dash-sub-block summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 15px;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 4px;
}

.dash-sub-block summary::-webkit-details-marker { display: none; }

.dash-sub-avg {
  margin-left: auto;
  font-weight: 500;
  font-size: 13px;
  color: var(--text-mute);
}

@media (max-width: 560px) { .mbar { width: 70px; } }

/* ================================================================
   BATTLE: N-PLAYER BOARD, TIMER, RESULTS
   ================================================================ */
.score-grid { display: grid; gap: 12px; grid-template-columns: repeat(2, 1fr); margin-bottom: 24px; }
.score-grid.n3, .score-grid.n5, .score-grid.n6 { grid-template-columns: repeat(3, 1fr); }
.score-grid.n4 { grid-template-columns: repeat(2, 1fr); }
@media (min-width: 620px) { .score-grid.n4 { grid-template-columns: repeat(4, 1fr); } }
.score-grid .player-card .pc-score { font-size: 36px; }

.qtimer { height: 4px; border-radius: 999px; background: var(--bg-2); overflow: hidden; margin-bottom: 16px; }
.qtimer.hidden { display: none; }
.qtimer-fill { display: block; height: 100%; width: 100%; background: var(--accent); border-radius: 999px; transition: width 1s linear; }
.qtimer-num { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--text-dim); }

.result-list { max-width: 380px; margin: 18px auto 0; display: flex; flex-direction: column; gap: 8px; }
.result-row { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: var(--radius-xs); background: var(--panel); border: 1px solid var(--line); }
.result-row.me { border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); box-shadow: 0 0 12px color-mix(in srgb, var(--accent) 10%, transparent); }
.result-rank { font-family: var(--font-mono); font-weight: 700; color: var(--text-mute); width: 34px; }
.result-name { font-weight: 600; flex: 1; text-align: left; }
.result-score { font-family: var(--font-mono); font-weight: 700; font-size: 18px; }

/* ================================================================
   MARKER (ESSAY) PRACTICE
   ================================================================ */
.marker-q {
  margin-top: 8px;
  padding: 22px;
  border-radius: var(--radius-sm);
  background: var(--bg-2);
  border: 1px solid var(--line-soft);
}

.marker-marks {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 20%, transparent);
  padding: 3px 10px;
  border-radius: 999px;
}

.marker-qtext {
  font-size: 17px;
  font-weight: 600;
  line-height: 1.5;
  margin-top: 12px;
}

.mark-result { margin-top: 24px; display: flex; flex-direction: column; gap: 14px; }

.mark-badge {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 16px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--panel);
  backdrop-filter: blur(16px) saturate(1.3);
  -webkit-backdrop-filter: blur(16px) saturate(1.3);
}

.mark-badge.band-high { border-color: color-mix(in srgb, var(--good) 30%, transparent); background: color-mix(in srgb, var(--good) 5%, var(--panel)); box-shadow: 0 0 12px color-mix(in srgb, var(--good) 10%, transparent); }
.mark-badge.band-mid  { border-color: color-mix(in srgb, var(--warn) 30%, transparent); background: color-mix(in srgb, var(--warn) 5%, var(--panel)); box-shadow: 0 0 12px color-mix(in srgb, var(--warn) 10%, transparent); }
.mark-badge.band-low  { border-color: color-mix(in srgb, var(--bad) 30%, transparent);  background: color-mix(in srgb, var(--bad) 5%, var(--panel)); box-shadow: 0 0 12px color-mix(in srgb, var(--bad) 10%, transparent); }

.mark-score { font-family: var(--font-mono); font-weight: 700; font-size: 30px; }
.mark-sub { color: var(--text-dim); font-size: 14px; }

.mark-sec {
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: var(--panel-2);
  backdrop-filter: blur(12px) saturate(1.3);
  -webkit-backdrop-filter: blur(12px) saturate(1.3);
  border: 1px solid var(--line-soft);
  border-left-width: 3px;
}

.mark-sec h4 { font-size: 14px; margin-bottom: 8px; font-weight: 600; }
.mark-sec.good  { border-left-color: var(--good); }
.mark-sec.warn  { border-left-color: var(--warn); }
.mark-sec.bad   { border-left-color: var(--bad); }
.mark-sec.info  { border-left-color: var(--accent); }
.mark-sec.model { border-left-color: var(--good); background: var(--bg-2); }

.mark-list { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
.mark-list li { font-size: 14px; line-height: 1.6; }
.model-text { margin: 0; font-size: 14px; line-height: 1.65; color: var(--text); white-space: pre-wrap; }
.mark-disclaimer { color: var(--text-mute); font-size: 12px; text-align: center; padding-top: 4px; }

.mark-model {
  background: color-mix(in srgb, var(--good) 4%, var(--bg-2));
  border: 1px solid color-mix(in srgb, var(--good) 15%, var(--line-soft));
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  margin-top: 12px;
}

/* ================================================================
   ACCOUNTS / RANKS / LEADERBOARD — Gaming Ranking
   ================================================================ */
.rank-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-weight: 600;
  font-size: 12px;
  padding: 4px 11px;
  border-radius: 999px;
  color: var(--rc, var(--accent));
  background: color-mix(in srgb, var(--rc, var(--accent)) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--rc, var(--accent)) 22%, transparent);
  white-space: nowrap;
}

.rank-badge.big { font-size: 14px; padding: 6px 14px; }

.profile-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line-soft);
}

.profile-id { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }

.profile-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 24px;
  letter-spacing: -0.02em;
}

.friend-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 4px;
  border-bottom: 1px solid var(--line-soft);
  transition: background var(--duration) ease;
}

.friend-row:last-child { border-bottom: none; }
.friend-name { font-weight: 600; font-size: 14px; }

.friends-box {
  background: var(--panel);
  backdrop-filter: blur(16px) saturate(1.3);
  -webkit-backdrop-filter: blur(16px) saturate(1.3);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-top: 16px;
}

.lb-row {
  display: grid;
  grid-template-columns: 48px 1fr auto auto auto;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border-radius: var(--radius-xs);
  background: var(--panel);
  backdrop-filter: blur(8px) saturate(1.2);
  -webkit-backdrop-filter: blur(8px) saturate(1.2);
  border: 1px solid var(--line-soft);
  margin-bottom: 6px;
  transition: all var(--duration) ease;
}

.lb-row:nth-child(1) { border-left: 3px solid var(--gold); box-shadow: 0 0 12px color-mix(in srgb, var(--gold) 10%, transparent); }
.lb-row:nth-child(2) { border-left: 3px solid #C0C0C0; box-shadow: 0 0 8px rgba(192, 192, 192, 0.08); }
.lb-row:nth-child(3) { border-left: 3px solid #CD7F32; box-shadow: 0 0 8px rgba(205, 127, 50, 0.08); }

.lb-row:hover {
  background: var(--panel-2);
  transform: translateX(4px);
  border-color: var(--line);
}

.lb-row.me {
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 40%, transparent), 0 0 16px color-mix(in srgb, var(--accent) 10%, transparent);
  background: color-mix(in srgb, var(--accent) 4%, var(--panel));
  border-left: 3px solid var(--accent);
}

.lb-pos { font-family: var(--font-mono); font-weight: 700; color: var(--text-mute); font-size: 14px; }
.lb-name { font-weight: 600; font-size: 14px; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.lb-elo { font-family: var(--font-mono); font-weight: 700; font-variant-numeric: tabular-nums; }
.lb-record { font-size: 13px; color: var(--text-dim); }

@media (max-width: 560px) {
  .lb-row { grid-template-columns: 36px 1fr auto; }
  .lb-row .rank-badge, .lb-record { display: none; }
}

.elo-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-weight: 600;
  border: 1px solid var(--line);
  background: var(--panel);
  backdrop-filter: blur(16px) saturate(1.3);
  -webkit-backdrop-filter: blur(16px) saturate(1.3);
}

.elo-banner.up   { border-color: color-mix(in srgb, var(--good) 30%, transparent); background: color-mix(in srgb, var(--good) 5%, var(--panel)); box-shadow: 0 0 16px color-mix(in srgb, var(--good) 10%, transparent); }
.elo-banner.down { border-color: color-mix(in srgb, var(--bad) 30%, transparent);  background: color-mix(in srgb, var(--bad) 5%, var(--panel)); box-shadow: 0 0 16px color-mix(in srgb, var(--bad) 10%, transparent); }
.elo-outcome { font-weight: 600; font-size: 15px; }
.elo-delta { font-family: var(--font-mono); font-weight: 700; }


/* ================================================================
   GLASS CARD
   ================================================================ */
.card-glass {
  position: relative;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(18px, 3vw, 28px);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.04) inset,
    0 8px 32px rgba(0, 0, 0, 0.3);
}

/* ── Monospace elements ── */
.mono, .stat-big, .pc-score, .mark-score, .lb-elo, .lb-pos, .score-ring,
.fc-count, .result-score, .result-rank, .qtimer-num, .dash-pct {
  font-family: var(--font-mono);
  font-feature-settings: "tnum";
}

.brand-mark { color: var(--accent-ink); }

/* ================================================================
   EXCUSE GENERATOR
   ================================================================ */
.excuse-card { text-align: left; }
.excuse-line { font-size: 17px; line-height: 1.6; font-weight: 500; color: var(--text); min-height: 54px; }

/* ================================================================
   ACHIEVEMENT BADGES — Rarity Styled
   ================================================================ */
.badge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }

.badge-card {
  background: var(--panel);
  backdrop-filter: blur(16px) saturate(1.3);
  -webkit-backdrop-filter: blur(16px) saturate(1.3);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 16px;
  text-align: center;
  opacity: 0.4;
  filter: grayscale(0.5);
  transition: all var(--duration) ease;
}

.badge-card.got {
  opacity: 1;
  filter: none;
  border-color: color-mix(in srgb, var(--gold) 35%, transparent);
  box-shadow: 0 0 12px color-mix(in srgb, var(--gold) 12%, transparent);
}

/* Rarity styles */
.rarity-common { }
.rarity-rare {
  border-color: color-mix(in srgb, #60A5FA 30%, var(--line)) !important;
  box-shadow: 0 0 16px color-mix(in srgb, #60A5FA 15%, transparent) !important;
}
.rarity-epic {
  border-color: color-mix(in srgb, #A78BFA 30%, var(--line)) !important;
  box-shadow: 0 0 20px color-mix(in srgb, #A78BFA 18%, transparent) !important;
}
.rarity-legendary {
  border-color: color-mix(in srgb, var(--gold) 30%, var(--line)) !important;
  box-shadow: 0 0 24px color-mix(in srgb, var(--gold) 20%, transparent) !important;
  animation: legendaryPulse 2s ease-in-out infinite;
}

@keyframes legendaryPulse {
  0%, 100% { box-shadow: 0 0 24px color-mix(in srgb, var(--gold) 20%, transparent); }
  50%      { box-shadow: 0 0 36px color-mix(in srgb, var(--gold) 35%, transparent); }
}

.badge-card.got.rarity-rare {
  border-color: color-mix(in srgb, #60A5FA 40%, var(--line));
  box-shadow: 0 0 20px color-mix(in srgb, #60A5FA 20%, transparent);
}
.badge-card.got.rarity-epic {
  border-color: color-mix(in srgb, #A78BFA 40%, var(--line));
  box-shadow: 0 0 24px color-mix(in srgb, #A78BFA 25%, transparent);
}
.badge-card.got.rarity-legendary {
  border-color: color-mix(in srgb, var(--gold) 40%, var(--line));
  box-shadow: 0 0 32px color-mix(in srgb, var(--gold) 25%, transparent);
  animation: legendaryPulse 2s ease-in-out infinite;
}

.badge.rarity-common { color: var(--text-dim); border-color: var(--line); background: var(--panel-2); }
.badge.rarity-rare { color: #60A5FA; border-color: color-mix(in srgb, #60A5FA 25%, transparent); background: color-mix(in srgb, #60A5FA 8%, transparent); }
.badge.rarity-epic { color: #A78BFA; border-color: color-mix(in srgb, #A78BFA 25%, transparent); background: color-mix(in srgb, #A78BFA 8%, transparent); }
.badge.rarity-legendary { color: var(--gold); border-color: color-mix(in srgb, var(--gold) 25%, transparent); background: color-mix(in srgb, var(--gold) 8%, transparent); }

.badge-icon { font-size: 28px; margin-bottom: 8px; }
.badge-name { font-weight: 600; font-size: 13px; }
.badge-desc { color: var(--text-mute); font-size: 11px; margin-top: 4px; line-height: 1.4; }
.badge-prog { margin-top: 6px; font-size: 11px; color: var(--gold); font-weight: 600; }

/* ================================================================
   BOSS BATTLE ARENA — Gaming HUD
   ================================================================ */
.boss-arena { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.boss-side {
  position: relative;
  overflow: hidden;
  text-align: center;
  padding: 24px 18px;
  border-radius: var(--radius);
  background: var(--panel);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  border: 1px solid var(--line);
  transition: all var(--duration) ease;
}

.boss-side.me {
  border-color: color-mix(in srgb, var(--blue) 25%, var(--line));
  box-shadow: 0 0 16px color-mix(in srgb, var(--blue) 8%, transparent);
}

.boss-face {
  font-size: 48px;
  line-height: 1;
  margin-bottom: 10px;
  transition: transform 150ms ease;
  display: inline-block;
  filter: drop-shadow(0 0 12px rgba(0, 0, 0, 0.5));
}

.boss-name { font-weight: 700; font-size: 16px; margin-bottom: 14px; }
.hp-row { display: flex; align-items: center; gap: 10px; }
.hp-row .mono { font-size: 13px; min-width: 56px; text-align: right; }

.hpbar {
  flex: 1;
  height: 10px;
  border-radius: 999px;
  background: var(--bg);
  overflow: hidden;
  border: 1px solid var(--line-soft);
  position: relative;
}

.hpfill {
  display: block;
  height: 100%;
  width: 100%;
  border-radius: 999px;
  transition: width 400ms var(--ease);
  position: relative;
}

.hpfill.hp-high {
  background: linear-gradient(90deg, var(--good), color-mix(in srgb, var(--good) 70%, #6ee7b7));
  box-shadow: 0 0 8px color-mix(in srgb, var(--good) 25%, transparent);
}
.hpfill.hp-mid {
  background: linear-gradient(90deg, var(--gold), color-mix(in srgb, var(--gold) 70%, #fde68a));
  box-shadow: 0 0 8px color-mix(in srgb, var(--gold) 25%, transparent);
}
.hpfill.hp-low {
  background: linear-gradient(90deg, var(--bad), color-mix(in srgb, var(--bad) 70%, #fca5a5));
  box-shadow: 0 0 8px color-mix(in srgb, var(--bad) 25%, transparent);
}

/* HP bar glow edge */
.hpfill::after {
  content: '';
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: rgba(255, 255, 255, 0.4);
  border-radius: 0 999px 999px 0;
  filter: blur(2px);
}

.float-hit {
  position: absolute;
  left: 50%;
  top: 30%;
  transform: translateX(-50%);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 20px;
  pointer-events: none;
  animation: floatup 0.9s ease-out forwards;
  text-shadow: 0 0 10px currentColor;
}

.float-hit.good { color: var(--good); }
.float-hit.bad { color: var(--bad); }

@keyframes floatup {
  from { opacity: 1; transform: translate(-50%, 0); }
  to   { opacity: 0; transform: translate(-50%, -40px); }
}

@media (max-width: 560px) { .boss-arena { grid-template-columns: 1fr; } }

.boss-hit { animation: bosshit 0.42s ease; }
@keyframes bosshit {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-7px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(3px); }
}

.boss-side.boss-hit:not(.me) {
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--gold) 40%, transparent), 0 0 24px color-mix(in srgb, var(--gold) 15%, transparent);
}

.boss-side.me.boss-hit {
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--bad) 40%, transparent), 0 0 24px color-mix(in srgb, var(--bad) 15%, transparent);
}

.combo-pill {
  display: block;
  width: 100%;
  text-align: center;
  margin: 14px 0 0;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 14px;
  color: var(--gold);
  letter-spacing: 0.03em;
  animation: comboPop 0.3s ease;
  text-shadow: 0 0 10px color-mix(in srgb, var(--gold) 40%, transparent);
}

.combo-pill.hidden { display: none; }

@keyframes comboPop {
  from { transform: scale(0.7); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

/* ── Ultimate bar ── */
.ult-bar {
  height: 4px;
  border-radius: 999px;
  background: var(--bg);
  overflow: hidden;
  margin-top: 10px;
  border: 1px solid var(--line-soft);
}

.ult-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--gold));
  box-shadow: 0 0 8px color-mix(in srgb, var(--accent) 30%, transparent);
  transition: width 300ms var(--ease);
}

/* ================================================================
   3D STUDY HOUSE
   ================================================================ */
.house-wrap {
  position: relative;
}

.house-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.house-title { font-size: clamp(22px, 4vw, 32px); letter-spacing: -0.02em; font-weight: 700; }

.house-stage {
  position: relative;
  width: 100%;
  min-height: 420px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--line);
  background: radial-gradient(120% 100% at 50% 0%, #121821, #08080c 70%);
  box-shadow: var(--shadow);
}

.house-canvas { display: block; width: 100%; touch-action: none; }

.house-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.spinner {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2.5px solid var(--line);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}

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

.house-label {
  position: absolute;
  transform: translate(-50%, -130%);
  pointer-events: none;
  z-index: 5;
  background: color-mix(in srgb, var(--panel) 90%, transparent);
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  padding: 6px 10px;
  font-size: 12px;
  line-height: 1.3;
  white-space: nowrap;
  backdrop-filter: blur(8px);
  box-shadow: var(--shadow-sm);
}

.house-label b { display: block; }
.house-label span { color: var(--text-mute); font-size: 11px; }


/* ================================================================
   HUB 3D — overlay UI for the drivable world
   ================================================================ */
.hub-overlay {
  background: linear-gradient(180deg, rgba(16,16,24,0.85), rgba(8,8,12,0.9)) !important;
  backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  border: 1px solid rgba(255,255,255,0.08) !important;
  border-radius: 12px !important;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4), 0 0 20px color-mix(in srgb, var(--accent) 10%, transparent);
  font-size: 13px !important;
  font-weight: 500;
  letter-spacing: 0.01em;
  padding: 10px 20px !important;
}

/* Classic mode grid inside hub fallback */
.hub-classic-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  padding: 8px;
}

/* ================================================================
   Info page — team grid
   ================================================================ */
.team-grid {
  display: grid;
  gap: 14px;
  /* compact vertical cards — all five members sit on one row on
     desktop instead of a stack of wide list-rows */
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  margin-bottom: 28px;
}

.team-card {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  background: var(--panel);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 14px 18px;
  transition: transform var(--duration) var(--ease), border-color var(--duration) ease, box-shadow 300ms var(--ease);
  animation: teamIn 0.5s var(--ease) both;
  animation-delay: calc(var(--i, 0) * 70ms);
}

@keyframes teamIn {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}

.team-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--hl);
  box-shadow: 0 0 8px color-mix(in srgb, var(--hl) 30%, transparent);
}

.team-card:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--hl) 30%, var(--line));
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3), 0 0 16px color-mix(in srgb, var(--hl) 8%, transparent);
}

.team-avatar {
  flex: none;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 600;
  font-size: 17px;
  color: var(--accent-ink);
  background: linear-gradient(135deg, var(--hl), color-mix(in srgb, var(--hl) 80%, var(--accent)));
  box-shadow: 0 0 12px color-mix(in srgb, var(--hl) 25%, transparent);
}

.team-meta { min-width: 0; }
.team-name { font-weight: 600; font-size: 15.5px; letter-spacing: -0.01em; }
.team-note { font-size: 12.5px; color: var(--text-dim); margin-top: 3px; line-height: 1.35; }

.team-social {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  align-self: flex-start;
  max-width: 100%;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg-2);
  transition: all var(--duration) ease;
  font-size: 12px;
}

a.team-social:hover {
  border-color: color-mix(in srgb, var(--hl) 35%, var(--line));
  transform: translateY(-1px);
  box-shadow: 0 0 8px color-mix(in srgb, var(--hl) 10%, transparent);
}

.team-social.no-link { opacity: 0.85; }
.ts-plat { font-size: 9px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-mute); flex: none; }
.ts-handle { font-family: var(--font-mono); font-size: 11.5px; color: var(--text); word-break: break-all; line-height: 1.2; }
a.team-social .ts-handle { color: var(--hl); }
.ts-arrow { color: var(--text-mute); font-size: 11px; flex: none; }
.info-foot { margin-top: 6px; }

/* ================================================================
   PROGRESSION: RATINGS, LEVEL, XP — Gaming Style
   ================================================================ */
.dmc-rating {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 60px;
  line-height: 1;
  margin-bottom: 4px;
  text-shadow: 0 4px 30px currentColor;
  animation: dmcPop 0.4s var(--ease);
}

@keyframes dmcPop {
  from { transform: scale(0.5) rotate(-6deg); opacity: 0; }
  to   { transform: none; opacity: 1; }
}

.lvl-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--hl) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--hl) 22%, transparent);
  font-weight: 600;
  font-size: 12.5px;
  color: var(--hl);
  white-space: nowrap;
  box-shadow: 0 0 8px color-mix(in srgb, var(--hl) 10%, transparent);
}

.lvl-pill .prestige {
  color: var(--accent-ink);
  background: linear-gradient(135deg, var(--hl), var(--accent));
  border-radius: 999px;
  padding: 1px 6px;
  font-size: 10px;
  font-weight: 700;
}

.xp-panel .xp-title-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.current-title { font-weight: 600; font-size: 18px; letter-spacing: -0.01em; }

.exp-meta {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 6px;
}

/* ── XP Bar — Gaming Style ── */
.exp-wrap {
  position: relative;
}

.exp-bar {
  height: 8px;
  border-radius: 999px;
  background: var(--bg-2);
  overflow: hidden;
  border: 1px solid var(--line-soft);
  position: relative;
}

.exp-bar i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--hl), color-mix(in srgb, var(--hl) 70%, var(--blue)));
  border-radius: 999px;
  transition: width 600ms var(--ease);
  position: relative;
  box-shadow: 0 0 8px color-mix(in srgb, var(--hl) 30%, transparent);
}

/* ── Glow effect on fill edge ── */
.exp-bar i::after {
  content: '';
  position: absolute;
  right: -1px;
  top: -2px;
  bottom: -2px;
  width: 6px;
  background: rgba(255, 255, 255, 0.5);
  border-radius: 999px;
  filter: blur(3px);
}

/* ── Level badge with glow ── */
.lvl-pill.glow {
  box-shadow: 0 0 16px color-mix(in srgb, var(--hl) 25%, transparent);
  animation: lvlGlow 2s ease-in-out infinite alternate;
}

@keyframes lvlGlow {
  0%   { box-shadow: 0 0 8px color-mix(in srgb, var(--hl) 15%, transparent); }
  100% { box-shadow: 0 0 20px color-mix(in srgb, var(--hl) 30%, transparent); }
}

/* ================================================================
   PROFILE CARD — Gaming Character Sheet
   ================================================================ */
.profile-card {
  position: relative;
  overflow: hidden;
}

.profile-avatar {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  font-size: 24px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  border: 2px solid color-mix(in srgb, var(--accent) 25%, transparent);
  flex-shrink: 0;
  box-shadow: 0 0 16px color-mix(in srgb, var(--accent) 15%, transparent);
}

.profile-coins-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 700;
  color: var(--gold);
  background: color-mix(in srgb, var(--gold) 10%, transparent);
  padding: 2px 10px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--gold) 20%, transparent);
}

.profile-title-label {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--hl) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--hl) 20%, transparent);
  color: var(--hl);
  text-shadow: 0 0 8px color-mix(in srgb, var(--hl) 30%, transparent);
}

.profile-card-main {
  position: relative;
  z-index: 2;
}

.profile-card-footer {
  position: relative;
  z-index: 2;
}

.profile-bio-preview {
  position: relative;
  z-index: 2;
}

.profile-private-badge {
  display: inline-block;
  font-size: 12px;
  padding: 4px 12px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--text-dim) 8%, transparent);
  border: 1px solid var(--line);
  color: var(--text-dim);
  position: relative;
  z-index: 2;
}

/* ── Avatar border glow variants ── */
.border_none { border-color: color-mix(in srgb, var(--accent) 25%, transparent) !important; }
.border_gold {
  border-color: color-mix(in srgb, var(--gold) 50%, transparent) !important;
  box-shadow: 0 0 16px color-mix(in srgb, var(--gold) 20%, transparent) !important;
}
.border_neon {
  border-color: color-mix(in srgb, var(--accent) 60%, transparent) !important;
  box-shadow: 0 0 20px color-mix(in srgb, var(--accent) 30%, transparent), 0 0 40px color-mix(in srgb, var(--accent) 10%, transparent) !important;
}
.border_shadow {
  border-color: color-mix(in srgb, var(--bad) 40%, transparent) !important;
  box-shadow: 0 0 16px color-mix(in srgb, var(--bad) 20%, transparent) !important;
}
.border_glitch {
  border-color: color-mix(in srgb, var(--accent) 50%, transparent) !important;
  box-shadow: 0 0 16px color-mix(in srgb, var(--accent) 20%, transparent), -2px 0 8px color-mix(in srgb, var(--bad) 15%, transparent) !important;
  animation: glitchBorder 3s ease-in-out infinite;
}

@keyframes glitchBorder {
  0%, 90%, 100% { transform: translate(0, 0); }
  92% { transform: translate(-2px, 1px); }
  94% { transform: translate(2px, -1px); }
  96% { transform: translate(-1px, -1px); }
  98% { transform: translate(1px, 1px); }
}

/* ── Profile effects ── */
.effect_none { }

.effect_matrix .profile-matrix-col {
  position: absolute;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--good);
  opacity: 0;
  pointer-events: none;
  animation: matrixFall 4s linear infinite;
  writing-mode: vertical-rl;
}

@keyframes matrixFall {
  0%   { opacity: 0; transform: translateY(-100%); }
  10%  { opacity: 0.6; }
  90%  { opacity: 0.2; }
  100% { opacity: 0; transform: translateY(200%); }
}

.effect_nebula .profile-nebula-glow {
  position: absolute;
  inset: -20%;
  background: radial-gradient(ellipse at 30% 50%, color-mix(in srgb, var(--accent) 12%, transparent), transparent 60%),
              radial-gradient(ellipse at 70% 30%, color-mix(in srgb, var(--accent) 8%, transparent), transparent 50%);
  pointer-events: none;
  animation: nebulaPulse 6s ease-in-out infinite alternate;
}

@keyframes nebulaPulse {
  0%   { opacity: 0.3; transform: scale(1); }
  100% { opacity: 0.6; transform: scale(1.05); }
}

.effect_sparks .profile-spark {
  position: absolute;
  border-radius: 50%;
  background: var(--gold);
  pointer-events: none;
  animation: sparkFloat 3s ease-in-out infinite;
  opacity: 0;
}

@keyframes sparkFloat {
  0%   { opacity: 0; transform: translateY(0); }
  20%  { opacity: 0.8; }
  100% { opacity: 0; transform: translateY(-80px); }
}

/* Shared profile effects (always available) */
.profile-spark {
  position: absolute;
  border-radius: 50%;
  background: var(--gold);
  pointer-events: none;
  animation: sparkFloat 3s ease-in-out infinite;
  opacity: 0;
}

.profile-matrix-col {
  position: absolute;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--good);
  opacity: 0;
  pointer-events: none;
  animation: matrixFall 4s linear infinite;
  writing-mode: vertical-rl;
}

.profile-nebula-glow {
  position: absolute;
  inset: -20%;
  background: radial-gradient(ellipse at 30% 50%, color-mix(in srgb, var(--accent) 12%, transparent), transparent 60%),
              radial-gradient(ellipse at 70% 30%, color-mix(in srgb, var(--accent) 8%, transparent), transparent 50%);
  pointer-events: none;
  animation: nebulaPulse 6s ease-in-out infinite alternate;
}

/* ── Profile Search Card ── */
.profile-card-search {
  position: relative;
  overflow: hidden;
}

/* ================================================================
   AUTH / ACCOUNT GATE — Glassmorphic Center
   ================================================================ */
.auth-shell { max-width: 520px; }
.auth-panel {
  padding: 22px 24px;
  background: var(--panel);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.03);
}
.auth-tabs { margin-bottom: 18px; }
.auth-fields { display: flex; flex-direction: column; gap: 2px; }
.auth-err { color: var(--bad); min-height: 18px; font-size: 13px; margin-top: 10px; text-shadow: 0 0 8px color-mix(in srgb, var(--bad) 20%, transparent); }
.auth-info { font-size: 13px; margin-top: 8px; line-height: 1.5; }
.auth-info a { color: var(--hl); text-decoration: underline; }
.auth-rules { margin: 16px 0 0; padding-left: 18px; font-size: 12.5px; line-height: 1.7; }
.pass-hint { font-size: 12px; margin: -4px 0 8px; }
.verify-panel { text-align: center; padding: 32px 24px; }
.verify-icon { font-size: 48px; margin-bottom: 12px; }
.profile-emoji { font-size: 36px; line-height: 1; margin-right: 12px; }
.bio-input { resize: vertical; min-height: 96px; }

.settings-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  cursor: pointer;
  user-select: none;
  padding: 4px 0;
}

.settings-toggle-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--hl);
  cursor: pointer;
  flex-shrink: 0;
}

.settings-privacy .profile-private-badge {
  display: inline-block;
  font-size: 12px;
  padding: 4px 12px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--text-dim) 8%, transparent);
  border: 1px solid var(--line);
  color: var(--text-dim);
}

/* ================================================================
   GOOGLE SIGN-IN BUTTON
   ================================================================ */
.google-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: #ffffff;
  color: #1f1f1f;
  border: 1px solid #dadce0;
  border-radius: var(--radius-xs);
  padding: 12px 20px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--duration) ease;
  width: 100%;
  max-width: 320px;
  margin: 10px auto;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.google-btn:hover {
  background: #f8f9fa;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12), 0 0 8px color-mix(in srgb, var(--accent) 10%, transparent);
  transform: translateY(-1px);
}

.google-btn:active { transform: translateY(0) scale(0.98); }
.google-btn svg { display: block; flex-shrink: 0; }

/* ================================================================
   SHOP & CUSTOMIZATION
   ================================================================ */
.shop-card {
  position: relative;
  overflow: hidden;
  background: var(--panel);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 18px;
  transition: all var(--duration) ease;
}

.shop-card:hover {
  border-color: color-mix(in srgb, var(--accent) 30%, var(--line));
  box-shadow: 0 0 16px color-mix(in srgb, var(--accent) 10%, transparent);
  transform: translateY(-2px);
}

.gacha-box-content {
  position: relative;
  z-index: 2;
}

.gacha-box-art {
  cursor: pointer;
  transition: transform 300ms var(--ease);
}

.gacha-box-art:hover { transform: scale(1.05); }

.roll-shake {
  animation: rollShake 0.5s ease;
}

@keyframes rollShake {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-8deg); }
  75% { transform: rotate(8deg); }
}

.gacha-card-reveal {
  animation: authFadeIn 0.8s var(--ease) both;
}

/* ================================================================
   MONTHLY REWARDS CALENDAR — Premium Grid
   ================================================================ */
.reward-summary {
  padding: 20px 22px;
  background: var(--panel);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 16px;
}

.reward-summary-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.reward-today-prize { font-weight: 600; font-size: 20px; color: var(--hl); text-shadow: 0 0 12px color-mix(in srgb, var(--hl) 25%, transparent); }
.reward-streak { font-size: 17px; font-weight: 700; }
.reward-streak-val { font-family: var(--font-mono); font-weight: 700; color: var(--gold); }

.reward-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
}

.reward-day {
  aspect-ratio: 1;
  border-radius: var(--radius-xs);
  border: 1px solid var(--line);
  background: var(--panel);
  backdrop-filter: blur(8px) saturate(1.2);
  -webkit-backdrop-filter: blur(8px) saturate(1.2);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 6px;
  text-align: center;
  transition: all var(--duration) ease;
  position: relative;
}

.reward-day .rd-num { font-size: 10px; color: var(--text-mute); font-weight: 600; }
.reward-day .rd-icon { font-size: 16px; line-height: 1; }
.reward-day .rd-label { font-size: 8.5px; color: var(--text-dim); line-height: 1.2; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }

.reward-day.claimed {
  border-color: color-mix(in srgb, var(--good) 30%, var(--line));
  background: color-mix(in srgb, var(--good) 6%, var(--panel));
}

.reward-day.claimed::after {
  content: "✓";
  position: absolute;
  top: 3px;
  right: 4px;
  font-size: 8px;
  color: var(--good);
  font-weight: 700;
  text-shadow: 0 0 4px color-mix(in srgb, var(--good) 30%, transparent);
}

.reward-day.today {
  border-color: var(--hl);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--hl) 20%, transparent);
  animation: rewardTodayPulse 2s ease infinite;
}

.reward-day.locked {
  opacity: 0.25;
}

.reward-day.milestone {
  background: color-mix(in srgb, var(--gold) 5%, var(--panel));
  border-color: color-mix(in srgb, var(--gold) 25%, var(--line));
  box-shadow: 0 0 8px color-mix(in srgb, var(--gold) 8%, transparent);
}

@keyframes rewardTodayPulse {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--hl) 20%, transparent); }
  50%      { box-shadow: 0 0 12px 3px color-mix(in srgb, var(--hl) 18%, transparent); }
}

/* ================================================================
   AI ADVISOR CHAT
   ================================================================ */
.advisor-panel {
  padding: 18px;
  display: flex;
  flex-direction: column;
  min-height: 520px;
  background: var(--panel);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.advisor-prompts { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.advisor-prompt-btn { font-size: 12px; }

.advisor-chat {
  flex: 1;
  min-height: 280px;
  max-height: 420px;
  overflow-y: auto;
  padding: 14px;
  background: var(--bg-2);
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-soft);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.advisor-bubble {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.6;
  position: relative;
}

.advisor-bubble.user {
  align-self: flex-end;
  background: color-mix(in srgb, var(--hl) 12%, var(--panel));
  border: 1px solid color-mix(in srgb, var(--hl) 20%, var(--line));
  border-bottom-right-radius: 4px;
  box-shadow: 0 0 8px color-mix(in srgb, var(--hl) 8%, transparent);
}

.advisor-bubble.ai {
  align-self: flex-start;
  background: var(--panel);
  backdrop-filter: blur(12px) saturate(1.3);
  -webkit-backdrop-filter: blur(12px) saturate(1.3);
  border: 1px solid var(--line);
  border-bottom-left-radius: 4px;
}

.advisor-input { flex: 1; resize: vertical; min-height: 44px; }
.advisor-compose { gap: 10px; }
.advisor-subject { max-width: 280px; }

.advisor-typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 14px;
  align-self: flex-start;
}

.typing-dots { letter-spacing: 4px; animation: typingBlink 1s infinite; }

@keyframes typingBlink {
  0%, 100% { opacity: 0.3; }
  50%      { opacity: 1; }
}

/* ================================================================
   POMODORO TIMER
   ================================================================ */
.pomo-panel {
  padding: 28px 22px;
  text-align: center;
  background: var(--panel);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.pomo-wrap {
  position: relative;
  width: 200px;
  height: 200px;
  margin: 0 auto 20px;
}

.pomo-ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.pomo-track { fill: none; stroke: var(--line); stroke-width: 6; }
.pomo-progress {
  fill: none;
  stroke-width: 6;
  stroke-linecap: round;
  transition: stroke-dashoffset 300ms ease, stroke 300ms ease;
  filter: drop-shadow(0 0 4px color-mix(in srgb, var(--accent) 40%, transparent));
}

.pomo-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.pomo-time { font-size: 34px; font-weight: 700; letter-spacing: 0.04em; font-family: var(--font-mono); }
.pomo-label { font-size: 13px; color: var(--text-dim); margin-top: 2px; }
.pomo-sessions { font-size: 12px; margin-top: 6px; }
.pomo-presets { justify-content: center; flex-wrap: wrap; gap: 8px; }

/* ================================================================
   CHECKLIST
   ================================================================ */
.checklist-prog { margin: 10px 0 14px; }
.checklist-prog-bar { height: 5px; border-radius: 999px; background: var(--bg-2); overflow: hidden; border: 1px solid var(--line-soft); margin-bottom: 6px; }
.checklist-prog-bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--good), color-mix(in srgb, var(--good) 70%, #6ee7b7)); border-radius: 999px; transition: width 350ms var(--ease); box-shadow: 0 0 4px color-mix(in srgb, var(--good) 25%, transparent); }

.checklist-list { display: flex; flex-direction: column; gap: 8px; }

.checklist-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-xs);
  background: var(--bg-2);
  border: 1px solid var(--line-soft);
  transition: all 250ms ease;
}

.checklist-row.done .checklist-text { text-decoration: line-through; color: var(--text-mute); }
.checklist-text { flex: 1; font-size: 14px; }
.checklist-tag { font-size: 11px; flex: none; }

/* ================================================================
   NAV NOTIFICATION DOT (rules live with .sidenav; keyframes below)
   ================================================================ */
@keyframes navDotPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.7; transform: scale(1.15); }
}

/* ================================================================
   SKELETON LOADING
   ================================================================ */
.skeleton {
  background: linear-gradient(90deg, var(--panel) 25%, var(--panel-2) 50%, var(--panel) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
  color: transparent !important;
  pointer-events: none;
  user-select: none;
  min-height: 1em;
  min-width: 3em;
}

.skeleton * { visibility: hidden !important; }

.skeleton.img { width: 100%; aspect-ratio: 16/9; border-radius: var(--radius); }
.skeleton.text { height: 1em; margin-bottom: 8px; width: 80%; }
.skeleton.text.short { width: 40%; }
.skeleton.title { height: 1.5em; width: 60%; margin-bottom: 12px; }
.skeleton.avatar { width: 48px; height: 48px; border-radius: 50%; }
.skeleton.card { height: 180px; border-radius: var(--radius); }

@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ================================================================
   FLOATING PARTICLES (positioned by JS)
   ================================================================ */
.particle {
  position: fixed;
  border-radius: 50%;
  pointer-events: none;
  opacity: 0;
  animation: particleFloat linear infinite;
  z-index: 0;
}

@keyframes particleFloat {
  0%   { transform: translateY(100vh) scale(0); opacity: 0; }
  10%  { opacity: 0.6; }
  90%  { opacity: 0.6; }
  100% { transform: translateY(-10vh) scale(1); opacity: 0; }
}

/* ================================================================
   MOUSE GLOW (positioned by JS)
   ================================================================ */
.mouse-glow {
  position: fixed;
  width: 400px;
  height: 400px;
  border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--accent) 8%, transparent), transparent 70%);
  pointer-events: none;
  transform: translate(-50%, -50%);
  z-index: 0;
  transition: left 100ms linear, top 100ms linear;
}

/* ================================================================
   MOUSE FX (mousefx.js) — cursor spotlight, click ripple + sparks
	   ================================================================ */
.mfx-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9998;
  overflow: hidden;
}

/* cursor spotlight — single element that follows the pointer,
   lighting up the background. Cheap (one transform per frame). */
.mfx-spotlight {
  position: fixed;
  top: 0;
  left: 0;
  width: 600px;
  height: 600px;
  margin: -300px 0 0 -300px;   /* centre the gradient on the pointer */
  pointer-events: none;
  z-index: 1;                   /* above aurora layers (z-index:0), below content */
  mix-blend-mode: screen;
  will-change: transform;
  opacity: 0.85;
}

/* ── water ripple on click — 5 concentric rings expanding outward ── */
.mfx-ripple {
  position: fixed;
  border-radius: 50%;
  border: 1.5px solid var(--accent);
  transform: translate(-50%, -50%) scale(0);
  pointer-events: none;
  animation: mfxWaterRing var(--dur, 0.8s) ease-out var(--delay, 0s) forwards;
  will-change: transform, opacity;
}
@keyframes mfxWaterRing {
  0%   { transform: translate(-50%, -50%) scale(0); opacity: 0.7; border-width: 2px; }
  100% { transform: translate(-50%, -50%) scale(1); opacity: 0;   border-width: 0.3px; }
}


/* ================================================================
   MUSIC PLAYER (music.js) — ambient study music in sidebar
   ================================================================ */
.music-player {
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  flex-shrink: 0;
  transition: opacity 200ms var(--ease);
}

.mp-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mp-play {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  color: var(--accent);
  transition: background var(--duration) ease, transform 150ms ease, box-shadow var(--duration) ease;
  cursor: pointer;
}
.mp-play:hover {
  background: color-mix(in srgb, var(--accent) 28%, transparent);
  box-shadow: 0 0 12px color-mix(in srgb, var(--accent) 20%, transparent);
}
.mp-play:active { transform: scale(0.92); }

.mp-label {
  flex: 1;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: opacity 200ms var(--ease);
}

.mp-mute {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  color: var(--text-mute);
  border: none;
  background: transparent;
  cursor: pointer;
  transition: color var(--duration) ease, opacity var(--duration) ease;
}
.mp-mute:hover { color: var(--text-dim); }

/* volume slider row */
.mp-vol-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  color: var(--text-mute);
}

.mp-vol {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.08);
  outline: none;
  cursor: pointer;
  transition: background var(--duration) ease;
}
.mp-vol::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 6px var(--accent);
  border: none;
  cursor: pointer;
  transition: transform 150ms ease;
}
.mp-vol::-webkit-slider-thumb:hover { transform: scale(1.2); }
.mp-vol::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 6px var(--accent);
  border: none;
  cursor: pointer;
}

/* station selector */
.mp-stations {
  display: flex;
  gap: 4px;
  margin-top: 8px;
}

.mp-st {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 0;
  border-radius: var(--radius-xs);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.04);
  color: var(--text-mute);
  cursor: pointer;
  transition: background var(--duration) ease, border-color var(--duration) ease, color var(--duration) ease, box-shadow var(--duration) ease;
  font-size: 14px;
}
.mp-st:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.08);
  color: var(--text-dim);
}
.mp-st.active {
  background: color-mix(in srgb, var(--accent) 15%, transparent);
  border-color: color-mix(in srgb, var(--accent) 30%, transparent);
  color: var(--accent);
  box-shadow: 0 0 10px color-mix(in srgb, var(--accent) 10%, transparent);
}
.mp-st-ico {
  line-height: 1;
}

/* ── Collapsed sidebar: music player collapses to icon-only ── */
body.sb-collapsed .music-player {
  padding-top: 0;
  border-top: none;
}
body.sb-collapsed .mp-label,
body.sb-collapsed .mp-vol-row,
body.sb-collapsed .mp-stations {
  display: none;
}
body.sb-collapsed .mp-head {
  justify-content: center;
}
body.sb-collapsed .mp-mute {
  display: none;
}
body.sb-collapsed .mp-play {
  width: 28px;
  height: 28px;
}
body.sb-collapsed .mp-play svg {
  width: 13px;
  height: 13px;
}

/* ── Mobile: keep full player visible in drawer ── */

/* ================================================================
   MESSAGES — inbox layout + conversation thread
   ================================================================ */
.msg-shell {
  display: flex;
  flex-direction: row;
  /* fixed height so the THREAD scrolls (not the page) — required for
     follow-latest behaviour and the "Check Latest Message" pill */
  height: clamp(520px, 72vh, 860px);
}

/* left column — conversation list */
.msg-list-col {
  width: 260px;
  flex-shrink: 0;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
}
.msg-list-head {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.msg-convo-list {
  flex: 1;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.08) transparent;
}
.msg-convo-list::-webkit-scrollbar { width: 5px; }
.msg-convo-list::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 5px; }

.msg-convo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  cursor: pointer;
  border-bottom: 1px solid var(--line-soft);
  transition: background var(--duration) ease;
}
.msg-convo:hover { background: rgba(255, 255, 255, 0.03); }
.msg-convo.active {
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  border-left: 3px solid var(--accent);
  padding-left: 13px;
}
.msg-convo-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}
.msg-convo-main {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}
.msg-convo-name {
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.msg-convo-preview {
  font-size: 12px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}
.msg-convo-time {
  font-size: 11px;
  color: var(--text-mute);
  white-space: nowrap;
  flex-shrink: 0;
  align-self: flex-start;
  margin-top: 2px;
}

/* right column — thread */
.msg-thread-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.msg-thread-head {
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  font-weight: 600;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.msg-thread-body {
  flex: 1;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.08) transparent;
  position: relative;
}
.msg-thread-body::-webkit-scrollbar { width: 5px; }
.msg-thread-body::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 5px; }

.msg-bubbles {
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.msg-bubble {
  max-width: 72%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.45;
  word-wrap: break-word;
}
.msg-bubble.in {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  border-bottom-left-radius: 4px;
}
.msg-bubble.out {
  align-self: flex-end;
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
  border-bottom-right-radius: 4px;
}
.msg-bubble-text {
  white-space: pre-wrap;
}
.msg-bubble-time {
  font-size: 10px;
  color: var(--text-mute);
  margin-top: 4px;
  text-align: right;
}

.msg-thread-foot {
  padding: 12px 18px;
  border-top: 1px solid var(--line);
  flex-shrink: 0;
}

/* ── photo attach button ── */
.msg-photo-btn {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-dim);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 200ms ease;
}
.msg-photo-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
  color: var(--text);
}

/* ── photo preview in compose area ── */
.msg-photo-preview-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0 4px;
}
.msg-photo-preview {
  max-height: 80px;
  max-width: 120px;
  border-radius: 10px;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.msg-photo-remove {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(255, 80, 80, 0.15);
  border: 1px solid rgba(255, 80, 80, 0.2);
  color: #ff6b6b;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  padding: 0;
  transition: all 200ms ease;
}
.msg-photo-remove:hover {
  background: rgba(255, 80, 80, 0.3);
}

/* ── image inside message bubbles ── */
.msg-bubble-img {
  max-width: 240px;
  max-height: 200px;
  border-radius: 10px;
  object-fit: cover;
  margin-bottom: 6px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}
.msg-bubble.out .msg-bubble-img {
  float: none;
}

/* ── full-size image overlay ── */
.msg-img-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  cursor: pointer;
  animation: fadeIn 200ms ease;
}

/* ── drag-and-drop highlight ── */
.msg-thread-col.msg-drag-over {
  outline: 2px dashed var(--accent);
  outline-offset: -4px;
  background: color-mix(in srgb, var(--accent) 4%, transparent);
}
.msg-thread-col.msg-drag-over .msg-thread-body::after {
  content: "Drop image here";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 10, 26, 0.7);
  color: var(--accent);
  font-size: 15px;
  font-weight: 600;
  pointer-events: none;
  z-index: 5;
}

.msg-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: var(--text-dim);
  text-align: center;
}

/* mobile: stack the columns */
@media (max-width: 640px) {
  .msg-shell {
    flex-direction: column;
    min-height: 0;
  }
  .msg-list-col {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--line);
    max-height: 200px;
  }
  .msg-convo.active {
    border-left: none;
    border-right: 3px solid var(--accent);
  }
  .msg-bubble { max-width: 85%; }
}

/* ================================================================
   AUTH-MODE CENTERING & PAGE TRANSITIONS
   ================================================================ */
body.auth-mode .sidenav,
body.auth-mode .sb-burger,
body.auth-mode .sb-scrim,
body.auth-mode .footer,
body.auth-mode .credit,
body.auth-mode .back,
body.auth-mode .audio-dock {
  display: none !important;
}

body.auth-mode {
  display: flex !important;
  flex-direction: column !important;
  justify-content: center !important;
  align-items: center !important;
  min-height: 100vh !important;
  margin: 0 !important;
  padding: 0 !important;
  background: var(--bg) !important;
}

body.auth-mode::before {
  background:
    radial-gradient(600px 400px at 30% 40%, rgba(123, 97, 255, 0.12), transparent 60%),
    radial-gradient(400px 300px at 70% 60%, rgba(108, 140, 255, 0.08), transparent 60%) !important;
}

body.auth-mode .app {
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  flex: none !important;
  width: 100% !important;
  max-width: 520px !important;
  padding: 20px !important;
  margin: 0 !important;
}

body.auth-mode .auth-shell {
  width: 100% !important;
  max-width: 460px !important;
  animation: authFadeIn 0.8s var(--ease) both;
}

body.auth-mode .auth-panel {
  background: color-mix(in srgb, var(--panel) 70%, transparent) !important;
  border: 1px solid rgba(255, 255, 255, 0.06) !important;
  backdrop-filter: blur(24px) saturate(1.4) !important;
  -webkit-backdrop-filter: blur(24px) saturate(1.4) !important;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5), 0 0 40px color-mix(in srgb, var(--accent) 5%, transparent), inset 0 1px 0 rgba(255, 255, 255, 0.03) !important;
  border-radius: 20px !important;
  padding: 36px 28px !important;
}

@keyframes authFadeIn {
  from { opacity: 0; transform: translateY(16px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ================================================================
   INTERACTION POLISH — smooth feel everywhere
   ================================================================ */

/* ── Smooth scroll globally ── */
html { scroll-behavior: smooth; }

/* ── Back links — slide on hover ── */
.back {
  transition: color var(--duration) ease, transform var(--duration) var(--ease);
}
.back:hover {
  color: var(--accent);
  transform: translateX(-3px);
}

/* ── Tabs — underline slide indicator ── */
.tab {
  position: relative;
  transition: color var(--duration) ease, background var(--duration) ease, transform 150ms var(--ease);
}
.tab:hover { background: rgba(255, 255, 255, 0.04); }
.tab:active { transform: scale(0.97); }

/* ── Chips / filter chips ── */
.chip {
  transition: all 180ms var(--ease);
}
.chip:hover {
  transform: translateY(-1px);
}
.chip:active {
  transform: scale(0.97);
}

/* ── Topic cards — press feedback ── */
.topic-card {
  cursor: pointer;
  transition: transform 250ms var(--ease), border-color var(--duration) ease, box-shadow 300ms var(--ease);
}
.topic-card:active {
  transform: scale(0.98);
}

/* ── Link rows — subtle slide on hover ── */
.link-row {
  transition: all var(--duration) var(--ease);
  cursor: pointer;
}

/* ── Inputs — smooth glow on focus ── */
.input {
  transition: border-color 200ms var(--ease), box-shadow 200ms var(--ease), background 200ms var(--ease);
}
.input:hover {
  border-color: color-mix(in srgb, var(--accent) 20%, var(--line));
}

/* ── Stat cards — press feedback ── */
.stat-card {
  cursor: default;
  transition: border-color var(--duration) ease, transform 250ms var(--ease), box-shadow 300ms var(--ease);
}
.stat-card:active {
  transform: scale(0.98);
}

/* ── Reward days — press on claimable ── */
.reward-day {
  cursor: default;
  transition: all var(--duration) ease;
}
.reward-day.today {
  cursor: pointer;
}
.reward-day.today:hover {
  transform: scale(1.08);
  box-shadow: 0 0 16px color-mix(in srgb, var(--hl) 25%, transparent);
}
.reward-day.today:active {
  transform: scale(0.95);
}

/* ── Sidebar nav links — smoother hover easing ── */
.sb-nav a {
  transition: color 180ms var(--ease), background 180ms var(--ease), box-shadow 180ms var(--ease), transform 150ms var(--ease);
}
.sb-nav a:active {
  transform: scale(0.96);
}

/* ── All interactive cursor targets get a slight press ── */
[onclick], a, button, .tab, .chip, .option {
  transition-property: transform, color, background, border-color, box-shadow, opacity;
  transition-duration: 200ms;
  transition-timing-function: var(--ease);
}
[onclick]:active, a:active, button:active, .option:active {
  transform: scale(0.98);
}

/* ── Select dropdowns ── */
select {
  transition: border-color 200ms var(--ease), box-shadow 200ms var(--ease);
}

/* ── Page content padding — smooth layout shift ── */
body {
  transition: padding-left 320ms var(--ease);
}

/* ================================================================
   MOTION / 3D (fx.js)
   ================================================================ */
@media (prefers-reduced-motion: no-preference) {
  .fx-reveal { opacity: 0; transform: translateY(14px); transition: opacity 0.5s ease, transform 0.5s var(--ease); }
  .fx-in { opacity: 1; transform: none; }
}

.subject-card, .topic-card {
  will-change: transform;
  transition: transform 300ms var(--ease), border-color var(--duration) ease, box-shadow 300ms var(--ease);
}

.subject-card:hover, .topic-card:hover {
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
}

.subject-card .sc-icon, .topic-card h4 { transform: translateZ(20px); }

.subject-card::after {
  width: 3px;
  border-radius: 0 3px 3px 0;
  opacity: 0.8;
}

/* ================================================================
   CUSTOM SCROLLBAR
   ================================================================ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(123, 97, 255, 0.3); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: rgba(123, 97, 255, 0.5); }

/* Firefox */
* { scrollbar-width: thin; scrollbar-color: rgba(123, 97, 255, 0.3) transparent; }

/* ================================================================
   SELECTION STYLING
   ================================================================ */
::selection {
  background: color-mix(in srgb, var(--accent) 25%, transparent);
  color: var(--text);
}

/* ================================================================
   FOCUS VISIBLE (Accessibility)
   ================================================================ */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  box-shadow: 0 0 8px color-mix(in srgb, var(--accent) 20%, transparent);
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  box-shadow: 0 0 8px color-mix(in srgb, var(--accent) 20%, transparent);
}

/* Remove outline for mouse users */
:focus:not(:focus-visible) {
  outline: none;
}

/* ================================================================
   RESPONSIVE
   ================================================================ */
@media (max-width: 768px) {
  :root {
    --radius: 12px;
    --radius-sm: 8px;
  }

  .grid {
    gap: 12px;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  }

  .subject-card {
    padding: 18px;
    min-height: auto;
  }

  .stat-grid {
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  }

  .boss-arena { gap: 10px; }

  .team-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .panel {
    padding: 16px;
  }
}

@media (max-width: 560px) {
  .vs-board { grid-template-columns: 1fr; }
  .vs-mid { padding: 4px 0; }
  .tabs { width: 100%; }
  .flashcard { height: 280px; }
  .reward-grid { grid-template-columns: repeat(4, 1fr); }

  .hero h1 { font-size: clamp(24px, 6vw, 32px); }
  .grid { gap: 10px; grid-template-columns: 1fr; }
  .topic-grid { grid-template-columns: 1fr; }
  .subject-card { padding: 18px; min-height: auto; }
  .boss-face { font-size: 36px; }
  .dmc-rating { font-size: 44px; }

  .stat-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .badge-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .pomo-wrap {
    width: 160px;
    height: 160px;
  }

  .pomo-time { font-size: 28px; }
}

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

  .hero h1 { font-size: 24px; }

  .panel {
    padding: 14px;
    border-radius: var(--radius-sm);
  }
}

/* ================================================================
   SIDEBAR — MOBILE (≤ 820px): slide-over drawer + burger
   The drawer is always full-width (labels visible) regardless of the
   desktop collapsed state; opening it is driven by body.sb-open.
   ================================================================ */
@media (max-width: 820px) {
  .sidenav {
    top: 0;
    left: 0;
    bottom: 0;
    border-radius: 0;
    border-left: none;
    width: var(--sb-w);
    transform: translateX(-105%);
    box-shadow: 0 0 60px rgba(0, 0, 0, 0.6);
  }
  /* drawer ignores desktop-collapsed styling so labels stay visible */
  body.sb-collapsed .sidenav { width: var(--sb-w); }
  body.sb-collapsed .brand-name,
  body.sb-collapsed .sb-label { opacity: 1; width: auto; pointer-events: auto; }
  body.sb-collapsed .sb-nav a { justify-content: flex-start; padding: 10px 12px; }
  body.sb-collapsed .sb-nav a .sb-ico { margin: 0; }

  body.sb-open .sidenav { transform: translateX(0); }
  body.sb-open .sb-scrim { display: block; opacity: 1; }

  .sb-burger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    top: 14px;
    left: 14px;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    z-index: 61;
    color: var(--text);
    background: rgba(20, 20, 30, 0.7);
    backdrop-filter: blur(18px) saturate(1.6);
    -webkit-backdrop-filter: blur(18px) saturate(1.6);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    transition: background var(--duration) ease, border-color var(--duration) ease;
  }
  .sb-burger:hover { background: rgba(40, 40, 56, 0.8); border-color: rgba(255,255,255,0.16); }

  /* content goes full-width; the drawer overlays instead of reserving space */
  body,
  body.sb-collapsed {
    padding-left: 0;
  }
}

/* ================================================================
   UTILITY: HIDDEN / INVISIBLE HELPERS
   ================================================================ */
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; }

/* ================================================================
   ADDITIONAL ENHANCEMENTS
   ================================================================ */

/* ── Hover card lift effect ── */
.subject-card:hover,
.topic-card:hover,
.stat-card:hover,
.badge-card.got:hover,
.shop-card:hover {
  will-change: transform;
}

/* ── Subtle top highlight on glass panels ── */
.panel::after,
.card-glass::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.06), transparent);
  pointer-events: none;
  border-radius: inherit;
}

/* (removed: rotating conic borders on active tabs/chips — visual noise) */

/* ── Glow text for important numbers ── */
.stat-big.glow,
.lb-elo.glow {
  text-shadow: 0 0 12px color-mix(in srgb, var(--accent) 30%, transparent);
}

/* ── Premium input glow ── */
.input:focus-visible {
  border-color: var(--accent);
  box-shadow: var(--ring), 0 0 16px color-mix(in srgb, var(--accent) 10%, transparent);
}

/* ── Error shake for form validation ── */
.input.error,
.field.error .input {
  border-color: var(--bad);
  box-shadow: 0 0 8px color-mix(in srgb, var(--bad) 15%, transparent);
  animation: wrongShake 0.4s var(--ease);
}

/* ── Premium scrollbar for chat ── */
.advisor-chat::-webkit-scrollbar { width: 4px; }
.advisor-chat::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--accent) 20%, transparent); border-radius: 999px; }
.advisor-chat::-webkit-scrollbar-thumb:hover { background: color-mix(in srgb, var(--accent) 35%, transparent); }

/* ── Staggered animation delays for grids ── */
.subject-card,
.topic-card,
.stat-card,
.badge-card,
.team-card,
.lb-row {
  animation: cardIn 0.5s var(--ease) both;
}

.subject-card:nth-child(1), .topic-card:nth-child(1), .stat-card:nth-child(1),
.badge-card:nth-child(1), .lb-row:nth-child(1) { animation-delay: 0ms; }
.subject-card:nth-child(2), .topic-card:nth-child(2), .stat-card:nth-child(2),
.badge-card:nth-child(2), .lb-row:nth-child(2) { animation-delay: 50ms; }
.subject-card:nth-child(3), .topic-card:nth-child(3), .stat-card:nth-child(3),
.badge-card:nth-child(3), .lb-row:nth-child(3) { animation-delay: 100ms; }
.subject-card:nth-child(4), .topic-card:nth-child(4), .stat-card:nth-child(4),
.badge-card:nth-child(4), .lb-row:nth-child(4) { animation-delay: 150ms; }
.subject-card:nth-child(5), .topic-card:nth-child(5), .stat-card:nth-child(5),
.badge-card:nth-child(5), .lb-row:nth-child(5) { animation-delay: 200ms; }
.subject-card:nth-child(6), .topic-card:nth-child(6), .stat-card:nth-child(6),
.badge-card:nth-child(6), .lb-row:nth-child(6) { animation-delay: 250ms; }

@keyframes cardIn {
  from { opacity: 0; transform: translateY(16px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── Victory celebration effect ── */
@keyframes victoryBounce {
  0%   { transform: scale(0.3); opacity: 0; }
  50%  { transform: scale(1.1); }
  70%  { transform: scale(0.95); }
  100% { transform: scale(1); opacity: 1; }
}

.victory-anim {
  animation: victoryBounce 0.6s var(--ease) both;
}

/* ── Hover glow for interactive icons ── */
.sc-icon:hover,
.sh-icon:hover,
.team-avatar:hover {
  box-shadow: 0 0 20px color-mix(in srgb, var(--accent) 25%, transparent);
  transform: scale(1.05);
  transition: all 200ms ease;
}

/* ── Combo fire glow ── */
.combo-pill.fire {
  text-shadow: 0 0 10px var(--gold), 0 0 20px color-mix(in srgb, var(--bad) 50%, transparent), 0 0 30px color-mix(in srgb, var(--gold) 30%, transparent);
  animation: comboPop 0.3s ease, fireGlow 0.8s ease-in-out infinite alternate;
}

@keyframes fireGlow {
  0%   { text-shadow: 0 0 10px var(--gold), 0 0 20px color-mix(in srgb, var(--bad) 50%, transparent); }
  100% { text-shadow: 0 0 16px var(--gold), 0 0 32px color-mix(in srgb, var(--bad) 60%, transparent), 0 0 48px color-mix(in srgb, var(--gold) 40%, transparent); }
}

/* ── Level up flash effect ── */
@keyframes levelUpFlash {
  0%   { opacity: 0; transform: scale(0.8); }
  30%  { opacity: 1; transform: scale(1.1); }
  100% { opacity: 0; transform: scale(1.5); }
}

.level-up-flash {
  position: absolute;
  inset: -4px;
  border-radius: inherit;
  border: 2px solid var(--hl);
  opacity: 0;
  animation: levelUpFlash 1s var(--ease) both;
  pointer-events: none;
}

/* ── Premium tooltip (for future use) ── */
[data-tooltip] {
  position: relative;
}

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  padding: 6px 10px;
  font-size: 12px;
  color: var(--text-dim);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 200ms ease, transform 200ms ease;
  z-index: 60;
  box-shadow: var(--shadow-sm);
}

[data-tooltip]:hover::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── Nav indicator (JS-positioned) ── */
.nav-indicator {
  position: absolute;
  bottom: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 60%, var(--blue)));
  border-radius: 1px;
  transition: left 300ms var(--ease), width 300ms var(--ease), opacity 300ms;
  box-shadow: 0 0 8px color-mix(in srgb, var(--accent) 50%, transparent);
  opacity: 0;
  pointer-events: none;
}

/* ── Scroll reveal ── */
.revealed {
  opacity: 1 !important;
  transform: translateY(0) !important;
}

/* ── Staggered card entrance ── */
.subject-card:nth-child(1) { animation-delay: 0ms; }
.subject-card:nth-child(2) { animation-delay: 60ms; }
.subject-card:nth-child(3) { animation-delay: 120ms; }
.subject-card:nth-child(4) { animation-delay: 180ms; }
.subject-card:nth-child(5) { animation-delay: 240ms; }
.subject-card:nth-child(6) { animation-delay: 300ms; }
.subject-card:nth-child(7) { animation-delay: 360ms; }
.subject-card:nth-child(8) { animation-delay: 420ms; }
.subject-card:nth-child(9) { animation-delay: 480ms; }
.subject-card:nth-child(10) { animation-delay: 540ms; }

/* ================================================================
   NEW — Page load fade-in (blur-to-clear over 0.6s)
   ================================================================ */
body.page-fade {
  opacity: 0;
  filter: blur(6px);
  transition: opacity 0.6s ease, filter 0.6s ease;
}
body.page-fade.ready {
  opacity: 1;
  filter: blur(0px);
}
/* Auth pages: skip the blur so the lighter background doesn't get washed out */
body.auth-mode.page-fade {
  filter: none !important;
}

/* ================================================================
   NEW — Sidebar frosted on scroll (scrolled class added by JS)
   ================================================================ */
.sidenav.scrolled {
  background: linear-gradient(180deg, rgba(14, 14, 22, 0.85), rgba(10, 10, 18, 0.82));
  backdrop-filter: blur(32px) saturate(1.8);
  -webkit-backdrop-filter: blur(32px) saturate(1.8);
  border-color: rgba(99, 102, 241, 0.15);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.06) inset,
    1px 0 0 rgba(99, 102, 241, 0.08) inset,
    0 24px 64px rgba(0, 0, 0, 0.55),
    0 0 48px rgba(99, 102, 241, 0.08);
}

/* ================================================================
   NEW — Hero parallax background
   ================================================================ */
.hero-parallax {
  position: absolute;
  inset: -60px -20px;
  background:
    radial-gradient(60vw 50vh at 30% 40%, rgba(99, 102, 241, 0.18), transparent 60%),
    radial-gradient(48vw 44vh at 70% 60%, rgba(139, 92, 246, 0.14), transparent 60%),
    radial-gradient(40vw 36vh at 50% 80%, rgba(59, 130, 246, 0.12), transparent 60%);
  pointer-events: none;
  z-index: -1;
  will-change: transform;
}

/* fallback — restore native cursor when reduced-motion is on (no custom cursor) */
@media (prefers-reduced-motion: reduce) {
  body { cursor: auto !important; }
}
/* also restore for touch devices */
@media (pointer: coarse) {
  body { cursor: auto !important; }
  .custom-cursor { display: none !important; }
}

/* ================================================================
   Custom cursor — dot + ring (replaces native cursor)
   ================================================================ */
.custom-cursor {
  position: fixed;
  top: 0; left: 0;
  pointer-events: none;
  z-index: 99999;
  will-change: transform;
}
.cursor-dot {
  position: fixed;
  top: 0; left: 0;
  width: 6px; height: 6px;
  margin: -3px 0 0 -3px;
  background: #fff;
  border-radius: 50%;
  pointer-events: none;
  will-change: transform;
  z-index: 99999;
  transition: transform 0.05s linear;
}
.cursor-ring {
  position: fixed;
  top: 0; left: 0;
  width: 32px; height: 32px;
  margin: -16px 0 0 -16px;
  border: 1.5px solid rgba(255, 255, 255, 0.5);
  border-radius: 50%;
  pointer-events: none;
  will-change: transform;
  z-index: 99999;
  transition: width 0.2s ease, height 0.2s ease, margin 0.2s ease, border-color 0.2s ease;
}
.cursor-ring.hover {
  width: 48px; height: 48px;
  margin: -24px 0 0 -24px;
  border-color: rgba(255, 255, 255, 0.8);
}

/* ================================================================
   Mouse trail — smooth canvas curve drawn by mousefx.js
   ================================================================ */
.trail-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 9998;
}
/* old DOM-based dots, kept inert in case of leftover spawns */
.trail-dot { display: none !important; }

/* ================================================================
   NEW — Click water ripple (single ring, 120px, thin border)
   ================================================================ */
.click-ripple {
  position: fixed;
  width: 0px;
  height: 0px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 9997;
  border: 2px solid rgba(139, 92, 246, 0.6);
  opacity: 0.6;
  transform: translate(-50%, -50%);
  animation: rippleExpand 700ms ease-out forwards;
}

@keyframes rippleExpand {
  0%   { width: 0px;   height: 0px;   opacity: 0.6; border-color: rgba(99, 102, 241, 0.6); }
  100% { width: 120px; height: 120px; opacity: 0;   border-color: rgba(139, 92, 246, 0); }
}

/* ================================================================
   AUDIO DOCK — single glassmorphism panel holding lofi player,
   focus tone, and mute button. Bottom-center, avoids overlap.
   ================================================================ */
.audio-dock {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9900;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: rgba(16, 16, 28, 0.8);
  backdrop-filter: blur(24px) saturate(1.5);
  -webkit-backdrop-filter: blur(24px) saturate(1.5);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
  user-select: none;
  transition: box-shadow 0.3s ease, border-color 0.3s ease;
}
.audio-dock:hover {
  border-color: rgba(99, 102, 241, 0.15);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), 0 0 16px rgba(99, 102, 241, 0.08);
}

/* dock separator line */
.audio-dock .dock-sep {
  width: 1px;
  height: 28px;
  background: rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

/* ── Lo-fi player (inside dock, no longer fixed) ── */
.lofi-player {
  position: static; /* override fixed */
  z-index: auto;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 14px;
  cursor: pointer;
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}
.lofi-player:hover {
  transform: scale(1.03);
  border-color: rgba(139, 92, 246, 0.2);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3), 0 0 12px rgba(139, 92, 246, 0.1);
}

/* glowing ring when playing */
.lofi-player.active {
  border-color: rgba(139, 92, 246, 0.3);
  box-shadow:
    0 4px 16px rgba(0, 0, 0, 0.3),
    0 0 16px rgba(99, 102, 241, 0.15),
    0 0 32px rgba(139, 92, 246, 0.08);
  animation: lofiGlow 2s ease-in-out infinite alternate;
}
@keyframes lofiGlow {
  0%   { box-shadow: 0 4px 16px rgba(0,0,0,0.3), 0 0 16px rgba(99,102,241,0.12), 0 0 32px rgba(139,92,246,0.06); }
  100% { box-shadow: 0 4px 16px rgba(0,0,0,0.3), 0 0 20px rgba(99,102,241,0.2),  0 0 40px rgba(139,92,246,0.12); }
}

/* vinyl record SVG */
.lofi-vinyl {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}
.lofi-vinyl.spinning {
  animation: vinylSpin 2s linear infinite;
}
@keyframes vinylSpin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

.lofi-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.lofi-label {
  font-size: 12px;
  font-weight: 600;
  color: #eef0f6;
  letter-spacing: -0.01em;
}
.lofi-sub {
  font-size: 10px;
  color: #8b8fa4;
}

/* ── 880Hz Focus Tone (inside dock, no longer fixed) ── */
.tone-toggle {
  position: static; /* override fixed */
  z-index: auto;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 999px;
  cursor: pointer;
  user-select: none;
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 500;
  color: #8b8fa4;
  transition: all 0.3s ease;
}
.tone-toggle:hover {
  color: #eef0f6;
  border-color: rgba(99, 102, 241, 0.2);
  transform: scale(1.03);
}
.tone-toggle.on {
  color: #eef0f6;
  border-color: rgba(99, 102, 241, 0.4);
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.15);
  background: rgba(99, 102, 241, 0.1);
}
.tone-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #4e5268;
  transition: background 0.3s ease, box-shadow 0.3s ease;
}
.tone-toggle.on .tone-dot {
  background: #6366f1;
  box-shadow: 0 0 8px rgba(99, 102, 241, 0.5);
}

/* ── Mute toggle (inside dock, no longer fixed) ── */
.mute-toggle {
  position: static !important; /* override inline JS styles */
  z-index: auto;
  width: 32px !important;
  height: 32px !important;
  flex-shrink: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: #8b8fa4;
  font-size: 15px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 200ms ease;
}
.mute-toggle:hover {
  border-color: rgba(255, 255, 255, 0.15) !important;
  transform: scale(1.05);
}

/* ================================================================
   NEW — Scroll-reveal (IntersectionObserver, staggered children)
   ================================================================ */
.scroll-reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1), transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}
.scroll-reveal.visible {
  opacity: 1;
  transform: translateY(0);
}
/* staggered delay via data-delay attribute (set by JS) */

/* ================================================================
   NEW — Hover lift for cards (kept subtle; no scaling)
   ================================================================ */
.subject-card:hover,
.topic-card:hover,
.team-card:hover,
.card-glass:hover {
  transform: translateY(-2px);
}

/* ================================================================
   NEW — Remove old mfx classes (replaced by trail-dot + click-ripple)
   ================================================================ */
.mfx-layer,
.mfx-spotlight,
.mfx-ripple { display: none !important; }

/* ── Reduced motion preference ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  body::before {
    animation: none;
  }

  .subject-card, .topic-card {
    transition: border-color 0.01ms, background-color 0.01ms;
  }

  /* scroll-reveal JS is skipped under reduced motion, so force
     these elements visible immediately (no fade) */
  .scroll-reveal,
  .scroll-reveal.visible {
    opacity: 1 !important;
    transform: none !important;
  }
}

/* ================================================================
   SUBJECT MAP  (js/hub.js)  — reliable, dependency-free replacement
   for the old 3D car hub. Radial SVG map on desktop, list on mobile.
   ================================================================ */
.map-wrap { position: relative; z-index: 1; }

.map-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}
.map-title {
  font-family: var(--font-display);
  font-size: clamp(24px, 4vw, 36px);
  letter-spacing: -0.02em;
  font-weight: 700;
  margin: 4px 0 0;
}

/* segmented Map / List control */
.seg-group {
  display: inline-flex;
  padding: 4px;
  gap: 4px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
}
.seg {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--text-dim);
  font: 600 13px/1 var(--font-body);
  padding: 8px 18px;
  border-radius: 999px;
  cursor: pointer;
  transition: color var(--duration) var(--ease), background var(--duration) var(--ease);
}
.seg:hover { color: var(--text); }
.seg.active {
  color: #fff;
  background: var(--accent);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* ---- radial canvas ---- */
.map-stage { position: relative; }
.map-canvas {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  max-height: 74vh;
  min-height: 440px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    radial-gradient(120% 90% at 50% 50%, rgba(123,97,255,0.06), transparent 60%),
    linear-gradient(180deg, rgba(20,20,30,0.55), rgba(10,10,16,0.55));
  overflow: hidden;
  isolation: isolate;
}
/* faint grid texture for depth */
.map-canvas::before {
  content: '';
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.025) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(120% 100% at 50% 50%, #000 40%, transparent 80%);
  -webkit-mask-image: radial-gradient(120% 100% at 50% 50%, #000 40%, transparent 80%);
  pointer-events: none;
}

.map-lines {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  transform: translate(var(--px, 0px), var(--py, 0px));
  transition: transform 300ms var(--ease);
  pointer-events: none;
}
.map-line {
  stroke: var(--c, var(--accent));
  stroke-width: 0.4;
  stroke-linecap: round;
  opacity: 0.28;
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
  animation: mapDraw 700ms var(--ease) forwards;
  animation-delay: calc(var(--i, 0) * 55ms + 120ms);
}
@keyframes mapDraw { to { stroke-dashoffset: 0; } }

/* central hub */
.map-hub {
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%) translate(var(--px, 0px), var(--py, 0px));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
  pointer-events: none;
  z-index: 2;
  transition: transform 300ms var(--ease);
}
.map-hub-mark {
  width: 54px; height: 54px;
  display: grid; place-items: center;
  font-size: 22px;
  color: var(--accent);
  border-radius: 50%;
  background: radial-gradient(circle at 50% 40%, color-mix(in srgb, var(--accent) 35%, transparent), rgba(12,12,20,0.9));
  border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
  box-shadow: 0 0 30px color-mix(in srgb, var(--accent) 30%, transparent);
  animation: hubPulse 3.5s ease-in-out infinite;
}
@keyframes hubPulse {
  0%,100% { box-shadow: 0 0 26px color-mix(in srgb, var(--accent) 24%, transparent); }
  50%     { box-shadow: 0 0 40px color-mix(in srgb, var(--accent) 40%, transparent); }
}
.map-hub-label {
  font: 600 11px/1 var(--font-body);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
}

/* ---- a subject node ---- */
.map-node {
  position: absolute;
  transform: translate(-50%, -50%) translate(var(--px, 0px), var(--py, 0px));
  transition: transform 300ms var(--ease);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 132px;
  padding: 0;
  background: transparent;
  border: 0;
  cursor: pointer;
  z-index: 3;
  color: inherit;
  animation: mapPop 520ms var(--ease) both;
  animation-delay: calc(var(--i, 0) * 55ms + 200ms);
}
@keyframes mapPop {
  from { opacity: 0; transform: translate(-50%, -46%) scale(0.9); }
  to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}
.map-node:hover, .map-node:focus-visible {
  outline: none;
  transform: translate(-50%, -50%) translate(var(--px, 0px), var(--py, 0px)) scale(1.06);
}
.map-node:focus-visible .map-ring { box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 60%, transparent); }

/* conic mastery ring */
.map-ring {
  --track: rgba(255,255,255,0.09);
  width: 72px; height: 72px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: conic-gradient(var(--c) calc(var(--pct, 0) * 1%), var(--track) 0);
  transition: box-shadow var(--duration) var(--ease), filter var(--duration) var(--ease);
  filter: drop-shadow(0 6px 14px rgba(0,0,0,0.45));
}
.map-ring.sm { width: 52px; height: 52px; }
.map-node:hover .map-ring { box-shadow: 0 0 22px color-mix(in srgb, var(--c) 45%, transparent); }
.map-ring-disc {
  width: calc(100% - 8px); height: calc(100% - 8px);
  border-radius: 50%;
  display: grid; place-items: center;
  background: linear-gradient(160deg, #14141e, #0c0c14);
  border: 1px solid var(--line);
}
.map-ico { width: 26px; height: 26px; color: var(--c); display: grid; place-items: center; }
.map-ico svg { width: 26px; height: 26px; }
.map-ring.sm .map-ico, .map-ring.sm .map-ico svg { width: 20px; height: 20px; }

.map-node.is-mastered .map-ring { animation: mapMastered 2.6s ease-in-out infinite; }
@keyframes mapMastered {
  0%,100% { box-shadow: 0 0 14px color-mix(in srgb, var(--c) 35%, transparent); }
  50%     { box-shadow: 0 0 28px color-mix(in srgb, var(--c) 60%, transparent); }
}

.map-node-meta { text-align: center; }
.map-node-name {
  font: 600 13.5px/1.2 var(--font-body);
  color: var(--text);
  letter-spacing: -0.01em;
}
.map-node-sub {
  margin-top: 2px;
  font-size: 11.5px;
  color: var(--text-dim);
  display: inline-flex; align-items: center; gap: 5px;
}
.map-tier { color: var(--c); font-weight: 600; }
.map-dot-sep { opacity: 0.5; }

/* ---- list view ---- */
.map-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 12px;
}
.map-list-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  text-align: left;
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 3px solid var(--c);
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: inherit;
  transition: transform var(--duration) var(--ease), border-color var(--duration) var(--ease), background var(--duration) var(--ease);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.map-list-card:hover, .map-list-card:focus-visible {
  outline: none;
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--c) 45%, var(--line));
  background: var(--panel-2);
}
.map-list-body { flex: 1; min-width: 0; }
.map-list-name { font: 600 15px/1.2 var(--font-body); }
.map-list-sub { font-size: 12px; color: var(--text-dim); margin: 2px 0 8px; }
.map-list-bar { height: 6px; border-radius: 999px; background: rgba(255,255,255,0.08); overflow: hidden; }
.map-list-bar i { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--c); transition: width 600ms var(--ease); }
.map-list-pct { text-align: right; flex-shrink: 0; }
.map-list-pct b { font: 700 17px/1 var(--font-display); color: var(--c); }
.map-list-pct span { display: block; font-size: 10.5px; color: var(--text-dim); margin-top: 2px; }

@media (max-width: 620px) {
  .map-list { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .map-line { animation: none; stroke-dashoffset: 0; }
  .map-node { animation: none; }
  .map-hub-mark, .map-node.is-mastered .map-ring { animation: none; }
  .map-lines, .map-hub, .map-node { transition: none; }
}

.map-node-lvl { font-size: 10.5px; color: var(--text-mute); margin-top: 1px; }

/* keep the floating audio dock clear of footer text on short content pages */
.footer { padding-bottom: 92px; }

/* ================================================================
   AVATARS — colored-initial circles (replace emoji avatars).
   Colors are set inline by U.avatar() from a name hash.
   ================================================================ */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid transparent;
  font-weight: 700;
  font-size: 15px;
  font-family: var(--font-display);
  flex-shrink: 0;
  user-select: none;
}

/* ================================================================
   EMPTY STATES — icon + text (replaces big emoji glyphs)
   ================================================================ */
.empty-ico {
  width: 40px;
  height: 40px;
  color: var(--text-mute);
  opacity: 0.7;
  margin-bottom: 10px;
}
.empty-ico svg { width: 100%; height: 100%; }

/* ================================================================
   MESSAGING — compose button, unread badges
   ================================================================ */
.msg-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.msg-new-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: var(--radius-xs);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--duration) ease;
}
.msg-new-btn:hover { background: color-mix(in srgb, var(--accent) 20%, transparent); }
.msg-new-btn .icon { width: 13px; height: 13px; }

/* compose row that expands under the inbox header */
.msg-new-row {
  display: flex;
  gap: 6px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}
.msg-new-row .input { flex: 1; min-width: 0; padding: 8px 10px; font-size: 13px; }

/* unread conversation rows */
.msg-convo.unread .msg-convo-name { color: var(--text); }
.msg-convo.unread .msg-convo-preview { color: var(--text); font-weight: 600; }
.msg-unread-count {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  align-self: center;
}

/* sidebar unread count on the Messages link */
.nav-count {
  position: absolute;
  top: 50%;
  right: 10px;
  transform: translateY(-50%);
  min-width: 17px;
  height: 17px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
body.sb-collapsed .nav-count { right: 4px; top: 4px; transform: none; }

/* icon-only square button (photo attach etc.) */
.icon-btn svg { width: 16px; height: 16px; }

/* floating "Check Latest Message" pill — appears when scrolled up in a thread */
.msg-thread-col { position: relative; }
.msg-jump-latest {
  position: absolute;
  left: 50%;
  bottom: 76px;
  transform: translateX(-50%) translateY(6px);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 12.5px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms var(--ease), transform 180ms var(--ease);
  z-index: 5;
}
.msg-jump-latest.show {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}
.msg-jump-latest .icon { width: 13px; height: 13px; }

/* ================================================================
   MOBILE POLISH
   ================================================================ */
/* drawer open: clear the fixed burger button so it doesn't sit on the logo */
@media (max-width: 820px) {
  body.sb-open .sb-head { padding-left: 52px; }
}

@media (max-width: 560px) {
  .credit { display: none; }

  /* audio dock: compact so it never crowds the viewport */
  .audio-dock {
    bottom: 10px;
    padding: 6px 8px;
    gap: 6px;
    max-width: calc(100vw - 16px);
  }
  .audio-dock .lofi-sub { display: none; }
  .lofi-player { padding: 6px 10px; gap: 8px; }
  .tone-toggle { padding: 6px 10px; font-size: 10px; }

  .app { padding: 18px 14px 28px; }

  /* tabs scroll horizontally instead of wrapping into a tall block */
  .tabs {
    width: 100%;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { white-space: nowrap; flex-shrink: 0; }

  .subject-head { gap: 12px; }
  .subject-head .sh-icon { width: 48px; height: 48px; }
}

/* touch devices */
@media (pointer: coarse) {
  /* 16px inputs stop iOS Safari zoom-on-focus */
  .input, select, textarea { font-size: 16px; }
  /* pointer flair is mouse-only */
  .trail-canvas, .mouse-glow, .custom-cursor, .cursor-dot, .cursor-ring { display: none !important; }
  /* comfortable touch targets */
  .btn { min-height: 44px; }
  .btn.sm { min-height: 38px; }
  .tab { padding: 9px 16px; }
  .msg-photo-btn { width: 42px; height: 42px; }
}

/* dynamic viewport units: keep the message thread usable when the
   on-screen keyboard shrinks the viewport */
@supports (height: 1dvh) {
  .msg-shell { height: clamp(420px, 70dvh, 860px); }
}

/* ── Info page banner ── */
.info-banner {
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--line);
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}
.info-banner img { display: block; width: 100%; height: auto; }


/* ── Interactive tutorial ── */
.tut-overlay { position: fixed; inset: 0; z-index: 10500; }
.tut-spot { position: absolute; border-radius: 12px; box-shadow: 0 0 0 9999px rgba(0,0,0,0.75); border: 2px solid var(--accent); transition: all 300ms var(--ease); pointer-events: none; }
.tut-tip { position: absolute; max-width: 320px; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 16px; box-shadow: var(--shadow); transition: all 300ms var(--ease); }
.tut-tip h4 { margin: 0 0 6px; font-size: 15px; }
.tut-tip p { margin: 0 0 12px; font-size: 13.5px; color: var(--text-dim); line-height: 1.5; }
.tut-row { display: flex; gap: 8px; justify-content: space-between; align-items: center; }
.tut-step { font-size: 11px; color: var(--text-mute); }
@media (max-width: 560px) { .tut-tip { max-width: calc(100vw - 32px); } }

/* ── Announcement bar ── */
.announce-bar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 10600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 9px 44px 9px 16px;
  background: var(--accent);
  color: #fff;
  font-size: 13.5px;
  font-weight: 600;
  text-align: center;
}
.announce-x {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 28px; height: 28px;
  border-radius: 6px;
  color: #fff;
  font-size: 18px;
  line-height: 1;
  background: rgba(0,0,0,0.15);
}
body.has-announce .sidenav { top: 38px; }
body.has-announce .app { padding-top: 46px; }

/* Custom cursor retired — the trailing ring read as a glitch */
.custom-cursor, .cursor-dot, .cursor-ring { display: none !important; }
body.has-custom-cursor { cursor: auto; }

/* ── presence dots ── */
.p-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex-shrink: 0; background: var(--text-mute); }
.p-online { background: var(--good); }
.p-away { background: var(--warn); }
.p-dnd { background: var(--bad); }
.p-offline { background: var(--text-mute); opacity: 0.6; }

/* avatars must never stretch (the global .row > * { flex:1 } rule was
   turning them into ovals) — always fixed-size perfect circles */
.avatar, .profile-avatar, .msg-convo-avatar, .team-avatar {
  flex: 0 0 auto !important;
  aspect-ratio: 1;
}

/* uploaded profile pictures */
.avatar-img { object-fit: cover; border-radius: 50%; border: 1px solid var(--line); }

/* profile picture crop modal */
.crop-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.75); display: flex; align-items: center; justify-content: center; z-index: 10700; }
.crop-box { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; max-width: 340px; width: calc(100vw - 32px); text-align: center; }
.crop-box canvas { border-radius: var(--radius-sm); cursor: grab; touch-action: none; max-width: 100%; }
.crop-box canvas:active { cursor: grabbing; }

/* ── Global search overlay ── */
.gs-kbd {
  margin-left: auto;
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text-mute);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1px 5px;
  flex-shrink: 0;
}
body.sb-collapsed .gs-kbd { display: none; }
.gs-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  z-index: 10800;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 12vh;
}
.gs-box {
  width: 100%; max-width: 560px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  max-height: 70vh;
  display: flex;
  flex-direction: column;
}
.gs-input-row {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  color: var(--text-mute);
  flex-shrink: 0;
}
.gs-input {
  flex: 1; border: none; background: none; outline: none;
  color: var(--text); font-size: 15px; font-family: inherit;
}
.gs-body { overflow-y: auto; padding: 8px 0; }
.gs-group-label {
  padding: 8px 16px 4px;
  font-size: 10px; font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--text-mute);
}
.gs-row {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 16px; cursor: pointer;
  color: var(--text-dim);
}
.gs-row:hover, .gs-row:focus-visible { background: rgba(255,255,255,0.05); color: var(--text); outline: none; }
.gs-row-ico { flex-shrink: 0; color: var(--accent); display: flex; }
.gs-row-main { min-width: 0; }
.gs-row-title { font-size: 14px; font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gs-row-sub { font-size: 12px; color: var(--text-mute); }
.gs-empty { padding: 24px 16px; text-align: center; color: var(--text-mute); font-size: 13px; }

/* ── notifications bell + panel ── */
.notif-bell {
  position: relative;
  width: 34px; height: 34px;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-dim);
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}
.notif-bell:hover { color: var(--text); }
.notif-badge {
  position: absolute; top: -3px; right: -3px;
  min-width: 15px; height: 15px; padding: 0 3px;
  border-radius: 999px;
  background: var(--bad); color: #fff;
  font-size: 9.5px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.notif-panel {
  position: fixed;
  width: 300px; max-height: 380px;
  overflow-y: auto;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  z-index: 10600;
}
.notif-head { padding: 12px 14px; font-weight: 700; font-size: 13px; border-bottom: 1px solid var(--line); }
.notif-row { padding: 10px 14px; border-bottom: 1px solid var(--line-soft); cursor: pointer; }
.notif-row:hover { background: rgba(255,255,255,0.03); }
.notif-row.unread { background: color-mix(in srgb, var(--accent) 6%, transparent); }
.notif-row.unread::before { content: ''; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); margin-right: 6px; }
.notif-text { font-size: 13px; line-height: 1.4; }
.notif-time { font-size: 11px; color: var(--text-mute); margin-top: 3px; }

/* ── best friend pact ── */
.pact-banner {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--gold) 8%, var(--panel-2));
  border: 1px solid color-mix(in srgb, var(--gold) 25%, var(--line));
  font-size: 13px;
  margin-top: 10px;
}

/* ── Loading splash screen ── */
.loading-screen {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  background: var(--bg);
  transition: opacity 0.45s ease;
}
.loading-screen.hide { opacity: 0; pointer-events: none; }
.loading-mark {
  width: 64px; height: 64px;
  display: flex; align-items: center; justify-content: center;
  animation: loadingPulse 1.8s ease-in-out infinite;
}
.loading-mark img { width: 100%; height: 100%; object-fit: contain; }
@keyframes loadingPulse {
  0%, 100% { transform: scale(1); opacity: 0.9; }
  50%      { transform: scale(1.06); opacity: 1; }
}
.loading-spinner {
  width: 26px; height: 26px;
  border-radius: 50%;
  border: 2.5px solid var(--line);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}
.loading-text {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-mute);
}
@media (prefers-reduced-motion: reduce) {
  .loading-mark { animation: none; }
  .loading-spinner { animation: spin 1.2s linear infinite; }
}

/* ── sidebar Settings link icon sizing (matches other nav icons) ── */
.sb-nav a[data-nav="settings"] .sb-ico svg { width: 18px; height: 18px; }
