/* ==========================================================================
   Fotobuch – the kit of the design "Helles Studio" (docs/spec/ui-v3.md, ui-v3-konzept.md sections 3 and 4; direction B
   of Data/_ui_mockups/editor-v4). The one source of the tokens, the base and the global building blocks for the website,
   the editor and Knipsi; served as _content/Fotobuch.Ui/kit.css and linked before app.css (App.razor), which keeps the
   interface fonts, the shell and page rests. Tokens -> base -> blocks. Blocks use tokens only (no hex values outside the
   token blocks; book materials such as paper are tokens too); pages and components bring their layout in *.razor.css.
   The building blocks are also Blazor components in src/Fotobuch.Ui (Icon, Button, IconButton, TopBar, Crumb, ...).
   ========================================================================== */

/* ---------- Tokens: light ---------- */
:root {
    color-scheme: light;
    --bg: #f7f6f3;
    --surface: #ffffff;
    --surface-2: #f0eeea;
    --surface-3: #e7e4de;
    --line: #e6e3dd;
    --line-strong: #d3cfc7;
    --ink: #1b1a18;
    --ink-2: #57534c;
    --ink-3: #8b867e;
    /* Zinnober (torii red, Roman terracotta): the one primary button, "im Buch", the active choice. Only for that. */
    --accent: #d6452a;
    --accent-hover: #bf3a21;
    --accent-ink: #ffffff;
    --accent-soft: #fbe9e3;
    --accent-text: #b8391f;
    --good: #1d8a4e;
    --good-soft: #e2f2e8;
    --warn: #a8670f;
    --warn-soft: #fbf0da;
    /* errors: a darker carmine, never the accent, and always shown with an icon (.notice-error, .badge-error) */
    --error: #9b1c3a;
    --error-soft: #f9e3e8;
    --scrim: rgba(17, 16, 15, .55);
    --glass: rgba(247, 246, 243, .82);
    /* dark floating things in both themes: toast, selection bar, tooltips, the tool pills */
    --inverse: #1f1e1c;
    --inverse-ink: #f6f4ef;
    /* marks on top of photos (the "im Buch" ring) */
    --on-photo: #ffffff;
    /* book material: the paper of a passepartout or a polaroid in a tile (the same in both themes, like a print) */
    --mat: #fffdf8;
    /* the paper ground of a tile that shows the book's own colours (stickers, text styles): a warm light grey in both
       themes, so dark book colours stay readable in the dark theme too */
    --mat-tile: color-mix(in srgb, var(--mat) 85%, var(--ink-3));
    /* monograms (initials on a colour, e.g. a print shop without a logo): the mockup's ten muted colours, white text */
    --mono-0: #c8553d; --mono-1: #3d7ea6; --mono-2: #6a8e4e; --mono-3: #8e5aa8; --mono-4: #c08a2e;
    --mono-5: #4f6d7a; --mono-6: #a64d79; --mono-7: #2f8f83; --mono-8: #7a6a4f; --mono-9: #5868b0;
    /* the dark full view (Großansicht, Sichten, Vorschau) is dark in both themes; .on-stage maps the surfaces onto it */
    --stage: #0f0f0e;
    --stage-2: #1d1c1a;
    --stage-ink: #f3f1ec;
    --stage-ink-2: #b4afa6;
    --stage-ink-3: #8a857c;
    --stage-accent-soft: rgba(255, 107, 77, .16);
    --stage-accent-text: #ff8a70;
    --focus: 0 0 0 3px rgba(214, 69, 42, .32);

    --font-ui: "Inter UI", system-ui, -apple-system, "Segoe UI", sans-serif;
    --font-display: "Playfair Display UI", Georgia, serif;

    /* exactly seven sizes */
    --fs-xs: .75rem;    /* 12 meta, badges */
    --fs-sm: .8125rem;  /* 13 hints, chips */
    --fs-md: .9375rem;  /* 15 text, buttons */
    --fs-lg: 1.25rem;   /* 20 card titles */
    --fs-xl: 1.625rem;  /* 26 section titles (display) */
    --fs-2xl: 2.25rem;  /* 36 page titles (display) */
    --fs-3xl: 3rem;     /* 48 hero (display) */

    --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 24px; --sp-6: 32px; --sp-7: 48px; --sp-8: 64px;
    --r-sm: 8px; --r-md: 12px; --r-lg: 20px; --r-pill: 999px;
    --sh-1: 0 1px 2px rgba(28, 22, 16, .05), 0 0 0 1px rgba(28, 22, 16, .045);
    --sh-2: 0 10px 30px -10px rgba(28, 22, 16, .18), 0 2px 6px rgba(28, 22, 16, .05), 0 0 0 1px rgba(28, 22, 16, .04);
    --sh-3: 0 30px 80px -20px rgba(20, 16, 12, .38), 0 0 0 1px rgba(28, 22, 16, .05);
    /* a spread lying on the light stage (editor, "Weitermachen" on Start, Buch-Überblick) */
    --sh-spread: 0 30px 60px -24px rgba(0, 0, 0, .55), 0 6px 14px -6px rgba(0, 0, 0, .3);
    --ease: cubic-bezier(.2, .8, .2, 1);
    --t-1: 120ms; --t-2: 220ms; --t-3: 360ms;
    --page-max: 1240px;
    /* the height of the top bar (.topbar, 60 px); what sits under it (sticky page bars, anchors, Knipsi's panel) reads it.
       The shell's phone header (56 px) and the editor (0: its bar is part of its grid) set their own value */
    --header-h: 60px;
    /* smallest tap target on touch screens */
    --tap: 44px;
    /* height of the phone bottom bar while it is shown, otherwise 0px; toasts, the selection bar and Knipsi sit above it */
    --bottom-bar-h: 0px;
    /* overlay layers, lowest first */
    --z-header: 40;
    --z-bottom-bar: 50;
    --z-popover: 60;
    --z-selbar: 65;
    --z-mascot: 70;
    --z-sheet: 75;
    --z-lightbox: 78;
    --z-toast: 85;
    --z-chat: 90;
    --z-confirm: 95;

    /* names of the first design (UX v2), kept for page styles that are not restyled yet */
    --paper: var(--bg);
    --ink-soft: var(--ink-2);
    --bad: var(--error);
    --bad-soft: var(--error-soft);
    --radius: var(--r-sm);
    --shadow: var(--sh-2);
}

