/* ═══════════════════════════════════════════════════════════════════════
   LEOMEE WEB — design system
   ───────────────────────────────────────────────────────────────────────
   One layer, loaded after style.css. It replaces the three older skins
   (leomee-theme / social-redesign / focus) and follows the same commitments
   as the Android app (leomee-mobile/MOBILE-DESIGN.md):

     · Flat colour. No gradients, glow, glass or background blobs.
     · One small radius family: 12 for panels and cards, 8 for controls,
       6 for tags. Circles only for avatars and status dots.
     · Purple is identity (action fills, links, current item). Vermilion is
       the red pen: counts, "marked" states, errors. Never decoration.
     · Onest for text and UI, Bricolage Grotesque for headings.

   How it recolours old markup: style.css and every template read the legacy
   tokens (--bg-primary, --electric-blue, --gradient-primary …). They are
   re-pointed at the tokens below, so a template written years ago picks up
   the new palette without changes. New code should use the --lm-* tokens.
   ═══════════════════════════════════════════════════════════════════════ */

/* ── Tokens ────────────────────────────────────────────────────────────
   Light: cool paper, ink text.  Dark: deep ink, lifted surfaces.
   Selectors out-rank style.css's bare [data-theme="dark"]. */
:root,
html[data-theme="light"],
body[data-theme="light"] {
  --lm-canvas:   #F6F4FB;
  --lm-surface:  #FFFFFF;
  --lm-sunken:   #EFECF7;
  --lm-hover:    #F1EEF9;
  --lm-rule:     #DDD8EA;
  --lm-rule-strong: #C5BEDB;

  --lm-text:     #1A1033;
  --lm-text-2:   #4B4466;
  --lm-text-3:   #6F6889;

  --lm-ink:      #1E0B5E;   /* deep ink — text-only dark surfaces */
  --lm-action:   #6D28D9;   /* filled controls */
  --lm-action-h: #5B21B6;
  --lm-brand:    #6D28D9;   /* links, current item, focus */
  --lm-brand-soft: rgba(109, 40, 217, 0.09);
  --lm-on-action: #FFFFFF;

  --lm-pen:      #D93A1C;   /* the red pen: counts, marked, errors */
  --lm-pen-soft: rgba(217, 58, 28, 0.10);
  --lm-ok:       #15803D;
  --lm-ok-soft:  rgba(21, 128, 61, 0.10);
  --lm-marker:   #FFD23F;   /* highlighter — used once per page */

  --lm-r-card: 12px;
  --lm-r-ctl:  8px;
  --lm-r-tag:  6px;

  --lm-lift: 0 1px 0 rgba(26, 16, 51, 0.04);
  --lm-float: 0 12px 32px rgba(26, 16, 51, 0.16);
  --lm-ring: 0 0 0 3px rgba(109, 40, 217, 0.28);

  --lm-font: 'Onest', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --lm-font-display: 'Bricolage Grotesque', 'Onest', sans-serif;
}

html[data-theme="dark"],
body[data-theme="dark"] {
  --lm-canvas:   #0F0B1E;
  --lm-surface:  #17122B;
  --lm-sunken:   #120E24;
  --lm-hover:    #211A3D;
  --lm-rule:     #2F2752;
  --lm-rule-strong: #43386F;

  --lm-text:     #F1EEFA;
  --lm-text-2:   #C4BEDB;
  --lm-text-3:   #9A93B8;

  --lm-action:   #7C3AED;
  --lm-action-h: #8B5CF6;
  --lm-brand:    #B197FC;
  --lm-brand-soft: rgba(177, 151, 252, 0.14);

  --lm-pen:      #FF6B4A;
  --lm-pen-soft: rgba(255, 107, 74, 0.14);
  --lm-ok:       #4ADE80;
  --lm-ok-soft:  rgba(74, 222, 128, 0.12);

  --lm-lift: 0 1px 0 rgba(0, 0, 0, 0.25);
  --lm-float: 0 16px 40px rgba(0, 0, 0, 0.55);
  --lm-ring: 0 0 0 3px rgba(177, 151, 252, 0.38);
}

