html, body { margin: 0; }

/* Layout: Apple Books calm. Desktop and iPad = spines on thin shelves, one shelf set per subject.
   Phone = one row of face-out covers per subject, swiped sideways, bottom tab bar. */
:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #eceef2;
  --ink: #12161d;
  --ink-2: #4a5361;
  --ink-3: #8b94a2;
  --line: #e1e4ea;
  --accent: #1e5aa0;
  --accent-ink: #ffffff;
  --plank-top: #e4e7ec;
  --plank-bot: #d5d9e0;
  --plank-shadow: rgba(24, 34, 52, 0.10);
  --scrim: rgba(18, 22, 29, 0.38);
  --paper: #f6f1e6;
  --paper-ink: #3b3428;
  --paper-line: #e2d9c6;
  --shadow: 0 1px 2px rgba(20, 28, 40, .06), 0 12px 32px rgba(20, 28, 40, .10);
  --c-icao: #1e5aa0;
  --c-ectl: #26356c;
  --c-easa: #2a7883;
  --c-faa: #4e5a66;
  --c-maroc: #ad3a34;
  --c-acad: #98692c;
  --c-other: #67589a;
  --f-ui: "Inter Tight Variable", "Inter Tight", "Segoe UI", system-ui, -apple-system, sans-serif;
  --f-title: "Newsreader Variable", "Newsreader", Georgia, "Times New Roman", serif;
  --f-mono: "JetBrains Mono Variable", "JetBrains Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1116; --surface: #171b22; --surface-2: #1f242d; --ink: #edf0f4; --ink-2: #b2bac6; --ink-3: #7c8695;
    --line: #262c36; --accent: #6da2e4; --accent-ink: #0b1220; --plank-top: #252b35; --plank-bot: #1b2028;
    --plank-shadow: rgba(0, 0, 0, 0.45); --scrim: rgba(0, 0, 0, 0.55); --paper: #e9e2d2; --paper-ink: #2e281e; --paper-line: #d3c8b0;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 16px 40px rgba(0, 0, 0, .45); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1116; --surface: #171b22; --surface-2: #1f242d; --ink: #edf0f4; --ink-2: #b2bac6; --ink-3: #7c8695;
  --line: #262c36; --accent: #6da2e4; --accent-ink: #0b1220; --plank-top: #252b35; --plank-bot: #1b2028;
  --plank-shadow: rgba(0, 0, 0, 0.45); --scrim: rgba(0, 0, 0, 0.55); --paper: #e9e2d2; --paper-ink: #2e281e; --paper-line: #d3c8b0;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 16px 40px rgba(0, 0, 0, .45); color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { background: var(--bg); }
body { color: var(--ink); font-family: var(--f-ui); font-size: 15px; line-height: 1.45; -webkit-font-smoothing: antialiased; overflow-x: hidden; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
button:focus-visible, input:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 30; background: var(--bg); }

.wrap { max-width: 1320px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }

/* ---------- top ---------- */
.top { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px); border-bottom: 1px solid transparent; transition: border-color .3s; }
.top.scrolled { border-bottom-color: var(--line); }
.top-row { display: flex; align-items: center; gap: 14px; padding-block: 12px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 15px; letter-spacing: -0.01em; white-space: nowrap; }
.brand svg { flex: none; }
.brand b { font-weight: 700; }
.search-btn { margin-left: auto; flex: none; display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 12px; min-width: 260px; border-radius: 10px; background: var(--surface-2); color: var(--ink-3); font-size: 14px; transition: background .2s; }
.search-btn:hover { background: var(--line); }
.search-btn kbd { margin-left: auto; font-family: var(--f-mono); font-size: 11px; padding: 2px 6px; border-radius: 5px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-3); }

