/* Qorvon — feuille de style commune */

@font-face {
  font-family: "IBM Plex Sans";
  src: url("./fonts/ibm-plex-sans-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Sans";
  src: url("./fonts/ibm-plex-sans-latin-500-normal.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Sans";
  src: url("./fonts/ibm-plex-sans-latin-600-normal.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Sans";
  src: url("./fonts/ibm-plex-sans-latin-700-normal.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Mono";
  src: url("./fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Mono";
  src: url("./fonts/ibm-plex-mono-latin-500-normal.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Mono";
  src: url("./fonts/ibm-plex-mono-latin-600-normal.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

/* ---------- Jetons ---------- */

:root {
  color-scheme: light;
  --bg: #f4f4f6;
  --s1:#ffffff;
  --s2:#f0f0f3;
  --s3:#e5e5ea;
  --line:#e1e1e6;
  --fg:#050506;
  --mut:#6a6d84;
  --upbg:#e3f4ec;
  --dn:#c4263e;
  --dnbg:#fbe8eb;
  --ac:#1a56ff;
  --on-ac:#fff;
  --on-dn:#fff;
  --on-up:#fff;
  --acbg:#e6edff;
  --grid:#ededf0;
  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  /* Legacy names (cards, forms, offline page): aliases of the workstation tokens, so old blocks match the panels. */
  --surface: var(--s1);
  --surface-2: var(--s2);
  --border: var(--line);
  --text: var(--fg);
  --text-soft: var(--mut);
  --accent: #141417;
  --accent-hover: #050506;
  --accent-text: #050506;
  --accent-soft: #efeff1;
  --on-accent: #ffffff;
  --up: #007a46;
  --up-soft: var(--upbg);
  --down: var(--dn);
  --down-soft: var(--dnbg);
  --warn: #553c00;
  --warn-soft: #f6eccf;
  --warn-line: #c39621;
  --header-bg: rgb(250 250 250 / 85%);
  --shadow: 0 1px 2px rgb(5 5 6 / 4%), 0 8px 24px rgb(5 5 6 / 5%);
  --shadow-pop: 0 12px 32px rgb(5 5 6 / 14%);

  --font: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --radius: 16px;
  --radius-sm: 10px;
  --gutter: clamp(16px, 2.5vw, 48px);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #050506;
    --s1:#0c0c0f;
    --s2:#141418;
    --s3:#1d1d23;
    --line:#24242b;
    --fg:#f5f5f7;
    --mut:#85869b;
    --upbg:#06241a;
    --dn:#ff3d5a;
    --dnbg:#2c0d14;
    --ac:#4d8dff;
    --on-ac:#050506;
    --on-dn:#050506;
    --on-up:#03150d;
    --acbg:#0f1b36;
    --grid:#15151a;
    --surface: var(--s1);
    --surface-2: var(--s2);
    --border: var(--line);
    --text: var(--fg);
    --text-soft: var(--mut);
    --accent: #fafafa;
    --accent-hover: #e3e3e8;
    --accent-text: #ffffff;
    --accent-soft: #1f1f25;
    --on-accent: #050506;
    --up: #00da80;
    --up-soft: var(--upbg);
    --down: var(--dn);
    --down-soft: var(--dnbg);
    --warn: #ffcd60;
    --warn-soft: #2b2617;
    --warn-line: #ffcd60;
    --header-bg: rgb(5 5 6 / 85%);
    --shadow: none;
    --shadow-pop: 0 12px 32px rgb(0 0 0 / 60%);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #050506;
  --s1:#0c0c0f;
  --s2:#141418;
  --s3:#1d1d23;
  --line:#24242b;
  --fg:#f5f5f7;
  --mut:#85869b;
  --upbg:#06241a;
  --dn:#ff3d5a;
  --dnbg:#2c0d14;
  --ac:#4d8dff;
  --on-ac:#050506;
  --on-dn:#050506;
  --on-up:#03150d;
  --acbg:#0f1b36;
  --grid:#15151a;
  --surface: var(--s1);
  --surface-2: var(--s2);
  --border: var(--line);
  --text: var(--fg);
  --text-soft: var(--mut);
  --accent: #fafafa;
  --accent-hover: #e3e3e8;
  --accent-text: #ffffff;
  --accent-soft: #1f1f25;
  --on-accent: #050506;
  --up: #00da80;
  --up-soft: var(--upbg);
  --down: var(--dn);
  --down-soft: var(--dnbg);
  --warn: #ffcd60;
  --warn-soft: #2b2617;
  --warn-line: #ffcd60;
  --header-bg: rgb(5 5 6 / 85%);
  --shadow: none;
  --shadow-pop: 0 12px 32px rgb(0 0 0 / 60%);
}

/* ---------- Base ---------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: clamp(16px, calc(9px + 0.55vw), 18px);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
}

h1,
h2,
h3,
h4 {
  line-height: 1.2;
  letter-spacing: -0.015em;
  margin: 0 0 0.5em;
  font-weight: 600;
  text-wrap: balance;
}

h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  letter-spacing: -0.03em;
}

h2 {
  font-size: clamp(1.4rem, 3vw, 1.75rem);
}

h3 {
  font-size: 1.08rem;
  font-weight: 600;
}

p,
ul,
ol {
  margin: 0 0 1em;
  max-width: 80ch;
}

ul,
ol {
  padding-left: 1.3em;
}

li {
  margin: 0.35em 0;
}

a {
  color: var(--accent-text);
  text-underline-offset: 3px;
}

a:hover {
  color: var(--accent-hover);
}

strong {
  font-weight: 600;
}

code,
.mono {
  font-family: var(--mono);
  font-size: 0.92em;
}

.num,
td,
.stat-value {
  font-variant-numeric: tabular-nums;
}

:focus-visible {
  outline: 2px solid var(--accent-text);
  outline-offset: 2px;
  border-radius: 4px;
}

[hidden] {
  display: none !important;
}

/* Pages use the whole screen width (the owner works on a wide PC screen); only the side gutter remains. */
.container {
  width: 100%;
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.small {
  font-size: 0.875rem;
  color: var(--text-soft);
}

.error {
  color: var(--down);
  font-size: 0.9rem;
  min-height: 1.2em;
  margin: 0.5em 0 0;
}

/* The session could not be read (offline, server error): one readable line instead of the sign-in form. */
.session-error {
  font-size: 1rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Cadre : bandeau, en-tête, menu latéral (shell.js) ----------
   Ticker 32 px, header 54 px, sidebar 232 px. The empty #qorvon-shell placeholder already takes that space,
   so nothing moves when shell.js fills it. Pages without the shell (account pages, offline) keep a plain header. */

#qorvon-shell {
  --frame-top: 86px;
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--s1);
  font-size: 14.5px;
  line-height: 1.45;
}

#qorvon-shell:empty {
  height: 86px;
  border-bottom: 1px solid var(--line);
}

#qorvon-shell.no-tape {
  --frame-top: 54px;
}

/* The shell spans the whole width (its logo cell sits above the sidebar); the page content starts after it. */
@media (min-width: 1101px) {
  body:has(> #qorvon-shell) {
    padding-left: 232px;
  }

  #qorvon-shell {
    margin-left: -232px;
  }
}

/* Bandeau des prix simulés */
.tape {
  height: 32px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--line);
  background: var(--s1);
  overflow: hidden;
  white-space: nowrap;
  font-size: 13.5px;
}

.tape-tag {
  flex: none;
  height: 100%;
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  border-right: 1px solid var(--line);
  font-size: 11.5px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--mut);
  font-weight: 500;
}

/* Only shown while the strip moves (it does not under prefers-reduced-motion). */
.tape-pause {
  display: none;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 100%;
  padding: 0;
  border: 0;
  border-left: 1px solid var(--line);
  background: var(--s1);
  color: var(--mut);
  cursor: pointer;
}

.tape-pause:hover {
  color: var(--fg);
}

.tape-pause svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tape-pause .icon-play,
.tape-pause[aria-pressed="true"] .icon-pause {
  display: none;
}

.tape-pause[aria-pressed="true"] .icon-play {
  display: block;
}

.tape-view {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.tape-track,
.tape-set {
  display: inline-flex;
}

.tape-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 18px;
  border-right: 1px solid var(--line);
}

.tape-item b {
  font-weight: 600;
}

.tape-item .num {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

@media (prefers-reduced-motion: no-preference) {
  .tape-track {
    animation: tape-roll 60s linear infinite;
  }

  .tape:hover .tape-track,
  .tape:focus-within .tape-track,
  .tape.paused .tape-track {
    animation-play-state: paused;
  }

  .tape-pause {
    display: inline-flex;
  }

  @keyframes tape-roll {
    to {
      transform: translateX(-50%);
    }
  }
}

/* En-tête */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--s1);
  border-bottom: 1px solid var(--line);
}

.site-header .container {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 54px;
}

#qorvon-shell .site-header {
  position: static;
  height: 54px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 14px 0 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 16.5px;
  color: var(--fg);
  text-decoration: none;
  margin-right: auto;
}

.brand:hover {
  color: var(--fg);
}

#qorvon-shell .brand {
  width: 232px;
  height: 100%;
  flex: none;
  padding: 0 14px;
  border-right: 1px solid var(--line);
  margin-right: 0;
}

.brand-mark {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  background: var(--ac);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-style: normal;
  font-weight: 600;
}

/* White on the dark theme's lighter blue is too faint: dark text instead. */
:root[data-theme="dark"] .brand-mark {
  color: #050506;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .brand-mark {
    color: #050506;
  }
}

.shell-search {
  flex: 0 1 440px;
  min-width: 0;
  height: 36px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--s2);
  color: var(--mut);
}

.shell-search:focus-within {
  border-color: var(--ac);
  outline: 2px solid var(--ac);
  outline-offset: 1px;
}

.shell-search svg {
  width: 16px;
  height: 16px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}

.shell-search input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  background: none;
  color: var(--fg);
  font: inherit;
  outline: none;
}

.shell-search input::placeholder {
  color: var(--mut);
}

.shell-tools {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.shell-account {
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--s1);
  color: var(--fg);
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}

.shell-account:hover {
  background: var(--s2);
  color: var(--fg);
}

/* Shown once the session is known (every page with the shell needs one). */
.shell-account:not([data-state="in"]) {
  visibility: hidden;
}

.site-header .icon-btn {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 5px;
  border: 1px solid var(--line);
  background: var(--s1);
  color: var(--fg);
}

.site-header .icon-btn:hover {
  background: var(--s2);
  border-color: var(--line);
  color: var(--fg);
}

.site-header .icon-btn svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  flex: none;
}

.icon-btn:hover {
  border-color: var(--accent-text);
  color: var(--accent-text);
}

.icon-btn svg {
  width: 18px;
  height: 18px;
}

.theme-toggle .icon-sun {
  display: none;
}

:root[data-theme="dark"] .theme-toggle .icon-sun {
  display: block;
}

:root[data-theme="dark"] .theme-toggle .icon-moon {
  display: none;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun {
    display: block;
  }

  :root:not([data-theme="light"]) .theme-toggle .icon-moon {
    display: none;
  }
}

.nav-toggle {
  display: none;
}