/* ── Legacy tokens → new palette ──────────────────────────────────────── */
:root,
html[data-theme="light"], body[data-theme="light"],
html[data-theme="dark"], body[data-theme="dark"] {
  --bg-main: var(--lm-canvas);
  --bg-primary: var(--lm-surface);
  --bg-secondary: var(--lm-sunken);
  --bg-card: var(--lm-surface);
  --bg-hover: var(--lm-hover);
  --text-primary: var(--lm-text);
  --text-secondary: var(--lm-text-2);
  --text-muted: var(--lm-text-3);
  --border-color: var(--lm-rule);
  --glass-border: var(--lm-rule);
  --glass-bg: var(--lm-surface);
  --glass-bg-premium: var(--lm-surface);
  --glass-bg-solid: var(--lm-surface);
  --glass-border-premium: var(--lm-rule);
  --glass-shadow: var(--lm-lift);

  --electric-blue: var(--lm-action);
  --electric-blue-rgb: 109, 40, 217;
  --electric-blue-light: var(--lm-brand-soft);
  --neon-purple: var(--lm-action);
  --neon-purple-rgb: 109, 40, 217;
  --neon-purple-light: var(--lm-brand-soft);
  --accent-purple: var(--lm-brand);
  --accent-pink: var(--lm-pen);
  --accent-red: var(--lm-pen);
  --accent-green: var(--lm-ok);
  --accent-cyan: var(--lm-brand);

  /* Flat "gradients": call sites keep working, nothing blends. */
  --gradient-primary: linear-gradient(var(--lm-action), var(--lm-action));
  --gradient-glow: linear-gradient(var(--lm-brand-soft), var(--lm-brand-soft));
  --gradient-soft: linear-gradient(var(--lm-brand-soft), var(--lm-brand-soft));
  --card-gradient: linear-gradient(var(--lm-surface), var(--lm-surface));
  --inner-shadow: none;

  --shadow-sm: var(--lm-lift);
  --shadow-md: 0 2px 10px rgba(26, 16, 51, 0.08);
  --shadow-lg: var(--lm-float);
  --shadow-glow: none;

  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 8px;
  --radius-xl: 12px;
}
html[data-theme="dark"], body[data-theme="dark"] {
  --electric-blue: #8B5CF6;
  --electric-blue-rgb: 139, 92, 246;
  --neon-purple: #8B5CF6;
  --shadow-md: 0 2px 12px rgba(0, 0, 0, 0.45);
}

/* ── Base ─────────────────────────────────────────────────────────────── */
html, body {
  background: var(--lm-canvas);
  color: var(--lm-text);
  font-family: var(--lm-font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
body { font-size: 15px; line-height: 1.55; transition: none; }
h1, h2, h3, .modal-title, .page-title, .section-title {
  font-family: var(--lm-font-display);
  color: var(--lm-text);
  letter-spacing: -0.015em;
  font-weight: 700;
}
a { color: inherit; }
::selection { background: var(--lm-brand-soft); color: var(--lm-text); }
.app-wrapper { min-height: 100dvh; position: relative; }

:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--lm-brand);
  outline-offset: 2px;
}
.skip-link {
  position: absolute; left: 12px; top: -48px; z-index: 2000;
  padding: 10px 14px; border-radius: var(--lm-r-ctl);
  background: var(--lm-action); color: #fff; font-weight: 600; text-decoration: none;
}
.skip-link:focus { top: 12px; }

/* ── Header ───────────────────────────────────────────────────────────── */
.main-header {
  position: sticky; top: 0; z-index: 1000;
  background: var(--lm-surface);
  backdrop-filter: none; -webkit-backdrop-filter: none;
  border-bottom: 1px solid var(--lm-rule);
  padding: 0;
  will-change: auto;
}
.main-header .header-content {
  max-width: 1600px; height: 60px; margin: 0 auto;
  padding: 0 16px; gap: 20px;
  display: flex; align-items: center; justify-content: space-between;
}
.main-header .logo {
  display: inline-flex; align-items: center; flex-shrink: 0;
  background: none; -webkit-text-fill-color: initial; text-decoration: none;
}
.main-header .logo-mark { height: 38px; width: auto; display: block; }
.main-header .logo-mark--dark { display: none; }
body[data-theme="dark"] .main-header .logo-mark--light { display: none; }
body[data-theme="dark"] .main-header .logo-mark--dark { display: block; }

