/* BrainAPP: night "Observatoire" and day "Météo du futur" (DESIGN.md has the final say).
   Every colour, radius, spacing and duration is a custom property below; components only read them.
   Theme: html[data-theme="nuit"|"jour"], set by /theme.js before the first paint. */

/* ---------- Fonts (self-hosted: the CSP only allows 'self') ---------- */
@font-face {
  font-family: 'Geist'; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url(/fonts/geist-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Geist'; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url(/fonts/geist-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Geist Mono'; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url(/fonts/geist-mono-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Geist Mono'; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url(/fonts/geist-mono-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Unbounded'; font-style: normal; font-weight: 200 900; font-display: swap;
  src: url(/fonts/unbounded-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Unbounded'; font-style: normal; font-weight: 200 900; font-display: swap;
  src: url(/fonts/unbounded-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ---------- Shared tokens ---------- */
:root {
  --font-display: 'Unbounded', 'Geist', system-ui, sans-serif;
  --font-body: 'Geist', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  /* Type scale, validated 2026-11-21: 11 · 13 · 15 · 18 · 22 · 28 · 58 px. In rem, so it follows the phone's text size. */
  --fs-11: 0.6875rem;
  --fs-13: 0.8125rem;
  --fs-15: 0.9375rem;
  --fs-18: 1.125rem;
  --fs-22: 1.375rem;
  --fs-28: 1.75rem;
  --fs-58: 3.625rem;
  /* Text painted on a generative cover is part of the artwork (the real title sits below it): fixed like an image. */
  --fs-cover: 11px;
  /* Navigation labels grow with the text size up to 13 px, so the five entries always fit in the pill. */
  --fs-nav: min(var(--fs-11), 13px);
  /* Avatar initials scale with the avatar (fixed size), not with the text: the name is always written next to it. */
  --fs-avatar: 13px;
  --fs-avatar-lg: 22px;
  --fs-avatar-hero: 36px;
  --lh-tight: 1.1;
  --lh-snug: 1.3;
  --lh-body: 1.45;
  --track-label: 0.14em;
  --track-label-tight: 0.06em;

  /* Spacing */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-7: 28px;
  --sp-8: 32px;
  --gutter: 20px;
  --tap: 48px;
  --pill-h: 40px;
  --nav-side: 16px;
  --nav-bottom: calc(22px + env(safe-area-inset-bottom, 0px));
  --content-top: calc(56px + env(safe-area-inset-top, 0px));
  --content-bottom: calc(132px + env(safe-area-inset-bottom, 0px));
  --column: 600px;

  /* Radii (DESIGN.md: cards 22 to 30 px, covers 10 to 12 px, pills) */
  --r-pill: 999px;
  --r-tag: 5px;
  --r-cover-sm: 8px;
  --r-cover: 12px;
  --r-cover-lg: 14px;
  --r-tile: 18px;
  --r-row: 22px;
  --r-card: 24px;
  --r-hero: 24px;
  --r-sheet: 28px;

  /* Motion (DESIGN.md, validated 2026-11-21) */
  --dur-press: 100ms;
  --dur-state: 200ms;
  --dur-enter: 300ms;
  --dur-emphasis: 400ms;
  --dur-sequence: 700ms;
  --dur-fade: 200ms;
  --stagger: 40ms;
  --rise: 8px;
  --ease-enter: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-exit: cubic-bezier(0.4, 0, 1, 1);
  --ease-move: cubic-bezier(0.4, 0, 0.2, 1);
  --loop-orb: 5s;
  --loop-float: 6s;
  --loop-twinkle: 6s;
  --loop-drift: 18s;
  --loop-orbit: 20s;
  --loop-work: 2.4s;

  /* Weather icons (same in both themes) */
  --wx-sun: #FFC23A;
  --wx-ray: #FFB020;
  --wx-cloud: #FFFFFF;
  --wx-cloud-line: #A9BDD3;
  --wx-fog-line: #93A9C2;
}
@media (prefers-reduced-motion: reduce) {
  :root {
    --dur-press: 0ms; --dur-state: 0ms; --dur-enter: 0ms;
    --dur-emphasis: 0ms; --dur-sequence: 0ms; --dur-fade: 150ms;
    --stagger: 0ms; --rise: 0px;
  }
  *, *::before, *::after { animation: none !important; }
}

/* ---------- Night « Observatoire » ---------- */
html[data-theme="nuit"] {
  color-scheme: dark;
  --bg: #070A12;
  --text: #F3EFE6;
  --text-2: #C9CFDE;
  --text-muted: #98A2BC;
  --link: #A9C4FF;
  --link-hover: #D3E0FF;
  --focus: #A9C4FF;
  --selected-ink: #070A12;

  --action-bg: #F3EFE6;
  --action-text: #070A12;
  --action-shadow: 0 0 24px rgba(243, 239, 230, 0.18);
  --action-disabled-bg: rgba(243, 239, 230, 0.35);

  --glass-bg: rgba(13, 19, 34, 0.82);
  --glass-border: rgba(170, 190, 255, 0.16);
  --glass-shadow: none;
  --glass-blur: blur(18px);
  --card-bg: rgba(13, 19, 34, 0.6);
  --card-border: rgba(170, 190, 255, 0.14);
  --card-shadow: none;
  --card-blur: none;
  --soft-bg: rgba(141, 163, 255, 0.08);
  --soft-border: rgba(170, 190, 255, 0.18);
  --row-bg: rgba(141, 163, 255, 0.06);
  --row-border: rgba(170, 190, 255, 0.12);
  --line: rgba(170, 190, 255, 0.08);
  --rule: linear-gradient(90deg, rgba(169, 196, 255, 0.35), rgba(169, 196, 255, 0));
  --rule-glow: 0 0 10px rgba(169, 196, 255, 0.25);
  --dashed: rgba(170, 190, 255, 0.3);

  --chip-bg: rgba(141, 163, 255, 0.07);
  --chip-border: rgba(170, 190, 255, 0.16);
  --chip-text: #C9CFDE;
  --chip-shadow: none;
  --chip-on-bg: #F3EFE6;
  --chip-on-border: #F3EFE6;
  --chip-on-text: #070A12;
  --chip-on-count: #3A4256;
  --chip-on-shadow: none;

  --field-bg: rgba(141, 163, 255, 0.07);
  --field-border: rgba(170, 190, 255, 0.16);
  --field-focus-border: rgba(243, 239, 230, 0.7);
  --field-shadow: none;
  --placeholder: #98A2BC;

  --track-bg: rgba(141, 163, 255, 0.07);
  --track-border: rgba(170, 190, 255, 0.16);
  --track-shadow: none;
  --seg-on-bg: #F3EFE6;
  --seg-on-text: #070A12;
  --seg-on-shadow: none;
  --bar-track: rgba(255, 255, 255, 0.1);
  --bar-track-shadow: none;

  --btn2-bg: transparent;
  --btn2-border: rgba(170, 190, 255, 0.22);
  --btn2-text: #F3EFE6;
  --btn2-shadow: none;
  --danger: #FF9E7A;

  --nav-h: 66px;
  --nav-idle: #98A2BC;
  --nav-active: #F3EFE6;
  --add-size: 52px;
  --add-bg: #F3EFE6;
  --add-text: #070A12;
  --add-shadow: 0 0 24px rgba(243, 239, 230, 0.25);

  --orb-bg: radial-gradient(circle at 34% 30%, #E4ECFF 0 18%, #8EA8FF 46%, #26305C 100%);
  --orb-rest: 0 0 16px 2px rgba(169, 196, 255, 0.35);
  --orb-glow: 0 0 28px 6px rgba(169, 196, 255, 0.6);

  --sheet-bg: #0D1322;
  --sheet-border: rgba(170, 190, 255, 0.16);
  --sheet-grabber: rgba(170, 190, 255, 0.3);
  --backdrop: rgba(4, 6, 12, 0.66);
  --toast-bg: #F3EFE6;
  --toast-text: #070A12;
  --skeleton: rgba(141, 163, 255, 0.08);

  --tag-lib-bg: rgba(127, 224, 181, 0.14);
  --tag-lib-text: #7FE0B5;
  --tag-inf-bg: rgba(246, 199, 102, 0.14);
  --tag-inf-text: #F6C766;
  --tag-web-bg: rgba(169, 196, 255, 0.14);
  --tag-web-text: #A9C4FF;

  --h1-weight: 500;
  --big-weight: 400;
  --screen-gap: 28px;

  /* Domains: colour, night background; ink = colour (readable on the dark sky). */
  --neuro: #FF9E7A; --neuro-deep: #2A1712; --neuro-ink: #FF9E7A;
  --ia: #8EA8FF; --ia-deep: #141B3A; --ia-ink: #8EA8FF;
  --physique: #5FD3F3; --physique-deep: #0D2A33; --physique-ink: #5FD3F3;
  --psycho: #F6C766; --psycho-deep: #2B2210; --psycho-ink: #F6C766;
  --communication: #F48FB8; --communication-deep: #2E1320; --communication-ink: #F48FB8;
  --philo: #C5A8FF; --philo-deep: #1E1736; --philo-ink: #C5A8FF;
  --sf: #7FE0B5; --sf-deep: #0E2A20; --sf-ink: #7FE0B5;
  --none: #98A2BC; --none-deep: #161B2A; --none-ink: #C9CFDE;
  --cover-end: #080B14;
}

/* ---------- Day « Météo du futur » (matte: no gloss, no reflection layer) ---------- */
html[data-theme="jour"] {
  color-scheme: light;
  --bg: #EEF6FD;
  --text: #0F2540;
  --text-2: #24405F;
  --text-muted: #4A6280;
  --link: #0B72A8;
  --link-hover: #08557E;
  --focus: #0B72A8;
  --selected-ink: #08557E;

  --action-bg: #0B72A8;
  --action-text: #FFFFFF;
  --action-shadow: 5px 7px 14px rgba(11, 114, 168, 0.3), -4px -4px 10px rgba(255, 255, 255, 0.85), inset -2px -3px 6px rgba(0, 30, 60, 0.22);
  --action-disabled-bg: #8FB3CC;

  --raised-bg: linear-gradient(145deg, #F7FAFD, #E6EEF7);
  --raised-shadow: 5px 5px 12px rgba(110, 142, 182, 0.3), -5px -5px 12px rgba(255, 255, 255, 0.95);
  --pressed-bg: #E4EDF7;
  --pressed-shadow: inset 3px 3px 8px rgba(110, 142, 182, 0.38), inset -3px -3px 8px rgba(255, 255, 255, 0.95);
  --inset-bg: #E7EFF8;
  --inset-shadow: inset 4px 4px 10px rgba(110, 142, 182, 0.32), inset -4px -4px 10px rgba(255, 255, 255, 0.95);

  --glass-bg: rgba(255, 255, 255, 0.58);
  --glass-border: rgba(255, 255, 255, 0.8);
  --glass-shadow: 12px 16px 32px rgba(34, 92, 150, 0.16), -6px -6px 16px rgba(255, 255, 255, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.9);
  --glass-blur: blur(24px) saturate(1.4);
  --card-bg: rgba(255, 255, 255, 0.5);
  --card-border: rgba(255, 255, 255, 0.75);
  --card-shadow: 12px 16px 32px rgba(34, 92, 150, 0.12), -8px -8px 22px rgba(255, 255, 255, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.9);
  --card-blur: blur(24px) saturate(1.4);
  --soft-bg: rgba(255, 255, 255, 0.5);
  --soft-border: rgba(255, 255, 255, 0.75);
  --row-bg: rgba(255, 255, 255, 0.5);
  --row-border: rgba(255, 255, 255, 0.75);
  --line: rgba(110, 142, 182, 0.2);
  --rule: linear-gradient(90deg, rgba(110, 142, 182, 0.3), rgba(110, 142, 182, 0));
  --rule-glow: none;
  --dashed: rgba(74, 98, 128, 0.4);

  --chip-bg: var(--raised-bg);
  --chip-border: transparent;
  --chip-text: #24405F;
  --chip-shadow: var(--raised-shadow);
  --chip-on-bg: var(--pressed-bg);
  --chip-on-border: transparent;
  --chip-on-text: #08557E;
  --chip-on-count: #08557E;
  --chip-on-shadow: var(--pressed-shadow);

  --field-bg: var(--inset-bg);
  --field-border: transparent;
  --field-focus-border: #0B72A8;
  --field-shadow: var(--inset-shadow);
  --placeholder: #4A6280;

  --track-bg: var(--inset-bg);
  --track-border: transparent;
  --track-shadow: var(--inset-shadow);
  --seg-on-bg: linear-gradient(145deg, #FFFFFF, #EEF4FA);
  --seg-on-text: #08557E;
  --seg-on-shadow: inset 0 0 0 1.5px #0B72A8, 3px 3px 8px rgba(110, 142, 182, 0.3), -3px -3px 8px rgba(255, 255, 255, 0.95);
  --bar-track: #E3ECF6;
  --bar-track-shadow: inset 2px 2px 4px rgba(110, 142, 182, 0.35), inset -2px -2px 4px rgba(255, 255, 255, 0.9);

  --btn2-bg: var(--raised-bg);
  --btn2-border: transparent;
  --btn2-text: #0F2540;
  --btn2-shadow: var(--raised-shadow);
  --danger: #96391D;

  --nav-h: 68px;
  --nav-idle: #4A6280;
  --nav-active: #0B72A8;
  --add-size: 54px;
  --add-bg: radial-gradient(circle at 30% 26%, #5DBDF0 0%, #1186C4 52%, #0A5F8E 100%);
  --add-text: #FFFFFF;
  --add-shadow: 6px 8px 16px rgba(10, 95, 142, 0.35), -5px -5px 12px rgba(255, 255, 255, 0.85), inset -3px -5px 8px rgba(0, 20, 50, 0.22);

  --orb-bg: radial-gradient(circle at 30% 26%, #CDEFFF 0%, #3AAEE6 52%, #0B72A8 100%);
  --orb-rest: 6px 8px 16px rgba(11, 114, 168, 0.3), -5px -5px 12px rgba(255, 255, 255, 0.85), 0 0 0 6px rgba(58, 174, 230, 0.12);
  --orb-glow: 6px 8px 16px rgba(11, 114, 168, 0.3), -5px -5px 12px rgba(255, 255, 255, 0.85), 0 0 0 11px rgba(58, 174, 230, 0.06);

  --sheet-bg: #F4F8FC;
  --sheet-border: rgba(255, 255, 255, 0.9);
  --sheet-grabber: rgba(74, 98, 128, 0.35);
  --backdrop: rgba(15, 37, 64, 0.28);
  --toast-bg: #0F2540;
  --toast-text: #FFFFFF;
  --skeleton: rgba(255, 255, 255, 0.55);

  --tag-lib-bg: #D8F5E7;
  --tag-lib-text: #0E7A50;
  --tag-inf-bg: #FFF0CC;
  --tag-inf-text: #8A5A00;
  --tag-web-bg: #DDEFFF;
  --tag-web-text: #0B5C88;

  --sun-core: radial-gradient(circle at 34% 30%, #FFF1BF 0%, #FFC94A 50%, #FF9F1C 100%);
  --sun-glow: 0 0 36px rgba(255, 186, 60, 0.55);
  --cloud-bg: linear-gradient(145deg, #FFFFFF, #E7EFF8);
  --cloud-shadow: 6px 8px 14px rgba(110, 142, 182, 0.3), -3px -3px 8px rgba(255, 255, 255, 0.9);
  --fog: rgba(147, 169, 194, 0.45);

  --h1-weight: 400;
  --big-weight: 300;
  --screen-gap: 24px;

  /* Domains: colour, deep, tint, soft, ink (text always uses the ink: 5.2:1 or more on light fills). */
  --neuro: #FF7A50; --neuro-deep: #D9532A; --neuro-tint: #FFE8DE; --neuro-soft: #FFBEA6; --neuro-ink: #96391D;
  --ia: #5B7CFF; --ia-deep: #3D5BE0; --ia-tint: #E3E9FF; --ia-soft: #B2C1FF; --ia-ink: #3047AF;
  --physique: #19B6E0; --physique-deep: #0C8DB3; --physique-tint: #DDF6FD; --physique-soft: #9ADFF2; --physique-ink: #09647F;
  --psycho: #FFB52E; --psycho-deep: #D48A00; --psycho-tint: #FFF1D6; --psycho-soft: #FFD994; --psycho-ink: #885800;
  --communication: #FF6FA8; --communication-deep: #D4407E; --communication-tint: #FFE3EF; --communication-soft: #FFB8D4; --communication-ink: #992E5B;
  --philo: #9B7BFF; --philo-deep: #7652E8; --philo-tint: #EEE7FF; --philo-soft: #CDBDFF; --philo-ink: #583EAE;
  --sf: #2CCB8C; --sf-deep: #12A06B; --sf-tint: #DCF8EC; --sf-soft: #9AE8C8; --sf-ink: #0C6B48;
  --none: #A9BDD3; --none-deep: #4A6280; --none-tint: #F7FAFD; --none-soft: #E4EDF7; --none-ink: #4A6280;
}

/* Domain scope: components read --dh (colour), --dd (deep), --dt (tint), --ds (soft), --di (ink). */
.d-neuro { --dh: var(--neuro); --dd: var(--neuro-deep); --dt: var(--neuro-tint, var(--neuro-deep)); --ds: var(--neuro-soft, var(--neuro-deep)); --di: var(--neuro-ink); }
.d-ia { --dh: var(--ia); --dd: var(--ia-deep); --dt: var(--ia-tint, var(--ia-deep)); --ds: var(--ia-soft, var(--ia-deep)); --di: var(--ia-ink); }
.d-physique { --dh: var(--physique); --dd: var(--physique-deep); --dt: var(--physique-tint, var(--physique-deep)); --ds: var(--physique-soft, var(--physique-deep)); --di: var(--physique-ink); }
.d-psycho { --dh: var(--psycho); --dd: var(--psycho-deep); --dt: var(--psycho-tint, var(--psycho-deep)); --ds: var(--psycho-soft, var(--psycho-deep)); --di: var(--psycho-ink); }
.d-communication { --dh: var(--communication); --dd: var(--communication-deep); --dt: var(--communication-tint, var(--communication-deep)); --ds: var(--communication-soft, var(--communication-deep)); --di: var(--communication-ink); }
.d-philo { --dh: var(--philo); --dd: var(--philo-deep); --dt: var(--philo-tint, var(--philo-deep)); --ds: var(--philo-soft, var(--philo-deep)); --di: var(--philo-ink); }
.d-sf { --dh: var(--sf); --dd: var(--sf-deep); --dt: var(--sf-tint, var(--sf-deep)); --ds: var(--sf-soft, var(--sf-deep)); --di: var(--sf-ink); }
.d-none { --dh: var(--none); --dd: var(--none-deep); --dt: var(--none-tint, var(--none-deep)); --ds: var(--none-soft, var(--none-deep)); --di: var(--none-ink); }

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; background: var(--bg); }
body {
  margin: 0;
  min-height: 100dvh;
  background: transparent; /* the sky (z-index -1) must show through; html paints --bg on the canvas */
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--fs-15);
  line-height: var(--lh-body);
  -webkit-tap-highlight-color: transparent;
  overflow-wrap: break-word;
}
a { color: var(--link); text-decoration: none; }
a:hover { color: var(--link-hover); }
img { max-width: 100%; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
#view:focus, #view:focus-visible { outline: none; } /* focused by the router after each navigation, for screen readers */
h1, h2, h3, p { margin: 0; }
.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
html[data-theme="nuit"] .only-jour,
html[data-theme="jour"] .only-nuit { display: none !important; }

svg.i { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
svg.i--16 { width: 16px; height: 16px; stroke-width: 2; }
svg.i--14 { width: 14px; height: 14px; stroke-width: 2.4; }
svg.i--18 { width: 18px; height: 18px; stroke-width: 2.2; }

/* ---------- Sky ---------- */
.sky { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.sky > div { position: absolute; }
html[data-theme="nuit"] .sky { background: var(--bg); }
html[data-theme="nuit"] .sky__stars,
html[data-theme="nuit"] .sky__twinkle { inset: 0; background-size: 390px 320px; }
html[data-theme="nuit"] .sky__stars {
  background-image:
    radial-gradient(1px 1px at 22px 34px, rgba(243, 239, 230, 0.55) 50%, transparent 51%),
    radial-gradient(1px 1px at 140px 96px, rgba(243, 239, 230, 0.32) 50%, transparent 51%),
    radial-gradient(1px 1px at 262px 214px, rgba(243, 239, 230, 0.3) 50%, transparent 51%),
    radial-gradient(1px 1px at 84px 268px, rgba(243, 239, 230, 0.35) 50%, transparent 51%),
    radial-gradient(1px 1px at 196px 160px, rgba(243, 239, 230, 0.22) 50%, transparent 51%);
}
html[data-theme="nuit"] .sky__twinkle {
  background-image:
    radial-gradient(1.5px 1.5px at 318px 58px, rgba(243, 239, 230, 0.6) 50%, transparent 51%),
    radial-gradient(1px 1px at 52px 190px, rgba(243, 239, 230, 0.45) 50%, transparent 51%),
    radial-gradient(1px 1px at 350px 280px, rgba(243, 239, 230, 0.4) 50%, transparent 51%);
  animation: twinkle var(--loop-twinkle) ease-in-out infinite;
}
html[data-theme="nuit"] .sky__sun,
html[data-theme="nuit"] .sky__cloud { display: none; }

html[data-theme="jour"] .sky {
  background:
    radial-gradient(120% 55% at 92% -8%, rgba(255, 247, 214, 0.9) 0%, rgba(255, 247, 214, 0) 48%),
    radial-gradient(70% 20% at 8% 14%, rgba(255, 255, 255, 0.8), rgba(255, 255, 255, 0) 70%),
    radial-gradient(60% 16% at 84% 48%, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0) 70%),
    linear-gradient(180deg, #A6D6FF 0%, #D9F0FF 38%, #EEF6FD 72%, #F4F8FC 100%);
}
html[data-theme="jour"] .sky__stars,
html[data-theme="jour"] .sky__twinkle { display: none; }
html[data-theme="jour"] .sky__sun,
html[data-theme="jour"] .sky__cloud--b { display: none; }
html[data-theme="jour"] .sky__cloud {
  border-radius: 40px;
  background: radial-gradient(closest-side, rgba(255, 255, 255, 0.85), rgba(255, 255, 255, 0));
  animation: drift var(--loop-drift) ease-in-out infinite;
}
html[data-theme="jour"] .sky__cloud--a { left: -40px; top: 64px; width: 190px; height: 56px; }

@keyframes twinkle { 0%, 100% { opacity: 0.35; } 50% { opacity: 1; } }
@keyframes drift { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(12px); } }
@keyframes breathe-nuit { 0%, 100% { box-shadow: var(--orb-rest); } 50% { box-shadow: var(--orb-glow); } }
@keyframes rise { from { opacity: 0; transform: translateY(var(--rise)); } to { opacity: 1; transform: none; } }
@keyframes sheet-in { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Layout ---------- */
main {
  container: page / inline-size;
  max-width: var(--column);
  margin: 0 auto;
  padding: var(--content-top) max(var(--gutter), env(safe-area-inset-right, 0px)) var(--content-bottom) max(var(--gutter), env(safe-area-inset-left, 0px));
  outline: none;
}
.screen { display: flex; flex-direction: column; gap: var(--screen-gap); }
.screen > * { animation: rise var(--dur-enter) var(--ease-enter) both; }
.screen > :nth-child(2) { animation-delay: calc(var(--stagger) * 1); }
.screen > :nth-child(3) { animation-delay: calc(var(--stagger) * 2); }
.screen > :nth-child(4) { animation-delay: calc(var(--stagger) * 3); }
.screen > :nth-child(5) { animation-delay: calc(var(--stagger) * 4); }
.screen > :nth-child(n + 6) { animation-delay: calc(var(--stagger) * 5); }
.loading-line { color: var(--text-muted); }

.head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-3); }
.head__titles { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.head__actions { display: flex; align-items: center; gap: var(--sp-2); flex: none; }
@container page (max-width: 16em) {
  .head { flex-direction: column-reverse; align-items: stretch; }
  .head__actions { align-self: flex-end; }
}
.surtitle {
  font-family: var(--font-mono); font-size: var(--fs-11); line-height: var(--lh-snug);
  letter-spacing: var(--track-label); text-transform: uppercase; color: var(--text-muted);
}
.surtitle--accent { color: var(--link); }
html[data-theme="jour"] .surtitle--day { color: var(--link); }
.h1 {
  font-family: var(--font-display); font-weight: var(--h1-weight); line-height: var(--lh-tight); letter-spacing: -0.01em;
  /* 28 px; with a very large text size, capped so a word like « Bibliothèque » still fits on a 320 px screen. */
  font-size: min(var(--fs-28), 9vw);
}
.h2 { font-family: var(--font-display); font-weight: 500; font-size: var(--fs-18); line-height: var(--lh-snug); }
.lede { font-size: var(--fs-13); color: var(--text-muted); }
.muted { color: var(--text-muted); }
.text-2 { color: var(--text-2); }
.section { display: flex; flex-direction: column; gap: 14px; }
.section__head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); flex-wrap: wrap; }
.section__head .link-arrow { margin: -14px 0; }

/* ---------- Navigation (floating pill) ---------- */
.nav {
  position: fixed; z-index: 10;
  left: max(var(--nav-side), env(safe-area-inset-left, 0px));
  right: max(var(--nav-side), env(safe-area-inset-right, 0px));
  bottom: var(--nav-bottom);
  max-width: 520px; margin: 0 auto;
  height: var(--nav-h); padding: 0 10px;
  display: flex; align-items: stretch; justify-content: space-between;
  border-radius: var(--r-pill);
  background: var(--glass-bg); border: 1px solid var(--glass-border); box-shadow: var(--glass-shadow);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
}
.nav__item {
  flex: 1 1 0; min-width: var(--tap); max-width: 72px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-size: var(--fs-nav); line-height: 1.2; color: var(--nav-idle);
  transition: color var(--dur-state) var(--ease-move);
}
.nav__item:hover { color: var(--nav-active); }
.nav__item[aria-current="page"] { color: var(--nav-active); font-weight: 600; }
.nav__item svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.nav__add {
  align-self: center; flex: none; margin: 0 4px;
  width: var(--add-size); height: var(--add-size); border-radius: 50%; border: 0; padding: 0;
  display: grid; place-items: center;
  background: var(--add-bg); color: var(--add-text); box-shadow: var(--add-shadow);
  transition: transform var(--dur-press) var(--ease-move);
}
.nav__add:active { transform: scale(0.96); }
.nav__add svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }

/* ---------- Surfaces ---------- */
.card {
  display: flex; flex-direction: column; gap: 14px;
  padding: 20px 18px; border-radius: var(--r-card);
  background: var(--card-bg); border: 1px solid var(--card-border); box-shadow: var(--card-shadow);
  -webkit-backdrop-filter: var(--card-blur); backdrop-filter: var(--card-blur);
  color: var(--text);
}
.card--soft { background: var(--soft-bg); border-color: var(--soft-border); }
html[data-theme="jour"] .card { border-radius: calc(var(--r-card) + 2px); }
html[data-theme="jour"] .card--hero { border-radius: calc(var(--r-hero) + 6px); }
a.card { color: var(--text); }
a.card:hover { color: var(--text); }

/* ---------- Buttons ---------- */
.btn {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  min-height: var(--tap); padding: 6px 22px; border-radius: var(--r-pill);
  border: 1px solid transparent; background: transparent; color: var(--text);
  font-size: var(--fs-15); font-weight: 600; line-height: var(--lh-snug); text-align: center;
  transition: transform var(--dur-press) var(--ease-move), opacity var(--dur-state) var(--ease-move);
}
.btn:active { transform: scale(0.98); }
.btn:disabled, .btn[aria-disabled="true"] { cursor: default; transform: none; }
.btn--primary { background: var(--action-bg); color: var(--action-text); box-shadow: var(--action-shadow); }
.btn--primary:hover { color: var(--action-text); }
.btn--primary:disabled { background: var(--action-disabled-bg); box-shadow: none; }
.btn--secondary { background: var(--btn2-bg); border-color: var(--btn2-border); color: var(--btn2-text); box-shadow: var(--btn2-shadow); font-weight: 500; }
.btn--secondary:hover { color: var(--btn2-text); }
.btn--text { padding: 6px 12px; color: var(--link); font-weight: 500; }
.btn--text:hover { color: var(--link-hover); }
.btn--danger { color: var(--danger); border-color: currentColor; background: transparent; font-weight: 500; }
.btn--block { width: 100%; }
.btn__spinner {
  width: 16px; height: 16px; border-radius: 50%; flex: none;
  border: 2px solid currentColor; border-right-color: transparent;
  animation: spin 0.8s linear infinite;
}
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-3); }

.icon-btn {
  flex: none; width: var(--tap); height: var(--tap); border-radius: 50%; border: 0; padding: 0;
  display: grid; place-items: center; background: transparent; color: var(--text-muted);
}
.icon-btn:hover { color: var(--text); }
html[data-theme="jour"] .icon-btn--raised { background: var(--raised-bg); box-shadow: var(--raised-shadow); color: var(--text-2); }
html[data-theme="nuit"] .icon-btn--raised { border: 1px solid var(--chip-border); background: var(--chip-bg); }

.link-arrow { display: inline-flex; align-items: center; gap: 6px; min-height: var(--tap); font-size: var(--fs-15); font-weight: 500; }
html[data-theme="jour"] .link-arrow { font-weight: 600; }
.back {
  align-self: flex-start; display: inline-flex; align-items: center; gap: 6px;
  min-height: var(--tap); padding: 6px 18px 6px 12px; border-radius: var(--r-pill);
  background: var(--btn2-bg); border: 1px solid var(--btn2-border); box-shadow: var(--btn2-shadow);
  color: var(--text); font-size: var(--fs-15); font-weight: 500;
}
.back:hover { color: var(--text); }

/* ---------- Orb (agent) ---------- */
.orb {
  flex: none; display: block; width: var(--tap); height: var(--tap); border-radius: 50%;
  background: var(--orb-bg); box-shadow: var(--orb-rest);
}
.orb--breathe { animation: breathe-nuit var(--loop-orb) ease-in-out infinite; }

/* ---------- Chips (filters, people, types, domains) ---------- */
.chips { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.chips--scroll { flex-wrap: nowrap; }
.chip {
  flex: none; min-height: var(--tap); padding: 0; border: 0; background: none;
  display: inline-flex; align-items: center; text-align: left; color: inherit;
}
.chip__pill {
  display: inline-flex; align-items: center; gap: 7px;
  min-height: var(--pill-h); padding: 6px 16px; border-radius: var(--r-pill);
  background: var(--chip-bg); border: 1px solid var(--chip-border); box-shadow: var(--chip-shadow);
  color: var(--chip-text); font-size: var(--fs-15); font-weight: 500; line-height: var(--lh-snug);
  transition: background-color var(--dur-state) var(--ease-move), color var(--dur-state) var(--ease-move), box-shadow var(--dur-state) var(--ease-move);
}
.chip__count { font-size: var(--fs-13); font-weight: 400; color: var(--text-muted); }
.chip__check { display: none; }
.chip[aria-pressed="true"] .chip__pill,
.chip.is-on .chip__pill {
  padding-left: 12px;
  background: var(--chip-on-bg); border-color: var(--chip-on-border); box-shadow: var(--chip-on-shadow);
  color: var(--chip-on-text); font-weight: 600;
}
.chip[aria-pressed="true"] .chip__count, .chip.is-on .chip__count { color: var(--chip-on-count); }
.chip[aria-pressed="true"] .chip__check, .chip.is-on .chip__check { display: block; }
.chip--person .chip__pill { padding: 6px 12px; }
html[data-theme="nuit"] .chip--person .chip__pill { color: var(--text); border-color: var(--btn2-border); }

/* Domain chip: dot + label; selected = pressed + check (not colour alone). */
.chip--domain .chip__pill { padding: 6px 14px 6px 12px; }
.chip--domain .dot { width: 8px; height: 8px; }
.chip--domain[aria-pressed="true"] .dot { display: none; }
html[data-theme="nuit"] .chip--domain[aria-pressed="true"] .chip__pill {
  background: color-mix(in srgb, var(--dh) 15%, transparent); border: 1.5px solid var(--dh); color: var(--text);
}
html[data-theme="jour"] .chip--domain[aria-pressed="true"] .chip__pill { color: var(--di); }
.chip--domain[aria-pressed="true"] .chip__check { color: var(--di); }

.dot { flex: none; display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--dh); }
html[data-theme="nuit"] .dot { box-shadow: 0 0 10px var(--dh); }
html[data-theme="jour"] .dot { box-shadow: 0 0 0 3px color-mix(in srgb, var(--dh) 15%, transparent); }

/* ---------- Choice (segmented, exclusive) ---------- */
.seg { margin: 0; padding: 0; border: 0; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.seg__legend { padding: 0; font-size: var(--fs-13); font-weight: 600; color: var(--text-2); }
.seg__track {
  display: flex; flex-wrap: wrap; gap: 4px; padding: 5px;
  border-radius: 29px; background: var(--track-bg); border: 1px solid var(--track-border); box-shadow: var(--track-shadow);
}
.seg__opt { flex: 1 1 auto; display: flex; min-width: 0; }
.seg__opt input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.seg__opt span {
  flex: 1; display: flex; align-items: center; justify-content: center; text-align: center;
  min-height: var(--tap); padding: 6px 14px; border-radius: var(--r-pill);
  color: var(--text-2); font-size: var(--fs-15); font-weight: 500; line-height: var(--lh-snug); cursor: pointer;
  transition: background-color var(--dur-state) var(--ease-move), color var(--dur-state) var(--ease-move);
}
.seg__opt input:checked + span { background: var(--seg-on-bg); color: var(--seg-on-text); box-shadow: var(--seg-on-shadow); font-weight: 600; }
.seg__opt input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 2px; }

/* ---------- Fields ---------- */
.field {
  width: 100%; min-height: var(--tap); padding: 12px 18px; border-radius: var(--r-pill);
  background: var(--field-bg); border: 1px solid var(--field-border); box-shadow: var(--field-shadow);
  color: var(--text); font-size: var(--fs-15); line-height: var(--lh-body); outline: none;
  transition: border-color var(--dur-state) var(--ease-move);
}
.field::placeholder { color: var(--placeholder); opacity: 1; }
.field:focus { border-color: var(--field-focus-border); }
textarea.field { border-radius: var(--r-tile); resize: vertical; min-height: 7.5em; }
.search { position: relative; }
.search .i { position: absolute; left: 16px; top: 50%; margin-top: -9px; width: 18px; height: 18px; color: var(--placeholder); pointer-events: none; }
.search .field { padding-left: 46px; }
.label { display: block; font-size: var(--fs-13); font-weight: 600; color: var(--text-2); }
.label .muted { font-weight: 400; }
.field-group { display: flex; flex-direction: column; gap: var(--sp-2); }

/* ---------- Covers (generative by domain, or the metadata image) ---------- */
.cover {
  position: relative; flex: none; overflow: hidden;
  width: 124px; aspect-ratio: 124 / 176; border-radius: var(--r-cover);
}
html[data-theme="nuit"] .cover { background: var(--motif), linear-gradient(165deg, var(--dd), var(--cover-end)); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08); }
html[data-theme="jour"] .cover {
  background: var(--motif), linear-gradient(160deg, var(--dt), var(--ds));
  border: 1px solid rgba(255, 255, 255, 0.75);
  box-shadow: 8px 12px 22px color-mix(in srgb, var(--dd) 19%, transparent), -5px -5px 12px rgba(255, 255, 255, 0.75);
}
.cover { --motif: radial-gradient(circle at 74% 24%, var(--dh) 0 13%, transparent 14%), radial-gradient(circle at 74% 24%, color-mix(in srgb, var(--dh) 19%, transparent) 0 27%, transparent 28%); }
.cover.k-podcast, .cover.k-episode { --motif: repeating-radial-gradient(circle at 50% 118%, color-mix(in srgb, var(--dh) 33%, transparent) 0 2px, transparent 3px 13px); }
.cover.k-concept { --motif: radial-gradient(circle at 50% 44%, var(--dh) 0 6%, color-mix(in srgb, var(--dh) 19%, transparent) 7% 36%, transparent 37%); }
.cover.k-article { --motif: repeating-linear-gradient(0deg, color-mix(in srgb, var(--dh) 15%, transparent) 0 1px, transparent 1px 7px); }
.cover.k-video { --motif: radial-gradient(ellipse 60% 22% at 50% 40%, color-mix(in srgb, var(--dh) 40%, transparent) 0 60%, transparent 62%), linear-gradient(0deg, transparent 0 58%, color-mix(in srgb, var(--dh) 12%, transparent) 58% 60%, transparent 60%); }
.cover.k-idee { --motif: radial-gradient(circle at 32% 34%, color-mix(in srgb, var(--dh) 80%, transparent) 0 5%, transparent 6%), radial-gradient(circle at 64% 60%, color-mix(in srgb, var(--dh) 47%, transparent) 0 4%, transparent 5%); }
.cover--hero { width: 168px; border-radius: var(--r-cover-lg); }
.cover--carousel { width: 148px; aspect-ratio: 148 / 196; border-radius: var(--r-cover-lg); }
.cover--thumb { width: 44px; border-radius: var(--r-cover-sm); }
.cover--square { aspect-ratio: 1; border-radius: var(--r-cover); }
.cover--mini { width: 34px; border-radius: 6px; }
.cover__title {
  position: absolute; left: 9px; right: 9px; bottom: 10px;
  font-family: var(--font-display); font-size: var(--fs-cover); font-weight: 500; line-height: 1.25;
  letter-spacing: -0.02em; text-transform: uppercase; overflow-wrap: break-word; color: var(--text);
}
.cover--hero .cover__title { font-size: 15px; left: 14px; right: 14px; bottom: 14px; }
.cover__img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

/* ---------- Avatars (initials on the domain tint) ---------- */
.avatar {
  flex: none; width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center;
  font-family: var(--font-display); font-size: var(--fs-avatar); font-weight: 500; line-height: 1;
}
html[data-theme="nuit"] .avatar {
  background: linear-gradient(165deg, var(--dd), var(--cover-end)); color: var(--dh);
  box-shadow: 0 0 0 1.5px var(--dh), 0 0 16px color-mix(in srgb, var(--dh) 33%, transparent);
}
html[data-theme="jour"] .avatar {
  background: linear-gradient(160deg, var(--dt), var(--ds)); color: var(--di);
  box-shadow: 5px 7px 14px color-mix(in srgb, var(--dd) 20%, transparent), -4px -4px 10px rgba(255, 255, 255, 0.85), inset 0 0 0 1px rgba(255, 255, 255, 0.6);
}
.avatar--lg { width: 76px; height: 76px; font-size: var(--fs-avatar-lg); }
.avatar--hero { width: 128px; height: 128px; font-size: var(--fs-avatar-hero); }

/* ---------- Source labels ---------- */
.tag {
  align-self: flex-start; display: inline-block; padding: 3px 7px; border-radius: var(--r-tag);
  font-family: var(--font-mono); font-size: var(--fs-11); line-height: var(--lh-snug); letter-spacing: 0.08em; text-transform: uppercase;
}
.tag--lib { background: var(--tag-lib-bg); color: var(--tag-lib-text); }
.tag--inf { background: var(--tag-inf-bg); color: var(--tag-inf-text); }
.tag--web { background: var(--tag-web-bg); color: var(--tag-web-text); }

/* ---------- Lists ---------- */
.rows { display: flex; flex-direction: column; }
.row {
  display: flex; align-items: center; gap: 14px; min-height: var(--tap); padding: 10px 0;
  border-bottom: 1px solid var(--line); color: var(--text);
}
.row:hover { color: var(--text); }
.row__main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.row__title { font-size: var(--fs-15); font-weight: 600; line-height: var(--lh-snug); }
.row__sub { font-size: var(--fs-13); line-height: 1.35; color: var(--text-muted); }
.row__snippet { font-size: var(--fs-13); line-height: 1.4; color: var(--text-2); }
.row__end { flex: none; display: flex; align-items: center; gap: 6px; font-size: var(--fs-13); color: var(--text-muted); }

.hscroll {
  display: flex; gap: 14px; overflow-x: auto; scrollbar-width: none;
  margin: 0 calc(-1 * var(--gutter)); padding: 2px var(--gutter) 4px; scroll-padding: 0 var(--gutter);
  overscroll-behavior-x: contain;
}
.hscroll::-webkit-scrollbar { display: none; }
html[data-theme="jour"] .hscroll { padding-bottom: 18px; margin-bottom: -14px; }

.tile { flex: none; width: 124px; display: flex; flex-direction: column; gap: 8px; color: var(--text); }
.tile:hover { color: var(--text); }
.tile--wide { width: 148px; }
.tile__text { display: flex; flex-direction: column; gap: 2px; }
.tile__title { font-size: var(--fs-15); font-weight: 600; line-height: var(--lh-snug); }
.tile__sub { font-size: var(--fs-13); line-height: 1.35; color: var(--text-muted); }
.tile--person { width: 104px; align-items: center; text-align: center; }

.shelf { display: flex; flex-direction: column; gap: 12px; }
.shelf__head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; }
.shelf__count { font-size: var(--fs-13); color: var(--text-muted); }
.shelf__rule { height: 1px; background: var(--rule); box-shadow: var(--rule-glow); }
.shelves { display: flex; flex-direction: column; gap: 26px; }
.domain-filter { display: flex; align-items: center; flex-wrap: wrap; gap: 0 10px; font-size: var(--fs-15); color: var(--text-2); }
.domain-filter strong { color: var(--text); font-weight: 600; }
.row__snippet strong { color: var(--text); font-weight: 600; }

/* ---------- Empty states ---------- */
.empty { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; }
.empty__text { font-size: var(--fs-15); line-height: 1.4; color: var(--text-2); }
.empty-shelf { display: flex; align-items: center; gap: 16px; }
.empty-shelf__ghost {
  flex: none; width: 72px; aspect-ratio: 72 / 102; border-radius: 10px; border: 1.5px dashed var(--dashed);
  display: grid; place-items: center; color: var(--text-muted);
}
.empty-shelf .empty { flex: 1; min-width: 0; gap: 10px; }

/* ---------- Bottom sheet ---------- */
dialog.sheet {
  position: fixed; inset: auto 0 0 0; margin: 0 auto; padding: 0;
  width: 100%; max-width: var(--column); max-height: min(92dvh, 100%);
  border: 1px solid var(--sheet-border); border-bottom: 0; border-radius: var(--r-sheet) var(--r-sheet) 0 0;
  background: var(--sheet-bg); color: var(--text);
  overflow: auto; overscroll-behavior: contain;
}
dialog.sheet[open] { animation: sheet-in var(--dur-enter) var(--ease-enter) both; }
dialog.sheet::backdrop { background: var(--backdrop); animation: fade-in var(--dur-fade) linear both; }
.sheet__body { display: flex; flex-direction: column; gap: 18px; padding: 10px var(--gutter) calc(20px + env(safe-area-inset-bottom, 0px)); }
.sheet__grabber { align-self: center; width: 40px; height: 4px; border-radius: 2px; background: var(--sheet-grabber); margin-bottom: 4px; }
.sheet__head { display: flex; flex-direction: column; gap: 4px; }
.sheet__title { font-family: var(--font-display); font-size: var(--fs-22); font-weight: var(--h1-weight); line-height: var(--lh-snug); }
.sheet__foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-2); }
.sheet__foot .btn--primary { flex: 1 1 14em; }
.notice { padding: 14px 16px; border-radius: var(--r-tile); background: var(--soft-bg); border: 1px solid var(--soft-border); display: flex; flex-direction: column; gap: 10px; }

/* ---------- Toast and offline banner ---------- */
.toast {
  position: fixed; z-index: 20; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--nav-bottom) + var(--nav-h) + 12px);
  width: max-content; max-width: min(92vw, 520px); padding: 12px 18px; border-radius: var(--r-tile);
  background: var(--toast-bg); color: var(--toast-text); font-size: var(--fs-15); line-height: var(--lh-snug);
  animation: fade-in var(--dur-fade) linear both;
}
.net {
  position: fixed; z-index: 15; top: calc(10px + env(safe-area-inset-top, 0px)); left: 50%; transform: translateX(-50%);
  width: max-content; max-width: min(92vw, 520px); padding: 8px 14px; border-radius: var(--r-pill);
  background: var(--glass-bg); border: 1px solid var(--glass-border);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  font-size: var(--fs-13); color: var(--text);
}

/* ---------- Skeleton (300 ms to 2 s) ---------- */
.skel { border-radius: var(--r-card); background: var(--skeleton); }
.skel--line { height: 1em; border-radius: 6px; }
.skel--pill { border-radius: var(--r-pill); }

/* =====================================================================
   Univers
   ===================================================================== */
.hero { padding: 20px 18px 4px; }
.hero--empty { padding-bottom: 20px; gap: 16px; }
.hero--empty .btn { align-self: flex-start; padding-left: 18px; }
.hero__figure { display: flex; align-items: baseline; flex-wrap: wrap; gap: 0 8px; }
.hero__count { font-family: var(--font-display); font-weight: var(--big-weight); font-size: var(--fs-58); line-height: 1; letter-spacing: -0.03em; }
.hero__unit { font-size: var(--fs-13); color: var(--text-2); }
html[data-theme="jour"] .hero__unit { color: var(--text-muted); }
.hero__text { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.hero__line { font-size: var(--fs-15); font-weight: 600; line-height: 1.35; }
.hero__sub { font-size: var(--fs-13); line-height: 1.4; color: var(--text-muted); }
.hero__lead { font-size: var(--fs-18); font-weight: 500; line-height: 1.4; }

/* Night: mini constellation. Labels sit on the sky when there is room, else a legend list takes over. */
.const { container-type: inline-size; container-name: const; }
.const__sky { position: relative; height: 200px; margin-top: 4px; }
.const__lines { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.const__lines line { stroke-width: 1; }
.const__lines stop { stop-color: var(--dh); }
.const__star {
  position: absolute; border-radius: 50%; transform: translate(-50%, -50%);
  background: radial-gradient(circle at 38% 34%, #FFFFFF 0 18%, var(--dh) 46%);
  box-shadow: 0 0 var(--glow, 12px) color-mix(in srgb, var(--dh) 53%, transparent);
  animation: twinkle var(--loop-twinkle) ease-in-out infinite;
}
.const__star.is-fog { background: none; box-shadow: none; border: 1px dashed var(--dh); opacity: 0.8; animation: none; }
.const__label {
  position: absolute; width: 8.5em; margin-left: -4.25em;
  display: flex; flex-direction: column; align-items: center; text-align: center;
}
.const__label.is-above { transform: translateY(-100%); }
.const__name { font-family: var(--font-mono); font-size: var(--fs-11); line-height: var(--lh-snug); letter-spacing: var(--track-label-tight); text-transform: uppercase; color: var(--text-2); }
.const__name.is-fog { color: var(--dh); }
.const__count { font-size: var(--fs-13); line-height: var(--lh-snug); color: var(--text-muted); }
.legend { list-style: none; margin: 0; padding: 0; }
@container const (max-width: 15em) {
  .const__label { display: none; }
  .const__sky { height: 150px; }
  .legend {
    position: static !important; width: auto !important; height: auto !important; margin: 0 0 var(--sp-2) !important;
    overflow: visible !important; clip: auto !important; white-space: normal !important;
    display: grid; gap: var(--sp-2);
  }
}
.legend li { display: flex; align-items: baseline; gap: 10px; font-size: var(--fs-13); color: var(--text-muted); }
.legend li .dot { align-self: center; }
.legend b { font-weight: 600; color: var(--text); }

/* Night empty sky: the seven places, dashed. */
.const__ghost { position: absolute; width: 18px; height: 18px; border-radius: 50%; transform: translate(-50%, -50%); border: 1.5px dashed var(--dh); opacity: 0.7; }

/* Day: weather illustration and forecast. */
.wx { display: flex; align-items: center; flex-wrap: wrap; gap: 12px 18px; }
.wx__art { position: relative; flex: none; width: 96px; height: 88px; }
.wx__art > span { position: absolute; display: block; }
.wx__sun { right: 4px; top: 0; width: 64px; height: 64px; border-radius: 50%; background: var(--sun-core); box-shadow: var(--sun-glow); }
.wx__cloud { left: 0; bottom: 4px; width: 66px; height: 26px; border-radius: 13px; background: var(--cloud-bg); box-shadow: var(--cloud-shadow); }
.wx__puff1 { left: 12px; bottom: 18px; width: 30px; height: 30px; border-radius: 50%; background: var(--cloud-bg); }
.wx__puff2 { left: 30px; bottom: 14px; width: 24px; height: 24px; border-radius: 50%; background: var(--cloud-bg); }
.wx__fog1 { left: 0; top: 62px; width: 70px; height: 6px; border-radius: 3px; background: var(--fog); }
.wx__fog2 { left: 18px; top: 76px; width: 74px; height: 6px; border-radius: 3px; background: var(--fog); opacity: 0.66; }
.wx__art.is-suncloud .wx__sun { right: 10px; top: 6px; width: 52px; height: 52px; }
.wx__art.is-suncloud .wx__cloud { left: 6px; bottom: 10px; width: 76px; height: 30px; }
.wx__art.is-suncloud .wx__puff1 { left: 18px; bottom: 26px; width: 34px; height: 34px; }
.wx__art.is-suncloud .wx__puff2 { left: 40px; bottom: 22px; width: 30px; height: 30px; }
.wx__art.is-cloud .wx__cloud, .wx__art.is-fog .wx__cloud { left: 10px; bottom: auto; top: 24px; width: 72px; height: 28px; }
.wx__art.is-cloud .wx__puff1, .wx__art.is-fog .wx__puff1 { left: 22px; bottom: auto; top: 8px; width: 32px; height: 32px; }
.wx__art.is-cloud .wx__puff2, .wx__art.is-fog .wx__puff2 { left: 44px; bottom: auto; top: 13px; width: 26px; height: 26px; }
.wx__art.is-cloud { height: 60px; }
.wx .hero__text { flex: 1 1 10em; }
.forecast { gap: 8px; margin: 0 -18px; padding: 2px 18px; }
html[data-theme="jour"] .forecast { padding-bottom: 2px; margin-bottom: 0; }
.fc {
  flex: none; min-width: 76px; display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 12px 10px 10px; border-radius: var(--r-tile);
  background: rgba(255, 255, 255, 0.55); border: 1px solid rgba(255, 255, 255, 0.85);
}
.fc__name { font-family: var(--font-mono); font-size: var(--fs-11); letter-spacing: var(--track-label-tight); text-transform: uppercase; color: var(--text-muted); }
.fc__icon { width: 30px; height: 30px; flex: none; }
.wx-sun { fill: var(--wx-sun); }
.wx-ray { stroke: var(--wx-ray); }
.wx-cloud { fill: var(--wx-cloud); stroke: var(--wx-cloud-line); }
.wx-fog { stroke: var(--wx-fog-line); }
.fc__value { display: flex; align-items: baseline; gap: 4px; white-space: nowrap; }
.fc__count { font-family: var(--font-display); font-size: var(--fs-22); font-weight: 400; line-height: 1; }
.fc__unit { font-size: var(--fs-13); color: var(--text-muted); }

/* Agent card */
.agent-card { gap: 14px; padding: 18px 18px 12px; }
html[data-theme="nuit"] .agent-card { background: var(--soft-bg); border-color: var(--soft-border); }
.agent-card__text { font-size: var(--fs-18); font-weight: 500; line-height: 1.4; }
.agent-card__foot { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: var(--sp-2); min-height: 60px; }
.agent-card__covers { display: flex; align-items: center; padding-left: 4px; }
.agent-card__covers .cover { margin-left: -12px; }
.agent-card__covers .cover:first-child { margin-left: 0; transform: rotate(-7deg); }
.agent-card__covers .cover:last-child:not(:first-child) { transform: rotate(7deg); }
.agent-card__cta { display: inline-flex; align-items: center; gap: 6px; min-height: var(--pill-h); font-size: var(--fs-15); font-weight: 500; color: var(--link); }
html[data-theme="jour"] .agent-card__cta {
  padding: 6px 16px 6px 18px; border-radius: var(--r-pill);
  background: var(--action-bg); color: var(--action-text); box-shadow: var(--action-shadow); font-weight: 600;
}

/* =====================================================================
   Fiche, Découvertes, Carte, Réglages (provisional, phase 2 and 3 rebuild them)
   ===================================================================== */
.fiche-top { display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; }
.fiche-top .surtitle { color: var(--di); }
.fiche-title { font-family: var(--font-display); font-size: var(--fs-22); font-weight: 500; line-height: 1.25; }
.fiche-by { font-size: var(--fs-15); color: var(--text-2); }
.notes-state { font-size: var(--fs-13); color: var(--text-muted); min-height: 1.4em; }
.meta-list { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 0; font-size: var(--fs-13); }
.meta-list dt { color: var(--text-muted); }
.meta-list dd { margin: 0; color: var(--text-2); overflow-wrap: anywhere; }
.link-row { display: flex; align-items: center; gap: var(--sp-2); border-bottom: 1px solid var(--line); }
.link-row .row { flex: 1; border-bottom: 0; }
.row--button { width: 100%; border: 0; border-bottom: 1px solid var(--line); background: none; text-align: left; font: inherit; }
select.field { appearance: none; border-radius: var(--r-pill); }

.disc { gap: 14px; }
.disc__top { display: flex; gap: 14px; align-items: flex-start; }
.disc__kind { font-size: var(--fs-13); font-weight: 500; color: var(--di); }
.disc__title { font-size: var(--fs-15); font-weight: 600; line-height: var(--lh-snug); }
.disc__by { font-size: var(--fs-13); color: var(--text-muted); }
.disc__why { font-size: var(--fs-15); line-height: 1.45; color: var(--text); }
.disc__source { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-size: var(--fs-13); color: var(--text-muted); }
.disc__preview { white-space: pre-wrap; font-size: var(--fs-13); color: var(--text-2); }
.disc.is-dimmed > :not(.disc__undo) { opacity: 0.45; transition: opacity var(--dur-state) var(--ease-move); }
.disc__undo { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-3); font-size: var(--fs-15); }

.dom-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.dom-row { display: flex; flex-direction: column; gap: 6px; }
.dom-row__head { display: flex; align-items: center; gap: 12px; min-height: var(--tap); color: var(--text); }
.dom-row__head:hover { color: var(--text); }
.dom-row__name { flex: 1; min-width: 0; font-size: var(--fs-15); font-weight: 500; line-height: var(--lh-snug); }
.dom-row__value { flex: none; display: flex; flex-direction: column; align-items: flex-end; text-align: right; font-size: var(--fs-13); line-height: var(--lh-snug); color: var(--text-2); }
.dom-row__wx { color: var(--text-muted); }
.dom-row__foot { display: flex; align-items: center; gap: 10px; }
.dom-row__foot .bar { flex: 1; }
.bar { height: 8px; border-radius: 4px; background: var(--bar-track); box-shadow: var(--bar-track-shadow); overflow: hidden; }
.bar__fill { height: 100%; border-radius: 4px; background: var(--dh); transform-origin: left; }
html[data-theme="nuit"] .bar { height: 4px; }
.fog-tag {
  display: inline-block; padding: 2px 10px; border-radius: var(--r-pill); border: 1.5px dashed var(--di);
  color: var(--di); font-size: var(--fs-13); white-space: nowrap;
}

.settings-block { display: flex; flex-direction: column; gap: 12px; }
.settings-block code {
  font-family: var(--font-mono); font-size: var(--fs-13); overflow-wrap: anywhere;
  padding: 2px 6px; border-radius: 6px; background: var(--soft-bg);
}

.login { max-width: 420px; }

/* Wider screens: same column, more air. */
@media (min-width: 720px) {
  :root { --gutter: 32px; }
}