/* Menu latéral */
.site-nav {
  position: fixed;
  left: 0;
  top: var(--frame-top);
  bottom: 0;
  width: 232px;
  z-index: 40;
  display: flex;
  flex-direction: column;
  padding: 8px;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--s1);
  border-right: 1px solid var(--line);
}

.nav-group {
  padding: 16px 8px 5px;
  font-size: 11.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--mut);
  font-weight: 500;
}

.site-nav a,
.site-nav .linklike {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 36px;
  padding: 0 8px;
  border: 0;
  border-radius: 5px;
  background: none;
  color: var(--mut);
  font: inherit;
  font-weight: 500;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.site-nav a:hover,
.site-nav .linklike:hover {
  background: var(--s2);
  color: var(--fg);
}

.site-nav a[aria-current="page"] {
  background: var(--acbg);
  color: var(--ac);
  box-shadow: inset 3px 0 0 var(--ac);
}

.site-nav svg {
  width: 17px;
  height: 17px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-account {
  margin-top: auto;
  display: flex;
  flex-direction: column;
}

.linklike {
  padding: 8px 14px;
  border-radius: 5px;
  color: var(--mut);
  text-decoration: none;
  font-size: 0.94rem;
  font-weight: 500;
  background: none;
  border: 0;
  font-family: inherit;
  cursor: pointer;
}

.linklike:hover {
  color: var(--fg);
  background: var(--s2);
}

/* Below 1100 px the sidebar becomes a drawer opened by the menu button. */
@media (max-width: 1100px) {
  .site-header .nav-toggle {
    display: inline-grid;
  }

  #qorvon-shell .site-header {
    padding: 0 12px;
    gap: 10px;
  }

  #qorvon-shell .brand {
    width: auto;
    padding: 0;
    border-right: 0;
  }

  .site-nav {
    display: none;
    width: min(280px, 86vw);
    z-index: 60;
  }

  .site-nav.open {
    display: flex;
  }
}

/* Phones: the search is the Lexique page itself; every control gets a 44 px touch target. */
@media (max-width: 699px) {
  .shell-search {
    display: none;
  }

  .site-header .icon-btn,
  .shell-account {
    min-width: 44px;
    height: 44px;
  }

  .site-header .icon-btn {
    width: 44px;
  }

  .site-nav a,
  .site-nav .linklike {
    min-height: 44px;
  }

  .btn {
    min-height: 44px;
  }
}

/* ---------- Pastille et chapeau ---------- */

.kicker {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--accent-text);
  background: var(--accent-soft);
  padding: 5px 12px;
  border-radius: 999px;
  margin: 0 0 18px;
}

.lead {
  font-size: 1.15rem;
  color: var(--text-soft);
  max-width: 60ch;
}

/* ---------- Cartes ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  min-width: 0;
}

.card > :last-child {
  margin-bottom: 0;
}

.card-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
}

a.card-link {
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: var(--text);
  text-decoration: none;
  transition:
    border-color 0.15s,
    transform 0.15s;
}

a.card-link:hover {
  border-color: var(--accent-text);
  color: var(--text);
}

@media (prefers-reduced-motion: no-preference) {
  a.card-link:hover {
    transform: translateY(-2px);
  }
}

.card-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent-text);
  display: grid;
  place-items: center;
  margin-bottom: 8px;
}

.card-icon svg {
  width: 22px;
  height: 22px;
}

.card-title {
  font-size: 1.15rem;
  font-weight: 700;
}

.card-desc {
  color: var(--text-soft);
  font-size: 0.95rem;
}

.card-cta {
  margin-top: auto;
  padding-top: 8px;
  color: var(--accent-text);
  font-weight: 600;
  font-size: 0.92rem;
}

/* ---------- Boutons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 22px;
  border-radius: 999px;
  border: 1px solid transparent;
  font: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  text-decoration: none;
  transition:
    background 0.15s,
    border-color 0.15s,
    color 0.15s;
}

.btn,
.btn-primary {
  background: var(--accent);
  color: var(--on-accent);
}

.btn:hover,
.btn-primary:hover {
  background: var(--accent-hover);
  color: var(--on-accent);
}

.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}

.btn-ghost:hover {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ---------- Formulaires ---------- */

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.field label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-soft);
}

input,
select,
textarea {
  font: inherit;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  min-height: 44px;
  width: 100%;
  font-variant-numeric: tabular-nums;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent-text);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.form-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr));
  margin-bottom: 14px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

/* ---------- Encadrés ---------- */

.callout {
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  margin: 18px 0;
  max-width: 80ch;
}

.callout > :last-child {
  margin-bottom: 0;
}

.callout .ttl {
  display: block;
  font-weight: 700;
  margin-bottom: 4px;
}

.callout-warn {
  border-left-color: var(--warn-line);
  background: var(--warn-soft);
}

.callout-warn .ttl {
  color: var(--warn);
}

.callout-ok {
  border-left-color: var(--up);
  background: var(--up-soft);
}

.callout-ok .ttl {
  color: var(--up);
}

/* ---------- Tableaux ---------- */

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin: 0 0 1.2em;
  max-width: 100%;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.94rem;
}

th,
td {
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

th {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--text-soft);
  background: var(--surface-2);
}

tbody tr:last-child td {
  border-bottom: 0;
}

tbody tr:hover td {
  background: var(--surface-2);
}

.tag-up,
.tag-down {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.tag-up {
  color: var(--up);
  background: var(--up-soft);
}

.tag-down {
  color: var(--down);
  background: var(--down-soft);
}

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

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

/* ---------- Statistiques ---------- */

.stats {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 150px), 1fr));
}

.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-soft);
}

.stat-value {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* ---------- Sections ---------- */

main {
  padding-bottom: 72px;
}

.section {
  margin: 0 0 48px;
  scroll-margin-top: 84px;
}

/* ---------- Bulles d'explication ---------- */

abbr.term {
  text-decoration: underline dotted var(--accent-text);
  text-underline-offset: 3px;
  cursor: help;
  border-radius: 3px;
}

abbr.term:hover,
abbr.term[aria-describedby] {
  background: var(--accent-soft);
}

.term-pop {
  position: absolute;
  z-index: 100;
  pointer-events: none; /* text only: never block a click on what lies underneath */
  max-width: min(320px, calc(100vw - 2 * var(--gutter)));
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-pop);
  padding: 12px 14px;
  font-size: 0.9rem;
  line-height: 1.5;
}

.term-pop strong {
  display: block;
  color: var(--accent-text);
  margin-bottom: 2px;
}

/* ---------- Pied de page ---------- */

.site-footer {
  border-top: 1px solid var(--border);
  padding: 28px 0 40px;
  font-size: 0.85rem;
  color: var(--text-soft);
}

.site-footer p {
  max-width: 80ch;
  margin: 0 0 6px;
}

.card-grid + .callout {
  margin-top: 32px;
}

/* ---------- Cours : contenu des leçons ---------- */

.course {
  min-width: 0;
}

.course h3 {
  margin-top: 1.6em;
}

.calc h3 {
  margin-top: 0;
}

.calc .hint {
  color: var(--text-soft);
  font-size: 0.9rem;
}

.result {
  display: block;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin: 4px 0 12px;
  font-variant-numeric: tabular-nums;
  line-height: 1.7;
}

.result b {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
}

.opts {
  display: grid;
  gap: 8px;
}

.why {
  display: none;
  margin: 12px 0 0;
  font-size: 0.92rem;
  color: var(--text-soft);
}

.why.show {
  display: block;
}

.progress {
  height: 8px;
  background: var(--surface-2);
  border-radius: 999px;
  overflow: hidden;
  margin: 12px 0 6px;
}

.progress span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--up);
  border-radius: 999px;
}

@media (prefers-reduced-motion: no-preference) {
  .progress span {
    transition: width 0.25s ease;
  }
}