.header-right-side { display: flex; align-items: center; gap: 4px; min-width: 0; }
.header-actions { gap: 2px !important; }

.header-search {
  position: relative; flex: 1; max-width: 420px;
  display: flex; align-items: center; gap: 8px;
  height: 40px; padding: 0 12px;
  background: var(--lm-sunken);
  border: 1px solid transparent;
  border-radius: var(--lm-r-ctl);
}
.header-search:focus-within {
  background: var(--lm-surface); border-color: var(--lm-brand); box-shadow: var(--lm-ring);
}
.header-search-icon { width: 18px; height: 18px; color: var(--lm-text-3); flex-shrink: 0; }
#globalSearchInput.header-search-input {
  flex: 1; min-width: 0; height: 100%; min-height: 0 !important;
  border: 0 !important; background: transparent !important; box-shadow: none !important;
  outline: none !important; padding: 0 !important; margin: 0;
  -webkit-appearance: none; appearance: none;
  font: inherit; font-size: 0.9rem; color: var(--lm-text);
}
#globalSearchInput::placeholder { color: var(--lm-text-3); }
#globalSearchInput::-webkit-search-decoration,
#globalSearchInput::-webkit-search-cancel-button { -webkit-appearance: none; }
.header-search-results {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 60;
  background: var(--lm-surface); border: 1px solid var(--lm-rule);
  border-radius: var(--lm-r-card); box-shadow: var(--lm-float);
  max-height: 380px; overflow: hidden auto; padding: 4px;
}
.header-search-results .suggestion-item { border-radius: var(--lm-r-ctl); }
.header-search-results .suggestion-item:hover { background: var(--lm-hover); }

.main-header .header-nav-btn {
  display: inline-flex; align-items: center; gap: 8px;
  height: 40px; padding: 0 12px;
  background: transparent; border: 0; border-radius: var(--lm-r-ctl);
  color: var(--lm-text-2) !important;
  font: inherit; font-size: 0.875rem; font-weight: 600;
  text-decoration: none; cursor: pointer; position: relative;
  transition: background .15s ease, color .15s ease;
}
.main-header .header-nav-btn:hover { background: var(--lm-hover); color: var(--lm-text) !important; transform: none; }
.main-header .header-nav-btn i, .main-header .header-nav-btn svg { width: 20px; height: 20px; color: currentColor !important; }
.header-icon-btn { width: 40px; padding: 0 !important; justify-content: center; }

.main-header .badge, .badge {
  background: var(--lm-pen); color: #fff;
  font-size: 11px; font-weight: 700; line-height: 1;
  min-width: 18px; height: 18px; padding: 0 5px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 6px;
}
.main-header .header-nav-btn .badge { position: absolute; top: 3px; left: 24px; margin: 0; }
.main-header .header-nav-btn { overflow: visible; }

.main-header .user-profile-menu .user-badge { background: none; border: 0; padding: 0; border-radius: 0; box-shadow: none; }
.main-header .user-profile-menu .header-nav-btn { padding: 0 6px 0 10px; }
.avatar-circle-sm {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--lm-brand-soft); color: var(--lm-brand);
  display: inline-grid; place-items: center; overflow: hidden;
  border: 1px solid var(--lm-rule);
}
.avatar-circle-sm img { width: 100%; height: 100%; object-fit: cover; }

/* The guest button is inline-styled in base.html; !important wins. */
#guestActions a.header-nav-btn {
  background: var(--lm-action) !important; color: var(--lm-on-action) !important;
  border-radius: var(--lm-r-ctl) !important; padding: 0 16px !important;
  height: 40px; font-weight: 600 !important; font-size: 0.875rem !important;
  box-shadow: none !important;
}
#guestActions a.header-nav-btn:hover { background: var(--lm-action-h) !important; }
#guestActions a.header-nav-btn i, #guestActions a.header-nav-btn svg { color: #fff !important; }

/* ── Layout frame ─────────────────────────────────────────────────────── */
.layout-container { gap: 16px; padding: 16px; }
.main-content { padding-bottom: 0; }

