[data-theme="cahier"] {
  color-scheme: light;
  --paper: #f8fafd;
  --surface: #ffffff;
  --line: #cfd9e2;
  --line-soft: #e3e8ed;
  --ink: #293f54;
  --muted: #566a7c;
  --accent: #395d89;
  --handnote: #4c6380;
  --focus: #a1608f;
  --butter: #f5e8bc;
  --sage: #d9e9df;
  --lilac: #e4def1;
  --blue: #d8e8f3;
  --rose: #f0dce2;
  --peach: #f4d9cb;
  --note-bg: #fbf2dc;
  --note-line: #c39f55;
  --today-bg: #edf2f9;
  --today-line: #aebfd1;
  --track: #d5dee6;
  --right-bg: #e5f1e8;
  --right-line: #6f9474;
  --wrong-bg: #f9ebec;
  --wrong-line: #b0696f;
  --color-base-100: var(--surface);
  --color-base-200: var(--paper);
  --color-base-300: var(--line);
  --color-base-content: var(--ink);
  --color-primary: var(--accent);
  --color-primary-content: #ffffff;
  --color-secondary: #6d4ea3;
  --color-secondary-content: #ffffff;
  --color-accent: #855912;
  --color-accent-content: #ffffff;
  --color-neutral: #293f54;
  --color-neutral-content: #f8fafd;
  --color-info: #3d7ea6;
  --color-info-content: #ffffff;
  --color-success: #28744c;
  --color-success-content: #ffffff;
  --color-warning: #855912;
  --color-warning-content: #ffffff;
  --color-error: #b23f47;
  --color-error-content: #ffffff;
  --radius-selector: 0.375rem;
  --radius-field: 0.45rem;
  --radius-box: 0.75rem;
  --size-selector: 0.25rem;
  --size-field: 0.25rem;
  --border: 1px;
  --depth: 0;
  --noise: 0;
}

[data-theme="tableau"] {
  color-scheme: dark;
  --paper: #141c26;
  --surface: #1c2633;
  --line: #354452;
  --line-soft: #283544;
  --ink: #dfe7ee;
  --muted: #a5b5c4;
  --accent: #9ab8e0;
  --handnote: #a9c0da;
  --focus: #e0a3cf;
  --butter: #d9cc9c;
  --sage: #b9cfc1;
  --lilac: #c7bfdc;
  --blue: #b8cddd;
  --rose: #d6bcc5;
  --peach: #d9bcae;
  --note-bg: #2c2a22;
  --note-line: #b8964f;
  --today-bg: #1f2b39;
  --today-line: #4b6075;
  --track: #33424f;
  --right-bg: #1d3329;
  --right-line: #5f9a7a;
  --wrong-bg: #3a2329;
  --wrong-line: #b77279;
  --color-base-100: var(--surface);
  --color-base-200: var(--paper);
  --color-base-300: var(--line);
  --color-base-content: var(--ink);
  --color-primary: var(--accent);
  --color-primary-content: #102033;
  --color-secondary: #c2a8ec;
  --color-secondary-content: #1d1430;
  --color-accent: #dcaa5e;
  --color-accent-content: #2a1d08;
  --color-neutral: #0f1422;
  --color-neutral-content: #dfe7ee;
  --color-info: #7fb6d8;
  --color-info-content: #0e1d27;
  --color-success: #62bc8b;
  --color-success-content: #0d2117;
  --color-warning: #dcaa5e;
  --color-warning-content: #2a1d08;
  --color-error: #e5807f;
  --color-error-content: #2d1010;
  --radius-selector: 0.375rem;
  --radius-field: 0.45rem;
  --radius-box: 0.75rem;
  --size-selector: 0.25rem;
  --size-field: 0.25rem;
  --border: 1px;
  --depth: 0;
  --noise: 0;
}

:root {
  --font-ui: "Avenir Next", Avenir, "Atkinson Hyperlegible Next", system-ui, sans-serif;
  --font-french: "Literata", Georgia, serif;
  --font-hand: "Bradley Hand", "Segoe Print", cursive;
}

body {
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.55;
  background: var(--paper);
  color: var(--ink);
}

.font-serif,
.sentence,
.cheer,
.french,
[lang="fr"] {
  font-family: var(--font-french);
}

.cheer {
  font-weight: 600;
  letter-spacing: -0.01em;
}

:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.sentence {
  font-size: clamp(1.5rem, 1.1rem + 1.6vw, 2.125rem);
  line-height: 1.5;
  font-optical-sizing: auto;
}

.context {
  font-family: "Literata", Georgia, serif;
  font-size: 1.125rem;
  line-height: 1.6;
  color: color-mix(in oklab, var(--color-base-content) 72%, transparent);
}

mark.ref,
.ref {
  background: none;
  color: var(--color-secondary);
  font-weight: 600;
}

.blank {
  display: inline-block;
  min-width: 3.5em;
  height: 1em;
  margin-inline: 0.15em;
  border-bottom: 2px solid color-mix(in oklab, var(--color-base-content) 35%, transparent);
  vertical-align: baseline;
}

.filled {
  color: var(--color-success);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.2em;
}

.blank-input {
  font: inherit;
  color: var(--color-primary);
  font-weight: 600;
  background: transparent;
  border: 0;
  border-bottom: 2px solid color-mix(in oklab, var(--color-primary) 55%, transparent);
  border-radius: 0;
  text-align: center;
  padding: 0 0.15em;
  margin-inline: 0.15em;
  min-width: 3.5ch;
  max-width: 100%;
  outline: none;
  transition: border-color 120ms;
}

.blank-input:focus {
  border-bottom-color: var(--color-primary);
  background: color-mix(in oklab, var(--color-primary) 7%, transparent);
}

.struck {
  color: var(--color-error);
  text-decoration: line-through;
  text-decoration-thickness: 2px;
  text-decoration-color: var(--color-error);
}

.correction {
  color: var(--color-success);
  font-weight: 600;
}

.write-in {
  display: inline-block;
  animation: write-in 380ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

@keyframes write-in {
  from { opacity: 0; transform: translateY(0.25em); clip-path: inset(0 100% 0 0); }
  to { opacity: 1; transform: none; clip-path: inset(0 0 0 0); }
}

.tile {
  font-family: "Literata", Georgia, serif;
  font-size: 1.125rem;
  padding: 0.35rem 0.8rem;
  border-radius: 0.5rem;
  border: 1px solid var(--color-base-300);
  border-bottom-width: 3px;
  background: var(--color-base-100);
  cursor: pointer;
  transition: transform 80ms, border-color 120ms;
}

.tile:hover { border-color: color-mix(in oklab, var(--color-primary) 45%, var(--color-base-300)); }
.tile:active { transform: translateY(1px); }
.tile:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }
.tile[disabled] { cursor: default; opacity: 1; }

.tile-slot {
  min-height: 3.25rem;
  border-bottom: 2px solid var(--color-base-300);
}

.choice {
  font-family: var(--font-french);
  font-size: 1.2rem;
  font-weight: 400;
  justify-content: flex-start;
  height: auto;
  min-height: 3.5rem;
  padding: 0.65rem 1.1rem;
  text-align: left;
  background: var(--surface);
  border-color: var(--line);
  border-radius: 8px;
  color: var(--ink);
}

.choice:hover { border-color: var(--accent); }
.choice .kbd { font-family: var(--font-ui); color: var(--muted); }
.choice[aria-disabled="true"] { color: var(--ink); }
.choice.is-other { color: var(--muted); }

.choice.is-right {
  border-color: var(--right-line);
  background: var(--right-bg);
}

.choice.is-wrong {
  border-color: var(--wrong-line);
  background: var(--wrong-bg);
}

.exercise-instruction {
  font-size: 20px;
  line-height: 1.3;
  font-weight: 650;
  letter-spacing: -0.015em;
}

