/* bookshelf — mobile first, system fonts only, no framework.
   Direction: literal.club / oku.club, with Apple/Notion restraint. */

:root {
    --bg: #fbfbfa;
    --surface: #ffffff;
    --text: #1d1d1f;
    --muted: #6e6e73;
    --faint: #a1a1a6;
    --hairline: rgba(0, 0, 0, 0.08);
    --fill: rgba(0, 0, 0, 0.04);
    --fill-strong: rgba(0, 0, 0, 0.07);
    --accent: #1d1d1f;
    --on-accent: #ffffff;
    --star: #f2a516;
    --danger: #d70015;
    --focus: rgba(0, 113, 227, 0.45);
    --bar: rgba(251, 251, 250, 0.78);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-cover: 0 1px 1px rgba(0, 0, 0, 0.06), 0 8px 18px -8px rgba(0, 0, 0, 0.28);
    --shadow-cover-hover: 0 2px 4px rgba(0, 0, 0, 0.06), 0 18px 32px -12px rgba(0, 0, 0, 0.35);
    --shadow-pop: 0 10px 40px -10px rgba(0, 0, 0, 0.25), 0 0 0 1px var(--hairline);
    --radius: 14px;
    --radius-cover: 5px;
    --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
    --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --serif: "New York", ui-serif, "Iowan Old Style", "Palatino Linotype", Georgia, serif;
    --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color-scheme: light;
}
@media (prefers-color-scheme: dark) {
    :root {
        --bg: #111112;
        --surface: #1c1c1e;
        --text: #f5f5f7;
        --muted: #98989d;
        --faint: #6e6e73;
        --hairline: rgba(255, 255, 255, 0.1);
        --fill: rgba(255, 255, 255, 0.06);
        --fill-strong: rgba(255, 255, 255, 0.1);
        --accent: #f5f5f7;
        --on-accent: #111112;
        --bar: rgba(17, 17, 18, 0.72);
        --shadow-cover: 0 1px 1px rgba(0, 0, 0, 0.4), 0 10px 22px -8px rgba(0, 0, 0, 0.7);
        --shadow-cover-hover: 0 2px 4px rgba(0, 0, 0, 0.4), 0 20px 36px -12px rgba(0, 0, 0, 0.8);
        --shadow-pop: 0 10px 40px -10px rgba(0, 0, 0, 0.7), 0 0 0 1px var(--hairline);
        color-scheme: dark;
    }
}

/* Smooth cross-page navigation where supported (Chrome, Safari 18+). */
@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 0.22s; animation-timing-function: var(--ease); }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body {
    margin: 0;
    font-family: var(--sans);
    font-size: 15px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100dvh;
}
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.serif { font-family: var(--serif); }

.wrap { width: 100%; max-width: 980px; margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 480px; margin-left: auto; margin-right: auto; }
main { padding: 20px 0 120px; }

/* ---------- Top bar ---------- */
.bar {
    position: sticky;
    top: 0;
    z-index: 20;
    background: var(--bar);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s;
}
.bar.scrolled { border-bottom-color: var(--hairline); }
.bar .wrap { display: flex; align-items: center; justify-content: space-between; height: 56px; gap: 12px; }
.brand { display: inline-flex; align-items: center; gap: 8px; font-family: var(--serif); font-size: 19px; font-weight: 600; letter-spacing: -0.01em; }
.brand-mark { width: 26px; height: 26px; border-radius: 6px; }
@media (prefers-color-scheme: dark) { .brand-mark, .auth-mark { filter: invert(1); } }
.bar-actions { display: flex; align-items: center; gap: 8px; }

/* Avatar + menu (a <details>, so it works without JS) */
.avatar {
    --hue: 30;
    display: inline-grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    user-select: none;
    background: var(--fill-strong);
    box-shadow: 0 0 0 1px var(--hairline);
}
.avatar.monogram {
    font-family: var(--serif);
    font-weight: 600;
    font-size: 17px;
    color: hsl(var(--hue) 28% 30%);
    background: radial-gradient(120% 120% at 30% 20%, hsl(var(--hue) 40% 96%), hsl(var(--hue) 30% 86%));
    box-shadow: inset 0 0 0 1.5px hsl(var(--hue) 25% 35% / 0.35);
}
.avatar.sm { width: 32px; height: 32px; font-size: 14px; }
.avatar.lg { width: 84px; height: 84px; font-size: 36px; box-shadow: 0 0 0 1px var(--hairline), var(--shadow-cover); }
.avatar.pop { animation: pop-in 0.4s var(--spring); }
@media (prefers-color-scheme: dark) {
    .avatar.monogram { color: hsl(var(--hue) 30% 85%); background: radial-gradient(120% 120% at 30% 20%, hsl(var(--hue) 18% 30%), hsl(var(--hue) 15% 20%)); box-shadow: inset 0 0 0 1.5px hsl(var(--hue) 30% 80% / 0.25); }
}
.menu { position: relative; }
.menu > summary { list-style: none; cursor: pointer; border-radius: 50%; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-panel {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    min-width: 200px;
    padding: 6px;
    background: var(--surface);
    border-radius: 12px;
    box-shadow: var(--shadow-pop);
    transform-origin: top right;
    animation: pop-in 0.18s var(--ease);
}
.menu-panel a, .menu-panel button {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 9px 12px;
    border: 0;
    background: none;
    text-align: left;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
}
.menu-panel a:hover, .menu-panel button:hover { background: var(--fill); }
.menu-panel .icon { color: var(--muted); }
.menu-panel .menu-head { gap: 10px; padding: 8px 12px 8px 10px; margin-bottom: 2px; }
.menu-head b { display: block; font-size: 14px; line-height: 1.2; }
.menu-head span { font-size: 12.5px; color: var(--muted); }
.menu-panel hr { border: 0; border-top: 1px solid var(--hairline); margin: 6px 4px; }
.menu-panel form { margin: 0; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    height: 38px;
    padding: 0 16px;
    border-radius: 999px;
    border: 0;
    background: var(--accent);
    color: var(--on-accent);
    font-weight: 500;
    font-size: 14px;
    cursor: pointer;
    white-space: nowrap;
    transition: transform 0.15s var(--ease), opacity 0.15s, background 0.15s;
    -webkit-tap-highlight-color: transparent;
}
.btn:hover { opacity: 0.88; }
.btn:active { transform: scale(0.96); }
.btn.soft { background: var(--fill-strong); color: var(--text); }
.btn.soft:hover { background: var(--fill-strong); opacity: 0.8; }
.btn.ghost { background: transparent; color: var(--text); box-shadow: inset 0 0 0 1px var(--hairline); }
.btn.lg { height: 50px; font-size: 16px; border-radius: 14px; width: 100%; }
.btn.sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.btn.danger-text { background: none; color: var(--danger); padding: 0; height: auto; }
.btn[aria-busy="true"] { pointer-events: none; opacity: 0.6; }

.fab {
    position: fixed;
    right: 18px;
    bottom: calc(18px + env(safe-area-inset-bottom));
    z-index: 30;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--accent);
    color: var(--on-accent);
    box-shadow: 0 8px 24px -6px rgba(0, 0, 0, 0.45);
    transition: transform 0.2s var(--spring);
    animation: rise 0.5s 0.2s var(--spring) both;
}
.fab:active { transform: scale(0.92); }
.fab svg { width: 24px; height: 24px; }
.desktop-only { display: none; }

/* ---------- Profile ---------- */
.profile-head { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding: 12px 0 8px; animation: fade-up 0.5s var(--ease) both; }
.profile-head h1 { font-family: var(--serif); font-size: 30px; font-weight: 600; letter-spacing: -0.02em; margin: 4px 0 0; line-height: 1.15; }
.handle { color: var(--muted); font-size: 14px; display: inline-flex; align-items: center; gap: 8px; }
.badge { font-size: 12px; padding: 2px 9px; border-radius: 999px; background: var(--fill-strong); color: var(--muted); }
.stats { display: flex; justify-content: center; gap: 26px; margin: 12px 0 0; }
.stat { display: flex; flex-direction: column-reverse; align-items: center; }
.stat dd { margin: 0; font-family: var(--serif); font-size: 22px; font-weight: 600; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat dt { font-size: 12px; color: var(--muted); white-space: nowrap; }
.who { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; }
.bio { margin: 4px 0 0; max-width: 460px; color: var(--text); font-size: 15px; }
.site { display: inline-flex; align-items: center; gap: 5px; font-size: 14px; color: var(--muted); }
.site:hover { color: var(--text); }
.badge { display: inline-flex; align-items: center; gap: 4px; }
.profile-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 18px; animation: fade-up 0.5s 0.06s var(--ease) both; }
.spacer { height: 12px; }
.grid-top { margin-top: 26px; }
.status-chip { font-size: 13px; padding: 3px 10px; border-radius: 999px; background: var(--fill-strong); color: var(--muted); margin-top: 4px; }

/* Segmented control */
.segmented {
    position: relative;
    display: flex;
    gap: 2px;
    padding: 3px;
    margin: 28px auto 8px;
    width: fit-content;
    max-width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
    background: var(--fill-strong);
    border-radius: 11px;
}
.segmented::-webkit-scrollbar { display: none; }
.segmented a {
    position: relative;
    z-index: 1;
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--muted);
    white-space: nowrap;
    transition: color 0.2s;
}
.segmented a .count { color: var(--faint); margin-left: 4px; font-variant-numeric: tabular-nums; }
.segmented a.active { color: var(--text); }
.segmented a.active { background: var(--surface); box-shadow: var(--shadow-sm); }
.segmented .indicator {
    position: absolute;
    top: 3px;
    bottom: 3px;
    left: 0;
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow-sm), 0 0 0 0.5px var(--hairline);
    transition: transform 0.3s var(--ease), width 0.3s var(--ease);
}
.segmented.js-indicator a.active { background: none; box-shadow: none; }

/* Year sections */
.year { display: flex; align-items: baseline; gap: 10px; margin: 36px 0 16px; }
.year h2 { font-family: var(--serif); font-size: 24px; font-weight: 600; letter-spacing: -0.01em; margin: 0; }
.year span { color: var(--faint); font-size: 13px; }
.year::after { content: ""; flex: 1; border-top: 1px solid var(--hairline); transform: translateY(-4px); }