.left-container { width: 232px; }
.menu-options {
  position: sticky; top: 76px; height: auto;
  display: flex; flex-direction: column; gap: 2px;
  padding: 0; background: none; border: 0; overflow: visible;
}
.menu-options a, .menu-item {
  display: flex; align-items: center; gap: 12px;
  min-height: 44px; padding: 0 12px; margin: 0;
  border-radius: var(--lm-r-ctl); border-left: 0;
  color: var(--lm-text-2); font-weight: 600; font-size: 0.95rem;
  text-decoration: none; background: transparent; box-shadow: none;
  position: relative; overflow: visible;
  transition: background .15s ease, color .15s ease;
}
.menu-options a:hover, .menu-item:hover { background: var(--lm-hover); color: var(--lm-text); transform: none; }
.menu-options a.active, .menu-item.active {
  background: var(--lm-brand-soft); color: var(--lm-brand); font-weight: 700; box-shadow: none; border-left: 0;
}
.menu-options a.active::before { content: none; }
.menu-item i, .menu-item svg { width: 20px; height: 20px; }
.menu-item .badge { margin-left: auto; }
.menu-options a.menu-cta {
  margin-top: 12px; justify-content: center;
  background: var(--lm-action); color: var(--lm-on-action); font-weight: 700;
}
.menu-options a.menu-cta:hover { background: var(--lm-action-h); color: var(--lm-on-action); }

.right-container {
  position: sticky; top: 76px; width: 340px;
  height: auto; max-height: calc(100vh - 92px); overflow-y: auto;
  background: var(--lm-surface); border: 1px solid var(--lm-rule);
  border-radius: var(--lm-r-card); box-shadow: none; padding: 16px;
}
/* A lone card is its own panel — no box around a box. */
.right-container:has(> .side-card) { background: none; border: 0; padding: 0; overflow: visible; }
/* Chats list lives in a panel of its own. */
.right-container:has(> .left-panel) { background: none; border: 0; padding: 0; overflow: visible; }
/* Empty chat state: a mark, not an orbiting orb. */
.chat-empty__ring { display: none !important; }
.chat-empty__core { border-radius: 12px !important; box-shadow: none !important; background: var(--lm-action) !important; width: 56px !important; height: 56px !important; }
.chat-empty__orb { width: 56px !important; height: 56px !important; }
/* A page with nothing for this column shouldn't show an empty panel. */
.right-container:not(:has(*)) { display: none; }

/* ── Mobile bottom bar: Feed · + · Chats ─────────────────────────────── */
@media (max-width: 992px) {
  .main-header .header-content { padding: 0 12px; gap: 8px; }
  .main-header .logo-mark { height: 32px; }
  .header-search { display: none; }
  .main-header .header-nav-btn .label { display: none; }
  .main-header .header-nav-btn { padding: 0; width: 40px; justify-content: center; }
  .main-header .user-profile-menu .header-nav-btn { width: auto; padding: 0 2px; }
  #headerUsername { display: none; }
  .layout-container { padding: 0; gap: 0; }

  .mobile-bottom-nav {
    left: 0 !important; right: 0 !important; bottom: 0 !important; width: auto !important;
    margin: 0 !important;
    display: flex !important; align-items: center; justify-content: space-around;
    padding: 6px 12px calc(6px + env(safe-area-inset-bottom));
    background: var(--lm-surface) !important;
    border: 0 !important; border-top: 1px solid var(--lm-rule) !important; border-radius: 0 !important;
    backdrop-filter: none; -webkit-backdrop-filter: none; box-shadow: none !important;
    z-index: 999;
  }
  .mobile-bottom-nav a {
    flex-direction: column; gap: 2px; min-width: 72px; min-height: 48px; padding: 6px 10px;
    display: flex; align-items: center; justify-content: center; position: relative;
    color: var(--lm-text-3); background: none !important; border-radius: var(--lm-r-ctl);
    box-shadow: none !important; text-decoration: none !important;
  }
  .mobile-bottom-nav a.active { color: var(--lm-brand) !important; }
  .mobile-bottom-nav a i, .mobile-bottom-nav a svg { width: 22px; height: 22px; }
  .mbn-label { font-size: 0.72rem; font-weight: 700; }
  .mobile-bottom-nav a.mbn-create {
    min-width: 0; width: 52px; height: 52px; min-height: 0; padding: 0; margin-top: -18px;
    border-radius: var(--lm-r-card);
    background: var(--lm-action) !important; color: #fff !important;
    outline: 4px solid var(--lm-surface);
  }
  .mobile-bottom-nav a.mbn-create svg { width: 24px; height: 24px; }
  .mobile-bottom-nav .badge { position: absolute; top: 2px; right: 14px; }
  .main-content { padding-bottom: 76px; }
}
@media (max-width: 380px) {
  #guestActions a.header-nav-btn i, #guestActions a.header-nav-btn svg { display: none; }
}