.track {
  list-style: none;
  padding: 0;
  margin: 12px 0 0;
  max-width: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.track li {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 16px;
  margin: 0;
  border-bottom: 1px solid var(--border);
}

.track li:last-child {
  border-bottom: 0;
}

.track input {
  width: 20px;
  height: 20px;
  min-height: 0;
  margin: 2px 0 0;
  flex: none;
  accent-color: var(--up);
  padding: 0;
}

.track label {
  cursor: pointer;
}

.track .phase {
  display: block;
  font-size: 0.78rem;
  color: var(--text-soft);
}

/* ---------- Rejeu ---------- */

.answer-grid {
  display: grid;
  gap: 8px;
}

.answer-grid .btn {
  width: 100%;
}

.price-form {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.entry-line,
.stop-line {
  margin: 4px 0;
}

.rr-preview {
  margin: 10px 0 0;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.rr-ok {
  color: var(--up);
}

.rr-warn {
  color: var(--warn);
}

.rr-bad {
  color: var(--down);
}

.feedback {
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  font-size: 0.95rem;
}

.feedback-ok {
  border-color: var(--up);
  background: var(--up-soft);
}

.feedback-warn {
  border-color: var(--warn-line);
  background: var(--warn-soft);
}

.feedback-bad {
  border-color: var(--down);
  background: var(--down-soft);
}

.exercise {
  display: grid;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.exercise-prompt {
  font-weight: 600;
  margin: 0;
}

.picker {
  display: grid;
  gap: 6px;
}

.pick-readout {
  margin: 0;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.picker-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.picker-buttons .btn {
  min-height: 40px;
  padding: 8px 14px;
  font-size: 0.88rem;
}

.lesson-actions {
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.module-done {
  padding: 22px 26px;
}

.card-first {
  border-color: var(--text-soft);
}

/* ---------- Rejeu : aide aux débutants ---------- */

.daily-text {
  max-width: none;
}

.replay-newcomer {
  grid-column: 1 / -1;
  margin: 0;
  max-width: none;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  max-width: none;
  font-size: 0.85rem;
  color: var(--text-soft);
}

.chart-legend li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
}

.swatch {
  display: inline-block;
  flex: none;
}

.swatch-up,
.swatch-down {
  width: 8px;
  height: 14px;
  border-radius: 2px;
}

.swatch-up {
  background: var(--up);
}

.swatch-down {
  background: var(--down);
}

.swatch-line {
  width: 18px;
  height: 2px;
  background: var(--text-soft);
}

.swatch-wave {
  width: 18px;
  height: 3px;
  background: var(--text-soft);
  transform: skewY(-20deg);
}

.review-lesson {
  margin: 0;
}

/* ---------- Cours : questions à cocher, fiches, schémas, tableau ---------- */

.choices {
  display: grid;
  gap: 8px;
}

.choices .choice {
  justify-content: flex-start;
  text-align: left;
  white-space: normal;
  min-height: 46px;
  height: auto;
}

.choice-check {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
  font-weight: 500;
}

.choice-check:hover {
  border-color: var(--text-soft);
}

.choice-check:has(input:checked) {
  border-color: var(--text);
  background: var(--surface-2);
}

.choice-check input {
  width: 18px;
  height: 18px;
  margin: 0;
  flex: none;
  accent-color: var(--text);
}

.choice-check span {
  line-height: 1.4;
}

.choice-hint {
  margin: -4px 0 0;
}

.market-card {
  display: grid;
  grid-template-columns: minmax(120px, 34%) minmax(0, 1fr);
  gap: 8px 14px;
  margin: 4px 0 0;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  font-size: 0.95rem;
}

.market-card-title {
  grid-column: 1 / -1;
  font-weight: 700;
}

.market-card dt {
  color: var(--text-soft);
}

.market-card dd {
  margin: 0;
}

.lesson-visual {
  display: grid;
  align-items: center;
  overflow-x: auto;
}

.schema-tall {
  display: none;
}

@media (max-width: 699px) {
  .schema.has-tall .schema-wide {
    display: none;
  }
  .schema.has-tall .schema-tall {
    display: block;
    max-width: 340px;
    margin: 0 auto;
  }
}

.schema {
  margin: 0;
  color: var(--text);
}

.schema svg {
  display: block;
  width: 100%;
  height: auto;
  max-height: 62vh;
}

.schema text {
  fill: currentColor;
  font-family: var(--font);
  font-size: 17px;
  text-anchor: middle;
}

.schema .schema-title {
  font-weight: 700;
  font-size: 20px;
}

.schema .schema-note {
  fill: var(--text-soft);
  font-size: 16px;
}

.schema-box rect {
  fill: var(--surface-2);
  stroke: var(--border);
  stroke-width: 2;
}

.schema-strong rect {
  stroke: currentColor;
}

.schema .schema-price {
  fill: none;
  stroke: currentColor;
  stroke-width: 3.5;
  stroke-linejoin: round;
}

.schema .schema-level {
  fill: none;
  stroke: var(--text-soft);
  stroke-width: 2.5;
  stroke-dasharray: 8 7;
}

.schema .schema-share {
  fill: none;
  stroke: var(--text-soft);
  stroke-width: 2.5;
  stroke-dasharray: 2 6;
  stroke-linecap: round;
}

.schema .schema-break {
  fill: none;
  stroke: var(--down);
  stroke-width: 3.5;
}

.schema .schema-break-up {
  fill: none;
  stroke: var(--up);
  stroke-width: 3.5;
}

.schema-arrows line {
  stroke: currentColor;
  stroke-width: 2.5;
}

.compare-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.98rem;
}

.compare-table th,
.compare-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.compare-table thead th {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-soft);
}

/* Course tables wrap their text so they fit the chart area; only figures stay on one line. */
.compare-table th,
.compare-table td {
  white-space: normal;
}

.compare-table caption {
  caption-side: bottom;
  text-align: left;
  padding-top: 10px;
  font-size: 0.85rem;
  color: var(--text-soft);
}

.compare-table tbody th {
  font-size: 1rem;
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text);
  background: transparent;
}

.compare-table td.num {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  white-space: nowrap;
}

/* ---------- Pages « plein écran » (Cours, Rejeu) sur PC ----------
   The page fits the window: header on top, compact footer at the bottom, nothing scrolls but the inner areas
   (course outline, step panel). Phones and short windows keep normal page scrolling. */

@media (min-width: 1100px) and (min-height: 600px) {
  body.app-screen {
    height: 100vh;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  body.app-screen > #qorvon-shell,
  body.app-screen > .site-footer {
    flex: none;
  }

  body.app-screen > main {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding-bottom: 12px;
  }

  body.app-screen > .site-footer {
    padding: 8px 0;
  }

  body.app-screen > .site-footer p {
    margin: 0;
    max-width: none;
  }
}

.zoom-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.zoom-buttons .zoom-btn {
  min-height: 38px;
  padding: 6px 14px;
  font-size: 0.88rem;
}

.zoom-buttons .zoom-btn[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}

/* Under a visual that scrolls inside its frame (full screen), while more is below. */
.visual-more {
  margin: 6px 0 0;
  text-align: center;
  font-size: 0.82rem;
  color: var(--text-soft);
}

/* Only on narrow screens, where wide tables scroll sideways inside their box. */
.scroll-hint {
  display: none;
  margin: 0 0 8px;
  font-size: 0.82rem;
  color: var(--text-soft);
}

.table-wrap.overflowing .scroll-hint {
  display: block;
  position: sticky;
  left: 0;
}

/* ---------- Cours : outils interactifs et chiffres clés ---------- */

.tool {
  display: grid;
  gap: 12px;
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.tool h3 {
  margin: 0;
  font-size: 1.1rem;
}

.tool p {
  margin: 0;
}

.tool-field {
  display: grid;
  gap: 6px;
  font-weight: 600;
}

.tool-field input[type="range"] {
  width: 100%;
  accent-color: var(--text);
}

.tool-input {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
}

.tool-input input {
  flex: 1;
  min-width: 0;
}

.tool-label {
  font-weight: 600;
}

.tool-results {
  display: grid;
  grid-template-columns: minmax(120px, 40%) minmax(0, 1fr);
  gap: 8px 14px;
  margin: 0;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.tool-results dt {
  color: var(--text-soft);
}

.tool-results dd {
  margin: 0;
  font-weight: 600;
}

.tool .tool-bad,
.tool-results .tool-bad {
  color: var(--down);
}

.tool-output {
  display: grid;
  gap: 4px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.tool-big {
  font-size: 1.4rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.stat-cards {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
}

.stat-card {
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.stat-card p {
  margin: 0;
}

.stat-card .stat-big {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 6px;
  font-variant-numeric: tabular-nums;
}

.market-field {
  max-width: 320px;
  margin: 12px 0 0;
}

/* ---------- Cours : questionnaire final ---------- */

.tool.quiz-tool {
  max-width: 960px;
}

.quiz-grid {
  display: grid;
  gap: 12px;
  align-items: start;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
}

.quiz-question legend:focus,
.quiz-result h3:focus {
  outline: none;
}

.quiz-question {
  display: grid;
  align-content: start;
  gap: 6px;
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}

.quiz-question legend {
  font-weight: 700;
  margin-bottom: 6px;
}

.quiz-question .choice-check {
  padding: 8px 12px;
  font-size: 0.92rem;
}

.quiz-form {
  display: grid;
  gap: 12px;
}

.quiz-result {
  display: grid;
  gap: 10px;
}

.quiz-reasons,
.quiz-warnings {
  margin: 0;
  padding-left: 1.2em;
  display: grid;
  gap: 6px;
}

.quiz-warnings {
  color: var(--down);
}

/* ---------- Examens de fin de niveau ---------- */

.exam-intro {
  display: grid;
  gap: 16px;
  width: 100%;
}

.exam-last {
  margin: 0;
  font-weight: 600;
}

.exam-corrections {
  display: grid;
  gap: 12px;
  width: 100%;
}

.exam-corrections h3 {
  margin: 0;
}

.exam-mistakes {
  margin: 0;
  padding-left: 1.4em;
  display: grid;
  gap: 14px;
}

.exam-mistakes li {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}

.exam-mistakes p {
  margin: 0 0 6px;
}

.exam-q {
  font-weight: 600;
}

.exam-given {
  color: var(--down);
}

.exam-answer {
  color: var(--text-soft);
}

.exam-perfect {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--up);
}

/* ---------- Zoom des graphiques ---------- */

.zoom-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.zoom-toolbar .zoom-tool {
  width: 32px;
  height: 32px;
  font-size: 1.1rem;
  font-weight: 700;
}

.zoom-toolbar .zoom-reset {
  width: auto;
  padding: 0 12px;
  font-size: 0.82rem;
}

@media (max-width: 699px) {
  .zoom-hint {
    display: none;
  }
}

/* ---------- Journal : onglets et situations du rejeu ---------- */

.tabs {
  display: flex;
  gap: 6px;
  margin: 8px 0 16px;
  border-bottom: 1px solid var(--border);
}

.tabs [role="tab"] {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--text-soft);
  font: inherit;
  font-weight: 600;
  padding: 10px 16px;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  cursor: pointer;
}

.tabs [role="tab"][aria-selected="true"] {
  color: var(--text);
  border-bottom-color: var(--text);
}

.replay-journal-intro {
  margin: 0 0 12px;
  max-width: 80ch;
}

#replay-attempts td.up {
  color: var(--up);
  font-weight: 600;
}

#replay-attempts td.down {
  color: var(--down);
  font-weight: 600;
}

#replay-attempts .replay-note {
  white-space: normal;
  min-width: 16ch;
  max-width: 40ch;
}

/* The table scrolls sideways on a phone: the editor stays in the visible part, at its width. */
.replay-table-wrap {
  container-type: inline-size;
}

.replay-editor {
  position: sticky;
  left: 16px;
  box-sizing: border-box;
  width: min(100%, calc(100cqw - 32px));
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 220px) minmax(0, 1fr);
  align-items: end;
  white-space: normal;
}

.replay-editor label {
  display: grid;
  gap: 4px;
  font-weight: 600;
}

.replay-editor .actions {
  grid-column: 1 / -1;
  margin: 0;
}

@media (max-width: 699px) {
  .replay-editor {
    grid-template-columns: 1fr;
  }
}

.btn.btn-small {
  min-height: 34px;
  padding: 6px 12px;
  font-size: 0.85rem;
}

.calc-result {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  font-weight: 600;
  min-height: 1.6em;
}

.calc-result.tool-bad {
  color: var(--down);
}

/* ---------- Ma progression ---------- */

.pr {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 10px;
  align-content: start;
  align-items: start;
  padding: 14px var(--gutter) 24px;
}

.pr > .panel {
  grid-column: span 4;
}

.pr > .w6 {
  grid-column: span 6;
}

.pr > .w8 {
  grid-column: span 8;
}

.pr > p {
  grid-column: 1 / -1;
  margin: 0;
}

@media (max-width: 1100px) {
  .pr > .panel {
    grid-column: 1 / -1;
  }
}

.bar {
  display: block;
  height: 8px;
  border-radius: 999px;
  background: var(--s3);
  overflow: hidden;
}

.bar.small-bar {
  height: 6px;
}

.bar b.w {
  background: var(--warn-line);
}

/* Level objectives: one cell per rule, each with its figure, its bar and its status. */
.obj {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

.obj > div {
  padding: 14px;
  border-right: 1px solid var(--line);
  display: grid;
  gap: 8px;
  align-content: start;
  justify-items: start;
}

.obj > div:last-child {
  border-right: 0;
}

.obj .v {
  font-size: 22px;
  font-weight: 500;
  line-height: 1.15;
}

.obj .tgt {
  display: block;
  font-size: 12.5px;
  font-weight: 400;
}

.obj .bar {
  width: 100%;
}

.prog-soon {
  margin: 0;
  max-width: none;
}

.prog-next {
  display: grid;
  gap: 12px;
  align-content: start;
  justify-items: start;
}

.prog-next p {
  margin: 0;
}

/* Result curve in R: inline SVG drawn to the box, 14 px from the right edge. */
.prog-curve-box {
  position: relative;
  height: 250px;
}

.prog-curve-box svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.pc-grid {
  stroke: var(--grid);
  stroke-width: 1;
}

.pc-zero {
  stroke: var(--line);
  stroke-width: 1;
}

.pc-axis {
  fill: var(--mut);
  font: 11px var(--mono);
}

.pc-limit {
  stroke-width: 1;
  stroke-dasharray: 5 4;
}

.pc-limit.dn {
  stroke: var(--dn);
}

.pc-limit.up {
  stroke: var(--up);
}

.pc-note {
  font: 600 11.5px var(--sans);
}

.pc-note.dn {
  fill: var(--dn);
}

.pc-note.up {
  fill: var(--up);
}

.pc-line {
  fill: none;
  stroke: var(--ac);
  stroke-width: 1.8;
}

.pc-area {
  fill: var(--ac);
  opacity: 0.1;
}

.pc-dot {
  fill: var(--ac);
}

/* Statistics: two columns of figures. */
.st {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.st > div {
  padding: 12px 14px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 3px;
  align-content: start;
}

.st > div:nth-child(2n) {
  border-right: 0;
}

.st > div:nth-last-child(-n + 2) {
  border-bottom: 0;
}

.st .v {
  font-size: 22px;
  font-weight: 500;
}

/* Session calendar: one square per Paris day. */
.cal {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
  padding: 12px;
}

.cal > div {
  aspect-ratio: 2.4;
  min-height: 24px;
  border-radius: 3px;
  background: var(--s3);
  font: 12px var(--mono);
  padding: 3px 5px;
  color: var(--mut);
}

.cal > .w {
  background: var(--upbg);
  color: var(--up);
}

.cal > .l {
  background: var(--dnbg);
  color: var(--dn);
}

.cal > .f {
  background: transparent;
  border: 1px dashed var(--line);
}

.cal > .today {
  outline: 2px solid var(--fg);
  outline-offset: 1px;
}

.prog-cal-legend,
.calendar-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 0;
}

.cal-key {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 3px;
  background: var(--s3);
}

.cal-key.w {
  background: var(--upbg);
  box-shadow: inset 0 0 0 1px var(--up);
}

.cal-key.l {
  background: var(--dnbg);
  box-shadow: inset 0 0 0 1px var(--dn);
}

.cal-key.done {
  background: var(--up);
}

/* Errors table: the fiche is a pill link. */
#prog-errors th,
#prog-errors td {
  padding: 6px 10px;
}

#prog-errors td:first-child {
  white-space: normal;
}

#prog-errors td:last-child {
  white-space: nowrap;
}