/* Cover grid */
.grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px 14px; }
.card { animation: fade-up 0.5s var(--ease) both; animation-delay: calc(min(var(--i, 0), 14) * 35ms); }
.card-button { display: block; width: 100%; padding: 0; border: 0; background: none; text-align: left; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.cover {
    position: relative;
    aspect-ratio: 2 / 3;
    border-radius: var(--radius-cover);
    background: var(--fill-strong);
    box-shadow: var(--shadow-cover);
    overflow: hidden;
    transition: transform 0.35s var(--ease), box-shadow 0.35s var(--ease);
}
/* Spine highlight and paper edge, so covers read as books. */
.cover::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(90deg, rgba(0, 0, 0, 0.14) 0, rgba(255, 255, 255, 0.18) 2.5%, rgba(255, 255, 255, 0) 6%, rgba(0, 0, 0, 0) 94%, rgba(0, 0, 0, 0.06) 100%);
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06);
    pointer-events: none;
}
.cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity 0.5s var(--ease); }
.cover img.loaded { opacity: 1; }
.cover-fallback small { font-family: var(--sans); font-size: 11px; color: var(--faint); }
.cover-fallback {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
    padding: 12px;
    text-align: center;
    font-family: var(--serif);
    font-size: 13px;
    line-height: 1.25;
    color: var(--muted);
    background: linear-gradient(160deg, var(--fill), var(--fill-strong));
}
@media (hover: hover) {
    .card-button:hover .cover { transform: translateY(-4px) rotate(-0.4deg); box-shadow: var(--shadow-cover-hover); }
}
.card-button:active .cover { transform: scale(0.97); }
.card-meta { padding-top: 10px; }
.card-title { font-size: 13.5px; font-weight: 600; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; letter-spacing: -0.005em; }
.card-author { font-size: 12.5px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-foot { display: flex; align-items: center; gap: 6px; margin-top: 4px; font-size: 11.5px; color: var(--faint); font-variant-numeric: tabular-nums; }
.stars { color: var(--star); letter-spacing: 0.5px; font-size: 11px; }
.stars .off { color: var(--fill-strong); }

/* Simple list (to read) */
.list { list-style: none; margin: 16px 0 0; padding: 0; background: var(--surface); border-radius: var(--radius); box-shadow: 0 0 0 1px var(--hairline); overflow: hidden; }
.list li { animation: fade-up 0.4s var(--ease) both; animation-delay: calc(min(var(--i, 0), 14) * 25ms); }
.list li + li { border-top: 1px solid var(--hairline); }
.list .row-link { display: flex; align-items: center; gap: 12px; padding: 10px 14px; width: 100%; border: 0; background: none; text-align: left; cursor: pointer; }
.list .row-link:hover { background: var(--fill); }
.list .thumb { width: 34px; flex-shrink: 0; border-radius: 3px; }
.list .thumb .cover-fallback { font-size: 0; }
.list .row-text { min-width: 0; }
.list .row-text b { display: block; font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list .row-text span { font-size: 13px; color: var(--muted); }

.empty { text-align: center; padding: 56px 16px; color: var(--muted); animation: fade-up 0.5s var(--ease) both; }
.empty .empty-art { font-size: 40px; margin-bottom: 8px; }
.empty p { margin: 0 0 16px; }

/* ---------- Book sheet (native <dialog>) ---------- */
.sheet {
    border: 0;
    padding: 0;
    margin: auto auto 0;
    width: 100%;
    max-width: 100%;
    max-height: 92dvh;
    border-radius: 22px 22px 0 0;
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--shadow-pop);
    overflow: auto;
    overscroll-behavior: contain;
}
.sheet[open] { animation: sheet-up 0.42s var(--ease); }
.sheet.closing { animation: sheet-down 0.25s var(--ease) forwards; }
.sheet::backdrop { background: rgba(0, 0, 0, 0.35); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); animation: fade 0.3s var(--ease); }
.sheet.closing::backdrop { animation: fade 0.25s var(--ease) reverse forwards; }
.sheet-grip { width: 38px; height: 5px; border-radius: 3px; background: var(--fill-strong); margin: 8px auto 0; }
.sheet-body { padding: 18px 22px calc(28px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; }
.sheet .cover { width: 150px; margin: 6px 0 14px; box-shadow: var(--shadow-cover-hover); }
.sheet .cover img { opacity: 1; }
.sheet h2 { font-family: var(--serif); font-size: 24px; font-weight: 600; line-height: 1.2; letter-spacing: -0.01em; margin: 0; }
.sheet .by { color: var(--muted); margin: 0; }
.sheet .stars { font-size: 18px; margin-top: 4px; }
.sheet dl { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; width: 100%; margin: 18px 0 8px; }
.sheet dl div { background: var(--fill); border-radius: 12px; padding: 10px 6px; }
.sheet dt { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.sheet dd { margin: 2px 0 0; font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
.sheet .sheet-actions { display: flex; gap: 8px; width: 100%; margin-top: 10px; }
.sheet .sheet-actions > * { flex: 1; }
.sheet-close { position: absolute; top: 12px; right: 12px; width: 30px; height: 30px; border-radius: 50%; border: 0; background: var(--fill-strong); color: var(--muted); cursor: pointer; display: grid; place-items: center; }

/* ---------- Toast ---------- */
.toast {
    position: fixed;
    left: 50%;
    bottom: calc(90px + env(safe-area-inset-bottom));
    z-index: 50;
    transform: translateX(-50%);
    padding: 10px 16px;
    border-radius: 999px;
    background: var(--accent);
    color: var(--on-accent);
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 10px 30px -8px rgba(0, 0, 0, 0.4);
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    animation: toast 3.2s var(--ease) forwards;
    pointer-events: none;
}

/* ---------- Forms ---------- */
.page-title { font-family: var(--serif); font-size: 30px; font-weight: 600; letter-spacing: -0.02em; margin: 8px 0 20px; line-height: 1.15; animation: fade-up 0.4s var(--ease) both; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.group { background: var(--surface); border-radius: var(--radius); box-shadow: 0 0 0 1px var(--hairline); padding: 16px; display: flex; flex-direction: column; gap: 14px; animation: fade-up 0.45s var(--ease) both; }
.group-title { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; margin: 0 0 -4px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span, .label { font-size: 13px; font-weight: 500; color: var(--muted); }
.input, .field input:not([type="radio"]):not([type="checkbox"]):not([type="file"]), .field select {
    font: inherit;
    font-size: 16px; /* prevents iOS zoom */
    width: 100%;
    height: 46px;
    padding: 0 14px;
    border-radius: 12px;
    border: 0;
    background: var(--fill);
    color: var(--text);
    box-shadow: inset 0 0 0 1px transparent;
    transition: box-shadow 0.2s, background 0.2s;
    -webkit-appearance: none;
    appearance: none;
}
.input:focus, .field input:focus, .field select:focus { outline: none; background: var(--surface); box-shadow: inset 0 0 0 1.5px var(--accent), 0 0 0 4px var(--fill-strong); }
.field input[type="date"] { min-width: 0; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.hint { font-size: 13px; color: var(--muted); margin: 0; }
.notice { padding: 12px 14px; border-radius: 12px; font-size: 14px; animation: shake 0.4s var(--ease); }
.notice.error { background: rgba(215, 0, 21, 0.08); color: var(--danger); }
.notice.info { background: var(--fill); color: var(--text); animation: fade-up 0.3s var(--ease) both; }

/* Search */
.search { position: relative; }
.search svg { position: absolute; left: 14px; top: 50%; width: 18px; height: 18px; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.search .input::-webkit-search-cancel-button { -webkit-appearance: none; }
.search .input { padding-left: 42px; height: 52px; font-size: 17px; border-radius: 14px; }
.spinner { position: absolute; right: 14px; top: 50%; width: 18px; height: 18px; margin-top: -9px; border-radius: 50%; border: 2px solid var(--fill-strong); border-top-color: var(--muted); animation: spin 0.7s linear infinite; }
.results { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; }
.results li { animation: fade-up 0.3s var(--ease) both; animation-delay: calc(var(--i, 0) * 30ms); }
.results a, .results button { display: flex; align-items: center; gap: 14px; width: 100%; padding: 10px 8px; border: 0; background: none; border-radius: 12px; text-align: left; cursor: pointer; transition: background 0.15s; }
.results a:hover, .results a:focus-visible, .results button:hover, .results button:focus-visible { background: var(--fill); outline: none; }
.results .cover { width: 44px; flex-shrink: 0; border-radius: 3px; }
.results .cover .cover-fallback { font-size: 0; }
.results b { display: block; font-weight: 600; font-size: 15px; line-height: 1.3; }
.results span span { font-size: 13px; color: var(--muted); }
.manual { margin-top: 6px; background: none; border: 0; color: var(--muted); font-size: 14px; cursor: pointer; padding: 8px 0; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--hairline); }

/* Picked book summary */
.picked { display: grid; grid-template-columns: 96px 1fr; gap: 16px; align-items: start; }
.picked .cover { width: 96px; }
.picked .cover img { opacity: 1; }
.cover-tools { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.cover-options { list-style: none; margin: 0; padding: 4px 2px 8px; display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; }
.cover-options li { flex-shrink: 0; scroll-snap-align: start; animation: pop-in 0.3s var(--spring) both; animation-delay: calc(var(--i, 0) * 40ms); }
.cover-options button { padding: 0; border: 0; background: none; cursor: pointer; border-radius: 4px; transition: transform 0.2s var(--ease); }
.cover-options button:active { transform: scale(0.95); }
.cover-options img { width: 58px; height: 87px; object-fit: cover; border-radius: 4px; box-shadow: var(--shadow-cover); }
.cover-options button[aria-pressed="true"] img { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent); }

/* Status pills */
.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pills label { cursor: pointer; }
.pills input { position: absolute; opacity: 0; pointer-events: none; }
.pills span { display: inline-block; padding: 8px 14px; border-radius: 999px; background: var(--fill); font-size: 14px; font-weight: 500; color: var(--muted); transition: background 0.2s, color 0.2s, transform 0.2s var(--spring); }
.pills input:checked + span { background: var(--accent); color: var(--on-accent); }
.pills input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
.pills label:active span { transform: scale(0.95); }

/* Star rating (radios, reversed so ~ lights up the lower stars) */
.rate { display: flex; align-items: center; justify-content: space-between; }
.stars-input { display: inline-flex; flex-direction: row-reverse; }
.stars-input input { position: absolute; opacity: 0; pointer-events: none; }
.stars-input label { font-size: 34px; line-height: 1; padding: 0 3px; color: var(--fill-strong); cursor: pointer; transition: color 0.15s, transform 0.25s var(--spring); -webkit-tap-highlight-color: transparent; }
.stars-input input:checked ~ label { color: var(--star); }
@media (hover: hover) {
    .stars-input:hover label { color: var(--fill-strong); }
    .stars-input label:hover, .stars-input label:hover ~ label { color: var(--star) !important; }
}
.stars-input input:checked + label { animation: star-pop 0.4s var(--spring); }
.stars-input input:focus-visible + label { outline: 3px solid var(--focus); border-radius: 6px; }
.clear-rating { font-size: 13px; color: var(--muted); background: none; border: 0; cursor: pointer; }
.clear-rating input { display: none; }

.save-bar { position: sticky; bottom: 0; padding: 12px 0 calc(12px + env(safe-area-inset-bottom)); background: linear-gradient(to top, var(--bg) 70%, transparent); margin-top: 4px; }

/* Settings: iOS-style list rows and switches */
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.setting-row + .setting-row { border-top: 1px solid var(--hairline); padding-top: 14px; }
.setting-row b { display: block; font-weight: 500; font-size: 15px; }
.setting-row small { color: var(--muted); font-size: 13px; }
.digest-row { flex-wrap: wrap; }
.digest-row > div:first-child { flex: 1 1 240px; }
.pills.small span { padding: 6px 12px; font-size: 13px; }
.switch { position: relative; width: 51px; height: 31px; flex-shrink: 0; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--fill-strong); transition: background 0.25s var(--ease); }
.switch span::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15), 0 1px 1px rgba(0, 0, 0, 0.16); transition: transform 0.3s var(--spring); }
.switch input:checked + span { background: #34c759; }
.switch input:checked + span::after { transform: translateX(20px); }
.switch input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
.prefix-input { display: flex; align-items: center; background: var(--fill); border-radius: 12px; padding-left: 14px; }
.prefix-input span { color: var(--faint); font-size: 16px; white-space: nowrap; }
.prefix-input input { padding-left: 2px !important; background: transparent !important; box-shadow: none !important; }
.prefix-input:focus-within { background: var(--surface); box-shadow: inset 0 0 0 1.5px var(--accent), 0 0 0 4px var(--fill-strong); }

/* ---------- Login ---------- */
.auth { min-height: calc(100dvh - 200px); display: flex; flex-direction: column; justify-content: center; max-width: 380px; margin: 0 auto; text-align: center; }
.auth .brand-mark { width: 48px; height: 48px; margin: 0 auto 18px; animation: pop-in 0.5s var(--spring) both; }
.auth h1 { font-family: var(--serif); font-size: 30px; font-weight: 600; letter-spacing: -0.02em; margin: 0 0 6px; }
.auth > p { color: var(--muted); margin: 0 0 26px; }
.auth form { text-align: left; }
.code-input { text-align: center; font-size: 28px !important; letter-spacing: 0.4em; font-variant-numeric: tabular-nums; height: 60px !important; font-weight: 600; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--faint); font-size: 13px; margin: 18px 0; }
.divider::before, .divider::after { content: ""; flex: 1; border-top: 1px solid var(--hairline); }
.google { background: var(--surface) !important; color: var(--text) !important; box-shadow: inset 0 0 0 1px var(--hairline), var(--shadow-sm); }
.fine { font-size: 13px; color: var(--faint); margin-top: 18px; }

/* ---------- Landing ---------- */
.hero { text-align: center; padding: 36px 0 20px; }
.hero h1 { font-family: var(--serif); font-size: clamp(38px, 9vw, 64px); font-weight: 600; letter-spacing: -0.03em; line-height: 1.05; margin: 0 0 16px; animation: fade-up 0.6s var(--ease) both; }
.hero p { font-size: 18px; color: var(--muted); max-width: 440px; margin: 0 auto 28px; animation: fade-up 0.6s 0.08s var(--ease) both; }
.hero .cta { display: flex; gap: 10px; justify-content: center; animation: fade-up 0.6s 0.16s var(--ease) both; }
.fan { position: relative; height: 230px; margin: 48px auto 0; max-width: 360px; }
.fan i { position: absolute; left: 50%; bottom: 0; width: 120px; aspect-ratio: 2/3; border-radius: 5px; box-shadow: var(--shadow-cover-hover); transform-origin: bottom center; animation: fan-in 0.9s var(--spring) both; }
.fan i::after { content: ""; position: absolute; inset: 0; border-radius: inherit; background: linear-gradient(90deg, rgba(0,0,0,.18), rgba(255,255,255,.2) 3%, transparent 7%); }
.fan i:nth-child(1) { background: linear-gradient(160deg, #e9c46a, #d4a24c); --r: -16deg; --x: -150%; animation-delay: 0.25s; }
.fan i:nth-child(2) { background: linear-gradient(160deg, #2a9d8f, #1d6f65); --r: -6deg; --x: -95%; animation-delay: 0.32s; }
.fan i:nth-child(3) { background: linear-gradient(160deg, #264653, #16303a); --r: 4deg; --x: -40%; animation-delay: 0.39s; z-index: 1; }
.fan i:nth-child(4) { background: linear-gradient(160deg, #e76f51, #c0513a); --r: 14deg; --x: 10%; animation-delay: 0.46s; }

/* ---------- Motion ---------- */
@keyframes fade { from { opacity: 0; } }
@keyframes fade-up { from { opacity: 0; transform: translateY(10px); } }
@keyframes rise { from { opacity: 0; transform: translateY(20px) scale(0.8); } }
@keyframes pop-in { from { opacity: 0; transform: scale(0.92); } }
@keyframes sheet-up { from { transform: translateY(100%); } }
@keyframes sheet-down { to { transform: translateY(100%); } }
@keyframes star-pop { 40% { transform: scale(1.35) rotate(-8deg); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
@keyframes toast { 0% { opacity: 0; transform: translate(-50%, 16px) scale(0.96); } 10%, 85% { opacity: 1; transform: translate(-50%, 0); } 100% { opacity: 0; transform: translate(-50%, 8px); } }
@keyframes fan-in { from { opacity: 0; transform: translateX(-50%) translateY(40px) rotate(0); } to { transform: translateX(var(--x)) rotate(var(--r)); } }
.fan i { transform: translateX(var(--x)) rotate(var(--r)); }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.01ms !important; animation-delay: 0ms !important; transition-duration: 0.01ms !important; }
    @view-transition { navigation: none; }
}

/* ---------- Larger screens ---------- */
@media (min-width: 560px) {
    .grid { grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 30px 22px; }
}
@media (min-width: 760px) {
    body { font-size: 15px; }
    main { padding: 32px 0 80px; }
    .desktop-only { display: inline-flex; }
    .fab { display: none; }
    .profile-head { flex-direction: row; text-align: left; align-items: center; gap: 24px; padding-top: 24px; }
    .profile-head .who { flex: 1; align-items: flex-start; }
    .profile-head .stats { gap: 30px; }
    .profile-head h1 { font-size: 36px; }
    .stats { margin: 0; }
    .profile-actions { justify-content: flex-start; }
    .segmented { margin-left: 0; }
    .sheet { margin: auto; max-width: 420px; border-radius: 22px; }
    .sheet[open] { animation: pop-in 0.3s var(--ease); }
    .sheet.closing { animation: fade 0.18s var(--ease) reverse forwards; }
    .sheet-grip { display: none; }
    .toast { bottom: 32px; }
    .page-title { font-size: 36px; }
}

/* ---------- Additions: empty states, landing, shelves, post, forms ---------- */
.spot { color: var(--text); opacity: 0.85; margin: 0 auto 10px; display: block; }
.empty.tall { padding-top: 12vh; }
.empty.tall .page-title { margin-bottom: 6px; }
.empty.tall p { margin-bottom: 22px; }
.center { text-align: center; }
.icon { flex-shrink: 0; }

/* Landing */
.hero { display: grid; gap: 8px; align-items: center; text-align: center; padding: 20px 0 8px; }
.hero-text { animation: fade-up 0.6s var(--ease) both; }
.hero h1 { animation: none; }
.hero p { animation: none; }
.hero .cta { animation: none; flex-wrap: wrap; }
.btn.lg-pill { height: 48px; padding: 0 22px; font-size: 15px; }
.hero-art { width: min(260px, 62vw); height: auto; margin: 12px auto 0; mix-blend-mode: multiply; animation: fade 1.2s 0.2s var(--ease) both, float 7s 1.4s ease-in-out infinite; }
@media (prefers-color-scheme: dark) { .hero-art { filter: invert(1); mix-blend-mode: screen; opacity: 0.9; } }
.announce { display: inline-flex; align-items: center; gap: 8px; margin-top: 22px; padding: 5px 12px 5px 5px; border-radius: 999px; font-size: 13px; color: var(--muted); box-shadow: inset 0 0 0 1px var(--hairline); background: var(--surface); transition: color 0.2s, box-shadow 0.2s; }
.announce span { background: var(--accent); color: var(--on-accent); border-radius: 999px; padding: 1px 8px; font-weight: 600; font-size: 12px; }
.announce:hover { color: var(--text); box-shadow: inset 0 0 0 1px var(--faint); }
.announce .icon { transition: transform 0.2s var(--ease); }
.announce:hover .icon { transform: translateX(3px); }

.shelves { margin-top: 44px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.section-head h2 { font-family: var(--serif); font-size: 26px; font-weight: 600; letter-spacing: -0.015em; margin: 0; }
.live { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--muted); }
.live i { width: 7px; height: 7px; border-radius: 50%; background: #34c759; box-shadow: 0 0 0 0 rgba(52, 199, 89, 0.5); animation: pulse 2s infinite; }
.shelf-list { list-style: none; margin: 0; padding: 0; }
.shelf-row { display: flex; flex-direction: column; gap: 12px; padding: 18px 0; border-bottom: 1px solid var(--hairline); animation: fade-up 0.5s var(--ease) both; animation-delay: calc(min(var(--i, 0), 10) * 60ms); }
.shelf-who { display: flex; align-items: center; gap: 12px; min-width: 0; }
.shelf-who b { display: block; font-weight: 600; font-size: 15px; line-height: 1.25; }
.shelf-who span { font-size: 13px; color: var(--muted); }
.shelf-strip {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding: 4px 2px 10px;
    margin: -4px -2px 0;
    scrollbar-width: none;
    scroll-snap-type: x proximity;
    -webkit-mask-image: linear-gradient(to right, #000 85%, transparent);
    mask-image: linear-gradient(to right, #000 85%, transparent);
}
.shelf-strip::-webkit-scrollbar { display: none; }
.cover.mini { width: 64px; flex-shrink: 0; scroll-snap-align: start; }
.cover.mini .cover-fallback { font-size: 9px; padding: 5px; }
@media (hover: hover) {
    .shelf-strip .cover.mini { transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease); }
    .shelf-row:hover .cover.mini { transform: translateY(-3px); box-shadow: var(--shadow-cover-hover); }
    .shelf-row:hover .cover.mini:nth-child(2) { transition-delay: 30ms; }
    .shelf-row:hover .cover.mini:nth-child(3) { transition-delay: 60ms; }
    .shelf-row:hover .cover.mini:nth-child(4) { transition-delay: 90ms; }
    .shelf-row:hover .cover.mini:nth-child(5) { transition-delay: 120ms; }
}

/* Login */
.auth-mark { width: 56px; height: 56px; margin: 0 auto 20px; border-radius: 12px; animation: pop-in 0.5s var(--spring) both; }
.auth .btn.lg + .divider, .auth .google { margin-top: 0; }

/* Forms: textarea, file labels, link field, cover swap */
.field textarea, textarea.input {
    font: inherit;
    font-size: 16px;
    width: 100%;
    padding: 12px 14px;
    border-radius: 12px;
    border: 0;
    background: var(--fill);
    color: var(--text);
    resize: vertical;
    min-height: 70px;
    transition: box-shadow 0.2s, background 0.2s;
}
.field textarea:focus { outline: none; background: var(--surface); box-shadow: inset 0 0 0 1.5px var(--accent), 0 0 0 4px var(--fill-strong); }
.file-label { cursor: pointer; }
.url-details { display: contents; }
.url-details summary { list-style: none; cursor: pointer; }
.url-details summary::-webkit-details-marker { display: none; }
.url-details[open] .input { flex-basis: 100%; margin-top: 4px; animation: fade-up 0.25s var(--ease); height: 42px; font-size: 15px; }
.cover.swap img { animation: pop-in 0.35s var(--spring); }
.picked .cover-fallback span { font-size: 12px; }
.stack.tight { gap: 10px; }
#cover-status:empty { display: none; }
/* Add a book: the results area has a fixed height, so the page never jumps. */
.finder { display: flex; flex-direction: column; }
.finder-body { height: min(440px, 56dvh); overflow-y: auto; overscroll-behavior: contain; margin: 10px -8px 0; padding: 0 8px; border-bottom: 1px solid var(--hairline); }
.finder .results { margin: 0; }
.finder-idle { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 10px; color: var(--muted); font-size: 14px; max-width: 280px; margin: 0 auto; }
.finder-idle[hidden] { display: none; }
.finder-idle svg { color: var(--faint); }
.finder .manual { align-self: center; margin-top: 14px; }
.finder-modal { overflow-x: hidden; }
.add-step { display: flex; flex-direction: column; gap: 16px; }
.add-step[hidden], .finder[hidden] { display: none; }
.add-step.reveal > * { animation: fade-up 0.35s var(--ease) both; }
.add-step .pills { justify-content: flex-start; }
.finder-modal-body { padding: 18px 20px calc(18px + env(safe-area-inset-bottom)); }
.finder-modal h2 { font-family: var(--serif); font-size: 22px; font-weight: 600; margin: 0 0 14px; }
.finder-modal .finder-body { height: min(440px, 60dvh); }
@media (min-width: 760px) {
    .finder-modal { max-width: 560px; margin: 10vh auto auto; }
}
#book-form.reveal > * { animation: fade-up 0.45s var(--ease) both; }
#book-form.reveal > *:nth-child(2) { animation-delay: 60ms; }
#book-form.reveal > *:nth-child(3) { animation-delay: 120ms; }
.results .cover img { opacity: 1; }
.results .cover img:not(.loaded) { opacity: 0; }
.delete-form { margin-top: 18px; text-align: center; }

/* Settings */
.avatar-edit { display: flex; align-items: center; gap: 18px; }
.sub-settings { display: flex; flex-direction: column; gap: 12px; transition: opacity 0.25s; border-top: 1px solid var(--hairline); padding-top: 14px; }
.sub-settings[data-dim] { opacity: 0.4; }
.setting-row { cursor: default; }
label.setting-row { cursor: pointer; }
.setting-row.compact { padding: 0 !important; border: 0 !important; }
.setting-row.compact b { font-weight: 400; }
.setting-row small { display: block; }
.group.account { margin-top: 16px; }
.group.account form { margin: 0; }

/* Announcement post */
.post { max-width: 640px; margin: 0 auto; animation: fade-up 0.5s var(--ease) both; }
.post-back { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 14px; }
.post-back:hover { color: var(--text); }
.post-date { color: var(--faint); font-size: 13px; margin: 26px 0 6px; }
.post h1 { font-family: var(--serif); font-size: clamp(32px, 7vw, 46px); line-height: 1.08; letter-spacing: -0.025em; margin: 0 0 18px; }
.post .lede { font-size: 19px; line-height: 1.55; color: var(--muted); }
.post h2 { font-family: var(--serif); font-size: 22px; letter-spacing: -0.01em; margin: 38px 0 8px; }
.post p, .post li { font-size: 16.5px; line-height: 1.7; }
.post a:not(.post-back) { text-decoration: underline; text-decoration-color: var(--faint); text-underline-offset: 3px; }
.post-list { padding-left: 20px; }
.post-list li { margin-bottom: 8px; }
.post-list li::marker { color: var(--faint); }
.video { position: relative; aspect-ratio: 16 / 9; border-radius: var(--radius); overflow: hidden; background: #000; box-shadow: var(--shadow-cover-hover); margin: 18px 0; }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.signoff { font-family: var(--serif); font-style: italic; font-size: 18px !important; margin-top: 30px; }

.footer { border-top: 1px solid var(--hairline); margin-top: 40px; padding-bottom: calc(80px + env(safe-area-inset-bottom)); }
.footer-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 28px 20px; padding-top: 34px; padding-bottom: 26px; font-size: 14px; }
.footer-brand { grid-column: 1 / -1; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.footer-brand p { margin: 0; color: var(--muted); }
.footer-promise { color: var(--text) !important; font-weight: 500; }
.footer-brand .btn { margin-top: 6px; }
.footer nav { display: flex; flex-direction: column; gap: 9px; }
.footer nav b { font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--faint); font-weight: 600; margin-bottom: 2px; }
.footer nav a, .footer nav span { color: var(--muted); }
.footer nav a:hover { color: var(--text); text-decoration: none; }
.footer-bottom { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 16px; padding-top: 16px; padding-bottom: 8px; border-top: 1px solid var(--hairline); font-size: 12.5px; color: var(--faint); }
@media (min-width: 760px) {
    .footer { padding-bottom: 20px; }
    .footer-grid { grid-template-columns: 1.4fr 1fr 1fr 1fr; }
    .footer-brand { grid-column: auto; }
}

@keyframes float { 50% { transform: translateY(-6px) rotate(-0.6deg); } }
@keyframes pulse { 70% { box-shadow: 0 0 0 7px rgba(52, 199, 89, 0); } 100% { box-shadow: 0 0 0 0 rgba(52, 199, 89, 0); } }

@media (min-width: 760px) {
    .hero { grid-template-columns: 1.15fr 0.85fr; text-align: left; padding: 48px 0 12px; gap: 32px; }
    .hero p { margin-left: 0; }
    .hero .cta { justify-content: flex-start; }
    .hero-art { width: 100%; max-width: 330px; margin: 0 0 0 auto; }
    .shelf-row { flex-direction: row; align-items: center; gap: 24px; }
    .shelf-who { width: 220px; flex-shrink: 0; }
    .shelf-strip { flex: 1; min-width: 0; }
    .cover.mini { width: 70px; }
}
.auth .divider { margin: 20px 0; }

/* ---------- Book page ---------- */
.book-hero { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 22px; margin: 14px 0 26px; }
.book-cover-lg { width: min(200px, 52vw); animation: pop-in 0.5s var(--ease) both; view-transition-name: book-cover; }
.book-cover-lg .cover { box-shadow: var(--shadow-cover-hover); }
.book-head { animation: fade-up 0.5s 0.05s var(--ease) both; }
.book-head h1 { font-family: var(--serif); font-size: clamp(28px, 6.5vw, 42px); line-height: 1.1; letter-spacing: -0.02em; margin: 0 0 6px; }
.book-head .by { font-size: 17px; color: var(--muted); margin: 0 0 10px; }
.meta { display: flex; align-items: center; justify-content: center; gap: 6px; color: var(--muted); font-size: 14px; margin: 0 0 6px; }
.meta b { color: var(--text); font-weight: 600; }
.chips { list-style: none; padding: 0; margin: 10px 0 0; display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.chips li { font-size: 12.5px; padding: 4px 10px; border-radius: 999px; background: var(--fill); color: var(--muted); text-transform: capitalize; }
.book-grid { display: grid; gap: 14px; }
.book-main, .book-side { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.panel { background: var(--surface); border-radius: var(--radius); box-shadow: 0 0 0 1px var(--hairline); padding: 16px; animation: fade-up 0.45s var(--ease) both; }
.eyebrow { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; margin: 0 0 8px; }
.shelf-cta { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.shelf-cta p { margin: 0; color: var(--muted); }
.mine { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.mine p { margin: 0; }
.mine-line { display: flex; align-items: center; gap: 10px; margin-bottom: 4px !important; }
.mine .stars { font-size: 15px; }
.ratings .rating-main { display: flex; align-items: center; gap: 14px; }
.ratings .big { font-family: var(--serif); font-size: 44px; font-weight: 600; line-height: 1; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stars.lg { font-size: 17px; }
.dist { list-style: none; padding: 0; margin: 14px 0 0; display: flex; flex-direction: column; gap: 5px; }
.dist li { display: grid; grid-template-columns: 12px 1fr 24px; gap: 8px; align-items: center; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.dist i { height: 6px; border-radius: 3px; background: var(--fill-strong); overflow: hidden; }
.dist b { display: block; height: 100%; width: var(--w); border-radius: 3px; background: var(--star); animation: grow 0.9s 0.2s var(--ease) both; transform-origin: left; }
.dist .n { text-align: right; }
.ext { display: flex; align-items: center; gap: 6px; font-size: 13.5px; margin: 14px 0 0; padding-top: 12px; border-top: 1px solid var(--hairline); color: var(--muted); }
.ext b { color: var(--text); }
.match { display: flex; align-items: center; gap: 16px; }
.match.tentative .ring .value { stroke: var(--faint); }
.ring { position: relative; width: 80px; height: 80px; flex-shrink: 0; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 7; stroke-linecap: round; }
.ring .track { stroke: var(--fill-strong); }
.ring .value { stroke: #34c759; stroke-dasharray: var(--c); stroke-dashoffset: var(--off); animation: ring 1.2s 0.2s var(--ease) both; }
.ring b { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--serif); font-size: 24px; font-variant-numeric: tabular-nums; }
.match-label { font-weight: 600; font-size: 16px; margin: 0 0 6px; }
.reasons { margin: 0; padding-left: 18px; font-size: 14px; color: var(--muted); }
.reasons li { margin-bottom: 3px; }
.reasons li::marker { color: var(--faint); }
.h-sm { font-family: var(--serif); font-size: 20px; margin: 10px 0 8px; }
.description { font-size: 16px; line-height: 1.7; max-height: 11.5em; overflow: hidden; position: relative; }
.description::after { content: ""; position: absolute; inset: auto 0 0; height: 3em; background: linear-gradient(transparent, var(--bg)); }
.description.open { max-height: none; }
.description.open::after { display: none; }
.description p { margin: 0 0 12px; }
.more { background: none; border: 0; padding: 0; font-weight: 600; cursor: pointer; }
.readers ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.readers a { display: flex; align-items: center; gap: 10px; padding: 5px 6px; margin: 0 -6px; border-radius: 10px; }
.readers a:hover { background: var(--fill); }
.readers a span:not(.stars):not(.avatar) { flex: 1; font-size: 14px; font-weight: 500; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.book-section { margin-top: 30px; }
.book-section .section-head h2 { font-size: 22px; }
.strip { list-style: none; margin: 12px -16px 0; padding: 4px 16px 10px; display: flex; gap: 14px; overflow-x: auto; scrollbar-width: none; scroll-snap-type: x proximity; scroll-padding-inline: 16px; }
.strip::-webkit-scrollbar { display: none; }
.strip li { width: 104px; flex-shrink: 0; scroll-snap-align: start; animation: fade-up 0.4s var(--ease) both; animation-delay: calc(min(var(--i, 0), 10) * 40ms); }
.strip a { display: block; }
.strip .cover { margin-bottom: 8px; transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease); }
@media (hover: hover) { .strip a:hover .cover { transform: translateY(-3px); box-shadow: var(--shadow-cover-hover); } }
.strip b { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 13px; line-height: 1.3; }
.strip span { display: block; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.strip em { font-style: normal; font-size: 11.5px; color: var(--faint); }
.card-foot .page-link, .sheet .page-link { color: var(--muted); }
@keyframes grow { from { transform: scaleX(0); } }
@keyframes ring { from { stroke-dashoffset: var(--c); } }
@media (min-width: 760px) {
    .book-hero { flex-direction: row; align-items: flex-end; text-align: left; gap: 36px; margin-top: 24px; }
    .book-cover-lg { width: 220px; flex-shrink: 0; }
    .chips, .meta { justify-content: flex-start; }
    .book-grid { grid-template-columns: 1fr 320px; gap: 22px; align-items: start; }
    .strip { margin: 12px 0 0; padding: 4px 0 10px; }
    .strip li { width: 120px; }
}

/* ---------- Social ---------- */
.profile-actions form { margin: 0; display: contents; }
.btn.following .icon { color: #34c759; }
blockquote { margin: 8px 0 0; padding: 8px 12px; border-left: 2px solid var(--hairline); color: var(--text); font-family: var(--serif); font-style: italic; font-size: 15px; line-height: 1.45; background: var(--fill); border-radius: 0 10px 10px 0; }
.sheet-note { text-align: left; width: 100%; margin-top: 12px; }
.sheet-link { font-size: 13.5px; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--hairline); margin: 2px 0 6px; }
.sheet-link:hover { color: var(--text); }
.sheet .sheet-actions > .btn:only-child { flex: 1; }
/* Inline editor in the book sheet */
.sheet-mini { display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; padding: 18px 44px 0 0; }
.sheet .sheet-mini .cover { width: 52px; margin: 0; flex-shrink: 0; box-shadow: var(--shadow-cover); padding: 0; border: 0; cursor: pointer; }
.sheet-mini-text { flex: 1; min-width: 0; }
.sheet .sheet-mini h2 { font-size: 19px; }
.icon-btn { width: 34px; height: 34px; flex-shrink: 0; border-radius: 50%; border: 0; background: var(--fill); color: var(--muted); display: grid; place-items: center; cursor: pointer; transition: background 0.15s, color 0.15s; }
.icon-btn:hover, .icon-btn[aria-expanded="true"] { background: var(--fill-strong); color: var(--text); }
.sheet-details { display: flex; flex-direction: column; gap: 12px; padding: 14px; border-radius: 14px; box-shadow: 0 0 0 1px var(--hairline); animation: fade-up 0.25s var(--ease); }
.sheet-details[hidden] { display: none; }
.sheet-details .cover-tools { margin-top: 0; }
.sheet-remove { align-self: flex-start; padding-left: 0; }
.sheet-edit { display: flex; flex-direction: column; gap: 16px; padding: 4px 22px calc(24px + env(safe-area-inset-bottom)); }
.sheet-edit[hidden] { display: none; }
.sheet-edit.reveal > * { animation: fade-up 0.35s var(--ease) both; }
.sheet-edit .pills { justify-content: flex-start; }
.sheet-edit .sheet-actions { margin-top: 2px; }
.sheet-more { align-self: center; font-size: 13px; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--hairline); }

.both { margin-top: 30px; animation: fade-up 0.5s 0.1s var(--ease) both; }
.both .section-head h2 { font-size: 22px; }
.match-pill { color: #1f8a3b; font-weight: 600; }
@media (prefers-color-scheme: dark) { .match-pill { color: #5fd47e; } }
.pair { display: flex; flex-direction: column; gap: 1px; margin-top: 3px; font-size: 11.5px; color: var(--muted); }
.pair span { display: flex; justify-content: space-between; gap: 4px; white-space: nowrap; overflow: hidden; }
.pair em { font-style: normal; overflow: hidden; text-overflow: ellipsis; }
.pair i { font-style: normal; color: var(--star); font-weight: 600; flex: none; }
.pair i.none { color: var(--faint); font-weight: 400; }
.strip li > div { display: block; }

.home-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 8px 0 20px; animation: fade-up 0.4s var(--ease) both; }
.home-head h1 { font-family: var(--serif); font-size: clamp(26px, 6vw, 36px); letter-spacing: -0.02em; margin: 0; line-height: 1.15; }
.recs, .feed { margin-bottom: 32px; }
.rec-list, .feed-list { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.rec { display: grid; grid-template-columns: 84px 1fr; gap: 16px; padding: 16px; background: var(--surface); border-radius: var(--radius); box-shadow: 0 0 0 1px var(--hairline); animation: fade-up 0.45s var(--ease) both; animation-delay: calc(var(--i, 0) * 50ms); }
.rec.new { box-shadow: 0 0 0 1.5px var(--star), 0 8px 24px -12px rgba(242, 165, 22, 0.5); }
.rec-from { display: flex; align-items: center; gap: 6px; margin: 0; font-size: 13.5px; color: var(--muted); flex-wrap: wrap; }
.rec-from a { display: inline-flex; align-items: center; gap: 6px; color: var(--text); }
.rec-from .avatar.sm { width: 22px; height: 22px; font-size: 11px; }
.rec-title { font-family: var(--serif); font-size: 19px; font-weight: 600; line-height: 1.2; margin: 6px 0 2px; }
.rec-body p { margin-top: 0; margin-bottom: 0; }
.rec-actions { display: flex; align-items: center; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.rec-actions form { margin: 0; }
.feed-empty { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 32px; flex-wrap: wrap; }
.feed-empty p { margin: 0; color: var(--muted); }
.feed-empty b { color: var(--text); font-weight: 600; }
.feed-list li { display: grid; grid-template-columns: 32px 1fr; gap: 12px; padding-bottom: 14px; border-bottom: 1px solid var(--hairline); animation: fade-up 0.4s var(--ease) both; animation-delay: calc(min(var(--i, 0), 10) * 40ms); }
.feed-body > p { margin: 5px 0 8px; font-size: 14px; }
.feed-book { display: flex; gap: 12px; align-items: center; padding: 8px; margin: 0 -8px; border-radius: 12px; transition: background 0.15s; }
.feed-book:hover { background: var(--fill); }
.feed-book .cover { width: 48px; flex-shrink: 0; }
.feed-book b { display: block; font-weight: 600; line-height: 1.3; }
.fb-text { min-width: 0; }
.fb-author { display: block; font-size: 13px; color: var(--muted); }
.fb-text .stars { display: block; margin-top: 2px; }

.rec-head { text-align: center; margin: 18px 0 20px; display: flex; flex-direction: column; align-items: center; }
.rec-head .page-title { font-size: 26px; margin: 14px 0 6px; }
.rec-head p { margin: 0; }
.pick-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px 12px; }
.pick-grid li { animation: fade-up 0.4s var(--ease) both; animation-delay: calc(min(var(--i, 0), 12) * 30ms); }
.pick-grid label { display: block; cursor: pointer; position: relative; }
.pick-grid input { position: absolute; opacity: 0; pointer-events: none; }
.pick-grid .cover { transition: transform 0.25s var(--spring), box-shadow 0.25s var(--ease); }
.pick-grid input:checked + .cover { transform: translateY(-4px) scale(1.03); box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--accent), var(--shadow-cover-hover); }
.pick-grid input:focus-visible + .cover { outline: 3px solid var(--focus); outline-offset: 3px; }
.pick-grid:has(input:checked) input:not(:checked) + .cover { opacity: 0.55; }
.pick-title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 12.5px; font-weight: 600; margin-top: 8px; line-height: 1.3; }
.feed-book .cover-fallback, .list .thumb .cover-fallback { font-size: 0; }
.feed-book .cover-fallback small { display: none; }
.code { margin: 0; padding: 12px 14px; border-radius: 12px; background: var(--fill); font: 12.5px/1.5 ui-monospace, "SF Mono", Menlo, monospace; white-space: pre-wrap; word-break: break-all; }
.hint code { font: 12px ui-monospace, "SF Mono", Menlo, monospace; background: var(--fill); padding: 1px 5px; border-radius: 5px; }
.group.embed { margin-top: 16px; }
.actions-end { display: flex; gap: 8px; }
.profile-actions .menu > summary.btn { border-radius: 999px; }
.profile-actions .menu-panel { left: 0; right: auto; transform-origin: top left; }
.actions-end .menu:last-child .menu-panel { left: auto; right: 0; transform-origin: top right; }
.menu-note { font-size: 12.5px; color: var(--muted); margin: 4px 10px 6px; max-width: 220px; line-height: 1.35; }
@media (min-width: 760px) {
    .profile-actions { align-items: center; }
    .actions-end { margin-left: auto; }
}
.book-section .section-head, .both .section-head, .shelves .section-head { justify-content: flex-start; flex-wrap: wrap; }
.book-section .section-head > span, .both .section-head > span { margin-left: 2px; }
.shelves .section-head .live { margin-left: auto; }
.be-first { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.be-first p { margin: 0; font-size: 15px; }
.see-all { margin-left: auto; display: inline-flex; align-items: center; gap: 4px; font-size: 13.5px; color: var(--muted); }
.see-all:hover { color: var(--text); }
.book-head .by a { color: var(--text); text-decoration: underline; text-decoration-color: var(--hairline); text-underline-offset: 3px; }
.book-head .by a:hover { text-decoration-color: var(--text); }
.ext a { color: var(--muted); }
.ext a:hover { color: var(--text); }
.ext + .ext { border-top: 0; padding-top: 0; margin-top: 8px; }

/* ---------- Author page ---------- */
.author-hero { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 16px; margin: 16px 0 8px; animation: fade-up 0.5s var(--ease) both; }
.author-hero h1 { font-family: var(--serif); font-size: clamp(30px, 7vw, 44px); letter-spacing: -0.02em; line-height: 1.1; margin: 0 0 6px; }
.author-photo { width: 120px; height: 120px; border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 1px var(--hairline), var(--shadow-cover); display: grid; place-items: center; font-family: var(--serif); font-size: 48px; color: var(--muted); background: var(--fill-strong); filter: grayscale(0.2); }
.biblio { margin-top: 14px; }
@media (min-width: 760px) {
    .author-hero { flex-direction: row; text-align: left; gap: 28px; }
    .author-hero .meta { justify-content: flex-start; }
}

/* ---------- Landing: pains ---------- */
.hero-fine { font-size: 14px !important; color: var(--faint) !important; margin: 14px 0 0 !important; }
.trending { margin-top: 44px; }
.pains { display: flex; flex-direction: column; gap: 18px; margin-top: 56px; }
.pain { display: grid; gap: 18px; align-items: center; padding: 22px; background: var(--surface); border-radius: 20px; box-shadow: 0 0 0 1px var(--hairline); animation: fade-up 0.5s var(--ease) both; }
.pain h3 { font-family: var(--serif); font-size: 22px; letter-spacing: -0.01em; line-height: 1.2; margin: 0 0 8px; }
.pain p { margin: 0; color: var(--muted); font-size: 15.5px; line-height: 1.6; }
.pain-art { display: grid; place-items: center; min-height: 150px; background: var(--fill); border-radius: 14px; overflow: hidden; padding: 16px; }
.stack-art { position: relative; width: 190px; height: 130px; }
.stack-art .cover.mini { position: absolute; bottom: 0; width: 70px; left: calc(var(--k) * 30px); transform: rotate(calc((var(--k) - 2) * 5deg)); transform-origin: bottom center; transition: transform 0.4s var(--ease); }
.pain:hover .stack-art .cover.mini { transform: rotate(calc((var(--k) - 2) * 8deg)) translateY(-4px); }
.mock-rec { display: flex; gap: 10px; align-items: center; background: var(--surface); padding: 12px 14px; border-radius: 14px; box-shadow: 0 0 0 1.5px var(--star), 0 10px 26px -12px rgba(242, 165, 22, 0.55); }
.mock-rec b { display: block; font-size: 14px; }
.mock-rec small { color: var(--muted); font-family: var(--serif); font-style: italic; font-size: 14px; }
.mock-embed { background: var(--surface); padding: 12px 14px 8px; border-radius: 14px; box-shadow: var(--shadow-sm), 0 0 0 1px var(--hairline); font-family: var(--serif); font-weight: 600; font-size: 14px; }
.mock-embed .stack-art { height: 110px; width: 170px; margin-top: 6px; }
.mock-embed .stack-art .cover.mini { width: 56px; transform: none; left: calc(var(--k) * 58px); }
.mock-embed .stack-art .cover.mini:nth-child(n+4) { display: none; }
.mock-privacy { display: grid; grid-template-columns: auto auto; gap: 10px 10px; align-items: center; font-size: 14px; font-weight: 500; }
.closing { text-align: center; padding: 56px 0 10px; }
.closing h2 { font-family: var(--serif); font-size: clamp(26px, 6vw, 38px); letter-spacing: -0.02em; line-height: 1.15; margin: 0 auto 20px; max-width: 560px; }
@media (min-width: 760px) {
    .pains { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
    .pain { grid-template-columns: 1fr; }
}

/* ---------- Import ---------- */
.howto summary { cursor: pointer; font-weight: 500; padding: 4px 0; list-style: none; display: flex; align-items: center; justify-content: space-between; }
.howto summary::-webkit-details-marker { display: none; }
.howto summary::after { content: ""; width: 7px; height: 7px; border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted); transform: translateY(-2px) rotate(45deg); transition: transform 0.2s var(--ease); margin-right: 4px; }
.howto[open] summary::after { transform: translateY(1px) rotate(-135deg); }
.narrow > .group + .group { margin-top: 16px; }
.howto + .howto { border-top: 1px solid var(--hairline); padding-top: 10px; }
.howto p { margin: 6px 0 4px; color: var(--muted); font-size: 14px; line-height: 1.6; }
.drop { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 28px 16px; border: 1.5px dashed var(--hairline); border-radius: 14px; cursor: pointer; text-align: center; transition: border-color 0.2s, background 0.2s; }
.drop:hover, .drop.over { border-color: var(--accent); background: var(--fill); }
.drop .icon { color: var(--muted); }
.import-counts { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.import-counts li { font-size: 13px; padding: 4px 10px; border-radius: 999px; background: var(--fill); }
.progress { height: 8px; border-radius: 4px; background: var(--fill-strong); overflow: hidden; }
.progress i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 4px; transition: width 0.4s var(--ease); }
.done-title { font-family: var(--serif); font-size: 20px; margin: 0; }
.empty-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }

/* ---------- Stats ---------- */
.stats-head { display: flex; align-items: center; gap: 14px; margin-top: 14px; }
.stats-head .page-title { margin: 0; }
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 20px 0; }
.tile { background: var(--surface); border-radius: var(--radius); box-shadow: 0 0 0 1px var(--hairline); padding: 16px; animation: fade-up 0.4s var(--ease) both; }
.tile b { display: block; font-family: var(--serif); font-size: 34px; line-height: 1.05; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.tile span { font-size: 13px; color: var(--muted); }
.chart { margin: 0 0 20px; padding: 16px; background: var(--surface); border-radius: var(--radius); box-shadow: 0 0 0 1px var(--hairline); }
.chart figcaption { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 12px; }
.bars { display: flex; align-items: flex-end; gap: 2px; height: 180px; border-bottom: 1px solid var(--hairline); padding-top: 18px; }
.bar-col { position: relative; flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; min-width: 0; outline: none; }
.chart-bar { width: min(100%, 44px); height: var(--h); min-height: 2px; background: var(--accent); border-radius: 4px 4px 0 0; transform-origin: bottom; animation: rise-bar 0.7s var(--ease) both; animation-delay: calc(var(--i) * 45ms); transition: opacity 0.15s; }
.bars:hover .chart-bar { opacity: 0.45; }
.bar-col:hover .chart-bar, .bar-col:focus-visible .chart-bar { opacity: 1; }
.bar-value { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; margin-bottom: 4px; }
.bar-label { position: absolute; bottom: -20px; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.tip { position: absolute; bottom: calc(var(--h, 0%) + 26px); left: 50%; transform: translateX(-50%); background: var(--accent); color: var(--on-accent); font-size: 12px; padding: 4px 8px; border-radius: 6px; white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity 0.15s; z-index: 2; }
.bar-col:hover .tip, .bar-col:focus-visible .tip { opacity: 1; }
.chart { padding-bottom: 34px; }
.stats-grid { display: grid; gap: 14px; }
.rank { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
.rank li { font-size: 14.5px; }
.rank li::marker { color: var(--faint); font-variant-numeric: tabular-nums; }
.rank a { font-weight: 500; }
.rank span { color: var(--muted); font-size: 13px; margin-left: 6px; }
.pace { margin: 0 0 6px; font-size: 14.5px; }
.pace b { display: inline-block; min-width: 64px; font-weight: 600; }
@keyframes rise-bar { from { transform: scaleY(0); } }
@media (min-width: 760px) {
    .tiles { grid-template-columns: repeat(4, 1fr); }
    .stats-grid { grid-template-columns: 1fr 1fr; }
}
.profile-head .stats { cursor: pointer; border-radius: 12px; padding: 6px 8px; margin-right: -8px; transition: background 0.15s; } .profile-head .stats:hover { background: var(--fill); }
.quote-list { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 12px; }
.quote-list li { animation: fade-up 0.45s var(--ease) both; animation-delay: calc(var(--i) * 60ms); }
.quote-list blockquote { margin: 0; padding: 16px 18px; font-size: 17px; line-height: 1.55; border-left: 0; border-radius: var(--radius); background: var(--surface); box-shadow: 0 0 0 1px var(--hairline); position: relative; }
.quote-list blockquote::before { content: "\201C"; position: absolute; top: -6px; left: 12px; font-size: 44px; color: var(--faint); font-family: var(--serif); line-height: 1; }
@media (min-width: 760px) { .quote-list { grid-template-columns: 1fr 1fr; } }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.founder { margin: 22px 0; padding: 18px; border-radius: 20px; background: var(--surface); box-shadow: 0 0 0 1px var(--hairline), var(--shadow-cover); display: flex; flex-direction: column; gap: 16px; }
.founder-who { display: flex; align-items: center; gap: 14px; text-decoration: none !important; }
.founder-who .avatar.lg { width: 64px; height: 64px; }
.founder-who b { display: block; font-family: var(--serif); font-size: 20px; line-height: 1.2; }
.founder-who span { font-size: 14px; color: var(--muted); }
.founder-books { display: flex; gap: 10px; overflow-x: auto; scrollbar-width: none; padding: 2px 2px 8px; text-decoration: none !important; -webkit-mask-image: linear-gradient(to right, #000 85%, transparent); mask-image: linear-gradient(to right, #000 85%, transparent); }
.founder-books::-webkit-scrollbar { display: none; }
.founder-books .cover.mini { width: 62px; flex-shrink: 0; }
.founder-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.founder-actions form { margin: 0; }
.post .founder a { text-decoration: none; }
.live-counter { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; font-size: 14px; color: var(--muted); margin: 18px 0 0; animation: fade-up 0.6s 0.2s var(--ease) both; }
.live-counter i { width: 8px; height: 8px; border-radius: 50%; background: #34c759; box-shadow: 0 0 0 0 rgba(52, 199, 89, 0.5); animation: pulse 2s infinite; margin-right: 2px; }
.live-counter b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.live-counter .sep { color: var(--faint); }
.hidden-stat { opacity: 0.45; border-bottom: 1px dashed var(--faint); cursor: help; }
.admin-hint { font-size: 12px; color: var(--faint); margin: 4px 0 0; }
.home-head + .live-counter { margin: -8px 0 22px; }
.hero .live-counter { justify-content: center; }
@media (min-width: 760px) { .hero .live-counter { justify-content: flex-start; } }

/* ---------- Hero v3 ---------- */
.btn.xl { height: 56px; padding: 0 30px; font-size: 17px; font-weight: 600; border-radius: 999px; margin-top: 6px; box-shadow: 0 10px 28px -12px rgba(0, 0, 0, 0.45); }
.btn.xl:hover { transform: translateY(-1px); opacity: 1; box-shadow: 0 14px 32px -12px rgba(0, 0, 0, 0.5); }
.promise { display: flex; align-items: center; gap: 7px; justify-content: center; font-size: 15px !important; color: var(--text) !important; font-weight: 500; margin: 16px 0 0 !important; }
.promise .icon { color: #34c759; }
.promise.center { justify-content: center; }
.live-pill { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px 6px 10px; border-radius: 999px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--hairline); font-size: 13.5px; color: var(--muted); margin-bottom: 22px; flex-wrap: wrap; justify-content: center; }
.live-pill:hover { box-shadow: inset 0 0 0 1px var(--faint); }
.live-pill > i { width: 8px; height: 8px; border-radius: 50%; background: #34c759; box-shadow: 0 0 0 0 rgba(52, 199, 89, 0.5); animation: pulse 2s infinite; }
.live-pill b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.live-pill .sep { color: var(--faint); }
.faces { display: inline-flex; }
.faces img { width: 22px; height: 22px; border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 2px var(--surface); }
.faces img + img { margin-left: -7px; }
.admin-counters { margin: -6px 0 22px; }
.hero .announce { margin-top: 26px; }

/* ---------- List cards ---------- */
.list-cards { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 14px; }
.list-card { animation: fade-up 0.45s var(--ease) both; animation-delay: calc(var(--i) * 60ms); }
.list-card a { display: grid; grid-template-columns: 150px 1fr; grid-template-rows: auto auto 1fr; column-gap: 16px; align-items: start; padding: 14px; border-radius: 18px; background: var(--surface); box-shadow: 0 0 0 1px var(--hairline); transition: box-shadow 0.2s, transform 0.25s var(--ease); }
.list-card a:hover { box-shadow: 0 0 0 1px var(--faint), var(--shadow-cover); transform: translateY(-2px); }
.list-fan { grid-row: 1 / 4; position: relative; height: 104px; }
.list-fan .cover { position: absolute; top: 0; width: 66px; left: calc(var(--k) * 28px); z-index: calc(4 - var(--k)); transition: transform 0.35s var(--ease); }
.list-card a:hover .list-fan .cover { transform: translateX(calc(var(--k) * 4px)); }
.list-fan .cover-fallback { font-size: 9px; padding: 4px; }
.list-card b { font-family: var(--serif); font-size: 19px; line-height: 1.2; margin-top: 4px; }
.list-card span { font-size: 14px; color: var(--muted); margin-top: 4px; }
.list-card em { font-style: normal; font-size: 12.5px; color: var(--faint); margin-top: 8px; align-self: end; }
@media (min-width: 760px) {
    .list-cards { grid-template-columns: repeat(3, 1fr); }
    .list-card a { grid-template-columns: 1fr; grid-template-rows: auto; height: 100%; }
    .list-fan { grid-row: auto; height: 120px; margin-bottom: 12px; }
    .list-fan .cover { width: 76px; left: calc(var(--k) * 34px); }
    .promise { justify-content: flex-start; }
}
.lists-intro { margin: -10px 0 20px; }
.list-head { margin: 10px 0 22px; }
.list-head .page-title { margin-bottom: 4px; }
.ranked { list-style: none; }
.rank { color: var(--faint); font-variant-numeric: tabular-nums; margin-right: 6px; font-weight: 500; }
.live-inline { display: inline-flex; align-items: center; gap: 6px; padding: 0 9px; border-radius: 999px; background: var(--fill); font-size: 0.92em; white-space: nowrap; font-variant-numeric: tabular-nums; }
.live-inline i { width: 7px; height: 7px; border-radius: 50%; background: #34c759; animation: pulse 2s infinite; }
.post-date a { color: inherit; text-decoration: none !important; }
.post-date a:hover { color: var(--text); }
.list-fan .cover { background: var(--surface); box-shadow: var(--shadow-cover), 0 0 0 1px var(--hairline); }
.list-fan .cover-fallback { font-size: 0; background: linear-gradient(160deg, var(--fill), var(--fill-strong)), var(--surface); }
.list-fan .cover-fallback small { display: none; }

/* Hero title: two lines on desktop, one sentence per line */
@media (min-width: 760px) {
    .hero { grid-template-columns: 1.6fr 0.7fr; }
    .hero h1 { font-size: clamp(44px, 4.6vw, 58px); }
    .hero h1 span { display: block; white-space: nowrap; }
}
.announce { padding: 6px 12px; }
.announce .icon:first-child { color: var(--muted); }
.footer-place { font-size: 13px; color: var(--faint) !important; }
a.cover.mini { display: block; }
.stack-art a.cover.mini:hover { z-index: 10; transform: rotate(0) translateY(-10px) scale(1.06) !important; box-shadow: var(--shadow-cover-hover); }

/* Books drifting by */
.marquee { margin-top: 56px; overflow: hidden; padding-top: 16px; padding-bottom: 24px; -webkit-mask-image: linear-gradient(to right, transparent, #000 8%, #000 92%, transparent); mask-image: linear-gradient(to right, transparent, #000 8%, #000 92%, transparent); }
.marquee-track { display: flex; width: max-content; animation: drift 90s linear infinite; }
.marquee:hover .marquee-track, .marquee:focus-within .marquee-track { animation-play-state: paused; }
.marquee-list { display: flex; gap: 18px; list-style: none; margin: 0; padding: 0 9px; }
.marquee-list .cover { width: 92px; transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease); }
.marquee-list a:hover .cover, .marquee-list a:focus-visible .cover { transform: translateY(-6px) scale(1.04); box-shadow: var(--shadow-cover-hover); }
.marquee-list .cover-fallback { font-size: 10px; }
@keyframes drift { to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) { .marquee-track { animation: none; } .marquee { overflow-x: auto; } }
@media (min-width: 760px) { .marquee-list .cover { width: 108px; } }
html, body { overflow-x: clip; }

.post .lede { font-size: 16.5px; line-height: 1.7; color: var(--text); }
.hero-pills { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: center; margin-bottom: 22px; }
.hero-pills .live-pill { margin-bottom: 0; }
.hero-pills .announce { margin-top: 0; }
.promise span b { font-weight: 700; }
.promise { font-size: 16px !important; }
@media (min-width: 760px) { .hero-pills { justify-content: flex-start; } }
.hero .hero-sub { font-family: var(--serif); font-style: italic; font-size: 21px; color: var(--muted); margin-bottom: 26px; }
.marquee-head { margin-top: 56px; }
.marquee-head h2 { font-family: var(--serif); font-size: 22px; font-weight: 600; letter-spacing: -0.01em; margin: 0; }
.marquee.titled { margin-top: 4px; }
.hero-pills .announce { padding: 6px 12px 6px 14px; }
.faq { max-width: 720px; margin: 56px auto 0; }
.faq details { border-bottom: 1px solid var(--hairline); padding: 4px 0; }
.faq summary { cursor: pointer; list-style: none; padding: 14px 28px 14px 0; font-weight: 600; font-size: 16px; position: relative; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; position: absolute; right: 4px; top: 10px; font-size: 22px; font-weight: 400; color: var(--muted); transition: transform 0.25s var(--ease); }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { margin: 0 0 16px; color: var(--muted); line-height: 1.6; animation: fade-up 0.3s var(--ease); }
.legal h2 { scroll-margin-top: 80px; }
.legal-nav { margin-top: 40px; color: var(--muted); font-size: 14px; }
.footer-legal a { color: var(--faint); }
.footer-legal a:hover { color: var(--text); }
.fine a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.danger-zone { margin-top: 16px; }
.danger-zone summary { cursor: pointer; list-style: none; color: var(--danger); }
.danger-zone summary::-webkit-details-marker { display: none; }
.danger-zone[open] summary { margin-bottom: 8px; }
.btn.danger-btn { background: var(--danger); color: #fff; }
.footer-copy { text-align: center; font-size: 12.5px; color: var(--faint); margin: 0 auto; padding-top: 6px; padding-bottom: 8px; }

/* Dropdowns: the action rows animate in (transform = new stacking context),
   so later content (the book grid) would paint over an open menu. */
.profile-actions, .actions-end { position: relative; z-index: 30; }
.profile-actions .menu[open], .bar .menu[open] { z-index: 40; }
.menu-panel { z-index: 50; }
.bar { z-index: 60; }
.stats a.stat { color: inherit; text-decoration: none; border-radius: 10px; padding: 2px 6px; margin: -2px -6px; transition: background 0.15s; }
.stats a.stat:hover { background: var(--fill); }
.profile-head .stats { cursor: default; padding: 0; margin-right: 0; }
.profile-head .stats:hover { background: none; }

/* ---------- Settings v2 ---------- */
.settings { display: block; }
.settings-nav { display: none; }
.settings-main { max-width: 560px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.settings-main .group { margin: 0 !important; scroll-margin-top: 80px; }
.group-actions { display: flex; justify-content: flex-end; gap: 8px; padding-top: 4px; }
@media (min-width: 900px) {
    .settings { display: grid; grid-template-columns: 180px 1fr; gap: 40px; align-items: start; }
    .settings-nav { display: flex; flex-direction: column; gap: 2px; position: sticky; top: 84px; padding-top: 70px; }
    .settings-nav a { padding: 7px 12px; border-radius: 8px; color: var(--muted); font-size: 14px; }
    .settings-nav a:hover { background: var(--fill); color: var(--text); text-decoration: none; }
    .settings-main { margin: 0; }
}

/* ---------- Charts ---------- */
:root { --h1: #c6e9cf; --h2: #7fd08f; --h3: #3fa95a; --h4: #1f6f35; --line: #2f8f4a; }
@media (prefers-color-scheme: dark) { :root { --h1: #12432a; --h2: #1c6b3b; --h3: #2aa152; --h4: #46d36f; --line: #46d36f; } }
.chart-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.chart-head figcaption { margin: 0; }
.mini-seg { display: inline-flex; padding: 2px; border-radius: 9px; background: var(--fill-strong); }
.mini-seg button { border: 0; background: none; font: inherit; font-size: 12.5px; padding: 4px 10px; border-radius: 7px; color: var(--muted); cursor: pointer; }
.mini-seg button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.heat { display: flex; flex-direction: column; gap: 4px; overflow-x: auto; }
.heat-row { display: grid; grid-template-columns: 40px repeat(12, minmax(14px, 1fr)); gap: 4px; align-items: center; }
.heat-head span { font-size: 11px; color: var(--faint); text-align: center; }
.heat-year { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.heat-cell { display: block; aspect-ratio: 1; max-height: 34px; border-radius: 4px; background: var(--fill-strong); outline-offset: 1px; }
.heat-cell.l1 { background: var(--h1); } .heat-cell.l2 { background: var(--h2); } .heat-cell.l3 { background: var(--h3); } .heat-cell.l4 { background: var(--h4); }
.heat-cell:hover, .heat-cell:focus-visible { outline: 2px solid var(--text); }
.heat-legend { display: flex; align-items: center; gap: 4px; justify-content: flex-end; margin-top: 10px; font-size: 11px; color: var(--faint); }
.heat-legend .heat-cell { width: 12px; height: 12px; }
.line-chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.line-chart .line { fill: none; stroke: var(--line); stroke-width: 2; stroke-linejoin: round; }
.line-chart .area { fill: var(--line); opacity: 0.08; }
.line-chart .dot { fill: var(--surface); stroke: var(--line); stroke-width: 2; }
.line-chart .grid-line { stroke: var(--hairline); }
.line-chart .baseline { stroke: var(--hairline); }
.line-chart .axis { font-size: 12px; fill: var(--muted); font-variant-numeric: tabular-nums; }
.line-chart .pt { cursor: pointer; outline: none; }
.line-chart .pt image { transition: opacity 0.2s; }
.line-chart .pt:hover image, .line-chart .pt:focus-visible image { opacity: 0.85; }
.line-chart .pt:hover .dot, .line-chart .pt:focus .dot { r: 6; }

/* Mobile polish */
.list-fan .cover-fallback span, .list-fan .cover-fallback small { display: none; }
.rank-badge { position: absolute; top: 6px; left: 6px; z-index: 2; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; background: rgba(17, 17, 18, 0.78); color: #fff; font-size: 12px; font-weight: 600; display: grid; place-items: center; font-variant-numeric: tabular-nums; }
.rank a { color: var(--text); }
.hero-pills .announce { max-width: 100%; }
.hero-pills .announce { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: inline-block; }
.hero-pills .announce .icon { vertical-align: -2px; margin-left: 4px; }
@media (max-width: 559px) {
    .hero-pills { flex-direction: column; }
    .hero-pills .announce { font-size: 12.5px; max-width: 92%; }
    .promise { text-align: left; max-width: 300px; margin-left: auto !important; margin-right: auto !important; }
}
.home-head { flex-wrap: wrap; row-gap: 10px; }
.home-head h1 { min-width: 0; overflow-wrap: anywhere; }
.mobile-only { display: inline-block; }
@media (min-width: 760px) { .mobile-only { display: none !important; } }
.menu-burger { width: 34px; height: 34px; border-radius: 50% !important; display: grid; place-content: center; gap: 4px; box-shadow: inset 0 0 0 1px var(--hairline); }
.menu-burger span { display: block; width: 14px; height: 1.5px; background: var(--text); border-radius: 2px; transition: transform 0.2s var(--ease), opacity 0.2s; }
details[open] > .menu-burger span:nth-child(1) { transform: translateY(5.5px) rotate(45deg); }
details[open] > .menu-burger span:nth-child(2) { opacity: 0; }
details[open] > .menu-burger span:nth-child(3) { transform: translateY(-5.5px) rotate(-45deg); }

/* Reading dates: one field, Started → Finished, with a range calendar
   (public/js/date-range.js). */
[data-range].enhanced { display: block; }
[data-range].enhanced > label { display: none; }
.range-field { display: flex; align-items: stretch; gap: 0; background: var(--fill); border-radius: 12px; padding: 4px; }
.range-part { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 1px; padding: 8px 12px; border: 0; background: none; border-radius: 9px; cursor: pointer; text-align: left; color: var(--text); transition: background 0.15s, box-shadow 0.15s; }
.range-part small { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.range-part b { font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
.range-part b.unset { color: var(--faint); font-weight: 500; }
.range-part:hover { background: var(--surface); }
.range-part.active { background: var(--surface); box-shadow: var(--shadow-sm), 0 0 0 1.5px var(--text); }
.range-field.single .range-part { flex: none; min-width: 50%; }
.range-arrow { align-self: center; color: var(--faint); padding: 0 2px; }
.range-summary { margin: 6px 2px 0; font-size: 13px; color: var(--muted); }
.cal { margin-top: 10px; padding: 12px; background: var(--surface); border-radius: 14px; box-shadow: 0 0 0 1px var(--hairline), var(--shadow-sm); animation: fade-up 0.22s var(--ease); }
.cal[hidden] { display: none; }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.cal-label { display: flex; align-items: center; gap: 6px; }
.cal-title { font-family: var(--serif); font-size: 17px; font-weight: 600; }
.cal-year { appearance: none; -webkit-appearance: none; border: 0; background: var(--fill); color: var(--text); font: inherit; font-size: 14px; font-weight: 600; padding: 3px 10px; border-radius: 999px; cursor: pointer; }
.cal-nav { width: 32px; height: 32px; border-radius: 50%; border: 0; background: none; color: var(--text); font-size: 20px; line-height: 1; cursor: pointer; }
.cal-nav:hover { background: var(--fill); }
.cal-nav:disabled { color: var(--faint); cursor: default; background: none; }
.cal-week, .cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.cal-week span { text-align: center; font-size: 11px; color: var(--faint); font-weight: 600; padding: 4px 0; }
.cal-grid { row-gap: 2px; }
.cal-day { position: relative; height: 38px; border: 0; background: none; color: var(--text); font: inherit; font-size: 14px; font-variant-numeric: tabular-nums; cursor: pointer; z-index: 0; }
/* The day's circle sits on top of the range band. */
.cal-day::after { content: ""; position: absolute; inset: 2px; margin: auto; width: 34px; height: 34px; border-radius: 50%; z-index: -1; transition: background 0.12s; }
.cal-day:hover:not(:disabled)::after { background: var(--fill); }
.cal-day.today { font-weight: 700; }
.cal-day.today::before { content: ""; position: absolute; left: 50%; bottom: 5px; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: var(--accent); }
.cal-day.in-range { background: var(--fill); }
.cal-day.has-range.is-start { background: linear-gradient(to right, transparent 50%, var(--fill) 50%); }
.cal-day.has-range.is-end { background: linear-gradient(to left, transparent 50%, var(--fill) 50%); }
.cal-day.is-start, .cal-day.is-end { color: var(--bg); font-weight: 600; }
.cal-day.is-start::after, .cal-day.is-end::after { background: var(--text) !important; }
.cal-day.is-start.today::before, .cal-day.is-end.today::before { background: var(--bg); }
.cal-day:disabled { color: var(--faint); opacity: 0.45; cursor: default; }
.cal-pad { height: 38px; }
.cal-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--hairline); }
.cal-hint { font-size: 12.5px; color: var(--muted); }
.cal-actions { display: flex; align-items: center; gap: 12px; }
.cal-link { border: 0; background: none; color: var(--muted); font: inherit; font-size: 13.5px; cursor: pointer; padding: 4px; }
.cal-link:hover { color: var(--text); }