.feedback {
  border-top: 2px solid transparent;
  animation: sheet-up 260ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.feedback.is-right {
  border-top-color: var(--right-line);
  background: var(--right-bg);
}

.feedback.is-wrong {
  border-top-color: var(--wrong-line);
  background: var(--wrong-bg);
}

@keyframes sheet-up {
  from { transform: translateY(100%); }
  to { transform: none; }
}

.shake { animation: shake 320ms ease-in-out; }

@keyframes shake {
  20%, 60% { transform: translateX(-5px); }
  40%, 80% { transform: translateX(5px); }
}

.heat {
  width: 0.85rem;
  height: 0.85rem;
  border-radius: 3px;
  background: var(--color-base-300);
}

.heat[data-level="1"] { background: color-mix(in oklab, var(--color-success) 35%, var(--color-base-300)); }
.heat[data-level="2"] { background: color-mix(in oklab, var(--color-success) 65%, var(--color-base-300)); }
.heat[data-level="3"] { background: var(--color-success); }
.heat[data-level="future"] { background: transparent; }

.kbd-hint { font-size: 0.75rem; opacity: 0.6; }

[x-cloak] { display: none !important; }

@media (prefers-reduced-motion: reduce) {
  .write-in, .feedback, .shake { animation: none; }
}

/* Color utilities the prebuilt daisyUI CSS doesn't ship and the Tailwind browser build can't derive from theme variables. */
.divide-base-300 > :not(:last-child) { border-color: var(--color-base-300); }
.border-l-success { border-left-color: var(--color-success); }
.border-l-error { border-left-color: var(--color-error); }

.radial-progress {
  box-shadow: inset 0 0 0 var(--thickness) color-mix(in oklab, currentColor 15%, transparent);
}

.story {
  font-family: "Literata", Georgia, serif;
  font-size: clamp(1.2rem, 1.05rem + 0.6vw, 1.45rem);
  line-height: 2.1;
  max-width: 68ch;
}

.hint {
  font-family: "Literata", Georgia, serif;
  font-style: italic;
  font-size: 0.72em;
  font-weight: 500;
  color: var(--color-accent);
  background: color-mix(in oklab, var(--color-accent) 12%, transparent);
  border-radius: 999px;
  padding: 0.1em 0.55em;
  margin-inline: 0.1em;
  vertical-align: 0.12em;
  white-space: nowrap;
}



[data-tone="butter"] { --tone: var(--butter); }
[data-tone="sage"] { --tone: var(--sage); }
[data-tone="lilac"] { --tone: var(--lilac); }
[data-tone="blue"] { --tone: var(--blue); }
[data-tone="rose"] { --tone: var(--rose); }
[data-tone="peach"] { --tone: var(--peach); }

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0.75rem;
  z-index: 50;
  background: var(--surface);
  color: var(--ink);
  padding: 0.6rem 1rem;
  border-radius: 0.5rem;
  border: 1px solid var(--line);
}

.skip-link:focus { left: 0.75rem; }

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 2.4rem;
  max-width: 1210px;
  min-height: 90px;
  margin: 0 auto;
  padding: 1rem 42px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--ink);
  text-decoration: none;
  font-weight: 750;
  font-size: 19px;
  line-height: 1.2;
  white-space: nowrap;
}

.brand img { width: 44px; height: 44px; object-fit: contain; }

.brand-sub {
  display: block;
  font-family: var(--font-hand);
  font-weight: 400;
  font-size: 14px;
  color: var(--muted);
}

.site-nav { display: flex; align-items: center; gap: 1.6rem; font-size: 14px; }

.site-nav a {
  padding: 0.6rem 0.1rem;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}

.site-nav a:hover { border-bottom-color: var(--line); }
.site-nav a[aria-current="page"] { font-weight: 700; border-bottom-color: var(--accent); }

.profile-menu { margin-left: auto; position: relative; font-size: 13px; }

.profile-menu summary {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 50px;
  padding: 4px 0.7rem 4px 4px;
  list-style: none;
  cursor: pointer;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.profile-menu summary:hover { border-color: var(--accent); }
.profile-menu summary::-webkit-details-marker { display: none; }
.profile-menu summary .name { max-width: 8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.profile-menu summary .chevron { flex-shrink: 0; transition: transform 120ms; }
.profile-menu[open] summary .chevron { transform: rotate(180deg); }

.profile-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 0.55rem);
  z-index: 30;
  width: 282px;
  padding: 1.1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 8px 26px rgb(41 66 86 / 0.09);
}

.profile-identity { display: flex; align-items: center; gap: 0.75rem; }
.profile-identity strong { display: block; font-size: 15px; overflow-wrap: anywhere; }
.profile-identity p { margin-top: 0.2rem; font-size: 12px; color: var(--muted); }
.profile-panel .local-note { margin: 0.9rem 0 0.6rem; padding-bottom: 0.9rem; border-bottom: 1px solid var(--line); font-size: 11px; color: var(--muted); }
.profile-panel ul { display: grid; gap: 0.1rem; }
.profile-panel li a { display: block; padding: 0.55rem 0.65rem; border-radius: 6px; color: var(--ink); }
.profile-panel li a:hover, .profile-panel li a[aria-current="page"] { background: color-mix(in oklab, var(--accent) 9%, var(--surface)); color: var(--accent); }
.profile-panel li.switch-profile { margin-top: 0.4rem; padding-top: 0.4rem; border-top: 1px solid var(--line); }

.avatar-art {
  --avatar-size: 64px;
  display: inline-block;
  flex: 0 0 var(--avatar-size);
  width: var(--avatar-size);
  height: var(--avatar-size);
  border-radius: 50%;
  background-color: var(--sage);
  background-image: var(--avatar-image);
  background-size: 300% 300%;
  background-repeat: no-repeat;
  vertical-align: middle;
}

.avatar-art[data-avatar="mona-lisa"] { background-position: 0 0; }
.avatar-art[data-avatar="eiffel-tower"] { background-position: 50% 0; }
.avatar-art[data-avatar="croissant"] { background-position: 100% 0; }
.avatar-art[data-avatar="baguette"] { background-position: 0 50%; }
.avatar-art[data-avatar="etretat"] { background-position: 50% 50%; }
.avatar-art[data-avatar="macarons"] { background-position: 100% 50%; }
.avatar-art[data-avatar="cafe-creme"] { background-position: 0 100%; }
.avatar-art[data-avatar="camembert"] { background-position: 50% 100%; }
.avatar-art[data-avatar="pencil-rat"] { background-position: 100% 100%; }

.avatar-art.header-size { --avatar-size: 40px; }
.avatar-art.menu-size { --avatar-size: 52px; }
.avatar-art.large-size { --avatar-size: 108px; }

.page {
  max-width: 1210px;
  margin: 0 auto;
  padding: 2rem 42px 3rem;
}

.page:focus { outline: none; }

.site-footer {
  max-width: 1126px;
  margin: 0 auto;
  padding: 1.25rem 0 1.75rem;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  font-size: 12px;
  color: var(--muted);
}

.site-footer nav { display: flex; gap: 0.9rem; }
.site-footer a { color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }

.flash { max-width: 1126px; margin: 1rem auto 0; display: grid; gap: 0.5rem; }


.page-title {
  font-size: 38px;
  line-height: 1.15;
  letter-spacing: -0.035em;
  font-weight: 650;
  margin-bottom: 0.6rem;
}

.lede { color: var(--muted); max-width: 42rem; }

.handnote {
  font-family: var(--font-hand);
  font-size: 20px;
  line-height: 1.4;
  color: var(--handnote);
}

.muted { color: var(--muted); }

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin: 0.75rem 0 1.1rem;
}

.section-head h2 { font-size: 25px; line-height: 1.2; letter-spacing: -0.025em; font-weight: 650; }
.section-head p, .section-head a { font-size: 13px; color: var(--muted); }

.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; margin-top: 1.25rem; }
.actions form { display: contents; }

.btn-paper {
  --btn-color: var(--surface);
  --btn-fg: var(--accent);
  --btn-border: var(--line);
}

.text-link {
  color: var(--accent);
  font-weight: 650;
  text-decoration: underline;
  text-underline-offset: 4px;
  cursor: pointer;
}

.text-link:hover { text-decoration-thickness: 2px; }

.meter {
  display: block;
  width: 100%;
  height: 6px;
  border: 0;
  border-radius: 4px;
  background: var(--track);
  overflow: hidden;
  appearance: none;
}

.meter::-webkit-progress-bar { background: var(--track); border-radius: 4px; }
.meter::-webkit-progress-value { background: var(--accent); border-radius: 4px; }
.meter::-moz-progress-bar { background: var(--accent); border-radius: 4px; }

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1.5rem;
}

.panel h2, .panel h3 { font-size: 19px; font-weight: 650; letter-spacing: -0.015em; margin-bottom: 0.4rem; }
.panel p { color: var(--muted); font-size: 14px; }


.home-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 250px;
  align-items: center;
  gap: 2rem;
  padding: 0.5rem 0 1.75rem;
}