/* ---------- Tokens: dark (system setting, or chosen in the menu: data-theme on <html>, theme-boot.js) ---------- */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        color-scheme: dark;
        --bg: #111110; --surface: #1b1a19; --surface-2: #252422; --surface-3: #302e2b;
        --line: #2e2c29; --line-strong: #403d39;
        --ink: #f3f1ec; --ink-2: #bdb8af; --ink-3: #8d887f;
        --accent: #ff6b4d; --accent-hover: #ff8166; --accent-ink: #1b0b06; --accent-soft: rgba(255, 107, 77, .14); --accent-text: #ff8a70;
        --good: #4cc483; --good-soft: rgba(76, 196, 131, .14); --warn: #e3a948; --warn-soft: rgba(227, 169, 72, .14);
        --error: #f2708d; --error-soft: rgba(242, 112, 141, .14);
        --glass: rgba(17, 17, 16, .78);
        --focus: 0 0 0 3px rgba(255, 107, 77, .4);
        --sh-1: 0 0 0 1px rgba(255, 255, 255, .06);
        --sh-2: 0 12px 32px -8px rgba(0, 0, 0, .6), 0 0 0 1px rgba(255, 255, 255, .07);
        --sh-3: 0 30px 80px -10px rgba(0, 0, 0, .7), 0 0 0 1px rgba(255, 255, 255, .08);
    }
}
:root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #111110; --surface: #1b1a19; --surface-2: #252422; --surface-3: #302e2b;
    --line: #2e2c29; --line-strong: #403d39;
    --ink: #f3f1ec; --ink-2: #bdb8af; --ink-3: #8d887f;
    --accent: #ff6b4d; --accent-hover: #ff8166; --accent-ink: #1b0b06; --accent-soft: rgba(255, 107, 77, .14); --accent-text: #ff8a70;
    --good: #4cc483; --good-soft: rgba(76, 196, 131, .14); --warn: #e3a948; --warn-soft: rgba(227, 169, 72, .14);
    --error: #f2708d; --error-soft: rgba(242, 112, 141, .14);
    --glass: rgba(17, 17, 16, .78);
    --focus: 0 0 0 3px rgba(255, 107, 77, .4);
    --sh-1: 0 0 0 1px rgba(255, 255, 255, .06);
    --sh-2: 0 12px 32px -8px rgba(0, 0, 0, .6), 0 0 0 1px rgba(255, 255, 255, .07);
    --sh-3: 0 30px 80px -10px rgba(0, 0, 0, .7), 0 0 0 1px rgba(255, 255, 255, .08);
}

/* ---------- Editor layout: the sizes its parts share (top bar, inspector, filmstrip, phone bar, stage) ----------
   On the shell, so that what lives outside the editor page (toasts, Knipsi, the selection bar) follows them too. */
.app-shell[data-area="editor"] {
    --header-h: 0px;
    --ed-top-h: 60px;
    --ed-insp-w: 344px;
    --ed-film-h: 100px;
    --ed-bbar-h: 0px;
    --stage-px: 64px;
    --stage-py: 44px;
    /* What lies under the stage (designs strip, filmstrip, the phone's bar) is measured by editor.js and published on the
       shell as --ed-below-h, which Knipsi keeps clear of (AssistantDock.razor.css falls back to --ed-film-h until then). */
}
@media (max-width: 1100px) {
    .app-shell[data-area="editor"] { --ed-insp-w: 300px; }
}
@media (max-width: 760px) {
    /* the phone bar of the editor: toasts and the selection bar sit above it like above the website's bottom bar */
    .app-shell[data-area="editor"] {
        --ed-insp-w: 0px; --ed-film-h: 84px; --ed-bbar-h: calc(60px + env(safe-area-inset-bottom, 0px));
        --bottom-bar-h: var(--ed-bbar-h); --stage-px: 10px; --stage-py: 32px;
    }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; min-height: 100%; }
body {
    background: var(--bg); color: var(--ink);
    font: 400 var(--fs-md)/1.55 var(--font-ui);
    -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
    font-feature-settings: "cv11", "ss01";
}
/* a jump to an anchor (/einstellungen#assistent …) ends below the sticky header; :where keeps it weaker than any
   element's own scroll-margin */
:where([id]) { scroll-margin-top: calc(var(--header-h) + var(--sp-3)); }

h1, h2, h3 { margin: 0 0 .5em; line-height: 1.2; }
h1, h2, .display { font-family: var(--font-display); font-weight: 400; letter-spacing: -.01em; line-height: 1.15; }
h1 { font-size: var(--fs-2xl); }
h2 { font-size: var(--fs-xl); }
h3 { font-family: var(--font-ui); font-size: var(--fs-lg); font-weight: 600; }
p { margin: 0 0 .75em; }
a { color: var(--accent-text); text-underline-offset: 3px; }
img { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid transparent; box-shadow: var(--focus); border-radius: var(--r-sm); }
.eyebrow { font-size: var(--fs-xs); font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.muted { color: var(--ink-2); }
.faint { color: var(--ink-3); }
.num { font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); }
.grow { flex: 1; }

@media (max-width: 760px) {
    h1 { font-size: var(--fs-xl); }
    h2 { font-size: var(--fs-lg); }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition-duration: 0ms !important; animation-duration: 0ms !important; animation-iteration-count: 1 !important; }
}

/* ---------- Icons (Lucide sprite, <Icon Name="…" />) ---------- */
.i { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }
.i-xs { width: 14px; height: 14px; }
.i-sm { width: 16px; height: 16px; }
.i-lg { width: 24px; height: 24px; }
.i-xl { width: 40px; height: 40px; stroke-width: 1.4; }
.i-fill { fill: currentColor; }