/* ── Panels & cards ───────────────────────────────────────────────────── */
.card, .panel, .section-card, .glass-card, .post-card-modern, .post-card,
.connection-card, .category-card-compact, .profile-card, .side-card {
  background: var(--lm-surface);
  border: 1px solid var(--lm-rule);
  border-radius: var(--lm-r-card);
  box-shadow: none;
  backdrop-filter: none; -webkit-backdrop-filter: none;
  transition: border-color .15s ease;
}
.card:hover, .post-card-modern:hover, .post-card:hover, .category-card-compact:hover { transform: none; box-shadow: none; }
.connection-card:hover { border-color: var(--lm-rule-strong); transform: none; }
.connection-card.active { border-color: var(--lm-brand); background: var(--lm-brand-soft); }
.post-card-modern { padding: 20px; }
.post-card-avatar { border-radius: 50%; object-fit: cover; }
.post-card-author-name { font-weight: 700; color: var(--lm-text); }
.post-card-author-handle, .post-card-time { color: var(--lm-text-3); font-weight: 500; }
.post-category-tag {
  border-radius: var(--lm-r-tag); background: var(--lm-brand-soft); color: var(--lm-brand);
  font-weight: 700; font-size: 0.72rem; border: 0;
}
.post-image, .post-media img { border-radius: var(--lm-r-ctl); }
.post-action-btn, .post-card-actions button, .action-btn { border-radius: var(--lm-r-ctl); transition: background .15s ease, color .15s ease; }
.post-action-btn:hover, .action-btn:hover { background: var(--lm-hover); transform: none; }

.side-card { padding: 20px; }
.side-card__icon {
  display: inline-grid; place-items: center; width: 40px; height: 40px;
  border-radius: var(--lm-r-ctl); background: var(--lm-brand-soft); color: var(--lm-brand);
}
.side-card__icon svg { width: 20px; height: 20px; }
.side-card__title { margin: 12px 0 4px; font-size: 1.1rem; font-weight: 700; color: var(--lm-text); }
.side-card__text { margin: 0 0 16px; font-size: 0.9rem; line-height: 1.5; color: var(--lm-text-2); }
.side-card__btn {
  display: block; text-align: center; padding: 11px 16px;
  border-radius: var(--lm-r-ctl); background: var(--lm-action); color: #fff; font-weight: 700; text-decoration: none;
}
.side-card__btn:hover { background: var(--lm-action-h); }
.side-card__list { list-style: none; margin: 16px 0 0; padding: 14px 0 0; border-top: 1px solid var(--lm-rule); display: grid; gap: 10px; }
.side-card__list li { display: flex; align-items: center; gap: 10px; font-size: 0.9rem; color: var(--lm-text-2); }
.side-card__list svg { width: 16px; height: 16px; color: var(--lm-brand); }

/* ── Buttons ──────────────────────────────────────────────────────────── */
.common-btn-compact, .primary-auth-btn, .btn-primary, .lm-btn-primary, .feed-new-post, .dialog-btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 18px;
  background: var(--lm-action) !important; color: var(--lm-on-action) !important;
  border: 0 !important; border-radius: var(--lm-r-ctl) !important;
  font: inherit; font-weight: 700 !important; font-size: 0.9375rem;
  box-shadow: none !important; text-decoration: none; cursor: pointer;
  transition: background .15s ease;
}
.common-btn-compact:hover, .primary-auth-btn:hover, .btn-primary:hover, .lm-btn-primary:hover,
.feed-new-post:hover, .dialog-btn-primary:hover { background: var(--lm-action-h) !important; transform: none; filter: none; }
.feed-new-post { min-height: 40px; padding: 8px 16px; white-space: nowrap; }
.feed-new-post svg, .feed-new-post i { width: 16px; height: 16px; }
.common-btn-compact:disabled, .primary-auth-btn:disabled, .btn-primary:disabled { opacity: .5; cursor: not-allowed; }