#prog-errors a.pill {
  color: var(--fg);
  text-decoration: none;
}

#prog-errors a.pill:hover {
  background: var(--acbg);
  color: var(--ac);
}

.progress-headline {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 8px;
}

.progress-big {
  font-size: 2rem;
  font-weight: 600;
  line-height: 1;
}

.module-list {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: grid;
  gap: 10px;
  max-width: none;
  max-height: 460px;
  overflow-y: auto;
}

.module-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(60px, 120px) 3.6em;
  align-items: center;
  gap: 12px;
  font-size: 0.92rem;
}

@media (max-width: 599px) {
  .module-row {
    grid-template-columns: minmax(0, 1fr) 56px 3.2em;
    gap: 8px;
  }
}

.level-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-top: 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--line);
}

.level-row:first-child {
  margin-top: 0;
}

.level-row .level-name {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.module-row .module-count {
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--mut);
}

.module-row.complete .module-count {
  color: var(--up);
  font-weight: 600;
}

.daily-calendar {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 40px));
  gap: 6px;
  margin: 12px 0 8px;
}

.cal-day {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border-radius: 4px;
  background: var(--s3);
  font-size: 0.78rem;
  color: var(--mut);
  font-variant-numeric: tabular-nums;
}

.cal-head {
  text-align: center;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--mut);
}

.cal-day.blank {
  background: transparent;
}

.cal-day.done {
  background: var(--up);
  color: #fff;
  font-weight: 600;
}

.cal-day.today {
  outline: 2px solid var(--fg);
  outline-offset: 1px;
}

.bar-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 140px;
}

.bar-cell .bar {
  flex: 1 1 auto;
}

#course-progress .actions,
#daily-progress .actions,
#cards-progress .actions {
  margin-top: 12px;
}

/* ---------- Mon compte ---------- */

.account-page .card h2 {
  font-size: 1.05rem;
  margin-bottom: 12px;
}

.stack {
  display: grid;
  gap: 14px;
}

.stack .field,
.inline-form .field {
  margin: 0;
}

.inline-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 12px;
}

.inline-form .field {
  flex: 1 1 260px;
}

.facts {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 6px 16px;
  margin: 0 0 12px;
}

.facts dt {
  color: var(--text-soft);
}

.facts dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.link-box {
  margin: 0 0 12px;
}

.link-row {
  display: flex;
  gap: 8px;
}

.link-row input {
  flex: 1 1 auto;
  min-width: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.85rem;
}

.btn.btn-danger {
  background: var(--down);
  border-color: var(--down);
  color: #fff;
}

.danger-card {
  border-color: var(--down);
}

.prose {
  max-width: 820px;
  margin-bottom: 32px;
}

.prose ul {
  padding-left: 1.2em;
  display: grid;
  gap: 8px;
}

.prose h2 {
  margin-top: 20px;
}

/* ---------- Fiches de révision ---------- */

.cards-filter {
  max-width: 420px;
  margin: 16px 0;
}

.cards-play {
  max-width: 900px;
  margin: 0 auto 32px;
}

.cards-progress {
  margin-bottom: 8px;
  color: var(--text-soft);
}

.flashcard {
  display: grid;
  gap: 16px;
  min-height: 320px;
  align-content: start;
  padding: clamp(20px, 4vw, 40px);
}

.flashcard-tag {
  margin: 0;
  color: var(--text-soft);
}

.flashcard-q {
  max-width: none;
  font-size: clamp(1.25rem, 2.6vw, 1.7rem);
  line-height: 1.35;
  margin: 0;
}

.flashcard-q:focus {
  outline: none;
}

.flashcard-a {
  border-top: 1px solid var(--border);
  padding-top: 16px;
}

.flashcard-a p:first-child {
  font-size: 1.1rem;
  line-height: 1.55;
  max-width: none;
}

.flashcard-actions {
  margin: 0;
}

.grade-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.grade-buttons kbd {
  margin-left: 6px;
  font-size: 0.75rem;
  opacity: 0.6;
  font-family: inherit;
}

/* The 1, 2, 3 keys only help with a keyboard. */
@media (hover: none) {
  .grade-buttons kbd {
    display: none;
  }
}

.grade-again {
  border-color: var(--down);
  color: var(--down);
}

.cards-done {
  max-width: 720px;
  margin: 0 auto 32px;
}

/* ---------- Rejeu : gérer un compte ---------- */

.risk-picker {
  margin: 14px 0;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
}

.risk-picker legend {
  padding: 0 4px;
  font-weight: 600;
}

.risk-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.risk-option {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
}

.risk-option input {
  width: 18px;
  height: 18px;
  margin: 0;
  flex: none;
}

.risk-text {
  display: grid;
  line-height: 1.25;
}

.risk-option:has(input:checked) {
  border-color: var(--text);
  background: var(--surface-2);
}

.risk-warning {
  margin: 8px 0 0;
  color: var(--down);
}

.account-line {
  margin: 0;
}

.summary-account {
  display: grid;
  gap: 10px;
  margin: 16px 0;
}

.summary-account h3 {
  margin: 0;
}

.account-compare {
  margin: 0;
  padding-left: 1.2em;
}

/* ---------- Accueil : poste de commande ---------- */

.home-dashboard {
  padding: 14px var(--gutter) 8px;
}

.home-dashboard h1 {
  margin: 0 0 12px;
  font-size: 1.3rem;
}

.home {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 10px;
  align-content: start;
}

.home > .panel,
.home > p {
  grid-column: span 4;
}

.home > .w8 {
  grid-column: span 8;
}

.home > .w12,
.home > p {
  grid-column: span 12;
}

.home .kpi > div > .bar {
  margin-top: 4px;
}

/* KPI sub-line: small, muted, one line, the same on all six cards. */
.kpi .sub {
  display: block;
  min-height: 18px;
  font-size: 12.5px;
  line-height: 18px;
  font-weight: 400;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kpi .sub .bar {
  margin-top: 8px;
}

/* Right column next to the challenge: the daily challenge and the levels stack, sized to their content. */
.home > .home-col {
  grid-column: span 4;
  display: grid;
  gap: 10px;
  align-content: start;
  align-self: start;
}

.ph-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.ph-row > div {
  padding: 14px;
  border-right: 1px solid var(--line);
  display: grid;
  gap: 8px;
  align-content: start;
}

.ph-row > div:last-child {
  border-right: 0;
}

.chk {
  display: grid;
  grid-template-columns: 16px 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 4px 0;
}

.chk i {
  width: 16px;
  height: 16px;
  border-radius: 3px;
  border: 1.5px solid var(--mut);
  display: grid;
  place-items: center;
  font-style: normal;
  position: relative;
}

.chk i.d {
  background: var(--up);
  border-color: var(--up);
}

/* The tick is drawn (two borders turned 45 degrees), no text glyph that a font may lack. */
.chk i.d::after {
  content: "";
  width: 4px;
  height: 8px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: translateY(-1px) rotate(45deg);
}

/* A breached rule: a drawn cross (two bars turned 45 degrees), not colour alone. */
.chk i.x {
  border-color: var(--dn);
}

.chk i.x::before,
.chk i.x::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 10px;
  height: 2px;
  background: var(--dn);
  transform: translate(-50%, -50%) rotate(45deg);
}

.chk i.x::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

.home-daily-body,
.home-empty {
  display: grid;
  gap: 10px;
  align-content: start;
}

.home-daily-body p,
.home-empty p {
  margin: 0;
}

.home-big {
  font-size: 1.6rem;
  font-weight: 600;
}

.daily-days {
  display: grid;
  grid-template-columns: repeat(14, 1fr);
  gap: 4px;
}

.daily-days i {
  aspect-ratio: 1;
  border-radius: 2px;
  background: var(--s3);
}

.daily-days i.d {
  background: var(--up);
}

.tbl-scroll {
  overflow-x: auto;
}

.tbl-scroll th.r,
.tbl-scroll td.r {
  text-align: right;
}

.home-lessons-foot {
  display: grid;
  gap: 8px;
  margin-top: auto;
}

.home-level-list {
  list-style: none;
  margin: 0;
  display: grid;
  gap: 12px;
}

.home-level {
  display: grid;
  grid-template-columns: 90px 1fr auto auto;
  align-items: center;
  gap: 10px;
}

.home-exam.done {
  color: var(--up);
}

.home-curve-box {
  padding: 14px;
}

.home-curve {
  display: block;
  width: 100%;
  height: 180px;
}

.home-curve .line {
  fill: none;
  stroke: var(--ac);
  stroke-width: 2;
}

