/* Phones (mobile-hamburger-mockups.html, option B "Slim title bar"). d-orbit.html loads this file only under 1025px,
   so desktop and wide windows never read it. One thin see-through bar over the body: ☰, where you are and the
   account. ☰ opens the side bar as a drawer listing every tab (phone-menu.js); a tab's text sits in a sheet. */

/* The bar runs over the body; it slides away while the page scrolls down (side-nav.js). */
.app > .bar { position: fixed; z-index: 8; inset: 0 0 auto; height: auto; min-height: 0; gap: 10px; padding: calc(6px + var(--sat, 0px)) 10px 14px !important;
  background: linear-gradient(#12162ae6 55%, #12162a00); border: 0; pointer-events: none; transition: transform .22s ease; }
.app > .bar > *, .bar-end > * { pointer-events: auto; }
.app > .bar :is(.brand, .side-top, .hiw-open) { display: none !important; }
.m-title { display: block; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: center;
  font: 700 15px "Plus Jakarta Sans", system-ui, sans-serif; color: #fff; pointer-events: none !important; }
.m-title small { font-size: inherit; font-weight: 600; opacity: .62; }
.bar-end > .set-open { display: none !important; } /* Settings is in the ☰ menu (signed in: the account menu) */
.m-burger { display: grid; place-items: center; width: 40px; height: 40px; min-height: 0; padding: 0; border: 0;
  border-radius: 12px; background: none; color: #fff; cursor: pointer; }
.m-burger svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.bar-end > .acct { display: grid; place-items: center; width: 40px; height: 40px; min-height: 0; padding: 0; border: 0; border-radius: 50%; background: none; }
.bar-end > .acct .acct-av { width: 28px; height: 28px; font-size: 13px; box-shadow: none; }
.bar-end > .acct .acct-left { display: none; }
.bar-away .app > .bar { transform: translateY(-100%); }
/* The Hara sheet takes 70% of the screen: the bar leaves while it is open, so every zone above it shows. */
body:has(.hara-dock:not([hidden])) .app > .bar, :root.full-view body:has(.hara-dock:not([hidden])) .app.app > .bar { transform: translateY(-100%); }
/* In full view too, and folded: the patient's right and left sit where the bar was. */

/* The side bar is a drawer from the start edge, as wide as it is on desktop unfolded but with phone-sized rows. */
.sidenav.mode, :root.app-cover .sidenav.mode { inset-block: 0; inset-inline: 0 auto; width: min(300px, 84vw); height: auto; z-index: 30;
  padding: calc(14px + var(--sat, 0px)) 12px calc(10px + var(--sab, 0px)); border-inline-end: 0; box-shadow: 0 0 40px #0006;
  translate: -105% 0; transition: translate .24s cubic-bezier(.2, .7, .3, 1); background: var(--d-panel, #fff); }
/* The app-cover form of the rule above must not win over right-to-left, or the closed drawer sits in mid-screen (app mode, Hebrew). */
[dir="rtl"] .sidenav.mode, :root.app-cover[dir="rtl"] .sidenav.mode { translate: 105% 0; }
:root.menu-open .sidenav.mode, :root.app-cover.menu-open .sidenav.mode { translate: none; }
.m-scrim { display: block; position: fixed; inset: 0; z-index: 29; background: #10131fa0; opacity: 0; pointer-events: none; transition: opacity .24s; }
:root.menu-open .m-scrim { opacity: 1; pointer-events: auto; }
.app, .app-cover .app { margin-inline-start: 0; padding-bottom: var(--sab, 0px); }
.sidenav .fold { display: none !important; }
.sidenav .sn-head { padding: 2px 6px 0; }
.sidenav .sn-head img { height: 26px; }
.sn-slogan { display: block; flex: none; padding: 3px 6px 14px; font-size: 11.5px; color: #7a8194; }
/* The Treatment / Study switch heads the drawer, which lists the chosen half's tabs. */
.sidenav .sn-tools { padding: 0 0 12px; margin-bottom: 4px; }
.sidenav .sn-tools .side-seg { flex: 1; padding: 3px; border: 1px solid var(--d-soft-line, #cdd2f5); border-radius: 12px; background: var(--indigo-soft); }
.sn-tools .side-seg button, .sidenav.mode .sn-tools .side-seg button { flex: 1; padding: 9px 6px; font-size: 13.5px; }
.sn-tools .side-seg button span { display: inline; }
.sn-tools .sn-gap { display: none; }
.sidenav.mode button { flex: none; height: auto; min-height: 0; padding: 12px 10px; font-size: 15px; gap: 12px; }
.sidenav.mode button svg { width: 22px; height: 22px; }
.sidenav.mode .sn-sub { padding-inline-start: 44px; font-size: 14px; }
.sidenav.mode button.on, .sidenav.mode button.on[data-mode] { background: var(--indigo-soft); color: var(--indigo); }
.sidenav .sn-k { padding-top: 12px; }
.sidenav .sn-foot { padding-top: 8px; }

/* The body fills the screen behind everything. Where a tab's text runs under the body (Pain, Hara, Indication), that
   text is a sheet: it starts 30% up from the bottom and slides over the body as the page scrolls. */
.app.app.app > .stage, .app.app.app.exam.study-anat > .stage { position: sticky; top: 0; height: calc(100svh - var(--sat, 0px) - var(--sab, 0px)); min-height: 0; }
.app.app.app.exam:not(.study-anat) > .stage { position: relative; height: 34svh; min-height: 240px; }
.app:not(.exam, .mer, .methods, .ind) > aside:not([class]), .app.ind > .ind-dock { position: relative; z-index: 4; margin-top: -30svh;
  border: 0; border-radius: 20px 20px 0 0; background: var(--panel); box-shadow: 0 -10px 30px #0005; transform: translateZ(0); }
/* translateZ: its own layer, or iPhone Safari draws the sticky 3D stage over all but the sheet's first lines. */
.app:not(.exam, .mer, .methods, .ind) > aside:not([class])::before, .app.ind > .ind-dock::before { content: ""; display: block; width: 40px; height: 5px;
  margin: 8px auto 0; border-radius: 3px; background: var(--d-line, #c4c8d4); }
.app.exam:not(.study-anat) > .stage { margin-top: 0; }
/* Nothing sits under the bar: the body tools and the chip rows start below it. */
.stage .tools { top: 64px; }
.app.mer > .rail, .app.app.methods > .mrail { margin-top: 60px; } /* the page already sits under the iOS status bar */
.app.mer > .rail { margin-inline-end: 60px; }
/* The sheets that float over the body sit on the bottom edge now that there is no tab bar. */
.app.mer > aside, .app.app.methods > :is(aside:not([class]), .mwiz), .app .stage > .anat-dock, .app .stage > .anat-dock:has(.ad-hint) { bottom: calc(8px + var(--sab, 0px)); }
.app :is(.mwiz, .anat-dock, aside:not([class]))[data-sheet="full"] { max-height: calc(100svh - 80px - var(--sat, 0px) - var(--sab, 0px)) !important; }
:is(#examPanel, #quizPanel) .qexit { bottom: calc(8px + var(--sab, 0px)); }
.legal { scroll-margin-bottom: 8px; }
/* Full view: nothing left to hide but the bar. */
:root.full-view .app.app > .bar { display: flex; background: none; transform: none; }
:root.full-view.bar-away .app.app > .bar { transform: translateY(-100%); } /* scrolled down to the panel: the faint bar must not lie over its text */
:root.full-view .m-title { transition: opacity .6s; }
:root.full-view .app > .bar :is(.m-burger, .bar-end > .acct) { background: #141a30b3; border-radius: 12px; transition: opacity .6s; }
/* A few seconds after the page opens or a tab changes the bar dims over the body (phone-menu.js); a touch lights it. */
:root.full-view.bar-dim .m-title, :root.full-view.bar-dim .app > .bar :is(.m-burger, .bar-end > .acct) { opacity: .3; }
:root.full-view .app > .bar :is(.m-burger, .bar-end > .acct):is(:hover, :focus-visible, :active) { opacity: 1; transition-duration: .1s; }
:root.full-view .sidenav.mode.mode { display: flex; } /* the drawer ☰ opens */
html.touring:not(.guest-tour) .app.app.app > .stage { height: calc(100svh - var(--sat, 0px) - var(--sab, 0px)); }

@media (prefers-reduced-motion: reduce) { .app > .bar, .sidenav.mode, .m-scrim { transition: none; } }
/* Watch the flow: the meridian chips leave (the film's controls list the channels) and the film starts under the bar,
   so its caption and Close show. */
.app:has(.stage .flow-in) > aside > .mclock { display: none; }
.stage .flow-in { top: 56px; height: calc(100% - 56px); }
.stage .flow-in-x { top: 64px; }

/* Learn the basics scrolls itself into view: its heading stops below the title bar. */
#learnPanel { scroll-margin-top: 60px; }

/* The body tools in the same dark glass as the bar and the sheets. */
[data-bg="dark"] .stage .tools { --bt-line: #ffffff1c; background: #141a30d9; backdrop-filter: blur(12px); }

/* Meridians (phone-mer.js): the sheet stays open in dark glass, led by the organ clock; its ✕ and the Search button go. */
.app.app.mer:not(.mer-open):not(:has(.stage .flow-in)) > aside:has(> #merPanel) { display: block; }
.app.mer .stage:not(:has(.flow-in)) .mer-list { display: none; }
.app.app.mer:has(:is(#pfloat, #afloat):not([hidden])) > aside:has(> #merPanel:not([hidden])) { display: none; } /* a point's (or a muscle's, a bone's) card takes the sheet's place; closing it brings the sheet back */
/* The screen splits: the card is the lower half, the body (drawn in the upper half, d-orbit.html) the upper. */
.stage > #pfloat[data-at="foot"] { top: var(--card-top, 50%); bottom: 8px; max-height: none; } /* --card-top: dragged by its grip (card-resize.js) */
.stage > #pfloat[data-at="foot"]:not(.pf-min) > .pf-head { padding-top: 14px; }
.stage > #pfloat[data-at="foot"]:not(.pf-min) > .pf-head::before { content: ""; position: absolute; top: 4px; left: 50%; translate: -50% 0; width: 40px; height: 4px; border-radius: 2px; background: var(--muted); opacity: .6; cursor: ns-resize; }
.stage > #pfloat.pf-min[data-at="foot"] { top: auto; } /* folded (⌄): just its head row at the foot */
.stage > .pfloat .pf-head { touch-action: none; cursor: grab; }
.stage > .near-bar { top: 58px; left: auto; inset-inline: 10px 68px; translate: none; padding-inline-start: 8px; } /* under the floating title, clear of the body tools */
.stage > .near-bar input { flex: 1; min-width: 0; width: auto; }
.stage:has(> #pfloat:not([hidden])) > .near-bar { display: none; } /* the point's card has the screen */ /* drag the card by it (phone-drag.js) */
.app.mer > aside:has(> #merPanel:not([hidden])) { background: #141a30eb; border-color: #ffffff1c; color: #eef0fa; backdrop-filter: blur(18px); box-shadow: 0 -10px 40px #0007; }
.app.app.mer > aside[data-sheet="peek"]:has(> #merPanel:not([hidden])) { max-height: 64px !important; overflow: hidden; } /* folded: the title bar alone, the body in full view */
.app.mer > aside:has(> #merPanel:not([hidden])) > .mer-head { justify-content: flex-start; align-items: center; gap: 8px; padding: 24px 12px 6px;
  background: #171d34; border-bottom: 0; }
.app.mer > aside:has(> #merPanel:not([hidden])) > .mer-head > .mer-x { display: none; }
.app.mer > aside:has(> #merPanel:not([hidden])) .sheet-grip > i { background: #ffffff40; }
.app:not(.mer) > aside > .mclock, .app > aside:has(> #merPanel[hidden]) > .mclock { display: none; }
/* The head is just the grab handle: the row below carries clear and fold. */
.app.mer > aside:has(> #merPanel:not([hidden])) > .mer-head { min-height: 0; padding: 24px 12px 0; } /* room for the handle (24px, d-orbit.html) */
.app.app.mer > aside[data-sheet="peek"]:has(> #merPanel:not([hidden])) { max-height: 70px !important; }
/* Nothing picked: the sheet is the row alone (no handle: there is nothing to pull up; the panel held only Sources and the
   search the magnifier has). */
.app.mer > aside > #merPanel.mer-idle, .app.mer > aside:has(> #merPanel.mer-idle) > :is(.legal, .mer-head) { display: none; }
.app.mer > aside:has(> #merPanel.mer-idle) > .mclock { margin-block: 0; }
.mclock > :is(.mc-proxy, .mc-fold) { flex: none; display: grid; place-items: center; width: 32px; height: 32px; min-height: 0; margin: 0; padding: 0;
  border: 1px solid #ffffff2e; border-radius: 50%; background: none; box-shadow: none; color: #e8ebf7; cursor: pointer; }
.mclock > .mc-proxy > :is(i, span, em) { display: none; }
.mclock > .mc-proxy svg, .mclock > .mc-fold svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2.3; stroke-linecap: round; stroke-linejoin: round; }
.mclock > .mc-fold svg { transition: transform .2s; }
.app > aside[data-sheet="peek"] > .mclock > .mc-fold svg { transform: rotate(180deg); }
/* A channel's points, small enough that a whole channel fits the half-open sheet. */
.app.mer #merPanel .pts { display: grid; grid-template-columns: repeat(auto-fill, minmax(34px, 1fr)); gap: 4px; margin-bottom: 10px; }
.app.mer #merPanel .pts button { min-width: 0; min-height: 30px; padding: 0; font-size: 10.5px; border-radius: 6px; }
.app.mer #merPanel .pts ~ p.muted { display: none; } /* "pick a point…": the points say it */

/* The channels: one row of circles ringed in the channel's colour, its code inside; picked = filled. Swiped either way. */
.mclock { position: relative; display: flex; align-items: center; gap: 6px; margin: 0 -14px 10px; padding-inline-end: 12px; }
.mclock > .rail { flex: 1; min-width: 0; display: flex; flex-direction: row; flex-wrap: nowrap; align-items: center; gap: 5px; margin: 0; padding: 2px 12px;
  overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x proximity; scrollbar-width: none; background: none; border: 0; pointer-events: auto; }
.mclock > .rail::-webkit-scrollbar { display: none; }
.mclock > .rail > :not(button[style], .preg-t, [data-mer="threads"]) { display: none !important; } /* the reset has a stand-in at the row's end */
.mclock > .rail button[style] { flex: none; display: grid; place-items: center; width: 38px; height: 38px; min-height: 0; margin: 0; padding: 0;
  border: 2px solid var(--c); border-radius: 50%; background: none; box-shadow: none; color: #f2f4fb; opacity: 1; scroll-snap-align: center; }
.mclock > .rail button[style] > :is(i, span) { display: none; }
.mclock > .rail button[style] b { font: 700 11px "Plus Jakarta Sans", system-ui, sans-serif; color: inherit; text-align: center; line-height: 1; text-box: trim-both cap alphabetic; }
.mclock > .rail button[style].on { background: var(--c); color: #fff; }
.mclock > .rail:has(button.on) button[style]:not(.on) { opacity: .55; }
/* The pregnancy toggle: the row's last item, a pill in the caution colour. */
.mclock > .rail > .preg-t { flex: none; display: flex; align-items: center; width: auto; height: 38px; min-height: 0; margin: 0; padding: 0 12px;
  border: 1px dashed #f08a2499; border-radius: 999px; background: #f08a2414; color: #ffd28a; box-shadow: none; scroll-snap-align: center; }
.mclock > .rail > .preg-t :is(i, span) { display: none; }
.mclock > .rail > .preg-t em { display: block; font: 700 12px "Plus Jakarta Sans", Heebo, system-ui, sans-serif; font-style: normal; white-space: nowrap; }
.mclock > .rail > .preg-t[aria-pressed="true"] { border-style: solid; border-color: #f08a24; background: #f08a24; color: #1a1206; }
/* More to see on a side: the row fades out there. */
.mclock > .rail { --fs: 0px; --fe: 0px; mask-image: linear-gradient(to right, #0000, #000 var(--fs), #000 calc(100% - var(--fe)), #0000); }
[dir="rtl"] .mclock > .rail { mask-image: linear-gradient(to left, #0000, #000 var(--fs), #000 calc(100% - var(--fe)), #0000); }
.mclock.more-s > .rail { --fs: 26px; }
.mclock.more-e > .rail { --fe: 26px; }

/* The points list in the dark sheet. */
#merPanel .psearch input { background: #ffffff12; border-color: #ffffff1c; color: #fff; }
#merPanel .psearch input::placeholder { color: #a6adc8; }
#merPanel > form + p.muted { display: none; } /* "pick a meridian at the top": the clock is right there */
#merPanel .mh h2 { color: #fff; }
/* The magnifier in the tool column searches, so the sheet drops its own field; ✕ on the heading closes the channel's card. */
.app.mer #merPanel .psearch { display: none; }
#merPanel .mh-x { display: grid; place-items: center; flex: none; } /* its look: close-x.css */
/* With one channel picked its ✕ does what clear-all would: clear-all shows from two channels on. */
.app.mer:not(:has(#rail button[style].on ~ button[style].on)) .mclock > .mc-proxy { display: none; }
#merPanel :is(.mh span, .muted, .pts-legend) { color: #a6adc8; }
/* The disclaimer folds behind Sources (its full text opens there). */
.app.mer > aside > .legal { border-color: #ffffff1c; color: #a6adc8; }
.app.mer > aside > .legal:not([open]) summary { font-size: 0; }
.app.mer > aside > .legal:not([open]) summary > .i { display: none; }
.app.mer > aside > .legal summary::after { font-size: 12px; color: #a9b3ff; }

/* While the flow plays: Whole body sits under the film's ✕, in its style, and hands the camera back to the film
   (flow-film.js); the film has the whole screen. Otherwise Whole body sits under the body tools (top 64px, 90px tall). */
.stage > .home { top: 162px; bottom: auto; inset-inline-end: 10px; }
.stage > .turn-btn { top: 210px; }
.stage > .reset-btn { top: 258px; inset-inline-end: 10px; }
.app.mer .stage:not(:has(.flow-in)) > .threads-btn { top: 306px; inset-inline-end: 10px; }
.stage:has(.flow-in) > .home { z-index: 7; bottom: auto; inset-inline-end: 12px; border: 0; border-radius: 50%; background: #1b1f27cc; color: #fff; }
:root.full-view .stage .flow-in { top: 0; height: 100%; }
:root.full-view .stage .flow-in-x { top: 12px; }
:root.full-view .stage:has(.flow-in) > .home[data-zoom="reset"] { top: 64px; }
:root.full-view .app:has(.stage .flow-in) > aside { display: none; }

/* A sheet folds into a glass pill at the foot (phone-pill.js): ⌄ on the sheet, or touching the body on Meridians. */
.m-fold { display: grid; place-items: center; flex: none; width: 32px; height: 32px; min-height: 0; padding: 0; border: 1px solid var(--line);
  border-radius: 50%; background: var(--panel); color: var(--muted); cursor: pointer; }
.m-fold svg, .m-pill svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.app > :is(aside:not([class]), .ind-dock) > .m-fold { position: absolute; z-index: 2; top: 10px; inset-inline-end: 12px; }
.app:is(.exam, .mer, .methods, .ind) > aside:not(.ind-dock) > .m-fold { display: none; }
.hara-dock .hd-head > .m-fold { width: 40px; height: 40px; border-radius: 10px; margin-inline-start: auto; }
.hara-dock .hd-head > .m-fold + .hd-x { margin-inline-start: 0; }
:root:is([data-fold="pain"], [data-fold="hara"]) .app > aside:not([class]), :root[data-fold="ind"] .app.ind > .ind-dock, :root[data-fold="hara"] .hara-dock, :root[data-fold="mer"] .app.app.mer > aside { display: none !important; }
.m-pill { position: fixed; z-index: 7; bottom: calc(18px + var(--sab, 0px)); left: 50%; translate: -50% 0; display: flex; align-items: center; gap: 10px;
  max-width: calc(100vw - 32px); height: 46px; min-height: 0; padding: 0 14px 0 8px; border: 1px solid #ffffff30; border-radius: 999px;
  background: #141a30cc; backdrop-filter: blur(12px); box-shadow: 0 6px 20px #0006; color: #fff; font: 700 14.5px "Plus Jakarta Sans", Heebo, system-ui, sans-serif; cursor: pointer; }
.m-pill[hidden], .app:has(:is(#pfloat, #afloat):not([hidden]), .stage .flow-in) > .m-pill { display: none; }
.m-pill .mp-n { display: grid; place-items: center; flex: none; width: 30px; height: 30px; border-radius: 50%; background: var(--indigo); font-weight: 800; }
.m-pill .mp-n:empty { width: 6px; background: none; }
.m-pill .mp-t { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* The point, muscle and bone cards follow the body's backdrop: dark glass over the dark one, white over the light. */
[data-bg="dark"] .stage > .pfloat { --ink: #eef0fa; --muted: #a6adc8; --line: #ffffff1f; --indigo: #a9b3ff; --indigo-soft: #ffffff14;
  background: #141a30f2; backdrop-filter: blur(18px); border-color: #ffffff1c; border-top-color: var(--c, #4b5bdc); color: var(--ink); }
[data-bg="dark"] .stage > .pfloat .pf-head { background: #171d34; }
[data-bg="dark"] .stage > .pfloat :is(.pf-head button, .cun-btn, .pdet-x) { background: #ffffff0d; color: var(--ink); }
[data-bg="dark"] .stage > .pfloat .pdet .cun-btn { color: var(--indigo); }
[data-bg="dark"] .stage > .pfloat .pdet .cun-btn.on { background: #4b5bdc; border-color: #4b5bdc; color: #fff; }
[data-bg="dark"] .stage > .pfloat .cats span { background: #ffffff14; color: #c9cdf5; }
[data-bg="dark"] .stage > .pfloat .caut p { background: #f59f0024; color: #ffd28a; }
[data-bg="dark"] .stage > .pfloat .caut p.stop { background: #e5484d2b; color: #ffb3b5; }
[data-bg="dark"] .stage > .pfloat .caut details { background: #f59f0024; color: #ffd28a; }
[data-bg="dark"] .stage > .pfloat .caut details.stop { background: #e5484d2b; color: #ffb3b5; }
[data-bg="dark"] .stage > .pfloat .caut details > p { background: none; color: inherit; }
[data-bg="dark"] .stage > .pfloat .ptlink { background: #00c76a24; color: #6ee7b0; }
[data-bg="dark"] .stage > .pfloat .badge.alt { background: #3b82f633; color: #bfdbfe; }
[data-bg="dark"] .stage > .pfloat .ad-acts button:not(.on) { background: #ffffff0d; border-color: #ffffff26; color: var(--ink); } /* Peel away, See through others: --panel is still white here */
[data-bg="dark"] .stage > .pfloat .ad-acts button.restore { color: #ffd28a; }
[data-bg="dark"] .stage > .pfloat .ad-acts button[data-more] { border-color: var(--indigo); color: var(--indigo); }
[data-bg="dark"] .stage > .pfloat .pdet .nav button { background: #ffffff12; border-color: #ffffff26; color: var(--ink); }
[data-bg="dark"] .stage > .pfloat .pdet .nav button:disabled { color: #ffffff4d; }
/* The card's switches and tabs: their track and chosen pill read --d-panel…, unset in the light theme, so they stayed white on the dark glass. */
[data-bg="dark"] .stage > .pfloat :is(.mseg, .pc-tabs) { --d-panel2: #232a3f; --d-panel: #3a4159; } /* opaque: the tabs stay put while the text scrolls under them */
[data-bg="dark"] .stage > .pfloat :is(.mseg button:is(.on, [aria-pressed="true"]), .pc-tabs button[aria-selected="true"]) { color: #fff; box-shadow: none; }

/* The other sheets over the body (Treatment ways, Hara, Indications, Anatomy, Learn, Quiz) follow the dark backdrop the
   same way: they take the dark theme's colours (dark.css). */
[data-bg="dark"] :is(.app > aside, .hara-dock, .ind-dock, .anat-dock) {
  color-scheme: dark;
  --bg: #0d1120; --panel: #161b2e; --ink: #e8ebf5; --muted: #9aa3bd; --line: #2b3250;
  --indigo: #6676f5; --indigo-soft: #262d55; --boost-soft: #3a2a14;
  --d-panel: #161b2e; --d-glass: #161b2eeb; --d-panel2: #1c2238; --d-line: #2b3250; --d-soft: #262d55; --d-soft-line: #3a4380;
  --d-ok: #12322a; --d-ok-ink: #6ee7b0; --d-bad: #3a1a1f; --d-bad-ink: #ffadb1; --d-warn: #3a2c12; --d-warn-ink: #ffd28a;
  --d-info: #1a2a4a; --d-info-ink: #bfdbfe; --d-ink: #e8ebf5; --d-muted: #9aa3bd;
  color: var(--ink);
}

/* Quiz (quiz-phone-mockups.html): a question that shows something on the body ([data-body]: a channel drawn, a point
   marked, a muscle or bone lit) sits in a sheet under the body (C); any other question, the list and the result cover
   the body (A). The body keeps one size, so moving between the two never resizes the 3D view. */
.app.app.app.exam.quiz > .stage { position: sticky; top: 0; height: 46svh; }
.app.exam.quiz > aside:not([class]) { position: fixed; z-index: 6; inset: 0; margin: 0; padding: calc(64px + var(--sat, 0px)) 18px calc(16px + var(--sab, 0px));
  overflow-y: auto; overscroll-behavior: contain; border: 0; border-radius: 0; background: var(--d-panel, var(--panel)); transition: top .3s ease, border-radius .3s ease; }
.app.exam.quiz > aside:not([class]):has(#quizPanel[data-body]) { top: 43svh; padding-top: 18px; border-radius: 22px 22px 0 0; box-shadow: 0 -10px 30px #0006; }
.app.exam.quiz > aside:not([class]):has(#quizPanel[data-body])::before { content: ""; position: absolute; top: 7px; left: 50%; width: 40px; height: 5px; margin-left: -20px;
  border-radius: 3px; background: var(--d-line, #c4c8d4); }
/* One header row with a small ✕ instead of the wide Exit at the foot; the score on one line; answers one per row. */
#quizPanel .qbar .qx { display: grid; place-items: center; flex: none; width: 34px; height: 34px; min-height: 0; padding: 0; border: 1px solid var(--line);
  border-radius: 50%; background: none; color: var(--muted); font-size: 15px; cursor: pointer; }
#quizPanel .qexit { display: none; }
#quizPanel .prog { margin-bottom: 10px; }
#quizPanel .stats:not(.big) { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 0 0 16px; }
#quizPanel .stats:not(.big) .cell { display: flex; align-items: baseline; gap: 4px; padding: 0; border-radius: 0; background: none; }
#quizPanel .stats:not(.big) b { display: inline; font: 700 13px "JetBrains Mono", ui-monospace, monospace; }
#quizPanel .stats:not(.big) span { display: none; }
#quizPanel .stats:not(.big) :is(.c, .w, .s) b::before { font-weight: 700; margin-inline-end: 4px; }
#quizPanel .stats:not(.big) .c b::before { content: "✓"; }
#quizPanel .stats:not(.big) .w b::before { content: "✗"; }
#quizPanel .stats:not(.big) .s b::before { content: "↷"; }
#quizPanel .qp { font-size: 21px; }
#quizPanel .opts { grid-template-columns: 1fr; }
#quizPanel[data-body] .qp { font-size: 18px; }

/* Hara open: the Treatment sheet under it stays away, also while the rating bubble folds the Hara sheet to its title. */
.app:has(> .hara-dock:not([hidden])) > aside:not([class]) { display: none; }
/* The 12 meridian rows (meridian-guide-ui.js): tighter than the tabs, so the drawer stays short. */
.sidenav.mode .sn-mer { padding-block: 7px; font-size: 13.5px; }
.mg-five { grid-template-columns: 1fr 1fr; }
.mg-five > div:first-child { grid-column: 1 / -1; } /* Element alone on top, then two rows of two */

/* ---- The drawer as cards (phone-panel.js): Study = the Meridians card with its 12 circles, then tiles; Treatment = a card with the three ways in. ---- */
.sidenav .sn-k[data-k="study"], .sidenav .sep { display: none; }
[data-side="treat"] .pn-study, [data-side="study"] .pn-treat { display: none; }
.pn-treat, .pn-study { display: grid; overflow: hidden; margin-bottom: 8px; border: 1px solid var(--d-soft-line, #e3e5f0); border-radius: 16px; background: var(--d-panel2, #fafaff); }
.sidenav.mode .sn-d, .sidenav .sn-k .sn-d { display: block; margin-top: 2px; font: 400 11.5px/1.3 "Plus Jakarta Sans", system-ui, sans-serif; color: var(--d-muted, #6b7092); }
/* The hero: the Meridians button (Study) and the Treatment heading (Treatment). */
.pn-study > [data-mode="mer"], .pn-treat > .sn-k { grid-column: 1 / -1; display: flex; align-items: center; gap: 12px; margin: 0 0 12px; padding: 14px 12px; border-radius: 0;
  background: linear-gradient(120deg, #4f46d8, #7a6cf0); color: #fff; text-transform: none; letter-spacing: 0; font: 700 16px/1.2 "Plus Jakarta Sans", system-ui, sans-serif; }
.sidenav.mode .pn-study > [data-mode="mer"].on { background: linear-gradient(120deg, #4f46d8, #7a6cf0); color: #fff; box-shadow: inset 0 0 0 2px #ffffffb0; }
.pn-study > [data-mode="mer"] .sn-d, .pn-treat > .sn-k .sn-d { color: #e4e2ff; }
.sidenav.mode .pn-study > [data-mode="mer"] svg, .pn-treat > .sn-k svg { flex: none; width: 34px; height: 34px; padding: 7px; border-radius: 10px; background: #ffffff26; fill: none; stroke: #fff; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.pn-study > [data-mode="mer"] > span, .pn-treat > .sn-k > span { display: block; min-width: 0; }
/* The 12 channels: a coloured circle with its code and the name under it, six to a row. */
.pn-study { grid-template-columns: repeat(6, minmax(0, 1fr)); padding-bottom: 10px; row-gap: 10px; }
.sidenav.mode .pn-study > .sn-mer { grid-column: auto; display: grid; grid-template-rows: 32px auto; justify-items: center; align-content: start; align-self: start; gap: 4px; min-height: 62px; height: auto; padding: 0 1px; border-radius: 8px;
  font-size: 8.3px; letter-spacing: -.2px; font-weight: 500; line-height: 1.15; text-align: center; }

.sidenav.mode .pn-study .sn-mer > span { display: block; width: 100%; white-space: normal; overflow-wrap: normal; margin-inline: -3px; width: calc(100% + 6px); }
.pn-study .sn-mer .sn-dot { width: 32px; height: 32px; border-radius: 50%; font-size: 10px; }
.sidenav.mode .pn-study > [data-flow] { grid-column: 1 / -1; margin: 2px 10px 0; padding: 10px 2px 0; border-top: 1px solid var(--d-soft-line, #e3e5f0); border-radius: 0; font-size: 13.5px; font-weight: 600; }
.sidenav.mode .pn-study > [data-flow] { order: 9; }
.pn-study > [data-flow] svg { width: 22px; height: 22px; }
.pn-study > [data-flow] .sn-long { display: block; }
.sidenav.mode .pn-study > [data-mode="learn"] { grid-column: 1 / -1; align-items: center; gap: 10px; margin: -4px 10px 4px; padding: 8px 10px; border: 1px solid var(--d-soft-line, #e3e5f0); border-radius: 12px; background: var(--d-panel, #fff);
  font-size: 13.5px; font-weight: 700; color: var(--d-ink, #1c1f3a); }
.sidenav.mode .pn-study > [data-mode="learn"].on { background: var(--indigo-soft); color: var(--indigo); box-shadow: inset 0 0 0 2px var(--indigo); }
.sidenav.mode .pn-study > [data-mode="learn"] svg { flex: none; width: 30px; height: 30px; padding: 6px; border-radius: 9px; background: var(--indigo-soft); color: var(--indigo); }
.sidenav.mode .pn-study > [data-mode="learn"] > span { min-width: 0; white-space: normal; overflow-wrap: anywhere; }
/* Treatment: the three ways in as circles. */
.pn-treat { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; padding: 0 8px 12px; }
.pn-treat > .sn-k { margin: 0 -8px 6px; }
.sidenav.mode .pn-treat > [data-way] { grid-column: auto; flex-direction: column; justify-content: flex-start; align-items: center; gap: 6px; padding: 10px 2px 8px; border: 1px solid var(--d-soft-line, #e3e5f0); border-radius: 12px; background: var(--d-panel, #fff);
  font-size: 13px; font-weight: 700; text-align: center; color: var(--d-ink, #1c1f3a); }
.sidenav.mode .pn-treat > [data-way].on { background: var(--indigo-soft); box-shadow: inset 0 0 0 2px var(--indigo); }
.sidenav.mode .pn-treat > [data-way] svg { width: 42px; height: 42px; padding: 10px; border-radius: 50%; background: var(--indigo); color: #fff; }
.sidenav.mode .pn-treat > [data-way] > span { display: block; width: 100%; white-space: normal; overflow-wrap: anywhere; }
.pn-treat > [data-way] .sn-d { font-size: 10.5px; font-weight: 400; }
/* Tiles for the other tabs, two to a row; the Sage alone under Treatment takes the whole row. */
.pn-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.sidenav.mode .pn-tiles > button { min-width: 0; align-items: center; gap: 10px; padding: 10px; border: 1px solid var(--d-soft-line, #e3e5f0); border-radius: 14px; background: var(--d-panel, #fff);
  font-size: 13.5px; font-weight: 700; color: var(--d-ink, #1c1f3a); }
.sidenav.mode .pn-tiles > button.on { background: var(--indigo-soft); color: var(--indigo); box-shadow: inset 0 0 0 2px var(--indigo); }
.sidenav.mode .pn-tiles > button svg { flex: none; width: 32px; height: 32px; padding: 7px; border-radius: 9px; background: var(--indigo-soft); color: var(--indigo); }
.sidenav.mode .pn-tiles > button > span { min-width: 0; white-space: normal; overflow-wrap: anywhere; }
[data-side="treat"] .pn-tiles > [data-mode="sage"] { grid-column: 1 / -1; }
/* iPhone Safari: the separators inside the tiles wrapper stay hidden, the drawer is as tall as the visible screen, and the foot keeps clear of the browser bar. */
.sidenav.mode .pn-tiles > .sep, .sidenav.mode .pn-tiles > .sep-sage { display: none; }
.sidenav.mode, :root.app-cover .sidenav.mode { height: 100dvh; max-height: 100dvh; padding-bottom: 0; }
.sidenav .sn-foot { position: sticky; bottom: 0; z-index: 2; margin-top: auto; padding: 8px 0 calc(14px + var(--sab, 0px)); background: var(--d-panel, #fff); }
.pn-study, .pn-treat { flex: none; }

/* Sage: a point opened from an answer shows on the body; the conversation folds into a pill until it is tapped (sage-mode.js). */
#sagePanel[data-mini] > .sg-layout { display: none; }
#sagePanel[data-mini] > .sg-pill { display: block; min-height: 44px; padding: 0 20px; border: 0; border-radius: 999px; background: var(--indigo); color: #fff; font-weight: 800; cursor: pointer; }
.app.sage > aside:has(#sagePanel[data-mini]) { position: fixed; z-index: 6; inset: auto; inset-inline-end: 16px; bottom: calc(16px + var(--sab, 0px)); width: auto; height: auto; min-height: 0;
  margin: 0; padding: 0; overflow: visible; border: 0; background: none; box-shadow: 0 6px 20px #0005; border-radius: 999px; }
.app.app.app.sage:has(#sagePanel[data-mini]) > .stage { height: calc(100svh - var(--sat, 0px) - var(--sab, 0px)); }
/* Sage chat history: a ☰ button at the top of the chat opens the list in place of the chat. */
#sagePanel .sg-layout { display: flex; flex-direction: column; flex: 1; min-height: 0; }
#sagePanel .sg-hist { display: none; position: static; max-height: none; }
/* Chat history: a glass drawer over the chat, closed by its × or a tap outside (sage-mode.js). */
#sagePanel[data-hist] .sg-hist { position: fixed; z-index: 30; inset-block: 0; inset-inline-start: 0; display: flex; width: min(86vw, 340px); padding: calc(14px + var(--sat, 0px)) 14px calc(14px + var(--sab, 0px));
  overflow-y: auto; background: color-mix(in srgb, var(--panel, #fff) 90%, transparent); backdrop-filter: blur(18px); box-shadow: 0 0 40px #0008; }
#sagePanel[data-hist] .sg-dim { display: block; position: fixed; z-index: 29; inset: 0; background: #0009; }
#sagePanel .sg-hclose { display: block; align-self: flex-end; } /* its look: close-x.css */
/* Sage, option 3: the body fills the screen behind a glass chat; its tools step aside. */
.app.app.app.app.sage > .stage { position: fixed; inset: 0; z-index: 0; height: 100svh; min-height: 0; margin: 0; }
.app.sage:not(:has(#sagePanel[data-mini])) .stage :is(.tools, .shr, .turn-btn, .reset-btn, .threads-btn) { display: none; }
.app.sage > aside:not([class]):not(:has(#sagePanel[data-mini])) { position: fixed; z-index: 2; inset: 0; display: flex; flex-direction: column; overflow-y: auto; padding: calc(60px + var(--sat, 0px)) 14px calc(6px + var(--sab, 0px)); border: 0;
  background: linear-gradient(color-mix(in srgb, var(--bg) 62%, transparent), color-mix(in srgb, var(--bg) 30%, transparent) 42%, color-mix(in srgb, var(--bg) 84%, transparent)); }
.app.sage > aside:not([class]):has(#sagePanel[data-hist]) { z-index: 40; } /* above the top bar while the history drawer is open */
.app.sage > aside:not([class]) > .legal { display: none; } /* the question box already says it is a study aid */
.app.sage > aside:not([class]):not(:has(#sagePanel[data-mini])) > #sagePanel { flex: 1; display: flex; flex-direction: column; min-height: 0; max-width: none; }
.app.sage #sagePanel .sg-wrap { flex: 1; min-height: 0; }
.app.sage #sagePanel .sg-reply { padding: 12px 14px; border: 1px solid var(--line); border-radius: 20px; background: var(--d-glass, color-mix(in srgb, var(--panel, #fff) 82%, transparent)); backdrop-filter: blur(12px); }
.app.sage #sagePanel .sg-chip { background: var(--d-glass, color-mix(in srgb, var(--panel, #fff) 82%, transparent)); backdrop-filter: blur(10px); }
.app.sage #sagePanel .sg-ask { margin-inline: -14px; padding-inline: 14px; background: linear-gradient(transparent, color-mix(in srgb, var(--bg) 80%, transparent) 30%); }
.app.sage #sagePanel .sg-histbtn { background: var(--d-glass, color-mix(in srgb, var(--panel, #fff) 82%, transparent)); backdrop-filter: blur(10px); }
#sagePanel .sg-histbtn { display: block; align-self: flex-start; min-height: 36px; margin-bottom: 8px; padding: 0 12px; border: 1px solid var(--line); border-radius: 999px; background: none; color: var(--ink); font: 600 13px "Plus Jakarta Sans", Heebo, system-ui, sans-serif; cursor: pointer; }

/* Share: frameless at the foot of the stage on the tools' side, kept above the sheets (phone-pill.js sets --shr-b). */
.stage > .shr, .app.mer .stage:not(:has(.flow-in)) > .shr { top: auto; bottom: var(--shr-b, 12px); inset-inline-end: 8px; transition: bottom .2s; }
.stage > .shr .shr-btn { border: 0; background: none; box-shadow: none; backdrop-filter: none; color: #fff; filter: drop-shadow(0 1px 3px #000c); }
.stage > .shr .shr-menu { top: auto; bottom: 0; }
.stage > .shr.shr-away, .stage:has(.flow-in) > .shr { display: none; }
/* Meridians: the search magnifier is last in the tool column (body-tools.css); the sheet drops its own field. */
.app.mer .stage:not(:has(.flow-in)) > .mfind-btn { top: 258px; inset-inline-end: 10px; }
.app.mer .stage:not(:has(.flow-in)) > .mfind { top: 258px; inset-inline-end: 62px; width: min(300px, calc(100% - 80px)); }
#merPanel.mer-idle .psearch { display: none; }

/* A folded point card opens again from a tap on its code or name (explorer.js). */
.pfloat.pf-min .pf-head :is(b, span), .pfloat .pf-head > b { cursor: pointer; }
/* Learn the basics: a lesson's sticky header sits under the bar while it shows, at the very top once it slides away. */
#learnPanel .lhead { top: var(--sat, 0px); }
:root:not(.bar-away) #learnPanel .lhead { top: calc(60px + var(--sat, 0px)); box-shadow: 0 calc(-60px - var(--sat, 0px)) 0 var(--panel); } /* the shadow fills the see-through bar's band, so text does not scroll by behind it */

/* Treatment rows: tags under the text, so the text gets the width; an opened "Why?" runs the full row. */
#casePanel .rec:not(.added) { grid-template-columns: 56px 1fr; align-items: start; }
#casePanel .rec:not(.added) > .pt { grid-row: span 2; align-self: start; line-height: 1.2; }
#casePanel .rec:not(.added) > .tags { grid-column: 2; justify-content: flex-start; }
#casePanel .rec .why[open] { margin-inline-start: -66px; font-size: 14px; line-height: 1.45; color: var(--ink); }
#casePanel .rec .why summary { padding: 6px 0; font-size: 14px; }
/* Cautions and system tags readable at arm's length. */
#casePanel .flag { display: inline-block; font-size: 13px; padding: 3px 8px; }
#casePanel .tag { font-size: 12px; }
/* Optional points: a finger-sized button. */
#casePanel .boost .opt { min-width: 48px; min-height: 40px; padding: 0 10px; border: 1px solid currentColor; border-radius: 9px; vertical-align: middle; }
/* The Matrix table's key. */
#casePanel .mx { margin-bottom: 4px; }
#casePanel .mx thead th { font-size: 12px; }
#casePanel .mx-key { display: block; margin: 0 0 14px; font-size: 14px; line-height: 1.45; color: var(--muted); }
#casePanel .mx-key summary { padding: 8px 0; color: var(--accent, #4f5bd5); cursor: pointer; }
#casePanel .mx-key p { margin: 4px 0; }
#casePanel .mx-key ul { margin: 4px 0; padding-inline-start: 18px; }
#casePanel .mx-key b { font-family: "JetBrains Mono", ui-monospace, monospace; }


/* The channels in two rows, all in view: each yin channel above its yang partner (LU over LI, SP over ST …), the two
   vessels last; the pregnancy toggle on a row of its own, with clear and fold beside it. */
.mclock { flex-wrap: wrap; row-gap: 8px; padding-inline-start: 12px; }
.mclock > .rail { flex: 1 0 100%; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); justify-items: center; row-gap: 8px; overflow: visible;
  padding: 2px 0; mask-image: none; }
[dir="rtl"] .mclock > .rail { mask-image: none; }
.mclock > .rail > .preg-t { grid-column: 1 / -1; justify-self: start; height: 32px; }
/* "Hide meridians" (Meridians tab, nothing picked) shares the pregnancy toggle's row. */
.mclock > .rail:has(> [data-mer="threads"]:not([hidden])) > .preg-t { grid-column: 1 / 4; }
.mclock > .rail > [data-mer="threads"] { order: 16; grid-column: 4 / -1; justify-self: start; display: flex; align-items: center; gap: 6px; width: auto;
  height: 32px; min-height: 0; margin: 0; padding: 0 12px; border-radius: 999px; background: #141a30cc; color: #f2f4fb; font-size: 12px; white-space: nowrap; }
.mclock > :is(.mc-proxy, .mc-fold) { position: absolute; bottom: 0; }
.mclock > .mc-fold { inset-inline-end: 12px; }
.mclock > .mc-proxy { inset-inline-end: 60px; }
.mclock > .rail [data-mer="LU"] { order: 1; } .mclock > .rail [data-mer="SP"] { order: 2; } .mclock > .rail [data-mer="HT"] { order: 3; }
.mclock > .rail [data-mer="KI"] { order: 4; } .mclock > .rail [data-mer="PC"] { order: 5; } .mclock > .rail [data-mer="LR"] { order: 6; }
.mclock > .rail [data-mer="CV"] { order: 7; } .mclock > .rail [data-mer="LI"] { order: 8; } .mclock > .rail [data-mer="ST"] { order: 9; }
.mclock > .rail [data-mer="SI"] { order: 10; } .mclock > .rail [data-mer="BL"] { order: 11; } .mclock > .rail [data-mer="TW"] { order: 12; }
.mclock > .rail [data-mer="GB"] { order: 13; } .mclock > .rail [data-mer="GV"] { order: 14; } .mclock > .rail > .preg-t { order: 15; }

/* The channels float over the body, no sheet around them: the circles alone, always there (a point's card still takes
   their place). The channel's name, notes and Sources are not shown on phones; its points are the rail (phone-rail.js). */
.app.app.mer > aside:has(> #merPanel:not([hidden])) { background: none; border: 0; box-shadow: none; backdrop-filter: none; pointer-events: none;
  max-height: none !important; overflow: visible; padding-block: 0; }
.app.mer > aside:has(> #merPanel:not([hidden])) > :is(.mer-head, #merPanel, .legal) { display: none; }
.app.mer > aside:has(> #merPanel:not([hidden])) > .mclock { margin-block: 0; pointer-events: auto; }
.mclock > .mc-fold { display: none; }
.mclock > .rail button[style] { background: #141a30cc; box-shadow: 0 2px 8px #0008; }
.mclock > .rail button[style].on { background: var(--c); }
.mclock > .rail:has(button.on) button[style]:not(.on) { opacity: .8; }
.mclock > .rail > .preg-t { background: #141a30cc; }
.mclock > .mc-proxy { inset-inline-end: 12px; background: #141a30cc; }


/* The card's head is the code alone (its names are the card's first line); folded, it reads "SP11 More details" and a tap opens it. */
.stage > .pfloat .pf-head .pf-name { display: none; }
.stage > .pfloat .pf-head > b { flex: 1; }
.stage > .pfloat.pf-min .pf-head > b { flex: none; }
.stage > .pfloat.pf-min .pf-head .pf-more { display: block; flex: 1; min-width: 0; font-size: 14px; font-weight: 600; font-style: normal; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }

/* Wider than a phone (tablets, narrow desktop windows up to 1024px): the channel circles keep a phone's spread, centred. */
@media (min-width: 600px) { .mclock > .rail { max-width: 460px; margin-inline: auto; } }