.ghost-btn, .btn-secondary, .outline-btn, .dialog-btn-cancel {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 16px;
  background: var(--lm-surface); color: var(--lm-text);
  border: 1px solid var(--lm-rule-strong); border-radius: var(--lm-r-ctl) !important;
  font: inherit; font-weight: 600; font-size: 0.9375rem; cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
}
.ghost-btn:hover, .btn-secondary:hover, .outline-btn:hover, .dialog-btn-cancel:hover {
  background: var(--lm-hover); border-color: var(--lm-text-3); transform: none;
}

/* ── Forms ────────────────────────────────────────────────────────────── */
.elegant-input, input[type="text"], input[type="email"], input[type="password"], input[type="search"],
input[type="number"], input[type="tel"], input[type="url"], input[type="date"], textarea, select {
  min-height: 44px;
  background: var(--lm-surface); color: var(--lm-text);
  border: 1px solid var(--lm-rule-strong); border-radius: var(--lm-r-ctl);
  font-family: inherit; font-size: 0.9375rem;
  transition: border-color .15s ease, box-shadow .15s ease;
}
::placeholder { color: var(--lm-text-3); opacity: 1; }
.elegant-input:focus, input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--lm-brand); box-shadow: var(--lm-ring);
}
input[type="checkbox"], input[type="radio"] { accent-color: var(--lm-action); }
.input-label, .input-field-group label { font-weight: 600; font-size: 0.8125rem; color: var(--lm-text-2); }

/* ── Tabs (segmented, rectangular) ───────────────────────────────────── */
.tab-btn {
  border-radius: var(--lm-r-ctl); font-weight: 600; color: var(--lm-text-2);
  transition: background .15s ease, color .15s ease;
}
.tab-btn:hover { background: var(--lm-hover); color: var(--lm-text); }
.tab-btn.active {
  background: var(--lm-brand-soft); color: var(--lm-brand) !important;
  border-color: transparent !important; box-shadow: none !important; font-weight: 700;
}

/* ── Poll / quiz cards ───────────────────────────────────────────────── */
.poll-card { margin: 16px 0; padding: 18px; background: var(--lm-surface); border: 1px solid var(--lm-rule); border-radius: var(--lm-r-card); }
.poll-question { margin: 0 0 14px; font-size: 1.02rem; font-weight: 700; color: var(--lm-text); line-height: 1.4; }
.poll-options { display: flex; flex-direction: column; gap: 8px; }
.poll-option {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  padding: 11px 14px; background: var(--lm-surface); color: var(--lm-text);
  border: 1px solid var(--lm-rule-strong); border-radius: var(--lm-r-ctl);
  font-weight: 500; font-size: 0.95rem; cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}