.home-curve .zero {
  stroke: var(--line);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.home-curve .limit {
  stroke: var(--dn);
  stroke-width: 1;
  stroke-dasharray: 4 4;
  vector-effect: non-scaling-stroke;
}

@media (max-width: 1100px) {
  .home > .panel,
  .home > .home-col {
    grid-column: span 12;
  }

  .ph-row {
    grid-template-columns: 1fr;
  }

  .ph-row > div {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
}

@media (max-width: 760px) {
  .home-level {
    grid-template-columns: 80px 1fr auto;
  }

  .home-level .home-exam {
    grid-column: 1 / -1;
  }
}

/* ---------- Recherche dans le cours, lexique ---------- */

.course-search-field {
  margin: 10px 0;
}

.course-search-results {
  display: grid;
  gap: 8px;
}

.search-results {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 4px;
}

.search-results li {
  display: grid;
  gap: 2px;
  padding: 8px 10px;
  border-radius: 10px;
}

.search-results li:hover {
  background: var(--surface-2);
}

.search-results a {
  display: grid;
  gap: 2px;
  color: inherit;
  text-decoration: none;
}

.search-why {
  color: var(--text-soft);
}

.lexique-page {
  padding-bottom: 40px;
}

.lexique-search {
  max-width: 560px;
}

.lexique-list {
  display: grid;
  grid-template-columns: minmax(140px, 220px) 1fr;
  gap: 0 24px;
  margin: 16px 0 0;
}

.lexique-list dt {
  font-weight: 600;
  padding: 14px 0 0;
  border-top: 1px solid var(--border);
}

.lexique-list dd {
  margin: 0;
  padding: 14px 0;
  border-top: 1px solid var(--border);
  display: grid;
  gap: 6px;
}

.lexique-list dd p {
  margin: 0;
}

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

  .lexique-list dd {
    border-top: 0;
    padding-top: 4px;
  }
}

/* ---------- Page hors ligne ---------- */

.offline-page {
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  place-items: center;
}

.offline-card {
  max-width: 460px;
  display: grid;
  gap: 14px;
  justify-items: start;
}

.offline-card h1 {
  margin: 0;
}

.offline-card p {
  margin: 0;
}

/* ---------- Poste de travail : composants de base ---------- */

.num {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}
.up { color: var(--up); }
.dn { color: var(--dn); }
.mut { color: var(--mut); }
.lbl {
  font-size: 11.5px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--mut);
  font-weight: 500;
}
.panel {
  background: var(--s1);
  border: 1px solid var(--line);
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.ph {
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 42px;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
}
.ph h3 {
  margin: 0;
  font-size: 12.5px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  font-weight: 600;
}
@media (max-width: 480px) {
  /* Phone: a panel title fits beside its pill on one line; a longer one wraps without breaking the header. */
  .ph {
    height: auto;
    min-height: 42px;
    padding: 6px 12px;
  }

  .ph h3 {
    font-size: 11.5px;
    letter-spacing: 0.04em;
  }
}
.ph .r {
  margin-left: auto;
  color: var(--mut);
  font-size: 13px;
  display: flex;
  gap: 10px;
  align-items: center;
}
.pb { padding: 12px; min-height: 0; overflow: auto; }
.pill {
  display: inline-flex;
  align-items: center;
  height: 21px;
  padding: 0 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  background: var(--s3);
  color: var(--mut);
}
.pill.up { background: var(--upbg); color: var(--up); }
.pill.dn { background: var(--dnbg); color: var(--dn); }
.bar b { display: block; height: 100%; background: var(--ac); }
.bar b.g { background: var(--up); }
.bar b.r { background: var(--dn); }
.btn {
  min-height: 36px;
  padding: 0 16px;
  border-radius: 5px;
  border: 1px solid var(--ac);
  background: var(--ac);
  color: var(--on-ac);
  font-weight: 600;
  gap: 6px;
}
.btn:hover { background: var(--ac); color: var(--on-ac); filter: brightness(0.92); }
.btn.btn-ghost, .btn-ghost {
  background: transparent;
  color: var(--fg);
  border-color: var(--line);
}
.btn.btn-ghost:hover, .btn-ghost:hover { background: var(--s2); color: var(--fg); border-color: var(--line); filter: none; }
/* Green and red stay reserved for up/down and buy/sell: these must beat the accent .btn above. */
.btn.btn-up, .btn.btn-up:hover { background: var(--up); border-color: var(--up); color: var(--on-up); }
.btn.btn-down, .btn.btn-down:hover { background: var(--dn); border-color: var(--dn); color: var(--on-dn); }
/* Touch size on a phone: after the compact .btn above, which would otherwise win at every width. */
@media (max-width: 699px) {
  .btn { min-height: 44px; }
}
.tabs button {
  border: 0;
  background: none;
  padding: 0 14px;
  color: var(--mut);
  font: inherit;
  font-weight: 500;
  border-bottom: 2px solid transparent;
  cursor: pointer;
}
.tabs button.on { color: var(--fg); border-bottom-color: var(--ac); }
.kpi { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
.kpi > div {
  padding: 12px 14px;
  border-right: 1px solid var(--line);
  display: grid;
  gap: 4px;
}
.kpi > div:last-child { border: 0; }
.kpi .v {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 27px;
  font-weight: 500;
  line-height: 1.1;
}

/* ---------- Rejeu : poste de travail ----------
   Market list (left), chart with its bar and drawing tools (centre), the four steps and the risk ticket
   (right), position / history / objectives / notes (bottom). The start screen and the summary take the
   centre and right columns. Below 1100 px everything stacks, chart first. */

main.replay {
  display: flex;
  flex-direction: column;
}

.replay-intro {
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--s1);
}

.replay-intro .lbl {
  margin: 0;
}

.replay-intro h1 {
  font-size: 1.35rem;
  margin: 2px 0 4px;
}

.replay-intro .lead {
  font-size: 14.5px;
  margin: 0;
  max-width: 120ch;
}

.rp {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1px;
  background: var(--line);
  font-size: 14.5px;
  line-height: 1.45;
}

.rp-play {
  display: contents;
}

.rp > *,
.rp-play > * {
  background: var(--s1);
  min-width: 0;
}

.rp .panel {
  border: 0;
}

/* Phones and tablets: the chart first, the market list last. */
.rp-chart-panel,
.rp-start,
.rp-summary {
  order: 1;
}

.book {
  order: 2;
}

.bot {
  order: 3;
}

.wl {
  order: 4;
}

@media (min-width: 1100px) {
  .rp {
    grid-template-columns: clamp(200px, 14vw, 250px) minmax(0, 1fr) clamp(300px, 21vw, 360px);
    grid-template-rows: minmax(0, 1fr) clamp(150px, 25vh, 260px);
    grid-template-areas:
      "wl main side"
      "wl bot side";
  }

  .wl {
    grid-area: wl;
  }

  .rp-chart-panel {
    grid-area: main;
  }

  .book {
    grid-area: side;
  }

  .bot {
    grid-area: bot;
  }

  .rp-start,
  .rp-summary {
    grid-row: 1;
    grid-column: 2 / 4;
  }

  /* No situation on screen: the bottom panel takes the right column too. */
  .rp:has(> #play[hidden]) > .bot {
    grid-column: 2 / 4;
  }
}

/* PC: the workspace fills the window and only the inner areas scroll. The chart row has a floor, so on a
   laptop (720 px high) the chart keeps its size and the page scrolls a little instead. */
@media (min-width: 1100px) and (min-height: 600px) {
  body.app-screen > main.replay {
    padding-bottom: 0;
  }

  /* The workspace is as high as the window leaves it (never under 651 px = chart floor + bottom panel), so the
     right column is bounded and scrolls inside itself; the page only scrolls on a small screen. */
  main.replay > .rp {
    flex: 1 1 0;
    min-height: 651px;
    grid-template-rows: minmax(520px, 1fr) clamp(130px, 13vh, 220px);
  }

  .step-track li {
    min-height: 30px;
    padding: 3px 10px;
  }

  .steps .feedback {
    padding: 7px 10px;
    line-height: 1.4;
  }

  /* The disclaimer is one muted line under the workspace (its full text stays in the page). */
  body.app-screen:has(main.replay) > .site-footer {
    padding: 5px 0;
    font-size: 12px;
  }

  body.app-screen:has(main.replay) > .site-footer p {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* One line for the legend, under the chart, with « Agrandir » at its end (as tall as the chart bar's controls). */
  .rp-chart-panel .chart-foot {
    flex-wrap: nowrap;
  }

  .chart-foot .chart-legend {
    flex-wrap: nowrap;
    overflow: hidden;
    white-space: nowrap;
  }

  .chart-foot .qx-btn {
    min-height: 26px;
    margin: -4px 0;
    padding: 0 10px;
  }

  .rp > *,
  .rp-play > * {
    min-height: 0;
  }

  .rp-start,
  .rp-summary,
  .wl-body {
    overflow: auto;
  }

  .steps {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
  }

  .rp .cwrap .cv {
    min-height: 0;
  }
}

@media (min-width: 1100px) and (min-height: 600px) and (max-height: 860px) {
  main.replay > .rp {
    grid-template-rows: minmax(520px, 1fr) 130px;
  }
}

/* Narrower chart column (a laptop): the candle figures go, and a long market name is shortened, so the chart
   bar stays on one line. */
@media (min-width: 1100px) and (max-width: 1399px) {
  #chart-ohlc {
    display: none;
  }
}

/* Up to 1799 px the bar is too short for everything: the « Simulé » pill (the title already says it) and the
   separators go, the buttons are tighter. */
@media (min-width: 1100px) and (max-width: 1799px) {
  .cbar > .pill,
  .cbar > .sep {
    display: none;
  }

  .cbar .cbar-period,
  .cbar .cbar-btn {
    padding: 0 7px;
  }
}

/* PC: the chart bar is one line; the candle figures, then the market name, give way first. */
@media (min-width: 1100px) {
  .rp-chart-panel .cbar {
    flex-wrap: nowrap;
  }
  .cbar .ohlc {
    flex: 0 100 auto;
    min-width: 0;
    overflow: hidden;
    flex-wrap: nowrap;
    white-space: nowrap;
  }

  .cbar-title {
    flex: 0 1 auto;
    min-width: 60px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .cbar-period,
  .cbar-btn,
  .cbar > .pill,
  .cbar > .sep,
  .cbar-counter,
  .cbar .zoom-toolbar {
    flex: none;
  }
}

/* 1400–1599 px: the candle figures alone give way (whole, see fitOhlc in replay.js); the market name stays whole. */
@media (min-width: 1400px) {
  .rp-chart-panel .cbar-title {
    flex: none;
  }
}

/* From 1600 px a long market name may shorten with an ellipsis (full name in its title) and the candle figures
   give way whole, the close last (fitOhlc), so the close always shows. From 1800 px every figure stays. */
@media (min-width: 1600px) {
  .rp-chart-panel .cbar-title {
    flex: 0 1 auto;
  }
}

@media (min-width: 1800px) {
  .cbar .ohlc {
    flex-shrink: 0;
  }
}

/* Market list */
.wl {
  display: flex;
  flex-direction: column;
}

.wl-body {
  flex: 1 1 auto;
}

.wl table,
.bot-body table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.wl th,
.bot-body th {
  font-size: 11.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--mut);
  font-weight: 500;
  text-align: left;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.wl td {
  padding: 0 8px;
  height: 34px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  font-size: 13.5px;
}

.wl td:first-child,
.wl th:first-child {
  padding-left: 12px;
  white-space: normal;
}

.wl th {
  padding-left: 8px;
  padding-right: 8px;
}

.wl .r,
.bot-body .r {
  text-align: right;
}

.wl-last,
.wl-var {
  display: block;
  line-height: 1.25;
}

.wl-var {
  font-size: 12px;
}

.wl td.r {
  padding-top: 4px;
  padding-bottom: 4px;
}

.wl .wl-group th {
  background: var(--s2);
  padding: 5px 12px;
}

.wl-market {
  border: 0;
  background: none;
  padding: 0;
  font: inherit;
  color: var(--fg);
  cursor: pointer;
  text-align: left;
  width: 100%;
  min-height: 34px;
}

.wl-market[aria-pressed="true"] {
  color: var(--ac);
  font-weight: 600;
}

.wl tr.on td {
  background: var(--s3);
}

.wl-note {
  padding: 10px 12px;
  margin: 0;
}

/* Chart panel: bar, drawing tools, chart with its RSI pane, legend */
.rp-chart-panel {
  display: flex;
  flex-direction: column;
}

.cbar {
  flex: none;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  min-height: 42px;
  padding: 4px 10px;
  border-bottom: 1px solid var(--line);
}

.cbar-title {
  font-size: 15px;
  font-weight: 600;
  margin-right: 4px;
}

.cbar .sep {
  width: 1px;
  height: 16px;
  background: var(--line);
  margin: 0 6px;
}

.cbar-period,
.cbar-btn {
  height: 28px;
  padding: 0 10px;
  border-radius: 4px;
  font: 500 13px var(--mono);
  display: inline-flex;
  align-items: center;
}

.cbar-period {
  background: var(--acbg);
  color: var(--ac);
}

.cbar-btn {
  border: 0;
  background: none;
  color: var(--mut);
  cursor: pointer;
}

.cbar-btn:hover {
  color: var(--fg);
}

.cbar-btn[aria-pressed="true"] {
  background: var(--acbg);
  color: var(--ac);
}

.ohlc {
  margin-left: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font: 13px var(--mono);
  color: var(--mut);
}

.ohlc > span {
  flex-shrink: 0;
}

.ohlc b {
  font-weight: 500;
  color: var(--fg);
}

.ohlc .up {
  color: var(--up);
}

.ohlc .dn {
  color: var(--dn);
}

.cbar-counter {
  margin-left: auto;
  color: var(--mut);
  font-size: 13px;
}

.cbar .zoom-toolbar {
  margin-left: 8px;
  gap: 4px;
}

.cbar .zoom-hint {
  display: none;
}

.cbar .zoom-toolbar .zoom-tool {
  width: 28px;
  height: 28px;
  border-radius: 4px;
  border: 1px solid var(--line);
  background: var(--s1);
  color: var(--fg);
  font-size: 1rem;
}

.cbar .zoom-toolbar .zoom-reset {
  width: auto;
  padding: 0 8px;
  font-size: 12.5px;
}

.cwrap {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
}

.tools {
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 0;
}

.tools button {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 4px;
  background: none;
  color: var(--mut);
  display: grid;
  place-items: center;
  cursor: pointer;
}

.tools button:hover {
  background: var(--s3);
  color: var(--fg);
}

.tools button[aria-pressed="true"] {
  background: var(--acbg);
  color: var(--ac);
}

.tools svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tools-sep {
  width: 20px;
  height: 1px;
  background: var(--line);
  margin: 4px 0;
}

/* At least 12 px between the chart and anything around it, the screen edge included. */
.rp .cv {
  position: relative;
  min-width: 0;
  min-height: clamp(340px, 58vh, 520px);
  margin: 12px;
}

.rp-chart {
  position: absolute;
  inset: 0;
}

.rp-chart.drawing {
  cursor: crosshair;
}

.chart-foot {
  flex: none;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 16px;
  padding: 0 12px 8px;
}

.chart-foot .chart-legend {
  margin: 0;
  gap: 4px 14px;
  font-size: 12.5px;
  color: var(--mut);
}

.swatch-rsi {
  width: 18px;
  height: 2px;
  background: var(--ac);
}

/* Over the chart's top left corner while a tool is in use or drawings are shown. */
.draw-status {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 3;
  margin: 0;
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--s1);
  font-size: 12.5px;
  color: var(--mut);
  pointer-events: none;
}

.draw-status[data-idle="true"] {
  visibility: hidden;
}

/* Right column: the four steps, then the risk ticket */
.book {
  display: flex;
  flex-direction: column;
}

.steps {
  display: flex;
  flex-direction: column;
}

#step-panel {
  scroll-margin-top: 92px;
}

#session-totals {
  white-space: nowrap;
  font-size: 12px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* A phone has no room for the word: the figures stay on one line. */
@media (max-width: 699px) {
  #session-totals .tot-lbl {
    display: none;
  }
}

