/* ===========================================================================
   BiblioMad — the look. Glass (the default) behaves like an Apple app
   (prompt-finition-apple.md): the books and their covers are the content,
   on a neutral ground; glass is only the functional layer above them — the
   sidebar, the header, the toast — never the content, never glass on glass.
   The suite's two rules still hold: the action is black (ice in dark mode),
   the ice accent is never clickable (it says "selected").
   The OOTB theme (ootb.css) overrides the same tokens under html[data-ui="ootb"].
   Checked on a Mac window and at 390 px (the block at the end).
   =========================================================================== */

/* --- Tokens: what a colour DOES, defined once, redefined for dark mode ------
   The names are the suite's (kit/design/DESIGN-SYSTEM.md §2): --bg/--bg2 the
   grounds, --txt…--txt4 the labels, --line/--line2 the separators; added:
   the elevated surface, four fills, the text styles. */
:root{
  /* grounds: the window, the content (a column), what rises above (sheet, dialog) */
  --bg:#f2f2f7; --bg2:#ffffff; --bg-elev:#ffffff;
  /* labels: 4.5:1 or more on white down to --txt3; --txt4 only for what is off */
  --txt:#1d1d1f; --txt2:#515154; --txt3:#6e6e73; --txt4:#aeaeb2;
  /* separators: see-through, and opaque */
  --line:rgba(60,60,67,.18); --line2:#c6c6c8;
  /* fills for controls, strongest to faintest */
  --fill1:rgba(120,120,128,.20); --fill2:rgba(120,120,128,.16); --fill3:rgba(120,120,128,.12); --fill4:rgba(120,120,128,.08);
  --bg3:var(--fill3); --bg4:var(--bg2);
  /* the action, and the state */
  --ink:#000; --ink-hover:#2a262a; --on-ink:#fff;
  --accent:#b0e3ff; --accent-line:#79cbf2; --ink-on-accent:#05121a;
  /* The ring of a chosen book (the user's wish): a metallic blue-grey, like
     brushed aluminium — a fine darker edge, a soft halo, a light on its top. */
  --chart:#3a6db5;   /* the statistics' one colour (validated against both surfaces) */
  --sel-line:#8c9aae; --sel-halo:rgba(120,138,162,.2); --sel-hi:rgba(255,255,255,.55); --sel-fill:rgba(120,138,162,.1);
  --red:#c23b3b;
  --read:rgba(63,158,111,.11); --read-strong:rgba(63,158,111,.18);
  --be:rgba(60,60,67,.17); --be-hi:rgba(255,255,255,.95); --be-lo:rgba(255,255,255,.5);
  /* glass: blur + saturation on a half-opaque fill, a bright top edge, two
     shadows (tight to anchor, wide for the air). --glass-solid when there is
     no blur (Reduce transparency, or an old browser). */
  --glass:rgba(250,250,252,.72); --glass-solid:#f9f9fb;
  --glass-edge:rgba(255,255,255,.7);
  --glass-hi:inset 0 1px 0 rgba(255,255,255,.9);
  --glass-shadow:0 1px 2px rgba(0,0,0,.06),0 8px 28px rgba(0,0,0,.07);
  --glass-shadow-lg:0 2px 6px rgba(0,0,0,.08),0 24px 64px rgba(0,0,0,.18);
  --blur:blur(20px) saturate(180%);
  --glass-thick:rgba(248,248,251,.62); --blur-thick:blur(34px) saturate(190%);
  /* content cards: two shadows too, never one grey cloud */
  --shadow:0 .5px 1px rgba(0,0,0,.07),0 4px 14px rgba(0,0,0,.05);
  --font:-apple-system,BlinkMacSystemFont,system-ui,'Helvetica Neue',Arial,sans-serif;
  --serif:'New York',ui-serif,Georgia,'Times New Roman',serif;
  /* The Apple text styles, in rem so the browser's text size is honoured
     (--u = one point; on an iPhone it follows Dynamic Type, see the end). */
  --u:calc(1rem / 16);
  --t-large:calc(34 * var(--u)); --t-title1:calc(28 * var(--u)); --t-title2:calc(22 * var(--u)); --t-title3:calc(20 * var(--u));
  --t-headline:calc(17 * var(--u)); --t-body:calc(17 * var(--u)); --t-callout:calc(16 * var(--u)); --t-subhead:calc(15 * var(--u));
  --t-footnote:calc(13 * var(--u)); --t-caption:calc(12 * var(--u)); --t-caption2:calc(11 * var(--u));
  /* shapes: a radius inside another = the outer one minus the gap between them */
  --r2:9px; --r3:14px; --r4:22px; --pill:999px;
  --fw:170px; --mini:22px;
  --ease:cubic-bezier(.2,.8,.2,1);
  /* the spring (core.js replaces these with the real curve where linear() exists) */
  --spring:var(--ease); --spring-t:.45s;
  --sat:env(safe-area-inset-top,0px); --sab:env(safe-area-inset-bottom,0px);
  --sal:env(safe-area-inset-left,0px); --sar:env(safe-area-inset-right,0px);
  --ground:var(--bg);
}
/* Dark is not an inversion: surfaces get lighter as they rise, borders do
   what shadows did, the accent is a little less saturated, white text is 96 %.
   On a Mac the ground is a very dark grey (the iPhone's is black, see the end). */
html[data-mode="dark"]{
  --bg:#161618; --bg2:#1f1f22; --bg-elev:#2a2a2e;
  --txt:rgba(255,255,255,.96); --txt2:rgba(235,235,245,.74); --txt3:rgba(235,235,245,.6); --txt4:rgba(235,235,245,.3);
  --line:rgba(84,84,88,.55); --line2:#3a3a3d;
  --fill1:rgba(120,120,128,.36); --fill2:rgba(120,120,128,.32); --fill3:rgba(120,120,128,.24); --fill4:rgba(120,120,128,.18);
  --ink:#a9d6ee; --ink-hover:#c4e4f5; --on-ink:#05121a;
  --accent:#a9d6ee; --accent-line:#6fb7da;
  --chart:#5b8fd9;
  --sel-line:#8593a8; --sel-halo:rgba(140,158,184,.22); --sel-hi:rgba(255,255,255,.12); --sel-fill:rgba(140,158,184,.12);
  --red:#ff9d94;
  --read:rgba(98,196,140,.14); --read-strong:rgba(98,196,140,.22);
  --be:rgba(255,255,255,.13); --be-hi:rgba(255,255,255,.2); --be-lo:rgba(255,255,255,.06);
  --glass:rgba(40,40,44,.72); --glass-solid:#2c2c30;
  --glass-thick:rgba(36,36,40,.62);
  --glass-edge:rgba(255,255,255,.08);
  --glass-hi:inset 0 1px 0 rgba(255,255,255,.1);
  --glass-shadow:0 0 0 .5px rgba(0,0,0,.6),0 8px 28px rgba(0,0,0,.35);
  --glass-shadow-lg:0 0 0 .5px rgba(0,0,0,.6),0 24px 64px rgba(0,0,0,.55);
  --shadow:0 0 0 .5px rgba(255,255,255,.06),0 4px 14px rgba(0,0,0,.25);
  color-scheme:dark;
}

*{box-sizing:border-box;margin:0;padding:0}
[hidden]{display:none!important}
html,body{height:100%}
body{font-family:var(--font);color:var(--txt);background:var(--ground);
  -webkit-font-smoothing:antialiased;font-size:var(--t-subhead);overflow:hidden;
  display:flex;height:100dvh;gap:12px;padding:calc(12px + var(--sat)) calc(12px + var(--sar)) calc(12px + var(--sab)) calc(12px + var(--sal));
  -webkit-tap-highlight-color:transparent}
button{font:inherit;color:inherit;background:none;border:0;cursor:pointer}
a{color:inherit}
input,textarea,select{font:inherit;color:var(--txt);background:var(--bg4);border:1px solid var(--line);
  border-radius:var(--r2);padding:8px 10px;outline:none;transition:border-color .15s,box-shadow .15s;min-width:0}