.poll-option:hover { border-color: var(--lm-brand); background: var(--lm-hover); transform: none; box-shadow: none; }
.poll-option-text { flex: 1; }
.poll-option-arrow { width: 18px; height: 18px; opacity: .35; }
.poll-letter {
  flex-shrink: 0; width: 28px; height: 28px; border-radius: 50%;
  display: inline-grid; place-items: center; font-weight: 700; font-size: 0.8rem;
  background: var(--lm-surface); color: var(--lm-text-2); border: 1.5px solid var(--lm-rule-strong);
}
.poll-result { position: relative; overflow: hidden; border: 1px solid var(--lm-rule); border-radius: var(--lm-r-ctl); background: var(--lm-surface); }
.poll-result-fill { position: absolute; inset: 0 auto 0 0; width: var(--poll-pct, 0%); background: var(--lm-brand-soft); }
.poll-result.is-correct { border-color: var(--lm-ok); }
.poll-result.is-correct .poll-result-fill { background: var(--lm-ok-soft); }
.poll-result.is-correct .poll-letter { background: var(--lm-ok); color: #fff; border-color: var(--lm-ok); }
.poll-result.is-wrong { border-color: var(--lm-pen); }
.poll-result.is-wrong .poll-result-fill { background: var(--lm-pen-soft); }
.poll-result.is-wrong .poll-letter { background: var(--lm-pen); color: #fff; border-color: var(--lm-pen); }
.poll-result-row { position: relative; z-index: 1; display: flex; align-items: center; gap: 12px; padding: 11px 14px; }
.poll-result-text { flex: 1; font-weight: 600; color: var(--lm-text); }
.poll-correct-tag { margin-left: 8px; font-size: 0.68rem; font-weight: 700; color: var(--lm-ok); background: var(--lm-ok-soft); padding: 2px 7px; border-radius: var(--lm-r-tag); }
.poll-pct { font-weight: 700; color: var(--lm-text); font-variant-numeric: tabular-nums; }
.poll-meta { display: inline-block; margin-top: 14px; font-size: 0.78rem; font-weight: 600; color: var(--lm-text-3); }

/* ── Community / lists ───────────────────────────────────────────────── */
.card-avatar, .card-avatar-wrapper img { border-radius: 50%; object-fit: cover; }
.card-name { font-weight: 700; color: var(--lm-text); }
.card-subtext, .card-time { color: var(--lm-text-3); }
.community-action-input { border-radius: var(--lm-r-ctl); border: 1px solid var(--lm-rule-strong); background: var(--lm-surface); }
.suggestions-list { border-radius: var(--lm-r-card); border: 1px solid var(--lm-rule); box-shadow: var(--lm-float); background: var(--lm-surface); }
.requests-list > *, .list-row { border-radius: var(--lm-r-ctl); transition: background .15s ease; }
.requests-list > *:hover, .list-row:hover { background: var(--lm-hover); }
.leaderboard-row, .rank-row { border-radius: var(--lm-r-ctl); }
.leaderboard-row:hover, .rank-row:hover { transform: none; box-shadow: none; background: var(--lm-hover); }
.chip, .tag, .pill { border-radius: var(--lm-r-tag); font-weight: 600; font-size: 0.75rem; }
hr, .divider { border: 0; border-top: 1px solid var(--lm-rule); }
.no-requests, .empty-state { color: var(--lm-text-2); text-align: center; padding: 40px 16px; }
.empty-state { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.empty-state__title { margin: 0; font-size: 1.1rem; color: var(--lm-text); }
.empty-state__text { margin: 0 0 10px; max-width: 34ch; font-size: 0.92rem; line-height: 1.5; }

/* ── Composer (create post) ──────────────────────────────────────────── */
.publish-btn { border-radius: var(--lm-r-ctl) !important; background: var(--lm-action) !important; }
.mode-pill { border-radius: var(--lm-r-tag) !important; background: var(--lm-brand-soft) !important; color: var(--lm-brand) !important; }
.compose-text-wrap { border-radius: var(--lm-r-ctl) !important; }
.compose-text-wrap textarea, .compose-text-wrap textarea:focus { border: 0 !important; box-shadow: none !important; background: transparent; min-height: 0; }
.compose-text-wrap:focus-within { border-color: var(--lm-brand) !important; box-shadow: var(--lm-ring) !important; }

/* ── Modals & dialogs ────────────────────────────────────────────────── */
.modal-overlay { background: rgba(15, 11, 30, 0.6); backdrop-filter: none; -webkit-backdrop-filter: none; }
.modal-content, .dialog-box {
  background: var(--lm-surface); color: var(--lm-text);
  border: 1px solid var(--lm-rule); border-radius: var(--lm-r-card); box-shadow: var(--lm-float);
}
.modal-title { font-weight: 700; }
.close-modal { border-radius: var(--lm-r-ctl); transition: background .15s ease; }
.close-modal:hover { background: var(--lm-hover); transform: none; }
.dialog-title { font-family: var(--lm-font-display); font-weight: 700; color: var(--lm-text); }
.dialog-message { color: var(--lm-text-2); }
.dialog-actions { display: flex; gap: 8px; justify-content: flex-end; }
#callOverlay { backdrop-filter: none !important; background: rgba(15, 11, 30, 0.94) !important; }

/* ── Footer ───────────────────────────────────────────────────────────── */
.main-footer {
  margin-top: 40px; padding: 28px 0 24px;
  background: none; border-top: 1px solid var(--lm-rule);
}
.main-footer .footer-content { max-width: none; gap: 20px; flex-direction: column; }
.footer-top { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 20px 40px; }
.footer-brand { max-width: 280px; }
.footer-brand strong { font-family: var(--lm-font-display); font-size: 1.1rem; color: var(--lm-text); }
.footer-brand p { margin: 4px 0 0; font-size: 0.85rem; color: var(--lm-text-3); line-height: 1.5; }
.footer-links { display: flex; flex-wrap: wrap; gap: 4px 20px; list-style: none; margin: 0; padding: 0; }
.footer-links a { display: inline-block; padding: 6px 0; font-size: 0.875rem; font-weight: 600; color: var(--lm-text-2); text-decoration: none; }
.footer-links a:hover { color: var(--lm-brand); text-decoration: underline; text-underline-offset: 3px; }
.footer-legal { margin: 0; font-size: 0.8125rem; color: var(--lm-text-3); }

/* ── Long-form documents (legal, guidelines, contact) ────────────────── */
.lm-doc, .legal-content, .policy-content, .terms-content { color: var(--lm-text); }
.lm-doc { max-width: 72ch; }
.lm-doc p, .lm-doc li { line-height: 1.7; color: var(--lm-text-2); text-align: left; }
.lm-doc h1 { font-size: clamp(1.7rem, 3vw, 2.3rem); line-height: 1.15; margin: 0 0 8px; }
.lm-doc h2 { font-size: 1.25rem; margin: 36px 0 10px; padding-top: 20px; border-top: 1px solid var(--lm-rule); }
.lm-doc h3 { font-size: 1.02rem; margin: 22px 0 6px; color: var(--lm-text); }
.lm-doc a { color: var(--lm-brand); text-underline-offset: 3px; }
.lm-doc table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.lm-doc th, .lm-doc td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--lm-rule); vertical-align: top; }
.lm-doc th { font-size: 0.75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--lm-text-3); }