/* ---------- Buttons ---------- */
.btn {
    --h: 40px;
    display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: var(--h); min-height: var(--h);
    padding: 0 18px; border-radius: var(--r-pill); border: 0;
    background: var(--surface-2); color: var(--ink); font-weight: 600; font-size: var(--fs-md); line-height: 1.2;
    white-space: nowrap; text-decoration: none; cursor: pointer;
    transition: background var(--t-1), box-shadow var(--t-1), transform var(--t-1), color var(--t-1);
}
.btn:hover { background: var(--surface-3); }
.btn:active { transform: scale(.98); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: default; transform: none; }
.btn .i { width: 18px; height: 18px; }
/* primary: the one red button of a screen */
.btn-primary { background: var(--accent); color: var(--accent-ink); box-shadow: 0 6px 16px -6px rgba(214, 69, 42, .55); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--surface); box-shadow: inset 0 0 0 1px var(--line-strong); }
.btn-secondary:hover { background: var(--surface-2); }
.btn-tonal { background: var(--surface-2); }
.btn-ghost, .btn-quiet { background: transparent; color: var(--ink-2); }
.btn-ghost:hover, .btn-quiet:hover { background: var(--surface-2); color: var(--ink); }
.btn-dark { background: var(--ink); color: var(--bg); }
.btn-dark:hover { background: var(--ink-2); }
/* destructive actions: carmine text, never the accent */
.btn-danger { color: var(--error); }
.btn-danger:hover { background: var(--error-soft); }
.btn-sm, .btn-small { --h: 32px; padding: 0 12px; font-size: var(--fs-sm); gap: 6px; }
.btn-sm .i, .btn-small .i { width: 16px; height: 16px; }
.btn-lg { --h: 48px; padding: 0 24px; }
.btn-icon { width: var(--h); padding: 0; }
.btn-block { width: 100%; }
/* a ghost icon button written by hand (btn btn-ghost btn-icon) looks like the kit's .ib */
.btn-ghost.btn-icon:not(.btn-sm):not(.btn-small):not(.btn-lg) { --h: 36px; }
.btn-ghost.btn-icon:not(.btn-sm):not(.btn-small) .i { width: 19px; height: 19px; }
.link { color: var(--accent-text); font-weight: 600; display: inline-flex; align-items: center; gap: 4px; text-decoration: none; }
.link:hover { text-decoration: underline; }
@media (pointer: coarse) {
    .btn-sm, .btn-small { --h: 40px; }
    .btn-ghost.btn-icon:not(.btn-sm):not(.btn-small):not(.btn-lg) { --h: var(--tap); }
}

/* ---------- Icon button (IconButton): round, see-through, its name as tooltip ---------- */
.ib {
    position: relative; display: inline-grid; place-items: center; width: 36px; height: 36px; flex: none; padding: 0;
    border: 0; border-radius: var(--r-pill); background: transparent; color: var(--ink-2); text-decoration: none; cursor: pointer;
    transition: background var(--t-1), color var(--t-1);
}
.ib:hover { background: var(--surface-2); color: var(--ink); }
.ib[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent-text); }
.ib:disabled, .ib[aria-disabled="true"] { opacity: .4; cursor: default; }
.ib:disabled:hover { background: transparent; color: var(--ink-2); }
.ib .i { width: 19px; height: 19px; }
.ib-sm { width: 32px; height: 32px; }
.ib-sm .i { width: 17px; height: 17px; }
.ib-lg { width: 44px; height: 44px; }
.ib-lg .i { width: 20px; height: 20px; }
/* something waits behind it (a note, a check result) */
.ib .dot { position: absolute; top: 6px; right: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px var(--surface); pointer-events: none; }
@media (pointer: coarse) {
    .ib, .ib-sm { width: var(--tap); height: var(--tap); }
}

/* ---------- Tooltip: data-tip="Rückgängig  Strg Z" (title= is invisible on phones and slow on screens) ----------
   A dark pill under the element (data-tip-up above, data-tip-right beside it), after a short wait on hover, at once on
   keyboard focus, never on touch screens. :where() keeps the relative position weaker than any class, so an element
   placed absolutely or fixed keeps its place. Not for elements inside a scrolling box (it would scroll with the tip). */
:where([data-tip]) { position: relative; }
[data-tip]::after {
    content: attr(data-tip); position: absolute; left: 50%; top: calc(100% + 8px); transform: translate(-50%, 0);
    z-index: var(--z-popover); display: none; padding: 5px 9px; border-radius: var(--r-sm); white-space: pre; pointer-events: none;
    background: var(--inverse); color: var(--inverse-ink); box-shadow: var(--sh-2);
    font: 600 var(--fs-xs)/1.2 var(--font-ui); letter-spacing: 0; text-transform: none;
}
[data-tip-up]::after { top: auto; bottom: calc(100% + 8px); }
[data-tip-right]::after { left: calc(100% + 10px); top: 50%; transform: translate(0, -50%); }
[data-tip-left]::after { left: auto; right: calc(100% + 10px); top: 50%; transform: translate(0, -50%); }
[data-tip]:hover::after, [data-tip]:focus-visible::after { display: block; animation: tip-in var(--t-1) var(--ease) 350ms both; }
[data-tip]:focus-visible::after { animation-delay: 0ms; }
[data-tip][aria-expanded="true"]::after, [data-tip]:disabled::after { display: none; }
/* on the dark stage the tip turns light, so it does not vanish into the background */
.on-stage [data-tip]::after, .lightbox [data-tip]::after { background: var(--stage-ink); color: var(--stage); }
@media (hover: none) {
    [data-tip]::after { display: none !important; }
}
@keyframes tip-in { from { opacity: 0; } }

/* ---------- Brand, save state, separator (top bars) ---------- */
.brand {
    display: inline-grid; place-items: center; width: 34px; height: 34px; flex: none; border-radius: 10px;
    background: var(--accent); color: var(--accent-ink); text-decoration: none;
}
.brand .i { width: 18px; height: 18px; stroke-width: 2; }
.saved { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-xs); color: var(--ink-3); white-space: nowrap; }
.saved::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--good); }
.saved.is-busy::before { background: var(--ink-3); }
/* a failed save: carmine and with its own icon (the dot goes), never by the colour alone */
.saved.is-error { color: var(--error); font-weight: 600; }
.saved.is-error::before { display: none; }
.saved .i { width: 14px; height: 14px; }
.vsep { width: 1px; height: 24px; flex: none; background: var(--line); }

/* ---------- Top bar (TopBar): one bar for the website, the editor and the preview ---------- */
.topbar {
    position: relative; z-index: var(--z-header); display: flex; align-items: center; gap: 10px; min-width: 0; height: 60px; padding: 0 16px;
    background: var(--glass); backdrop-filter: saturate(1.6) blur(18px); -webkit-backdrop-filter: saturate(1.6) blur(18px);
    border-bottom: 1px solid var(--line);
}
.topbar.is-sticky { position: sticky; top: 0; }
.topbar-start, .topbar-context, .topbar-end { display: flex; align-items: center; gap: 10px; min-width: 0; }
.topbar-start { flex: none; }
.topbar-end { flex: none; gap: 6px; margin-left: auto; }
/* the place in the middle holds the crumb; its width decides what the crumb leaves out (container queries) */
.topbar-center { flex: 1; display: flex; justify-content: center; min-width: 0; container-type: inline-size; }
.topbar-end .btn { --h: 36px; padding: 0 12px; font-size: var(--fs-sm); }
.topbar-end .btn .i { width: 17px; height: 17px; }
.topbar-end .badge { height: 18px; padding: 0 6px; }
@media (max-width: 1100px) {
    .topbar .book-pill-meta, .topbar .saved { display: none; }
    .topbar-center { min-width: 160px; }
    .topbar .lbl-md { display: none; }
    .topbar-end .btn.ghost-md { width: 36px; padding: 0; }
}
/* .hide-md/.hide-sm: the class twice, so that it wins against a component's own display rule (a menu button's scoped
   ".menu-button { display: inline-block }" has the same weight and comes later, from the components' bundle) */