.hero { display: flex; align-items: flex-end; gap: 24px; flex-wrap: wrap; padding-block: 18px 6px; }
.hero h1 { margin: 0; font-size: 34px; line-height: 1.05; letter-spacing: -0.025em; font-weight: 700; text-wrap: balance; }
.hero p { margin: 6px 0 0; color: var(--ink-3); font-size: 14px; font-variant-numeric: tabular-nums; }
.seg { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--surface-2); }
.seg button { height: 28px; padding: 0 12px; border-radius: 999px; font-size: 13px; font-weight: 500; color: var(--ink-3); transition: color .2s, background .2s, box-shadow .2s; }
.seg button[aria-pressed="true"] { color: var(--ink); background: var(--surface); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.tools { margin-left: auto; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.toggle { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); height: 34px; padding: 0 4px; }
.toggle .sw { width: 30px; height: 18px; border-radius: 999px; background: var(--line); position: relative; transition: background .25s; }
.toggle .sw::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--surface); box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .25s var(--ease); }
.toggle[aria-pressed="true"] .sw { background: var(--accent); }
.toggle[aria-pressed="true"] .sw::after { transform: translateX(12px); }

.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-block: 12px 4px; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-size: 13px; font-weight: 500; color: var(--ink-2); transition: all .2s var(--ease); }
.chip i { width: 9px; height: 9px; border-radius: 3px; background: var(--c); }
.chip span { color: var(--ink-3); font-variant-numeric: tabular-nums; font-weight: 400; }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip[aria-pressed="true"] span { color: color-mix(in srgb, var(--bg) 70%, transparent); }

/* ---------- groups ---------- */
main { padding-bottom: 80px; }
.group { margin-top: 30px; }
.group-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 6px; }
.group-head h2 { margin: 0; font-size: 19px; font-weight: 650; letter-spacing: -0.015em; }
.group-head .n { color: var(--ink-3); font-size: 13px; font-variant-numeric: tabular-nums; }
.group-head .more { margin-left: auto; font-size: 13px; color: var(--accent); font-weight: 500; }

/* ---------- shelves (spines) ---------- */
.shelf { position: relative; display: flex; align-items: flex-end; gap: 3px; padding: 0 14px; margin-top: 22px; min-height: 60px; }
.shelf::after { content: ""; position: absolute; left: 0; right: 0; bottom: -11px; height: 11px; border-radius: 3px; background: linear-gradient(var(--plank-top), var(--plank-bot)); box-shadow: 0 10px 18px -6px var(--plank-shadow); }
.shelf .run-gap { width: 12px; flex: none; }

.spine { position: relative; flex: none; width: var(--w); height: var(--h); border-radius: 2px 3px 3px 2px; background: var(--c); color: #f7f3ea; overflow: hidden;
  box-shadow: inset 2px 0 0 rgba(255,255,255,.10), inset -2px 0 3px rgba(0,0,0,.22), 0 1px 0 rgba(0,0,0,.15);
  transform-origin: 50% 100%; transition: transform .35s var(--ease), filter .3s, opacity .3s; will-change: transform; }
