/* Medulla 2.1: visual polish, themes and accessibility.
   Loaded after styles.css and app.css. Sections:
     1. refined tokens          6. accessibility panel        11. home sections
     2. comfort settings        7. reading guide / read aloud  12. bot card
     3. dark theme              8. hard words                  13. team, partners
     4. high contrast           9. header                      14. footer
     5. focus / seizure-safe   10. hero                        15. pages, print
                                                              16. public site, app top bar, brain map, sign-in
   Colours stay inside the locked palette (navy, purple, lavender, white,
   orange) and their tints. */

/* ------------------------------------------------------ 1. refined tokens */

:root {
  --shadow-1: 0 1px 1px rgba(13, 17, 40, 0.03), 0 2px 6px -2px rgba(13, 17, 40, 0.06), 0 12px 28px -16px rgba(13, 17, 40, 0.14);
  --shadow-2: 0 2px 4px rgba(13, 17, 40, 0.04), 0 18px 40px -18px rgba(13, 17, 40, 0.22), 0 40px 80px -40px rgba(13, 17, 40, 0.18);
  --shadow-p: 0 1px 0 rgba(255, 255, 255, 0.25) inset, 0 10px 24px -10px rgba(108, 92, 231, 0.65);
  --ring: 0 0 0 1px rgba(108, 92, 231, 0.08);
  --glass: rgba(255, 255, 255, 0.72);
  --glass-line: rgba(255, 255, 255, 0.7);
  --accent-text: var(--purple);
  --hero-glow: rgba(162, 155, 254, 0.28);
  --ease-out: cubic-bezier(.2, .8, .2, 1);
}

::selection { background: rgba(162, 155, 254, 0.45); color: var(--ink); }
body { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility; }
h1, h2 { font-feature-settings: "ss01" 1; }
.stat-value, .metric, .result-stats strong { font-feature-settings: "tnum" 1; }