@media (max-width: 900px) {
    .topbar-end .btn-primary { width: 36px; padding: 0; }
    .topbar-end .btn-primary .lbl { display: none; }
    .topbar .hide-md.hide-md { display: none; }
}
@media (max-width: 760px) {
    .topbar { flex-wrap: wrap; row-gap: 6px; height: auto; min-height: 56px; padding: 8px 12px; }
    .topbar .hide-sm.hide-sm { display: none; }
    .topbar-end .btn-primary { --h: 40px; width: 40px; }
    .topbar-center { order: 9; flex-basis: 100%; min-width: 0; }
    .topbar-center .crumb, .topbar-center .crumb-host .popover { width: 100%; }
}

/* ---------- Crumb (Crumb): "where am I", a pill that opens the jump menu ---------- */
/* the host is the container the crumb measures: it takes the room it is given (a flex item grows into it) */
.crumb-host { flex: 1 1 auto; min-width: 0; max-width: 100%; container-type: inline-size; }
.crumb-host .popover { min-width: 0; max-width: 100%; vertical-align: top; }
.topbar-center > .crumb-host { display: flex; justify-content: center; }
.crumb {
    display: inline-flex; align-items: center; gap: 6px; min-width: 0; max-width: 100%; height: 36px; padding: 0 8px 0 14px; overflow: hidden;
    border: 0; border-radius: var(--r-pill); background: var(--surface-2); color: var(--ink-2); font-size: var(--fs-sm); text-align: left;
    white-space: nowrap; cursor: pointer; transition: background var(--t-1);
}
.crumb:hover { background: var(--surface-3); }
.crumb.is-static { cursor: default; padding-right: 14px; }
.crumb.is-static:hover { background: var(--surface-2); }
.crumb .c-part { flex: none; }
.crumb .c-strong { color: var(--ink); font-weight: 600; }
.crumb .c-sep { flex: none; color: var(--ink-3); }
.crumb .c-place { flex: 0 1 auto; min-width: 2em; overflow: hidden; text-overflow: ellipsis; }
.crumb .c-pos { flex: none; color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.crumb .c-extra { flex: none; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.crumb .i { width: 16px; height: 16px; color: var(--ink-3); }
/* Narrower, the crumb leaves things out instead of cutting off its words: first the addition, then the place; what is
   still too long of the position ends in "…"; where even day and position do not fit (a long book name beside it), the
   bold part goes too - but only where a mark in front of it still names the chapter or day. */
@container (max-width: 470px) {
    .crumb .c-extra { display: none; }
}
@container (max-width: 330px) {
    .crumb .c-place, .crumb .c-place + .c-sep { display: none; }
    .crumb .c-pos { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
}
@container (max-width: 290px) {
    .crumb:has(.c-mark):has(.c-pos) .c-strong, .crumb:has(.c-mark):has(.c-pos) .c-strong + .c-sep { display: none; }
}
/* the mark of a chapter or day: its colour, a short sign on it */
.c-mark {
    display: inline-grid; place-items: center; flex: none; min-width: 22px; height: 22px; padding: 0 5px; border-radius: 6px;
    background: var(--ink-3); color: var(--on-photo); font: 600 11px/1 var(--font-ui);
}
.jump-pop { width: min(380px, calc(100vw - 24px)); max-width: min(380px, calc(100vw - 24px)); }
.jump-item {
    display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: var(--r-sm);
    background: none; color: var(--ink); text-align: left; text-decoration: none; cursor: pointer;
}
.jump-item:hover, .jump-item:focus-visible { background: var(--surface-2); }
.jump-item.is-cur, .jump-item[aria-current="true"] { background: var(--accent-soft); }
.jump-item > .i { color: var(--ink-2); }
.jump-text { flex: 1; min-width: 0; }
.jump-text b { font-weight: 600; }
.jump-item small { display: block; color: var(--ink-3); font-size: var(--fs-xs); }

/* ---------- Page bar (PageBar): the row of tools above the content ---------- */
.pagebar { display: flex; align-items: center; gap: 8px; min-width: 0; padding: 12px 20px 0; }
.pagebar.is-sticky {
    position: sticky; top: var(--header-h); z-index: 30; padding: 10px 20px;
    background: var(--glass); backdrop-filter: saturate(1.6) blur(18px); -webkit-backdrop-filter: saturate(1.6) blur(18px);
    border-bottom: 1px solid var(--line);
}
.pagebar-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; font-size: var(--fs-sm); }
.pagebar-title small { margin-left: 6px; font-weight: 400; color: var(--ink-3); font-size: var(--fs-xs); }
.pagebar-tools { display: flex; align-items: center; gap: 2px; flex: none; margin-left: auto; }
.pagebar .btn { --h: 34px; padding: 0 12px; font-size: var(--fs-sm); }
.pagebar .btn .i { width: 17px; height: 17px; }
.pagebar .ib { width: 34px; height: 34px; }
/* a tool's label is its tooltip only while the label itself is hidden */
.pagebar .pb-tool[data-tip]::after { display: none; }
@media (max-width: 1100px) {
    .pagebar .btn:has(.pb-l) { width: 34px; padding: 0; }
    .pagebar .pb-l { display: none; }
    .pagebar .pb-tool[data-tip]:hover::after, .pagebar .pb-tool[data-tip]:focus-visible::after { display: block; }
}
@media (pointer: coarse) {
    .pagebar .btn, .pagebar .ib { --h: var(--tap); height: var(--tap); min-width: var(--tap); }
}
@media (max-width: 760px) {
    .pagebar { padding: 8px 12px 0; }
    .pagebar.is-sticky { padding: 8px 12px; }
}

/* ---------- Chips and badges ---------- */
.chip {
    display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: var(--r-pill);
    border: 0; background: var(--surface-2); color: var(--ink-2); font-size: var(--fs-sm); font-weight: 600; white-space: nowrap;
    text-decoration: none; cursor: pointer; transition: background var(--t-1), color var(--t-1);
}
.chip:hover { background: var(--surface-3); color: var(--ink); }
.chip[aria-pressed="true"], .chip.is-on { background: var(--ink); color: var(--bg); }
.chip .count { font-weight: 400; opacity: .7; }
.chip .i { width: 16px; height: 16px; }
/* chips in a bar (page bar, inspector, filter rows) are a step smaller */
.chip-sm, .pagebar .chip, .chip-row .chip { height: 28px; padding: 0 10px; font-size: var(--fs-xs); }
.chip-row { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
@media (pointer: coarse) {
    .chip { min-height: var(--tap); }
    .chip-sm, .pagebar .chip, .chip-row .chip { height: var(--tap); }
}
.badge {
    display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: var(--r-pill);
    font-size: var(--fs-xs); font-weight: 600; background: var(--surface-2); color: var(--ink-2); white-space: nowrap;
}
.badge .i { width: 13px; height: 13px; stroke-width: 2.2; }
.badge-accent { background: var(--accent-soft); color: var(--accent-text); }
.badge-good { background: var(--good-soft); color: var(--good); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-error, .badge-bad { background: var(--error-soft); color: var(--error); }
.badge-dark, .badge-solid { background: var(--ink); color: var(--bg); }

/* ---------- Segmented choice and tabs ---------- */
.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-2); border-radius: var(--r-pill); max-width: 100%; overflow-x: auto; }
.seg button, .seg a {
    display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 14px; border: 0; border-radius: var(--r-pill);
    background: transparent; color: var(--ink-2); font-size: var(--fs-sm); font-weight: 600; white-space: nowrap; text-decoration: none;
}
.seg button:hover, .seg a:hover { color: var(--ink); }
.seg [aria-pressed="true"], .seg [aria-current="page"], .seg [aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--sh-1); }
.seg .count { font-weight: 400; color: var(--ink-3); }
/* across the whole width, equal parts (the inspector's tabs "Fotos | Gestalten") */
.seg.is-block { display: flex; width: 100%; }
.seg.is-block > button, .seg.is-block > a { flex: 1 1 0; justify-content: center; min-width: 0; }
/* the underline is drawn inside the tab: nothing reaches below the bar, so it never shows a vertical scroll bar */
.tabs { display: flex; gap: var(--sp-5); border-bottom: 1px solid var(--line); overflow-x: auto; overflow-y: hidden; margin-bottom: var(--sp-5); }
.tab {
    display: inline-flex; align-items: center; gap: 6px; padding: var(--sp-3) 0; border: 0;
    background: none; color: var(--ink-2); font-weight: 600; white-space: nowrap; text-decoration: none; cursor: pointer;
}
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] { color: var(--ink); box-shadow: inset 0 -2px 0 var(--accent); }
.tab .count { font-weight: 400; color: var(--ink-3); }
/* tabs in the look of a segmented choice (Tabs Look="Segmented") */
.seg.tabs-seg { margin-bottom: var(--sp-5); }

