  :root {
    --font: "Instrument Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    --display: var(--font);
    --bg0: #0f172a; --ink: #f1f5f9; --ink2: #cbd5e1; --quiet: #94a3b8;
    --glass: rgba(30, 41, 59, .96); --glass2: rgba(255, 255, 255, .04); --brd: #334155; --brd2: #475569;
    /* Accent = the landing page's teal (lighter shade on the dark background). */
    --a1: #D9926A; --a2: #E8AD88; --a3: #34d399; --hot: #ff4d6d; --warn: #ffb547;
    --acc: 217, 146, 106; --acc2: 232, 173, 136;
    --grad: linear-gradient(135deg, #A85A32 0%, #C2733F 100%);
    --good: #34d399; --bad: #ff4d6d; --accent: #E8AD88; --link: #E8AD88;
    --r: 14px; --blur: saturate(140%) blur(12px);
  }

  /* Light theme (default) = the landing page's look: white surfaces, thin slate borders, teal accent.
     Applies to data-theme="light", and to "auto" with a light system setting. */
  :root[data-theme="light"] {
    --bg0: #f8fafc; --ink: #0f172a; --ink2: #475569; --quiet: #64748b;
    --glass: rgba(255, 255, 255, .94); --glass2: #f1f5f9; --brd: #e2e8f0; --brd2: #cbd5e1;
    --a1: #A85A32; --a2: #C2733F; --acc: 168, 90, 50; --acc2: 194, 115, 63;
    --grad: linear-gradient(135deg, #A85A32 0%, #A85A32 100%);
    --good: #059669; --bad: #be123c; --accent: #A85A32; --link: #A85A32; --warn: #b45309;
    --r: 14px; --blur: saturate(140%) blur(12px);
    color-scheme: light;
  }
  :root[data-theme="light"] .glass, :root[data-theme="light"] aside, :root[data-theme="light"] #quizbar, :root[data-theme="light"] .modal .box, :root[data-theme="light"] .card, :root[data-theme="light"] #toast { box-shadow: 0 1px 3px rgba(15,23,42,.05), 0 1px 2px rgba(15,23,42,.03); }
  :root[data-theme="light"] .card-title, :root[data-theme="light"] .card .big { background: none; color: var(--ink); -webkit-text-fill-color: var(--ink); } :root[data-theme="light"] .card .big { color: var(--a1); -webkit-text-fill-color: var(--a1); }
  :root[data-theme="light"] a.link { border-bottom-color: rgba(168, 90, 50,.3); }
  :root[data-theme="light"] a.link:hover { color: #8E4A27; border-bottom-color: #8E4A27; }
  :root[data-theme="light"] button:not(.primary) { background: #fff; border-color: var(--brd); }
  :root[data-theme="light"] button:not(.primary):hover { background: #f1f5f9; border-color: var(--brd2); }
  :root[data-theme="light"] button.primary { background: #A85A32; box-shadow: none; }
  :root[data-theme="light"] button.primary:hover { background: #8E4A27; box-shadow: 0 6px 16px rgba(168, 90, 50,.28); filter: none; }
    :root[data-theme="light"] .modal .box, :root[data-theme="light"] #qcm { background: #fff; }
  :root[data-theme="light"] #ctxmenu { background: #fff; }
  :root[data-theme="light"] #tip, :root[data-theme="light"] .rlabel { background: rgba(255,255,255,.96); color: var(--ink); }
  :root[data-theme="light"] #dash { background: #f8fafc; backdrop-filter: none; -webkit-backdrop-filter: none; }
  :root[data-theme="light"] .cards .card:first-child { background: #FBF6F2; border-color: #E8CDB8; }
  :root[data-theme="light"] .card::after { display: none; }
  :root[data-theme="light"] input[type=search], :root[data-theme="light"] input[type=text], :root[data-theme="light"] input[type=date], :root[data-theme="light"] input[type=email], :root[data-theme="light"] input[type=password], :root[data-theme="light"] textarea, :root[data-theme="light"] select { background: #fff; color-scheme: light; }
  :root[data-theme="light"] select option { background: #fff; }
  :root[data-theme="light"] #rlabels .rlines line { stroke: rgba(15,23,42,.5); }
  :root[data-theme="light"] #rlabels .rlines circle { fill: #0f172a; }
  :root[data-theme="light"] .tnode.active { background: #FBF6F2; color: #6B3A1F; box-shadow: inset 2px 0 0 #A85A32; }
  :root[data-theme="light"] .qprop.discordant .qmark { color: #b42318; }
  :root[data-theme="light"] .lesion-sign { color: #a21caf; }
  :root[data-theme="light"] dd.mv-lost a.link { color: #be185d; }
  :root[data-theme="light"] dd.mv-weak a.link { color: #a16207; }
  :root[data-theme="light"] .rap-badge.described { color: #047857; }
  :root[data-theme="light"] .bar, :root[data-theme="light"] .prog-track, :root[data-theme="light"] .qcm-gauge { background: #e2e8f0; }
  :root[data-theme="light"] .bar > div, :root[data-theme="light"] .prog-fill, :root[data-theme="light"] #qGauge > div { background: #A85A32; box-shadow: none; }
  :root[data-theme="light"] .seg label:has(input:checked) { background: #A85A32; box-shadow: none; }
  :root[data-theme="light"] .chip.on { color: #A85A32; border-color: #E8CDB8; background: #FBF6F2; }
  :root[data-theme="light"] .prog-legend .late { color: #a15c00; }
  @media (prefers-color-scheme: light) {
    :root[data-theme="auto"] {
    --bg0: #f8fafc; --ink: #0f172a; --ink2: #475569; --quiet: #64748b;
    --glass: rgba(255, 255, 255, .94); --glass2: #f1f5f9; --brd: #e2e8f0; --brd2: #cbd5e1;
    --a1: #A85A32; --a2: #C2733F; --acc: 168, 90, 50; --acc2: 194, 115, 63;
    --grad: linear-gradient(135deg, #A85A32 0%, #A85A32 100%);
    --good: #059669; --bad: #be123c; --accent: #A85A32; --link: #A85A32; --warn: #b45309;
    --r: 14px; --blur: saturate(140%) blur(12px);
    color-scheme: light;
    }
    :root[data-theme="auto"] .glass, :root[data-theme="auto"] aside, :root[data-theme="auto"] #quizbar, :root[data-theme="auto"] .modal .box, :root[data-theme="auto"] .card, :root[data-theme="auto"] #toast { box-shadow: 0 1px 3px rgba(15,23,42,.05), 0 1px 2px rgba(15,23,42,.03); }
    :root[data-theme="auto"] .card-title, :root[data-theme="auto"] .card .big { background: none; color: var(--ink); -webkit-text-fill-color: var(--ink); } :root[data-theme="auto"] .card .big { color: var(--a1); -webkit-text-fill-color: var(--a1); }
    :root[data-theme="auto"] a.link { border-bottom-color: rgba(168, 90, 50,.3); }
    :root[data-theme="auto"] a.link:hover { color: #8E4A27; border-bottom-color: #8E4A27; }
    :root[data-theme="auto"] button:not(.primary) { background: #fff; border-color: var(--brd); }
    :root[data-theme="auto"] button:not(.primary):hover { background: #f1f5f9; border-color: var(--brd2); }
    :root[data-theme="auto"] button.primary { background: #A85A32; box-shadow: none; }
    :root[data-theme="auto"] button.primary:hover { background: #8E4A27; box-shadow: 0 6px 16px rgba(168, 90, 50,.28); filter: none; }
        :root[data-theme="auto"] .modal .box, :root[data-theme="auto"] #qcm { background: #fff; }
    :root[data-theme="auto"] #ctxmenu { background: #fff; }
    :root[data-theme="auto"] #tip, :root[data-theme="auto"] .rlabel { background: rgba(255,255,255,.96); color: var(--ink); }
    :root[data-theme="auto"] #dash { background: #f8fafc; backdrop-filter: none; -webkit-backdrop-filter: none; }
    :root[data-theme="auto"] .cards .card:first-child { background: #FBF6F2; border-color: #E8CDB8; }
    :root[data-theme="auto"] .card::after { display: none; }
    :root[data-theme="auto"] input[type=search], :root[data-theme="auto"] input[type=text], :root[data-theme="auto"] input[type=date], :root[data-theme="auto"] input[type=email], :root[data-theme="auto"] input[type=password], :root[data-theme="auto"] textarea, :root[data-theme="auto"] select { background: #fff; color-scheme: light; }
    :root[data-theme="auto"] select option { background: #fff; }
    :root[data-theme="auto"] #rlabels .rlines line { stroke: rgba(15,23,42,.5); }
    :root[data-theme="auto"] #rlabels .rlines circle { fill: #0f172a; }
    :root[data-theme="auto"] .tnode.active { background: #FBF6F2; color: #6B3A1F; box-shadow: inset 2px 0 0 #A85A32; }
    :root[data-theme="auto"] .qprop.discordant .qmark { color: #b42318; }
    :root[data-theme="auto"] .lesion-sign { color: #a21caf; }
    :root[data-theme="auto"] dd.mv-lost a.link { color: #be185d; }
    :root[data-theme="auto"] dd.mv-weak a.link { color: #a16207; }
    :root[data-theme="auto"] .rap-badge.described { color: #047857; }
    :root[data-theme="auto"] .bar, :root[data-theme="auto"] .prog-track, :root[data-theme="auto"] .qcm-gauge { background: #e2e8f0; }
    :root[data-theme="auto"] .bar > div, :root[data-theme="auto"] .prog-fill, :root[data-theme="auto"] #qGauge > div { background: #A85A32; box-shadow: none; }
    :root[data-theme="auto"] .seg label:has(input:checked) { background: #A85A32; box-shadow: none; }
    :root[data-theme="auto"] .chip.on { color: #A85A32; border-color: #E8CDB8; background: #FBF6F2; }
    :root[data-theme="auto"] .prog-legend .late { color: #a15c00; }
  }
  * { box-sizing: border-box; }
  html, body { margin: 0; height: 100%; color: var(--ink); overflow: hidden;
    font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
  body { background: var(--bg0); }

  /* Glass surfaces */
  .glass, #top, aside, #quizbar, .modal .box, .card, #toast {
    background: var(--glass); border: 1px solid var(--brd); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
    box-shadow: 0 1px 3px rgba(0,0,0,.2), 0 18px 40px -16px rgba(0,0,0,.5); }

  /* Header: same bar as the landing page (full width, 64px, bottom border, brand left, actions right). */
  #top { position: fixed; z-index: 20; top: 0; left: 0; right: 0; height: 64px; display: flex; align-items: center; gap: 8px;
    padding: 0 24px; border-radius: 0; border-width: 0 0 1px; white-space: nowrap; }
  :root #top { box-shadow: none; }
  .brand { font: 600 18px/1 var(--display); letter-spacing: .01em; margin-right: 28px; display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; }
  .brand svg { width: 28px; height: 28px; flex: none; color: var(--ink); }
  .brand .marrow { fill: var(--bg0); }
  .brand .tag { font: 700 10.5px/1 var(--font); letter-spacing: .06em; color: #6B3A1F; background: #F4E6DC; border-radius: 999px; padding: 4px 9px; }
  /* Explorer / Mon espace read as the landing page's nav links; the active one is underlined in teal. */
  #top .tab { background: transparent; border: 0; border-radius: 0; height: 64px; padding: 0 4px; margin: 0 10px; color: var(--ink2);
    font-weight: 550; font-size: 14.5px; box-shadow: inset 0 -2px 0 transparent; }
  #top .tab:hover { background: transparent; color: var(--ink); }
  #top .tab.active { background: transparent; color: var(--ink); box-shadow: inset 0 -2px 0 var(--a1); }
  #top .tab:active { transform: none; }
  .spacer { flex: 1; }
  .chip { font-size: 12px; color: var(--quiet); border: 1px solid var(--brd); border-radius: 999px; padding: 7px 12px; cursor: pointer; }
  #top #userChip { margin-left: 6px; font-size: 13.5px; font-weight: 600; color: var(--ink); border-radius: 10px; padding: 9px 16px; background: transparent; }
  #top #userChip:hover { border-color: var(--brd2); }
  .chip.on { color: var(--a3); border-color: rgba(52,211,153,.35); }

  /* Full-bleed stage, floating panels */
  #app { position: fixed; inset: 0; z-index: 1; }
  #stage { position: absolute; inset: 0; overflow: hidden; }
  #stage canvas { display: block; width: 100%; height: 100%; }
  aside { position: absolute; z-index: 10; top: 80px; bottom: 16px; width: 300px; padding: 16px 16px 18px; border-radius: var(--r); overflow-y: auto;
    transition: transform .5s cubic-bezier(.2,.8,.2,1), opacity .4s; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.15) transparent; }
  aside#left { left: 16px; }
  aside.right { right: 16px; width: 360px; }
  body.fold-left aside#left { transform: translateX(calc(-100% - 24px)); opacity: 0; }
  body.fold-right aside.right { transform: translateX(calc(100% + 24px)); opacity: 0; }
  .fold { position: fixed; z-index: 11; top: 50%; width: 22px; height: 64px; padding: 0; border-radius: 999px; font-size: 12px; color: var(--quiet);
    background: var(--glass); border: 1px solid var(--brd); border-radius: 10px; backdrop-filter: var(--blur); transition: left .5s cubic-bezier(.2,.8,.2,1), right .5s cubic-bezier(.2,.8,.2,1); }
  .fold[data-fold=left] { left: 322px; } body.fold-left .fold[data-fold=left] { left: 10px; }
  .fold[data-fold=right] { right: 382px; } body.fold-right .fold[data-fold=right] { right: 10px; }
  #zoomCtl { position: fixed; z-index: 11; right: 392px; bottom: 24px; display: flex; flex-direction: column; overflow: hidden;
    background: var(--glass); border: 1px solid var(--brd); border-radius: 10px; backdrop-filter: var(--blur); transition: right .5s cubic-bezier(.2,.8,.2,1); }
  body.fold-right #zoomCtl { right: 20px; }
  #zoomCtl button { width: 40px; height: 40px; padding: 0; margin: 0; border: 0; border-radius: 0; background: transparent; color: inherit; font: 600 20px/1 var(--font); cursor: pointer; }
  #zoomCtl button + button { border-top: 1px solid var(--brd); }
  #zoomCtl button:hover { background: rgba(var(--acc), .12); }

  h1 { font: 500 40px/1.15 var(--display); letter-spacing: -.03em; margin: 0 0 6px; }
  h2 { font: 700 11.5px/1 var(--font); text-transform: uppercase; letter-spacing: .08em; color: var(--a1); margin: 24px 0 10px; }
  h2:first-child { margin-top: 2px; }
  .sub { color: var(--quiet); font-size: 12.5px; }
  .card-title { font: 600 26px/1.15 var(--display); letter-spacing: -.02em; margin-bottom: 4px;
    background: linear-gradient(180deg, #fff, #b9c3e6); -webkit-background-clip: text; background-clip: text; color: transparent; }
  input[type=search], input[type=text], input[type=email], input[type=password], input[type=date], textarea, select {
    width: 100%; background: rgba(255,255,255,.05); border: 1px solid var(--brd); color: var(--ink); border-radius: 10px; padding: 10px 12px; font: inherit; outline: none;
    transition: border-color .2s, box-shadow .2s; }
  input:focus, select:focus, textarea:focus { border-color: rgba(var(--acc),.6); box-shadow: 0 0 0 4px rgba(var(--acc),.18); }
  select option { background: #0d1220; }
  textarea { font: 11px/1.4 ui-monospace, Menlo, monospace; height: 150px; resize: vertical; }
  #results { list-style: none; margin: 8px 0 0; padding: 0; }
  #results li { padding: 8px 10px; border-radius: 12px; cursor: pointer; transition: background .15s; }
  #results li:hover, #results li.active { background: rgba(255,255,255,.07); }
  #results .la { color: var(--quiet); font-style: italic; font-size: 12px; display: block; }
  .sys { display: flex; align-items: center; gap: 10px; padding: 5px 2px; cursor: pointer; }
  .sys input { accent-color: var(--a1); }
  .sys .count, .tnode .count { color: var(--quiet); font-size: 11.5px; margin-left: auto; font-variant-numeric: tabular-nums; }
  .dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; box-shadow: 0 0 10px currentColor; }
  .row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
  aside .row > button { flex: 1 1 0; padding: 8px 10px; font-size: 13px; white-space: nowrap; }
  aside .theme-row > button { flex: 0 1 auto; }

  button { background: rgba(255,255,255,.06); color: var(--ink); border: 1px solid var(--brd); border-radius: 10px; padding: 9px 16px; font: 600 13.5px/1.2 var(--font);
    cursor: pointer; transition: transform .15s, background .2s, border-color .2s, box-shadow .2s; }
  button:hover { background: rgba(255,255,255,.1); border-color: var(--brd2); }
  button:active { transform: scale(.97); }
  button:disabled { opacity: .45; cursor: default; }
  button.primary { background: #A85A32; color: #fff; border-color: transparent; font-weight: 650; }
  button.primary:hover { background: #8E4A27; box-shadow: 0 6px 16px rgba(168, 90, 50,.28); }
  button.small { padding: 6px 12px; font-size: 12.5px; border-radius: 8px; }
  button.danger:hover { border-color: var(--hot); color: var(--hot); }
  label.range { display: block; font-size: 12px; color: var(--quiet); margin-top: 8px; }
  input[type=range] { width: 100%; accent-color: var(--a1); }

  #tree details { margin-left: 8px; }
  #tree > details { margin-left: 0; }
  #tree summary { cursor: pointer; padding: 6px 8px; border-radius: 10px; list-style: none; display: flex; align-items: center; gap: 8px; font-weight: 500; }
  #tree summary::-webkit-details-marker { display: none; }
  #tree summary::before { content: ""; width: 6px; height: 6px; border-right: 1.5px solid var(--quiet); border-bottom: 1.5px solid var(--quiet); transform: rotate(-45deg); transition: transform .25s; flex: none; }
  #tree details[open] > summary::before { transform: rotate(45deg); }
  .tnode { display: flex; align-items: center; gap: 8px; padding: 6px 10px 6px 24px; border-radius: 10px; cursor: pointer; color: var(--ink2); transition: background .15s, color .15s; }
  .tnode:hover, #tree summary:hover { background: rgba(255,255,255,.06); color: var(--ink); }
  .tnode.active { background: linear-gradient(90deg, rgba(var(--acc),.28), rgba(var(--acc2),.12)); color: #fff; box-shadow: inset 2px 0 0 var(--accent); }
  .tlabel { cursor: pointer; }

  #tip { position: absolute; z-index: 12; pointer-events: none; background: rgba(10,13,22,.85); border: 1px solid var(--brd2); backdrop-filter: blur(10px);
    padding: 6px 10px; border-radius: 10px; font: 600 12.5px/1.2 var(--font); display: none; white-space: nowrap; }
  #credits { position: absolute; z-index: 5; left: 50%; transform: translateX(-50%); bottom: 14px; width: min(560px, calc(100% - 760px)); min-width: 260px; text-align: center;
    font-size: 10.5px; line-height: 1.4; color: rgba(200,206,225,.55); }
  #credits a { color: inherit; }
  #loading { position: absolute; inset: 0; z-index: 3; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; color: var(--quiet); }
  #loading > div:first-child { font: 600 22px/1 var(--display); letter-spacing: -.02em; color: var(--ink); }
  #loading .bar { width: 260px; height: 4px; background: rgba(255,255,255,.08); border-radius: 4px; overflow: hidden; }
  #loading .bar div { height: 100%; width: 0; background: var(--grad); box-shadow: 0 0 16px rgba(var(--acc),.9); transition: width .2s; }

  /* Immersive quiz */
  body.quizzing aside, body.quizzing .fold { transform: translateY(12px); opacity: 0; pointer-events: none; }
  #quizbar { position: absolute; z-index: 15; top: 84px; left: 50%; transform: translateX(-50%); border-radius: 24px; padding: 16px 20px 14px; display: none;
    width: min(640px, 92%); text-align: center; overflow: hidden; }
  #quizbar .meta { font-size: 12px; color: var(--quiet); display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
  #qGauge { position: absolute; left: 0; right: 0; top: 0; height: 4px; background: rgba(255,255,255,.06); }
  #qGauge[hidden] { display: none; }
  #qGauge > div { height: 100%; width: 100%; background: linear-gradient(90deg, #34d399, var(--a2)); box-shadow: 0 0 14px rgba(52,211,153,.8); transition: background .3s; }
  #quizbar[data-t=warn] #qGauge > div { background: linear-gradient(90deg, #ffb547, #ffd36b); box-shadow: 0 0 14px rgba(255,181,71,.8); }
  #quizbar[data-t=crit] #qGauge > div { background: linear-gradient(90deg, #ff4d6d, #ff8a5c); box-shadow: 0 0 18px rgba(255,77,109,.9); }
  .qrow { display: flex; align-items: center; gap: 16px; text-align: left; }
  #qRing { position: relative; width: 58px; height: 58px; flex: none; }
  #qRing[hidden] { display: none; }
  #qRing svg { width: 100%; height: 100%; transform: rotate(-90deg); }
  #qRing circle { fill: none; stroke-width: 4; }
  #qRing .trk { stroke: rgba(255,255,255,.08); }
  #qRing .arc { stroke: #34d399; stroke-linecap: round; stroke-dasharray: 119.38; filter: drop-shadow(0 0 5px currentColor); color: #34d399; transition: stroke .3s, color .3s; }
  #quizbar[data-t=warn] #qRing .arc { stroke: #ffb547; color: #ffb547; }
  #quizbar[data-t=crit] #qRing .arc { stroke: #ff4d6d; color: #ff4d6d; }
  #quizbar[data-t=crit] #qRing { animation: ringBeat .5s ease-in-out infinite alternate; }
  @keyframes ringBeat { from { transform: scale(1); } to { transform: scale(1.08); } }
  #qSec { position: absolute; inset: 0; display: grid; place-items: center; font: 700 18px/1 var(--display); font-variant-numeric: tabular-nums; }
  #quizbar .q { font: 600 21px/1.25 var(--display); letter-spacing: -.015em; flex: 1; }
  #quizbar .choices { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }
  #quizbar .choices button { text-align: left; border-radius: 14px; padding: 12px 14px; font-size: 14px; background: rgba(255,255,255,.05); }
  #quizbar .choices button:hover { background: rgba(var(--acc),.18); border-color: rgba(var(--acc),.45); }
  #quizbar .choices button.ok { border-color: var(--good); color: #b9ffe2; background: rgba(52,211,153,.16); }
  #quizbar .choices button.ko { border-color: var(--bad); color: #ffc2cc; background: rgba(255,77,109,.14); }
  #quizbar form { margin-top: 14px; display: flex; gap: 8px; }
  #quizbar form[hidden] { display: none; }
  /* On the left (where the hidden panel was), so the 3D structure of the question stays in view on the right. */
  #qcm { position: absolute; z-index: 16; top: 84px; left: 16px; width: min(600px, calc(50% - 24px));
    max-height: calc(100% - 104px); overflow-y: auto; border-radius: 24px; padding: 16px 20px 14px; background: rgba(12,16,28,.94); }
  #qcm[hidden] { display: none; }
  #qcm .meta { font-size: 12px; color: var(--quiet); display: flex; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
  #qcmTime { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--ink2); }
  #qcm.hurry #qcmTime { color: var(--bad); }
  .qcm-gauge { height: 4px; border-radius: 4px; background: rgba(255,255,255,.08); overflow: hidden; margin-bottom: 12px; }
  .qcm-gauge > div { height: 100%; width: 100%; background: linear-gradient(90deg, var(--a1), var(--a2)); transition: width .25s linear; }
  #qcm.hurry .qcm-gauge > div { background: var(--bad); }
  .qcm-stem { font: 600 19px/1.3 var(--display); letter-spacing: -.01em; margin-bottom: 6px; }
  .qprop { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; margin-top: 8px; border: 1px solid var(--brd);
    border-radius: 14px; background: rgba(255,255,255,.04); cursor: pointer; line-height: 1.4; }
  .qprop input { margin: 3px 0 0; accent-color: var(--a1); }
  .qprop .letter { font-weight: 700; min-width: 14px; color: var(--quiet); }
  .qprop.checked { border-color: rgba(var(--acc),.6); background: rgba(var(--acc),.16); }
  .qprop.is-true { border-color: var(--good); }
  .qprop.discordant { background: rgba(255,77,109,.14); }
  .qprop .qmark { margin-left: 8px; font-size: 11.5px; font-weight: 600; color: var(--quiet); text-transform: uppercase; letter-spacing: .06em; }
  .qprop.is-true .qmark { color: var(--good); }
  .qprop.discordant .qmark { color: #ffc2cc; }
  .qprop .why { display: block; font-size: 12.5px; color: var(--quiet); margin-top: 3px; }
  .qcm-verdict { margin-top: 12px; font-weight: 600; }
  .qcm-verdict.good, .qscore.good { color: var(--good); }
  .qcm-verdict.mid, .qscore.mid { color: #fcd34d; }
  .qcm-verdict.bad, .qscore.bad { color: var(--bad); }
  .qcm-foot { margin-top: 14px; }
  .qcm-foot .spacer { flex: 1; }
  .qcm-review details { border-top: 1px solid var(--brd); padding: 8px 0; }
  .qcm-review summary { cursor: pointer; line-height: 1.35; }
  .qscore { display: inline-block; min-width: 30px; font-weight: 700; }
  #rlabels { position: absolute; inset: 0; pointer-events: none; z-index: 11; overflow: hidden; }
  #rlabels .rlines { position: absolute; inset: 0; width: 100%; height: 100%; }
  #rlabels .rlines line { stroke: rgba(230,236,255,.55); stroke-width: 1; }
  #rlabels .rlines circle { fill: #fff; }
  #lmTip { position: absolute; z-index: 12; pointer-events: none; transform: translate(-50%, calc(-100% - 10px)); white-space: nowrap; font-weight: 600; }
  .lm-list { display: flex; flex-wrap: wrap; gap: 4px; }
  .rlabel { position: absolute; left: 0; top: 0; pointer-events: auto; font-size: 12px; line-height: 1.2; padding: 4px 8px; border-radius: 10px;
    background: rgba(10,13,22,.82); border: 1px solid var(--brd2); color: var(--ink2); white-space: nowrap; cursor: pointer; text-align: left; }
  .rlabel:hover { border-color: #fff; color: #fff; z-index: 2; }
  .rlabel.described { border-color: rgba(46,230,143,.6); }
  .rlabel small { display: block; font-size: 10.5px; color: var(--quiet); }
  .rap-legend { margin-top: 10px; font-size: 12px; color: var(--quiet); display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
  .rap-badge { display: inline-block; font-size: 10.5px; padding: 1px 6px; border-radius: 6px; border: 1px solid var(--brd); color: var(--quiet); margin-left: 4px; }
  .rap-badge.described { border-color: rgba(46,230,143,.6); color: #b9ffe2; }
  .modal .box.wide { width: min(860px, 94vw); }
  .sheet-head { display: grid; grid-template-columns: 1fr 170px; gap: 16px; align-items: start; }
  .sheet-kicker { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--quiet); margin-bottom: 6px; }
  .sheet-img img { width: 100%; border-radius: 14px; display: block; }
  .sheet section { margin-top: 14px; }
  .sheet h4 { margin: 0 0 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .12em; color: var(--quiet); }
  .sheet ul { margin: 0; padding-left: 18px; }
  .sheet li { margin: 3px 0; line-height: 1.45; }
  @media (max-width: 560px) { .sheet-head { grid-template-columns: 1fr; } }
  .auth { display: grid; gap: 10px; margin-top: 14px; text-align: left; }
  .auth label { display: grid; gap: 4px; font-size: 12.5px; color: var(--quiet); }
  .auth .btn-g { margin-top: 4px; }
  .auth label.sys { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--ink2); }
  .auth label.sys input { width: auto; flex: none; margin: 0; }
  .auth-err { color: var(--bad); font-size: 13px; min-height: 1em; }
  button.danger { border-color: rgba(255,77,109,.5); color: #ffc2cc; }
  .prog-empty { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px; border: 1px dashed var(--brd2); border-radius: 18px; }
  .prog-empty p { margin: 0; max-width: 60ch; color: var(--ink2); }
  .prog-card { border: 1px solid var(--brd); border-radius: 16px; padding: 18px 20px; background: var(--glass2); display: grid; gap: 12px; }
  .prog-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
  .prog-name { font: 700 22px/1.15 var(--display); letter-spacing: -.02em; color: var(--ink); }
  .prog-count b { font: 700 30px/1 var(--display); letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
  .prog-track { position: relative; height: 8px; border-radius: 6px; background: rgba(255,255,255,.08); }
  .prog-fill { height: 100%; border-radius: 6px; background: linear-gradient(90deg, #34d399, var(--a2)); }
  .prog-mark { position: absolute; top: -4px; width: 2px; height: 16px; background: var(--ink); transform: translateX(-1px); }
  .prog-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12.5px; color: var(--quiet); }
  .prog-legend .ok { color: var(--good); } .prog-legend .late { color: var(--warn); }
  .prog-today { display: grid; gap: 8px; padding-top: 10px; border-top: 1px solid var(--brd); }
  .prog-day { font-weight: 600; color: var(--ink); }
  .prog-new { font-size: 13.5px; line-height: 1.6; }
  input[type=date] { width: 100%; background: rgba(255,255,255,.05); border: 1px solid var(--brd); color: var(--ink); border-radius: 10px; padding: 10px 12px; font: inherit; color-scheme: dark; }
  .cls-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 18px; }
  .cls-col { display: grid; gap: 10px; align-content: start; min-width: 0; }
  .cls-card { border: 1px solid var(--brd); border-radius: 16px; padding: 12px 14px; display: grid; gap: 8px; background: var(--glass2); }
  .cls-head, .cls-row, .cls-series { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
  .cls-name { font-weight: 600; color: var(--ink); }
  .cls-series { padding-top: 6px; border-top: 1px solid var(--brd); }
  .cls-join { display: flex; gap: 8px; }
  .cls-join input, .cls-join select { flex: 1; min-width: 0; }
  .cls-screen h4 { margin: 18px 0 8px; font-size: 11px; text-transform: uppercase; letter-spacing: .12em; color: var(--quiet); }
  .cls-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
  .cls-code { display: grid; text-align: right; }
  .cls-code b { font: 700 26px/1.1 ui-monospace, Menlo, monospace; letter-spacing: .08em; }
  .cls-table-wrap { overflow-x: auto; }
  .cls-table { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
  .cls-table th, .cls-table td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--brd); white-space: nowrap; }
  .cls-table th { color: var(--quiet); font-weight: 500; font-size: 11.5px; }
  .cls-weak { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 0 18px; }
  .cls-weak ul { margin: 0; padding-left: 18px; }
  .cls-weak li { margin: 4px 0; line-height: 1.4; }
  #ctxmenu { position: fixed; z-index: 70; min-width: 230px; max-width: 300px; padding: 6px; border-radius: 14px; display: grid; gap: 1px;
    background: rgba(15,19,32,.96); box-shadow: 0 18px 48px -12px rgba(0,0,0,.7); animation: rise .14s ease-out; }
  #ctxmenu[hidden] { display: none; }
  .ctx-title { padding: 8px 10px 6px; font-weight: 600; color: var(--ink); display: grid; gap: 2px; }
  .ctx-sub { font-size: 11px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: var(--quiet); }
  #ctxmenu button { display: flex; justify-content: space-between; align-items: center; gap: 12px; width: 100%; text-align: left;
    border: 0; border-radius: 9px; background: transparent; padding: 7px 10px; font-size: 13px; }
  #ctxmenu button:hover:not(:disabled), #ctxmenu button:focus-visible { background: rgba(var(--acc),.22); outline: none; }
  .ctx-hint { font-size: 11.5px; color: var(--quiet); }
  .ctx-sep { height: 1px; margin: 4px 6px; background: var(--brd); }
  .hidden-note { margin-top: 8px; }
  @media (prefers-reduced-motion: reduce) { #ctxmenu { animation: none; } }
  .fb-done { opacity: .55; }
  .theme-row { margin-top: 10px; }
  .theme-row .sub { margin-right: 4px; }
  [data-theme-set][aria-pressed="true"] { border-color: var(--a1); color: var(--ink); background: rgba(var(--acc),.18); }
  .share-row { display: flex; gap: 8px; }
  .share-row input { flex: 1; min-width: 0; font-size: 12.5px; }
  .notice { margin: 10px 0 4px; padding: 10px 12px; border-radius: 12px; border: 1px solid rgba(var(--acc),.35); background: rgba(var(--acc),.12); font-size: 13.5px; }
  .nb-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px; margin: 14px 0 6px; }
  .nb-h { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--quiet); margin-bottom: 8px; }
  .nb-row { display: flex; justify-content: space-between; gap: 10px; padding: 3px 0; }
  .nb-sub { font-size: 12px; color: var(--quiet); margin: -2px 0 6px; }
  .nb-list { margin-top: 14px; display: grid; gap: 10px; }
  .nb-item { border: 1px solid var(--brd); border-radius: 14px; padding: 12px 14px; background: rgba(255,255,255,.03); }
  .nb-stem { font-size: 12px; color: var(--quiet); }
  .nb-text { margin-top: 4px; font-weight: 600; line-height: 1.4; }
  .nb-verdict { margin-top: 6px; font-size: 13.5px; }
  .nb-verdict.is-true b { color: var(--good); }
  .nb-verdict.is-false b { color: var(--bad); }
  .nb-why { font-size: 13px; color: var(--quiet); margin-top: 3px; }
  .nb-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 8px; font-size: 12.5px; color: var(--quiet); }
  .nb-meta .nb-done { margin-left: auto; }
  .nb-done-list { margin-top: 14px; }
  .nb-done-list summary { cursor: pointer; color: var(--quiet); }
  #quizbar .fb { font-size: 14px; font-weight: 500; margin-top: 10px; min-height: 20px; }
  #quizbar .row { justify-content: center; margin-top: 8px; }
  .fb.ok { color: var(--good); } .fb.ko { color: var(--bad); }
  #quizScore { font: 700 15px/1 var(--display); color: var(--ink); font-variant-numeric: tabular-nums; }
  #quizScore .combo { display: inline-block; margin-left: 8px; padding: 3px 8px; border-radius: 999px; font-size: 11px; color: #1b1300;
    background: linear-gradient(135deg, #ffd36b, #ff8a5c); box-shadow: 0 0 16px rgba(255,160,80,.7); animation: comboPop .4s cubic-bezier(.3,1.6,.5,1); }
  @keyframes comboPop { from { transform: scale(.4); } to { transform: scale(1); } }
  .pts { font-weight: 700; margin-left: 6px; }
  .float-pts { position: absolute; left: 50%; top: 54%; transform: translateX(-50%); font: 700 34px/1 var(--display); pointer-events: none;
    background: linear-gradient(135deg, #34d399, var(--a2)); -webkit-background-clip: text; background-clip: text; color: transparent;
    animation: floatUp 1.1s cubic-bezier(.2,.8,.2,1) forwards; }
  @keyframes floatUp { from { opacity: 0; transform: translate(-50%, 10px) scale(.7); } 25% { opacity: 1; } to { opacity: 0; transform: translate(-50%, -60px) scale(1.15); } }
  #quizbar.good { animation: goodGlow .7s ease-out; }
  @keyframes goodGlow { from { box-shadow: 0 0 0 0 rgba(52,211,153,.7), 0 20px 50px -20px rgba(0,0,0,.6); } to { box-shadow: 0 0 0 26px rgba(52,211,153,0), 0 20px 50px -20px rgba(0,0,0,.6); } }
  #quizbar.shake { animation: shake .45s cubic-bezier(.36,.07,.19,.97); }
  @keyframes shake { 10%, 90% { transform: translateX(calc(-50% - 2px)); } 20%, 80% { transform: translateX(calc(-50% + 4px)); } 30%, 50%, 70% { transform: translateX(calc(-50% - 8px)); } 40%, 60% { transform: translateX(calc(-50% + 8px)); } }
  #stage::after { content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 4; }
  #stage.pressure::after { animation: vignette .6s ease-in-out infinite alternate; }
  @keyframes vignette { from { box-shadow: inset 0 0 70px 10px rgba(255,60,90,.15); } to { box-shadow: inset 0 0 160px 40px rgba(255,60,90,.42); } }

  /* Cards in the right panel */
  dl { margin: 0; }
  dt { color: var(--quiet); font-size: 11px; text-transform: uppercase; letter-spacing: .1em; margin-top: 14px; }
  dd { margin: 4px 0 0; color: var(--ink2); }
  dd.def { font-size: 13px; color: #aeb6cf; }
  ul.rel { list-style: none; margin: 0; padding: 0; max-height: 240px; overflow-y: auto; }
  ul.rel li { padding: 2px 0; line-height: 1.35; }
  .rnote { display: block; font-size: 12px; color: var(--quiet); }
  .lesion-sign { margin-top: 12px; font: 600 16px/1.3 var(--display); color: #f0abfc; }
  .lesion-legend { margin-top: 10px; font-size: 12px; color: var(--quiet); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
  .lesion-legend .dot { margin-left: 6px; }
  .lesion-levels { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
  .lesion-levels button { font-size: 12px; padding: 6px 10px; }
  /* id selector: must beat the light theme's plain-button rule. */
  #info .lesion-levels button.on { border-color: #c026d3; background: rgba(217,70,239,.14); color: var(--ink); }
  .lesion-pick { display: flex; flex-direction: column; gap: 6px; }
  .lesion-pick button { text-align: left; display: flex; flex-direction: column; gap: 2px; }
  .lesion-pick button span { font-size: 12px; color: var(--quiet); }
  dd.mv-lost a.link { color: #f9a8d4; }
  dd.mv-weak a.link { color: #fcd34d; }
  ul.lesion-details { margin: 0; padding-left: 18px; }
  ul.lesion-details li { margin: 4px 0; line-height: 1.4; }
  .lesion-p { margin: 0 0 6px; }
  dd.rdraft { margin-top: 14px; font-size: 11.5px; color: var(--quiet); font-style: italic; }
  a.link { color: var(--link); cursor: pointer; text-decoration: none; border-bottom: 1px solid rgba(var(--acc),.35); }
  a.link:hover { color: #fff; border-bottom-color: #fff; }
  .empty { color: var(--quiet); }
  .stat { font-size: 12px; color: var(--quiet); margin-top: 6px; }
  .view2d { margin-top: 14px; background: #fbfaf7; border-radius: 14px; overflow: hidden; box-shadow: 0 12px 30px -12px rgba(0,0,0,.6); }
  .view2d img { display: block; width: 100%; }
  .view2d .cap { font-size: 11px; color: #5a6275; padding: 7px 10px; background: #f1efe9; }
  .members { max-height: 220px; overflow-y: auto; margin-top: 6px; font-size: 13px; }
  .members div { padding: 3px 0; }
  .actions { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
  .bar { height: 6px; background: rgba(255,255,255,.08); border-radius: 6px; overflow: hidden; }
  .bar > div { height: 100%; background: linear-gradient(90deg, #34d399, var(--a2)); border-radius: 6px; box-shadow: 0 0 10px rgba(52,211,153,.6); }
  details#devState { margin-top: 22px; }
  details#devState summary { cursor: pointer; color: var(--quiet); font-size: 12px; }

  /* Dashboard: bento grid */
  #dash { position: absolute; inset: 0; z-index: 12; overflow-y: auto; padding: 100px max(28px, calc((100% - 1120px) / 2)) 40px;
    background: radial-gradient(60% 50% at 20% 0%, rgba(var(--acc),.14), transparent 70%), rgba(5,7,13,.82); backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px); }
  #dash[hidden] { display: none; }
  #dash > .sub { font-size: 14px; }
  .cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin: 22px 0; }
  .adm-chart { margin: 6px 0 22px; padding: 16px 18px; border: 1px solid var(--brd); border-radius: 16px; background: var(--glass); }
  .adm-chart .lbl { font-size: 13px; color: var(--quiet); margin-bottom: 10px; }
  .adm-bars { display: flex; align-items: flex-end; gap: 3px; height: 90px; }
  .adm-bars span { flex: 1; min-width: 0; background: rgba(var(--acc), .7); border-radius: 3px 3px 0 0; }
  .adm-bars span.zero { background: rgba(var(--acc), .15); }
  .adm-axis { display: flex; justify-content: space-between; font-size: 12px; color: var(--quiet); margin-top: 6px; }
  .adm-h3 { font-size: 15px; margin: 8px 0 10px; }
  .card { border-radius: 24px; padding: 18px 20px; position: relative; overflow: hidden; }
  .card::after { content: ""; position: absolute; right: -40px; top: -40px; width: 120px; height: 120px; border-radius: 50%; background: radial-gradient(circle, rgba(var(--acc),.25), transparent 70%); }
  .card .big { font: 700 46px/1.05 var(--display); letter-spacing: -.04em; margin: 6px 0 10px;
    background: linear-gradient(135deg, #ffffff 30%, var(--link)); -webkit-background-clip: text; background-clip: text; color: transparent; }
  .card .big .sub { -webkit-text-fill-color: var(--quiet); font: 500 15px/1 var(--font); }
  .card .lbl { color: var(--ink2); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
  .cards .card:first-child { background: linear-gradient(135deg, rgba(var(--acc),.38), rgba(var(--acc2),.18)); border-color: rgba(var(--acc),.3); }
  table.series { width: 100%; border-collapse: separate; border-spacing: 0 8px; margin-top: 4px; }
  table.series th { text-align: left; color: var(--quiet); font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: .1em; padding: 4px 14px; }
  table.series td { padding: 14px; background: var(--glass2); border-top: 1px solid var(--brd); border-bottom: 1px solid var(--brd); vertical-align: middle; }
  table.series td:first-child { border-left: 1px solid var(--brd); border-radius: 16px 0 0 16px; font-weight: 600; }
  table.series td:last-child { border-right: 1px solid var(--brd); border-radius: 0 16px 16px 0; }
  .sysrow { display: grid; grid-template-columns: 100px 1fr 52px; gap: 14px; align-items: center; margin: 9px 0; font-size: 13px; }

  /* Modal */
  .modal { position: fixed; inset: 0; z-index: 50; background: rgba(3,5,10,.55); backdrop-filter: blur(6px); display: flex; align-items: center; justify-content: center; animation: fadeIn .2s; }
  .modal[hidden] { display: none; }
  .modal .box { border-radius: 24px; padding: 26px 28px; width: min(560px, 94vw); max-height: 90vh; overflow-y: auto; background: rgba(15,19,32,.92); animation: rise .35s cubic-bezier(.2,.9,.3,1.2); }
  @keyframes fadeIn { from { opacity: 0; } }
  @keyframes rise { from { opacity: 0; transform: translateY(16px) scale(.98); } }
  .modal h3 { margin: 0 0 14px; font: 600 26px/1.15 var(--display); letter-spacing: -.02em; }
  .field { margin: 16px 0; }
  .field > .lbl { font-size: 11px; color: var(--quiet); margin-bottom: 8px; display: block; text-transform: uppercase; letter-spacing: .1em; }
  .seg { display: flex; flex-wrap: wrap; gap: 6px; }
  .seg label { border: 1px solid var(--brd); background: rgba(255,255,255,.04); border-radius: 999px; padding: 7px 13px; cursor: pointer; font-size: 13px; transition: all .15s; }
  .seg label:hover { border-color: var(--brd2); }
  .seg input { display: none; }
  .seg label:has(input:checked) { border-color: transparent; background: var(--grad); color: #fff; box-shadow: 0 6px 18px -6px rgba(var(--acc),.7); }
  .seg[style*="column"] label { border-radius: 14px; }
  .hint { font-size: 12px; color: var(--quiet); margin-top: 6px; }
  .modal .foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
  .modal .cards { margin: 12px 0; }
  .modal .card .big { font-size: 34px; }
  .signup { text-align: center; }
  .signup h3 { font-size: 30px; }
  .signup .btn-g { width: 100%; background: #fff; color: #14161c; border-color: #fff; font-weight: 600; margin-top: 10px; padding: 12px; }
  .signup .btn-e { width: 100%; margin-top: 8px; padding: 12px; }
  /* Google's sign-in button guidelines: white, the multicolour G, "Continuer avec Google". */
  .btn-google { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; box-sizing: border-box; margin-top: 12px;
    padding: 11px 14px; border: 1px solid #dadce0; border-radius: 8px; background: #fff; color: #1f1f1f; font: 600 15px/1.2 var(--font); text-decoration: none; }
  .btn-google:hover { background: #f8f9fa; border-color: #c6c9ce; }
  .btn-google svg { width: 18px; height: 18px; flex: none; }
  .signup .or { display: flex; align-items: center; gap: 10px; margin: 14px 0 4px; color: var(--quiet); font-size: 13px; }
  .signup .or::before, .signup .or::after { content: ""; flex: 1; height: 1px; background: var(--brd); }
  .mock { font-size: 11px; color: var(--warn); border: 1px dashed rgba(255,181,71,.45); border-radius: 12px; padding: 8px 10px; margin-top: 16px; }
  #toast { position: fixed; z-index: 60; bottom: 22px; left: 50%; transform: translateX(-50%); border-radius: 999px; padding: 10px 18px; font-size: 13px; display: none; animation: rise .3s; }
  /* Legend of the colour mode, in the left panel under the mode buttons. */
  #colorLegend { margin-top: 10px; font-size: 12px; }
  #colorLegend[hidden] { display: none; }
  #colorLegend .hint { color: var(--quiet); margin: 0 0 8px; line-height: 1.4; }
  #colorLegend .chips { display: grid; gap: 2px; }
  #colorLegend span { display: inline-flex; align-items: center; gap: 8px; padding: 4px 2px; }
  #colorLegend button { display: flex; align-items: center; gap: 8px; width: 100%; padding: 6px 8px; font-size: 13px; font-weight: 500;
    text-align: left; border: 0; border-radius: 8px; background: transparent; }
  #colorLegend button:hover { background: rgba(var(--acc),.08); }
  #colorLegend button .n { margin-left: auto; font-size: 11.5px; font-variant-numeric: tabular-nums; }
  #colorLegend button .dot { box-shadow: none; }
  #colorLegend button .n { color: var(--quiet); font-weight: 500; }
  /* id selector: must beat the light theme's plain-button rule. */
  #left .color-row button[aria-pressed="true"], #left [data-theme-set][aria-pressed="true"] { border-color: var(--a1); color: var(--ink); background: rgba(var(--acc),.14); }


  /* Imaging panel */
  #imaging { position: absolute; z-index: 12; right: 16px; top: 80px; bottom: 16px; width: min(600px, 46vw); padding: 18px; border-radius: var(--r); overflow-y: auto;
    background: var(--glass); border: 1px solid var(--brd); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); box-shadow: 0 20px 50px -20px rgba(0,0,0,.6); animation: rise .35s cubic-bezier(.2,.9,.3,1.2); }
  #imaging[hidden] { display: none; }
  body.imaging aside.right, body.imaging .fold[data-fold=right] { display: none; }
  .imgHead { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
  .imgHead h2 { margin: 0 0 6px; }
  .imgTabs { margin: 12px 0; }
  .imgView { position: relative; aspect-ratio: 1; background: #000; border-radius: 16px; overflow: hidden; box-shadow: 0 0 0 1px rgba(255,255,255,.06), 0 20px 40px -20px rgba(0,0,0,.8); }
  .imgView canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
  #imgOverlay { cursor: crosshair; }
  #imgTip { position: absolute; z-index: 2; pointer-events: none; display: none; white-space: nowrap; padding: 5px 10px; border-radius: 999px; font: 600 12.5px/1.2 Inter, sans-serif;
    background: rgba(8,12,20,.85); border: 1px solid rgba(127,233,255,.45); color: #dff9ff; }
  #imaging .field { margin: 12px 0; }
  #imaging .disclaimer { font-size: 11.5px; color: var(--quiet); margin-top: 12px; }

  /* Projection mode: daylight, huge type */
  #projbar, #projcap { display: none; }
  body.proj { background: #f4f2ec; }
  body.proj::before { background: radial-gradient(40% 35% at 15% 10%, rgba(var(--acc),.12), transparent 70%), radial-gradient(40% 35% at 90% 90%, rgba(var(--acc2),.12), transparent 70%); }
  body.proj::after, body.proj #top, body.proj aside, body.proj .fold, body.proj #credits { display: none; }
  body.proj #projbar { display: flex; position: absolute; z-index: 15; top: 18px; right: 18px; gap: 8px; }
  body.proj #projbar button { background: rgba(255,255,255,.85); color: #1b2030; border-color: rgba(20,30,50,.12); font-size: 15px; padding: 10px 16px; backdrop-filter: blur(10px); }
  body.proj #projcap { display: block; position: absolute; z-index: 15; left: 28px; bottom: 28px; max-width: min(72%, 980px); color: #10131c;
    padding: 22px 28px 20px; border-radius: 28px; background: rgba(250,248,243,.80); border: 1px solid rgba(20,30,50,.08);
    backdrop-filter: saturate(150%) blur(16px); -webkit-backdrop-filter: saturate(150%) blur(16px); box-shadow: 0 24px 60px -24px rgba(20,25,40,.35); }
  #projcap .n { font: 700 clamp(44px, 6.2vw, 92px)/.95 var(--display); letter-spacing: -.045em; }
  #projcap .l { font: italic 400 clamp(18px, 1.8vw, 26px)/1.3 var(--font); color: #5b6176; margin-top: 10px; }
  #projcap .i { display: inline-block; font-size: 17px; color: #fff; margin-top: 14px; padding: 6px 14px; border-radius: 999px; background: var(--grad); }
  #projcap .c { font-size: 13px; color: #8a8fa0; margin-top: 14px; }
  body.proj #tip { font-size: 18px; background: #fff; color: #14202b; border-color: rgba(20,30,50,.12); }
  body.proj #quizbar { background: rgba(255,255,255,.9); color: #14202b; }

  .mobile-only { display: none; }
  .icon-btn { width: 40px; height: 40px; padding: 0; align-items: center; justify-content: center; }
  @media (max-width: 900px) {
    .mobile-only { display: inline-flex; }
    #top > #quizOpen, #top > #qcmOpen, #top > #imgOpen, #top > #lesionOpen, #top > #projOpen, #top > #userChip { display: none; }
    #top .brand .tag { display: none; }
    #top .spacer { flex: 1; min-width: 0; }
    #top { gap: 4px; padding: 0 10px; height: 56px; }
    #top .brand { margin-right: 6px; font-size: 15px; }
    #top .brand svg { width: 28px; height: 28px; }
    #top .tab { height: 56px; margin: 0 6px; font-size: 13.5px; }
    details#devState { display: none; }
    body.mobile-search aside#left { display: block; position: fixed; top: 64px; bottom: 8px; left: 8px; right: 8px; max-height: none; z-index: 30; transform: none; opacity: 1; }
    body.mobile-search aside.right { display: none; }
    .mobile-sheet-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; font-weight: 600; }
    #top { overflow-x: auto; }
    aside#left, aside.right { left: 8px; right: 8px; width: auto; top: auto; bottom: 8px; max-height: 42vh; }
    aside#left { display: none; }
    .fold { display: none; }
    /* Phone: the QCM is a bottom sheet, the 3D stays visible above it. */
    #qcm { left: 8px; right: 8px; width: auto; top: auto; bottom: 8px; max-height: 58%; }
    body.quizzing #zoomCtl { bottom: auto; top: 76px; }
    #zoomCtl { right: 12px; bottom: calc(42vh + 20px); }
    #credits { display: none; }
  }