/* A very fine grain on soft sections gives the flat colours some depth. */
.section.is-soft, .page-hero, .chapter:nth-child(even) {
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.42 0 0 0 0 0.36 0 0 0 0 0.9 0 0 0 0.035 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.card, .char-card, .explainer, .activity-card, .quiz-q, .result-card { box-shadow: var(--shadow-1), var(--ring); }
.btn { letter-spacing: -0.005em; }
.btn-primary { background: linear-gradient(180deg, #7767EC, var(--purple)); }
.btn-primary:hover { background: linear-gradient(180deg, #6B5BE6, var(--purple-600)); }
.btn-ghost:hover { border-color: var(--purple); color: var(--purple); }
.chip { letter-spacing: 0.02em; }
.eyebrow { color: var(--accent-text); }

/* ----------------------------------------------- 2. comfort settings */

/* Text size steps (Accessibility & comfort → Text). Everything is in rem. */
html[data-text="1"] { font-size: 112.5%; }
html[data-text="2"] { font-size: 125%; }
html[data-text="3"] { font-size: 150%; }
html[data-text="3"] .header-inner { flex-wrap: wrap; }

/* Wider spacing (letter ≈ 0.05em, word ≈ 0.16em, line 1.8). Spacing helps
   readers with dyslexia; see RESEARCH.md §8 (Zorzi et al. 2012). */
html.a11y-spacing body { letter-spacing: 0.05em; word-spacing: 0.16em; line-height: 1.8; }
html.a11y-spacing p, html.a11y-spacing li { max-width: 68ch; }
html.a11y-spacing h1, html.a11y-spacing h2, html.a11y-spacing h3 { letter-spacing: 0; line-height: 1.3; }

/* Hyperlegible font (Braille Institute, SIL OFL), downloaded only when chosen. */
html.a11y-readable {
  --font-body: "Atkinson Hyperlegible", Verdana, system-ui, sans-serif;
  --font-head: "Atkinson Hyperlegible", Verdana, system-ui, sans-serif;
}
html.a11y-readable h1, html.a11y-readable h2 { letter-spacing: -0.01em; }

/* Dyslexia-friendly: no italics or justified text (BDA style guide). */
html.a11y-dyslexia em, html.a11y-dyslexia i { font-style: normal; font-weight: 700; }
html.a11y-dyslexia p, html.a11y-dyslexia li { text-align: left; }

/* Underline every link. */
html.a11y-links a:not(.btn):not(.brand):not(.float-card):not(.activity-card) { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; }

/* ------------------------------------------------------ 3. dark theme */

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0B0F24;
  --surface: #151A3A;
  --bg-soft: #10142E;
  --lav-100: #232A5C;
  --lav-200: #2D3470;
  --lav-300: #424A8E;
  --orange-100: #33261A;
  --orange-200: #5B3E1F;
  --ink: #F4F3FF;
  --ink-2: #D4D2EF;
  --ink-3: #ABA9CF;
  --line: #262C56;
  --line-2: #363D74;
  --purple-600: #B6ADFF;
  --accent-text: #ADA4FF;
  --glass: rgba(21, 26, 58, 0.72);
  --glass-line: rgba(162, 155, 254, 0.18);
  --hero-glow: rgba(108, 92, 231, 0.35);
  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.35), 0 12px 30px -16px rgba(0, 0, 0, 0.75);
  --shadow-2: 0 24px 60px -24px rgba(0, 0, 0, 0.85);
  --ring: 0 0 0 1px rgba(162, 155, 254, 0.06);
}
html[data-theme="dark"] body { background: var(--bg); }
html[data-theme="dark"] a:not(.btn):hover { color: #DCD8FF; }
html[data-theme="dark"] .btn-primary, html[data-theme="dark"] .btn-primary:hover { color: var(--white); }
html[data-theme="dark"] .accent { color: #ADA4FF; }
html[data-theme="dark"] .site-header { background: rgba(11, 15, 36, 0.8); }
html[data-theme="dark"] .btn-ghost { background: var(--surface); color: var(--ink); }
html[data-theme="dark"] .btn-ghost:hover { color: #DCD8FF; border-color: var(--lavender); }
html[data-theme="dark"] .light-social .btn-social { color: var(--ink); }
/* Inline character tints become deep tints. */
html[data-theme="dark"] [style*="--tint"] { --tint: #232A5C !important; }
html[data-theme="dark"] [style*="#FFF1E4"], html[data-theme="dark"] [style*="#FFF5EC"], html[data-theme="dark"] [style*="#FFF0E6"], html[data-theme="dark"] [style*="#FFF2E9"] { --tint: #2C2650 !important; }
html[data-theme="dark"] .tile.is-orange, html[data-theme="dark"] .toast.is-streak .toast-icon,
html[data-theme="dark"] .toast.is-level .toast-icon, html[data-theme="dark"] .save-mini.is-saved { color: #FFC08A; }
html[data-theme="dark"] .quiz-option.is-right { background: #12352A; }
html[data-theme="dark"] .kind-note { background: #2A2418; }
html[data-theme="dark"] .btn-danger { color: #FFC08A; }
html[data-theme="dark"] .status-ok { color: #6BE3A5; }
html[data-theme="dark"] .updates { background: linear-gradient(135deg, #2A2036, #1B1834); border-color: #3A2E44; }
html[data-theme="dark"] .float-card { background: var(--glass); }
html[data-theme="dark"] .hero-circle { background: radial-gradient(circle at 35% 30%, #20265A 0%, #171C42 55%, #10142E 100%); box-shadow: inset 0 0 0 1px rgba(162, 155, 254, 0.12); }
html[data-theme="dark"] .feature-art, html[data-theme="dark"] .modal-art, html[data-theme="dark"] .reader-cover { background: linear-gradient(160deg, #20265A, #10142E); }
html[data-theme="dark"] .review-badge { color: #FFC08A; }
html[data-theme="dark"] .sheet-thumb img, html[data-theme="dark"] .print-preview img { background: #fff; }
html[data-theme="dark"] .cta-art { background: rgba(255, 255, 255, 0.14); }
html[data-theme="dark"] ::selection { color: var(--white); }

/* --------------------------------------------------- 4. high contrast */

html.a11y-contrast {
  --ink-2: #0D1128;
  --ink-3: #2B2F45;
  --line: #9C97C9;
  --line-2: #6F69A8;
  --purple-600: #3F2FB8;
  --accent-text: #3F2FB8;
}
html.a11y-contrast[data-theme="dark"] {
  --ink: #FFFFFF;
  --ink-2: #F2F1FF;
  --ink-3: #E2E0FA;
  --line: #6870A8;
  --line-2: #8A91C8;
  --purple-600: #D3CEFF;
  --accent-text: #D3CEFF;
}
html.a11y-contrast a:not(.btn) { color: #3F2FB8; }
html.a11y-contrast[data-theme="dark"] a:not(.btn) { color: #D3CEFF; }
html.a11y-contrast .accent { color: #3F2FB8; }
html.a11y-contrast[data-theme="dark"] .accent { color: #D3CEFF; }
html.a11y-contrast :focus-visible { outline-width: 4px; outline-color: var(--orange); box-shadow: 0 0 0 7px var(--navy); }
html.a11y-contrast .card, html.a11y-contrast .char-card, html.a11y-contrast .explainer, html.a11y-contrast .switch { border-width: 2px; }

/* ------------------------------------------- 5. focus / seizure-safe */

/* Hide decorations: moving backgrounds, floating cards, big decorative art. */
html.a11y-nodecor .hero-canvas, html.a11y-nodecor .hero-art, html.a11y-nodecor .story-nav,
html.a11y-nodecor .story-progress, html.a11y-nodecor .hero::before, html.a11y-nodecor .page-hero::before,
html.a11y-nodecor .why-art, html.a11y-nodecor .updates-art, html.a11y-nodecor .cta-art, html.a11y-nodecor .cta-band::after,
html.a11y-nodecor .chapter-host, html.a11y-nodecor .bot-card-art, html.a11y-nodecor .mini-breath-label,
html.a11y-nodecor .page-hero-art, html.a11y-nodecor .hero-dots, html.a11y-nodecor .chapter-bg,
html.a11y-nodecor .access-art { display: none !important; }
html.a11y-nodecor .hero-grid, html.a11y-nodecor .chapter-grid, html.a11y-nodecor .split,
html.a11y-nodecor .page-hero .container, html.a11y-nodecor .access-teaser { grid-template-columns: minmax(0, 1fr) !important; }
html.a11y-nodecor .chapter.is-night { background: var(--bg-soft); color: inherit; }
html.a11y-nodecor .chapter.is-night .chapter-body > h2, html.a11y-nodecor .chapter.is-night .chapter-body > p,
html.a11y-nodecor .chapter.is-night .eyebrow { color: inherit; }
html.a11y-nodecor .cta-band { background: var(--purple); }
html.a11y-nodecor .tilt { transform: none !important; }

/* Seizure-safe: no glows, flashes or blinking at all. */
html.a11y-noflash *, html.a11y-noflash *::before, html.a11y-noflash *::after { animation: none !important; }
html.a11y-noflash .seq-tile.lit { box-shadow: inset 0 0 0 4px var(--navy); transform: none; }
html.a11y-noflash .stroop-word.flash-ok, html.a11y-noflash .stroop-word.flash-no { box-shadow: none; }
html.a11y-noflash .night-moon { box-shadow: none; }

/* ---------------------------------------------------------- 6. panel */

.ax-toggle { width: auto; min-width: 44px; padding: 0 10px; gap: 8px; display: inline-flex; align-items: center; }
.ax-toggle .icon { width: 22px; height: 22px; }
.ax-toggle-text { display: none; font-weight: 700; font-size: 0.86rem; }

.header-cta, .me-pill { white-space: nowrap; }
/* Header fit. Uzbek and Russian menu labels are long, so: a slightly wider
   header, the level pill shows only its avatar (its label stays in aria-label),
   the "Accessibility" label appears only where it fits, and between 1160 and
   1279 px the menu moves into the menu button (rules further down). */
.site-header .container { width: min(100% - 2 * var(--gutter), 1320px); }
@media (min-width: 1160px) {
  .site-nav ul { gap: 2px; }
  .site-nav a { padding: 0 10px; }
  html:not([lang="en"]) .me-pill .me-text { display: none; }
  html:not([lang="en"]) .me-pill { padding-right: 3px; }
}
@media (min-width: 1440px) { .ax-toggle-text { display: inline; } .ax-toggle { padding: 0 14px 0 10px; } }
@media (min-width: 1280px) { html[lang="en"] .ax-toggle-text { display: inline; } html[lang="en"] .ax-toggle { padding: 0 14px 0 10px; } }
@media (max-width: 400px) { .header-inner { gap: 8px; } .header-tools { gap: 5px; } }

.ax-scrim { position: fixed; inset: 0; z-index: 90; background: rgba(13, 17, 40, 0.42); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.ax-scrim[hidden] { display: none; }
.ax-drawer {
  position: fixed; z-index: 91; top: 0; right: 0; bottom: 0;
  display: flex; flex-direction: column;
  width: min(440px, 100vw);
  background: var(--bg); color: var(--ink-2);
  border-left: 1px solid var(--line);
  box-shadow: -30px 0 80px -30px rgba(13, 17, 40, 0.45);
  transform: translateX(16px); opacity: 0;
  transition: transform 0.28s var(--ease-out), opacity 0.2s ease;
}
.ax-drawer.is-in { transform: none; opacity: 1; }
.ax-drawer[hidden] { display: none; }
html.calm .ax-drawer { transition: none; }
.ax-head {
  display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: start;
  padding: 20px 20px 16px;
  background:
    radial-gradient(20rem 10rem at 100% 0%, var(--hero-glow), transparent 70%),
    var(--bg-soft);
  border-bottom: 1px solid var(--line);
}
.ax-badge { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 15px; color: var(--white); background: linear-gradient(140deg, #8576F2, var(--purple) 55%, #4B3BC4); box-shadow: var(--shadow-p); }
.ax-badge .icon { width: 26px; height: 26px; }
.ax-title { margin: 0 0 4px; font-size: 1.25rem; outline: none; }
.ax-lead { margin: 0; color: var(--ink-3); font-size: 0.9rem; line-height: 1.45; }
.ax-close { width: 40px; height: 40px; }
.ax-body { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 6px 20px 20px; }
.ax-sec { padding-block: 16px; border-bottom: 1px solid var(--line); display: grid; gap: 10px; }
.ax-sec:last-child { border-bottom: 0; }
.ax-sec h3 { margin: 0; font-size: 0.78rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3); font-family: var(--font-body); font-weight: 800; }
.ax-profiles { list-style: none; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ax-profile {
  position: relative; display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; align-items: start;
  width: 100%; height: 100%; padding: 12px 12px 12px 10px;
  border: 1.5px solid var(--line); border-radius: 16px; background: var(--surface);
  color: var(--ink); font: inherit; text-align: left; cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease, transform 0.15s ease;
}
.ax-profile:hover { border-color: var(--lav-300); }
.ax-profile[aria-pressed="true"] { border-color: var(--purple); background: var(--lav-100); }
.ax-p-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 11px; background: var(--lav-100); color: var(--purple); }
.ax-profile[aria-pressed="true"] .ax-p-icon { background: var(--purple); color: var(--white); }
.ax-p-icon .icon { width: 19px; height: 19px; }
.ax-p-text { display: grid; gap: 2px; min-width: 0; }
.ax-p-text strong { font-size: 0.92rem; line-height: 1.25; }
.ax-p-text small { color: var(--ink-3); font-size: 0.74rem; line-height: 1.3; }
.ax-p-check { position: absolute; right: 8px; top: 8px; display: none; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--purple); color: var(--white); }
.ax-p-check .icon { width: 13px; height: 13px; }
.ax-profile[aria-pressed="true"] .ax-p-check { display: grid; }
.ax-hint { display: flex; gap: 8px; margin: 2px 0 0; color: var(--ink-3); font-size: 0.8rem; line-height: 1.4; }
.ax-hint .icon { flex: none; width: 16px; height: 16px; margin-top: 1px; color: var(--purple); }
.ax-field { display: grid; gap: 6px; }
.ax-label { font-weight: 700; color: var(--ink); font-size: 0.92rem; }
.ax-seg { display: flex; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 14px; background: var(--bg-soft); }
.ax-seg button {
  flex: 1; display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: 46px; padding: 6px 6px; border: 0; border-radius: 10px; background: transparent;
  color: var(--ink-3); font: inherit; font-size: 0.8rem; font-weight: 700; cursor: pointer; line-height: 1.15;
}
.ax-seg button .icon { width: 18px; height: 18px; }
.ax-seg button[aria-pressed="true"] { background: var(--surface); color: var(--purple); box-shadow: var(--shadow-1); }
html[data-theme="dark"] .ax-seg button[aria-pressed="true"] { color: #CFC9FF; background: var(--lav-100); }
.ax-aa { font-family: var(--font-head); font-weight: 700; line-height: 1; }
.ax-seg small { font-size: 0.68rem; font-weight: 700; }
.ax-switch { background: var(--surface); }
.ax-readpage { justify-content: center; margin-top: 4px; }
.ax-foot { padding: 14px 20px 18px; border-top: 1px solid var(--line); background: var(--bg-soft); display: grid; gap: 10px; }
.ax-note { margin: 0; color: var(--ink-3); font-size: 0.8rem; }
.ax-foot-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.ax-drawer .lang-choice { background: var(--surface); }
@media (max-width: 380px) { .ax-profiles { grid-template-columns: 1fr; } }

/* ------------------------------------- 7. reading guide / read aloud */

.ax-ruler {
  position: fixed; left: 0; right: 0; top: 0; z-index: 80; height: 4.6em;
  pointer-events: none;
  border-block: 2px solid rgba(162, 155, 254, 0.9);
  box-shadow: 0 0 0 200vmax rgba(13, 17, 40, 0.38);
  transition: transform 0.06s linear;
}
.ax-ruler[hidden] { display: none; }
html.calm .ax-ruler { transition: none; }
.ax-open .ax-ruler { display: none; }

.ax-reading { border-radius: 10px; background: rgba(255, 159, 67, 0.16); box-shadow: 0 0 0 6px rgba(255, 159, 67, 0.16); }
.ax-readbar {
  position: fixed; left: 50%; bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 85;
  display: flex; align-items: center; gap: 8px;
  padding: 8px 8px 8px 16px; transform: translateX(-50%);
  border-radius: 999px; background: var(--navy); color: var(--white);
  box-shadow: 0 20px 50px -18px rgba(13, 17, 40, 0.7);
}
.ax-readbar[hidden] { display: none; }
.ax-readbar .rb-text { font-weight: 700; font-size: 0.9rem; white-space: nowrap; }
.ax-readbar .rb-text small { opacity: 0.7; font-weight: 600; margin-left: 4px; }
.ax-readbar .icon-btn { width: 40px; height: 40px; border-color: rgba(255, 255, 255, 0.18); background: rgba(255, 255, 255, 0.08); color: var(--white); }
.rb-wave { display: inline-flex; gap: 3px; align-items: flex-end; height: 18px; }
.rb-wave i { width: 3px; height: 100%; border-radius: 2px; background: var(--orange); transform-origin: bottom; }
@media (prefers-reduced-motion: no-preference) {
  html:not(.calm) .rb-wave i { animation: rb 0.9s ease-in-out infinite; }
  html:not(.calm) .rb-wave i:nth-child(2) { animation-delay: -0.3s; }
  html:not(.calm) .rb-wave i:nth-child(3) { animation-delay: -0.6s; }
}
@keyframes rb { 0%, 100% { transform: scaleY(0.35); } 50% { transform: scaleY(1); } }

.ax-selbtn {
  position: fixed; z-index: 86; display: inline-flex; align-items: center; gap: 6px;
  min-height: 38px; padding: 0 14px 0 10px; border: 0; border-radius: 999px;
  background: var(--navy); color: var(--white); font: inherit; font-size: 0.85rem; font-weight: 700;
  box-shadow: var(--shadow-2); cursor: pointer;
}
.ax-selbtn[hidden] { display: none; }
.ax-selbtn .icon { width: 18px; height: 18px; color: var(--orange); }
.ax-para-btn {
  display: inline-grid; place-items: center; vertical-align: middle;
  width: 30px; height: 30px; margin-left: 6px; padding: 0;
  border: 1px solid var(--line-2); border-radius: 50%; background: var(--surface); color: var(--purple); cursor: pointer;
}
.ax-para-btn .icon { width: 16px; height: 16px; }
.ax-para-btn:hover { border-color: var(--purple); }

/* ------------------------------------------------------- 8. hard words */

.gloss {
  display: inline; padding: 0; margin: 0; border: 0; background: none;
  color: inherit; font: inherit; letter-spacing: inherit; word-spacing: inherit; line-height: inherit;
  text-decoration: underline dotted; text-decoration-color: var(--lavender); text-decoration-thickness: 2px; text-underline-offset: 4px;
  cursor: help;
}
.gloss:hover, .gloss[aria-expanded="true"] { text-decoration-style: solid; text-decoration-color: var(--purple); background: rgba(162, 155, 254, 0.16); border-radius: 4px; }
html.a11y-noglossary .gloss { text-decoration: none; cursor: inherit; }
.gloss-pop {
  position: fixed; z-index: 87; width: min(340px, calc(100vw - 24px));
  padding: 14px 16px 12px; border: 1px solid var(--line); border-radius: 18px;
  background: var(--surface); color: var(--ink-2); box-shadow: var(--shadow-2);
}
.gloss-pop[hidden] { display: none; }
.gloss-pop::before {
  content: ""; position: absolute; top: -7px; left: calc(var(--arrow, 50%) - 7px); width: 14px; height: 14px;
  background: var(--surface); border-left: 1px solid var(--line); border-top: 1px solid var(--line); transform: rotate(45deg);
}
.gloss-pop.is-above::before { top: auto; bottom: -7px; transform: rotate(225deg); }
.gp-head { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; }
.gp-icon { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 10px; background: var(--orange-100); color: #C76A12; }
html[data-theme="dark"] .gp-icon { color: #FFC08A; }
.gp-icon .icon { width: 18px; height: 18px; }
.gp-term { margin: 0; color: var(--ink); font-family: var(--font-head); font-weight: 700; font-size: 1.05rem; }
.gp-x { display: grid; place-items: center; width: 32px; height: 32px; border: 0; border-radius: 10px; background: var(--bg-soft); color: var(--ink-3); cursor: pointer; }
.gp-x .icon { width: 16px; height: 16px; }
.gp-def { margin: 10px 0 12px; font-size: 0.95rem; line-height: 1.55; }
.gp-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.gp-note { display: flex; gap: 6px; align-items: center; margin: 10px 0 0; color: var(--ink-3); font-size: 0.75rem; }
.gp-note .icon { width: 14px; height: 14px; }

/* Glossary page */
.gl-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; margin-bottom: 18px; }
.gl-tools .search-field { flex: 1 1 280px; display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 0 16px; border: 1.5px solid var(--line-2); border-radius: 999px; background: var(--surface); }
.gl-tools .search-field:focus-within { border-color: var(--purple); }
.gl-tools input { flex: 1; min-width: 0; border: 0; background: none; color: var(--ink); font: inherit; outline: none; }
.gl-count { margin: 0; font-size: 0.9rem; }
.gl-list { display: grid; gap: 12px; margin: 0; }
.gl-item { display: grid; gap: 6px; padding: 18px 20px; scroll-margin-top: 110px; }
.gl-item[hidden] { display: none; }
.gl-item.is-target { border-color: var(--purple); box-shadow: 0 0 0 4px rgba(108, 92, 231, 0.18), var(--shadow-1); }
.gl-item dt { margin: 0; }
.gl-term { color: var(--ink); font-family: var(--font-head); font-weight: 700; font-size: 1.15rem; }
.gl-item dd { margin: 0; }
.gl-item dd p { margin: 0 0 10px; }
.gl-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }
@media (min-width: 860px) { .gl-list { grid-template-columns: 1fr 1fr; } }

/* ----------------------------------------------------------- 9. header */

.site-header { background: color-mix(in srgb, var(--bg) 82%, transparent); }
.brand-mark {
  width: 44px; height: 44px; border: 0; border-radius: 14px;
  background: linear-gradient(140deg, #8576F2 0%, var(--purple) 55%, #4B3BC4 100%);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.35) inset, 0 8px 18px -8px rgba(108, 92, 231, 0.7);
  overflow: hidden;
}
.brand-mark img { width: 40px; height: 40px; }
.brand-name { letter-spacing: -0.02em; }
.site-footer .brand-mark { box-shadow: 0 8px 18px -8px rgba(0, 0, 0, 0.5); }
.me-pill { transition: border-color 0.15s ease, box-shadow 0.15s ease; }
.me-pill:hover { box-shadow: var(--shadow-1); }
@media (min-width: 1160px) {
  .site-nav a { border-radius: 999px; }
  .site-nav a:hover { color: var(--ink); background: var(--bg-soft) !important; }
}

/* ------------------------------------------------------------- 10. hero */

.hero { isolation: isolate; }
.hero::before { background: radial-gradient(closest-side, var(--hero-glow), transparent); }
.hero::after {
  content: ""; position: absolute; inset: auto 0 0 0; height: 40%; z-index: -1; pointer-events: none;
  background: linear-gradient(180deg, transparent, var(--bg-soft));
  opacity: 0.6;
}
.hero h1 .accent {
  background: linear-gradient(100deg, var(--purple) 10%, #8E7FF3 55%, var(--purple) 90%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
html.a11y-contrast .hero h1 .accent, html[data-theme="dark"] .hero h1 .accent {
  background: none; -webkit-background-clip: border-box; background-clip: border-box; color: var(--accent-text);
}
.hero-brain {
  position: absolute; left: 50%; top: 47%; width: 96%; height: auto;
  transform: translate(-50%, -50%);
  filter: drop-shadow(0 30px 40px rgba(108, 92, 231, 0.28));
  pointer-events: none;
}
html[data-theme="dark"] .hero-brain { filter: drop-shadow(0 0 60px rgba(162, 155, 254, 0.35)); }
.hero-circle { inset: 6%; }
.hero-art .hero-dendi { bottom: 9%; height: 46%; filter: drop-shadow(0 16px 20px rgba(13, 17, 40, 0.28)); }
.float-card {
  background: var(--glass); border-color: var(--glass-line);
  backdrop-filter: blur(14px) saturate(1.5); -webkit-backdrop-filter: blur(14px) saturate(1.5);
  box-shadow: var(--shadow-2), var(--ring);
}
.badge-pill { background: var(--glass); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }

/* Trust strip: only real numbers, 3–5 cells */
.stats { border-radius: 24px; }
@media (min-width: 760px) {
  .stats.stats-3 { grid-template-columns: repeat(3, 1fr); }
  .stats.stats-4 { grid-template-columns: repeat(4, 1fr); }
  .stats.stats-5 { grid-template-columns: repeat(5, 1fr); }
  .stats.stats-3 .stat, .stats.stats-4 .stat, .stats.stats-5 .stat { border-top: 0; }
  .stats.stats-3 .stat + .stat, .stats.stats-4 .stat + .stat, .stats.stats-5 .stat + .stat { border-left: 1px solid var(--line); }
}
.stat .tile { background: linear-gradient(140deg, var(--lav-100), var(--lav-200)); color: var(--purple); }
html[data-theme="dark"] .stat .tile { color: #CFC9FF; }

/* ---------------------------------------------------- 11. home sections */

/* Character cards: soft spotlight behind each character */
.char-art { background: radial-gradient(70% 60% at 50% 100%, color-mix(in srgb, var(--tint, var(--lav-100)) 40%, var(--surface)) 0%, var(--tint, var(--lav-100)) 70%); }
.char-art img { filter: drop-shadow(0 10px 12px rgba(13, 17, 40, 0.16)); transition: transform 0.35s var(--ease-out); }
.char-card:hover .char-art img { transform: translateY(-4px) scale(1.03); }
html.calm .char-card:hover .char-art img { transform: none; }
.host-circle { box-shadow: inset 0 0 0 1px rgba(108, 92, 231, 0.08), var(--shadow-1); }
.host-circle img { filter: drop-shadow(0 12px 14px rgba(13, 17, 40, 0.18)); }

/* The sleep chapter happens at night */
.chapter.is-night { position: relative; overflow: hidden; isolation: isolate; background: #0B0F24; color: rgba(255, 255, 255, 0.86); }
.chapter-bg { position: absolute; inset: 0; z-index: -1; }
.chapter-bg img { width: 100%; height: 100%; object-fit: cover; object-position: 30% 60%; opacity: 0.9; }
.chapter-bg::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(11, 15, 36, 0.55) 0%, rgba(11, 15, 36, 0.78) 45%, rgba(11, 15, 36, 0.9) 100%); }
.chapter.is-night .chapter-body > h2 { color: var(--white); }
.chapter.is-night .chapter-body > p { color: rgba(255, 255, 255, 0.82); }
.chapter.is-night .eyebrow { color: #C9C2FF; }
.chapter.is-night .chapter-num { color: #FFC08A; }
.chapter.is-night .host-circle { background: radial-gradient(circle at 50% 70%, rgba(255, 159, 67, 0.35), rgba(255, 255, 255, 0.06) 70%) !important; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12); }
.chapter.is-night .bubble { background: rgba(21, 26, 58, 0.85); color: var(--white); border: 1px solid rgba(162, 155, 254, 0.25); }
.chapter.is-night .btn-ghost { background: rgba(255, 255, 255, 0.08); color: var(--white); border-color: rgba(255, 255, 255, 0.3); }
.chapter.is-night .btn-ghost:hover { border-color: var(--white); color: var(--white); }
.chapter.is-night .explainer { background: rgba(255, 255, 255, 0.96); color: #3D4157; }
html[data-theme="dark"] .chapter.is-night .explainer { background: var(--surface); color: var(--ink-2); }

/* Why Medulla: neurons image */
.why-photo { position: relative; display: block; overflow: hidden; min-height: 0; padding: 0; border: 0; border-radius: 28px; box-shadow: var(--shadow-2); aspect-ratio: 4 / 3; background: var(--lav-100); }
.why-photo img.why-neurons { width: 100%; height: 100%; object-fit: cover; }
.why-photo .why-syno { position: absolute; right: 6%; bottom: 6%; width: 26%; height: auto; filter: drop-shadow(0 14px 18px rgba(13, 17, 40, 0.3)); }
.why-photo .why-tag {
  position: absolute; left: 18px; top: 18px; display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px 8px 10px; border-radius: 999px; background: rgba(255, 255, 255, 0.82); color: #0D1128;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); font-size: 0.82rem; font-weight: 700;
}
.why-photo .why-tag .icon { color: var(--purple); }

/* Access teaser on the home page */
.access-teaser {
  position: relative; display: grid; gap: 26px; overflow: hidden; isolation: isolate;
  padding: 30px 24px; border-radius: 28px;
  background: radial-gradient(28rem 18rem at 100% 0%, var(--hero-glow), transparent 70%), var(--bg-soft);
  border: 1px solid var(--line);
}
.access-teaser h2 { margin-bottom: 10px; }
.access-teaser .lead { margin-bottom: 18px; }
.access-chips { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 22px; }
.access-chips button {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px 0 10px;
  border: 1.5px solid var(--line-2); border-radius: 999px; background: var(--surface); color: var(--ink);
  font: inherit; font-weight: 700; font-size: 0.9rem; cursor: pointer;
}
.access-chips button:hover { border-color: var(--purple); }
.access-chips button[aria-pressed="true"] { border-color: var(--purple); background: var(--lav-100); color: var(--purple); }
html[data-theme="dark"] .access-chips button[aria-pressed="true"] { color: #DCD8FF; }
.access-chips .icon { width: 20px; height: 20px; color: var(--purple); }
.access-art { position: relative; display: grid; place-items: center; min-height: 240px; }
.access-art .demo-card { position: relative; width: min(100%, 380px); padding: 26px 24px 92px; border-radius: 22px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-2); }
.access-art .demo-card p { position: relative; z-index: 1; margin: 0; color: var(--ink); font-family: var(--font-head); font-size: 1.2rem; font-weight: 600; line-height: 1.55; }
.access-art .demo-ruler { position: absolute; left: -10px; right: -10px; top: 20px; height: 3.4em; border-block: 2px solid var(--lavender); background: rgba(162, 155, 254, 0.12); border-radius: 8px; }
.access-art .demo-gloss { text-decoration: underline dotted var(--purple) 2px; text-underline-offset: 5px; background: rgba(162, 155, 254, 0.18); border-radius: 4px; padding-inline: 2px; }
.access-art .demo-pop { position: absolute; right: -18px; bottom: -26px; width: 78%; padding: 12px 14px; border-radius: 16px; background: var(--navy); color: var(--white); font-size: 0.85rem; line-height: 1.45; box-shadow: var(--shadow-2); }
.access-art .demo-pop::before { content: ""; position: absolute; top: -6px; left: 30%; width: 12px; height: 12px; background: var(--navy); transform: rotate(45deg); }
.access-art .demo-pop strong { display: block; margin-bottom: 2px; color: #FFC08A; font-size: 0.78rem; letter-spacing: 0.04em; text-transform: uppercase; }
html[data-theme="dark"] .access-art .demo-pop, html[data-theme="dark"] .access-art .demo-pop::before { background: #252C66; }
.access-art img { position: absolute; left: -2%; bottom: -6%; width: 30%; max-width: 150px; height: auto; filter: drop-shadow(0 12px 16px rgba(13, 17, 40, 0.25)); }
@media (min-width: 900px) {
  .access-teaser { grid-template-columns: 1.1fr 0.9fr; align-items: center; padding: 48px 52px; }
}

/* Closing band with the violet glass waves */
.cta-band { background: linear-gradient(115deg, rgba(56, 40, 160, 0.9), rgba(108, 92, 231, 0.55) 60%, rgba(108, 92, 231, 0.2)), url("../assets/img/waves-sm.webp") center / cover no-repeat, var(--purple); }
@media (min-width: 700px) {
  .cta-band { background: linear-gradient(115deg, rgba(56, 40, 160, 0.92), rgba(108, 92, 231, 0.5) 60%, rgba(108, 92, 231, 0.1)), url("../assets/img/waves.webp") center / cover no-repeat, var(--purple); }
}
.cta-art { background: rgba(255, 255, 255, 0.16); border: 1px solid rgba(255, 255, 255, 0.35); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.cta-art img { filter: drop-shadow(0 16px 18px rgba(13, 17, 40, 0.35)); }

/* Mini badges: even rows */
.mini-badges { grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)) !important; }

/* Extra-time note on result cards */
.pace-note { display: flex; gap: 8px; align-items: center; margin: 0; padding: 10px 12px; border-radius: 12px; background: var(--lav-100); color: var(--ink-2); font-size: 0.88rem; }
.pace-note .icon { color: var(--purple); flex: none; }

/* -------------------------------------------------------- 12. bot card */

.bot-card {
  position: relative; display: grid; gap: 24px; overflow: hidden; isolation: isolate;
  padding: 28px 24px; border-radius: 28px;
  background:
    radial-gradient(24rem 16rem at 0% 100%, rgba(255, 159, 67, 0.16), transparent 70%),
    radial-gradient(30rem 20rem at 100% 0%, rgba(108, 92, 231, 0.22), transparent 70%),
    var(--surface);
  border: 1px solid var(--line); box-shadow: var(--shadow-1);
}
.bot-card h3 { font-size: clamp(1.4rem, 1.15rem + 1vw, 1.9rem); margin: 0 0 8px; }
.bot-card-body > p { color: var(--ink-3); margin: 0 0 14px; }
.bot-card .eyebrow { margin-bottom: 10px; }
.bot-feats { list-style: none; display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; margin: 0 0 20px; }
.bot-feats li { display: flex; gap: 8px; align-items: center; color: var(--ink-2); font-weight: 600; font-size: 0.92rem; }
.bot-feats .icon { flex: none; width: 30px; height: 30px; padding: 6px; border-radius: 10px; background: var(--lav-100); color: var(--purple); }
.bot-privacy { display: flex; gap: 8px; align-items: flex-start; margin: 14px 0 0; color: var(--ink-3); font-size: 0.82rem; }
.bot-privacy .icon { flex: none; width: 16px; height: 16px; margin-top: 2px; }
.btn-soon { border: 1.5px dashed var(--lav-300); background: var(--bg-soft); color: var(--ink-3); cursor: default; }
.bot-card-art { position: relative; display: grid; place-items: end center; min-height: 230px; border-radius: 22px; background: linear-gradient(160deg, #2AABEE22, var(--lav-100)); overflow: hidden; }
.bot-card-art img { max-height: 200px; width: auto; filter: drop-shadow(0 14px 16px rgba(13, 17, 40, 0.25)); }
.bot-bubble {
  position: absolute; z-index: 1; padding: 8px 12px; border-radius: 16px 16px 16px 4px;
  background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1);
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 0.85rem; font-weight: 700;
}
.bot-bubble.b1 { left: 8%; top: 12%; }
.bot-bubble.b2 { right: 8%; top: 26%; border-radius: 16px 16px 4px 16px; background: var(--purple); color: var(--white); }
.bot-bubble.b3 { left: 12%; top: 46%; }
@media (min-width: 860px) {
  .bot-card { grid-template-columns: 0.8fr 1.2fr; align-items: center; padding: 36px 40px; }
  .bot-card-art { min-height: 300px; }
  .bot-card-art img { max-height: 250px; }
}

/* --------------------------------------------- 13. team and partners */

.photo.initials {
  display: grid; place-items: center; font-family: var(--font-head); font-weight: 700; font-size: 1.15rem; color: var(--white);
  background: linear-gradient(140deg, hsl(calc(250 + var(--hue, 0) * 0.08) 75% 66%), hsl(calc(248 + var(--hue, 0) * 0.05) 65% 50%));
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.3) inset, 0 8px 18px -10px rgba(108, 92, 231, 0.8);
}
.people--compact .person.is-clean { padding: 12px 14px; }
.people:not(.people--compact) .person.is-clean { display: grid; grid-template-columns: 72px 1fr; gap: 16px; align-items: center; padding: 18px 20px; }
.people:not(.people--compact) .person.is-clean .photo.initials { width: 72px; height: 72px; border-radius: 22px; font-size: 1.4rem; }
.people:not(.people--compact) .person.is-clean h3 { margin: 0 0 2px; }
.people:not(.people--compact) .person.is-clean .person-role { margin: 0; }
@media (min-width: 1040px) { .people:has(.person.is-clean) { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 560px) { .team-preview .people--compact { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; } }
.team-preview .people--compact .person.is-clean { margin: 0; }
.person.is-clean { border-style: solid; background: var(--surface); }
.person.is-clean .person-role { color: var(--accent-text); }
.partner-cta {
  grid-column: 1 / -1; display: grid; grid-template-columns: auto 1fr; gap: 12px 14px; align-items: center;
  padding: 18px 20px; border: 1.5px dashed var(--lav-300); border-radius: 20px; background: var(--surface);
}
.partner-cta .pc-icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 14px; background: var(--lav-100); color: var(--purple); }
.partner-cta strong { display: block; color: var(--ink); }
.partner-cta small { display: block; color: var(--ink-3); font-size: 0.88rem; }
.partner-cta .btn { grid-column: 1 / -1; justify-self: start; }
.soft-empty { display: flex; gap: 10px; align-items: center; margin: 0; padding: 14px 16px; border-radius: 16px; background: var(--bg-soft); color: var(--ink-3); }
.soft-empty .icon { color: var(--purple); flex: none; }

/* ------------------------------------------------------------ 14. footer */

.site-footer {
  background:
    radial-gradient(40rem 22rem at 100% 0%, rgba(108, 92, 231, 0.38), transparent 60%),
    radial-gradient(30rem 18rem at 0% 100%, rgba(255, 159, 67, 0.08), transparent 70%),
    #0B0F24;
}
.footer-access {
  display: flex; gap: 12px; align-items: center; margin-top: 18px; padding: 12px 14px;
  border: 1px solid rgba(162, 155, 254, 0.25); border-radius: 16px; background: rgba(255, 255, 255, 0.05);
  color: var(--white); text-decoration: none;
}
.footer-access:hover { border-color: var(--lavender); background: rgba(255, 255, 255, 0.08); color: var(--white); }
.footer-access .icon { flex: none; width: 34px; height: 34px; padding: 6px; border-radius: 11px; background: var(--purple); color: var(--white); }
.footer-access strong { display: block; font-size: 0.92rem; }
.footer-access small { display: block; color: rgba(255, 255, 255, 0.7); font-size: 0.8rem; }

/* ----------------------------------------------------- 15. pages, print */

.ax-pcards { list-style: none; display: grid; gap: 14px; }
.ax-pcard { display: grid; gap: 8px; align-content: start; padding: 22px; }
.ax-pcard h3 { margin: 4px 0 0; }
.ax-pcard .ax-p-icon { width: 46px; height: 46px; border-radius: 15px; }
.ax-pcard .ax-p-icon .icon { width: 24px; height: 24px; }
.ax-pcard .ax-pfor { margin: 0; color: var(--accent-text); font-weight: 700; font-size: 0.88rem; }
.ax-pcard p { margin: 0; color: var(--ink-3); font-size: 0.95rem; }
.ax-pcard .btn { justify-self: start; margin-top: 8px; }
.ax-pcard.is-on { border-color: var(--purple); box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.14), var(--shadow-1); }
.ax-pcard.is-on .ax-p-icon { background: var(--purple); color: var(--white); }
@media (min-width: 700px) { .ax-pcards { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1040px) { .ax-pcards { grid-template-columns: repeat(3, 1fr); } }

.feature-list { list-style: none; display: grid; gap: 12px; }
.feature-list li { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; padding: 18px 20px; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); box-shadow: var(--shadow-1); }
.feature-list .fl-icon { grid-row: span 2; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 14px; background: var(--lav-100); color: var(--purple); }
.feature-list strong { color: var(--ink); }
.feature-list p { margin: 0; color: var(--ink-3); font-size: 0.95rem; }
@media (min-width: 860px) { .feature-list { grid-template-columns: 1fr 1fr; } }
.kbd-list { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 10px 0 0; padding: 0; list-style: none; color: var(--ink-3); font-size: 0.92rem; }
.kbd-list kbd { display: inline-block; min-width: 28px; padding: 2px 8px; margin-right: 4px; border: 1px solid var(--line-2); border-bottom-width: 3px; border-radius: 8px; background: var(--surface); color: var(--ink); font: inherit; font-weight: 700; font-size: 0.82rem; text-align: center; }
.source-list { display: grid; gap: 8px; margin: 0; padding-left: 1.2em; color: var(--ink-3); font-size: 0.9rem; }

@media print {
  .ax-drawer, .ax-scrim, .ax-ruler, .ax-readbar, .ax-selbtn, .ax-para-btn, .gloss-pop { display: none !important; }
  .gloss { text-decoration: none; }
}

/* Static "TBD" chips are only for the team (?placeholders=1 or showPlaceholders in js/config.js). */
html:not(.show-tbd) .tbd:not(.is-soon) { display: none; }

/* Elements with the hidden attribute stay hidden even when a class sets display. */
[hidden] { display: none !important; }

/* Larger text or wider spacing: on mid-size desktops the main menu moves into
   the menu button instead of wrapping onto two lines. */
.site-nav a, .brand-tag { white-space: nowrap; }
@media (min-width: 1160px) and (max-width: 1279px) {
  html .menu-btn { display: inline-grid; }
  html .header-cta { display: none; }
  html .header-tools { margin-left: auto; }
  html .site-nav {
    display: none; position: absolute; left: 0; right: 0; top: 100%; margin: 0;
    padding: 8px var(--gutter) 18px; background: var(--surface); border-bottom: 1px solid var(--line); box-shadow: var(--shadow-2);
  }
  html .site-nav.is-open { display: block; }
  html .site-nav ul { display: grid; gap: 2px; }
  html .site-nav .nav-more { display: list-item; }
  html .site-nav a { min-height: 48px; color: var(--ink); font-size: 1rem; }
  html .site-nav a[aria-current="page"]::after { display: none; }
  html .ax-toggle-text { display: none; }
}
@media (min-width: 1160px) and (max-width: 1679px) {
  html:is([data-text="1"], [data-text="2"], [data-text="3"], .a11y-spacing, .a11y-dyslexia, .a11y-readable) .menu-btn { display: inline-grid; }
  html:is([data-text="1"], [data-text="2"], [data-text="3"], .a11y-spacing, .a11y-dyslexia, .a11y-readable) .header-cta { display: none; }
  html:is([data-text="1"], [data-text="2"], [data-text="3"], .a11y-spacing, .a11y-dyslexia, .a11y-readable) .header-tools { margin-left: auto; }
  html:is([data-text="1"], [data-text="2"], [data-text="3"], .a11y-spacing, .a11y-dyslexia, .a11y-readable) .site-nav {
    display: none; position: absolute; left: 0; right: 0; top: 100%; margin: 0;
    padding: 8px var(--gutter) 18px; background: var(--surface); border-bottom: 1px solid var(--line); box-shadow: var(--shadow-2);
  }
  html:is([data-text="1"], [data-text="2"], [data-text="3"], .a11y-spacing, .a11y-dyslexia, .a11y-readable) .site-nav.is-open { display: block; }
  html:is([data-text="1"], [data-text="2"], [data-text="3"], .a11y-spacing, .a11y-dyslexia, .a11y-readable) .site-nav ul { display: grid; gap: 2px; }
  html:is([data-text="1"], [data-text="2"], [data-text="3"], .a11y-spacing, .a11y-dyslexia, .a11y-readable) .site-nav .nav-more { display: list-item; }
  html:is([data-text="1"], [data-text="2"], [data-text="3"], .a11y-spacing, .a11y-dyslexia, .a11y-readable) .site-nav a { min-height: 48px; color: var(--ink); font-size: 1rem; }
  html:is([data-text="1"], [data-text="2"], [data-text="3"], .a11y-spacing, .a11y-dyslexia, .a11y-readable) .site-nav a[aria-current="page"]::after { display: none; }
  html:is([data-text="1"], [data-text="2"], [data-text="3"], .a11y-spacing, .a11y-dyslexia, .a11y-readable) .ax-toggle-text { display: none; }
}
html[data-text="3"] .lang-switch.wide-only { display: none; }
.partners .soft-empty { grid-column: 1 / -1; list-style: none; }

/* Dark theme: brand purple text is too dark on navy (axe colour-contrast); use the light accent. */
html[data-theme="dark"] .eyebrow,
html[data-theme="dark"] .badge-pill .dot,
html[data-theme="dark"] .accent,
html[data-theme="dark"] .btn-ghost:hover,
html[data-theme="dark"] .btn-play .play,
html[data-theme="dark"] .btn-play:hover,
html[data-theme="dark"] .text-link,
html[data-theme="dark"] .tile,
html[data-theme="dark"] .brand-tag,
html[data-theme="dark"] .lang-btn[aria-pressed="true"],
html[data-theme="dark"] .icon-btn[aria-expanded="true"],
html[data-theme="dark"] .site-nav a:hover,
html[data-theme="dark"] .site-nav a[aria-current="page"],
html[data-theme="dark"] .note .icon,
html[data-theme="dark"] .filter-chip:hover,
html[data-theme="dark"] .fact-foot .src .icon,
html[data-theme="dark"] .empty-state .icon,
html[data-theme="dark"] .checks .check,
html[data-theme="dark"] .callout-box.is-calm > .icon,
html[data-theme="dark"] .tab[aria-selected="true"],
html[data-theme="dark"] .small-notes .icon,
html[data-theme="dark"] .result-explain .icon,
html[data-theme="dark"] .link-btn,
html[data-theme="dark"] .photo-slot,
html[data-theme="dark"] .avatar-slot,
html[data-theme="dark"] .partner .icon,
html[data-theme="dark"] .timeline .when,
html[data-theme="dark"] .light-social .btn-social:hover,
html[data-theme="dark"] .notfound .code,
html[data-theme="dark"] .sound-btn[aria-pressed="true"],
html[data-theme="dark"] .me-pill:hover,
html[data-theme="dark"] .toast-icon,
html[data-theme="dark"] .chapter-num,
html[data-theme="dark"] .mini-breath-label span,
html[data-theme="dark"] .card-link:hover,
html[data-theme="dark"] .back-link,
html[data-theme="dark"] .breath-count,
html[data-theme="dark"] .steps li.is-now,
html[data-theme="dark"] .quiz-why .icon,
html[data-theme="dark"] .level-toggle button[aria-pressed="true"],
html[data-theme="dark"] .listen-btn.is-speaking,
html[data-theme="dark"] .related-list a:hover,
html[data-theme="dark"] .topic-hub:hover,
html[data-theme="dark"] .q-list li::before { color: var(--accent-text); }
html[data-theme="dark"] a:not(.btn):not(.brand) { color: #BDB6FF; }
html[data-theme="dark"] .btn-night, html[data-theme="dark"] .btn-night:hover { color: var(--navy); }
html[data-theme="dark"] .btn-light, html[data-theme="dark"] .btn-light:hover { color: var(--navy); }
html[data-theme="dark"] .tbd { background: #FFB877; color: var(--navy); }
html[data-theme="dark"] .brand-tag { color: #ADA4FF; }
html[data-theme="dark"] .todo-note { color: #FFC08A; }

/* ------------------------------------------------- 12. Version 2.2 look */

/* Characters are vector stickers (tools/characters.js) with their own white
   rim and soft shadow, so the extra drop-shadows of 2.1 are dropped. */
.char-art img, .host-circle img, .hero-art .hero-dendi, .access-art img, .cta-art img, .bot-card-art img, .why-syno { filter: none; }
.hero-art .hero-dendi { bottom: 6%; height: 52%; }
.hero-lumi { width: 24%; right: 5%; top: 6%; }
.hero-dots, .hero-path { display: none; }

/* Head-and-shoulders crops fill their circle. */
img[src*="characters/faces/"] { width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; object-fit: cover; }
.story-nav a img[src*="characters/faces/"] { filter: grayscale(0.6); }
.story-nav a[aria-current="step"] img { filter: none; }
.toast-art img, .activity-card .act-art img, .badge.is-earned .badge-art img, .greet-avatar img, .me-avatar img, .avatar img, .avatar-option img {
  width: 100%; height: auto; max-width: none; max-height: none; margin: 0; align-self: end;
}
.chapter-host .host-circle img { height: 88%; max-width: 92%; }
.page-hero-art img { max-height: 190px; max-width: 190px; }
@media (min-width: 760px) { .page-hero-art img { max-height: 216px; max-width: 216px; } }
.tip-card img { width: 84px; }
.kind-note img { width: 52px; }
.flip-front img { height: 124px; }

/* Character cards: the character greets you when you point at the card. */
.char-pose { position: relative; z-index: 1; display: grid; place-items: end center; }
.char-pose img { grid-area: 1 / 1; transition: opacity 0.25s ease, transform 0.35s var(--ease-out); }
.char-pose .is-hover { opacity: 0; transform: translateY(6px) scale(0.97); }
.char-card:hover .char-pose .is-hover, .char-card:focus-within .char-pose .is-hover { opacity: 1; transform: none; }
.char-card:hover .char-pose .is-rest, .char-card:focus-within .char-pose .is-rest { opacity: 0; }
html.calm .char-pose img { transition: none; }
.char-art { background: radial-gradient(80% 70% at 50% 100%, color-mix(in srgb, var(--tint, var(--lav-100)) 30%, var(--surface)) 0%, var(--tint, var(--lav-100)) 75%); }
.char-art::before {
  content: ""; position: absolute; left: 50%; bottom: 10px; width: 62%; height: 18px; transform: translateX(-50%);
  border-radius: 50%; background: radial-gradient(closest-side, rgba(13, 17, 40, 0.12), transparent);
}

/* Syno's chapter: Syno breathes in, then out (two expressions cross-fade). */
.mini-breath .breath-syno { grid-area: 1 / 1; height: 62%; }
.breath-visual > .breath-syno { grid-area: 1 / 1; }
.mini-breath .breath-syno-out { opacity: 0; }
@media (prefers-reduced-motion: no-preference) {
  html:not(.calm) .mini-breath .breath-syno:not(.breath-syno-out) { animation: mini-breath-s 10s ease-in-out infinite, lbl-a 10s ease-in-out infinite; }
  html:not(.calm) .mini-breath .breath-syno-out { animation: mini-breath-s 10s ease-in-out infinite, lbl-b 10s ease-in-out infinite; }
}
.breath-stage .breath-syno { height: 60%; }

/* Lab tests: a small host who looks curious, then concentrates. */
.game-host { order: 9; margin-left: auto; display: grid; place-items: end center; width: 64px; height: 64px; flex: none; }
.game-host img { width: 100%; height: 100%; }

/* ---- Bubbly icons: rounded 2 px strokes, a soft tinted body, solid dots. */
.icon .f { fill: currentColor; fill-opacity: 0.2; }
.icon .d { fill: currentColor; stroke: none; }
.icon .s { fill: none; stroke: #fff; stroke-opacity: 0.85; stroke-width: 1.6; }
.btn .icon .f, .site-nav .icon .f { fill-opacity: 0.24; }
.btn-primary .icon .s, .btn-night .icon .s { stroke-opacity: 0.5; }

/* Icon tiles: glossy, gently raised "bubbles". */
.tile, .stat .tile, .badge-pill .dot, .checks .check, .toast-icon, .bot-feats .icon, .topic-hub .tile {
  background: radial-gradient(120% 120% at 28% 18%, var(--surface) 0%, var(--lav-100) 48%, var(--lav-200) 100%);
  box-shadow: inset 0 1.5px 0 rgba(255, 255, 255, 0.9), inset 0 -3px 6px rgba(108, 92, 231, 0.14), 0 8px 16px -10px rgba(108, 92, 231, 0.6);
}
.tile { border-radius: 16px; }
.stat .tile { width: 48px; height: 48px; border-radius: 16px; }
.stat .tile .icon { width: 26px; height: 26px; }
.tile.is-orange { background: radial-gradient(120% 120% at 28% 18%, #FFFFFF 0%, var(--orange-100) 45%, var(--orange-200) 100%); box-shadow: inset 0 1.5px 0 rgba(255, 255, 255, 0.9), inset 0 -3px 6px rgba(255, 159, 67, 0.2), 0 8px 16px -10px rgba(255, 159, 67, 0.7); }
.tile.is-night { background: radial-gradient(120% 120% at 28% 18%, #2D3470 0%, var(--navy) 100%); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 8px 16px -10px rgba(13, 17, 40, 0.8); }
.checks .check { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 4px 10px -6px rgba(108, 92, 231, 0.6); }
.footer-access .icon { background: linear-gradient(145deg, #8E80F6, var(--purple) 60%, #4A3BC4); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 6px 14px -8px rgba(108, 92, 231, 0.9); }
.eyebrow .icon { width: 1.35em; height: 1.35em; }
html[data-theme="dark"] .tile, html[data-theme="dark"] .stat .tile, html[data-theme="dark"] .badge-pill .dot, html[data-theme="dark"] .checks .check,
html[data-theme="dark"] .toast-icon, html[data-theme="dark"] .bot-feats .icon, html[data-theme="dark"] .topic-hub .tile {
  background: radial-gradient(120% 120% at 28% 18%, #3A4290 0%, var(--lav-100) 55%, #1B2150 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16), inset 0 -3px 6px rgba(0, 0, 0, 0.25), 0 8px 16px -10px rgba(0, 0, 0, 0.8);
}
html[data-theme="dark"] .tile.is-orange { background: radial-gradient(120% 120% at 28% 18%, #5A3A22 0%, #3A2716 100%); }
html[data-theme="dark"] .icon .s { stroke-opacity: 0.35; }

/* Header logo tile: the white-line brain mark. */
.brand-mark img { width: 36px; height: 36px; }

/* Explainers: a touch more depth around each illustration. */
.explainer { background: linear-gradient(180deg, var(--surface), color-mix(in srgb, var(--surface) 70%, var(--lav-100))); }
.explainer svg.pupil-eye { border-radius: 16px; box-shadow: inset 0 0 0 1px var(--line); }
.explainer .ex-title .icon { width: 1.3em; height: 1.3em; color: var(--purple); }
html[data-theme="dark"] .explainer .ex-title .icon { color: var(--accent-text); }
html[data-theme="dark"] .mc-ms circle { stroke: var(--surface); }
html[data-theme="dark"] .nf-myelin rect { stroke: #8C82F0; }

/* Chapter explainers: one per row, illustration beside its text on wide screens. */
.chapter .explainers { grid-template-columns: 1fr; }
@media (min-width: 980px) {
  .chapter .explainer { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); grid-template-rows: auto auto 1fr auto; column-gap: 26px; align-items: start; padding: 22px 24px; }
  .chapter .explainer > svg { grid-column: 1; grid-row: 1 / span 3; align-self: center; }
  .chapter .explainer > .ex-title { grid-column: 2; grid-row: 1; margin-top: 4px; }
  .chapter .explainer > figcaption { grid-column: 2; grid-row: 2; margin-top: 0; }
  .chapter .explainer > .pupil-range { grid-column: 1; grid-row: 4; }
}
.modal-art img { height: 132px; width: auto; }
.fact-presenter .host-circle img { height: 140px; width: auto; max-width: none; }
.night-lumi { height: 150px; }
.night-lumi-small { height: 140px; }
.page-hero-art img.logo-tile { width: 62%; height: auto; max-width: none; border-radius: 26%; box-shadow: 0 18px 30px -16px rgba(108, 92, 231, 0.8); }

/* Character cut-outs (WebP, white sticker border): a soft shadow lifts them off the page. */
img[src*="assets/characters/"]:not([src*="/faces/"]):not(.night-lumi):not(.night-lumi-small) { filter: drop-shadow(0 6px 9px rgba(13, 17, 40, 0.16)); }
html[data-theme="dark"] img[src*="assets/characters/"]:not([src*="/faces/"]):not(.night-lumi):not(.night-lumi-small) { filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.45)); }

/* ------------------------------------- 16. public site and app shell (2.3) */

/* js/prefs.js is redirecting: do not paint the page that is being left. */
html.gate-leaving body { visibility: hidden; }

/* Logo tile: the team's wireframe brain on a purple-to-navy square. */
.brand-mark { background: linear-gradient(140deg, #7B6CF0 0%, #5A4AD6 48%, #1B1F4F 100%); }
.brand-mark img { width: 38px; height: 38px; }

/* Public header: "Sign in" + "Get started", or "My Medulla" once signed in. */
.header-auth { display: inline-flex; align-items: center; gap: 8px; }
.header-auth .auth-in { display: none; }
.nav-auth { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; padding: 14px 14px 4px; border-top: 1px solid var(--line); }
@media (min-width: 600px) {
  .header-auth .auth-in { display: inline-flex; }
  .nav-auth { display: none; }
}
.app-pill { gap: 8px; padding: 3px 16px 3px 3px; white-space: nowrap; }
.app-pill .me-avatar { width: 34px; height: 34px; }
@media (max-width: 599px) {
  .app-pill { padding: 3px; }
  .app-pill > span:last-child { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}
@media (max-width: 419px) {
  .site-header .brand-tag { display: none; }
  .header-auth .btn { padding-inline: 14px; }
}
.footer-grid--site { grid-template-columns: 1fr 1fr; }
.footer-grid--site > div:first-child, .footer-grid--site > div:last-child { grid-column: 1 / -1; }
.footer-grid--site .footer-links { grid-template-columns: 1fr; }
@media (min-width: 900px) {
  .footer-grid--site { grid-template-columns: 1.3fr 0.8fr 0.8fr 1.1fr; }
  .footer-grid--site > div:first-child, .footer-grid--site > div:last-child { grid-column: auto; }
}

/* App (2.4): game-style top bar (HUD), avatar menu, bottom tab bar on phones.
   Navy in both themes so the app has its own frame; chunky tabs with a
   "pressed key" edge; the avatar wears a ring that fills towards the next level. */
html[data-shell="app"] { --hud-h: 68px; }
.app-hud.site-header {
  background: linear-gradient(180deg, #141A40, #0B0F24);
  border-bottom: 1px solid rgba(162, 155, 254, 0.18);
  box-shadow: 0 12px 30px -20px rgba(13, 17, 40, 0.8);
  color: var(--white);
}
.hud { display: flex; align-items: center; gap: 12px; width: min(100% - 2 * var(--gutter), 1240px); min-height: var(--hud-h); margin-inline: auto; }
.app-hud .brand, .app-hud .brand:hover { color: var(--white); }
.app-hud .brand-tag { color: var(--lavender); }
.hud-tabs { display: none; }
.hud-right { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.hud-ico {
  display: inline-grid; place-items: center; flex: none; width: 32px; height: 32px; border-radius: 11px;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.04));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), inset 0 -2px 0 rgba(0, 0, 0, 0.25);
  color: #C9C2FF;
}
.hud-ico .icon { width: 20px; height: 20px; }
[data-app-item="daily"] .hud-ico, [data-app-item="lab"] .hud-ico, [data-app-item="activities"] .hud-ico { color: #FFC28C; }
.hud-tab {
  display: inline-flex; align-items: center; gap: 9px; min-height: 48px; padding: 0 16px 0 8px;
  border: 1px solid transparent; border-radius: 16px;
  color: rgba(255, 255, 255, 0.84); font-family: var(--font-head); font-size: 0.95rem; font-weight: 700; text-decoration: none; white-space: nowrap;
  transition: transform 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}
.hud-tab:hover { color: var(--white); background: rgba(255, 255, 255, 0.07); transform: translateY(-1px); }
.hud-tab[aria-current="page"] {
  color: var(--white); border-color: rgba(255, 255, 255, 0.18);
  background: linear-gradient(180deg, #8475F2, var(--purple) 60%, #5646D6);
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.22), 0 10px 22px -10px rgba(108, 92, 231, 0.95);
}
.hud-tab[aria-current="page"] .hud-ico { background: var(--white); color: var(--purple); }
.app-hud :focus-visible { outline-color: var(--orange); }
.hud-chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 14px 0 6px;
  border: 1px solid rgba(255, 255, 255, 0.14); border-radius: 999px; background: rgba(255, 255, 255, 0.07);
  color: var(--white); font-family: var(--font-head); font-weight: 700; text-decoration: none;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.25);
}
.hud-chip:hover { color: var(--white); border-color: rgba(255, 255, 255, 0.32); }
.hud-chip .hud-ico { width: 32px; height: 32px; border-radius: 50%; color: rgba(255, 255, 255, 0.6); }
.hud-chip.is-lit .hud-ico { color: var(--orange); background: radial-gradient(circle at 35% 30%, rgba(255, 159, 67, 0.38), rgba(255, 159, 67, 0.08)); }
.app-hud .icon-btn { border-color: rgba(255, 255, 255, 0.14); background: rgba(255, 255, 255, 0.07); color: var(--white); box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.25); }
.app-hud .icon-btn:hover { border-color: rgba(255, 255, 255, 0.32); }
.app-hud .icon-btn[aria-expanded="true"] { border-color: var(--lavender); background: rgba(108, 92, 231, 0.45); color: var(--white); }
.app-hud .ax-toggle-text { display: none !important; }
.hud-me {
  position: relative; display: grid; place-items: center; flex: none; width: 52px; height: 52px; padding: 0;
  border: 0; border-radius: 50%; cursor: pointer;
  background: conic-gradient(var(--orange) var(--pct, 0%), rgba(255, 255, 255, 0.16) 0);
}
.hud-me .me-avatar { width: 44px; height: 44px; box-shadow: 0 0 0 3px #0E1330; }
.hud-me:hover, .hud-me[aria-expanded="true"] { box-shadow: 0 0 0 3px rgba(162, 155, 254, 0.5); }
.hud-lv {
  position: absolute; right: -4px; bottom: -3px; min-width: 22px; height: 22px; padding: 0 5px;
  border-radius: 999px; background: linear-gradient(180deg, #FFB874, var(--orange));
  color: var(--navy); font-family: var(--font-head); font-size: 0.72rem; font-weight: 700; line-height: 22px; text-align: center;
  box-shadow: 0 0 0 2px #0E1330;
}

/* The avatar's menu */
.hud-menu {
  position: absolute; z-index: 80; top: calc(100% + 8px); right: max(var(--gutter), calc((100vw - 1240px) / 2));
  display: grid; gap: 12px; width: min(340px, calc(100vw - 2 * var(--gutter)));
  max-height: calc(100vh - var(--hud-h) - 24px); overflow-y: auto; padding: 14px;
  border: 1px solid var(--line); border-radius: 22px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow-2);
}
.hud-menu .hud-ico { background: linear-gradient(140deg, var(--lav-100), var(--lav-200)); color: var(--purple); box-shadow: none; }
html[data-theme="dark"] .hud-menu .hud-ico { color: var(--accent-text); }
.hud-menu-me { display: grid; grid-template-columns: auto 1fr; gap: 8px 12px; align-items: center; padding: 12px; border-radius: 16px; background: linear-gradient(140deg, var(--lav-100), var(--bg-soft)); }
.hud-menu-me .me-avatar { width: 48px; height: 48px; }
.hud-menu-me strong { display: block; color: var(--ink); font-family: var(--font-head); line-height: 1.25; }
.hud-menu-me small { display: block; color: var(--ink-3); font-size: 0.82rem; }
.hud-bar { grid-column: 1 / -1; display: block; height: 8px; overflow: hidden; border-radius: 999px; background: var(--surface); }
.hud-bar span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--purple), var(--orange)); }
.hud-menu-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.hud-menu-tile {
  display: grid; justify-items: start; gap: 8px; padding: 12px;
  border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: inset 0 -3px 0 var(--line);
  color: var(--ink); font-size: 0.9rem; font-weight: 700; text-decoration: none;
}
.hud-menu-tile:hover { border-color: var(--lav-300); color: var(--ink); }
.hud-menu-tile[aria-current="page"] { border-color: var(--purple); background: var(--lav-100); }
.hud-menu-list { list-style: none; display: grid; gap: 2px; }
.hud-menu-link {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 48px; padding: 4px 8px;
  border: 0; border-radius: 14px; background: transparent;
  color: var(--ink); font: inherit; font-weight: 700; text-align: left; text-decoration: none; cursor: pointer;
}
.hud-menu-link:hover { background: var(--bg-soft); color: var(--ink); }
.hud-menu-link[aria-current="page"] { background: var(--lav-100); }
.hud-menu-link.is-out .hud-ico { background: var(--orange-100); color: #B5560A; }
html[data-theme="dark"] .hud-menu-link.is-out .hud-ico { color: #FFC08A; }
.hud-menu-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 12px; border-top: 1px solid var(--line); }
.app-hud .hud-menu .icon-btn { border-color: var(--line); background: var(--surface); color: var(--ink); box-shadow: none; }
.app-hud .hud-menu .sound-btn[aria-pressed="true"] { border-color: var(--lav-300); background: var(--lav-100); color: var(--purple); }
.hud-menu-guest { display: grid; grid-template-columns: auto 1fr; gap: 10px 12px; align-items: center; padding: 12px; border-radius: 16px; background: var(--bg-soft); }
.hud-menu-guest img { width: auto; height: 64px; }
.hud-menu-guest p { margin: 0; color: var(--ink-3); font-size: 0.88rem; line-height: 1.45; }
.hud-menu-guest strong { display: block; color: var(--ink); }
.hud-menu-guest .btn { grid-column: 1 / -1; justify-self: start; }

.app-foot { margin-top: 28px; padding-block: 24px 30px; border-top: 1px solid var(--line); color: var(--ink-3); font-size: 0.84rem; }
.app-foot p { margin: 0 0 6px; }
html[data-shell="app"] .page-hero { padding-block: 28px 26px; }

/* Phones and tablets: bottom tab bar, the active tab pops up. */
.app-tabbar {
  position: fixed; z-index: 60; left: 0; right: 0; bottom: 0;
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px;
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, #141A40, #0B0F24);
  border-top: 1px solid rgba(162, 155, 254, 0.2); box-shadow: 0 -12px 30px -18px rgba(13, 17, 40, 0.6);
}
.app-tab {
  display: grid; justify-items: center; align-content: center; gap: 4px; min-height: 58px; padding: 4px 2px;
  border-radius: 16px; color: rgba(255, 255, 255, 0.74); font-size: 0.7rem; font-weight: 700; line-height: 1.15; text-align: center; text-decoration: none;
}
.app-tab:hover { color: var(--white); }
.app-tab .hud-label { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-tab .hud-ico { width: 42px; height: 32px; border-radius: 12px; transition: transform 0.2s cubic-bezier(.3, 1.4, .5, 1); }
.app-tab[aria-current="page"] { color: var(--white); }
.app-tab[aria-current="page"] .hud-ico {
  background: linear-gradient(180deg, #8475F2, var(--purple) 60%, #5646D6); color: var(--white);
  transform: translateY(-6px) scale(1.08);
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.25), 0 8px 16px -6px rgba(108, 92, 231, 0.95);
}
html.calm .app-tab .hud-ico { transition: none; }
html[data-shell="app"] body { padding-bottom: calc(82px + env(safe-area-inset-bottom)); }
html[data-shell="app"] .toasts { bottom: calc(92px + env(safe-area-inset-bottom)); }
@media (max-width: 479px) { .app-hud .brand-text { display: none; } }
@media (max-width: 380px) { .app-hud .ax-toggle { display: none; } }
@media (min-width: 960px) {
  .hud-tabs { display: flex; gap: 6px; margin-inline: auto; }
  .app-tabbar { display: none; }
  html[data-shell="app"] body { padding-bottom: 0; }
  html[data-shell="app"] .toasts { bottom: 16px; }
}
@media (min-width: 960px) and (max-width: 1179px) {
  .app-hud .brand-text { display: none; }
  .hud-tab { padding-right: 12px; }
}
/* Larger text or wider spacing: keep the bottom tabs a little longer. */
@media (min-width: 960px) and (max-width: 1399px) {
  html:is([data-text="2"], [data-text="3"], .a11y-spacing, .a11y-dyslexia) .hud-tabs { display: none; }
  html:is([data-text="2"], [data-text="3"], .a11y-spacing, .a11y-dyslexia) .app-tabbar { display: grid; }
  html:is([data-text="2"], [data-text="3"], .a11y-spacing, .a11y-dyslexia)[data-shell="app"] body { padding-bottom: calc(82px + env(safe-area-inset-bottom)); }
}
@media print {
  html[data-shell="app"] body { padding: 0 !important; }
  .app-tabbar, .hud-menu { display: none !important; }
}

/* Brain map (My Medulla dashboard) */
.map-grid { display: grid; gap: 16px; }
@media (min-width: 960px) { .map-grid { grid-template-columns: minmax(0, 1.12fr) minmax(0, 1fr); align-items: start; } }
.map-card .card-head { align-items: flex-start; }
.map-card .chip .icon { width: 14px; height: 14px; }
.map-stage { position: relative; width: min(100%, 500px); aspect-ratio: 1; margin: 30px auto 0; }
.map-stage::before { content: ""; position: absolute; inset: 10%; border-radius: 50%; background: radial-gradient(closest-side, rgba(162, 155, 254, 0.3), transparent); }
.map-lines { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.map-lines line { stroke: var(--line-2); stroke-width: 2.5; stroke-linecap: round; stroke-dasharray: 2 9; vector-effect: non-scaling-stroke; }
.map-lines .map-spoke.is-on { stroke: var(--purple); stroke-width: 4; stroke-dasharray: 12 10; }
.map-lines .map-edge.is-on { stroke: var(--orange); stroke-width: 4; stroke-dasharray: none; }
html:not(.calm) .map-lines .map-spoke.is-on { animation: map-flow 1.4s linear infinite; }
@keyframes map-flow { to { stroke-dashoffset: -22; } }
@media (prefers-reduced-motion: reduce) { .map-lines .map-spoke.is-on { animation: none !important; } }
html[data-theme="dark"] .map-lines .map-spoke.is-on { stroke: #9A8FFA; }
.map-core {
  position: absolute; left: 50%; top: 50%; width: 31%; aspect-ratio: 1; transform: translate(-50%, -50%);
  display: grid; place-items: center; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, var(--white), var(--lav-100) 72%);
  box-shadow: 0 0 0 7px rgba(162, 155, 254, 0.22), 0 18px 40px -16px rgba(108, 92, 231, 0.7);
}
html[data-theme="dark"] .map-core { background: radial-gradient(circle at 35% 30%, #343C82, #171C42 72%); }
.map-core-art { display: grid; place-items: end center; width: 100%; height: 100%; overflow: hidden; border-radius: 50%; }
.map-core-art img { width: auto; height: 84%; max-width: 92%; object-fit: contain; }
.map-count {
  position: absolute; left: 50%; bottom: -10px; transform: translateX(-50%); padding: 2px 11px; border-radius: 999px;
  background: var(--navy); color: var(--white); font-family: var(--font-head); font-size: 0.85rem; font-weight: 700; white-space: nowrap;
  box-shadow: 0 0 0 3px var(--surface);
}
.map-stage.is-full .map-core { box-shadow: 0 0 0 7px rgba(255, 159, 67, 0.4), 0 0 46px rgba(255, 159, 67, 0.55); }
.map-stage.is-full .map-count { background: var(--orange); color: var(--navy); }
.map-node {
  position: absolute; transform: translate(-50%, -50%); display: grid; justify-items: center; gap: 4px; width: 23%;
  padding: 0; border: 0; background: none; color: var(--ink); font: inherit; cursor: pointer;
}
.map-orb {
  position: relative; display: block; width: 100%; aspect-ratio: 1; padding: 5px; border-radius: 50%;
  background: conic-gradient(var(--lavender) var(--pct), var(--line) 0);
  transition: transform 0.2s cubic-bezier(.3, 1.4, .5, 1), box-shadow 0.2s ease;
}
.map-orb img { display: block; width: 100%; height: 100%; border-radius: 50%; background: var(--tint); object-fit: cover; filter: grayscale(0.85) opacity(0.65); transition: filter 0.3s ease; }
.map-node.is-lit .map-orb { background: conic-gradient(var(--orange) var(--pct), var(--purple) 0); box-shadow: 0 0 26px rgba(108, 92, 231, 0.55); }
.map-node.is-lit .map-orb img { filter: none; }
.map-node:hover .map-orb { transform: scale(1.05); }
.map-node:focus-visible { outline: none; }
.map-node:focus-visible .map-orb { outline: 3px solid var(--orange); outline-offset: 3px; }
.map-lv {
  position: absolute; right: -3px; top: -3px; min-width: 24px; height: 24px; padding: 0 6px; border-radius: 999px;
  background: var(--navy); color: var(--white); font-family: var(--font-head); font-size: 0.74rem; font-weight: 700; line-height: 24px; text-align: center;
  box-shadow: 0 0 0 2px var(--surface);
}
.map-node.is-lit .map-lv { background: var(--orange); color: var(--navy); }
.map-name {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface); box-shadow: var(--shadow-1);
  color: var(--ink); font-size: 0.78rem; font-weight: 800; white-space: nowrap;
}
.map-name .icon { width: 14px; height: 14px; color: var(--purple); }
html[data-theme="dark"] .map-name .icon { color: var(--accent-text); }
.map-node[aria-pressed="true"] .map-name { border-color: var(--purple); background: var(--purple); color: var(--white); }
.map-node[aria-pressed="true"] .map-name .icon { color: var(--white); }
.map-hint { margin: 18px 0 0; font-size: 0.85rem; text-align: center; }
@media (max-width: 420px) { .map-name { padding: 2px 7px; font-size: 0.7rem; } .map-name .icon { display: none; } .map-lv { min-width: 20px; height: 20px; font-size: 0.66rem; line-height: 20px; } }

/* The selected area */
.area-head { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.area-head h2 { margin: 0 0 6px; font-size: 1.35rem; }
.area-head .eyebrow { margin: 0 0 4px; }
.area-art { display: grid; place-items: end center; flex: none; overflow: hidden; width: 84px; height: 84px; border-radius: 26px; background: var(--tint); box-shadow: var(--shadow-1); }
.area-art img { width: auto; height: 88%; max-width: 92%; object-fit: contain; }
.area-state { display: inline-flex; align-items: center; gap: 6px; margin: 0; padding: 3px 10px; border-radius: 999px; background: var(--bg-soft); color: var(--ink-3); font-size: 0.82rem; font-weight: 700; }
.area-state .icon { width: 14px; height: 14px; }
.area-state.is-on { background: var(--lav-100); color: var(--purple-600); }
.area-level { display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; align-items: center; margin: 4px 0 12px; }
.area-level strong { color: var(--ink); font-family: var(--font-head); font-size: 0.9rem; }
.area-level small { grid-column: 1 / -1; color: var(--ink-3); font-size: 0.8rem; }
.area-what { margin: 0 0 14px; color: var(--ink-2); }
.ci-row { min-width: 0; margin: 0 0 12px; padding: 0; border: 0; }
.ci-row legend, .ci-legend { margin: 0 0 8px; padding: 0; color: var(--ink); font-weight: 800; }
.ci-legend { margin-top: 16px; }
.ci-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.ci-chip {
  display: inline-grid; justify-items: center; align-content: center; min-width: 58px; min-height: 54px; padding: 6px 10px;
  border: 1.5px solid var(--line-2); border-radius: 16px; background: var(--surface); box-shadow: inset 0 -3px 0 var(--line);
  color: var(--ink); font: inherit; cursor: pointer;
  transition: transform 0.12s ease, border-color 0.12s ease, background-color 0.12s ease;
}
.ci-chip strong { font-family: var(--font-head); font-size: 1.05rem; line-height: 1.1; }
.ci-chip small { color: var(--ink-3); font-size: 0.7rem; font-weight: 700; }
.ci-chip:hover { border-color: var(--purple); transform: translateY(-1px); }
.ci-chip[aria-pressed="true"] { border-color: var(--purple); background: linear-gradient(180deg, #8475F2, var(--purple)); color: var(--white); box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.2), var(--shadow-p); }
.ci-chip[aria-pressed="true"] small { color: rgba(255, 255, 255, 0.9); }
/* Mood check-in: one colourful face per mood; the chosen one fills with its own colour. */
.ci-chips.is-mood { gap: 10px; }
.ci-chips.is-mood .ci-chip {
  flex: 1 1 0; min-width: 0; padding: 12px 2px 10px; gap: 6px; border-radius: 20px;
  background: linear-gradient(180deg, var(--surface), color-mix(in srgb, var(--mood-soft, var(--lav-100)) 22%, var(--surface)));
  transition: transform 0.18s cubic-bezier(.3, 1.6, .5, 1), border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}
.ci-chips.is-mood .ci-chip small { color: var(--ink-2); font-size: 0.74rem; }
.ci-chips.is-mood .ci-chip:hover { border-color: var(--mood, var(--purple)); transform: translateY(-3px); }
.ci-chips.is-mood .ci-chip:hover .mood-face { transform: scale(1.08) rotate(-4deg); }
.ci-chips.is-mood .ci-chip[aria-pressed="true"] {
  border-color: var(--mood, var(--purple)); color: var(--ink);
  background: linear-gradient(180deg, color-mix(in srgb, var(--mood-soft) 55%, var(--surface)), color-mix(in srgb, var(--mood) 35%, var(--surface)));
  box-shadow: inset 0 -3px 0 color-mix(in srgb, var(--mood) 45%, transparent), 0 10px 22px -10px var(--mood);
}
.ci-chips.is-mood .ci-chip[aria-pressed="true"] small { color: var(--ink); font-weight: 800; }
.ci-chips.is-mood .ci-chip[aria-pressed="true"] .mood-face { transform: scale(1.14); }
.ci-chips.is-mood:has([aria-pressed="true"]) .ci-chip[aria-pressed="false"] .mood-face { filter: saturate(0.55); opacity: 0.75; }
.mood-face { display: block; width: 48px; height: 48px; overflow: visible; transition: transform 0.25s cubic-bezier(.3, 1.6, .5, 1), filter 0.2s, opacity 0.2s; filter: drop-shadow(0 3px 4px rgba(43, 35, 80, 0.12)); }
@media (prefers-reduced-motion: no-preference) {
  html:not(.calm) .ci-chips.is-mood .ci-chip[aria-pressed="true"] .mood-face { animation: mood-pop 0.45s cubic-bezier(.3, 1.8, .5, 1); }
}
@keyframes mood-pop { 0% { transform: scale(0.8); } 60% { transform: scale(1.22) rotate(6deg); } 100% { transform: scale(1.14); } }
@media (max-width: 420px) { .ci-chips.is-mood { gap: 6px; } .mood-face { width: 40px; height: 40px; } .ci-chips.is-mood .ci-chip small { font-size: 0.66rem; } }
.ci-hint { margin: -4px 0 12px; color: var(--ink-3); font-size: 0.85rem; }
.ci-support { display: flex; align-items: flex-start; gap: 10px; margin: 0 0 12px; padding: 10px 12px; border-radius: 14px; background: var(--orange-100); color: var(--ink-2); font-size: 0.88rem; }
.ci-support .icon { flex: none; width: 20px; height: 20px; color: #B5560A; }
html[data-theme="dark"] .ci-support .icon { color: #FFC08A; }
.quests { display: grid; gap: 8px; margin: 4px 0 12px; }
.quest {
  display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 8px 12px;
  border: 1.5px solid var(--line-2); border-radius: 16px; background: var(--surface); box-shadow: inset 0 -3px 0 var(--line);
  color: var(--ink); font-weight: 700; text-decoration: none;
}
.quest > span:nth-child(2) { flex: 1; }
.quest:hover { border-color: var(--purple); color: var(--ink); }
.quest-box { display: grid; place-items: center; flex: none; width: 30px; height: 30px; border-radius: 10px; background: var(--lav-100); color: var(--purple); }
html[data-theme="dark"] .quest-box { color: var(--accent-text); }
.quest-box .icon { width: 16px; height: 16px; }
.quest.is-done .quest-box { background: var(--purple); color: var(--white); }
.area-panel .kind-tasks { gap: 8px; }
.area-panel .kind-task { min-height: 48px; padding: 8px 12px; }
.area-why { display: flex; align-items: center; gap: 12px; margin-top: 16px; padding: 12px; border: 1.5px dashed var(--line-2); border-radius: 16px; background: var(--bg-soft); color: var(--ink); text-decoration: none; }
.area-why > span:nth-child(2) { flex: 1; }
.area-why small { display: block; color: var(--ink-3); font-size: 0.74rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.area-why strong { display: block; font-size: 0.95rem; }
.area-why .tile { width: 40px; height: 40px; }
.area-why:hover { border-color: var(--purple); color: var(--ink); }

/* Week, experiment, the project beyond the screen */
.map-more { margin-top: 16px; }
.map-more > * { min-width: 0; }
.wm-scroll { overflow-x: auto; }
.wm-table { width: 100%; border-collapse: separate; border-spacing: 4px; }
.wm-table thead th { color: var(--ink-3); font-size: 0.78rem; font-weight: 700; text-align: center; }
.wm-table thead th.is-today { color: var(--purple-600); }
.wm-table tbody th { padding-right: 6px; color: var(--ink); font-size: 0.86rem; font-weight: 700; text-align: left; white-space: nowrap; }
.wm-face { display: inline-grid; place-items: end center; overflow: hidden; width: 30px; height: 30px; margin-right: 8px; border-radius: 50%; background: var(--tint); vertical-align: middle; }
.wm-face img { width: 100%; height: 100%; }
.wm-table td { text-align: center; }
.wm-dot { display: inline-grid; place-items: center; width: 28px; height: 28px; border: 1.5px dashed var(--line-2); border-radius: 10px; background: var(--bg-soft); color: var(--white); }
.wm-dot .icon { width: 14px; height: 14px; }
.wm-table td.is-on .wm-dot { border: 0; background: linear-gradient(160deg, #8475F2, var(--purple)); box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.2); }
.wm-table td.is-today.is-on .wm-dot { background: linear-gradient(160deg, #FFB874, var(--orange)); color: var(--navy); }
.wm-note { margin: 10px 0 0; font-size: 0.82rem; }
@media (max-width: 480px) {
  .wm-table { border-spacing: 3px; }
  .wm-table tbody th > span:last-child { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .wm-face { margin-right: 0; }
  .wm-dot { width: 26px; height: 26px; border-radius: 9px; }
}
.experiment .card-head h2 { font-size: 1.15rem; }
.exp-faces { display: flex; }
.exp-faces img { width: 36px; height: 36px; margin-left: -8px; border: 2px solid var(--surface); border-radius: 50%; background: var(--lav-100); }
.exp-row { display: grid; grid-template-columns: 1fr auto auto; gap: 4px 10px; align-items: center; margin-bottom: 12px; }
.exp-row > span:first-child { grid-column: 1 / -1; color: var(--ink-3); font-size: 0.85rem; font-weight: 700; }
.exp-bar { height: 12px; overflow: hidden; border-radius: 999px; background: var(--lav-100); }
.exp-bar span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--purple), var(--lavender)); }
.exp-row strong { color: var(--ink); font-family: var(--font-head); }
.exp-row small { color: var(--ink-3); font-size: 0.78rem; }
.exp-diff { color: var(--ink); font-weight: 700; }
.exp-need { list-style: none; display: grid; gap: 8px; margin: 10px 0; }
.exp-need li { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 12px; background: var(--bg-soft); font-size: 0.9rem; }
.exp-need strong { color: var(--accent-text, var(--purple)); font-family: var(--font-head); }
.exp-honest { display: flex; align-items: flex-start; gap: 8px; margin: 10px 0 14px; color: var(--ink-3); font-size: 0.82rem; }
.exp-honest .icon { flex: none; width: 18px; height: 18px; }
.community { display: grid; gap: 18px; align-items: center; margin-top: 16px; background: linear-gradient(135deg, var(--lav-100), var(--surface) 62%); }
.community h2 { font-size: 1.4rem; }
.community p { color: var(--ink-2); }
.community-art { display: grid; place-items: center; width: 116px; height: 116px; border-radius: 34px; background: var(--surface); box-shadow: var(--shadow-1); }
.community-art img { width: auto; height: 96px; }
@media (min-width: 760px) { .community { grid-template-columns: auto 1fr; } }

/* "Me": sub-tabs and the five areas as skills */
.seg { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 16px; padding: 6px; border: 1px solid var(--line); border-radius: 20px; background: var(--bg-soft); scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg a { flex: 1 0 auto; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 14px; border-radius: 14px; color: var(--ink-3); font-size: 0.92rem; font-weight: 800; text-decoration: none; white-space: nowrap; }
.seg a .icon { width: 20px; height: 20px; }
.seg a:hover { background: var(--surface); color: var(--ink); }
.seg a[aria-current="page"] { background: linear-gradient(180deg, #8475F2, var(--purple)); color: var(--white); box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.2), var(--shadow-p); }
@media (max-width: 559px) { .seg { display: grid; grid-template-columns: 1fr 1fr; } }
.skills { margin-bottom: 16px; }
.xp-num { color: var(--accent-text, var(--purple)); font-family: var(--font-head); }
.skill-total { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.skill-total > div { flex: 1; }
.skill-total p { margin: 6px 0 0; color: var(--ink-3); font-size: 0.85rem; }
.skill-list { list-style: none; display: grid; gap: 12px; }
.skill-list li { display: grid; grid-template-columns: auto minmax(0, 1fr) minmax(80px, 1.2fr) auto; gap: 10px; align-items: center; }
.skill-list .wm-face { margin: 0; width: 38px; height: 38px; }
.skill-name strong { display: block; color: var(--ink); font-size: 0.95rem; }
.skill-name small { display: block; color: var(--ink-3); font-size: 0.76rem; }
.skill-lv { color: var(--ink); font-family: var(--font-head); font-size: 0.85rem; font-weight: 700; white-space: nowrap; }
@media (max-width: 560px) {
  .skill-list li { grid-template-columns: auto 1fr auto; }
  .skill-list .skill-lv { grid-column: 3; grid-row: 1; }
  .skill-list .meter { grid-column: 2 / -1; grid-row: 2; }
}

/* Sign-in page (start.html). */
.start { display: grid; min-height: 100vh; min-height: 100dvh; }
.start-brand {
  position: relative; display: flex; flex-direction: column; gap: 20px; padding: 14px var(--gutter); overflow: hidden;
  background:
    radial-gradient(70% 55% at 30% 32%, rgba(108, 92, 231, 0.55), transparent 70%),
    radial-gradient(50% 40% at 85% 95%, rgba(255, 159, 67, 0.12), transparent 70%),
    #0B0F24;
  color: rgba(255, 255, 255, 0.86);
}
.start-brand .brand, .start-brand .brand:hover { color: var(--white); }
.start-brand .brand-tag { color: var(--lavender); }
.start-brand-body, .start-cast { display: none; }
.start-main { display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 12px var(--gutter) 36px; }
.start-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; max-width: 560px; }
.start-home { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; font-weight: 700; text-decoration: none; }
.start-home .icon { width: 20px; height: 20px; }
.start-card { width: 100%; max-width: 560px; margin-block: auto; padding: 26px clamp(20px, 4vw, 40px) 30px; box-shadow: var(--shadow-2); }
.start-card h1 { margin-bottom: 8px; font-size: clamp(1.7rem, 1.3rem + 1.6vw, 2.3rem); }
.start-card h1:focus { outline: none; }
.start-card .lead { margin-bottom: 22px; font-size: 1rem; }
.start-hero-art { display: grid; place-items: end center; overflow: hidden; width: 104px; height: 104px; margin-bottom: 16px; border-radius: 30px; background: var(--tint, var(--lav-100)); box-shadow: var(--shadow-1); }
.start-hero-art img { width: auto; height: 90%; max-width: 92%; object-fit: contain; }
.start-step { display: grid; gap: 10px; margin-bottom: 22px; }
.start-step-label { display: flex; align-items: center; gap: 10px; margin: 0; color: var(--ink); font-weight: 800; }
.start-num { display: grid; place-items: center; flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--purple); color: var(--white); font-size: 0.8rem; }
.start-note { margin: 0; font-size: 0.86rem; }
.btn-block { display: flex; width: 100%; }
.start-alt { margin: 18px 0 0; color: var(--ink-3); font-size: 0.92rem; text-align: center; }
.start-alt .link-btn { font-size: 0.92rem; }
.start-alt .link-btn .icon { width: 16px; height: 16px; vertical-align: -3px; margin-right: 4px; }
.start-profile { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; padding: 14px; border: 1px solid var(--line); border-radius: 18px; background: var(--bg-soft); }
.start-profile .me-avatar { width: 54px; height: 54px; }
.start-profile strong { display: block; color: var(--ink); font-family: var(--font-head); font-size: 1.1rem; }
.start-profile small { display: block; color: var(--ink-3); font-size: 0.88rem; }
.start-foot { margin: 0; color: var(--ink-3); font-size: 0.88rem; text-align: center; }
.start-picker .avatar-option:focus-visible { outline-offset: 2px; }
.pop-in { animation: pop-in 0.35s cubic-bezier(.3, 1.5, .5, 1) both; }
@keyframes pop-in { from { transform: scale(0.82) translateY(6px); opacity: 0.4; } }
html.calm .pop-in { animation: none; }
@media (min-width: 960px) {
  .start { grid-template-columns: minmax(380px, 0.9fr) minmax(0, 1.1fr); }
  .start-brand { position: sticky; top: 0; height: 100vh; height: 100dvh; padding: 32px clamp(32px, 4vw, 56px); }
  .start-brand-body { display: grid; flex: 1; align-content: center; justify-items: start; gap: 22px; max-width: 470px; }
  .start-logo { width: min(290px, 72%); height: auto; filter: drop-shadow(0 18px 46px rgba(108, 92, 231, 0.6)); }
  html:not(.calm) .start-logo { animation: logo-float 7s ease-in-out infinite; }
  .start-brand h2 { margin: 0; color: var(--white); font-size: clamp(1.7rem, 1.1rem + 1.3vw, 2.35rem); }
  .start-points { list-style: none; display: grid; gap: 12px; }
  .start-points li { display: flex; align-items: center; gap: 12px; }
  .start-points .icon { flex: none; width: 36px; height: 36px; padding: 7px; border-radius: 12px; background: rgba(162, 155, 254, 0.16); color: var(--lavender); }
  .start-cast { display: flex; gap: 8px; }
  .start-cast img { width: 50px; height: 50px; border-radius: 50%; background: rgba(255, 255, 255, 0.1); }
  .start-main { justify-content: center; padding: 24px clamp(24px, 4vw, 56px) 32px; }
}
@keyframes logo-float { 50% { transform: translateY(-8px); } }
html.a11y-nodecor .start-logo, html.a11y-nodecor .start-cast { display: none; }

/* ------------------------------------------------ 18. top bar + avatars (2.5) */

/* Top bar icons: a little more body in the soft fill. */
.hud-ico .icon .f { fill-opacity: 0.3; }
.hud-chip.is-lit .hud-ico .icon .f { fill-opacity: 0.45; }

/* Expression avatars are square crops: they fill their circle or tile. */
.me-avatar.is-mood, .avatar-option.is-mood, .studio-avatar.is-mood { place-items: center; }
.me-avatar.is-mood img, .avatar-option.is-mood img, .studio-avatar.is-mood img { width: 100%; height: 100%; align-self: center; object-fit: cover; }

/* Avatar studio in "Men": preview, then character, expression, background. */
.avatar-studio { display: grid; gap: 8px; }
.studio-preview { display: flex; align-items: center; gap: 14px; margin-bottom: 6px; padding: 12px; border-radius: 20px; background: linear-gradient(140deg, var(--lav-100), var(--bg-soft)); }
.studio-preview p { margin: 0; display: grid; gap: 2px; }
.studio-preview strong { font-family: var(--font-head); font-size: 1.1rem; color: var(--ink); }
.studio-preview span { color: var(--ink-3); font-size: 0.88rem; }
.studio-avatar { display: grid; place-items: end center; overflow: hidden; flex: none; width: 76px; height: 76px; border-radius: 50%; background: var(--tint); box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--lav-300); }
.studio-avatar img { width: 100%; height: auto; }
.studio-label { margin: 8px 0 2px; color: var(--ink); font-weight: 700; }
.studio-mood { grid-template-columns: repeat(auto-fill, 52px); }
.studio-mood .avatar-option { border-radius: 50%; }
.studio-bg { display: flex; flex-wrap: wrap; gap: 10px; }
.bg-option {
  position: relative; display: grid; place-items: center; width: 44px; height: 44px; padding: 0;
  border: 2px solid var(--line); border-radius: 50%; background: var(--tint); cursor: pointer;
}
.bg-option[aria-checked="true"] { border-color: var(--purple); box-shadow: 0 0 0 3px var(--lav-200); }
.bg-option.is-locked { cursor: not-allowed; }
.bg-option.is-locked::before { content: ""; position: absolute; inset: 0; border-radius: 50%; background: rgba(13, 17, 40, 0.55); }
.bg-option.is-locked .icon { position: relative; width: 18px; height: 18px; color: var(--white); }
.bg-lv {
  position: absolute; right: -5px; bottom: -4px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 999px;
  background: var(--orange); color: var(--navy); font-size: 0.68rem; font-weight: 700; line-height: 18px; text-align: center;
}
.studio-note { margin: 4px 0 0; font-size: 0.85rem; }
.studio-char { grid-template-columns: repeat(5, minmax(0, 76px)); }
.studio-char .avatar-option { border-radius: 20px; }
/* A chosen avatar background stays as picked in both themes. */
[data-avbg] { background: var(--avbg) !important; }

/* Dark / light switch (2.5): a moon in the light theme, a sun in the dark one. */
.theme-btn .icon-sun { display: none; }
html[data-theme="dark"] .theme-btn .icon-sun { display: block; color: #FFC28C; }
html[data-theme="dark"] .theme-btn .icon-moon { display: none; }
@media (max-width: 419px) { .site-header:not(.app-hud) .theme-btn { display: none; } }
@media (max-width: 359px) { .app-hud .theme-btn { display: none; } }

/* Sign-in page fits one screen (2.5): the character sits beside the heading,
   and on shorter laptop screens everything is scaled to the window height. */
/* Header row: character beside the title; the lead stays one short line. */
.start-head { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; }
.start-head > div { min-width: 0; }
.start-head .start-hero-art { flex: none; width: 84px; height: 84px; margin: 0; border-radius: 26px; }
.start-head h1 { margin: 0 0 4px; }
.start-head .lead { margin: 0; font-size: 0.95rem; }
.start-card .start-step { margin-bottom: 16px; }
.start-card .start-step-label { font-size: 0.95rem; }
.start-card .nick-row { gap: 8px; }
.start-card .nick { font-size: 1.05rem; }
.start-name { margin-top: 4px; }
.start-card .start-note { font-size: 0.8rem; line-height: 1.4; }
.start-card .start-legal { margin-bottom: 12px; font-size: 0.8rem; }
.start-card .start-login { margin-top: 14px; gap: 10px; }
.start-card .login-consent { font-size: 0.82rem; }
.start-card .login-consent input { width: 18px; height: 18px; }
.start-card .login-buttons .btn { min-height: 44px; }
.start-cast img { object-fit: contain; }
@media (min-width: 960px) {
  .start { height: 100vh; height: 100dvh; min-height: 0; }
  .start-main { height: 100vh; height: 100dvh; overflow-y: auto; gap: clamp(8px, 1.6vh, 16px); padding-block: clamp(12px, 2.4vh, 24px); }
  .start-brand { padding-block: clamp(18px, 3.6vh, 32px); gap: clamp(10px, 2vh, 20px); }
  .start-brand-body { gap: clamp(12px, 2.4vh, 22px); }
  .start-logo { width: min(290px, 72%, 32vh); }
  .start-brand h2 { font-size: clamp(1.5rem, 0.6rem + 2.4vh, 2.35rem); }
  .start-points { gap: clamp(6px, 1.2vh, 12px); }
  .start-points .icon { width: clamp(30px, 4vh, 36px); height: clamp(30px, 4vh, 36px); padding: 6px; }
  .start-cast img { width: clamp(38px, 5.4vh, 50px); height: clamp(38px, 5.4vh, 50px); }
  .start-card { margin-block: 0; padding: clamp(18px, 3vh, 28px) clamp(22px, 3vw, 36px); }
  .start-card h1 { font-size: clamp(1.4rem, 0.6rem + 2.2vh, 1.9rem); }
  .start-picker .avatar-option { max-height: clamp(72px, 11vh, 110px); }
  .start-alt { margin-top: 12px; }
}
/* Sign-in brand panel: clean navy glow only (the 2.5 neuron photo sat behind the logo and made it look blurry). */
.start-brand > * { position: relative; z-index: 1; }

/* Sign in with Telegram / Google (2.7) */
.start-login { margin-top: 20px; display: grid; gap: 12px; }
.start-or { display: flex; align-items: center; gap: 12px; margin: 0; color: var(--ink-3); font-size: 0.9rem; }
.start-or::before, .start-or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.login-consent { display: flex; gap: 10px; align-items: flex-start; font-size: 0.92rem; color: var(--ink-2); cursor: pointer; }
.login-consent input { width: 20px; height: 20px; margin-top: 2px; flex: none; accent-color: var(--purple); }
.login-buttons { display: grid; gap: 10px; justify-items: center; }
.login-buttons .btn-block { width: 100%; }
.login-slot:empty { display: none; }
.tg-code { display: grid; gap: 8px; width: 100%; padding: 14px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface-2, rgba(108, 92, 231, 0.06)); }
.tg-code p { margin: 0; font-size: 0.92rem; color: var(--ink-2); white-space: pre-line; }
.tg-code label { font-weight: 800; font-size: 0.9rem; }
.tg-code-row { display: flex; gap: 8px; }
.tg-code-row .input { flex: 1; min-width: 0; text-transform: uppercase; letter-spacing: 0.12em; font-weight: 800; }

/* ---- 2.7: badge pop-up, profile name, legal line on sign-in ---- */
.badge-btn { display: grid; justify-items: center; gap: 6px; width: calc(100% + 20px); margin: -16px -10px -14px; padding: 16px 10px 14px; border: 0; border-radius: inherit; background: none; color: inherit; font: inherit; text-align: center; cursor: pointer; }
.badge-btn:focus-visible { outline: 3px solid var(--purple); outline-offset: 2px; }
.badge-btn:hover .badge-art { transform: scale(1.06); }
.badge-art { transition: transform 0.2s cubic-bezier(.3, 1.5, .5, 1); }
dialog.badge-pop { width: min(380px, calc(100% - 24px)); text-align: center; }
.badge-pop-body { justify-items: center; background: linear-gradient(180deg, var(--surface), var(--orange-100)); }
.badge-pop-body:not(.is-earned) { background: var(--surface); }
.badge-pop-art { position: relative; display: grid; place-items: center; width: 168px; height: 168px; }
.badge-pop-disc { position: relative; z-index: 1; display: grid; place-items: end center; overflow: hidden; width: 132px; height: 132px; border-radius: 50%; background: var(--tint); box-shadow: 0 0 0 4px var(--white), 0 0 0 7px var(--orange), 0 14px 30px -8px rgba(255, 159, 67, 0.7); }
.badge-pop-disc img { height: 86%; width: auto; max-width: 90%; object-fit: contain; }
.badge-pop-body:not(.is-earned) .badge-pop-disc { filter: grayscale(1); opacity: 0.6; box-shadow: 0 0 0 4px var(--white), 0 0 0 7px var(--line-2); }
.badge-pop-body:not(.is-earned) .badge-lock { right: 14px; bottom: 14px; width: 34px; height: 34px; }
.badge-rays { position: absolute; inset: 0; border-radius: 50%; background: repeating-conic-gradient(from 0deg, rgba(255, 159, 67, 0.55) 0 10deg, transparent 10deg 30deg); -webkit-mask: radial-gradient(circle, transparent 38%, #000 40%, #000 62%, transparent 72%); mask: radial-gradient(circle, transparent 38%, #000 40%, #000 62%, transparent 72%); }
.badge-pop-body .eyebrow { margin: 0; }
.badge-pop-how { margin: 0; color: var(--ink-2); }
.badge-pop-facts { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; color: var(--ink-3); font-size: 0.9rem; }
.badge-pop-facts li { display: flex; gap: 8px; align-items: center; justify-content: center; }
.badge-pop-facts .icon { width: 16px; height: 16px; color: var(--purple); }
.badge-pop-body .btn-row { justify-content: center; }
@media (prefers-reduced-motion: no-preference) {
  dialog.badge-pop[open] { animation: badge-pop-in 0.45s cubic-bezier(.3, 1.6, .5, 1) both; }
  dialog.badge-pop[open] .badge-pop-disc { animation: badge-bounce 0.7s 0.15s cubic-bezier(.3, 1.8, .5, 1) both; }
  .badge-rays { animation: badge-spin 14s linear infinite; }
}
html.calm dialog.badge-pop[open], html.calm dialog.badge-pop[open] .badge-pop-disc, html.calm .badge-rays { animation: none; }
@keyframes badge-pop-in { from { transform: scale(0.7) translateY(24px); opacity: 0; } }
@keyframes badge-bounce { 0% { transform: scale(0.3) rotate(-14deg); } 100% { transform: none; } }
@keyframes badge-spin { to { transform: rotate(360deg); } }
.start-legal { margin: 0; font-size: 0.86rem; color: var(--ink-3); line-height: 1.5; }
.start-legal a { color: var(--purple); font-weight: 700; text-decoration: underline; text-underline-offset: 2px; }
.start-name { margin-top: 12px; }
.profile-name-form { margin: 0 0 16px; }

.start-logo { image-rendering: auto; width: min(260px, 64%); aspect-ratio: 1; object-fit: contain; filter: drop-shadow(0 10px 28px rgba(108, 92, 231, 0.45)); }

/* Optional sync sits in a fold under the main button (keeps the card short). */
details.start-login { margin-top: 12px; padding: 0; border-top: 1px solid var(--line); }
details.start-login > summary { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; margin-top: 4px; color: var(--ink-2); font-size: 0.88rem; font-weight: 700; cursor: pointer; list-style: none; }
details.start-login > summary::-webkit-details-marker { display: none; }
details.start-login > summary::after { content: ""; width: 8px; height: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg) translateY(-2px); transition: transform 0.2s; }
details.start-login[open] > summary::after { transform: rotate(-135deg); }
details.start-login > summary:focus-visible { outline: 3px solid var(--purple); outline-offset: 2px; border-radius: 12px; }
details.start-login[open] { display: grid; gap: 10px; }
.start-home { white-space: nowrap; }

/* ---- Sign-in page refresh: starry brand panel, soft glow behind the card, livelier picker and name tag ---- */
.start-brand {
  background:
    radial-gradient(1.5px 1.5px at 12% 18%, rgba(255, 255, 255, 0.7), transparent 60%),
    radial-gradient(1px 1px at 72% 12%, rgba(255, 255, 255, 0.6), transparent 60%),
    radial-gradient(1.5px 1.5px at 86% 46%, rgba(255, 255, 255, 0.55), transparent 60%),
    radial-gradient(1px 1px at 22% 72%, rgba(255, 255, 255, 0.5), transparent 60%),
    radial-gradient(1.5px 1.5px at 58% 88%, rgba(255, 255, 255, 0.45), transparent 60%),
    radial-gradient(1px 1px at 40% 8%, rgba(255, 255, 255, 0.5), transparent 60%),
    radial-gradient(1px 1px at 94% 80%, rgba(255, 255, 255, 0.45), transparent 60%),
    radial-gradient(70% 55% at 30% 32%, rgba(108, 92, 231, 0.6), transparent 70%),
    radial-gradient(45% 35% at 90% 8%, rgba(116, 185, 255, 0.18), transparent 70%),
    radial-gradient(50% 40% at 85% 95%, rgba(255, 159, 67, 0.2), transparent 70%),
    linear-gradient(180deg, #0E1230, #090C1F);
}
.start-points li { padding: 6px 12px 6px 6px; border-radius: 16px; background: rgba(255, 255, 255, 0.04); border: 1px solid rgba(162, 155, 254, 0.12); }
.start-points .icon { background: linear-gradient(135deg, rgba(162, 155, 254, 0.3), rgba(108, 92, 231, 0.18)); }
.start-cast img { box-shadow: 0 0 0 2px rgba(162, 155, 254, 0.35); transition: transform 0.2s cubic-bezier(.3, 1.6, .5, 1); }
.start-cast img:hover { transform: translateY(-4px) scale(1.06); }
@media (min-width: 960px) {
  .start-brand-body { position: relative; }
  .start-brand-body::before {
    content: ""; position: absolute; z-index: -1; top: -4%; left: -6%; width: min(360px, 88%); aspect-ratio: 1; border-radius: 50%;
    background: radial-gradient(circle, rgba(162, 155, 254, 0.35), rgba(108, 92, 231, 0.12) 45%, transparent 70%);
    pointer-events: none;
  }
}

/* The light side: a soft lavender/peach glow so the card doesn't float on flat white. */
.start-main {
  background:
    radial-gradient(60% 45% at 85% 10%, rgba(162, 155, 254, 0.22), transparent 70%),
    radial-gradient(50% 40% at 10% 95%, rgba(255, 179, 120, 0.18), transparent 70%),
    var(--bg);
}
.start-card { position: relative; overflow: hidden; border-radius: 28px; border: 1px solid var(--line); box-shadow: 0 1px 0 rgba(255, 255, 255, 0.6) inset, 0 24px 60px -24px rgba(76, 60, 190, 0.35), var(--shadow-1); }
.start-card::before { content: ""; position: absolute; inset: 0 0 auto; height: 5px; background: linear-gradient(90deg, #A29BFE, var(--purple), #FF9F43); }
.start-hero-art { background: radial-gradient(circle at 50% 35%, #fff, var(--tint, var(--lav-100)) 70%); box-shadow: 0 0 0 4px var(--surface), 0 0 0 6px var(--lav-200), 0 14px 28px -12px rgba(108, 92, 231, 0.45); }
.start-num { background: linear-gradient(135deg, #8F84F5, var(--purple)); box-shadow: 0 4px 10px -3px rgba(108, 92, 231, 0.6); }
.start-chosen { margin-left: auto; padding: 3px 10px; border-radius: 999px; background: var(--lav-100); color: var(--purple-600, var(--purple)); font-family: var(--font-head); font-size: 0.82rem; font-weight: 700; }

/* Character picker: lift on hover, a clear ring and check on the chosen one. */
.start-picker { gap: 10px; }
.start-picker .avatar-option { position: relative; overflow: visible; border-radius: 20px; border-width: 2.5px; box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.05); transition: transform 0.2s cubic-bezier(.3, 1.6, .5, 1), box-shadow 0.2s, border-color 0.2s, filter 0.2s; }
.start-picker .avatar-option img { border-radius: 17px; }
.start-picker .avatar-option:hover { transform: translateY(-3px); }
.start-picker:has([aria-checked="true"]) .avatar-option[aria-checked="false"] { filter: saturate(0.75); }
.start-picker:has([aria-checked="true"]) .avatar-option[aria-checked="false"]:hover { filter: none; }
.start-picker .avatar-option[aria-checked="true"] { transform: translateY(-3px) scale(1.04); border-color: var(--purple); box-shadow: 0 0 0 4px var(--lav-200), 0 12px 22px -10px rgba(108, 92, 231, 0.7); }
.start-picker .avatar-option[aria-checked="true"]::after {
  content: ""; position: absolute; top: -8px; right: -8px; width: 24px; height: 24px; border-radius: 50%;
  background: var(--purple) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 12.5l4 4 8-9'/%3E%3C/svg%3E") center / 15px no-repeat;
  box-shadow: 0 0 0 3px var(--surface);
}

/* Nickname as a little name tag with the chosen face. */
.start-tag { padding: 8px 8px 8px 8px; border: 1.5px dashed var(--lav-200); border-radius: 18px; background: linear-gradient(90deg, var(--lav-100), transparent); }
.start-tag-pic { display: grid; place-items: center; overflow: hidden; flex: none; width: 40px; height: 40px; border-radius: 50%; background: var(--tint); box-shadow: 0 0 0 2px var(--surface); }
.start-tag-pic img { width: 100%; height: 100%; object-fit: cover; }
.start-tag .nick { flex: 1; min-width: 0; }
.start-tag .btn { background: var(--surface); }

/* Main button: gradient with a soft shine. */
.start-card [data-enter] { position: relative; overflow: hidden; min-height: 52px; border-radius: 16px; background: linear-gradient(135deg, #8F84F5, var(--purple) 55%, #5A48D8); box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.18), 0 14px 26px -12px rgba(108, 92, 231, 0.8); }
.start-card [data-enter]::after { content: ""; position: absolute; top: 0; bottom: 0; left: -40%; width: 30%; background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.35), transparent); transform: skewX(-20deg); pointer-events: none; }
@media (prefers-reduced-motion: no-preference) {
  html:not(.calm) .start-card [data-enter]::after { animation: start-shine 3.6s ease-in-out 1s infinite; }
}
@keyframes start-shine { 0% { left: -40%; } 35%, 100% { left: 130%; } }

html[data-theme="dark"] .start-main {
  background:
    radial-gradient(60% 45% at 85% 10%, rgba(108, 92, 231, 0.25), transparent 70%),
    radial-gradient(50% 40% at 10% 95%, rgba(255, 159, 67, 0.08), transparent 70%),
    var(--bg);
}
html[data-theme="dark"] .start-card { box-shadow: 0 24px 60px -24px rgba(0, 0, 0, 0.7); }
html[data-theme="dark"] .start-hero-art { background: radial-gradient(circle at 50% 35%, rgba(255, 255, 255, 0.35), var(--tint, var(--lav-100)) 70%); }
html[data-theme="dark"] .start-tag { border-color: rgba(162, 155, 254, 0.3); background: linear-gradient(90deg, rgba(108, 92, 231, 0.18), transparent); }
html[data-theme="dark"] .start-chosen { background: rgba(108, 92, 231, 0.25); color: var(--lavender); }