.steps-body {
  padding: 12px 14px;
  display: grid;
  gap: 12px;
  align-content: start;
  font-size: 14.5px;
}

/* The feedback and the step's hints are teaching text too: the size of the step, never smaller (the hints stay muted). */
.steps-body .feedback,
.steps-body .small {
  font-size: inherit;
}

/* PC: the room for the whole risk ticket at 1080 px comes from tighter spacing, not smaller text. */
@media (min-width: 1100px) and (min-height: 600px) {
  .steps-body {
    padding: 8px 12px;
    gap: 8px;
  }
}

@media (min-width: 1600px) and (min-height: 600px) {
  .steps-body {
    font-size: 15px;
  }
}

.step-track {
  list-style: none;
  margin: 0;
  padding: 0;
  max-width: none;
  border: 1px solid var(--line);
  border-radius: 5px;
  overflow: hidden;
}

.step-track li {
  margin: 0;
  display: grid;
  grid-template-columns: 20px auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 6px 10px;
  border-top: 1px solid var(--line);
  color: var(--mut);
}

.step-track li:first-child {
  border-top: 0;
}

.step-n {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1.5px solid var(--line);
  display: grid;
  place-items: center;
  font-size: 11.5px;
}

.step-name {
  font-weight: 500;
}

.step-value {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 6px;
  color: var(--fg);
  font-size: 13px;
  text-align: right;
}

.step-value b {
  font-weight: 500;
}

.step-track li.done {
  color: var(--fg);
}

.step-track li.done .step-n {
  border-color: var(--up);
  color: var(--up);
}

.step-track li.current {
  background: var(--acbg);
  color: var(--ac);
}

.step-track li.current .step-n {
  border-color: var(--ac);
  background: var(--ac);
  color: #fff;
}

#step-body h3 {
  font-size: 15px;
  margin: 0 0 6px;
}

#step-body p {
  margin: 0 0 8px;
}

.rp-result p {
  margin: 0 0 8px;
}

.result-outcome {
  font-weight: 600;
  font-size: 15px;
}

.result-figures {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid var(--line);
  border-radius: 5px;
  margin-bottom: 10px;
}

.result-figures > div {
  display: grid;
  gap: 2px;
  padding: 8px 12px;
}

.result-figures > div + div {
  border-left: 1px solid var(--line);
}

.result-figures .stat-value {
  font-family: var(--mono);
  font-size: 22px;
  font-weight: 500;
}

.tk {
  flex: none;
  border-top: 1px solid var(--line);
  padding: 8px 14px 10px;
  display: grid;
  gap: 6px;
}

.tk-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sg {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid var(--line);
  border-radius: 5px;
  overflow: hidden;
}

.sg span {
  height: 28px;
  display: grid;
  place-items: center;
  background: var(--s2);
  color: var(--mut);
  font-weight: 600;
  font-size: 13.5px;
}

.sg span.on[data-side="long"] {
  background: var(--up);
  color: #fff;
}

.sg span.on[data-side="short"] {
  background: var(--dn);
  color: var(--on-dn);
}

:root[data-theme="dark"] .sg span.on[data-side="long"] {
  color: #03150d;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .sg span.on[data-side="long"] {
    color: #03150d;
  }
}

.tk-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.tk .inp {
  display: grid;
  gap: 0;
  min-width: 0;
  padding: 3px 9px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--s2);
}

.tk .inp span {
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--mut);
}

.tk .inp b {
  font-weight: 500;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Bottom panel: tabs */
.bot {
  display: flex;
  flex-direction: column;
}

.bot .ph {
  padding: 0 4px;
}

#bottom-tabs {
  margin: 0;
  border: 0;
  height: 100%;
  gap: 0;
}

#bottom-tabs [role="tab"] {
  padding: 0 14px;
  color: var(--mut);
  font-weight: 500;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

#bottom-tabs [role="tab"][aria-selected="true"] {
  color: var(--fg);
  border-bottom-color: var(--ac);
}

.bot-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}

.bot-body td {
  padding: 7px 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.bot-body td.up {
  color: var(--up);
}

.bot-body td.dn {
  color: var(--dn);
}

.bot-empty,
.bot-foot {
  padding: 10px 14px;
  margin: 0;
}

.obj-head {
  padding: 10px 14px 6px;
  margin: 0;
  max-width: none;
}

.obj-rules {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.obj-rule {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-content: start;
  gap: 6px 8px;
  padding: 10px 14px;
  border-right: 1px solid var(--line);
}

.obj-rule:last-child {
  border-right: 0;
}

.obj-label {
  grid-column: 1 / -1;
  font-weight: 500;
}

.obj-figure {
  font-size: 15px;
}

.obj-rule .obj-bar {
  grid-column: 1 / -1;
  height: 5px;
  border-radius: 3px;
  background: var(--s3);
}

.obj-soon {
  padding: 4px 14px 14px;
  margin: 0;
}

.notes-editor {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px 12px;
  max-width: 900px;
  padding: 12px 14px;
}

.notes-editor input,
.notes-editor textarea {
  width: 100%;
  padding: 6px 10px;
  border-radius: 5px;
  border-color: var(--line);
  background: var(--s2);
  color: var(--fg);
}

.notes-actions {
  grid-column: 2;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
}

.notes-actions p {
  margin: 0;
}

/* Start screen and summary */
.rp .rp-start {
  display: grid;
  gap: 10px;
  align-content: start;
  padding: 10px;
  background: var(--bg);
}

.rp-start .panel {
  border: 1px solid var(--line);
}

.rp-start .replay-newcomer {
  grid-column: 1 / -1;
}

@media (min-width: 1100px) {
  .rp .rp-start {
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  }

  .rp-start .rp-daily {
    grid-column: 1 / -1;
  }
}

.rp-daily-body {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 24px;
}

.rp-daily-body .daily-text {
  flex: 1 1 320px;
  margin: 0;
}

.rp-daily-body .actions {
  margin: 0;
}

.rp-daily-body .error:empty {
  display: none;
}

.replay-howto ol {
  max-width: none;
}

.rp-summary .stats {
  margin-bottom: 16px;
}

@media (max-width: 1099px) {
  .notes-editor {
    grid-template-columns: minmax(0, 1fr);
  }

  .notes-actions {
    grid-column: 1;
  }
}

/* ---------- Cours : poste de travail ----------
   Plan of the course (260 px), lesson text (≈ 0.62 fr) and the chart / exercise column (≈ 1.5 fr, full height).
   The chart comes first in the page, so phones show it above the text; on a PC, grid placement puts it on the
   right. A lesson without chart shows its words and fiches there (#lesson-aside). Below 1100 px the parts stack. */

main.course {
  display: flex;
  flex-direction: column;
}

.lessons-intro {
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--s1);
}

.lessons-intro .kicker {
  margin: 0;
}

.lessons-intro h1 {
  font-size: 1.35rem;
  margin: 4px 0;
}

.lessons-intro .lead {
  font-size: 14.5px;
  margin: 0;
  max-width: 120ch;
}

.cr,
.lesson-view,
.course-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1px;
  background: var(--line);
  min-width: 0;
}