.spine::before { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(0,0,0,.20), rgba(255,255,255,.10) 28%, rgba(255,255,255,0) 60%, rgba(0,0,0,.18)); pointer-events: none; }
.spine .txt { position: absolute; inset: 10px 0 12px; display: flex; align-items: center; justify-content: flex-start; writing-mode: vertical-rl; transform: rotate(180deg); gap: 7px; overflow: hidden; white-space: nowrap; }
.spine .r { font-family: var(--f-ui); font-weight: 700; font-size: var(--fs, 11px); letter-spacing: .01em; }
.spine .t { font-family: var(--f-title); font-style: italic; font-size: calc(var(--fs, 11px) + 0.5px); opacity: .88; overflow: hidden; text-overflow: ellipsis; }
.spine.narrow .t { display: none; }
.spine .band { position: absolute; left: 0; right: 0; height: 2px; background: rgba(255,255,255,.55); }
.spine .band.a { top: 7px; } .spine .band.b { bottom: 8px; }
.spine.old { filter: saturate(.25) brightness(1.05); opacity: .55; }
.spine.k-notes { background: var(--paper); color: var(--paper-ink); box-shadow: inset 0 0 0 1px var(--paper-line), 0 1px 0 rgba(0,0,0,.12); }
.spine.k-notes::before { background: linear-gradient(90deg, rgba(0,0,0,.08), rgba(0,0,0,0) 40%, rgba(0,0,0,.06)); }
.spine.k-notes::after { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 12px; background: var(--c); opacity: .85; }
.spine.k-exam { background: color-mix(in srgb, var(--c) 78%, #ffffff); }
.spine.k-paper { background: color-mix(in srgb, var(--c) 30%, #f2efe8); color: #2a2620; }
.spine.k-paper::after { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--c); }
.spine.k-thesis .band { background: #e6c77a; }
.spine.k-binder { border-radius: 4px; background: linear-gradient(90deg, color-mix(in srgb, var(--c) 82%, #000) 0, var(--c) 18%, var(--c) 82%, color-mix(in srgb, var(--c) 80%, #000)); }
.spine.k-binder .holes { position: absolute; left: 50%; transform: translateX(-50%); top: 0; bottom: 0; display: flex; flex-direction: column; justify-content: space-evenly; padding: 22px 0; }
.spine.k-binder .holes i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid rgba(255,255,255,.55); background: rgba(0,0,0,.18); }
.spine.k-binder .lbl { position: absolute; left: 6px; right: 6px; top: 50%; transform: translateY(-50%); background: #f6f1e6; color: #2b2520; border-radius: 2px; text-align: center; padding: 7px 0; font-family: var(--f-mono); font-weight: 500; font-size: 11px; letter-spacing: .06em; writing-mode: vertical-rl; transform: translateY(-50%) rotate(180deg); }
@media (hover: hover) and (pointer: fine) {
  .spine:hover { transform: translateY(-10px) rotate(-1.5deg); }
  .spine.old:hover { opacity: .9; filter: none; }
}
.spine.taken { visibility: hidden; }

.tip { position: fixed; z-index: 40; pointer-events: none; max-width: 300px; padding: 8px 11px; border-radius: 9px; background: var(--ink); color: var(--bg); font-size: 12.5px; line-height: 1.35; opacity: 0; transform: translateY(4px); transition: opacity .15s, transform .15s; }
.tip.on { opacity: 1; transform: none; }
.tip b { font-weight: 600; } .tip small { display: block; opacity: .7; margin-top: 2px; font-family: var(--f-mono); font-size: 10.5px; }

/* ---------- covers ---------- */
.covers { display: flex; gap: 14px; }
.covers.scroll { overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; padding: 10px max(16px, env(safe-area-inset-right, 0px)) 8px max(16px, env(safe-area-inset-left, 0px)); margin-inline: calc(-1 * max(16px, env(safe-area-inset-left, 0px))) calc(-1 * max(16px, env(safe-area-inset-right, 0px))); scroll-padding-inline: max(16px, env(safe-area-inset-left, 0px)); }
.covers.scroll::-webkit-scrollbar { display: none; }
.covers.grid { flex-wrap: wrap; padding-top: 10px; }
.tile { flex: none; width: var(--cw, 112px); scroll-snap-align: start; text-align: left; transition: transform .3s var(--ease); }
.tile:active { transform: scale(.97); }
.tile .meta { margin-top: 8px; }
.tile .meta .r { display: block; font-family: var(--f-mono); font-size: 10.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .meta .t { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 12.5px; line-height: 1.3; color: var(--ink); margin-top: 2px; }
@media (hover: hover) and (pointer: fine) { .tile:hover { transform: translateY(-4px); } }

.cover { position: relative; width: 100%; aspect-ratio: 0.71; border-radius: 3px 6px 6px 3px; overflow: hidden; background: var(--c); color: #f6f2ea; box-shadow: 0 1px 1px rgba(0,0,0,.12), 0 8px 18px -6px rgba(10,16,28,.35); container-type: inline-size; isolation: isolate; }
.cover::before { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(0,0,0,.22) 0, rgba(255,255,255,.12) 2.5%, rgba(0,0,0,.05) 5%, rgba(0,0,0,0) 9%), radial-gradient(120% 80% at 85% 0%, rgba(255,255,255,.16), rgba(255,255,255,0) 60%); z-index: 1; pointer-events: none; }
.cover .in { position: absolute; inset: 0; padding: 11cqw 9cqw 9cqw 13cqw; display: flex; flex-direction: column; }
.cover .org { font-family: var(--f-mono); font-size: max(7px, 6.6cqw); letter-spacing: .08em; text-transform: uppercase; opacity: .78; }
.cover .rf { margin-top: auto; font-weight: 700; font-size: 15cqw; line-height: .98; letter-spacing: -0.03em; text-wrap: balance; }
.cover .rf.sm { font-size: 11cqw; }
.cover .ti { margin-top: 5cqw; font-family: var(--f-title); font-style: italic; font-size: 8.6cqw; line-height: 1.15; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; opacity: .95; }
.cover .ti.big { font-size: 11cqw; -webkit-line-clamp: 5; }
.cover .foot { display: flex; gap: 4cqw; align-items: center; margin-top: 8cqw; font-family: var(--f-mono); font-size: max(7px, 6cqw); opacity: .8; white-space: nowrap; overflow: hidden; }
.cover .foot span:first-child:not(.lg) { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.cover .foot .lg { flex: none; }
.cover .foot .lg { border: 1px solid currentColor; border-radius: 3px; padding: 0 2.5cqw; }
.cover .rule { height: 1px; background: currentColor; opacity: .35; margin-top: 7cqw; }
.cover .old-tag { position: absolute; z-index: 2; top: 12cqw; right: -14cqw; transform: rotate(35deg); background: #f2e9d6; color: #6a4b16; font-family: var(--f-mono); font-size: max(6px, 5.6cqw); letter-spacing: .06em; padding: 1.4cqw 18cqw; text-transform: uppercase; }
.cover.old { filter: saturate(.35); }
.cover.k-notes { background: var(--paper); color: var(--paper-ink); background-image: repeating-linear-gradient(180deg, transparent 0 9cqw, var(--paper-line) 9cqw calc(9cqw + 1px)); }
.cover.k-notes::after { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 6cqw; background: var(--c); }
.cover.k-paper { background: color-mix(in srgb, var(--c) 22%, #f3f0ea); color: #26221c; }
.cover.k-exam { background: color-mix(in srgb, var(--c) 82%, #ffffff); }
.cover.k-binder { background: linear-gradient(90deg, color-mix(in srgb, var(--c) 80%, #000) 0 10%, var(--c) 10%); }
.cover.k-binder .rings { position: absolute; left: 2.5cqw; top: 0; bottom: 0; display: flex; flex-direction: column; justify-content: space-around; padding: 16cqw 0; z-index: 2; }
.cover.k-binder .rings i { width: 6cqw; height: 6cqw; border-radius: 50%; background: rgba(255,255,255,.55); box-shadow: inset 0 0 0 1.5px rgba(0,0,0,.25); }
.cover.k-binder .code { font-family: var(--f-mono); font-weight: 500; font-size: 22cqw; letter-spacing: .02em; margin-top: auto; }
.cover.k-binder .card { background: #f6f1e6; color: #2b2520; border-radius: 2px; padding: 4cqw 5cqw; font-size: 7.4cqw; line-height: 1.25; margin-top: 5cqw; }

/* ---------- desk ---------- */
.desk { margin-top: 22px; padding: 16px 16px 12px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); }
.desk h2 { margin: 0; font-size: 15px; font-weight: 650; }
.desk .sub { color: var(--ink-3); font-size: 13px; }
.desk .covers { --cw: 86px; }
.empty { color: var(--ink-3); font-size: 13.5px; padding: 10px 0 4px; max-width: 52ch; }

/* ---------- modal (desktop) ---------- */
.scrim { position: fixed; inset: 0; z-index: 50; background: var(--scrim); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); opacity: 0; transition: opacity .35s; }
.scrim.on { opacity: 1; }
.modal { position: fixed; inset: 0; z-index: 51; display: grid; place-items: center; padding: 24px; pointer-events: none; }
.modal-card { pointer-events: auto; width: min(860px, 100%); max-height: calc(100vh - 48px); display: grid; grid-template-columns: 330px 1fr; border-radius: 20px; background: var(--surface); box-shadow: var(--shadow); overflow: hidden; }
.modal-card .bg { opacity: 0; transition: opacity .3s; }
.stage { position: relative; display: grid; place-items: center; padding: 40px 30px; background: var(--surface-2); perspective: 1600px; min-height: 460px; }
.flight { width: 236px; height: 334px; position: relative; transform-style: preserve-3d; }
.book3d { position: absolute; inset: 0; transform-style: preserve-3d; transition: transform .6s var(--ease); }
.face { position: absolute; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.face.front { inset: 0; transform: translateZ(calc(var(--d) / 2)); }
.face.front .cover { height: 100%; aspect-ratio: auto; box-shadow: 0 24px 40px -18px rgba(10,16,28,.55); }
.face.spinef { top: 0; height: 100%; width: var(--d); left: calc(50% - var(--d) / 2); transform: rotateY(-90deg) translateZ(118px); }
.face.spinef .spine { width: 100% !important; height: 100% !important; border-radius: 2px; }
.face.pages { top: 3px; bottom: 3px; width: calc(var(--d) - 2px); left: calc(50% - var(--d) / 2 + 1px); transform: rotateY(90deg) translateZ(116px); background: repeating-linear-gradient(90deg, #f3efe6 0 2px, #e2dccf 2px 3px); }
.info { position: relative; padding: 30px 30px 26px; overflow-y: auto; display: flex; flex-direction: column; min-width: 0; }
.info .x { position: absolute; top: 14px; right: 14px; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; color: var(--ink-3); }
.info .x:hover { background: var(--surface-2); color: var(--ink); }
.pill { align-self: flex-start; display: inline-flex; align-items: center; gap: 7px; height: 26px; padding: 0 10px; border-radius: 999px; background: var(--surface-2); font-size: 12px; font-weight: 500; color: var(--ink-2); }
.pill i { width: 8px; height: 8px; border-radius: 2px; background: var(--c); }
.pill.warn { background: color-mix(in srgb, #c98a14 16%, transparent); color: color-mix(in srgb, #9a6608 80%, var(--ink)); }
.pill.ok { background: color-mix(in srgb, #2f8a57 14%, transparent); color: color-mix(in srgb, #23704a 85%, var(--ink)); }
.pills { display: flex; gap: 6px; flex-wrap: wrap; }
.info h3 { margin: 16px 0 0; font-size: 28px; line-height: 1.08; letter-spacing: -0.02em; font-weight: 700; text-wrap: balance; }
.info .ttl { margin: 8px 0 0; font-family: var(--f-title); font-style: italic; font-size: 21px; line-height: 1.25; color: var(--ink-2); text-wrap: balance; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 7px 18px; margin: 22px 0 0; font-size: 13.5px; }
.facts dt { color: var(--ink-3); }
.facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.facts dd.mono { font-family: var(--f-mono); font-size: 12px; color: var(--ink-2); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 24px; }
.btn { height: 40px; padding: 0 16px; border-radius: 11px; font-weight: 600; font-size: 14px; display: inline-flex; align-items: center; gap: 8px; background: var(--surface-2); color: var(--ink); transition: transform .15s, background .2s; }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.star[aria-pressed="true"] { background: color-mix(in srgb, #d4a017 20%, transparent); color: color-mix(in srgb, #9a7200 85%, var(--ink)); }
.notice { margin-top: 14px; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); color: var(--ink-2); font-size: 13.5px; line-height: 1.45; }
.notice[hidden] { display: none; }
.link { color: var(--accent); font-weight: 500; font-size: 13.5px; text-align: left; margin-top: 14px; align-self: flex-start; }
.sheets { margin-top: 18px; border-top: 1px solid var(--line); }
.sheets button { width: 100%; display: grid; grid-template-columns: 138px 1fr auto; gap: 10px; align-items: baseline; text-align: left; padding: 9px 2px; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.sheets button:hover { background: var(--surface-2); }
.sheets .sr { font-family: var(--f-mono); font-size: 11.5px; color: var(--ink-2); }
.sheets .sd { font-family: var(--f-mono); font-size: 11px; color: var(--ink-3); white-space: nowrap; }
.sheets .o { opacity: .5; }

/* ---------- bottom sheet (phone) ---------- */
.bsheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 51; max-height: 90vh; display: flex; flex-direction: column; border-radius: 22px 22px 0 0; background: var(--surface); box-shadow: 0 -10px 40px rgba(0,0,0,.25); transform: translateY(105%); transition: transform .45s var(--ease); padding-bottom: env(safe-area-inset-bottom, 0px); touch-action: none; }
.bsheet.on { transform: translateY(0); }
.bsheet .grab { padding: 10px 0 6px; display: grid; place-items: center; cursor: grab; }
.bsheet .grab i { width: 40px; height: 5px; border-radius: 99px; background: var(--line); }
.bsheet .body { overflow-y: auto; padding: 6px max(20px, env(safe-area-inset-right, 0px)) 24px max(20px, env(safe-area-inset-left, 0px)); touch-action: pan-y; }
.bs-top { display: flex; gap: 16px; align-items: flex-end; }
.bs-cover { width: 120px; flex: none; }
.bs-top .pills { margin-bottom: 6px; }
.bsheet h3 { margin: 14px 0 0; font-size: 24px; line-height: 1.1; letter-spacing: -0.02em; font-weight: 700; text-wrap: balance; }
.bsheet .ttl { margin: 6px 0 0; font-family: var(--f-title); font-style: italic; font-size: 18px; line-height: 1.25; color: var(--ink-2); }
.bsheet .pills { margin-top: 16px; }
.bsheet .sheets button { grid-template-columns: 120px 1fr; }
.bsheet .sheets .sd { display: none; }
.bsheet .facts { margin-top: 18px; }
.bsheet .actions .btn { flex: 1; justify-content: center; height: 46px; }

/* ---------- search palette ---------- */
.palette { position: fixed; z-index: 52; left: 50%; top: 12vh; width: min(640px, calc(100% - 32px)); transform: translateX(-50%) scale(.98); opacity: 0; pointer-events: none; transition: opacity .2s, transform .25s var(--ease); background: var(--surface); border-radius: 16px; box-shadow: var(--shadow); overflow: hidden; }
.palette.on { opacity: 1; transform: translateX(-50%) scale(1); pointer-events: auto; }
.palette .q { display: flex; align-items: center; gap: 10px; padding: 0 16px; border-bottom: 1px solid var(--line); }
.palette input, .msearch input { flex: 1; height: 54px; border: 0; background: none; font: inherit; font-size: 17px; color: var(--ink); outline: none; min-width: 0; }
.results { max-height: 56vh; overflow-y: auto; padding: 6px; }
.res { width: 100%; display: grid; grid-template-columns: 10px 1fr auto; gap: 12px; align-items: center; text-align: left; padding: 10px 10px; border-radius: 10px; }
.res i { width: 10px; height: 34px; border-radius: 2px; background: var(--c); }
.res .r { font-weight: 600; font-size: 14px; }
.res .t { color: var(--ink-2); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.res .t span { font-family: var(--f-title); font-style: italic; }
.res .o { color: var(--ink-3); font-size: 12px; font-family: var(--f-mono); white-space: nowrap; }
.res[aria-selected="true"] { background: var(--surface-2); }
.res > div { min-width: 0; }
.hint { padding: 10px 16px; font-size: 12px; color: var(--ink-3); border-top: 1px solid var(--line); }

/* ---------- phone ---------- */
.tabbar { display: none; }
.view[hidden] { display: none !important; }
.msearch .q { display: flex; align-items: center; gap: 10px; padding: 0 14px; margin-top: 14px; border-radius: 14px; background: var(--surface-2); }
.msearch input { height: 46px; font-size: 16px; }

@media (max-width: 759px) {
  .search-btn, .tools, .hero .tools { display: none; }
  .acct-wrap { margin-left: auto; }
  .hero { padding-top: 6px; }
  .hero h1 { font-size: 30px; }
  .top-row { padding-block: 10px; }
  .group { margin-top: 22px; }
  .group-head h2 { font-size: 17px; }
  main { padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px)); }
  .tabbar { display: flex; position: fixed; z-index: 45; left: 0; right: 0; bottom: 0; padding: 6px max(10px, env(safe-area-inset-right, 0px)) calc(6px + env(safe-area-inset-bottom, 0px)) max(10px, env(safe-area-inset-left, 0px)); background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: saturate(1.5) blur(16px); -webkit-backdrop-filter: saturate(1.5) blur(16px); border-top: 1px solid var(--line); }
  .tabbar button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 0; font-size: 11px; font-weight: 500; color: var(--ink-3); }
  .tabbar button[aria-current="page"] { color: var(--accent); }
  .modal, .scrim.desk-only { display: none; }
  .palette { display: none; }
}
@media (min-width: 760px) { .bsheet { display: none; } .msearch, .mdesk { display: none !important; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
@keyframes rise { from { transform: translateY(14px); } to { transform: none; } }
.rise { animation: rise .7s var(--ease) both; }

/* ===== additions pour l'application réelle ===== */
/* ===== compte, chargement, erreurs ===== */
.acct-wrap { position: relative; flex: none; }
.acct { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; overflow: hidden; background: var(--surface-2); color: var(--ink-2); font-weight: 650; font-size: 14px; border: 1px solid var(--line); }
.acct:hover { background: var(--line); }
.acct #acctImg { display: grid; place-items: center; width: 100%; height: 100%; }
.acct img { width: 100%; height: 100%; object-fit: cover; display: block; }
.menu { position: absolute; right: 0; top: 44px; z-index: 60; width: 272px; padding: 8px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); }
.menu[hidden] { display: none; }
.menu .who { padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.menu .who b { display: block; font-size: 14.5px; }
.menu .who span { display: block; font-size: 12.5px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu .lbl { padding: 6px 10px 4px; font-size: 11.5px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .06em; }
.menu .theme { display: flex; gap: 3px; padding: 3px; margin: 0 6px 6px; border-radius: 10px; background: var(--surface-2); }
.menu .theme button { flex: 1; height: 30px; border-radius: 8px; font-size: 13px; font-weight: 500; color: var(--ink-3); }
.menu .theme button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.1); }
.menu .item { display: block; width: 100%; text-align: left; padding: 10px 10px; border-radius: 9px; font-size: 14px; color: var(--ink); }
.menu .item:hover { background: var(--surface-2); }
.menu small { display: block; padding: 6px 10px 2px; font-size: 11.5px; color: var(--ink-3); }
.menu form { margin: 0; }
.menu form[hidden] { display: none; }
html.demo .brand span::after { content: "démo"; margin-left: 8px; font: 500 10.5px var(--f-mono); text-transform: uppercase; letter-spacing: .08em; padding: 2px 6px; border-radius: 5px; background: color-mix(in srgb, #c98a14 22%, transparent); color: color-mix(in srgb, #9a6608 80%, var(--ink)); vertical-align: 2px; }
.links2 { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 14px; }
.links2 .link { margin-top: 0; }
@media (max-width: 759px) { .menu { position: fixed; right: max(12px, env(safe-area-inset-right, 0px)); top: calc(52px + env(safe-area-inset-top, 0px)); } .links2 { margin-top: 16px; } }

.skel-h { width: 180px; height: 18px; border-radius: 6px; background: var(--surface-2); margin-top: 30px; animation: pulse 1.4s ease-in-out infinite; }
.shelf.skel { align-items: flex-end; }
.shelf.skel i { flex: none; border-radius: 2px; background: var(--surface-2); animation: pulse 1.4s ease-in-out infinite; }
.shelf.skel i:nth-child(3n) { animation-delay: .2s; } .shelf.skel i:nth-child(3n+1) { animation-delay: .4s; }
@keyframes pulse { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }
.errbox { margin: 48px auto; max-width: 520px; padding: 24px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); }
.errbox b { font-size: 17px; }
.errbox p { color: var(--ink-2); line-height: 1.5; margin: 8px 0 16px; }
.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translate(-50%, 14px); z-index: 70; max-width: calc(100% - 32px); padding: 11px 16px; border-radius: 12px; background: var(--ink); color: var(--bg); font-size: 13.5px; opacity: 0; pointer-events: none; transition: opacity .25s, transform .3s var(--ease); }
.toast.on { opacity: 1; transform: translate(-50%, 0); }
@media (max-width: 759px) { .toast { bottom: calc(76px + env(safe-area-inset-bottom, 0px)); } }