:is(input,textarea,select):focus{border-color:var(--accent-line);box-shadow:0 0 0 3px var(--accent)}
:is(button,a,[tabindex]):focus-visible{outline:3px solid var(--accent-line);outline-offset:2px}
.card:focus-visible{outline-offset:-2px}
.flow:focus-visible .fi.c .cv{outline:3px solid var(--accent-line);outline-offset:3px}
/* Pressed: the finger has no hover, so what it touches answers at once. */
:is(.card,.nav-i,.tg,.seg button,.link,.col-add-b,.chip button):active{background:var(--fill2)}
:is(.ibtn,.tabbar button,#toast button):active{opacity:.55}
.primary:active{transform:scale(.96)}
::placeholder{color:var(--txt3)}
/* The functional layer: glass. Only the bars and the toast wear it. */
.pane{background:var(--glass);-webkit-backdrop-filter:var(--blur);backdrop-filter:var(--blur);
  border:.5px solid var(--glass-edge);box-shadow:var(--glass-shadow),var(--glass-hi)}
/* What rises above the content (the sheet, a dialog): opaque. */
/* What rises above the content — the book's sheet, a dialog, the menu — is
   Liquid Glass too (the user's wish, 30/10): the books stay visible through
   it, blurred, as in iOS. A thicker glass than the bars so text stays easy to
   read; opaque under Reduce transparency (see the end). */
.surface{background:var(--glass-thick);-webkit-backdrop-filter:var(--blur-thick);backdrop-filter:var(--blur-thick);
  border:.5px solid var(--glass-edge);box-shadow:var(--glass-shadow-lg),var(--glass-hi)}
svg.i{width:18px;height:18px;stroke:currentColor;fill:none;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round;flex:none}
.muted{color:var(--txt3)}

/* Buttons: the action is black. */
.primary{background:var(--ink);color:var(--on-ink);padding:8px 16px;border-radius:var(--pill);font-weight:600;font-size:var(--t-footnote);
  display:inline-flex;align-items:center;justify-content:center;gap:6px;transition:background .15s,transform .15s;text-decoration:none;white-space:nowrap}
.primary svg.i{width:15px;height:15px;stroke-width:2}
.primary:hover{background:var(--ink-hover)}
.primary:active{transform:scale(.97)}
.ghost{padding:8px 16px;border-radius:var(--pill);border:1px solid var(--line2);font-weight:600;font-size:var(--t-footnote);color:var(--txt2);
  display:inline-flex;align-items:center;justify-content:center;gap:6px;text-decoration:none}
.ghost:hover{color:var(--txt);border-color:var(--txt3)}
.danger{color:var(--red)}
.wide{width:100%;padding:11px 16px;font-size:var(--t-subhead)}
.ibtn{width:34px;height:34px;border-radius:50%;display:grid;place-items:center;color:var(--txt2);transition:background .15s;flex:none}
.ibtn:hover{background:var(--bg3);color:var(--txt)}
.ibtn.sm{width:28px;height:28px}.ibtn.sm svg.i{width:15px;height:15px}
select.pill{padding:6px 28px 6px 12px;border-radius:var(--pill);font-size:var(--t-footnote);appearance:none;-webkit-appearance:none;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' fill='none' stroke='%239aa0ad' stroke-width='1.6'%3E%3Cpath d='m1 1 4 4 4-4'/%3E%3C/svg%3E");
  background-repeat:no-repeat;background-position:right 11px center}
select.pill:hover{border-color:var(--line2)}

/* --- Sidebar, like Music: the library above, my lists below --------------- */
.side{width:var(--sidew,224px);flex:0 0 var(--sidew,224px);border-radius:var(--r4);padding:18px 10px;display:flex;flex-direction:column;gap:2px;overflow:auto}
.name{font-size:var(--t-title3);font-weight:700;letter-spacing:-.015em;padding:0 10px 14px}
.nav-h{font-size:var(--t-caption);font-weight:600;color:var(--txt3);padding:14px 10px 6px}
.nav-i{display:flex;align-items:center;gap:10px;padding:7px 10px;border-radius:12px;font-size:var(--t-subhead);font-weight:500;color:var(--txt2);
  text-align:left;width:100%;transition:background .2s,color .2s;min-height:34px}
.nav-i:hover{background:var(--fill4);color:var(--txt)}
.nav-i.on{background:var(--fill2);color:var(--txt);font-weight:600}
.nav-i small{margin-left:auto;color:var(--txt3);font-weight:500;font-variant-numeric:tabular-nums}
.nav-i span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.nav-i input{flex:1;min-width:0;padding:3px 6px;font-size:var(--t-footnote)}
.nav-add{color:var(--txt3)}
/* The sidebar's right edge: pull it to widen the sidebar (double-click: back to normal). */
.side-rz{flex:0 0 0;position:relative;margin:0 -6px;z-index:6;cursor:col-resize;touch-action:none}
.side-rz i{position:absolute;top:30%;bottom:30%;left:-5px;width:10px}
.side-rz i::after{content:"";position:absolute;left:4px;top:50%;height:36px;margin-top:-18px;width:3px;border-radius:2px;background:var(--line2);opacity:0;transition:opacity .15s}
.side-rz:hover i::after,.side-rz:focus-visible i::after,body.resizing .side-rz i::after{opacity:1}
.nav-sec{display:contents}
.nav-foot{margin-top:auto;padding-top:14px;display:flex;gap:4px;align-items:center}

/* --- Main column ------------------------------------------------------------ */
.main{flex:1;min-width:0;display:flex;flex-direction:column;gap:10px}
.top{border-radius:26px;padding:9px 10px 9px 20px;display:flex;align-items:center;gap:10px;position:relative;z-index:5}
.top h1{font-size:var(--t-title3);font-weight:700;letter-spacing:-.015em;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0}
.top .sub{color:var(--txt3);font-size:var(--t-footnote);font-variant-numeric:tabular-nums;white-space:nowrap}
.grow{flex:1}
.search{width:200px;border-radius:var(--pill);padding-left:32px;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='none' stroke='%239aa0ad' stroke-width='1.8'%3E%3Ccircle cx='6' cy='6' r='4.5'/%3E%3Cpath d='m9.5 9.5 3.5 3.5'/%3E%3C/svg%3E");
  background-repeat:no-repeat;background-position:12px 50%}
#searchBtn{display:none}
.zoom{display:flex;align-items:center;gap:2px}
.zoom input{width:86px;padding:0;accent-color:var(--txt);border:0;background:none;box-shadow:none}
.stage-wrap{flex:1;min-height:0;display:flex;flex-direction:column;overflow:hidden}

/* --- Cover flow: the band above, the chosen column's books ------------------ */
.flow{position:relative;flex:none;height:calc(var(--fw)*1.5 + 96px);outline:none;user-select:none;-webkit-user-select:none;
  touch-action:pan-y;overflow:hidden;cursor:grab}
.flow.grab{cursor:grabbing}
.stage{position:absolute;inset:18px 0 0;perspective:1200px}
.fi{position:absolute;left:50%;top:0;width:var(--fw);margin-left:calc(var(--fw)/-2);transition:transform var(--spring-t) var(--spring),opacity .3s;
  transform-style:preserve-3d;will-change:transform}
.stage.still .fi{transition:none}
.fi .cv{-webkit-box-reflect:below 3px linear-gradient(transparent 72%,rgba(255,255,255,.22))}
.fi:not(.c) .cv{filter:brightness(.92)}
.flow-cap{position:absolute;left:12px;right:12px;bottom:14px;text-align:center;pointer-events:none}
/* Covers or spines: a small switch at the band's top right. */
.flow-mode{position:absolute;top:10px;right:14px;z-index:5;display:flex;padding:2px;border-radius:var(--pill);background:var(--glass-thick);-webkit-backdrop-filter:var(--blur-thick);backdrop-filter:var(--blur-thick);
  box-shadow:inset 0 0 0 .5px var(--be),0 4px 14px -4px rgba(0,0,0,.25)}
.flow-mode button{width:32px;height:28px;border-radius:var(--pill);display:grid;place-items:center;color:var(--txt3)}
.flow-mode button .i{width:17px;height:17px}
.flow-mode button[aria-checked="true"]{background:var(--bg-elev);color:var(--txt);box-shadow:0 1px 3px rgba(0,0,0,.12)}
/* The spines on their shelf. */
.flow.spines .stage{perspective:none}
.flow.spines .stage::after{content:"";position:absolute;left:-20px;right:-20px;top:calc(var(--fw)*1.5 + 2px);height:10px;border-radius:2px;
  background:linear-gradient(180deg,var(--fill2),var(--fill3));box-shadow:0 8px 14px -8px rgba(0,0,0,.35)}
.flow.spines .fi{height:calc(var(--fw)*1.5);display:flex;align-items:flex-end;transform-style:flat}
.sp{position:relative;width:100%;height:var(--sh);border-radius:3px 3px 2px 2px;background:var(--c);overflow:hidden;
  display:flex;flex-direction:column;align-items:center;justify-content:space-between;padding:10px 0 8px;color:#fff;
  box-shadow:inset 2px 0 3px rgba(255,255,255,.18),inset -3px 0 4px rgba(0,0,0,.22),0 1px 2px rgba(0,0,0,.25);
  background-image:linear-gradient(90deg,rgba(0,0,0,.12),rgba(255,255,255,.08) 30%,rgba(0,0,0,.08) 70%,rgba(0,0,0,.18))}
.sp-t,.sp-a{writing-mode:vertical-rl;transform:rotate(180deg);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;text-shadow:0 1px 1px rgba(0,0,0,.35)}
.sp-t{font-weight:700;font-size:12px;letter-spacing:.01em;max-height:72%;flex:0 1 auto}
.sp-a{font-size:10px;opacity:.85;max-height:24%}
.flow.spines .fi:not(.c) .sp{filter:brightness(.94)}
.flow.spines .fi.c .sp{box-shadow:inset 2px 0 3px rgba(255,255,255,.2),inset -3px 0 4px rgba(0,0,0,.22),0 10px 18px -6px rgba(0,0,0,.45)}
.flow-cap b{display:block;font-size:var(--t-subhead);font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.flow-cap span{color:var(--txt2);font-size:var(--t-footnote)}
.flow-cap .st{color:var(--txt3)}
/* The handle under the covers: a thin bar, visible on hover, pulled up or down. */
.flow-rz{flex:none;height:12px;margin:-6px 0 -6px;position:relative;z-index:3;cursor:row-resize;touch-action:none;display:grid;place-items:center}
.flow-rz i{width:44px;height:4px;border-radius:2px;background:var(--line2);opacity:.5;transition:opacity .15s}
.flow-rz:hover i,.flow-rz:focus-visible i,body.resizing-v .flow-rz i{opacity:1}
body.resizing-v,body.resizing-v *{cursor:row-resize!important;user-select:none!important}
body.flow-off .flow{display:none}
body.flow-off .flow-rz{margin:0 0 2px}
.flow-empty{position:absolute;inset:0;display:grid;place-items:center;color:var(--txt3);text-align:center;padding:20px}
.empty{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;color:var(--txt2)}
.empty svg.empty-i{width:40px;height:40px;stroke-width:1.4;color:var(--txt3);margin-bottom:4px}
.empty h2{font-size:var(--t-title3);font-weight:600;color:var(--txt);letter-spacing:-.01em}
.empty p{font-size:var(--t-subhead);max-width:34ch;line-height:1.4}
.empty .ghost{margin-top:8px}
/* While the library loads: the shape of what is coming, not a spinner. */
.sk{background:var(--fill3);border-radius:6px;animation:sk 1.2s ease-in-out infinite alternate}
@keyframes sk{to{opacity:.45}}
.sk-cover{position:absolute;top:0;left:50%;width:var(--fw);aspect-ratio:2/3;margin-left:calc(var(--fw)/-2);border-radius:4px 8px 8px 4px}
.sk-col{flex:0 0 236px;border-radius:var(--r3);background:var(--fill4);padding:12px 10px;display:flex;flex-direction:column;gap:12px}
.sk-row{display:flex;gap:8px;align-items:center}.sk-row i{width:var(--mini);aspect-ratio:2/3;flex:none}
.sk-row b{height:10px;flex:1;max-width:70%}

/* --- Covers: the scan when there is one, otherwise a drawn "poche" --------- */
.cv{position:relative;aspect-ratio:2/3;border-radius:4px 8px 8px 4px;overflow:hidden;background:#8a8f98;
  box-shadow:0 1px 2px rgba(0,0,0,.2),0 10px 22px rgba(0,0,0,.14);container-type:inline-size}
.cv img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover}
.cv .art{position:absolute;inset:0;display:flex;flex-direction:column;justify-content:space-between;padding:12% 10% 10%;color:#fff}
.cv::after{content:"";position:absolute;inset:0;pointer-events:none;
  background:linear-gradient(105deg,rgba(0,0,0,.18) 0 3%,rgba(255,255,255,.12) 3.5% 5%,transparent 9%),linear-gradient(180deg,rgba(255,255,255,.12),transparent 40%)}
.cv .a{font-size:7.5cqw;font-weight:500;opacity:.85;position:relative}
.cv .t{font-family:var(--serif);font-size:12cqw;line-height:1.08;font-weight:600;position:relative;letter-spacing:-.01em;overflow-wrap:anywhere}
.cv .p{font-size:5.6cqw;text-transform:uppercase;letter-spacing:.14em;opacity:.7;position:relative}
.cv .badge{position:absolute;z-index:1;top:6%;right:6%;font-size:max(9px,7cqw);font-weight:600;padding:.25em .7em;border-radius:var(--pill);
  background:rgba(255,255,255,.92);color:#1d1d1f;box-shadow:0 1px 2px rgba(0,0,0,.2)}
.cv:has(.badge) .a{padding-right:40%}
.cv.notmine{filter:saturate(.45) brightness(1.08)}

/* --- The columns below: compact; the chosen one feeds the flow ------------- */
#below{flex:1;min-height:0}
.board{display:flex;gap:10px;align-items:stretch;overflow-x:auto;height:100%;padding:6px 16px 16px;scroll-padding:0 16px;overscroll-behavior-x:contain}
.col{position:relative;flex:0 0 var(--colw,236px);min-width:0;display:flex;flex-direction:column;min-height:0;border-radius:var(--r3);padding:8px 6px 6px;cursor:pointer;
  background:var(--fill4);box-shadow:inset 0 0 0 .5px var(--line);transition:background .2s,box-shadow .2s}
/* The columns are see-through (the user's wish, 30/10): a faint fill on the
   ground, like the panels of Apple's apps; the chosen one a little stronger. */
.col:hover{background:var(--fill3)}
.col.on{background:var(--fill3);box-shadow:inset 0 0 0 1.5px var(--txt3)}
.col-h{display:flex;align-items:center;gap:4px;padding:0 2px 6px 6px;min-height:30px}
.col-h{padding-left:0}
.grip{cursor:grab;color:var(--txt3);padding:4px;font-size:15px;line-height:1;touch-action:none;user-select:none;-webkit-user-select:none}
.grip:hover{color:var(--txt)}
.col-h h3{font-size:var(--t-footnote);font-weight:600;flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.col-h input{flex:1;min-width:0;padding:3px 6px;font-size:var(--t-footnote)}
.col-h small{color:var(--txt3);font-size:var(--t-caption);font-variant-numeric:tabular-nums;margin-right:2px}
.col-h .ibtn{opacity:0;transition:opacity .15s}
.col:hover .col-h .ibtn,.col.on .col-h .ibtn{opacity:1}
.cards{display:flex;flex-direction:column;gap:1px;min-height:36px;flex:1;overflow-y:auto;overflow-x:hidden;border-radius:8px;overscroll-behavior-y:contain}
.card{display:flex;gap:8px;align-items:center;padding:3px 6px;border-radius:8px;text-align:left;width:100%;
  cursor:pointer;user-select:none;-webkit-user-select:none;-webkit-touch-callout:none;transition:background .15s}
.board.edit .card{cursor:grab}
.card{position:relative}
.card+.card::before{content:"";position:absolute;top:-1px;left:calc(var(--mini) + 14px);right:6px;height:1px;transform:scaleY(.5);background:var(--line);pointer-events:none}
:is(.card:hover,.card.sel,.card:focus-visible)::before,:is(.card:hover,.card.sel,.card:focus-visible)+.card::before{opacity:0}
.card:hover{background:var(--fill4)}
/* A book I have read: its row takes a soft green tint (the user's wish), the
   word "Lu" stays beside it — the colour is never the only sign. */
/* An author's group (the user's wish): a bubble a shade darker than the
   column, with a fine glass edge and light on its top; the author's name at
   its top, the books under it. Between a saga's volumes, no separator. */
.au-grp{margin:4px 0;padding:0 0 3px;border-radius:12px;background:var(--fill4);
  box-shadow:inset 0 0 0 .5px var(--be),inset 0 1px 0 var(--be-hi)}
.au-h{padding:7px 10px 3px;font-size:var(--t-caption);font-weight:600;color:var(--txt2);letter-spacing:.01em;
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.au-grp .card:hover{background:var(--fill3)}
.au-h{cursor:grab;touch-action:pan-y}
/* An author's section taken by its name: its place shrinks to a slot, and it
   travels as a small pile of covers. */
.au-grp.ph{opacity:1}
.au-grp.slot{background:var(--sel-fill);box-shadow:inset 0 0 0 1.5px var(--sel-line);min-height:34px}
.au-grp.slot>*{visibility:hidden}.au-grp.slot .card{display:none}
.au-pile{position:fixed;z-index:50;pointer-events:none;display:flex;align-items:center;gap:10px;padding:6px 14px 6px 6px;
  border-radius:14px;background:var(--glass-thick);-webkit-backdrop-filter:var(--blur-thick);backdrop-filter:var(--blur-thick);
  box-shadow:inset 0 0 0 .5px var(--be),0 12px 32px -8px rgba(0,0,0,.35)}
.au-pile .pile{width:58px;height:62px;flex:0 0 58px;margin:0}
.au-pile .pile .st{left:6px;top:4px;width:36px}
.au-pile b{display:block;font-size:var(--t-subhead);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.au-pile span{font-size:var(--t-caption);color:var(--txt3)}
.card.sg::before{opacity:0}
.card.read{background:var(--read)}
/* A book among several chosen (⌘ / ⇧-click). */
.card.picked,.card.picked.read{background:var(--sel-fill);box-shadow:inset 0 0 0 1.5px var(--sel-line),inset 0 2.5px 0 -1px var(--sel-hi)}
.card.picked::before,.card.picked+.card::before{opacity:0}
/* The sheet of several books: their covers in a loose pile. */
.pile{position:relative;width:118px;height:150px;flex:0 0 118px;margin-bottom:14px}
.pile .st{position:absolute;left:14px;top:6px;width:84px;transform:translate(var(--x),var(--y)) rotate(var(--r))}
.pile .st .cv{box-shadow:0 1px 2px rgba(0,0,0,.18),0 8px 18px -6px rgba(0,0,0,.25)}
.tg.mixed{border-style:dashed}
.mix{font-size:var(--t-caption);color:var(--txt3);font-weight:500;font-style:italic}
.card.read:hover{background:var(--read-strong)}
.card.read.sel{background:var(--read)}
.card.read::before,.card.read+.card::before{opacity:0}
/* The book in the middle of the flow: selected — a fine bluish ring around
   it, no fill (the user's wish: discreet, as in Apple's apps). */
.card.sel{box-shadow:inset 0 0 0 1.5px var(--sel-line),inset 0 2.5px 0 -1px var(--sel-hi),0 0 0 3px var(--sel-halo)}
.card .cv{width:var(--mini);flex:0 0 var(--mini);border-radius:2px 4px 4px 2px;box-shadow:0 1px 3px rgba(15,23,42,.2)}
.card .cv .art,.card .cv .badge{display:none}
.card>div{min-width:0}
.card b{display:block;font-size:var(--t-footnote);font-weight:600;line-height:1.3;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.card span{display:block;font-size:var(--t-caption2);color:var(--txt2);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.eye{width:1.25em;height:1.25em;vertical-align:-.28em;stroke:currentColor;fill:none;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}
.card .ok{display:flex;align-items:center;gap:5px}
.card .ok .eye{width:16px;height:16px;color:var(--txt2);display:block}
/* The favourite's star: filled, warm and small — the one touch of gold. */
.eye.star{fill:#e8a735;stroke:#d4911c;stroke-width:1.2}
.card .ok .eye.star{width:14px;height:14px}
.tg-fav{display:inline-flex;align-items:center;gap:5px}
.tg-fav .eye.star{width:15px;height:15px;fill:none;stroke:currentColor;stroke-width:1.6}
.tg-fav.on .eye.star{fill:#e8a735;stroke:#d4911c}
.card.sel .ok .eye{color:var(--txt2)}
.cv .badge.eye-b{padding:.3em .45em;line-height:0}
.cv .badge.eye-b .eye{width:max(10px,9cqw);height:max(10px,9cqw);vertical-align:0}
.card .ok{margin-left:auto;color:var(--txt3);font-size:var(--t-caption2);font-weight:600;white-space:nowrap;flex:none}
.col-rz{position:absolute;top:10px;bottom:10px;right:-8px;width:10px;cursor:col-resize;z-index:2;touch-action:none}
.col-rz::after{content:"";position:absolute;top:50%;left:4px;width:3px;height:28px;margin-top:-14px;border-radius:2px;background:var(--line2);opacity:0;transition:opacity .15s}
.col:hover .col-rz::after,.col-rz.on::after{opacity:1}
body.resizing,body.resizing *{cursor:col-resize!important;user-select:none!important}
.col-add-b{color:var(--txt3);font-size:var(--t-footnote);font-weight:600;padding:8px 6px 2px;text-align:left;width:100%}
.col-add-b:hover{color:var(--txt)}
.col-new{flex:0 0 200px;height:46px;align-self:flex-start;border-radius:var(--r3);border:1.5px dashed var(--line2);color:var(--txt2);font-weight:600;font-size:var(--t-footnote)}
.col-new:hover{color:var(--txt);border-color:var(--txt3)}
.board-empty{margin:30px auto;max-width:360px;text-align:center;color:var(--txt2);line-height:1.5}
.ph{opacity:.28}
/* A view that appears: every book rises in, one after the other down each
   column, 25 ms apart (all of them — the user's wish: none may sit still). */
.board.enter .card{animation:rise var(--spring-t) var(--spring) both;animation-delay:calc(var(--i,0) * 25ms)}
@keyframes rise{from{opacity:0;transform:translateY(8px)}}
/* A drop target under a dragged book: a shelf or a list of the sidebar, a
   book under an image from the Finder. Ice: it is a state ("ready"). */
.nav-i.drop{background:var(--accent);color:var(--ink-on-accent);box-shadow:0 0 0 2px var(--accent-line)}
.drop-cover{outline:3px solid var(--accent-line);outline-offset:2px;border-radius:8px}
/* The book's menu (right-click, long press): glass, it floats over the content. */
.menu{position:fixed;z-index:45;min-width:220px;max-width:min(300px,calc(100vw - 24px));padding:6px;border-radius:14px;overflow:auto;
  display:none;flex-direction:column;overscroll-behavior:contain}
.menu.on{display:flex}
.menu button{display:flex;align-items:center;gap:6px;padding:6px 10px 6px 4px;border-radius:8px;text-align:left;font-size:var(--t-footnote);min-height:28px}
/* Hover only with a mouse: under a finger it would stick. */
@media (hover:hover){.menu button:hover{background:var(--accent);color:var(--ink-on-accent)}.menu .danger:hover{background:var(--red);color:#fff}}
.menu button:focus-visible{background:var(--accent);color:var(--ink-on-accent);outline:none}
.menu .ck{width:16px;text-align:center;flex:none;font-weight:600}
.menu .danger{color:var(--red)}
.menu .danger:focus-visible{background:var(--red);color:#fff}
.menu hr{border:0;height:.5px;background:var(--line);margin:5px 10px}
.menu-h{font-size:var(--t-caption2);font-weight:600;color:var(--txt3);padding:4px 10px 2px 26px}
/* The cover that flies between the shelf and the sheet. */
.fly{position:fixed;z-index:11;margin:0;pointer-events:none;transform-origin:0 0}
/* Lifted: a little bigger, a wider and softer shadow in two layers, opaque. */
.drag-ghost{position:fixed;z-index:50;pointer-events:none;margin:0;transform:scale(1.04);opacity:.97;
  box-shadow:0 2px 6px rgba(0,0,0,.12),0 18px 44px rgba(0,0,0,.2)!important;transition:none}
.drag-ghost.landing{transform:none;box-shadow:0 1px 3px rgba(0,0,0,.1)!important;transition:box-shadow var(--spring-t) var(--spring)}
.drag-ghost.card{background:var(--bg-elev)}
.lifting{animation:lift .25s var(--ease)}
@keyframes lift{50%{transform:scale(1.04)}}
body.dragging,body.dragging *{cursor:grabbing!important}

/* --- The book sheet: from the right on a computer, from below on a phone --- */
.veil{position:fixed;inset:0;background:rgba(0,0,0,.18);opacity:0;pointer-events:none;transition:opacity .35s var(--ease);z-index:9}
.veil.on{opacity:1;pointer-events:auto}
@media (min-width:761px){.veil{display:none}}
.sheet{position:fixed;top:calc(12px + var(--sat));right:calc(12px + var(--sar));bottom:calc(12px + var(--sab));width:min(420px,calc(100vw - 24px));border-radius:var(--r4);
  z-index:10;transform:translateX(calc(100% + 40px));transition:transform var(--spring-t) var(--spring);
  display:flex;flex-direction:column;overflow:hidden}
.sheet.on{transform:none}
/* The cover's colour washing down from the top of the sheet. */
.sheet::before{content:"";position:absolute;inset:0 0 auto;height:420px;pointer-events:none;opacity:0;
  background:linear-gradient(180deg,color-mix(in srgb,var(--tint,transparent) 42%,transparent),color-mix(in srgb,var(--tint,transparent) 12%,transparent) 55%,transparent);
  transition:opacity .45s var(--ease)}
.sheet.tinted::before{opacity:1}
html[data-mode="dark"] .sheet::before{background:linear-gradient(180deg,color-mix(in srgb,var(--tint,transparent) 30%,transparent),transparent)}
.sheet>*{position:relative}
/* The sheet open on a computer: room on the right, so every column can slide
   out from under it. */
@media (min-width:761px){body.sheet-open .board{padding-right:calc(min(420px,100vw - 24px) + 28px)}}
.sh-grab{display:none}
.sh-top{display:flex;justify-content:flex-end;padding:10px 10px 0}
.sh-body{overflow:auto;padding:0 24px 28px;overscroll-behavior:contain}
.sh-head{display:flex;gap:18px;align-items:flex-end;margin-bottom:6px}
/* The book in its sheet: standing straight, with a soft shadow in two layers
   (one close, one wide and low) so it reads as an object with some thickness. */
.sh-head .cv{width:104px;flex:0 0 104px;
  box-shadow:0 1px 2px rgba(0,0,0,.16),0 6px 14px -4px rgba(0,0,0,.18),0 18px 32px -12px rgba(0,0,0,.22)}
.sh-head h3{font-size:var(--t-title2);line-height:1.15;letter-spacing:-.015em;font-weight:700}
.sh-head p{color:var(--txt2);margin-top:4px}
/* A book's quotes: a thin rule on the left, the page beneath. */
.quote{margin:4px 0 12px;padding:2px 0 2px 14px;border-left:2px solid var(--line2)}
.quote blockquote{font-family:ui-serif,Georgia,"Times New Roman",serif;font-size:var(--t-callout);line-height:1.5;color:var(--txt);white-space:pre-line}
.quote figcaption{display:flex;gap:12px;align-items:baseline;margin-top:4px;color:var(--txt3);font-size:var(--t-footnote)}
.tg .i{width:16px;height:16px;vertical-align:-3px;margin-right:4px}
#q-text{width:100%;min-height:140px;font-family:ui-serif,Georgia,serif;font-size:var(--t-callout);line-height:1.5}
.q-row{display:flex;align-items:center;gap:10px;margin-top:10px;flex-wrap:wrap}
.q-row #q-page{width:80px}
.q-row .ghost .i{width:16px;height:16px;vertical-align:-3px}
.q-photo{margin-bottom:12px}
.q-help{color:var(--txt2);font-size:var(--t-footnote);margin-bottom:6px}
.q-stage{position:relative;touch-action:none;cursor:crosshair;border-radius:10px;overflow:hidden;line-height:0}
.q-stage canvas{width:100%;height:auto;display:block}
.q-sel{position:absolute;border:2px solid var(--sel-line);background:color-mix(in srgb,var(--sel-line) 18%,transparent);border-radius:4px;box-shadow:0 0 0 999px rgba(0,0,0,.35)}
.q-prog{color:var(--txt2);font-size:var(--t-footnote)}
/* Offline: a pill at the top, the page read-only. */
.off-pill{position:fixed;top:calc(10px + var(--sat));left:50%;transform:translate(-50%,-150%);z-index:60;padding:8px 16px;border-radius:var(--pill);
  font-size:var(--t-footnote);font-weight:600;color:var(--txt);transition:transform var(--spring-t) var(--spring);pointer-events:none;white-space:nowrap}
body.offline .off-pill{transform:translate(-50%,0)}
/* For VoiceOver only: said, not shown. */
.sr-only{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
.au-h:focus-visible{outline:2px solid var(--accent-line);outline-offset:-2px;border-radius:10px}
/* Statistiques: tiles, the months, what I read most, my year. */
.st-years{margin-bottom:14px;flex-wrap:wrap}
.st-tiles{display:grid;grid-template-columns:repeat(auto-fit,minmax(120px,1fr));gap:10px}
.st-tile{padding:14px;border-radius:14px;background:var(--fill4);box-shadow:inset 0 0 0 .5px var(--be);display:flex;flex-direction:column;gap:2px}
.st-tile span{color:var(--txt2);font-size:var(--t-footnote)}
.st-tile b{font-size:28px;font-weight:700;letter-spacing:-.02em;font-variant-numeric:tabular-nums;color:var(--txt)}
.st-tile small{color:var(--txt3);font-size:var(--t-caption)}
.st-goal{flex-direction:row;align-items:center;gap:10px}
.st-goal>div{display:flex;flex-direction:column;gap:2px;min-width:0}
.st-goal svg{width:44px;height:44px;flex:none;transform:rotate(-90deg)}
.st-goal circle{fill:none;stroke:var(--fill2);stroke-width:5}
.st-goal circle.on{stroke:var(--chart);stroke-linecap:round;transition:stroke-dasharray .6s var(--ease)}
.st-gl{color:var(--txt3);font-size:var(--t-caption)}
.st-gl input{width:56px;padding:2px 6px;font-size:var(--t-footnote);min-height:0}
.st-cols{display:flex;align-items:flex-end;gap:6px;height:170px;padding-top:18px;border-bottom:1px solid var(--line)}
.st-c{flex:1;height:100%;display:flex;flex-direction:column;justify-content:flex-end;align-items:center;position:relative;outline:none;cursor:default}
.st-c i{display:block;width:min(70%,34px);background:var(--chart);border-radius:4px 4px 0 0;min-height:0;transition:height .5s var(--ease)}
.st-c:hover i,.st-c:focus-visible i{filter:brightness(1.12)}
.st-c:focus-visible{box-shadow:0 0 0 2px var(--accent-line);border-radius:6px}
.st-c small{position:absolute;bottom:-20px;font-size:var(--t-caption);color:var(--txt3);white-space:nowrap}
.st-v{font-size:var(--t-caption);color:var(--txt2);font-variant-numeric:tabular-nums;margin-bottom:3px}
.st-cols+.st-two{margin-top:30px}
.st-two{display:grid;grid-template-columns:1fr 1fr;gap:6px 28px}
.st-rank{display:flex;flex-direction:column;gap:6px}
.st-r{display:grid;grid-template-columns:minmax(0,9em) 1fr 2.2em;gap:8px;align-items:center;font-size:var(--t-footnote)}
.st-k{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:var(--txt2)}
.st-bar{height:10px;border-radius:0 4px 4px 0;background:var(--fill4)}
.st-bar i{display:block;height:100%;background:var(--chart);border-radius:0 4px 4px 0}
.st-r b{text-align:right;font-variant-numeric:tabular-nums;color:var(--txt)}
.st-recap{display:grid;grid-template-columns:1.4fr 1fr;gap:18px;align-items:start}
.st-mosaic{display:grid;grid-template-columns:repeat(auto-fill,minmax(46px,1fr));gap:6px}
.st-m{padding:0;border-radius:3px;line-height:0}.st-m .cv{border-radius:2px 4px 4px 2px;box-shadow:0 1px 3px rgba(0,0,0,.2)}
.st-m .cv .art,.st-m .cv .badge{display:none}
.st-facts{display:flex;flex-direction:column;gap:10px}
.st-facts span{display:block;color:var(--txt3);font-size:var(--t-caption)}.st-facts b{font-size:var(--t-footnote)}
.st-facts small{color:var(--txt2);font-weight:400}
#statsModal .modal-b{position:relative}
.st-tip{position:absolute;z-index:3;max-width:280px;padding:7px 10px;border-radius:9px;background:var(--ink);color:var(--on-ink);font-size:var(--t-caption);pointer-events:none;box-shadow:0 6px 18px -6px rgba(0,0,0,.4)}
@media (max-width:760px){.st-two,.st-recap{grid-template-columns:1fr}.st-cols{gap:3px}.st-c small{font-size:9px}}
/* Exporter et sauvegarder: four big choices, then the weekly e-mail. */
.ex-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.ex{display:flex;flex-direction:column;align-items:flex-start;gap:3px;padding:14px;border-radius:14px;background:var(--fill4);
  box-shadow:inset 0 0 0 .5px var(--be);text-align:left;color:var(--txt);text-decoration:none;min-height:44px}
.ex:hover{background:var(--fill3)}
.ex .i{width:22px;height:22px;margin-bottom:4px;color:var(--txt2)}
.ex b{font-size:var(--t-callout)}.ex span{color:var(--txt2);font-size:var(--t-footnote)}
.ex-h{font-size:var(--t-callout);margin:18px 0 4px}
#ex-mail{flex:1;min-width:180px}
.ex-rows{display:flex;flex-direction:column;gap:4px;margin:8px 0;font-size:var(--t-footnote)}.ex-rows span{color:var(--txt2)}
.set-line .ghost .i{width:16px;height:16px;vertical-align:-3px}
@media (max-width:760px){.ex-grid{grid-template-columns:1fr}}
/* Paramètres › Doublons: the two sheets side by side. */
.dup{display:grid;grid-template-columns:1fr 1fr;gap:10px;padding:10px 0 12px;border-bottom:.5px solid var(--line)}
.dup>.link{grid-column:1/-1;justify-self:start}
.dup-b{display:flex;gap:10px;align-items:flex-start;min-width:0}
.dup-b .cv{width:44px;flex:0 0 44px;border-radius:2px 4px 4px 2px}
.dup-b .cv .art,.dup-b .cv .badge{display:none}
.dup-b>div{min-width:0;display:flex;flex-direction:column;gap:2px}
.dup-b b{font-size:var(--t-subhead)}.dup-b span,.dup-b small{color:var(--txt2);font-size:var(--t-footnote)}
.dup-b .ghost{align-self:flex-start;margin-top:4px}
@media (max-width:760px){.dup{grid-template-columns:1fr}}
/* "Je l'ai déjà ?" after a scan: mine (green), read, advised, or not yet. */
.have{display:flex;align-items:center;gap:12px;margin:2px 0 10px;padding:12px 14px;border-radius:14px;background:var(--fill4);
  box-shadow:inset 0 0 0 .5px var(--be),0 4px 14px -4px rgba(0,0,0,.25)}
.have>svg{width:26px;height:26px;flex:none;color:var(--txt2);fill:none;stroke:currentColor;stroke-width:1.6}
.have div{flex:1;min-width:0}.have b{display:block;font-size:var(--t-callout)}
.have span{display:block;color:var(--txt2);font-size:var(--t-footnote);margin-top:2px}
.have.own{background:var(--read)}.have.own>svg{color:#2f7d57}
.have.adv>svg{color:#c2416b}
.have .ghost.sm{flex:none}
/* A scanned pile: a tick per book. */
.pile-row{cursor:pointer}.pile-row input{width:20px;height:20px;flex:none;accent-color:var(--ink);margin:0 4px 0 2px}
.pile-row.none{opacity:.6}
.pile-own{display:flex;align-items:center;gap:4px;color:#2f7d57!important}.pile-own svg{width:14px;height:14px}
/* "Scanner" in Ajouter: the camera reads the barcode. */
.scan-b{margin-left:auto;align-self:center;display:inline-flex;align-items:center;gap:6px;padding:8px 14px;border-radius:var(--pill);
  background:var(--fill3);color:var(--txt);font-weight:600;font-size:var(--t-footnote);min-height:36px}
.scan-b:hover{background:var(--fill2)}
.scan-b .i{width:20px;height:20px}
/* The scanner: the camera full screen behind a dark veil, a frame where the
   barcode goes, a line that sweeps it; green when an ISBN is read. */
.scan{position:fixed;inset:0;z-index:90;display:grid;place-items:center;background:rgba(0,0,0,.72);opacity:0;transition:opacity .25s var(--ease)}
.scan.on{opacity:1}
.scan-box{position:relative;width:min(560px,92vw);aspect-ratio:4/3;border-radius:22px;overflow:hidden;background:#000;
  box-shadow:0 30px 80px -20px rgba(0,0,0,.6);transform:scale(.96);transition:transform var(--spring-t) var(--spring)}
.scan.on .scan-box{transform:none}
.scan video{width:100%;height:100%;object-fit:cover;display:block}
.scan-frame{position:absolute;left:12%;right:12%;top:30%;bottom:30%;border-radius:14px;box-shadow:0 0 0 2px rgba(255,255,255,.9),0 0 0 999px rgba(0,0,0,.35);overflow:hidden}
.scan-frame i{position:absolute;left:6%;right:6%;top:50%;height:2px;background:#ff5a4f;box-shadow:0 0 12px #ff5a4f;animation:sweep 1.6s ease-in-out infinite alternate}
@keyframes sweep{from{top:12%}to{top:88%}}
.scan.got .scan-frame{box-shadow:0 0 0 3px #34c759,0 0 0 999px rgba(0,0,0,.35)}
.scan.got .scan-frame i,.scan.err .scan-frame i{display:none}
.scan .scan-x{position:absolute;top:10px;right:10px;background:rgba(0,0,0,.45);color:#fff;border-radius:50%}
.scan-tip{position:absolute;left:0;right:0;bottom:14px;text-align:center;color:#fff;font-weight:600;font-size:var(--t-subhead);text-shadow:0 1px 3px rgba(0,0,0,.6);padding:0 16px}
.scan-mode{position:absolute;top:10px;left:10px;display:flex;padding:2px;border-radius:var(--pill);background:rgba(0,0,0,.45);
  -webkit-backdrop-filter:blur(12px);backdrop-filter:blur(12px)}
.scan-mode button{padding:7px 13px;border-radius:var(--pill);color:rgba(255,255,255,.8);font-weight:600;font-size:var(--t-footnote);min-height:32px}
.scan-mode button[aria-checked="true"]{background:rgba(255,255,255,.92);color:#111}
.scan-tray{position:absolute;left:10px;right:10px;bottom:10px;display:flex;align-items:center;gap:12px;padding:10px 10px 10px 16px;border-radius:16px;
  background:rgba(20,20,22,.72);-webkit-backdrop-filter:blur(16px);backdrop-filter:blur(16px);color:#fff}
.scan-tray div{flex:1;min-width:0}.scan-tray b{display:block}.scan-tray span{display:block;font-size:var(--t-footnote);opacity:.75;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.scan-tray .primary{background:#fff;color:#111}
.scan:has(.scan-tray:not([hidden])) .scan-tip{bottom:84px}
.scan.flash .scan-frame{animation:flash .5s ease-out}
@keyframes flash{0%{box-shadow:0 0 0 4px #34c759,0 0 0 999px rgba(52,199,89,.35)}100%{box-shadow:0 0 0 2px rgba(255,255,255,.9),0 0 0 999px rgba(0,0,0,.35)}}
@media (prefers-reduced-motion:reduce){.scan-frame i,.scan.flash .scan-frame{animation:none}.scan,.scan-box{transition:none}}
@media (max-width:760px){
  .scan{background:#000}
  .scan-box{width:100vw;height:100dvh;aspect-ratio:auto;border-radius:0}
  .scan-frame{left:8%;right:8%;top:38%;bottom:38%}
  .scan .scan-x{top:calc(env(safe-area-inset-top) + 10px);width:44px;height:44px}
  .scan-tip{bottom:calc(env(safe-area-inset-bottom) + 28px)}
  .scan .scan-mode{top:calc(env(safe-area-inset-top) + 10px)}
  .scan-tray{bottom:calc(env(safe-area-inset-bottom) + 14px)}
  .scan:has(.scan-tray:not([hidden])) .scan-tip{bottom:calc(env(safe-area-inset-bottom) + 92px)}
}
.sh-head .ed{color:var(--txt3);font-size:var(--t-footnote);margin-top:6px}
.sec{margin-top:20px}
.lab{font-size:var(--t-caption);font-weight:600;color:var(--txt2);margin-bottom:8px;display:block}
.toggles{display:flex;gap:6px;flex-wrap:wrap}
.tg{padding:7px 13px;border-radius:var(--pill);border:1px solid var(--line2);font-size:var(--t-footnote);font-weight:500;color:var(--txt2);transition:background .2s var(--ease),color .2s var(--ease),border-color .2s var(--ease);min-height:34px}
.tg:hover{border-color:var(--txt3);color:var(--txt)}
.tg.on{background:var(--accent);color:var(--ink-on-accent);border-color:transparent;font-weight:600}
.dates{display:flex;flex-direction:column;gap:6px}
.date{display:flex;align-items:center;gap:6px}.date input{flex:1}
.link{color:var(--txt2);font-weight:600;font-size:var(--t-footnote);padding:6px 0;text-align:left}
.link:hover{color:var(--txt)}
.chips{display:flex;gap:6px;flex-wrap:wrap;align-items:center}
.chip{font-size:var(--t-caption);padding:4px 6px 4px 10px;border-radius:var(--pill);background:var(--bg3);color:var(--txt2);display:inline-flex;align-items:center;gap:2px}
.chip button{width:20px;height:20px;border-radius:50%;color:var(--txt3);line-height:1}
.chip button:hover{color:var(--txt);background:var(--bg3)}
.chips select,.chips input{padding:4px 24px 4px 10px;font-size:var(--t-caption);border-radius:var(--pill)}
.chips input{padding-right:10px;width:130px}
textarea{width:100%;min-height:84px;resize:vertical;line-height:1.45}
.facts{display:grid;grid-template-columns:auto 1fr;gap:6px 10px;align-items:center}
.facts label{font-size:var(--t-footnote);color:var(--txt2)}
.facts input{padding:6px 9px;font-size:var(--t-footnote);width:100%}
.sh-foot{margin-top:28px;display:flex;justify-content:space-between;gap:10px}
/* The editions found in the catalogues: cover, title, collection, year, ISBN. */
.eds{display:flex;flex-direction:column;gap:4px;margin-top:10px}
.ed{display:flex;gap:12px;align-items:flex-start;padding:8px;border-radius:12px;text-align:left;width:100%}
.ed:hover{background:var(--fill4)}
.ed.on{background:var(--accent);color:var(--ink-on-accent)}
.ed.on :is(span,small){color:inherit}
.ed-cv{flex:0 0 46px;aspect-ratio:2/3;border-radius:2px 4px 4px 2px;overflow:hidden;background:var(--fill2);
  box-shadow:0 1px 2px rgba(0,0,0,.15),0 4px 10px -4px rgba(0,0,0,.2)}
.ed-cv img{width:100%;height:100%;object-fit:cover;display:block}
.ed-t{display:flex;flex-direction:column;gap:1px;min-width:0}
.ed-t b{font-size:var(--t-footnote);font-weight:600}
.ed-t span{font-size:var(--t-caption);color:var(--txt2)}
.ed-t small{font-size:var(--t-caption2);color:var(--txt3);font-variant-numeric:tabular-nums}
.find-tip{font-size:var(--t-caption);color:var(--txt3);margin:4px 2px 0}
.ed-part{font-style:italic}
.ed-none{font-size:var(--t-footnote);color:var(--txt3);padding:6px 2px}
.sk-ed i{width:46px;aspect-ratio:2/3;flex:none}.sk-ed b{height:12px;width:60%;margin-top:6px}
#edModal .search,#a-find{width:100%;margin-bottom:4px}
.match{display:flex;flex-direction:column;gap:2px;margin-top:6px}
.match button{display:flex;gap:10px;align-items:center;padding:5px 6px;border-radius:8px;text-align:left}
.match button:hover{background:var(--bg3)}
.match .cv{width:24px;flex:0 0 24px}.match .cv :is(.art,.badge){display:none}
.match b{font-size:var(--t-footnote);font-weight:600;display:block}.match span{font-size:var(--t-caption);color:var(--txt2)}

/* --- Dialogs (🕘 History, ⚙️ look) ------------------------------------------ */
.modal-back{position:fixed;inset:0;z-index:30;background:rgba(0,0,0,.1);display:grid;place-items:center;padding:16px;
  opacity:0;pointer-events:none;transition:opacity .3s var(--ease)}
.modal-back.open{opacity:1;pointer-events:auto}
.modal{width:min(560px,100%);max-height:min(720px,calc(100dvh - 32px));display:flex;flex-direction:column;border-radius:var(--r4);
  transform:translateY(12px) scale(.98);transition:transform var(--spring-t) var(--spring);overflow:hidden}
.modal-back.open .modal{transform:none}
/* ⚙️ Paramètres: wider, its sections fold. */
.modal.wide{width:min(640px,100%)}
.modal-b details{border-top:.5px solid var(--line);padding:4px 0}
.modal-b details:first-child{border-top:0}
.modal-b summary{cursor:pointer;font-size:var(--t-subhead);font-weight:600;padding:10px 0;list-style-position:outside;margin-left:16px}
.set-hint{font-size:var(--t-caption);color:var(--txt3);margin:-2px 0 8px}
.set-rows{display:flex;flex-direction:column;gap:2px;padding-bottom:8px}
.set-row{display:flex;align-items:center;gap:6px;padding:2px 2px 2px 0;border-radius:10px}
.set-row:hover{background:var(--fill4)}
.set-row.sub{padding-left:22px}
.set-row input{flex:1;min-width:0;border-color:transparent;background:none;padding:6px 8px;font-size:var(--t-footnote)}
.set-row input:hover{border-color:var(--line)}
.set-row small{color:var(--txt3);font-size:var(--t-caption);font-variant-numeric:tabular-nums;min-width:24px;text-align:right}
.set-row .grip,.grip-sp{width:22px;text-align:center;flex:none}
.del-sp{width:28px;flex:none}
.link.sub{padding-left:30px}
.set-line{display:flex;align-items:center;gap:12px;flex-wrap:wrap;margin-bottom:10px}
.set-line>span{font-size:var(--t-footnote);color:var(--txt2);min-width:60px}
.set-ver{margin-top:14px;font-size:var(--t-caption)}
/* On a computer, the secondary choices (Apparence, Historique) open as a
   popover beside their button: no dimming, an arrow at the button. */
.modal-back.pop{background:none;display:block;padding:0}
.modal-back.pop .modal{position:fixed;width:min(380px,calc(100vw - 24px));transform:scale(.96);opacity:0;
  transition:transform var(--spring-t) var(--spring),opacity .2s;overflow:visible}
.modal-back.pop.open .modal{transform:none;opacity:1}
.modal-back.pop .modal-b{overflow:auto}
.modal-back.pop .modal::before{content:"";position:absolute;width:14px;height:14px;background:var(--glass-solid);transform:rotate(45deg);border-radius:2px}
.modal-back.pop .modal[data-side="left"]::before{left:-6px;top:calc(var(--ax) - 7px)}
.modal-back.pop .modal[data-side="top"]::before{top:-6px;left:calc(var(--ax) - 7px)}
.modal-back.pop .modal[data-side="bottom"]::before{bottom:-6px;left:calc(var(--ax) - 7px)}
.modal-back.pop .modal>*{position:relative}
#histModal.pop .modal{width:min(440px,calc(100vw - 24px))}
/* A tall window: the whole height by default, its bottom handle pulls it shorter. */
.modal.tall{height:var(--mh,calc(100dvh - 32px));max-height:calc(100dvh - 32px)}
.modal.tall .modal-b{flex:1;min-height:0;overflow:auto}
.modal-rz{flex:none;height:14px;display:grid;place-items:center;cursor:ns-resize;touch-action:none;outline:none}
.modal-rz i{width:40px;height:4px;border-radius:2px;background:var(--line2);transition:background .15s,width .15s}
.modal-rz:hover i,.modal-rz:focus-visible i{background:var(--txt3);width:56px}
.modal-h{display:flex;align-items:center;gap:10px;padding:16px 14px 10px 22px}
.modal-h h2{font-size:var(--t-title3);font-weight:700;letter-spacing:-.015em;flex:1}
.modal-b{overflow:auto;padding:0 22px 22px;overscroll-behavior:contain}
.modal-b h3{font-size:var(--t-caption);font-weight:600;color:var(--txt2);margin:18px 0 8px}
.rows{display:flex;flex-direction:column;gap:2px}
.hist-per{margin-bottom:8px;align-self:flex-start}
.row{display:flex;gap:10px;align-items:flex-start;padding:8px 10px;border-radius:10px;background:var(--fill4)}
.row .when{color:var(--txt3);font-size:var(--t-caption);font-variant-numeric:tabular-nums;white-space:nowrap;min-width:72px;padding-top:1px}
.row .what{flex:1;min-width:0;font-size:var(--t-footnote);line-height:1.35}
.row .what small{display:block;color:var(--txt3);font-size:var(--t-caption)}
.row.undone .what{color:var(--txt3);text-decoration:line-through}
.row .ghost{padding:4px 10px;font-size:var(--t-caption)}
.seg{display:inline-flex;gap:2px;background:var(--fill3);padding:3px;border-radius:var(--pill)}
.seg button{min-height:28px;padding:6px 14px;border-radius:var(--pill);font-size:var(--t-footnote);font-weight:500;color:var(--txt2)}
.seg button:hover{color:var(--txt)}
.seg button.on{background:var(--bg2);color:var(--txt);font-weight:600;box-shadow:0 .5px 1px rgba(0,0,0,.1),0 2px 6px rgba(0,0,0,.08)}
html[data-mode="dark"] .seg button.on{background:#5a5a5f}
/* The read / unread switch in the header, each choice with its count. */
#filter{flex:none}
#filter button{white-space:nowrap;padding:5px 11px;font-size:var(--t-footnote)}
#filter small{margin-left:3px;color:var(--txt3);font-weight:500;font-variant-numeric:tabular-nums}
/* The ⠿ of a shelf or a list in the sidebar: there, quiet until the row is hovered. */
.nav-i .grip{margin:-4px -4px -4px 2px;opacity:.35;font-style:normal;transition:opacity .15s}
.nav-i:hover .grip{opacity:1}

#toast{position:fixed;left:50%;bottom:calc(22px + var(--sab));transform:translate(-50%,30px);opacity:0;padding:8px 8px 8px 16px;border-radius:var(--pill);
  font-size:var(--t-footnote);font-weight:500;z-index:40;transition:transform var(--spring-t) var(--spring),opacity .25s;display:flex;gap:10px;align-items:center;
  pointer-events:none;max-width:calc(100vw - 24px)}
#toast.on{transform:translate(-50%,0);opacity:1;pointer-events:auto}
#toast:not(:has(button:not([hidden]))){padding-right:16px}
#toast button:hover{background:var(--fill2)}
#toast button{font-weight:600;padding:6px 12px;border-radius:var(--pill);background:var(--fill3);white-space:nowrap}
.anim{animation:in var(--spring-t) var(--spring) both}
@keyframes in{from{opacity:0;transform:translateY(8px)}}

/* --- Plain pages: sign in, install, self-check ------------------------------ */
body.page-center{display:grid;place-items:center;overflow:auto}
.card-center{width:min(400px,100%);border-radius:var(--r4);padding:28px 26px;display:flex;flex-direction:column;gap:14px}
.card-center h1{font-size:var(--t-title2);font-weight:700;letter-spacing:-.015em}
.note{color:var(--txt2);line-height:1.5}
.err{color:var(--red);background:color-mix(in srgb,var(--red) 10%,transparent);padding:10px 12px;border-radius:var(--r2)}
.fld{display:flex;flex-direction:column;gap:6px;font-size:var(--t-footnote);font-weight:600;color:var(--txt2)}
.fld input{font-weight:400}
.log{list-style:none;display:flex;flex-direction:column;gap:6px;font-size:var(--t-footnote);line-height:1.4}

/* Reduce motion: no move and no change of scale — short fades instead. The
   feedback stays, its nature changes. */
@media (prefers-reduced-motion:reduce){
  *,*::before,*::after{scroll-behavior:auto!important}
  .fi{transition:opacity .2s}
  .sheet{transition:opacity .25s,visibility .25s}
  .sheet:not(.on){transform:none!important;opacity:0;visibility:hidden}
  .modal,.modal-back.pop .modal{transform:none!important;transition:opacity .2s}
  #toast{transform:translateX(-50%)!important;transition:opacity .2s}
  .anim,.board.enter .card{animation:fade .2s both}
  .lifting{animation:none}
  .drag-ghost{transform:none}
}
@keyframes fade{from{opacity:0}}

/* A narrower Mac window: the title keeps its room; the secondary controls shrink. */
@media (max-width:1600px) and (min-width:761px){
  .top h1{min-width:min(220px,18vw)}
  .top .sub{display:none}
  .zoom input{width:60px}
  .search{width:150px}
}

/* ===========================================================================
   iPhone — compact width (portrait, or a phone on its side). One code, two
   shapes: the switch is the room available, not the device.
   - The page itself scrolls. The bar at the top is see-through at rest and
     turns to glass as the content passes under it; the large title scrolls
     away and the small one fades in, in step with the finger (app.js).
   - The tab bar sits on the bottom edge, under the thumb: Bibliothèque,
     Listes, Chercher, Ajouter. The shelves (or the lists) are a strip under
     the large title.
   - The categories are full-width cards you swipe between.
   - The sheet comes up from below, at half height or full height.
   - Every field is 16 px or more (Safari zooms on less).
   =========================================================================== */
.tabbar{display:none}
.big{display:none}
@media (max-width:760px),(max-height:500px) and (pointer:coarse){
  :root{--fw:118px}
  html,body{height:auto}
  body{display:flex;flex-direction:column;gap:8px;overflow:visible;min-height:100dvh;
    padding:0 calc(8px + var(--sar)) calc(70px + var(--sab)) calc(8px + var(--sal))}
  .main{display:contents}
  .side-rz{display:none}
  input,textarea,select,select.pill{font-size:max(16px,var(--t-callout))}

  /* The bar: sticky, see-through, glass as the content slides under it (--sg). */
  .top{order:1;position:sticky;top:0;z-index:7;isolation:isolate;margin:0 calc(-8px - var(--sar)) 0 calc(-8px - var(--sal));
    padding:calc(6px + var(--sat)) calc(8px + var(--sar)) 8px calc(16px + var(--sal));gap:6px;flex-wrap:wrap;border-radius:0;
    background:none;-webkit-backdrop-filter:none;backdrop-filter:none;border:0;box-shadow:none}
  .top::before{content:"";position:absolute;inset:0;z-index:-1;opacity:var(--sg,0);background:var(--glass);
    -webkit-backdrop-filter:var(--blur);backdrop-filter:var(--blur);box-shadow:0 .5px 0 var(--line)}
  .top h1{font-size:var(--t-headline);flex:1 1 0;min-width:0;opacity:var(--sc,0)}
  .top .sub,.top .grow,.zoom,#searchBtn,#add{display:none}
  .top .search{display:none;order:9;width:100%}
  .top.searching .search{display:block}
  #group,#lgroup{max-width:150px;padding-top:6px;padding-bottom:6px}
  #filter{order:8;flex:1 1 100%;display:flex}
  #filter button{flex:1;padding:7px 4px;font-size:var(--t-footnote);min-height:34px}

  /* The large title: content, it scrolls away. */
  .big{order:2;display:flex;align-items:baseline;gap:10px;padding:2px 8px 0}
  .big h2{font-size:var(--t-large);font-weight:700;letter-spacing:-.02em;line-height:1.1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
  .big span{color:var(--txt3);font-size:var(--t-subhead);font-variant-numeric:tabular-nums;white-space:nowrap}

  /* The shelves (Bibliothèque) or the lists (Listes): a strip of pills. */
  .side{order:3;width:auto;flex:none;flex-direction:row;padding:0 2px;overflow-x:auto;align-items:center;scrollbar-width:none;gap:6px;
    background:none;-webkit-backdrop-filter:none;backdrop-filter:none;border:0;box-shadow:none;border-radius:0;margin:0 -8px;padding:2px 8px}
  .side::-webkit-scrollbar{display:none}
  .nav-sec{display:contents}
  body[data-tab="lib"] .nav-sec[data-sec="lists"],body[data-tab="lists"] .nav-sec[data-sec="lib"]{display:none}
  .name,.nav-h{display:none}
  .nav-i{width:auto;white-space:nowrap;flex:none;border-radius:var(--pill);padding:8px 14px;min-height:40px;background:var(--fill4)}
  .nav-i.on{background:var(--txt);color:var(--bg2)}
  .nav-i.on small{color:inherit;opacity:.7}
  .nav-i svg.i{display:none}
  .nav-i small{margin-left:4px}
  .nav-i .grip{display:none}
  .nav-foot{margin:0;padding:0 0 0 4px}

  .stage-wrap{order:4;overflow:visible;flex:none}
  #below{flex:none}
  .flow{height:calc(var(--fw)*1.5 + 74px)}
  .flow-rz{height:22px;margin:-8px 0 -6px}
  .flow-rz i{opacity:.8}
  .stage{inset:12px 0 0}
  .flow-cap{bottom:8px}
  .flow-cap b{font-size:var(--t-subhead)}
  /* One category at a time, the next one peeking: swipe left and right; the
     page scrolls down through its books. */
  .board{height:auto;align-items:flex-start;padding:4px 12px 12px;margin:0 -8px;gap:8px;scroll-snap-type:x mandatory;scroll-padding:0 12px;overscroll-behavior-x:contain;scrollbar-width:none}
  .board::-webkit-scrollbar{display:none}
  .col{flex:0 0 min(calc(100% - 28px),420px);scroll-snap-align:start}
  .cards{overflow:visible;flex:none}
  .col-rz{display:none}
  .col-h .ibtn{opacity:1}
  .card{padding:6px;min-height:44px;position:relative;touch-action:pan-y}
  .col{overflow:hidden}
  /* The actions a swipe reveals, fixed to the book's right edge. */
  .swipe-acts{position:absolute;top:0;bottom:0;left:100%;display:flex;width:152px}
  .swipe-acts button{flex:1 1 76px;display:grid;place-items:center;color:#fff;font-weight:600;font-size:var(--t-footnote);
    transition:flex-basis var(--spring-t) var(--spring)}
  .swipe-acts.full button:not(.sa-main){flex:0 0 0;overflow:hidden;padding:0}
  .sa-main{background:#3f9e6f}.sa-del{background:var(--red)}.sa-more{background:#8e8e93}
  html[data-mode="dark"] .sa-main{background:#2f7d57}html[data-mode="dark"] .sa-del{background:#c23b3b}
  .card b{font-size:var(--t-subhead)}.card span{font-size:var(--t-footnote)}
  .col-new{flex-basis:calc(100% - 28px);scroll-snap-align:start}

  /* The tab bar: glass on the bottom edge, the home indicator's room below. */
  .tabbar{display:flex;position:fixed;left:0;right:0;bottom:0;z-index:8;border-radius:0;border:0;box-shadow:0 -.5px 0 var(--line);
    padding:6px calc(8px + var(--sar)) calc(4px + var(--sab)) calc(8px + var(--sal))}
  .tabbar button{flex:1;display:flex;flex-direction:column;align-items:center;gap:3px;min-height:46px;padding-top:2px;
    font-size:var(--t-caption2);font-weight:500;color:var(--txt3)}
  .tabbar svg.i{width:25px;height:25px;stroke-width:1.6}
  .tabbar button.on{color:var(--txt);font-weight:600}
  .tabbar button.on svg.i{stroke-width:2.1}
  #toast{bottom:calc(72px + var(--sab))}
  .menu button{min-height:44px;font-size:var(--t-subhead)}
  .set-row input{font-size:max(16px,var(--t-callout));min-height:40px}
  .tabbar button span{white-space:nowrap}
  :is(.ibtn,.chip button,.seg button){position:relative}
  :is(.ibtn,.chip button)::after{content:"";position:absolute;inset:-6px}
  .chip button::after{inset:-12px}
  .seg button::after{content:"";position:absolute;inset:-5px 0}
  .link{min-height:44px}
  #group,#lgroup{min-height:40px}

  /* The sheet: from below, two heights (half, full); pull to change, down to close. */
  .sheet{top:auto;left:0;right:0;bottom:0;width:auto;height:calc(100dvh - 44px - var(--sat));border-radius:22px 22px 0 0;
    transform:translateY(105%);padding-bottom:var(--sab)}
  .sh-grab{display:block;width:38px;height:5px;border-radius:3px;background:var(--line2);margin:8px auto 0}
  .sh-top{padding:0 8px;margin-top:-6px}
  .sh-body{padding:0 18px 22px}
  .sh-head .cv{width:84px;flex-basis:84px}
  .tg{padding:8px 14px;min-height:40px}
  .modal-back{place-items:end stretch;padding:0}
  .modal{width:100%;max-height:calc(100dvh - 40px - var(--sat));border-radius:22px 22px 0 0;padding-bottom:var(--sab);transform:translateY(40px)}
}
/* A phone on its side: less height, so smaller covers and wider cards. */
@media (max-height:500px) and (pointer:coarse){
  :root{--fw:84px}
  .big h2{font-size:var(--t-title1)}
  #filter{order:0;flex:0 1 auto}
  #filter button{padding:6px 12px}
  .tabbar{padding-top:4px}
  .tabbar button{flex-direction:row;justify-content:center;gap:6px;min-height:36px;font-size:var(--t-footnote)}
  .tabbar svg.i{width:21px;height:21px}
  body{padding-bottom:calc(52px + var(--sab))}
  #toast{bottom:calc(54px + var(--sab))}
}
}

/* iPhone: dark mode on a black ground (the OLED screen really turns off),
   surfaces rising from it; and the text follows Dynamic Type — the size
   chosen in Réglages › Luminosité et affichage › Taille du texte. */
@media (max-width:760px),(max-height:500px) and (pointer:coarse){
  html[data-mode="dark"]:not([data-ui="ootb"]){--bg:#000;--bg2:#1c1c1e;--bg-elev:#2c2c2e}
}
@supports (font:-apple-system-body){
  @media (max-width:760px),(max-height:500px) and (pointer:coarse){
    html{font:-apple-system-body}
    :root{--u:calc(1rem / 17)}
  }
}

/* ===========================================================================
   Accessibility settings of the Mac and the iPhone.
   =========================================================================== */
/* No blur available, or Reduce transparency: every glass becomes its opaque
   equivalent — the same layout, nothing degraded. */
@supports not ((backdrop-filter:blur(1px)) or (-webkit-backdrop-filter:blur(1px))){
  .pane,.surface{background:var(--glass-solid)}
}
@media (prefers-reduced-transparency:reduce){
  .pane,.surface{background:var(--glass-solid);-webkit-backdrop-filter:none;backdrop-filter:none}
  .veil,.modal-back{background:rgba(0,0,0,.4)}
}
/* Increase contrast: stronger separators and borders, darker secondary text. */
@media (prefers-contrast:more){
  :root{--txt2:#3a3a3c;--txt3:#48484a;--line:rgba(60,60,67,.5);--line2:#8e8e93}
  html[data-mode="dark"]{--txt2:rgba(235,235,245,.88);--txt3:rgba(235,235,245,.8);--line:rgba(170,170,178,.7);--line2:#77777c}
  .pane{background:var(--glass-solid);border:1px solid var(--line2)}
  .col{box-shadow:0 0 0 1px var(--line2)}
  .col.on{box-shadow:inset 0 0 0 2px var(--txt)}
  .card.sel,.tg.on{outline:1.5px solid var(--txt);outline-offset:-1.5px}
  .seg button.on{box-shadow:0 0 0 1px var(--line2)}
}