/* ---------- Disclosure (Disclosure): a section that folds, its title and a chevron that turns ---------- */
.disclosure { border-top: 1px solid var(--line); }
.disclosure > summary {
    display: flex; align-items: center; gap: 10px; min-height: var(--tap); padding: 14px 16px; cursor: pointer; list-style: none;
    font-weight: 600; font-size: var(--fs-sm); color: var(--ink);
}
.disclosure > summary::-webkit-details-marker { display: none; }
.disclosure > summary > .i { color: var(--ink-2); }
.disclosure > summary > .disclosure-chev { margin-left: auto; color: var(--ink-3); transition: transform var(--t-2) var(--ease); }
.disclosure[open] > summary > .disclosure-chev { transform: rotate(180deg); }
.disclosure-title { min-width: 0; }
.disclosure-body { padding: 0 16px 16px; }

/* ---------- Cards (never a card inside a card) ---------- */
.card { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--sh-1); padding: var(--sp-5); }
.card-flush { padding: 0; overflow: hidden; }
.card-link { transition: box-shadow var(--t-2), transform var(--t-2); }
.card-link:hover { box-shadow: var(--sh-2); transform: translateY(-2px); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); margin-bottom: var(--sp-3); }
.card-title { font-size: var(--fs-lg); font-weight: 600; margin: 0; font-family: var(--font-ui); }
.section { margin-top: var(--sp-7); }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--sp-4); margin-bottom: var(--sp-4); }
.section-head h2 { margin: 0; }
@media (max-width: 760px) {
    .card { padding: var(--sp-4); }
    .card-flush { padding: 0; }
    .section { margin-top: var(--sp-6); }
}

/* ---------- Choice tiles: one look for "this one is chosen" (designs, print shops, a new book's theme) ---------- */
.choice {
    position: relative; display: grid; gap: 6px; min-width: 0; padding: 6px; border: 0; border-radius: var(--r-md);
    background: transparent; color: var(--ink); font: inherit; text-align: left; cursor: pointer;
    transition: background var(--t-1), box-shadow var(--t-1);
}
.choice:hover { background: var(--surface-2); }
.choice.is-card { padding: var(--sp-4); background: var(--surface); box-shadow: var(--sh-1); }
.choice.is-card:hover { box-shadow: var(--sh-2); }
.choice[aria-pressed="true"], .choice[aria-checked="true"], .choice.is-chosen { background: var(--accent-soft); box-shadow: inset 0 0 0 2px var(--accent); }
.choice-meta { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: var(--fs-xs); color: var(--ink-2); }
.choice-num {
    display: inline-grid; place-items: center; flex: none; width: 20px; height: 20px; border-radius: 50%;
    background: var(--surface-3); color: var(--ink); font-size: 11px; font-weight: 600;
}
.choice[aria-pressed="true"] .choice-num, .choice[aria-checked="true"] .choice-num, .choice.is-chosen .choice-num { background: var(--accent); color: var(--accent-ink); }
/* "Aktuell" / "Gewählt": only on the chosen one */
.choice-badge {
    position: absolute; top: 12px; left: 12px; z-index: 1; display: none; align-items: center; gap: 4px; height: 22px; padding: 0 8px;
    border-radius: var(--r-pill); background: var(--accent); color: var(--accent-ink); font-size: 11px; font-weight: 600; box-shadow: var(--sh-2);
}
.choice-badge .i { width: 13px; height: 13px; stroke-width: 2.4; }
.choice[aria-pressed="true"] .choice-badge, .choice[aria-checked="true"] .choice-badge, .choice.is-chosen .choice-badge { display: inline-flex; }