.home-hero.is-first-visit { grid-template-columns: minmax(0, 1fr); }
.home-hero .page-title { font-size: 40px; }
.home-hero .lede { max-width: 37rem; }
.home-hero .handnote { color: #567697; margin-bottom: 0.2rem; }
[data-theme="tableau"] .home-hero .handnote { color: var(--handnote); }

.resume-note { font-size: 13px; color: var(--muted); margin-top: 0.6rem; }

.today {
  padding: 1.25rem 1.4rem;
  background: var(--today-bg);
  border-left: 2px solid var(--today-line);
  border-radius: 0 12px 12px 0;
}

.today h2 { font-size: 15px; font-weight: 650; margin-bottom: 0.4rem; }
.today .count { font-size: 26px; font-weight: 600; }
.today .of { font-size: 14px; }
.today .meter { margin: 0.75rem 0; }
.today p { font-size: 12px; color: var(--muted); }

.module-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.module-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  transition: border-color 150ms;
}

.module-card:hover { border-color: var(--accent); }
.module-card:focus-within { border-color: var(--accent); }

.module-visual {
  height: 130px;
  display: grid;
  place-items: center;
  background: var(--tone);
}

.module-visual img { width: 128px; height: 128px; object-fit: contain; }

.module-state {
  position: absolute;
  top: 10px;
  left: 12px;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  background: rgb(255 255 255 / 0.94);
  color: #293f54;
  font-size: 11px;
  font-weight: 650;
}

.module-body { display: flex; flex-direction: column; flex: 1; padding: 1.05rem 1.2rem; }

.module-title { font-size: 21px; font-weight: 650; letter-spacing: -0.02em; line-height: 1.2; }

.module-title a { color: var(--ink); text-decoration: none; }
.module-title a::after { content: ""; position: absolute; inset: 0; }
.module-title a:focus-visible { outline: none; }
.module-card:has(.module-title a:focus-visible) { outline: 3px solid var(--focus); outline-offset: 3px; }

.module-sub { margin-top: 0.2rem; font-family: var(--font-ui); font-size: 12px; color: var(--muted); }
.module-desc { margin: 0.75rem 0; font-size: 13px; line-height: 1.5; color: color-mix(in oklab, var(--ink) 85%, var(--muted)); flex: 1; }

.module-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--line-soft);
}

.module-count { font-size: 12px; color: var(--muted); }
.module-foot .text-link { position: relative; z-index: 1; font-size: 13px; color: var(--ink); }

.bottom-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1.9rem; margin-top: 1.75rem; align-items: center; }

.review-callout {
  padding: 1.1rem 1.25rem;
  background: var(--note-bg);
  border-left: 3px solid var(--note-line);
  border-radius: 0 9px 9px 0;
}

.review-callout h2, .review-callout h3 { font-size: 16px; font-weight: 650; }
.review-callout p { font-size: 13px; margin: 0.3rem 0 0.6rem; }
.review-callout .links { display: flex; flex-wrap: wrap; gap: 0.4rem 1.1rem; font-size: 13px; }

.maker-note { display: flex; align-items: center; gap: 0.9rem; padding: 0.5rem 1rem; }
.maker-note img { width: 84px; height: 84px; object-fit: contain; flex-shrink: 0; }
.maker-note p { font-size: 13px; line-height: 1.65; }
.maker-note .handnote { font-size: 17px; line-height: 1.3; }
.maker-note a { font-size: 13px; color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }


.crumbs ol { display: flex; flex-wrap: wrap; gap: 0.55rem; font-size: 12px; color: var(--muted); margin-bottom: 1.3rem; }
.crumbs li + li::before { content: "/"; margin-right: 0.55rem; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { text-decoration: underline; }

.module-banner {
  display: flex;
  align-items: center;
  gap: 1.75rem;
  padding: 1.5rem 1.9rem;
  border-radius: 12px;
  background: var(--tone);
  color: #293f54;
}

.module-banner img { width: 128px; height: 128px; object-fit: contain; flex-shrink: 0; }
.module-banner h1 { font-size: 38px; line-height: 1.1; letter-spacing: -0.035em; font-weight: 650; }
.module-banner .fr-label { display: block; margin-top: 0.3rem; font-family: var(--font-french); font-style: italic; color: #4c5f71; }
.module-banner p { font-size: 14px; max-width: 42.5rem; margin: 0.5rem 0; }
.module-banner .module-count { color: #4c5f71; }

.tab-nav {
  display: flex;
  gap: 1.75rem;
  margin: 1.4rem 0 1.65rem;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}

.tab-nav a {
  padding: 0.6rem 0.2rem 0.75rem;
  font-size: 14px;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 3px solid transparent;
  white-space: nowrap;
}

.tab-nav a:hover { border-bottom-color: var(--line); }
.tab-nav a[aria-current="page"] { font-weight: 700; border-bottom-color: var(--accent); }

.overview-intro { display: grid; grid-template-columns: minmax(0, 1fr) 270px; gap: 2.1rem; margin: 1.9rem 0; align-items: start; }
.overview-intro > div > h2 { font-size: 25px; font-weight: 650; letter-spacing: -0.025em; margin-bottom: 0.6rem; }
.overview-intro > div > p { color: var(--muted); }

.topic-list {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}

.topic-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.75rem 1.5rem;
  align-items: center;
  padding: 1.05rem 1.4rem;
}

.topic-row + .topic-row { border-top: 1px solid var(--line-soft); }
.topic-row.is-inline { display: flex; justify-content: space-between; }
.topic-row h3 { font-size: 16px; font-weight: 650; }
.topic-row .fr { font-family: var(--font-french); font-style: italic; font-size: 13px; color: var(--muted); }
.topic-row .example { margin-top: 0.35rem; font-family: var(--font-french); font-size: 15px; }
.topic-status { margin-top: 0.4rem; font-size: 12px; color: var(--muted); }
.topic-links { display: flex; align-items: center; gap: 1rem; }
.topic-links .text-link { font-size: 13px; color: var(--ink); }


.guide-layout { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 2.6rem; align-items: start; }

.guide-index { position: sticky; top: 1.25rem; }
.guide-index h2 { font-size: 15px; font-weight: 650; margin-bottom: 0.6rem; }
.guide-index ol { display: grid; }

.guide-index ol a, .mobile-index a {
  display: block;
  padding: 0.45rem 0 0.45rem 0.7rem;
  margin-left: -0.7rem;
  border-left: 2px solid transparent;
  font-size: 13px;
  color: var(--muted);
  text-decoration: none;
}

.guide-index ol a:hover { color: var(--ink); }
.guide-index ol a[aria-current="true"] { color: var(--accent); font-weight: 700; border-left-color: var(--accent); }
.guide-index hr { border: 0; border-top: 1px solid var(--line); margin: 1.6rem 0 1.25rem; }

.mobile-index { display: none; }

.guide-content { max-width: 50rem; min-width: 0; }

.guide-section { margin-bottom: 2.6rem; scroll-margin-top: 1.25rem; }
.guide-section h2 { font-size: 26px; line-height: 1.2; letter-spacing: -0.025em; font-weight: 650; margin-bottom: 0.75rem; }
.guide-section h3 { font-size: 16px; font-weight: 650; margin: 1.1rem 0 0.4rem; }
.guide-section > p, .guide-section > ul:not([class]) { max-width: 68ch; color: color-mix(in oklab, var(--ink) 85%, var(--muted)); }
.guide-section > p + p { margin-top: 0.6rem; }
.guide-section > ul:not([class]) { display: grid; gap: 0.4rem; padding-left: 1.1rem; list-style: disc; }
.guide-section b, .guide-section strong { font-weight: 700; color: var(--ink); }

.example-board {
  margin: 1.1rem 0;
  padding: 1.4rem 1.7rem;
  border-radius: 10px;
  background: color-mix(in oklab, var(--tone) 60%, var(--surface));
  border: 1px solid color-mix(in oklab, var(--tone), #293f54 14%);
  color: #293f54;
}

[data-theme="tableau"] .example-board { background: color-mix(in oklab, var(--tone) 16%, var(--surface)); border-color: color-mix(in oklab, var(--tone) 30%, var(--surface)); color: var(--ink); }

.board-label { font-size: 12px; font-weight: 650; margin-bottom: 0.6rem; }

.french { font-size: 21px; line-height: 1.55; }
.example-board .french + .french { margin-top: 0.3rem; }
.example-board ul.french { display: grid; gap: 0.35rem; }
.gloss, .translation { font-family: var(--font-ui); font-size: 13px; color: color-mix(in oklab, currentColor 72%, transparent); }
.translation { display: block; margin-top: 0.2rem; }

.formula { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 0.6rem; margin: 0.4rem 0 1.25rem; }
.formula-cell { display: flex; flex-direction: column; align-items: center; gap: 0.35rem; }
.formula-cell strong { font-family: var(--font-french); font-weight: 400; font-size: 30px; line-height: 1.3; padding: 0.3rem 0.85rem; border-radius: 6px; background: var(--tone, #ffffff); color: #293f54; }
.formula-cell[data-tone="paper"] strong { background: #ffffff; }
.formula-cell small { font-family: var(--font-ui); font-size: 12px; }
.formula .joiner { align-self: center; padding-bottom: 1.4rem; font-size: 14px; color: var(--muted); }

.exception {
  margin: 1.25rem 0;
  padding: 0.95rem 1.25rem;
  background: var(--note-bg);
  border-left: 3px solid var(--note-line);
  border-radius: 0 6px 6px 0;
}

.exception > strong { display: block; font-size: 14px; margin-bottom: 0.2rem; }
.exception p, .exception li { font-size: 14px; }
.exception p + p { margin-top: 0.3rem; }

.practice-link {
  display: inline-block;
  margin-top: 0.25rem;
  font-size: 14px;
  font-weight: 700;
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 4px;
}

.rule-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.75rem; margin: 1rem 0; }
.rule-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.rule-tile { padding: 1.1rem 1.25rem; border-radius: 9px; background: var(--tone, var(--blue)); color: #293f54; }
.rule-tile .key { font-family: var(--font-french); font-size: 29px; line-height: 1.2; margin-bottom: 0.35rem; }
.rule-tile .key.small { font-family: var(--font-ui); font-size: 16px; font-weight: 650; }
.rule-tile p { font-size: 13px; margin-top: 0.25rem; }
.rule-tile b, .rule-tile strong { color: inherit; }
.rule-tile .fr-list { font-family: var(--font-french); font-size: 15px; line-height: 1.6; margin-top: 0.4rem; }

.word-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.5rem; margin: 1rem 0; }
.word-grid.wide { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.word-grid.narrow { grid-template-columns: repeat(7, minmax(0, 1fr)); }
.word { background: var(--surface); border: 1px solid var(--line); border-radius: 5px; padding: 0.55rem 0.7rem; font-size: 15px; }
.word small, .word .gloss { display: block; font-family: var(--font-ui); font-size: 12px; color: var(--muted); }
.word .num { display: block; font-family: var(--font-ui); font-variant-numeric: tabular-nums; font-size: 12px; color: var(--muted); }

.pair-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem 1.4rem;
  margin: 1rem 0;
  padding: 1.1rem 1.4rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 9px;
}

.pair-list.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.pair-list.one { grid-template-columns: minmax(0, 1fr); }
.pair-list > * { font-family: var(--font-french); font-size: 16px; }
.pair-list small { display: block; font-family: var(--font-ui); font-size: 12px; color: var(--muted); }
.pair-list dt { font-family: var(--font-ui); font-weight: 650; font-size: 14px; }
.pair-list dd { font-family: var(--font-french); }
.pair-list.defs { grid-template-columns: minmax(0, 1fr); gap: 0.25rem; }
.pair-list.defs dd + dt { margin-top: 0.6rem; }

.guide-table { width: 100%; border-collapse: collapse; font-size: 15px; }
.guide-table th, .guide-table td { padding: 0.6rem 0.9rem; text-align: left; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.guide-table thead th { font-size: 13px; font-weight: 650; background: color-mix(in oklab, var(--tone) 45%, var(--surface)); color: var(--ink); }
.guide-table thead small { display: block; font-weight: 400; color: var(--muted); }
.guide-table tbody td { font-family: var(--font-french); font-size: 17px; }
.guide-table tbody th { font-size: 13px; font-weight: 400; font-style: italic; color: var(--muted); }
.guide-table tr:last-child > * { border-bottom: 0; }
.table-wrap { overflow-x: auto; margin: 1rem 0; background: var(--surface); border: 1px solid var(--line); border-radius: 9px; }

.conjugation { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.15rem 1.5rem; font-family: var(--font-french); font-size: 18px; }
.conjugation .stem { grid-column: span 1; padding-bottom: 0.4rem; margin-bottom: 0.3rem; border-bottom: 1px solid color-mix(in oklab, currentColor 20%, transparent); }

.end { text-decoration: underline; text-decoration-color: var(--note-line); text-decoration-thickness: 2px; text-underline-offset: 0.18em; }


.setup { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 1.9rem; align-items: start; }
.setup legend { font-size: 16px; font-weight: 650; margin-bottom: 0.75rem; }

.topic-option {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
  padding: 0.8rem 1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 7px;
  cursor: pointer;
}

.topic-option:hover { border-color: color-mix(in oklab, var(--accent) 50%, var(--line)); }
.topic-option:has(input:checked) { border-color: var(--accent); background: color-mix(in oklab, var(--accent) 8%, var(--surface)); }
.topic-option:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
.topic-option input { margin-top: 0.2rem; }
.topic-option input:focus-visible { outline: none; }
.topic-option .name { font-weight: 650; }
.topic-option .fr { font-family: var(--font-french); font-style: italic; font-size: 13px; color: var(--muted); margin-left: 0.25rem; }
.topic-option .summary { display: block; font-size: 13px; color: var(--muted); }
.topic-option .example { display: block; margin-top: 0.2rem; font-family: var(--font-french); }
.topic-option .total { margin-left: auto; font-size: 12px; color: var(--muted); white-space: nowrap; }

.setup-side { position: sticky; top: 1.25rem; }
.setup-side fieldset + fieldset { margin-top: 1.4rem; }
.setup-side legend { font-size: 15px; }
.setup-side .note { margin-top: 0.6rem; font-size: 13px; color: var(--muted); min-height: 2.6em; }
.setup-side .join .btn { padding-inline: 0.25rem; font-weight: 600; }
.setup-side .start { margin-top: 1.4rem; display: grid; gap: 0.6rem; }
.setup-side .start .btn { width: 100%; }
.setup-side .guide-link { margin-top: 0.4rem; text-align: center; font-size: 13px; }


.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}

.stat-cell { padding: 1.35rem; }
.stat-cell + .stat-cell { border-left: 1px solid var(--line); }
.stat-cell dt, .stat-cell .sub { font-size: 12px; color: var(--muted); }
.stat-cell dd.value { font-size: 29px; font-weight: 650; margin: 0.4rem 0; line-height: 1.2; }

.progress-layout { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 1.5rem; margin-top: 1.5rem; }

.week-chart { display: flex; align-items: flex-end; gap: 0.75rem; margin: 1.4rem 0 0.9rem; }
.week-chart li { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 0.4rem; font-size: 12px; color: var(--muted); }
.week-chart .bar { width: 100%; max-width: 54px; height: 64px; display: flex; align-items: flex-end; background: color-mix(in oklab, var(--line) 45%, var(--surface)); border-radius: 5px; overflow: hidden; }
.week-chart .bar span { display: block; width: 100%; background: #7f9d8e; border-radius: 5px; }
[data-theme="tableau"] .week-chart .bar span { background: #8fb3a1; }
.week-chart .is-today { color: var(--ink); font-weight: 700; }
.week-chart .is-future { opacity: 0.55; }

.progress-module { border-bottom: 1px solid var(--line); }
.progress-module summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(8rem, 15rem) 8.5rem auto;
  align-items: center;
  gap: 1rem;
  padding: 1rem 0;
  cursor: pointer;
  list-style: none;
}
.progress-module summary::-webkit-details-marker { display: none; }
.progress-module summary .name { font-size: 15px; font-weight: 650; display: flex; align-items: center; gap: 0.6rem; }
.progress-module summary .dot { width: 0.8rem; height: 0.8rem; border-radius: 3px; background: var(--tone); flex-shrink: 0; border: 1px solid color-mix(in oklab, var(--ink) 15%, transparent); }
.progress-module summary .seen { font-size: 12px; color: var(--muted); text-align: right; white-space: nowrap; }
.progress-module summary .chevron { color: var(--muted); transition: transform 120ms; }
.progress-module[open] summary .chevron { transform: rotate(180deg); }
.progress-module .detail { padding: 0 0 1.25rem; }
.progress-module .detail > p { font-size: 13px; color: var(--muted); margin-bottom: 0.75rem; }

.topic-results { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.6rem 1.5rem; padding: 1rem 1.25rem; background: var(--surface); border: 1px solid var(--line); border-radius: 9px; }
.topic-results li { display: grid; gap: 0.15rem; font-size: 14px; }
.topic-results a { color: var(--ink); font-weight: 650; text-underline-offset: 3px; }
.topic-results small { font-size: 12px; color: var(--muted); }

.heat-panel { overflow-x: auto; }

.history-day { font-size: 18px; font-weight: 650; margin: 1.6rem 0 0.6rem; }
.history-list { display: grid; gap: 0.6rem; }

.history-row {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  padding: 1rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  text-decoration: none;
}

.history-row:hover { border-color: var(--accent); }
.history-row .score { display: grid; place-items: center; flex-shrink: 0; width: 3.4rem; height: 3.4rem; border-radius: 50%; background: var(--tone, var(--blue)); color: #293f54; font-size: 15px; font-weight: 650; font-variant-numeric: tabular-nums; }
.history-row .what { min-width: 0; flex: 1; }
.history-row h3 { font-size: 16px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-row p { font-size: 12px; color: var(--muted); }
.history-row .xp { font-size: 13px; color: var(--muted); white-space: nowrap; }
.history-row .resume { font-size: 13px; font-weight: 700; color: var(--accent); white-space: nowrap; }

.answer-card {
  padding: 1.1rem 1.35rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--line);
  border-radius: 10px;
}

.answer-card.is-right { border-left-color: var(--color-success); }
.answer-card.is-wrong { border-left-color: var(--color-error); }
.answer-card .meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; font-size: 13px; color: var(--muted); }
.answer-card .links { display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; margin-top: 0.4rem; font-size: 13px; }

.mistake-group + .mistake-group { margin-top: 2.25rem; }
.mistake-group .group-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem; margin-bottom: 0.9rem; }
.mistake-group .group-head h2 { font-size: 21px; font-weight: 650; display: flex; align-items: center; gap: 0.6rem; }
.mistake-group .group-head .dot { width: 0.9rem; height: 0.9rem; border-radius: 3px; background: var(--tone); }


.about { max-width: 790px; margin: 0 auto; }
.about h1 { font-size: 44px; line-height: 1.12; letter-spacing: -0.035em; font-weight: 650; margin: 0.9rem 0 1.25rem; }
.about .lead { font-size: 21px; line-height: 1.6; margin-bottom: 1rem; }
.about p { margin-bottom: 0.9rem; }
.about-art { float: right; width: 220px; margin: 0.5rem 0 1.25rem 1.9rem; }
.about ul { clear: both; display: grid; gap: 0.5rem; margin: 1.5rem 0; padding: 1.1rem 1.4rem; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
.about li { display: flex; gap: 0.6rem; }
.about li::before { content: "✎"; color: var(--accent); }

.empty-state { display: flex; align-items: center; gap: 1.25rem; padding: 1.5rem; }
.empty-state img { width: 96px; height: 96px; object-fit: contain; flex-shrink: 0; }

.done-art { width: 120px; height: 120px; margin: 0 auto 0.5rem; object-fit: contain; }

@media (max-width: 1050px) {
  .header-inner { gap: 1.4rem; padding-inline: 27px; }
  .page { padding-inline: 27px; }
  .site-footer { margin-inline: 27px; }
  .guide-layout { grid-template-columns: 180px minmax(0, 1fr); gap: 1.7rem; }
  .progress-layout { grid-template-columns: minmax(0, 1fr); }
  .stat-cell { padding: 1.1rem; }
}

@media (max-width: 760px) {
  .header-inner { flex-wrap: wrap; gap: 0.8rem; min-height: 0; padding: 0.85rem 20px 0; }
  .brand { font-size: 17px; }
  .brand img { width: 38px; height: 38px; }
  .brand-sub { font-size: 12px; }
  .site-nav { order: 3; width: 100%; justify-content: center; gap: 2.4rem; font-size: 13px; border-top: 1px solid var(--line); }
  .site-nav a { padding: 0.65rem 0.1rem; }
  .profile-menu summary { min-height: 46px; padding: 3px 0.5rem 3px 3px; gap: 0.3rem; }
  .profile-menu summary .name { display: none; }
  .avatar-art.header-size { --avatar-size: 38px; }
  .profile-panel { width: 270px; }
  .profile-panel .avatar-art.menu-size { --avatar-size: 48px; }
  .profile-panel li a { min-height: 43px; display: flex; align-items: center; }
  .page { padding: 1.5rem 20px 2rem; }
  .site-footer { margin-inline: 20px; }
  .page-title, .home-hero .page-title { font-size: 31px; letter-spacing: -0.03em; }
  .home-hero { grid-template-columns: minmax(0, 1fr); gap: 1.1rem; padding-bottom: 1.5rem; }
  .home-hero .lede { font-size: 14px; }
  .handnote { font-size: 19px; }
  .today { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 0.3rem 0.75rem; padding: 0.8rem 1rem; border-radius: 7px; border-left: 0; }
  .today h2 { margin: 0; font-size: 13px; }
  .today .count { font-size: 19px; }
  .today .of { font-size: 12px; }
  .today .meter { grid-column: 1 / -1; margin: 0.2rem 0; }
  .today p { grid-column: 1 / -1; }
  .section-head { align-items: flex-start; }
  .section-head h2 { font-size: 22px; }
  .section-head p { font-size: 12px; max-width: 7.5rem; text-align: right; }
  .module-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .module-visual { height: 100px; }
  .module-visual img { width: 100px; height: 100px; }
  .module-body { padding: 0.8rem 0.75rem; }
  .module-title { font-size: 18px; }
  .module-sub { font-size: 12px; line-height: 1.35; }
  .module-desc { font-size: 12px; margin: 0.5rem 0; }
  .module-count { font-size: 11px; }
  .module-state { font-size: 11px; top: 6px; left: 6px; }
  .bottom-row { grid-template-columns: minmax(0, 1fr); gap: 0.9rem; margin-top: 1.5rem; }
  .maker-note { padding: 0.5rem 0; }
  .module-banner { align-items: flex-start; gap: 0.75rem; padding: 1.1rem 1.2rem; }
  .module-banner img { width: 80px; height: 80px; order: 2; }
  .module-banner h1 { font-size: 29px; }
  .module-banner p { font-size: 13px; }
  .tab-nav { gap: 1.5rem; margin: 1rem 0 1.4rem; }
  .tab-nav a { font-size: 13px; }
  .overview-intro { grid-template-columns: minmax(0, 1fr); gap: 1rem; margin-top: 1.25rem; }
  .overview-intro > div > h2 { font-size: 23px; }
  .topic-row { grid-template-columns: minmax(0, 1fr); padding: 1rem; }
  .guide-layout { display: block; }
  .guide-index { display: none; }
  .mobile-index { display: block; margin-bottom: 1.5rem; padding: 0.6rem 0.9rem; background: var(--surface); border: 1px solid var(--line); border-radius: 7px; font-size: 13px; }
  .mobile-index summary { cursor: pointer; font-weight: 650; padding: 0.2rem 0; }
  .mobile-index ol { padding: 0.3rem 0 0.2rem 0.7rem; }
  .guide-section h2 { font-size: 24px; }
  .example-board { padding: 1.1rem 1rem; }
  .french { font-size: 19px; }
  .formula { gap: 0.4rem; }
  .formula-cell strong { font-size: 23px; padding: 0.25rem 0.6rem; }
  .rule-grid, .rule-grid.two { grid-template-columns: minmax(0, 1fr); }
  .word-grid, .word-grid.narrow { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .word-grid.wide { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pair-list, .pair-list.three { grid-template-columns: minmax(0, 1fr); padding: 0.9rem 1rem; }
  .conjugation { font-size: 16px; gap: 0.15rem 0.9rem; }
  .setup { grid-template-columns: minmax(0, 1fr); }
  .setup-side { position: static; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-cell + .stat-cell { border-left: 0; }
  .stat-cell:nth-child(odd) { border-right: 1px solid var(--line); }
  .stat-cell:nth-child(-n + 2) { border-bottom: 1px solid var(--line); }
  .stat-cell dd.value { font-size: 25px; }
  .panel { padding: 1.1rem; }
  .week-chart { gap: 0.4rem; }
  .progress-module summary { grid-template-columns: minmax(0, 1fr) auto auto; gap: 0.4rem 0.75rem; }
  .progress-module summary .meter { grid-column: 1 / -1; grid-row: 2; }
  .topic-results { grid-template-columns: minmax(0, 1fr); padding: 0.9rem 1rem; }
  .history-row { padding: 0.85rem 0.9rem; gap: 0.8rem; }
  .history-row .score { width: 2.9rem; height: 2.9rem; font-size: 13px; }
  .about h1 { font-size: 33px; }
  .about .lead { font-size: 19px; }
  .about-art { width: 130px; margin-left: 0.9rem; }
}

@media (prefers-reduced-motion: reduce) {
  .module-card, .profile-menu summary .chevron, .progress-module summary .chevron { transition: none; }
}

@media print {
  .site-header, .site-footer, .tab-nav, .guide-index, .mobile-index, .practice-link, .skip-link { display: none !important; }
  .guide-layout { display: block; }
  .page { padding: 0; max-width: none; }
  body { background: #fff; }
}

.settings-heading { display: flex; align-items: center; justify-content: space-between; gap: 1.75rem; margin-bottom: 1.7rem; }
.settings-heading .settings-note { font-size: 24px; transform: rotate(-3deg); color: var(--handnote); }

.settings-form { max-width: 1126px; }

.settings-surface {
  margin-bottom: 1.3rem;
  padding: 1.55rem 1.75rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.settings-surface h2 { font-size: 22px; line-height: 1.2; letter-spacing: -0.02em; font-weight: 650; margin-bottom: 0.35rem; }
.section-description { font-size: 13px; line-height: 1.6; color: var(--muted); }
.settings-section-heading { padding-bottom: 1.25rem; margin-bottom: 1.4rem; border-bottom: 1px solid var(--line-soft); }

.identity-layout { display: grid; grid-template-columns: minmax(0, 1fr) 274px; gap: 3.25rem; align-items: start; }
.identity-editor { max-width: 590px; }
.field-label, .settings-form legend, .avatar-fieldset legend { display: block; font-size: 13px; font-weight: 650; }
.field-label { margin-bottom: 0.5rem; }

.name-field {
  width: 100%;
  max-width: 480px;
  min-height: 46px;
  padding: 0.6rem 0.9rem;
  border: 1px solid color-mix(in oklab, var(--line), var(--ink) 18%);
  border-radius: 7px;
  background: var(--paper);
  color: var(--ink);
  font-size: 15px;
}

.field-help { margin: 0.4rem 0 1rem; font-size: 12px; line-height: 1.5; color: var(--muted); }
.avatar-fieldset { margin-top: 1.6rem; }

.avatar-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0.6rem; }

.avatar-choice {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 107px;
  padding: 0.7rem 0.3rem 0.55rem;
  border: 1px solid transparent;
  border-radius: 10px;
  background: var(--paper);
  cursor: pointer;
}

.avatar-choice:hover { background: color-mix(in oklab, var(--accent) 7%, var(--surface)); }
.avatar-choice:has(input:checked) { border-color: var(--accent); background: color-mix(in oklab, var(--accent) 9%, var(--surface)); }
.avatar-choice:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 3px; }
.avatar-choice input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.avatar-choice .picture { position: relative; display: block; }
.avatar-choice .avatar-art { box-shadow: 0 0 0 1px rgb(52 73 93 / 0.06); }
.avatar-choice .avatar-label { font-size: 11px; font-weight: 600; text-align: center; line-height: 1.4; }

.choice-check {
  position: absolute;
  right: -3px;
  bottom: -2px;
  display: none;
  place-items: center;
  width: 21px;
  height: 21px;
  border: 2px solid var(--surface);
  border-radius: 50%;
  background: var(--accent);
  color: var(--color-primary-content);
}

.avatar-choice:has(input:checked) .choice-check { display: grid; }

.identity-preview {
  position: sticky;
  top: 1.25rem;
  padding: 1.4rem 1.1rem;
  text-align: center;
  background: color-mix(in oklab, var(--accent) 8%, var(--surface));
  border: 1px solid color-mix(in oklab, var(--accent) 14%, var(--line));
  border-radius: 12px;
}

.identity-preview .preview-label { margin-bottom: 1rem; font-size: 12px; font-weight: 650; color: var(--muted); }
.identity-preview h3 { margin: 0.8rem 0 0.3rem; font-size: 20px; font-weight: 650; overflow-wrap: anywhere; }
.identity-preview .stats { font-size: 12px; color: var(--muted); }
.identity-preview hr { border: 0; border-top: 1px solid color-mix(in oklab, var(--accent) 16%, var(--line)); margin: 1.25rem 0 1rem; }
.identity-preview .handnote { font-size: 20px; }
.identity-preview .current { margin-top: 1.1rem; font-size: 11px; color: var(--muted); }
.identity-preview .current strong { color: var(--ink); font-weight: 600; }

.settings-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.3rem; }
.settings-pair .settings-surface { margin-bottom: 1.3rem; }
.preference-fieldset { margin-top: 1.3rem; }
.preference-fieldset legend { font-size: 12px; margin-bottom: 0.6rem; }

.goal-options { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.55rem; }

.goal-options label {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 69px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  cursor: pointer;
}

.goal-options input, .appearance-choice input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.goal-options label:has(input:checked), .appearance-choice:has(input:checked) {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
  background: color-mix(in oklab, var(--accent) 9%, var(--surface));
}
.goal-options label:has(input:focus-visible), .appearance-choice:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 3px; }
.goal-options .number { font-size: 21px; font-weight: 650; }
.goal-options small { font-size: 11px; color: var(--muted); }
.settings-pair .field-help { margin: 0.8rem 0 0; }

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  padding: 1.1rem 0;
  border-bottom: 1px solid var(--line-soft);
  cursor: pointer;
}

.switch-row:last-child { border-bottom: 0; padding-bottom: 0; }
.switch-row strong { display: block; font-size: 13px; font-weight: 650; }
.switch-row small { display: block; max-width: 300px; margin-top: 0.25rem; font-size: 12px; line-height: 1.5; color: var(--muted); }

.switch-control {
  appearance: none;
  position: relative;
  flex: 0 0 42px;
  width: 42px;
  height: 25px;
  margin: 0;
  border: 1px solid color-mix(in oklab, var(--line), var(--ink) 20%);
  border-radius: 20px;
  background: var(--track);
  cursor: pointer;
}

.switch-control::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 19px;
  height: 19px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 1px 2px rgb(26 48 75 / 0.13);
  transition: transform 150ms;
}

.switch-control:checked { background: var(--accent); border-color: var(--accent); }
.switch-control:checked::after { transform: translateX(17px); }

.appearance-section { display: grid; grid-template-columns: 274px minmax(0, 1fr); gap: 2.25rem; align-items: center; }
.appearance-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.7rem; }

.appearance-choice {
  position: relative;
  display: block;
  padding: 0.6rem 0.6rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  font-size: 12px;
  cursor: pointer;
}

.theme-mini { position: relative; display: block; height: 64px; margin-bottom: 0.55rem; overflow: hidden; border: 1px solid #d1dce6; border-radius: 5px; background: #f8fafd; }
.theme-mini i { position: absolute; inset: 0 0 auto 0; height: 13px; background: #ffffff; border-bottom: 1px solid #d6e0e8; }
.theme-mini b { position: absolute; left: 12px; top: 25px; width: 40%; height: 7px; border-radius: 2px; background: #afc0d1; }
.theme-mini em { position: absolute; left: 12px; right: 12px; top: 39px; height: 13px; border-radius: 2px; background: #e2edf3; }
.theme-mini.dark { background: #243849; border-color: #4b6071; }
.theme-mini.dark i { background: #344b5e; border-color: #455f75; }
.theme-mini.dark b { background: #b8d0e3; }
.theme-mini.dark em { background: #597185; }
.theme-mini.auto { background: linear-gradient(90deg, #f8fafd 50%, #243849 50%); }
.theme-mini.auto i { background: linear-gradient(90deg, #ffffff 50%, #344b5e 50%); }
.theme-mini.auto em { background: linear-gradient(90deg, #e2edf3 50%, #597185 50%); }
.appearance-choice .choice-check { right: 0.5rem; bottom: 0.55rem; width: 18px; height: 18px; border-width: 0; }
.appearance-choice:has(input:checked) .choice-check { display: grid; }

.settings-save { display: flex; align-items: center; justify-content: space-between; gap: 1.25rem; min-height: 56px; padding-top: 0.5rem; }
.settings-status { font-size: 12px; color: var(--muted); }
.settings-status.is-error { color: var(--color-error); font-weight: 600; }
.settings-status:focus { outline: none; }
.settings-save .buttons { display: flex; gap: 0.7rem; }
.settings-save .btn { min-width: 112px; }

.profile-picker { max-width: 760px; margin: 0.6rem auto 1rem; text-align: center; }
.profile-picker > img { width: 94px; height: 94px; object-fit: contain; display: inline-block; }
.profile-picker .handnote { margin: 0.6rem 0 0.4rem; }
.profile-picker h1 { font-size: 34px; line-height: 1.2; letter-spacing: -0.03em; font-weight: 650; }
.profile-picker .lede { margin: 0.6rem auto 0; }
.profile-people { display: flex; flex-wrap: wrap; justify-content: center; gap: 1rem; margin: 1.6rem 0; }

.profile-person {
  flex: 0 1 260px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1.6rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.profile-person h2 { margin: 0.9rem 0 0.3rem; font-size: 22px; font-weight: 650; overflow-wrap: anywhere; }
.profile-person p { font-size: 13px; color: var(--muted); margin-bottom: 1rem; }
.profile-person form { width: 100%; margin-top: auto; }
.profile-person .btn { width: 100%; }
.new-profile { text-align: left; margin-top: 2rem; }
.new-profile .actions { margin-top: 1.4rem; }

@media (max-width: 1100px) {
  .identity-layout { grid-template-columns: minmax(0, 1fr) 225px; gap: 1.9rem; }
  .avatar-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .settings-surface { padding: 1.45rem; }
  .appearance-section { grid-template-columns: 210px minmax(0, 1fr); gap: 1.5rem; }
}

@media (max-width: 760px) {
  .settings-heading .settings-note { display: none; }
  .settings-surface { padding: 1.25rem 1.05rem; margin-bottom: 1.05rem; border-radius: 10px; }
  .settings-surface h2 { font-size: 21px; }
  .identity-layout { grid-template-columns: minmax(0, 1fr); gap: 1.4rem; }
  .identity-preview { display: none; }
  .name-field { max-width: none; font-size: 16px; }
  .avatar-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.5rem; }
  .avatar-choice { min-height: 111px; }
  .avatar-choice .avatar-art { --avatar-size: 66px; }
  .settings-pair { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .settings-pair .settings-surface { margin-bottom: 1.05rem; }
  .goal-options { gap: 0.45rem; }
  .goal-options .number { font-size: 22px; }
  .switch-control { flex-basis: 44px; width: 44px; height: 27px; }
  .switch-control::after { width: 21px; height: 21px; }
  .appearance-section { grid-template-columns: minmax(0, 1fr); gap: 1.1rem; }
  .appearance-options { gap: 0.5rem; }
  .appearance-choice { padding: 0.5rem 0.5rem 0.6rem; font-size: 11px; line-height: 1.4; }
  .theme-mini { height: 60px; }
  .appearance-choice .choice-check { top: 0.3rem; right: 0.3rem; bottom: auto; width: 19px; height: 19px; border-width: 2px; }
  .settings-save {
    position: sticky;
    bottom: 0;
    z-index: 5;
    flex-direction: column-reverse;
    align-items: stretch;
    gap: 0.55rem;
    margin: 0 -20px -0.5rem;
    padding: 0.8rem 20px;
    border-top: 1px solid var(--line);
    background: color-mix(in oklab, var(--paper) 94%, transparent);
    backdrop-filter: blur(8px);
  }
  .settings-save .buttons .btn { flex: 1; min-width: 0; min-height: 44px; }
  .settings-status { text-align: center; font-size: 11px; }
  .profile-picker h1 { font-size: 29px; }
}

@media (prefers-reduced-motion: reduce) {
  .switch-control::after { transition: none; }
}

/* Reading-language controls follow the notebook's existing tokens and avatar menu. */
.header-preferences {
  display:flex;
  align-items:center;
  gap:12px;
  margin-left:auto;
  min-width:0
}

.header-preferences .profile-menu {
  margin-left:0
}

.language-menu {
  position:relative;
  flex:none;
  color:var(--ink);
  font-family:var(--font-ui)
}

.language-menu summary {
  display:flex;
  align-items:center;
  gap:5px;
  cursor:pointer;
  list-style:none;
  min-height:48px;
  padding:4px 10px;
  border:1px solid var(--line);
  border-radius:28px;
  background:var(--surface)
}

.language-menu summary::-webkit-details-marker {
  display:none
}

.language-menu[open] summary,.language-menu summary:hover {
  border-color:var(--accent);
  background:var(--paper)
}

.language-pair {
  display:inline-flex;
  align-items:center;
  gap:2px;
  vertical-align:middle
}

.language-flag {
  width:43px;
  height:33px;
  object-fit:contain
}

.language-arrow {
  width:23px;
  height:20px;
  object-fit:contain
}

.language-panel {
  position:absolute;
  right:0;
  top:calc(100% + 10px);
  width:320px;
  max-height:calc(100dvh - 100px);
  overflow-y:auto;
  overscroll-behavior:contain;
  padding:20px;
  border:1px solid var(--line);
  border-radius:12px;
  background:var(--surface);
  box-shadow:0 10px 30px #162a431a;
  z-index:50
}

.language-panel h2 {
  font-size:17px;
  font-weight:650;
  line-height:1.3;
  margin:0 0 7px
}

.language-panel>p {
  font-size:12px;
  color:var(--muted);
  margin:0 0 15px
}

.language-option {
  width:100%;
  display:flex;
  align-items:center;
  text-align:left;
  gap:12px;
  padding:10px;
  border:1px solid transparent;
  border-radius:8px;
  min-height:66px;
  background:transparent;
  cursor:pointer
}

.language-option[aria-pressed=true] {
  border-color:var(--line);
  background:var(--paper)
}

.language-option:hover {
  border-color:var(--accent)
}

.language-option img,.language-tile img,.language-target img {
  object-fit:contain;
  flex-shrink:0
}

.language-option strong,.language-tile strong {
  display:block;
  font-size:14px;
  font-weight:650
}

.language-option small,.language-tile small {
  display:block;
  font-size:11px;
  color:var(--muted);
  margin-top:3px
}

.language-check {
  margin-left:auto;
  font-weight:650;
  color:var(--accent)
}

.language-target {
  border-top:1px solid var(--line);
  padding-top:12px;
  margin-top:13px;
  display:flex;
  align-items:center;
  gap:8px;
  font-size:11px;
  color:var(--muted)
}

.language-target span {
  flex:1
}

.language-panel>a {
  display:inline-block;
  color:var(--accent);
  font-size:12px;
  text-decoration:underline;
  margin-top:12px
}

.language-settings .settings-section-heading {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:20px
}

.language-settings .settings-section-heading .language-flag {
  width:60px;
  height:44px
}

.language-tiles {
  border:0;
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(min(100%,280px),1fr));
  gap:15px;
  margin:22px 0;
  padding:0
}

.language-tile {
  position:relative;
  display:flex;
  align-items:center;
  gap:16px;
  padding:19px;
  border:1px solid var(--line);
  border-radius:9px;
  cursor:pointer;
  background:var(--paper)
}

.language-tile input {
  position:absolute;
  opacity:0;
  width:1px;
  height:1px
}

.language-tile:has(input:checked) {
  border-color:var(--accent);
  box-shadow:inset 0 0 0 1px var(--accent)
}

.language-tile .language-check {
  visibility:hidden
}

.language-tile:has(input:checked) .language-check {
  visibility:visible
}

.language-tile:has(input:focus-visible) {
  outline:3px solid var(--accent);
  outline-offset:3px
}

.language-help {
  display:flex;
  align-items:center;
  gap:28px;
  justify-content:space-between
}

.language-help p {
  font-size:13px;
  line-height:1.7;
  color:var(--muted);
  max-width:70ch
}

.language-help .btn {
  flex-shrink:0
}

.language-source {
  font-size:12px;
  color:var(--muted);
  margin-top:18px
}

.language-status:empty {
  display:none
}

.language-status {
  position:fixed;
  bottom:16px;
  left:50%;
  transform:translateX(-50%);
  max-width:90vw;
  background:var(--ink);
  color:var(--paper);
  padding:12px 20px;
  border-radius:8px;
  z-index:60
}

@media(max-width:1080px) {
  .header-preferences .profile-menu .name {
    display:none
  }
  .header-inner {
    gap:20px
  }
  .site-nav {
    gap:18px
  }
}

@media(max-width:760px) {
  .header-inner {
    display:grid;
    grid-template-columns:1fr auto;
    gap:0;
    padding:13px 20px 0
  }
  .brand {
    font-size:17px;
    gap:6px;
    white-space:nowrap
  }
  .brand img {
    width:30px;
    height:39px
  }
  .brand-sub {
    display:none
  }
  .header-preferences {
    gap:7px
  }
  .header-preferences .profile-menu summary {
    padding:3px;
    min-height:44px;
    border-radius:50%
  }
  .header-preferences .profile-menu .chevron {
    display:none
  }
  .language-menu summary {
    min-height:44px;
    padding:3px 7px;
    gap:1px
  }
  .language-menu summary>svg {
    width:10px
  }
  .language-flag {
    width:32px;
    height:28px
  }
  .language-arrow {
    width:18px;
    height:16px
  }
  .language-pair {
    gap:0
  }
  .language-panel {
    width:290px;
    padding:18px;
    right:0
  }
  .site-nav {
    grid-row:2;
    grid-column:1/-1;
    justify-content:center;
    margin:12px 0 0;
    padding:4px 0;
    gap:30px;
    border-top:1px solid var(--line);
    width:100%
  }
  .language-settings .settings-section-heading>.language-pair {
    display:none
  }
  .language-tiles {
    grid-template-columns:1fr;
    gap:10px
  }
  .language-tile {
    padding:16px
  }
  .language-help {
    display:block
  }
  .language-help .btn {
    width:100%;
    margin-top:15px
  }
  .language-panel h2 {
    font-size:16px
  }
  .language-option {
    min-height:62px
  }
  .language-target {
    font-size:11px
  }
  .language-menu .language-panel {
    max-width:calc(100vw - 32px)
  }
  body:has(.profile-menu) .header-preferences .language-panel {
    right:-49px
  }
}

@media(max-width:360px) {
  .header-inner {
    padding-left:15px;
    padding-right:15px
  }
  .brand {
    font-size:14px
  }
  .brand img {
    width:24px
  }
  .language-menu summary {
    padding:3px 4px
  }
  .language-menu .language-flag {
    width:28px
  }
  .language-menu .language-arrow {
    width:16px
  }
  .header-preferences {
    gap:5px
  }
}

@media (max-width:760px) {
  .header-inner:has(.choose-profile) .header-preferences {
    display: contents;
  }
  .header-inner:has(.choose-profile) .language-menu {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
  }
  .header-inner .choose-profile {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-self: end;
    margin: 10px 0 12px;
  }
  .header-inner:not(:has(.site-nav)):not(:has(.choose-profile)) {
    padding-bottom: 13px;
  }
}

/* Account pages: a personal notebook, using the existing paper and pencil tokens. */
.guest-actions { display:flex; align-items:center; gap:.65rem; flex-wrap:wrap; }
.welcome-intro { display:grid; grid-template-columns:minmax(0,1fr) 240px; align-items:center; gap:3rem; padding:2rem 0 3rem; }
.welcome-intro .page-title { max-width:21ch; font-size:clamp(2rem,4vw,3.1rem); margin-top:.8rem; }
.welcome-intro .lede { max-width:60ch; line-height:1.75; }
.welcome-rat { width:100%; object-fit:contain; }
.welcome-note { margin-top:1rem; color:var(--muted); font-size:.9rem; }
.welcome-modules-heading { align-items:start; }
.welcome-modules-heading p { max-width:35ch; text-align:left; }
.account-layout { display:grid; grid-template-columns: .9fr 1.1fr; gap:clamp(2rem,6vw,6rem); max-width:970px; margin:2rem auto 4rem; align-items:start; }
.account-welcome { padding:2rem 0; }
.account-welcome img { display:block; margin:2rem 0; object-fit:contain; }
.account-welcome h2 { font-family:Literata,Georgia,serif; font-size:clamp(1.6rem,3vw,2.2rem); line-height:1.4; margin-bottom:1rem; max-width:15ch; }
.account-welcome p:not(.handnote) { color:var(--muted); line-height:1.8; max-width:32ch; }
.account-card { width:100%; padding:clamp(1.5rem,4vw,2.5rem); }
.account-card .page-title { font-size:clamp(1.7rem,3vw,2.25rem); line-height:1.3; margin-bottom:.65rem; }
.account-eyebrow { color:var(--accent); font-size:.75rem; text-transform:uppercase; letter-spacing:.13em; margin-bottom:1rem; font-weight:700; }
.account-form { display:grid; gap:1.1rem; margin-top:1.75rem; }
.account-field > label { display:block; font-weight:650; font-size:.9rem; margin-bottom:.45rem; }
.account-field input:not([type=checkbox]) { display:block; width:100%; min-height:46px; padding:.6rem .8rem; border:1px solid var(--line); border-radius:8px; background:var(--paper); color:var(--ink); }
.account-field input:focus-visible, .timezone-section input:focus-visible { outline:2px solid var(--accent); outline-offset:3px; }
.account-field .account-remember { display:flex; align-items:center; gap:.65rem; font-weight:400; }
.account-remember input { width:18px; height:18px; accent-color:var(--accent); }
.account-field .field-help { margin-top:.5rem; font-size:.78rem; }
.account-field .field-help ul { padding-left:1.1rem; list-style:disc; }
.account-errors { color:var(--wrong-line); font-size:.88rem; line-height:1.5; margin:.5rem 0; }
.account-submit { width:100%; margin-top:.3rem; }
.account-links { margin-top:1.5rem; font-size:.9rem; color:var(--muted); }
.account-links a { color:var(--accent); text-decoration:underline; text-underline-offset:3px; }
.account-join { margin-top:1.75rem; padding-top:1.5rem; border-top:1px solid var(--line); }
.account-join h2 { font-weight:650; font-size:1.1rem; }
.account-join p { margin:.4rem 0 1rem; color:var(--muted); font-size:.9rem; }
.account-join .btn { width:100%; }
.account-password { position:relative; }
.account-password input:not([type=checkbox]) { padding-right:6rem; }
.account-password button { position:absolute; right:3px; top:2px; bottom:2px; padding:0 .75rem; color:var(--accent); font-size:.82rem; font-weight:650; border-radius:5px; cursor:pointer; }
.account-field.has-error input:not([type=checkbox]) { border-color:var(--color-error); }
.account-summary { display:flex; align-items:center; justify-content:space-between; gap:1rem; margin-bottom:1.5rem; }
.account-summary p { color:var(--muted); margin-top:.35rem; overflow-wrap:anywhere; }
.timezone-section .name-field { max-width:460px; }
.timezone-actions { display:flex; gap:1rem; align-items:center; flex-wrap:wrap; margin-top:1rem; }
.account-standalone { max-width:650px; margin:2rem auto; }
@media(max-width:760px) {
  .guest-header .header-preferences { display:contents; }
  .guest-header .language-menu { grid-column:2; grid-row:1; justify-self:end; }
  .guest-actions { grid-column:1/-1; grid-row:2; justify-content:flex-end; padding:10px 0 0; }
  .welcome-intro { grid-template-columns:minmax(0,1fr) 110px; gap:1rem; padding:1rem 0 2rem; }
  .welcome-modules-heading { flex-direction:column; gap:.5rem; }
}
@media(max-width:480px) {
  .welcome-intro { display:block; position:relative; }
  .welcome-intro .handnote { padding-right:70px; min-height:60px; display:flex; align-items:center; }
  .welcome-rat { position:absolute; top:.7rem; right:0; width:64px; height:64px; }
}
@media(max-width:720px) {
  .account-layout { grid-template-columns:1fr; gap:1.25rem; margin:0 auto 2rem; max-width:480px; }
  .account-welcome { padding:0; display:flex; align-items:center; gap:1rem; }
  .account-welcome img { width:70px; height:70px; margin:0; order:-1; }
  .account-welcome h2, .account-welcome p:not(.handnote) { display:none; }
  .account-welcome .handnote { margin:0; }
  .account-summary { align-items:flex-start; flex-direction:column; }
}