.cr {
  font-size: 14.5px;
  line-height: 1.45;
}

.cr .panel {
  border: 0;
}

.cr > *,
.lesson-view > *,
.course-main > * {
  background: var(--s1);
  min-width: 0;
}

/* Plan of the course */
.course-toc > summary {
  cursor: pointer;
  list-style: none;
  height: auto;
  min-height: 42px;
  flex-wrap: wrap;
  row-gap: 0;
}

.course-toc > summary::-webkit-details-marker {
  display: none;
}

.course-toc > summary h2 {
  margin: 0;
  font-size: 12.5px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  font-weight: 600;
}

.course-toc > summary .r {
  font-size: 13px;
}

.course-toc-body {
  padding: 0 0 8px;
}

.course-search-field {
  margin: 10px 12px 6px;
}

#course-search-count:not(:empty),
.course-search-results {
  margin: 0 12px 8px;
}

.course-nav .level-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 2px 8px;
  padding: 9px 14px;
  background: var(--s2);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.course-nav .level-title {
  margin: 0;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.course-nav .level-progress,
.course-nav .module-progress {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 12.5px;
  color: var(--mut);
}

.course-nav .level-advice {
  flex-basis: 100%;
  margin: 0;
  font-size: 12.5px;
  color: var(--mut);
}

.course-nav .module {
  border-bottom: 1px solid var(--line);
}

.course-nav .module-title {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 0;
  font-size: 14px;
  font-weight: 500;
  color: var(--mut);
}

.course-nav details.module > summary {
  list-style: none;
  cursor: pointer;
  padding: 9px 14px;
}

.course-nav details.module > summary::-webkit-details-marker {
  display: none;
}

.course-nav details.module > summary:hover {
  background: var(--s2);
}

.course-nav details.module > summary:hover .module-title {
  color: var(--fg);
}

/* The current module: accent colour and a bar on the left, as in the replay's market list. */
.course-nav details.module > summary[aria-current] {
  background: var(--acbg);
  box-shadow: inset 3px 0 0 var(--ac);
}

.course-nav details.module > summary[aria-current] .module-title,
.course-nav details.module > summary[aria-current] .module-progress {
  color: var(--ac);
}

/* Chevron drawn with borders (the font has no arrow glyph): points right folded, down unfolded. */
.course-nav details.module > summary .module-title::after {
  content: "";
  order: 9;
  flex: none;
  width: 7px;
  height: 7px;
  margin: 0 2px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  align-self: center;
}

.course-nav details.module[open] > summary .module-title::after {
  transform: rotate(45deg);
}

.course-nav .module-num {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  min-width: 1.4em;
}

.course-nav .module-progress {
  margin-left: auto;
}

.course-nav .module.soon {
  padding: 9px 14px;
}

.course-nav p.soon {
  margin: 2px 0 0 2em;
  font-size: 12.5px;
  color: var(--mut);
}

.course-nav ol {
  list-style: none;
  margin: 0;
  padding: 0 0 6px;
}

/* Positioned: the « (réussie) » of a lesson passed (.sr-only, absolute) stays inside the scrolling outline instead
   of stretching the page (3 px of page scroll at 1366 × 768 once a lesson low in the outline is passed). */
.course-nav a {
  position: relative;
  display: block;
  padding: 7px 14px 7px calc(14px + 2em);
  color: var(--mut);
  text-decoration: none;
  font-size: 13.5px;
}

.course-nav a:hover {
  color: var(--fg);
  background: var(--s2);
}

.course-nav a.current {
  color: var(--ac);
  font-weight: 600;
}

/* Tick drawn with borders: the ✓ glyph is missing from some fonts. */
.course-nav a.done::after {
  content: "";
  display: inline-block;
  width: 5px;
  height: 10px;
  margin-left: 8px;
  border-right: 2px solid var(--up);
  border-bottom: 2px solid var(--up);
  transform: rotate(45deg) translateY(-2px);
}

/* Lesson text */
.lesson-panel {
  padding: 22px 26px 18px;
  gap: 14px;
}

.lesson-title {
  font-size: 1.6rem;
  line-height: 1.25;
  letter-spacing: -0.01em;
  margin: 0;
}

.lesson-text p,
.lesson-text ul,
.lesson-text ol {
  font-size: 16.5px;
  line-height: 1.65;
  max-width: 72ch;
}

.lesson-text ul {
  margin-top: -4px;
}

.lesson-panel > .btn,
.lesson-actions .btn {
  align-self: flex-start;
}

.lesson-panel .exercise,
.lesson-panel .feedback,
.lesson-actions {
  max-width: 72ch;
}

/* Chart / exercise column */
.chart-head h2 {
  margin: 0;
  font-size: 12.5px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  font-weight: 600;
}

.chart-head #lesson-chart-meta {
  font-size: 13px;
  color: var(--mut);
}

.chart-head .zoom-hint {
  display: none;
}

/* At least 12 px between the chart and anything around it, the screen edge included. */
.lesson-stage .chart {
  height: clamp(300px, 58vh, 680px);
  margin: 16px 22px 16px 12px;
  min-width: 0;
}

.lesson-stage .lesson-visual {
  padding: 16px 22px 16px 16px;
  min-height: clamp(300px, 50vh, 680px);
}

.lesson-stage .visual-more {
  margin: 0 0 8px;
}

.lesson-aside {
  padding: 18px 22px 18px 18px;
  display: grid;
  gap: 18px;
  align-content: start;
  overflow: auto;
}

.lesson-aside h3 {
  margin: 0 0 8px;
}

.aside-note {
  margin: 0;
}

.aside-words dl {
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
  gap: 8px;
}

.aside-word {
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 12px 14px;
}

.aside-word dt {
  font-weight: 600;
}

.aside-word dd {
  margin: 4px 0 0;
}

.aside-word dd p {
  margin: 0 0 6px;
  color: var(--mut);
}

.aside-cards {
  display: grid;
  gap: 6px;
  justify-items: start;
}

.aside-card {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--s2);
}

.aside-card > summary {
  cursor: pointer;
  padding: 10px 14px;
  font-weight: 500;
}

.aside-card > p {
  margin: 0;
  padding: 0 14px 12px;
  color: var(--mut);
}

.aside-cards .btn {
  margin-top: 6px;
}

@media (min-width: 1100px) {
  .cr {
    grid-template-columns: 260px minmax(0, 1fr);
  }

  .lesson-view {
    grid-template-columns: minmax(380px, 0.62fr) minmax(0, 1.5fr);
  }

  .lesson-panel {
    grid-column: 1;
    grid-row: 1;
  }

  .lesson-stage {
    grid-column: 2;
    grid-row: 1;
  }

  /* The plan is always open on a PC. */
  .course-toc > summary {
    pointer-events: none;
    cursor: default;
  }

  .course-toc #course-toc-current {
    display: none;
  }
}

/* A laptop: a narrower plan and text (never under 280 px), so the chart column stays the widest. */
@media (min-width: 1100px) and (max-width: 1399px) {
  .cr {
    grid-template-columns: 200px minmax(0, 1fr);
  }

  .lesson-view {
    grid-template-columns: minmax(280px, 0.5fr) minmax(0, 1.5fr);
  }

  .lesson-panel {
    padding: 18px 16px 16px;
  }
}

/* Phones and tablets: the plan's rows are 44 px touch targets. */
@media (max-width: 1099px) {
  .course-nav a,
  .course-nav details.module > summary {
    min-height: 44px;
    display: flex;
    align-items: center;
  }

  .course-nav details.module > summary .module-title {
    flex: 1;
  }
}

/* PC: the workspace fills the window; the plan, the text and the visual scroll inside their own column. */
@media (min-width: 1100px) and (min-height: 600px) {
  body.app-screen > main.course {
    padding-bottom: 0;
  }

  body.app-screen .lessons-intro {
    display: none;
  }

  main.course > .cr {
    flex: 1 1 auto;
    min-height: 0;
    grid-template-rows: minmax(0, 1fr);
  }

  .course-toc {
    overflow-y: auto;
  }

  .course-toc > summary {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--s1);
  }

  .course-main {
    min-height: 0;
    grid-template-rows: minmax(0, 1fr);
  }

  .lesson-view {
    min-height: 0;
    grid-template-rows: minmax(0, 1fr);
  }

  .lesson-panel {
    overflow-y: auto;
  }

  .lesson-stage .chart {
    flex: 1 1 auto;
    height: auto;
    min-height: 260px;
  }

  .lesson-stage .lesson-visual,
  .lesson-stage .lesson-aside {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
  }

  .module-done {
    overflow-y: auto;
  }
}

/* ---------- Autres pages : poste de travail (fiches, lexique, calculettes, journal, compte) ----------
   One page head, then a twelve-column grid of panels. Panels default to the full row; .w4/.w5/.w6/.w7/.w8
   pick a width. Tables are tight and scroll inside their panel. Below 1100 px everything stacks. */

.wp-page {
  padding: 14px var(--gutter) 40px;
  font-size: 14.5px;
  line-height: 1.45;
}

.wp figure.panel {
  margin: 0;
}

.wp-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px 16px;
  margin: 0 0 12px;
}

.wp-head h1 {
  margin: 0;
  font-size: 20px;
  letter-spacing: -0.01em;
}

.wp-head .lead {
  margin: 4px 0 0;
  font-size: 14.5px;
  max-width: 120ch;
}

.wp-page .tabs {
  margin: 0 0 10px;
}

.wp {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 10px;
  align-content: start;
  align-items: start;
}

.wp > .panel,
.wp > p {
  grid-column: 1 / -1;
}

.wp > p {
  margin: 0;
}

.wp > .w4 {
  grid-column: span 4;
}

.wp > .w6 {
  grid-column: span 6;
}

.wp > .w8 {
  grid-column: span 8;
}

@media (max-width: 1100px) {
  .wp > .panel {
    grid-column: 1 / -1;
  }
}

.wp .ph h2 {
  margin: 0;
  font-size: 12.5px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  font-weight: 600;
}

.wp .pb > p:first-child {
  margin-top: 0;
}

.wp .pb > :last-child {
  margin-bottom: 0;
}

.wp .small,
.wp-head .small {
  color: var(--mut);
}

.wp .tbl-scroll table {
  font-size: 13.5px;
}

.wp .tbl-scroll th,
.wp .tbl-scroll td {
  padding: 6px 12px;
  border-bottom: 1px solid var(--line);
}

.wp .tbl-scroll th {
  background: var(--s2);
  font-size: 11.5px;
  color: var(--mut);
}

.wp .tbl-scroll tbody tr:hover td {
  background: var(--s2);
}

.wp .tbl-scroll td {
  font-variant-numeric: tabular-nums;
}

.wp .stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0;
}

.wp .stat {
  background: none;
  border: 0;
  border-right: 1px solid var(--line);
  border-radius: 0;
  padding: 12px 14px;
}

.wp .stat:last-child {
  border-right: 0;
}

.wp .stat-label {
  font-size: 11.5px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--mut);
}

.wp .stat-value {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 22px;
  font-weight: 500;
}

.wp .stack {
  margin-top: 0;
  gap: 12px;
}

.wp .form-grid {
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}

/* Fiches */
.wp .cards-start-panel .pb,
.wp .cards-howto-panel .pb {
  display: grid;
  gap: 12px;
  align-content: start;
}