/* look tiles (LookTile): a small picture of a look and its name, instead of a list */
.look-tiles { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.look-tiles.is-4 { grid-template-columns: repeat(4, 1fr); }
.look-tiles.is-3 { grid-template-columns: repeat(3, 1fr); }
.look-tile {
    display: grid; gap: 5px; justify-items: center; align-content: start; min-width: 0; padding: 6px 2px 5px; border: 0; border-radius: var(--r-md);
    background: var(--surface-2); color: var(--ink-2); font: 600 11px/1.2 var(--font-ui); text-align: center; cursor: pointer;
    transition: background var(--t-1), box-shadow var(--t-1);
}
.look-tile:hover { background: var(--surface-3); }
.look-tile[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent-text); box-shadow: inset 0 0 0 2px var(--accent); }
.look-tile:disabled { opacity: .45; cursor: default; }
.lt-pic { position: relative; display: grid; place-items: center; width: 40px; height: 40px; }
.lt-label { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (pointer: coarse) {
    .look-tile { min-height: var(--tap); }
}

/* ---------- Notices: errors in carmine with an icon, hints in amber ---------- */
.notice { display: flex; align-items: flex-start; gap: var(--sp-2); padding: var(--sp-3) var(--sp-4); border-radius: var(--r-md); background: var(--surface-2); color: var(--ink); }
.notice > .i { margin-top: 2px; }
.notice-error { background: var(--error-soft); color: var(--error); }
.notice-warn { background: var(--warn-soft); color: var(--warn); }
.notice-good { background: var(--good-soft); color: var(--good); }

/* ---------- Progress ---------- */
.meter { height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.meter > i { display: block; height: 100%; border-radius: 3px; background: var(--accent); }
.ring { --p: 0; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--accent) calc(var(--p) * 1%), var(--surface-3) 0); }
.ring::after { content: attr(data-label); width: 28px; height: 28px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; font-size: 10px; font-weight: 600; color: var(--ink-2); }
/* four steps: Fotos · Gestalten · Druckerei · Bestellen - done green, the next one in ink (site-start.html), hatched = a
   proposal of the analysis; Start's "Weitermachen" and the book overview draw their own steps in the same colours */
.steps4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.steps4 > i { height: 6px; border-radius: 3px; background: var(--surface-3); }
.steps4 > i.is-done { background: var(--good); }
.steps4 > i.is-now { background: var(--ink); }
.steps4 > i.is-ai { background: repeating-linear-gradient(135deg, var(--good) 0 3px, var(--good-soft) 3px 6px); }

/* ---------- "Im Buch" mark: a filled accent circle with a white ring, visible on red motifs too ---------- */
.inbook-mark {
    display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%;
    background: var(--accent); color: var(--on-photo); box-shadow: 0 0 0 2px var(--on-photo), 0 1px 4px rgba(0, 0, 0, .35);
}
.inbook-mark .i { width: 14px; height: 14px; stroke-width: 2.2; }
.inbook-mark.is-missing { background: rgba(0, 0, 0, .35); border: 1.5px dashed var(--on-photo); box-shadow: none; }

/* ---------- Popover and menu (MenuButton, BookPill, Crumb) ---------- */
.pop {
    position: absolute; z-index: var(--z-popover); min-width: 220px; max-width: min(360px, calc(100vw - 24px));
    max-height: min(70vh, 512px); overflow-y: auto; padding: 6px;
    background: var(--surface); color: var(--ink); border-radius: var(--r-md); box-shadow: var(--sh-3); animation: pop-in var(--t-2) var(--ease);
}
.popover { position: relative; display: inline-block; max-width: 100%; }
.popover > .pop { top: calc(100% + 8px); }
.pop-right { right: 0; }
.pop-left { left: 0; }
.menu-group { padding: 8px 10px 4px; font-size: var(--fs-xs); font-weight: 600; color: var(--ink-3); letter-spacing: .06em; text-transform: uppercase; }
.menu-sep { height: 1px; background: var(--line); margin: 6px 4px; }

/* ---------- Toast (ToastHost) ---------- */
@keyframes toast-in { from { opacity: 0; transform: translateY(12px) scale(.98); } }

/* ---------- Scrim, side panel and sheet ---------- */
.scrim { position: fixed; inset: 0; z-index: var(--z-sheet); background: var(--scrim); animation: fade-in var(--t-2) var(--ease); }
.panel {
    position: fixed; z-index: var(--z-sheet); display: flex; flex-direction: column;
    background: var(--surface); color: var(--ink); box-shadow: var(--sh-3); outline: none;
}
.panel-side { top: 12px; right: 12px; bottom: 12px; width: min(420px, calc(100% - 24px)); border-radius: var(--r-lg); animation: slide-in var(--t-3) var(--ease); }
.panel-center {
    left: 50%; top: 50%; width: min(980px, calc(100% - 48px)); max-height: calc(100% - 64px); transform: translate(-50%, -50%);
    border-radius: var(--r-lg); animation: fade-in var(--t-2) var(--ease);
}
.panel-head { display: flex; align-items: center; gap: 10px; min-height: 60px; padding: 12px 12px 12px 20px; border-bottom: 1px solid var(--line); }
.panel-head h2 { margin: 0; font-family: var(--font-ui); font-size: var(--fs-lg); font-weight: 600; letter-spacing: 0; flex: 1; min-width: 0; }
.panel-body { flex: 1; overflow: auto; padding: 20px; }
.panel-foot { display: flex; justify-content: flex-end; gap: var(--sp-2); padding: 12px; border-top: 1px solid var(--line); }
@media (max-width: 760px) {
    .panel-side, .panel-center {
        top: auto; left: 0; right: 0; bottom: 0; width: 100%; max-height: 90%; transform: none;
        border-radius: var(--r-lg) var(--r-lg) 0 0; animation: sheet-up var(--t-3) var(--ease);
    }
    .panel-side { height: min(64vh, 540px); }
    .panel-foot { padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px)); }
}