/* Legal pages: readable measure, ragged-right (justified text makes uneven gaps). */
.legal-page-container { max-width: 74ch; margin: 0 auto; padding: 24px 20px 8px; }
.legal-page-container h1 { font-size: clamp(1.8rem, 3.2vw, 2.4rem); line-height: 1.15; }
.legal-page-container .last-updated { font-style: normal; color: var(--lm-text-3); font-size: 0.9rem; }
.legal-page-container p, .legal-page-container li { text-align: left !important; line-height: 1.7; color: var(--lm-text-2); }
.legal-page-container h2 { font-size: 1.25rem; margin-top: 36px; }
.legal-page-container a { color: var(--lm-brand); text-underline-offset: 3px; }

/* ── Toast / banners ─────────────────────────────────────────────────── */
#uploadingBanner { background: var(--lm-ink) !important; }
.toast { border-radius: var(--lm-r-ctl); box-shadow: var(--lm-float); }
#cookie-notice {
  background: var(--lm-ink) !important; color: #EDE9FE !important;
  border-radius: var(--lm-r-card) !important; box-shadow: var(--lm-float) !important;
}
#cookie-notice a { color: #C4B5FD !important; }
#cookie-notice-ok { background: #fff !important; color: var(--lm-ink) !important; border-radius: var(--lm-r-ctl) !important; }

/* ── Auth pages (login / setup) — no app chrome around the form ──────── */
body.lm-auth .left-container, body.lm-auth .right-container, body.lm-auth .mobile-bottom-nav,
body.lm-auth .header-search, body.lm-auth #headerActions, body.lm-auth #guestActions a { display: none !important; }
body.lm-auth .layout-container { display: block; padding: 0; max-width: none; }
body.lm-auth .main-content { padding-bottom: 0; }

/* ── Motion ──────────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001s !important; animation-iteration-count: 1 !important; transition-duration: .001s !important; scroll-behavior: auto !important; }
}