.wp .cards-howto-panel ol {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 1.2em;
  max-width: none;
}

.wp .cards-filter {
  margin: 0;
}

.flashcard-panel .pb {
  display: grid;
  gap: 16px;
  min-height: 320px;
  align-content: start;
  padding: clamp(16px, 3vw, 32px);
}

.flashcard-panel .flashcard-a {
  border-top: 1px solid var(--line);
}

/* Lexique */
.lexique-find {
  display: grid;
  gap: 6px;
  max-width: 560px;
}

.lexique-find .field {
  margin: 0;
}

.lexique-find .small {
  margin: 0;
}

.wp .lexique-list {
  margin: 0;
  padding: 0 14px;
  grid-template-columns: minmax(130px, 220px) minmax(0, 1fr);
}

.wp .lexique-list dt,
.wp .lexique-list dd {
  border-top-color: var(--line);
}

.wp .lexique-list dt:first-of-type,
.wp .lexique-list dt:first-of-type + dd {
  border-top: 0;
}

@media (min-width: 1500px) {
  .wp .lexique-list {
    grid-template-columns: minmax(130px, 200px) minmax(0, 1fr) minmax(130px, 200px) minmax(0, 1fr);
    column-gap: 24px;
  }

  .wp .lexique-list dt:nth-of-type(2),
  .wp .lexique-list dt:nth-of-type(2) + dd {
    border-top: 0;
  }
}

@media (max-width: 640px) {
  .wp .lexique-list {
    grid-template-columns: 1fr;
  }

  .wp .lexique-list dt:first-of-type + dd {
    border-top: 0;
  }
}

/* Calculettes */
.wp .calc-panel .pb {
  display: grid;
  gap: 12px;
  align-content: start;
}

.wp .w4 .form-grid {
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
}

.wp .calc-panel .form-grid {
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}

.wp .calc-panel .pb p {
  margin: 0;
}

.wp .calc-result {
  border-radius: 4px;
  background: var(--s2);
  border: 1px solid var(--line);
}

/* Journal */
.equity-panel svg {
  width: 100%;
  height: auto;
  display: block;
}

.baseline {
  stroke: var(--line);
  stroke-width: 1;
  stroke-dasharray: 4 4;
}

.curve {
  fill: none;
  stroke: var(--fg);
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.mini {
  font: inherit;
  font-size: 12.5px;
  color: var(--fg);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 2px 8px;
  cursor: pointer;
}

.mini:hover {
  background: var(--s2);
}

.mini.danger {
  color: var(--dn);
  border-color: var(--dn);
}

.tv-panel summary {
  cursor: pointer;
  font-weight: 600;
  padding: 0 14px;
  height: 42px;
  display: flex;
  align-items: center;
  font-size: 12.5px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.tv-panel[open] summary {
  border-bottom: 1px solid var(--line);
}

.tv-field {
  margin-top: 0;
  max-width: 240px;
}

.tv-container {
  height: 560px;
  margin-top: 12px;
  overflow: hidden;
  background: var(--s2);
}

@media (max-width: 560px) {
  .tv-container {
    height: 380px;
  }
}

.replay-journal-intro {
  margin: 0;
  max-width: none;
}

.wp .pb.error:empty {
  display: none;
}

/* Compte */
.wp .facts {
  margin: 0 0 12px;
}

.wp .link-box {
  margin: 12px 0;
}

.wp .danger-card {
  border-color: var(--dn);
}

.wp .inline-form {
  margin-top: 0;
}

/* ---------- Pages d'accès (inscription, mot de passe, rappel, confidentialité) et page de connexion ----------
   The only centred cards. The access pages keep the plain header (brand and theme button); the login page
   (connexion.html, .login-card) is the same card, at the same width. */

/* The server-error line of Rejeu, Progression, Journal and Compte (#session-error), at the same place on each page.
   The type size is the workstation one, whatever page the line sits in (Rejeu has none of its own). */
.login-view {
  padding: 14px var(--gutter) 40px;
  font-size: 14.5px;
  line-height: 1.45;
}

/* The workstation pages already have the gutter and a 14 px top padding: the line starts where it does on Rejeu. */
.wp-page > .login-view {
  margin: -14px calc(-1 * var(--gutter)) 0;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 14px;
}

.login-form .error {
  margin: 0;
  min-height: 0;
}

/* No message yet: the alert region stays in place (for screen readers) without adding a gap. */
.login-form .error:empty {
  margin-top: -14px;
}

.login-card .forgot-link {
  margin: 0;
}

.auth-page {
  padding: 40px var(--gutter) 32px;
  font-size: 14.5px;
  line-height: 1.5;
}

.auth-card,
.login-card {
  max-width: 440px;
  margin: 0 auto;
  border-radius: 6px;
}

.auth-card.auth-long {
  max-width: calc(70ch + 32px);
}

.auth-card .ph,
.login-card .ph {
  justify-content: space-between;
  gap: 12px;
  min-height: 42px;
  height: auto;
  padding: 10px 16px;
  flex-wrap: wrap;
}

.auth-card .ph h1,
.login-card .ph h1 {
  margin: 0;
  font-size: 13.5px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  font-weight: 600;
}

.auth-card .ph .r {
  margin-left: 0;
  font-size: 13px;
}

.auth-card .pb,
.login-card .pb {
  padding: 16px;
  overflow: visible;
}

.auth-card .pb > :first-child,
.login-card .pb > :first-child {
  margin-top: 0;
}

.auth-card .pb > :last-child,
.login-card .pb > :last-child {
  margin-bottom: 0;
}

.auth-card .field label,
.login-card .field label {
  font-size: 12.5px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-weight: 500;
  color: var(--mut);
}

.auth-card input:not([type="checkbox"]),
.login-card input:not([type="checkbox"]) {
  background: var(--s2);
  border: 1px solid var(--line);
  border-radius: 5px;
  min-height: 40px;
  padding: 8px 12px;
  font-size: 14.5px;
  color: var(--fg);
}

.auth-card input:not([type="checkbox"]):focus,
.login-card input:not([type="checkbox"]):focus {
  outline: none;
  border-color: var(--ac);
  box-shadow: 0 0 0 3px var(--acbg);
}

.auth-card .choice-check {
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--s1);
  font-weight: 400;
  align-items: flex-start;
}

.auth-card .choice-check:has(input:checked) {
  border-color: var(--ac);
  background: var(--acbg);
}

.auth-card .choice-check input {
  accent-color: var(--ac);
  margin-top: 2px;
}

.auth-card .small,
.login-card .small,
.auth-card .error,
.login-card .error {
  font-size: 14.5px;
}

.auth-card a,
.login-card a {
  color: var(--ac);
}

.auth-card .btn,
.login-card .btn {
  width: 100%;
}

.auth-card.auth-long .pb {
  padding: 20px 24px 24px;
}

.auth-card .pb.prose {
  max-width: none;
  margin: 0;
}

.auth-card .pb.prose h2 {
  margin: 22px 0 8px;
  font-size: 12.5px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--mut);
}

.auth-card .pb.prose h2:first-child {
  margin-top: 0;
}

@media (max-width: 480px) {
  .auth-page {
    padding-top: 20px;
  }

  .auth-card.auth-long .pb {
    padding: 16px;
  }
}

.auth-card #code-state {
  margin-bottom: 14px;
}

/* ---------- Agrandir un graphique (expand.js) ----------
   The « Agrandir » button sits in the panel header; the expanded panel covers the window (12 px from its edges
   on a PC, the whole screen on a phone) over the theme background, and its chart area takes all the room left.
   No animation: the panel is simply in place. */

.qx-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: none;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: transparent;
  color: var(--fg);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
}

.qx-btn:hover {
  background: var(--s2);
}

.qx-btn:focus-visible {
  outline: 2px solid var(--ac);
  outline-offset: 2px;
}

.qx-btn[aria-pressed="true"] {
  background: var(--acbg);
  border-color: var(--ac);
  color: var(--ac);
}

.qx-btn svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* A panel without a header: the button goes in its top right corner. */
.qx-corner {
  position: relative;
}

.qx-corner > .qx-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
}

/* Above the shell (header 50, phone menu 60), under the glossary bubbles (100). */
.panel.qx-on {
  position: fixed;
  inset: 12px;
  z-index: 80;
  width: auto;
  height: auto;
  max-width: none;
  max-height: none;
  margin: 0;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  overscroll-behavior: contain;
  box-shadow: 0 0 0 100vmax var(--bg);
}

.panel.qx-on > .qx-grow {
  flex: 1 1 0;
  min-height: 0;
  height: auto;
  max-height: none;
}

html.qx-lock,
html.qx-lock body,
.qx-frozen {
  overflow: hidden !important;
}

/* Rejeu: the chart bar is full, so the button sits at the end of the legend row, under the chart. */
.chart-foot .qx-btn {
  margin-left: auto;
}

.chart-foot .chart-legend {
  min-width: 0;
}

/* Cours: the button at the right end of the chart header. */
.chart-head .qx-btn {
  margin-left: auto;
}

/* A panel header that also holds the button: its figures stay whole on a phone. */
.ph .r:has(> .qx-btn) > * {
  white-space: nowrap;
}

/* Accueil: the result curve fills its box. */
.qx-on .home-curve-box .home-curve {
  height: 100%;
}

/* Cours: the lesson chart, or the schema (scaled by its viewBox, whole on screen). */
.qx-on.lesson-stage .chart {
  flex: 1 1 0;
  height: auto;
  min-height: 0;
}

.qx-on.lesson-stage .lesson-visual {
  flex: 1 1 0;
  min-height: 0;
  overflow: auto;
}

.qx-on.lesson-stage .schema svg {
  height: calc(100vh - 140px);
  max-height: none;
}

@media (max-width: 699px) {
  .qx-btn {
    min-height: 44px;
  }

  /* The title keeps its line(s); the figures and the button go to the right, on the next line if needed. */
  .ph:has(> .r > .qx-btn) {
    flex-wrap: wrap;
    height: auto;
    row-gap: 6px;
    padding-top: 6px;
    padding-bottom: 6px;
  }

  .ph:has(> .r > .qx-btn) > .r {
    margin-left: auto;
  }

  .qx-on .chart-legend {
    display: none;
  }

  .panel.qx-on {
    inset: 0;
    border: 0;
    border-radius: 0;
  }
}

/* ---------- Page de connexion plein écran (connexion.html) ---------- */
body.login-screen {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.login-screen .login-theme {
  position: absolute;
  top: 12px;
  right: var(--gutter);
}

.login-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 24px;
  padding: 72px var(--gutter) 64px;
  font-size: 14.5px;
  line-height: 1.5;
}

.login-main .login-card {
  width: 100%;
}

.login-brand {
  margin: 0;
  font-size: 20px;
}

/* Replay: the one-line notice when real situations were asked but simulated ones are used (shown under the chart bar). */
.source-notice {
  margin: 0;
  padding: 8px 14px;
  font-size: 13px;
  border-bottom: 1px solid var(--warn-line);
  background: var(--warn-soft);
}

/* Empty status line (no fallback): it stays in the page so a screen reader announces the text when it appears, but takes no room. */
.source-notice:empty {
  padding: 0;
  border: 0;
}