/* ---------- Floating bars: the dark pill of tools (.float-bar) and the selection bar (.selbar, SelectionBar) ---------- */
.float-bar, .selbar {
    display: inline-flex; align-items: center; gap: 2px; max-width: calc(100vw - 24px); padding: 4px;
    border-radius: var(--r-pill); background: var(--inverse); color: var(--inverse-ink);
    box-shadow: var(--sh-3), 0 0 0 1px color-mix(in srgb, var(--inverse-ink) 6%, transparent);
    font-size: var(--fs-sm); white-space: nowrap;
}
.float-bar .btn, .selbar .btn {
    --h: 36px; gap: 7px; padding: 0 12px 0 10px; background: transparent; color: var(--inverse-ink); font-size: var(--fs-sm);
}
.float-bar .btn .i, .selbar .btn .i { width: 18px; height: 18px; }
.float-bar .btn-icon, .selbar .btn-icon { width: 36px; padding: 0; }
.float-bar .btn:hover, .selbar .btn:hover, .float-bar .ib:hover, .selbar .ib:hover { background: color-mix(in srgb, var(--inverse-ink) 12%, transparent); color: var(--inverse-ink); }
.float-bar [aria-pressed="true"], .float-bar [aria-expanded="true"], .selbar .btn[aria-pressed="true"], .selbar .btn[aria-expanded="true"] { background: var(--inverse-ink); color: var(--inverse); }
.float-bar .btn-primary, .selbar .btn-primary { padding: 0 14px; background: var(--accent); color: var(--accent-ink); box-shadow: none; }
.float-bar .btn-primary:hover, .selbar .btn-primary:hover { background: var(--accent-hover); color: var(--accent-ink); }
.float-bar .ib, .selbar .ib { color: var(--inverse-ink); }
.float-bar kbd, .selbar kbd { background: color-mix(in srgb, var(--inverse-ink) 14%, transparent); color: var(--inverse-ink); }
/* the words beside the icons only with .has-labels, and never on a phone */
.float-bar:not(.has-labels) .lbl { display: none; }
.float-bar-sep, .selbar-sep { width: 1px; align-self: stretch; margin: 6px 3px; background: color-mix(in srgb, var(--inverse-ink) 18%, transparent); }
.selbar {
    position: fixed; z-index: var(--z-selbar); left: 50%; bottom: calc(var(--bottom-bar-h) + 24px); transform: translateX(-50%);
    gap: var(--sp-1); padding: 4px; animation: toast-in var(--t-3) var(--ease);
}
/* "✕ 3 Fotos markiert": the count is the button that ends the marking */
.selbar-count {
    display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px 0 9px; border: 0; border-radius: var(--r-pill);
    background: transparent; color: var(--inverse-ink); font: inherit; font-weight: 600; white-space: nowrap;
    font-variant-numeric: tabular-nums; cursor: pointer; transition: background var(--t-1);
}
.selbar-count:hover { background: color-mix(in srgb, var(--inverse-ink) 12%, transparent); }
.selbar-count .i { width: 18px; height: 18px; }
.selbar-count b { font-weight: 600; }
.selbar [data-tip]::after, .float-bar [data-tip]:not([data-tip-right])::after { top: auto; bottom: calc(100% + 10px); }
@media (pointer: coarse) {
    .float-bar .btn, .selbar .btn { --h: var(--tap); }
    .float-bar .btn-icon, .selbar .btn-icon { width: var(--tap); }
    .selbar-count { height: var(--tap); }
}
@media (max-width: 760px) {
    .float-bar .lbl { display: none; }
    /* the phone's bar: only the number on the way out, closer together; what still does not fit scrolls sideways (a tip
       would scroll with it) */
    .selbar { gap: 0; overflow-x: auto; }
    .selbar-count { padding: 0 10px 0 8px; }
    .selbar-count-l { display: none; }
    .selbar-sep { margin: 6px 2px; }
    .selbar .hide-sm, .float-bar .hide-sm { display: none; }
    .selbar [data-tip]::after { display: none; }
}

/* ---------- The dark stage: surfaces and ink of the stage colours, in both themes (Großansicht, Sichten, Vorschau) ---------- */
.on-stage {
    color-scheme: dark;
    --bg: var(--stage); --surface: var(--stage-2);
    --surface-2: color-mix(in srgb, var(--stage-ink) 7%, transparent); --surface-3: color-mix(in srgb, var(--stage-ink) 13%, transparent);
    --line: color-mix(in srgb, var(--stage-ink) 9%, transparent); --line-strong: color-mix(in srgb, var(--stage-ink) 18%, transparent);
    --ink: var(--stage-ink); --ink-2: var(--stage-ink-2); --ink-3: var(--stage-ink-3);
    --accent-soft: var(--stage-accent-soft); --accent-text: var(--stage-accent-text);
    --sh-1: 0 0 0 1px color-mix(in srgb, var(--stage-ink) 7%, transparent);
    /* a top bar on the stage (the preview) is dark glass, also in the light theme */
    --glass: color-mix(in srgb, var(--stage) 82%, transparent);
    background: var(--bg); color: var(--ink);
}

/* ---------- Dark full view (Großansicht; Sichten is the same building block) ---------- */
.lightbox {
    position: fixed; inset: 0; z-index: var(--z-lightbox); display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto 1fr auto;
    background: var(--stage); color: var(--stage-ink); color-scheme: dark; outline: none;
}
.lightbox-top { grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; min-height: 60px; padding: var(--sp-2) var(--sp-4); }
.lightbox-top > .btn, .lightbox-top > .ib { flex: none; }
.lightbox-title { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lightbox-stage { position: relative; display: grid; place-items: center; min-height: 0; padding: 0 68px; }
.lightbox-stage img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 4px; }
.lightbox-nav { position: absolute; top: 50%; transform: translateY(-50%); }
.lightbox-nav.is-prev { left: 12px; }
.lightbox-nav.is-next { right: 12px; }
.lightbox-bottom { grid-column: 1; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: var(--sp-2); padding: var(--sp-3) var(--sp-4) var(--sp-4); }
.lightbox-aside { grid-row: 2 / 4; grid-column: 2; width: 340px; overflow-y: auto; padding: var(--sp-4); background: var(--stage-2); }
.lightbox .btn { background: color-mix(in srgb, var(--stage-ink) 10%, transparent); color: var(--stage-ink); }
.lightbox .btn:hover { background: color-mix(in srgb, var(--stage-ink) 20%, transparent); }
.lightbox .btn-primary { background: var(--accent); color: var(--accent-ink); }
.lightbox .btn[aria-pressed="true"] { background: var(--stage-ink); color: var(--stage); }
.lightbox .ib { color: var(--stage-ink); }
.lightbox .ib:hover { background: color-mix(in srgb, var(--stage-ink) 14%, transparent); color: var(--stage-ink); }
/* the arrows: round 44 px buttons lying on the stage */
.lightbox .lightbox-nav.ib { width: 44px; height: 44px; background: color-mix(in srgb, var(--stage-ink) 10%, transparent); box-shadow: var(--sh-2); }
.lightbox .lightbox-nav.ib:hover { background: color-mix(in srgb, var(--stage-ink) 20%, transparent); }
.lightbox .lightbox-nav.ib:disabled { opacity: .3; }
.lightbox .muted { color: var(--stage-ink-2); }
.lightbox-progress { height: 3px; background: color-mix(in srgb, var(--stage-ink) 12%, transparent); grid-column: 1 / -1; }
.lightbox-progress > i { display: block; height: 100%; background: var(--accent); transition: width var(--t-3) var(--ease); }
@media (max-width: 760px) {
    .lightbox { grid-template-columns: 1fr; }
    .lightbox-top { min-height: 56px; padding: var(--sp-2) var(--sp-3); }
    .lightbox-stage { padding: 0; }
    .lightbox-aside { display: none; }
    .lightbox-bottom .btn { --h: 44px; }
}

/* ---------- Book object, small cover, book pill ---------- */
.book3d {
    position: relative; aspect-ratio: 297 / 210; border-radius: 3px 8px 8px 3px; overflow: hidden; background: var(--surface-3);
    box-shadow: 0 1px 0 rgba(255, 255, 255, .4) inset, 0 18px 30px -14px rgba(20, 16, 12, .45), 0 4px 8px -2px rgba(20, 16, 12, .18);
}
.book3d img { display: block; width: 100%; height: 100%; object-fit: cover; }
.book3d::before { content: ""; position: absolute; inset: 0 auto 0 0; width: var(--spine, 10px); z-index: 1; background: linear-gradient(90deg, rgba(0, 0, 0, .35), rgba(255, 255, 255, .18) 55%, rgba(0, 0, 0, .12)); }
.book3d::after { content: ""; position: absolute; inset: 0; z-index: 1; background: linear-gradient(115deg, rgba(255, 255, 255, .18), transparent 38%); pointer-events: none; }
.cover-xs { position: relative; width: 40px; height: 28px; flex: none; overflow: hidden; border-radius: 2px 5px 5px 2px; background: var(--surface-3); box-shadow: 0 2px 6px -1px rgba(0, 0, 0, .3); }
.cover-xs img { display: block; width: 100%; height: 100%; object-fit: cover; }
.cover-xs::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; z-index: 1; background: linear-gradient(90deg, rgba(0, 0, 0, .35), rgba(255, 255, 255, .2)); }
.book-pill-wrap { position: relative; min-width: 0; }
.book-pill {
    display: inline-flex; align-items: center; gap: 10px; max-width: 100%; height: 40px; padding: 0 12px 0 6px;
    border: 0; border-radius: var(--r-pill); background: var(--surface); box-shadow: var(--sh-1); color: var(--ink); text-align: left;
}
.book-pill:hover { box-shadow: var(--sh-2); }
.book-pill-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.book-pill-meta { color: var(--ink-3); font-size: var(--fs-sm); white-space: nowrap; }
.book-pill-meta.is-warn { color: var(--warn); font-weight: 600; }
.book-pill .i { color: var(--ink-3); width: 16px; height: 16px; }
.book-pill.is-large { height: 48px; padding: 0 16px 0 8px; font-size: var(--fs-lg); }
.book-pill.is-large .cover-xs { width: 48px; height: 34px; }
.book-pill.is-empty { color: var(--ink-2); }
/* "Nur die Reise": no book is the lens, the pill names the trip */
.book-pill.is-trip-only { padding-left: 12px; }
.book-pill.is-trip-only > .i:first-child { color: var(--ink-2); width: 18px; height: 18px; }
/* phones: only the name, at most half the width */
.book-pill.is-compact { max-width: 50vw; height: 36px; padding: 0 10px 0 12px; }
.book-pill.is-compact .cover-xs, .book-pill.is-compact .book-pill-meta { display: none; }
.book-menu { width: min(340px, calc(100vw - 24px)); }
.book-opt {
    display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: var(--r-sm);
    background: none; color: var(--ink); text-align: left; text-decoration: none; cursor: pointer;
}
.book-opt:hover, .book-opt:focus-visible { background: var(--surface-2); }
.book-opt > .i:first-child { color: var(--ink-2); }
.book-opt-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.book-opt-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.book-opt-meta { font-size: var(--fs-sm); color: var(--ink-3); }
.book-opt-check { color: var(--accent-text); }
.book-opt[aria-checked="false"] .book-opt-check { visibility: hidden; }
.book-opt.is-trip-only > .i:first-child { width: 40px; }

/* ---------- Empty states ---------- */
.empty { display: grid; justify-items: center; gap: 10px; padding: var(--sp-7) var(--sp-5); text-align: center; color: var(--ink-2); }
.empty > .i { width: 40px; height: 40px; color: var(--ink-3); stroke-width: 1.4; }

/* ---------- Inputs ---------- */
input[type=text], input[type=password], input[type=search], input[type=number], input[type=date], input[type=time],
input[type=datetime-local], input[type=email], input[type=url], select, textarea {
    width: 100%; min-height: 40px; padding: 8px 12px; border: 1px solid var(--line-strong); border-radius: var(--r-sm);
    background: var(--surface); color: var(--ink); transition: border-color var(--t-1), box-shadow var(--t-1);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus); }
label { display: block; font-size: var(--fs-sm); color: var(--ink-2); margin: var(--sp-3) 0 var(--sp-1); }
.field { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 14px; border-radius: var(--r-pill); background: var(--surface-2); color: var(--ink-3); }
.field input { border: 0; background: transparent; outline: none; box-shadow: none; color: var(--ink); width: 100%; min-height: 0; padding: 0; }
.switch { position: relative; width: 40px; height: 24px; flex: none; border-radius: 12px; border: 0; background: var(--surface-3); transition: background var(--t-1); }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--surface); box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform var(--t-2) var(--ease); }
.switch[aria-checked="true"] { background: var(--accent); }
.switch[aria-checked="true"]::after { transform: translateX(16px); }
kbd { font: 600 11px/1 var(--font-ui); color: var(--ink-3); background: var(--surface-2); padding: 3px 6px; border-radius: 6px; }

/* ---------- Light and dark (ThemeToggle): the icon follows the scheme that shows, also the system's ---------- */
.theme-toggle .tt-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .tt-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .tt-moon { display: none; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .theme-toggle .tt-sun { display: block; }
    :root:not([data-theme="light"]) .theme-toggle .tt-moon { display: none; }
}

/* ---------- Motion ---------- */
@keyframes fade-in { from { opacity: 0; } }
@keyframes pop-in { from { opacity: 0; transform: translateY(-4px) scale(.98); } }
@keyframes slide-in { from { transform: translateX(calc(100% + 64px)); } }
@keyframes sheet-up { from { transform: translateY(100%); } }

@media print {
    .topbar, .selbar, .float-bar, .toast-host, [data-tip]::after { display: none !important; }
}
