/* Windows has no flag emojis (it shows "IE", "BD"...). This small font draws only the flags. */
@font-face {
    font-family: "Twemoji Country Flags";
    unicode-range: U+1F1E6-1F1FF, U+1F3F4, U+E0062-E007F;
    src: url("https://cdn.jsdelivr.net/npm/country-flag-emoji-polyfill@0.1/dist/TwemojiCountryFlags.woff2") format("woff2");
    font-display: swap;
}
/* =====================================================================
   EarBook stylesheet
   1. Design tokens (light + dark)      7. Book page
   2. Base & typography                 8. Mini-player & read-along
   3. Navbar                            9. Earby mascot
   4. Forms & buttons                  10. Auth pages
   5. Flash / badges / progress        11. Admin
   6. Library                          12. Responsive & reduced motion
   ===================================================================== */

/* ---------- 1. Design tokens ---------- */
:root {
    color-scheme: light;
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --primary-soft: #eef2ff;
    --primary-line: #c7d2fe;
    --on-primary: #ffffff;
    --danger: #dc2626;
    --danger-line: #fca5a5;
    --danger-soft: #fef2f2;
    --bg: #f8fafc;
    --bg-tint: radial-gradient(1200px 500px at 85% -10%, #eef2ff 0%, transparent 60%),
               radial-gradient(900px 400px at -10% 10%, #fff7ed 0%, transparent 55%);
    --card-bg: #ffffff;
    --surface-2: #f1f5f9;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --border-strong: #cbd5e1;
    --accent: #f59e0b;
    --accent-soft: #fef3c7;
    --accent-line: #fde68a;
    --accent-text: #92400e;

    --success-bg: #dcfce7; --success-text: #166534;
    --danger-bg: #fee2e2;  --danger-text: #991b1b;
    --warning-bg: #fef3c7; --warning-text: #92400e;
    --info-bg: #dbeafe;    --info-text: #1e40af;
    --good: #16a34a;

    --font-serif: "Twemoji Country Flags", "Literata", Georgia, "Times New Roman", serif;
    --font-sans: "Twemoji Country Flags", "Inter", "Noto Sans Bengali", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
    --shadow-md: 0 4px 14px -4px rgba(15, 23, 42, 0.12);
    --shadow-lift: 0 12px 28px -10px rgba(15, 23, 42, 0.25), 0 2px 6px rgba(15, 23, 42, 0.06);
    --radius: 14px;
    --tap: 44px;

    /* mascot */
    --earby-cover: #4f46e5;
    --earby-spine: #3730a3;
    --earby-pages: #fffaf0;
    --earby-phones: #f59e0b;
    --earby-ink: #1e1b4b;
}

/* Dark theme: used when the user picks it, or when the OS prefers dark and the user hasn't chosen */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        color-scheme: dark;
        --primary: #818cf8; --primary-dark: #a5b4fc; --primary-soft: #1e1b4b; --primary-line: #3730a3; --on-primary: #0b1020;
        --danger: #f87171; --danger-line: #7f1d1d; --danger-soft: #2a1215;
        --bg: #0b1120;
        --bg-tint: radial-gradient(1200px 500px at 85% -10%, #1e1b4b 0%, transparent 60%),
                   radial-gradient(900px 400px at -10% 10%, #1c1408 0%, transparent 55%);
        --card-bg: #111827; --surface-2: #1f2937;
        --text: #e5e7eb; --text-muted: #9ca3af;
        --border: #1f2937; --border-strong: #374151;
        --accent: #fbbf24; --accent-soft: #2a2006; --accent-line: #78350f; --accent-text: #fcd34d;
        --success-bg: #052e16; --success-text: #86efac;
        --danger-bg: #2a1215;  --danger-text: #fca5a5;
        --warning-bg: #2a2006; --warning-text: #fcd34d;
        --info-bg: #0c1a3a;    --info-text: #93c5fd;
        --good: #4ade80;
        --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
        --shadow-md: 0 4px 14px -4px rgba(0, 0, 0, 0.5);
        --shadow-lift: 0 12px 28px -10px rgba(0, 0, 0, 0.7);
        --earby-cover: #6366f1; --earby-spine: #4338ca; --earby-pages: #fef3c7; --earby-ink: #0b1020;
    }
}
:root[data-theme="dark"] {
    color-scheme: dark;
    --primary: #818cf8; --primary-dark: #a5b4fc; --primary-soft: #1e1b4b; --primary-line: #3730a3; --on-primary: #0b1020;
    --danger: #f87171; --danger-line: #7f1d1d; --danger-soft: #2a1215;
    --bg: #0b1120;
    --bg-tint: radial-gradient(1200px 500px at 85% -10%, #1e1b4b 0%, transparent 60%),
               radial-gradient(900px 400px at -10% 10%, #1c1408 0%, transparent 55%);
    --card-bg: #111827; --surface-2: #1f2937;
    --text: #e5e7eb; --text-muted: #9ca3af;
    --border: #1f2937; --border-strong: #374151;
    --accent: #fbbf24; --accent-soft: #2a2006; --accent-line: #78350f; --accent-text: #fcd34d;
    --success-bg: #052e16; --success-text: #86efac;
    --danger-bg: #2a1215;  --danger-text: #fca5a5;
    --warning-bg: #2a2006; --warning-text: #fcd34d;
    --info-bg: #0c1a3a;    --info-text: #93c5fd;
    --good: #4ade80;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 14px -4px rgba(0, 0, 0, 0.5);
    --shadow-lift: 0 12px 28px -10px rgba(0, 0, 0, 0.7);
    --earby-cover: #6366f1; --earby-spine: #4338ca; --earby-pages: #fef3c7; --earby-ink: #0b1020;
}

/* ---------- 2. Base & typography ---------- */
* { box-sizing: border-box; }

body {
    font-family: var(--font-sans);
    background: var(--bg-tint), var(--bg);
    background-attachment: fixed;
    color: var(--text);
    margin: 0;
    line-height: 1.5;
    -webkit-text-size-adjust: 100%;
    transition: background-color 0.25s ease, color 0.25s ease;
}
body.has-player { padding-bottom: 120px; }

h1, .book-card h3, .book-title, .empty-state h2, .brand, .cover-initials, .auth-tagline {
    font-family: var(--font-serif);
    letter-spacing: -0.01em;
}
h1 { font-weight: 700; line-height: 1.2; }
a { color: var(--primary); }
code { background: var(--surface-2); padding: 0.1em 0.35em; border-radius: 4px; font-size: 0.9em; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--primary) 55%, transparent); outline-offset: 2px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: -999px; top: 0.5rem; background: var(--card-bg); padding: 0.5rem 1rem; z-index: 100; border-radius: 8px; }
.skip-link:focus { left: 0.5rem; }

.container { max-width: 920px; margin: 2rem auto; padding: 0 1.5rem; }
.container-wide { max-width: 1100px; }

/* ---------- 3. Navbar ---------- */
.navbar {
    position: sticky; top: 0; z-index: 30;
    display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; flex-wrap: wrap;
    padding: 0.75rem 2rem;
    background: color-mix(in srgb, var(--card-bg) 85%, transparent);
    backdrop-filter: saturate(160%) blur(10px);
    -webkit-backdrop-filter: saturate(160%) blur(10px);
    border-bottom: 1px solid var(--border);
}
.brand { font-size: 1.35rem; font-weight: 700; text-decoration: none; color: var(--text); display: inline-flex; align-items: center; gap: 0.35rem; }
.brand-mark { display: inline-block; transition: transform 0.3s ease; }
.brand:hover .brand-mark { transform: rotate(-12deg) scale(1.1); }
.nav-links { display: flex; align-items: center; gap: 1.1rem; flex-wrap: wrap; }
.nav-links a { text-decoration: none; color: var(--text-muted); font-weight: 500; padding: 0.35rem 0; border-bottom: 2px solid transparent; }
.nav-links a:hover { color: var(--primary); }
.nav-links a.active { color: var(--text); border-bottom-color: var(--accent); }
.nav-user { color: var(--text-muted); }
.theme-toggle {
    width: 38px; height: 38px; border-radius: 50%;
    border: 1px solid var(--border-strong); background: var(--card-bg); cursor: pointer; font-size: 1rem;
    display: inline-flex; align-items: center; justify-content: center;
    transition: transform 0.3s ease;
}
.theme-toggle:hover { transform: rotate(20deg); }
.theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: inline; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme]) .theme-toggle .icon-sun { display: inline; }
    :root:not([data-theme]) .theme-toggle .icon-moon { display: none; }
}

/* ---------- 4. Forms & buttons ---------- */
.auth-card, .upload-box, .chapters-box, .pages-box, .settings-box, .new-book-form {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-sm);
}
.section-title { font-size: 1.1rem; font-weight: 600; margin: 0 0 1rem; }

.form-group { margin-bottom: 1rem; min-width: 0; }
.form-group label { display: block; font-weight: 600; margin-bottom: 0.3rem; font-size: 0.9rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
.field-hint { color: var(--text-muted); font-size: 0.8rem; margin: 0.3rem 0 0; }
.checkbox { display: flex; align-items: center; gap: 0.5rem; font-size: 0.9rem; margin-bottom: 1rem; cursor: pointer; }

.input {
    width: 100%; min-height: 44px;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--border-strong); border-radius: 10px;
    background: var(--card-bg); color: var(--text);
    font-size: 1rem; font-family: inherit;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 18%, transparent); }
.select { appearance: auto; cursor: pointer; }
.select:disabled { opacity: 0.6; cursor: not-allowed; }
.textarea { resize: vertical; line-height: 1.6; min-height: 160px; }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
    min-height: 42px; padding: 0.6rem 1.1rem;
    border: 1px solid transparent; border-radius: 10px;
    font-weight: 600; font-family: inherit; font-size: 0.95rem;
    cursor: pointer; text-decoration: none; white-space: nowrap;
    transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
}
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn.is-busy { opacity: 0.7; cursor: progress; }
.btn-primary { background: var(--primary); color: var(--on-primary); box-shadow: 0 6px 16px -8px var(--primary); }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); }
.btn-secondary { background: var(--primary-soft); color: var(--primary-dark); border-color: var(--primary-line); }
.btn-secondary:hover { border-color: var(--primary); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-outline-danger { background: transparent; color: var(--danger); border-color: var(--danger-line); }
.btn-outline-danger:hover { background: var(--danger-soft); }
.btn-small { min-height: 34px; padding: 0.35rem 0.8rem; font-size: 0.84rem; }
.btn-lg { min-height: 54px; padding: 0.8rem 1.5rem; font-size: 1.05rem; }
.btn-block { width: 100%; }

.btn-link, .btn-link-danger {
    background: none; border: none; padding: 0.4rem 0; min-height: 34px;
    color: var(--text-muted); font: inherit; font-size: 0.84rem; cursor: pointer;
    text-decoration: underline; text-underline-offset: 2px;
}
.btn-link:hover { color: var(--primary); }
.btn-link-danger:hover { color: var(--danger); }
.icon-link { text-decoration: none; margin-left: 0.4rem; padding: 0.2rem 0.4rem; border-radius: 6px; }
.icon-link:hover { background: var(--primary-soft); }

.inline-form { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.auth-switch { margin-top: 1rem; font-size: 0.9rem; color: var(--text-muted); text-align: center; }
.field-error, .inline-error { color: var(--danger); font-size: 0.85rem; margin: 0.4rem 0 0; }

/* Cover picker (new book + settings) */
.cover-picker {
    position: relative; display: flex; align-items: center; justify-content: center;
    width: 120px; aspect-ratio: 3 / 4; flex: 0 0 auto;
    border: 2px dashed var(--border-strong); border-radius: 10px;
    background: var(--surface-2); color: var(--text-muted);
    overflow: hidden; cursor: pointer; text-align: center; font-size: 0.85rem;
    transition: border-color 0.15s ease;
}
.cover-picker:hover, .cover-picker:focus-within { border-color: var(--primary); }
.cover-picker input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.cover-picker img { width: 100%; height: 100%; object-fit: cover; }
.cover-picker-empty { display: flex; flex-direction: column; align-items: center; gap: 0.3rem; pointer-events: none; }
.cover-picker-empty > span:first-child { font-size: 1.6rem; }
.new-book-grid { display: flex; gap: 1.25rem; align-items: flex-start; }
.new-book-fields { flex: 1; min-width: 0; }

/* ---------- 5. Flash / badges / progress ---------- */
.flash-container { margin-bottom: 1.5rem; }
.flash {
    display: flex; justify-content: space-between; align-items: flex-start; gap: 0.75rem;
    padding: 0.75rem 1rem; border-radius: 10px; margin-bottom: 0.5rem; font-size: 0.92rem;
    animation: slide-in 0.35s ease both;
}
.flash-close { background: none; border: none; font-size: 1.2rem; line-height: 1; color: inherit; opacity: 0.6; cursor: pointer; padding: 0 0.2rem; }
.flash-close:hover { opacity: 1; }
.flash-success { background: var(--success-bg); color: var(--success-text); }
.flash-danger  { background: var(--danger-bg);  color: var(--danger-text); }
.flash-warning { background: var(--warning-bg); color: var(--warning-text); }
.flash-info    { background: var(--info-bg);    color: var(--info-text); }
@keyframes slide-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

.badge {
    font-size: 0.72rem; font-weight: 600; padding: 0.15rem 0.55rem; border-radius: 999px;
    background: var(--surface-2); color: var(--text-muted); white-space: nowrap;
}
.badge-good { background: var(--success-bg); color: var(--success-text); }
.badge-fair { background: var(--info-bg); color: var(--info-text); }
.badge-poor { background: var(--warning-bg); color: var(--warning-text); }
.badge-accent { background: var(--primary-soft); color: var(--primary-dark); }
.lang-chip {
    display: inline-flex; align-items: center; gap: 0.25rem;
    font-size: 0.78rem; font-weight: 600; padding: 0.1rem 0.5rem; border-radius: 999px;
    background: var(--surface-2); color: var(--text-muted);
}
.lang-chip-accent { background: var(--accent-soft); color: var(--accent-text); }

.progress { height: 6px; background: var(--surface-2); border-radius: 999px; overflow: hidden; margin: 0.55rem 0 0.35rem; }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, var(--primary), var(--accent)); border-radius: inherit; transition: width 0.4s ease; }
.progress-lg { height: 8px; }

/* ---------- 6. Library ---------- */
.library-hero { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; margin-bottom: 1.25rem; }
.library-hero-text { min-width: 0; }
.hero-sub { color: var(--text-muted); margin: 0.6rem 0 0; }
.accent-heading { position: relative; margin: 0; padding-bottom: 0.35rem; font-size: 2.1rem; }
.accent-heading::after {
    content: ""; position: absolute; left: 0; bottom: 0;
    width: 2.5rem; height: 4px; border-radius: 2px; background: var(--accent);
    transition: width 0.4s ease;
}
.accent-heading:hover::after { width: 4.5rem; }

.new-book { margin-bottom: 1.5rem; }
.new-book > summary { list-style: none; display: inline-flex; }
.new-book > summary::-webkit-details-marker { display: none; }
.new-book[open] > summary { margin-bottom: 0.9rem; }
.new-book-form { animation: slide-in 0.3s ease both; }

.library-tools { margin-bottom: 1rem; }
.search-input { max-width: 340px; padding-left: 2.2rem; background: var(--card-bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%2394a3b8' stroke-width='2' viewBox='0 0 24 24'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") no-repeat 0.75rem center; }

.book-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 1.25rem; }
.book-card {
    background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius);
    overflow: hidden; text-decoration: none; color: var(--text);
    display: flex; flex-direction: column; box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    animation: card-in 0.45s ease both; animation-delay: calc(var(--i, 0) * 50ms);
}
@keyframes card-in { from { opacity: 0; transform: translateY(10px) scale(0.98); } to { opacity: 1; transform: none; } }
.book-card:hover, .book-card:focus-visible { transform: translateY(-3px); box-shadow: var(--shadow-lift); border-color: var(--primary-line); }
.book-card:hover .book-cover img, .book-card:hover .book-cover:not(.has-image) { transform: scale(1.04); }
.book-card-body { padding: 0.85rem 1rem 1rem; }
.book-card h3 { margin: 0 0 0.3rem; font-size: 1.05rem; line-height: 1.3; overflow-wrap: anywhere; }
.book-card p { margin: 0.15rem 0; color: var(--text-muted); font-size: 0.85rem; }
.book-card-meta { display: flex; align-items: center; justify-content: space-between; gap: 0.4rem; flex-wrap: wrap; }
.resume-tag { color: var(--primary) !important; font-weight: 600; }

.book-cover {
    position: relative; aspect-ratio: 3 / 4; overflow: hidden; /* portrait, like a real book */
    display: flex; align-items: center; justify-content: center;
    color: rgba(255, 255, 255, 0.95);
    transition: transform 0.4s ease;
}
.book-cover.has-image { background: var(--surface-2); }
.book-cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.4s ease; }
.book-cover::before { content: ""; position: absolute; top: 0; bottom: 0; left: 10px; width: 3px; background: rgba(255,255,255,0.25); z-index: 1; }
.book-cover::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(255,255,255,0.14), rgba(255,255,255,0) 45%); }
.book-cover.has-image::before { background: rgba(255,255,255,0.35); box-shadow: 1px 0 3px rgba(0,0,0,0.25); }
.cover-initials { font-size: 2.6rem; font-weight: 700; text-shadow: 0 2px 8px rgba(0,0,0,0.18); }

.empty-state { text-align: center; padding: 2.5rem 1.5rem; color: var(--text-muted); background: var(--card-bg); border: 2px dashed var(--border); border-radius: 18px; }
.empty-illustration { width: 180px; max-width: 60%; height: auto; margin-bottom: 0.75rem; }
.empty-waves path { animation: wave-pulse 1.8s ease-in-out infinite; }
.empty-waves path:nth-child(2) { animation-delay: 0.2s; }
.empty-waves path:nth-child(3) { animation-delay: 0.4s; }
@keyframes wave-pulse { 0%, 100% { opacity: 0.3; } 50% { opacity: 1; } }
.empty-state h2 { color: var(--text); margin: 0 0 0.5rem; font-size: 1.35rem; }
.empty-state p { max-width: 440px; margin: 0 auto 1.25rem; line-height: 1.55; }
.how-it-works { list-style: none; padding: 0; margin: 0; display: flex; justify-content: center; gap: 1rem; flex-wrap: wrap; }
.how-it-works li { display: flex; align-items: center; gap: 0.4rem; background: var(--surface-2); padding: 0.45rem 0.85rem; border-radius: 999px; font-size: 0.88rem; color: var(--text); counter-increment: step; }
.how-it-works li::before { content: counter(step); font-weight: 700; color: var(--primary); }
.hint { color: var(--text-muted); font-size: 0.9rem; margin-top: 0.5rem; }

/* ---------- 7. Book page ---------- */
.back-link { display: inline-block; margin-bottom: 1rem; color: var(--text-muted); text-decoration: none; font-size: 0.9rem; padding: 0.3rem 0; }
.back-link:hover { color: var(--primary); }

.book-hero { display: flex; align-items: center; gap: 1.25rem; margin-bottom: 1.5rem; }
.book-hero-info { flex: 1; min-width: 0; }
.book-cover-sm { flex: 0 0 auto; width: 104px; aspect-ratio: 3 / 4; border-radius: 8px; box-shadow: var(--shadow-lift); }
.book-cover-sm .cover-initials { font-size: 1.8rem; }
.book-cover-sm::before { left: 7px; width: 2px; }
.book-title { margin: 0; font-size: 2rem; overflow-wrap: anywhere; }
.book-meta { margin: 0.25rem 0 0; color: var(--text-muted); font-size: 0.9rem; }
.lang-line { display: flex; align-items: center; gap: 0.4rem; margin: 0.5rem 0 0; color: var(--text-muted); }
.hero-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; margin-top: 0.9rem; }
.book-earby { align-self: flex-end; }

.resume-banner {
    display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap;
    padding: 0.75rem 1rem; margin-bottom: 1.5rem;
    background: var(--accent-soft); border: 1px solid var(--accent-line); border-radius: var(--radius); color: var(--accent-text);
}
.resume-progress { opacity: 0.8; }

.upload-box { border-color: var(--primary-line); box-shadow: 0 0 0 4px var(--primary-soft); }
.file-drop {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.5rem;
    min-height: 150px; padding: 1.25rem; margin-bottom: 1rem;
    border: 2px dashed var(--border-strong); border-radius: var(--radius); background: var(--surface-2);
    text-align: center; transition: border-color 0.15s ease, background-color 0.15s ease;
}
.file-drop.is-dragover { border-color: var(--primary); background: var(--primary-soft); }
.file-drop.has-file { border-style: solid; border-color: var(--primary); }
.file-drop.is-busy { opacity: 0.6; pointer-events: none; }
.file-drop-icon { font-size: 1.8rem; line-height: 1; }
.file-drop-text { font-weight: 600; margin: 0; overflow-wrap: anywhere; }
.file-drop-sub { font-size: 0.8rem; color: var(--text-muted); }
.picker-buttons { display: flex; gap: 0.6rem; flex-wrap: wrap; justify-content: center; }
.picker-btn { position: relative; overflow: hidden; }
.picker-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; font-size: 0; }
.thumb-strip { list-style: none; display: flex; flex-wrap: wrap; gap: 0.5rem; padding: 0; margin: 0.25rem 0 0; justify-content: center; }
.thumb-strip:empty { display: none; }
.thumb-strip li { position: relative; width: 64px; animation: slide-in 0.25s ease both; }
.thumb-strip img { width: 64px; height: 84px; object-fit: cover; border-radius: 6px; box-shadow: var(--shadow-sm); display: block; }
.thumb-strip .thumb-num { position: absolute; left: 4px; top: 4px; background: rgba(0,0,0,0.6); color: #fff; font-size: 0.68rem; padding: 0 0.3rem; border-radius: 4px; }
.thumb-strip .thumb-remove { position: absolute; right: -6px; top: -6px; width: 22px; height: 22px; border-radius: 50%; border: none; background: var(--danger); color: #fff; cursor: pointer; font-size: 0.8rem; line-height: 1; }
.thumb-strip li.is-done img { outline: 3px solid var(--good); }
.thumb-strip li.is-active img { outline: 3px solid var(--primary); animation: pulse-outline 1s ease-in-out infinite; }
@keyframes pulse-outline { 50% { outline-color: var(--accent); } }

.processing { display: flex; align-items: center; gap: 1rem; margin-top: 1rem; padding: 0.9rem 1rem; border-radius: 12px; background: var(--primary-soft); color: var(--text); }
.processing-text { flex: 1; min-width: 0; }
.processing p { margin: 0.2rem 0 0; font-size: 0.9rem; color: var(--text-muted); }

.chapters-box > summary, .settings-box > summary { cursor: pointer; margin: 0; }
.chapters-box[open] > summary { margin-bottom: 0.75rem; }
.chapter-list { list-style: none; padding: 0; margin: 0; }
.chapter-list li { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 0.55rem 0; border-bottom: 1px solid var(--border); }
.chapter-list li:last-child { border-bottom: none; }
.chapter-link { color: var(--text); font-weight: 600; text-decoration: none; }
.chapter-link:hover { color: var(--primary); }
.chapter-meta { color: var(--text-muted); font-size: 0.85rem; white-space: nowrap; }

.page-row { border: 1px solid var(--border); border-radius: 12px; padding: 1rem; margin-bottom: 0.75rem; scroll-margin-top: 5rem; transition: border-color 0.2s ease, box-shadow 0.2s ease; }
.page-row:target, .page-row.is-playing { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.page-row-head { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.6rem; }
.page-num { font-weight: 700; }
.chapter-tag { font-size: 0.75rem; font-weight: 600; color: var(--accent-text); background: var(--accent-soft); padding: 0.15rem 0.55rem; border-radius: 999px; }
.audio-player { width: 100%; height: 44px; margin-bottom: 0.4rem; }

.page-row-foot { display: flex; justify-content: space-between; align-items: flex-start; gap: 0.75rem; flex-wrap: wrap; }
.row-actions { display: flex; gap: 1rem; margin-left: auto; }
.inline-action { margin: 0; }
.status-msg { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap; margin: 0 0 0.5rem; padding: 0.6rem 0.8rem; border-radius: 10px; font-size: 0.88rem; }
.status-warn { background: var(--warning-bg); color: var(--warning-text); border: 1px solid var(--accent-line); }
.retry-form { margin: 0; }

.page-text-toggle { font-size: 0.9rem; flex: 1 1 60%; min-width: 0; }
.page-text-toggle > summary { cursor: pointer; color: var(--text-muted); padding: 0.4rem 0; min-height: 34px; }
.page-text-toggle > summary:hover { color: var(--primary); }
.text-panel { display: grid; grid-template-columns: 160px 1fr; gap: 1rem; margin-top: 0.5rem; animation: slide-in 0.25s ease both; }
.page-photo { margin: 0; }
.page-photo img { width: 100%; border-radius: 8px; box-shadow: var(--shadow-sm); background: var(--surface-2); min-height: 120px; object-fit: contain; cursor: zoom-in; }
.page-photo figcaption { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.3rem; text-align: center; }
.edit-actions { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; margin-top: 0.5rem; }
.translated-block { grid-column: 1 / -1; background: var(--surface-2); padding: 0.75rem 1rem; border-radius: 10px; }
.translated-block h4 { margin: 0 0 0.4rem; font-size: 0.85rem; color: var(--text-muted); }
.translated-block p { margin: 0; white-space: pre-wrap; line-height: 1.65; }
.page-photo.is-zoomed img { position: fixed; inset: 5vh 5vw; width: 90vw; height: 90vh; z-index: 60; object-fit: contain; background: rgba(0,0,0,0.85); cursor: zoom-out; }

.settings-box { font-size: 0.95rem; }
.settings-box > summary { font-weight: 600; }
.settings-box[open] > summary { margin-bottom: 1rem; }
.settings-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; padding-top: 1rem; margin-top: 0.5rem; border-top: 1px solid var(--border); }
.danger-zone { padding-top: 1rem; margin-top: 1rem; border-top: 1px dashed var(--danger-line); }

/* ---------- 8. Mini-player & read-along ---------- */
.mini-player {
    position: fixed; left: 50%; bottom: 12px; transform: translateX(-50%); z-index: 40;
    width: min(920px, calc(100% - 24px));
    background: color-mix(in srgb, var(--card-bg) 92%, transparent);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-strong); border-radius: 18px;
    box-shadow: var(--shadow-lift);
    padding: 0.35rem 0.9rem 0.6rem;
    padding-bottom: calc(0.6rem + env(safe-area-inset-bottom));
    animation: rise 0.4s ease both;
}
@keyframes rise { from { opacity: 0; transform: translate(-50%, 20px); } to { opacity: 1; transform: translate(-50%, 0); } }
.mp-progress input { width: 100%; accent-color: var(--primary); height: 18px; margin: 0; cursor: pointer; }
.mp-row { display: flex; align-items: center; gap: 0.9rem; }
.mp-now { display: flex; align-items: center; gap: 0.6rem; min-width: 0; flex: 1 1 180px; }
.mp-cover { width: 38px; aspect-ratio: 3 / 4; border-radius: 4px; flex: 0 0 auto; }
.mp-cover .cover-initials { font-size: 0.8rem; }
.mp-cover::before { display: none; }
.mp-now-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.mp-now-text strong, .mp-now-text span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mp-now-text span { font-size: 0.8rem; color: var(--text-muted); }
.mp-controls { display: flex; align-items: center; gap: 0.3rem; }
.mp-btn { width: 40px; height: 40px; border-radius: 50%; border: none; background: transparent; color: var(--text); font-size: 1.05rem; cursor: pointer; }
.mp-btn:hover { background: var(--surface-2); }
.mp-btn-main { width: 48px; height: 48px; background: var(--primary); color: var(--on-primary); font-size: 1.15rem; box-shadow: 0 6px 16px -6px var(--primary); }
.mp-btn-main:hover { background: var(--primary-dark); }
.mp-options { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; justify-content: flex-end; flex: 1 1 260px; }
.mp-opt { display: inline-flex; align-items: center; gap: 0.25rem; font-size: 0.85rem; }
.mp-opt select { min-height: 34px; padding: 0.2rem 0.35rem; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--card-bg); color: var(--text); font: inherit; font-size: 0.85rem; cursor: pointer; }
.mp-toggle { display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.8rem; color: var(--text-muted); cursor: pointer; white-space: nowrap; }
.mp-toggle input { accent-color: var(--primary); }
.mp-sleep-left { font-size: 0.78rem; font-weight: 600; color: var(--accent-text); background: var(--accent-soft); padding: 0.1rem 0.45rem; border-radius: 999px; }

.readalong {
    font-size: 1.05rem; line-height: 1.9; margin: 0.3rem 0 0.6rem; padding: 0.8rem 1rem;
    background: var(--surface-2); border-radius: 10px; max-height: 220px; overflow-y: auto;
    scroll-behavior: smooth;
}
.readalong .w { border-radius: 4px; padding: 0.05em 0.05em; cursor: pointer; transition: background-color 0.15s ease, color 0.15s ease; }
.readalong .w:hover { text-decoration: underline; text-decoration-color: var(--primary-line); }
.readalong .w.is-read { color: var(--text-muted); }
.readalong .w.is-current { background: var(--accent); color: #111; box-shadow: 0 0 0 2px var(--accent); }

/* ---------- 9. Earby mascot ---------- */
.earby { position: relative; width: var(--earby-size, 110px); flex: 0 0 auto; cursor: pointer; user-select: none; -webkit-tap-highlight-color: transparent; outline: none; }
.earby svg { width: 100%; height: auto; display: block; overflow: visible; }
.earby-shadow { fill: rgba(15, 23, 42, 0.12); transform-origin: 60px 126px; animation: shadow 3.2s ease-in-out infinite; }
.earby-body { transform-origin: 60px 118px; animation: bob 3.2s ease-in-out infinite; }
.earby-cover { fill: var(--earby-cover); }
.earby-spine { fill: var(--earby-spine); }
.earby-pages { fill: var(--earby-pages); stroke: #e7d8b8; stroke-width: 1.5; }
.earby-page-lines { stroke: #e7d8b8; stroke-width: 1.5; }
.earby-flip { fill: var(--earby-pages); opacity: 0; transform-origin: 57px 65px; }
.earby-feet ellipse { fill: var(--earby-spine); }
.earby-arm { fill: none; stroke: var(--earby-spine); stroke-width: 5; stroke-linecap: round; }
.earby-arm-right-wrap { transform-origin: 96px 74px; }
.earby-eye-white { fill: #fff; }
.earby-pupil circle:first-child { fill: var(--earby-ink); }
.earby-glint { fill: #fff; }
.earby-pupil { transition: transform 0.12s ease-out; }
.earby-eyes { transform-origin: 59px 58px; animation: blink 5s infinite; }
.earby-closed-eyes { fill: none; stroke: #fff; stroke-width: 3; stroke-linecap: round; opacity: 0; }
.earby-cheek { fill: #fb7185; opacity: 0.55; }
.earby-mouth { fill: none; stroke: #fff; stroke-width: 3; stroke-linecap: round; }
.earby-mouth-open { fill: #1e1b4b; opacity: 0; }
.earby-band { fill: none; stroke: var(--earby-phones); stroke-width: 6; stroke-linecap: round; }
.earby-cup { fill: var(--earby-phones); stroke: #b45309; stroke-width: 1.5; }
.earby-notes, .earby-zzz, .earby-sparkles { opacity: 0; }
.earby-note { fill: var(--primary); font-size: 18px; font-weight: 700; }
.earby-zzz text { fill: var(--text-muted); font-size: 12px; font-weight: 700; font-family: var(--font-sans); }
.earby-sparkles path { fill: var(--accent); }

.earby-bubble {
    position: absolute; right: calc(100% + 8px); top: 8%;
    width: max-content; max-width: 220px;
    background: var(--card-bg); color: var(--text);
    border: 1px solid var(--border-strong); border-radius: 14px 14px 4px 14px;
    padding: 0.5rem 0.75rem; font-size: 0.85rem; line-height: 1.35; box-shadow: var(--shadow-md);
    animation: bubble-in 0.4s cubic-bezier(.2,1.4,.4,1) both;
}
.earby-bubble.is-swapping { animation: bubble-pop 0.35s cubic-bezier(.2,1.4,.4,1) both; }
@keyframes bubble-in { from { opacity: 0; transform: translateY(6px) scale(0.9); } to { opacity: 1; transform: none; } }
@keyframes bubble-pop { 0% { transform: scale(0.85); } 100% { transform: scale(1); } }

@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
@keyframes shadow { 0%, 100% { transform: scaleX(1); opacity: 1; } 50% { transform: scaleX(0.85); opacity: 0.7; } }
@keyframes blink { 0%, 94%, 100% { transform: scaleY(1); } 96% { transform: scaleY(0.1); } }

/* wave: right arm waves hello */
.earby--wave .earby-arm-right-wrap { animation: wave 1.6s ease-in-out infinite; }
@keyframes wave { 0%, 60%, 100% { transform: rotate(0); } 10%, 30% { transform: rotate(-22deg); } 20%, 40% { transform: rotate(10deg); } }

/* reading: page flips, eyes scan left-right */
.earby--reading .earby-flip { animation: flip 1.2s ease-in-out infinite; }
.earby--reading .earby-pupil { animation: scan 1.2s ease-in-out infinite; }
.earby--reading .earby-body { animation-duration: 1.2s; }
@keyframes flip { 0% { opacity: 0; transform: scaleX(1); } 15% { opacity: 1; } 60% { opacity: 1; transform: scaleX(-1); } 61%, 100% { opacity: 0; transform: scaleX(-1); } }
@keyframes scan { 0%, 100% { transform: translate(-2.5px, 1.5px); } 50% { transform: translate(2.5px, 1.5px); } }

/* listening: sway to the music, notes float up */
.earby--listening .earby-body { animation: sway 1s ease-in-out infinite; }
.earby--listening .earby-notes { opacity: 1; }
.earby--listening .earby-note { animation: note-float 2s ease-in infinite; }
.earby--listening .earby-note.n2 { animation-delay: 0.6s; }
.earby--listening .earby-note.n3 { animation-delay: 1.2s; }
.earby--listening .earby-closed-eyes { opacity: 1; }
.earby--listening .earby-eyes { opacity: 0; animation: none; }
@keyframes sway { 0%, 100% { transform: rotate(-4deg); } 50% { transform: rotate(4deg) translateY(-2px); } }
@keyframes note-float { 0% { opacity: 0; transform: translateY(8px); } 20% { opacity: 1; } 100% { opacity: 0; transform: translateY(-22px) rotate(15deg); } }

/* celebrate: hop + sparkles + open mouth */
.earby--celebrate .earby-body { animation: hop 0.6s cubic-bezier(.3,1.6,.5,1) 3; }
.earby--celebrate .earby-sparkles { opacity: 1; animation: sparkle 0.6s ease-in-out 3; }
.earby--celebrate .earby-mouth { opacity: 0; }
.earby--celebrate .earby-mouth-open { opacity: 1; }
.earby--celebrate .earby-arm-right-wrap { animation: wave 0.6s ease-in-out 3; }
@keyframes hop { 0%, 100% { transform: translateY(0) scale(1, 1); } 30% { transform: translateY(0) scale(1.05, 0.93); } 60% { transform: translateY(-14px) scale(0.97, 1.04); } }
@keyframes sparkle { 0%, 100% { opacity: 0.2; transform: scale(0.8); } 50% { opacity: 1; transform: scale(1.1); } }

/* sleeping: eyes closed, slow breathing, zzz */
.earby--sleeping .earby-body { animation: breathe 3.5s ease-in-out infinite; }
.earby--sleeping .earby-eyes { opacity: 0; animation: none; }
.earby--sleeping .earby-closed-eyes { opacity: 1; }
.earby--sleeping .earby-zzz { opacity: 1; animation: zzz 2.5s ease-in-out infinite; }
@keyframes breathe { 0%, 100% { transform: scale(1, 1); } 50% { transform: scale(1.02, 0.98) translateY(1px); } }
@keyframes zzz { 0% { opacity: 0; transform: translate(0, 4px); } 30% { opacity: 1; } 100% { opacity: 0; transform: translate(6px, -8px); } }

/* tapped: a quick squish */
.earby.is-poked .earby-body { animation: hop 0.5s cubic-bezier(.3,1.6,.5,1) 1; }

.library-earby .earby-bubble { right: calc(100% + 6px); }
.processing-earby .earby-bubble { display: none; }

/* ---------- 10. Auth pages ---------- */
.auth-layout { display: grid; grid-template-columns: 1.1fr 1fr; gap: 2rem; align-items: stretch; min-height: calc(100vh - 150px); }
.auth-brand {
    position: relative; overflow: hidden; border-radius: 24px;
    background: linear-gradient(145deg, #4338ca 0%, #6d28d9 55%, #db2777 120%);
    color: #fff; display: flex; align-items: center; justify-content: center; padding: 2.5rem 2rem;
}
.auth-brand-inner { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; text-align: center; }
.auth-earby { --earby-cover: #fbbf24; --earby-spine: #b45309; --earby-phones: #f8fafc; margin-bottom: 1rem; }
.auth-earby .earby-cup { stroke: #cbd5e1; }
.auth-earby .earby-shadow { fill: rgba(0,0,0,0.2); }
.auth-earby .earby-bubble { right: auto; left: 70%; top: -12%; border-radius: 14px 14px 14px 4px; color: #1e293b; background: #fff; border-color: transparent; }
.auth-tagline { font-size: 2rem; line-height: 1.2; margin: 0.5rem 0 1rem; }
.auth-tagline em { font-style: italic; color: #fde68a; }
.auth-points { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.5rem; font-size: 0.95rem; opacity: 0.95; text-align: left; }
.float-letters { position: absolute; inset: 0; pointer-events: none; }
.float-letters span {
    position: absolute; left: var(--x); bottom: -2rem;
    font-size: var(--size); font-weight: 700; color: rgba(255,255,255,0.18);
    font-family: var(--font-serif), "Noto Sans Bengali", serif;
    animation: drift var(--dur) linear infinite; animation-delay: var(--delay);
}
@keyframes drift { from { transform: translateY(0) rotate(0); opacity: 0; } 10% { opacity: 1; } 90% { opacity: 1; } to { transform: translateY(-110vh) rotate(var(--rot)); opacity: 0; } }
.auth-form-side { display: flex; align-items: center; justify-content: center; }
.auth-card { width: 100%; max-width: 420px; margin: 0; padding: 2rem; }
.auth-card h1 { margin: 0 0 0.25rem; }
.auth-sub { color: var(--text-muted); margin: 0 0 1.5rem; }

/* ---------- 11. Admin ---------- */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1rem; margin: 1.5rem 0 2rem; }
.stat-card { background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.1rem 1rem; text-align: center; box-shadow: var(--shadow-sm); }
.stat-number { display: block; font-size: 2rem; font-weight: 700; color: var(--primary); line-height: 1.2; }
.stat-number small { font-size: 1rem; }
.stat-label { color: var(--text-muted); font-size: 0.85rem; }
.admin-columns { display: grid; grid-template-columns: 2fr 1fr; gap: 1.25rem; }
.bar-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.6rem; }
.bar-list li { display: grid; grid-template-columns: 130px 1fr 36px; gap: 0.75rem; align-items: center; font-size: 0.9rem; }
.bar-label small { color: var(--text-muted); }
.bar-track { height: 10px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: var(--primary); border-radius: inherit; }
.bar-value { text-align: right; font-weight: 600; }
.big-number { font-size: 2.5rem; font-weight: 700; margin: 0; color: var(--accent-text); }
.table-wrap { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; margin-bottom: 1.5rem; background: var(--card-bg); border-radius: var(--radius); overflow: hidden; }
.admin-table th, .admin-table td { text-align: left; padding: 0.65rem 0.75rem; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
.admin-table th { color: var(--text-muted); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.03em; }

/* ---------- 13. Community: navbar menu, avatars, stars ---------- */
.nav-link { position: relative; }
.nav-links a.btn { padding: 0.4rem 0.9rem; border-bottom: none; }
.nav-links a.btn-primary, .nav-links a.btn-primary:hover { color: var(--on-primary); }
.nav-publish { margin-left: 0.25rem; }
.user-menu { position: relative; }
.user-menu-btn {
    display: inline-flex; align-items: center; gap: 0.45rem;
    padding: 0.2rem 0.55rem 0.2rem 0.2rem; border-radius: 999px;
    border: 1px solid var(--border-strong); background: var(--card-bg); color: var(--text);
    cursor: pointer; font: inherit; font-weight: 600; font-size: 0.9rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.user-menu-btn:hover, .user-menu.is-open .user-menu-btn { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.user-menu-btn .caret { font-size: 0.7rem; color: var(--text-muted); transition: transform 0.2s ease; }
.user-menu.is-open .caret { transform: rotate(180deg); }
.user-menu-backdrop { display: none; }
.user-menu-panel {
    position: absolute; right: 0; top: calc(100% + 10px); z-index: 50;
    width: 290px; padding: 0.5rem;
    background: var(--card-bg); border: 1px solid var(--border-strong); border-radius: 16px;
    box-shadow: var(--shadow-lift);
    opacity: 0; visibility: hidden; transform: translateY(-8px) scale(0.98); transform-origin: top right;
    transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
}
.user-menu.is-open .user-menu-panel { opacity: 1; visibility: visible; transform: none; }
.um-header { display: flex; align-items: center; gap: 0.7rem; padding: 0.6rem 0.6rem 0.8rem; border-bottom: 1px solid var(--border); margin-bottom: 0.35rem; }
.um-header strong { display: block; font-size: 0.95rem; }
.um-header span { display: block; font-size: 0.8rem; color: var(--text-muted); overflow-wrap: anywhere; }
.um-close { display: none; margin-left: auto; background: none; border: none; font-size: 1.5rem; color: var(--text-muted); cursor: pointer; }
.um-group { display: flex; flex-direction: column; padding: 0.25rem 0; border-bottom: 1px solid var(--border); margin: 0; }
.um-group:last-child { border-bottom: none; }
.um-group a, .um-group button {
    display: flex; align-items: center; gap: 0.65rem; width: 100%;
    padding: 0.55rem 0.7rem; border-radius: 10px; border: none; background: none;
    color: var(--text); text-decoration: none; font: inherit; font-size: 0.92rem; text-align: left; cursor: pointer;
    transition: background-color 0.12s ease, transform 0.12s ease;
}
.um-group a:hover, .um-group button:hover, .um-group a:focus-visible, .um-group button:focus-visible { background: var(--surface-2); transform: translateX(2px); outline: none; }
.um-group a > span:first-child, .um-group button > span:first-child { width: 1.3rem; text-align: center; }
.um-logout { color: var(--danger) !important; }
.um-mobile-only { display: none; }
.um-theme .icon-sun, .um-theme .label-light { display: none; }
:root[data-theme="dark"] .um-theme .icon-sun, :root[data-theme="dark"] .um-theme .label-light { display: inline; }
:root[data-theme="dark"] .um-theme .icon-moon, :root[data-theme="dark"] .um-theme .label-dark { display: none; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme]) .um-theme .icon-sun, :root:not([data-theme]) .um-theme .label-light { display: inline; }
    :root:not([data-theme]) .um-theme .icon-moon, :root:not([data-theme]) .um-theme .label-dark { display: none; }
}

.avatar {
    width: var(--size, 36px); height: var(--size, 36px); border-radius: 50%; object-fit: cover; flex: 0 0 auto;
    display: inline-flex; align-items: center; justify-content: center; vertical-align: middle;
}
.avatar-initials { color: #fff; font-weight: 700; font-size: calc(var(--size, 36px) * 0.4); letter-spacing: 0.02em; }

.stars { display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.85rem; color: var(--text-muted); white-space: nowrap; }
.stars-track { position: relative; display: inline-block; color: var(--border-strong); letter-spacing: 1px; line-height: 1; }
.stars-fill { position: absolute; inset: 0 auto 0 0; overflow: hidden; color: var(--accent); white-space: nowrap; }
.stars-num { font-weight: 700; color: var(--text); }
.stars-empty { font-size: 0.8rem; font-style: italic; }

/* Star input (review form): radios rendered as big stars, hover fills leftwards */
.star-input { display: inline-flex; flex-direction: row-reverse; border: none; padding: 0; margin: 0 0 0.6rem; gap: 0.1rem; }
.star-input input { position: absolute; opacity: 0; pointer-events: none; }
.star-input label { font-size: 2rem; line-height: 1; color: var(--border-strong); cursor: pointer; transition: color 0.12s ease, transform 0.15s cubic-bezier(.3,1.6,.5,1); }
.star-input label:hover, .star-input label:hover ~ label, .star-input input:checked ~ label { color: var(--accent); }
.star-input label:hover { transform: scale(1.2) rotate(-8deg); }
.star-input input:focus-visible + label { outline: 2px solid var(--primary); border-radius: 4px; }
.star-input input:checked + label { animation: star-pop 0.35s ease; }
@keyframes star-pop { 50% { transform: scale(1.35); } }

.pill { font-size: 0.7rem; font-weight: 700; padding: 0.2rem 0.5rem; border-radius: 999px; background: rgba(255,255,255,0.92); color: #111; box-shadow: var(--shadow-sm); }
.pill-hot { background: #fff1f2; color: #be123c; }
.pill-trend { background: #eef2ff; color: #4338ca; }
.genre-chip { font-size: 0.72rem; font-weight: 600; padding: 0.1rem 0.5rem; border-radius: 999px; background: var(--accent-soft); color: var(--accent-text); }
.status-chip { display: inline-block; font-size: 0.72rem; font-weight: 600; padding: 0.15rem 0.55rem; border-radius: 999px; background: var(--surface-2); color: var(--text-muted); margin-top: 0.35rem; }
.status-live { background: var(--success-bg); color: var(--success-text); }
.status-info { background: var(--info-bg); color: var(--info-text); border: 1px solid transparent; }

/* Reveal-on-scroll (only when JS is running, so nothing is ever hidden without it) */
.js-reveal .reveal { opacity: 0; transform: translateY(14px); transition: opacity 0.55s ease, transform 0.55s cubic-bezier(.2,.8,.2,1); transition-delay: calc(var(--i, 0) * 60ms); }
.js-reveal .reveal.is-visible { opacity: 1; transform: none; }

/* ---------- 14. Landing page ---------- */
.hero {
    position: relative; overflow: hidden;
    display: grid; grid-template-columns: 1.4fr 1fr; align-items: center; gap: 1.5rem;
    padding: 2.5rem 2.5rem 2rem; margin-bottom: 2rem; border-radius: 28px;
    background: radial-gradient(700px 300px at 90% 10%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 70%),
                linear-gradient(160deg, var(--primary-soft), var(--card-bg) 65%);
    border: 1px solid var(--border);
}
.hero .float-letters span { color: color-mix(in srgb, var(--primary) 14%, transparent); }
.hero-text { position: relative; z-index: 1; }
.eyebrow { font-size: 0.85rem; font-weight: 600; color: var(--primary); margin: 0 0 0.6rem; letter-spacing: 0.02em; }
.hero-title { font-size: clamp(2rem, 4.6vw, 3.3rem); line-height: 1.12; margin: 0 0 1rem; }
.rotator { display: inline-grid; vertical-align: bottom; }
.rotator-word { grid-area: 1 / 1; font-style: italic; color: var(--primary); opacity: 0; transform: translateY(0.4em); transition: opacity 0.45s ease, transform 0.45s ease; white-space: nowrap; }
.rotator-word.is-active { opacity: 1; transform: none; }
.rotator-word.is-leaving { opacity: 0; transform: translateY(-0.4em); }
.hero-sub { color: var(--text-muted); font-size: 1.05rem; line-height: 1.6; max-width: 560px; margin: 0 0 1.4rem; }
.hero-actions { display: flex; gap: 0.7rem; flex-wrap: wrap; }
.hero-stats { display: grid; grid-template-columns: repeat(4, auto); justify-content: start; gap: 1.8rem; margin: 1.8rem 0 0; }
.hero-stats div { display: flex; flex-direction: column-reverse; }
.hero-stats dt { font-size: 0.78rem; color: var(--text-muted); }
.hero-stats dd { margin: 0; font-family: var(--font-serif); font-size: 1.7rem; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.hero-art { position: relative; z-index: 1; display: flex; justify-content: center; padding-top: 2rem; }
.hero-earby .earby-bubble { right: 55%; top: -14%; }

.section-heading { font-size: 1.6rem; text-align: center; margin: 0 0 1.25rem; font-family: var(--font-serif); }
.how { margin: 1rem 0 2.5rem; }
.how-steps { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; counter-reset: step; }
.how-steps li { background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.2rem; position: relative; transition: transform 0.2s ease, box-shadow 0.2s ease; }
.how-steps li:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); }
.how-steps li::before { counter-increment: step; content: counter(step); position: absolute; top: 0.8rem; right: 1rem; font-family: var(--font-serif); font-size: 1.6rem; font-weight: 700; color: var(--primary-line); }
.how-icon { font-size: 1.8rem; display: inline-block; margin-bottom: 0.4rem; }
.how-steps li:hover .how-icon { animation: wiggle 0.5s ease; }
@keyframes wiggle { 25% { transform: rotate(-10deg); } 75% { transform: rotate(10deg); } }
.how-steps h3 { margin: 0 0 0.3rem; font-size: 1rem; }
.how-steps p { margin: 0; color: var(--text-muted); font-size: 0.88rem; line-height: 1.5; }

.shelf { margin: 0 0 2.2rem; }
.shelf-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; margin-bottom: 0.9rem; }
.shelf-head h2 { margin: 0; font-size: 1.35rem; font-family: var(--font-serif); }
.shelf-sub { margin: 0.2rem 0 0; color: var(--text-muted); font-size: 0.85rem; }
.shelf-more { font-size: 0.88rem; font-weight: 600; text-decoration: none; white-space: nowrap; }
.shelf-more:hover { text-decoration: underline; }
.shelf-row {
    display: grid; grid-auto-flow: column; grid-auto-columns: minmax(160px, 180px); gap: 1rem;
    overflow-x: auto; padding: 0.3rem 0.2rem 1rem; scroll-snap-type: x proximity; scrollbar-width: thin;
}
.shelf-row > * { scroll-snap-align: start; }

.community-card .cover-wrap { position: relative; overflow: hidden; }
.card-badges { position: absolute; top: 0.5rem; left: 0.5rem; display: flex; flex-direction: column; gap: 0.25rem; align-items: flex-start; z-index: 2; }
.play-hint {
    position: absolute; right: 0.6rem; bottom: 0.6rem; z-index: 2;
    width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
    background: var(--primary); color: #fff; font-size: 0.95rem; box-shadow: 0 6px 16px -4px rgba(0,0,0,0.4);
    opacity: 0; transform: translateY(8px) scale(0.9); transition: opacity 0.2s ease, transform 0.2s ease;
}
.community-card:hover .play-hint, .community-card:focus-visible .play-hint { opacity: 1; transform: none; }
.card-author { font-size: 0.8rem !important; margin: 0 0 0.3rem !important; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.community-card .book-card-meta { margin-top: 0.35rem; justify-content: flex-start; }

.browse { margin-bottom: 2rem; scroll-margin-top: 5rem; }
.filters { margin-bottom: 1.2rem; }
.sort-tabs { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-bottom: 0.8rem; }
.sort-tab { position: relative; padding: 0.45rem 0.9rem; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--card-bg); font-size: 0.88rem; font-weight: 600; cursor: pointer; transition: all 0.15s ease; }
.sort-tab input { position: absolute; opacity: 0; pointer-events: none; }
.sort-tab:hover { border-color: var(--primary); }
.sort-tab.is-active, .sort-tab:has(input:checked) { background: var(--primary); border-color: var(--primary); color: var(--on-primary); box-shadow: 0 6px 14px -8px var(--primary); }
.sort-tab:has(input:focus-visible) { outline: 3px solid color-mix(in srgb, var(--primary) 45%, transparent); }
.filter-row { display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: center; }
.filter-row .search-input { flex: 1 1 240px; max-width: none; }
.filter-row .select { width: auto; flex: 0 1 200px; }
.pager { display: flex; justify-content: center; align-items: center; gap: 1rem; margin: 1.5rem 0; color: var(--text-muted); font-size: 0.9rem; }

.cta-band {
    display: flex; justify-content: space-between; align-items: center; gap: 1.5rem; flex-wrap: wrap;
    padding: 1.8rem 2rem; margin: 1rem 0 2rem; border-radius: 22px; color: #fff;
    background: linear-gradient(135deg, #4338ca, #7c3aed 60%, #db2777);
}
.cta-band h2 { margin: 0 0 0.3rem; font-family: var(--font-serif); }
.cta-band p { margin: 0; opacity: 0.9; }
.cta-band .btn-primary { background: #fff; color: #3730a3; box-shadow: none; }

.site-footer { max-width: 1100px; margin: 3rem auto 0; padding: 1.5rem; border-top: 1px solid var(--border); display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; font-size: 0.85rem; color: var(--text-muted); }
.footer-links { display: flex; gap: 1rem; }
.footer-links a { color: var(--text-muted); text-decoration: none; }
.footer-links a:hover { color: var(--primary); }
body.has-player .site-footer { display: none; }

/* ---------- 15. Publishing & reviews ---------- */
.publish-paths { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin: 1.5rem 0; }
.path-card {
    display: flex; flex-direction: column; gap: 0.4rem; padding: 1.4rem; border-radius: 18px; text-decoration: none; color: var(--text);
    background: var(--card-bg); border: 1px solid var(--border); box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.path-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); border-color: var(--primary-line); }
.path-icon { font-size: 2rem; }
.path-card h2 { margin: 0; font-family: var(--font-serif); font-size: 1.25rem; }
.path-card p { margin: 0; color: var(--text-muted); line-height: 1.5; }
.path-cta { margin-top: auto; padding-top: 0.5rem; font-weight: 600; color: var(--primary); }
.publish-list { list-style: none; padding: 0; margin: 0; }
.publish-item { display: flex; align-items: center; gap: 0.9rem; padding: 0.7rem 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.publish-item:last-child { border-bottom: none; }
.pub-cover { width: 44px; aspect-ratio: 3 / 4; border-radius: 4px; flex: 0 0 auto; }
.pub-cover .cover-initials { font-size: 0.9rem; }
.pub-cover::before { display: none; }
.publish-info { flex: 1; min-width: 160px; display: flex; flex-direction: column; gap: 0.1rem; }
.publish-title { font-weight: 700; color: var(--text); text-decoration: none; }
.publish-title:hover { color: var(--primary); }
.publish-meta { font-size: 0.8rem; color: var(--text-muted); }

.book-author { margin: 0.2rem 0 0; font-family: var(--font-serif); font-style: italic; color: var(--text-muted); }
.book-rating-line { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; margin: 0.4rem 0 0; }
.book-rating-line .status-chip { margin-top: 0; }
.rating-link { text-decoration: none; }
.published-by { margin: 0.4rem 0 0; font-size: 0.85rem; color: var(--text-muted); }
.published-by a { display: inline-flex; align-items: center; gap: 0.3rem; font-weight: 600; text-decoration: none; }
.book-description { background: var(--card-bg); border: 1px solid var(--border); border-left: 4px solid var(--accent); border-radius: 12px; padding: 0.9rem 1.1rem; margin: -0.5rem 0 1.5rem; }
.book-description p { margin: 0; line-height: 1.65; white-space: pre-wrap; }
.resume-text { flex: 1; min-width: 200px; }
.resume-text .progress { margin: 0.45rem 0 0.25rem; background: rgba(255,255,255,0.5); }

.publish-box, .reviews-box {
    background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 1.5rem; margin-bottom: 1.5rem; box-shadow: var(--shadow-sm); scroll-margin-top: 5rem;
}
.publish-box { border-style: dashed; border-color: var(--primary-line); }
.publish-box.is-live { border-style: solid; border-color: color-mix(in srgb, var(--good) 45%, transparent); }
.publish-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; }
.publish-head .hint { margin-top: 0; }
.publish-form { margin-top: 1rem; animation: slide-in 0.25s ease both; }
.textarea-sm { min-height: 80px; }

.reviews-summary { display: grid; grid-template-columns: 180px 1fr; gap: 1.5rem; align-items: center; margin-bottom: 1.25rem; }
.rating-big { display: flex; flex-direction: column; align-items: center; gap: 0.3rem; }
.rating-number { font-family: var(--font-serif); font-size: 3rem; font-weight: 700; line-height: 1; }
.rating-bars { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.35rem; }
.rating-bars li { display: grid; grid-template-columns: 32px 1fr 28px; gap: 0.6rem; align-items: center; font-size: 0.82rem; color: var(--text-muted); }
.rating-bars .bar-fill { background: var(--accent); transition: width 0.8s cubic-bezier(.2,.8,.2,1); }
.review-form { background: var(--surface-2); border-radius: 14px; padding: 1rem 1.1rem; margin-bottom: 1.25rem; }
.review-form-title { font-weight: 700; margin: 0 0 0.3rem; }
.review-list { list-style: none; padding: 0; margin: 0; }
.review { display: flex; gap: 0.8rem; padding: 0.9rem 0; border-top: 1px solid var(--border); }
.review-body { flex: 1; min-width: 0; }
.review-head { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.review-author { font-weight: 700; color: var(--text); text-decoration: none; }
.review-head time { font-size: 0.78rem; color: var(--text-muted); }
.review-body p { margin: 0.35rem 0 0; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
.review-body form { margin: 0.2rem 0 0; }

/* ---------- 16. Profile & settings ---------- */
.profile-hero {
    display: grid; grid-template-columns: auto 1fr auto; gap: 1.5rem; align-items: center;
    padding: 1.75rem; margin-bottom: 2rem; border-radius: 22px; border: 1px solid var(--border);
    background: linear-gradient(135deg, var(--primary-soft), var(--card-bg) 70%);
}
.profile-avatar { box-shadow: 0 0 0 5px var(--card-bg), var(--shadow-lift); }
.profile-info h1 { margin: 0 0 0.3rem; }
.profile-bio { margin: 0 0 0.4rem; line-height: 1.55; max-width: 520px; }
.profile-stats { display: grid; grid-template-columns: repeat(2, auto); gap: 0.9rem 1.5rem; margin: 0; }
.profile-stats div { display: flex; flex-direction: column-reverse; }
.profile-stats dt { font-size: 0.75rem; color: var(--text-muted); }
.profile-stats dd { margin: 0; font-family: var(--font-serif); font-size: 1.5rem; font-weight: 700; }
.progress-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.7rem; }
.progress-list li { display: grid; grid-template-columns: minmax(140px, 1.2fr) 2fr auto; gap: 1rem; align-items: center; background: var(--card-bg); border: 1px solid var(--border); border-radius: 12px; padding: 0.7rem 1rem; }
.progress-list a { font-weight: 600; color: var(--text); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.progress-list .progress { margin: 0; }
.progress-label { font-size: 0.82rem; color: var(--text-muted); white-space: nowrap; }

.tabs { display: flex; gap: 0.4rem; margin: 1.25rem 0; border-bottom: 1px solid var(--border); }
.tab { padding: 0.6rem 1rem; text-decoration: none; color: var(--text-muted); font-weight: 600; border-bottom: 3px solid transparent; margin-bottom: -1px; transition: color 0.15s ease, border-color 0.15s ease; }
.tab:hover { color: var(--text); }
.tab.is-active { color: var(--text); border-bottom-color: var(--accent); }
.settings-panel { max-width: 720px; animation: slide-in 0.3s ease both; }
.danger-panel { border-color: var(--danger-line); }
.danger-panel summary { list-style: none; }
.delete-account-form { margin-top: 1rem; }
.avatar-edit { display: flex; align-items: center; gap: 1.2rem; margin-bottom: 1.2rem; }
.avatar-picker { position: relative; cursor: pointer; border-radius: 50%; }
.avatar-picker input { position: absolute; inset: 0; opacity: 0; cursor: pointer; z-index: 2; }
.avatar-preview .avatar, .avatar-preview img { width: 96px; height: 96px; }
.avatar-edit-badge { position: absolute; right: -2px; bottom: -2px; width: 32px; height: 32px; border-radius: 50%; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 0.9rem; box-shadow: 0 0 0 3px var(--card-bg); transition: transform 0.2s ease; }
.avatar-picker:hover .avatar-edit-badge { transform: scale(1.12) rotate(-8deg); }

/* Password field */
.password-wrap { position: relative; }
.password-wrap .input { padding-right: 2.8rem; }
.pw-toggle { position: absolute; right: 0.35rem; top: 50%; transform: translateY(-50%); width: 36px; height: 36px; border: none; background: none; cursor: pointer; font-size: 1rem; border-radius: 8px; }
.pw-toggle:hover { background: var(--surface-2); }
.pw-meter { height: 5px; border-radius: 999px; background: var(--surface-2); margin: 0.5rem 0 0.4rem; overflow: hidden; }
.pw-meter span { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--danger); transition: width 0.3s ease, background-color 0.3s ease; }
.pw-meter span[data-level="ok"] { background: var(--accent); }
.pw-meter span[data-level="strong"] { background: var(--good); }
.pw-rules { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 0.15rem 0.8rem; font-size: 0.78rem; color: var(--text-muted); }
.pw-rules li::before { content: "○"; display: inline-block; width: 1.1rem; transition: transform 0.2s ease; }
.pw-rules li.is-ok { color: var(--success-text); }
.pw-rules li.is-ok::before { content: "✓"; font-weight: 700; transform: scale(1.2); }
.password-group.is-common .pw-rules::after { content: "⚠ This is a very common password"; grid-column: 1 / -1; color: var(--danger); font-weight: 600; }
.password-group.shake { animation: shake 0.45s ease; }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

/* ---------- 17. My Writing ---------- */
.kind-picker { display: grid; grid-template-columns: 1fr 1fr; gap: 0.8rem; margin-bottom: 1rem; }
.kind-option input { position: absolute; opacity: 0; pointer-events: none; }
.kind-card { display: flex; flex-direction: column; gap: 0.2rem; height: 100%; padding: 1rem; border-radius: 14px; border: 2px solid var(--border); background: var(--surface-2); cursor: pointer; transition: all 0.15s ease; }
.kind-card small { color: var(--text-muted); }
.kind-icon { font-size: 1.6rem; }
.kind-option input:checked + .kind-card { border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 12%, transparent); }
.kind-option input:focus-visible + .kind-card { outline: 3px solid color-mix(in srgb, var(--primary) 45%, transparent); }

.writing-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 1rem; }
.writing-card { display: flex; flex-direction: column; gap: 0.35rem; padding: 1.1rem 1.2rem; border-radius: 16px; text-decoration: none; color: var(--text); background: var(--card-bg); border: 1px solid var(--border); box-shadow: var(--shadow-sm); transition: transform 0.2s ease, box-shadow 0.2s ease; position: relative; overflow: hidden; }
.writing-card::after { content: ""; position: absolute; inset: auto 0 0 0; height: 4px; background: linear-gradient(90deg, var(--primary), var(--accent)); transform: scaleX(0); transform-origin: left; transition: transform 0.3s ease; }
.writing-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); }
.writing-card:hover::after { transform: scaleX(1); }
.writing-card h3 { margin: 0; font-family: var(--font-serif); font-size: 1.15rem; }
.writing-kind { font-size: 0.75rem; font-weight: 700; color: var(--text-muted); }
.writing-excerpt { margin: 0; color: var(--text-muted); font-size: 0.88rem; line-height: 1.5; font-family: var(--font-serif); }
.writing-meta { margin: 0; font-size: 0.78rem; color: var(--text-muted); display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.writing-meta .status-chip { margin-top: 0; }

.editor-top { display: flex; align-items: center; gap: 0.8rem; margin-bottom: 1rem; flex-wrap: wrap; }
.editor-title { flex: 1; min-width: 200px; border: none; background: transparent; color: var(--text); font-family: var(--font-serif); font-size: 1.9rem; font-weight: 700; padding: 0.2rem 0.3rem; border-radius: 8px; }
.editor-title:hover, .editor-title:focus { background: var(--card-bg); outline: none; box-shadow: 0 0 0 2px var(--primary-line); }
.save-status { font-size: 0.82rem; color: var(--text-muted); padding: 0.25rem 0.7rem; border-radius: 999px; background: var(--surface-2); transition: all 0.2s ease; }
.save-status[data-state="saved"] { background: var(--success-bg); color: var(--success-text); }
.save-status[data-state="saving"] { background: var(--info-bg); color: var(--info-text); }
.save-status[data-state="error"] { background: var(--danger-bg); color: var(--danger-text); }
.editor-layout { display: grid; grid-template-columns: 240px 1fr; gap: 1.25rem; margin-bottom: 1.5rem; }
.editor-sidebar { background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; align-self: start; position: sticky; top: 5rem; }
.sidebar-title { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); margin: 0 0 0.6rem; }
.section-list { list-style: none; padding: 0; margin: 0 0 0.8rem; max-height: 50vh; overflow-y: auto; counter-reset: sec; }
.section-list a { display: flex; justify-content: space-between; gap: 0.5rem; padding: 0.5rem 0.6rem; border-radius: 8px; text-decoration: none; color: var(--text); font-size: 0.9rem; transition: background-color 0.12s ease; }
.section-list a:hover { background: var(--surface-2); }
.section-list li.is-current a { background: var(--primary-soft); color: var(--primary-dark); font-weight: 600; }
.section-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.section-words { font-size: 0.75rem; color: var(--text-muted); white-space: nowrap; }
.sidebar-total { font-size: 0.82rem; color: var(--text-muted); margin: 0.8rem 0 0.4rem; }
.sidebar-links { display: flex; flex-direction: column; align-items: flex-start; gap: 0.2rem; }
.sidebar-links form { margin: 0; }
.editor-main { background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.25rem 0.75rem; box-shadow: var(--shadow-sm); min-width: 0; }
.section-bar { display: flex; align-items: center; gap: 0.5rem; }
.section-title-input { flex: 1; min-width: 0; border: none; border-bottom: 2px solid transparent; background: transparent; color: var(--text); font-family: var(--font-serif); font-size: 1.3rem; font-weight: 700; padding: 0.3rem 0.1rem; }
.section-title-input:focus { outline: none; border-bottom-color: var(--accent); }
.section-tools { display: flex; gap: 0.2rem; }
.section-tools form { margin: 0; }
.icon-btn { width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--border); background: var(--card-bg); color: var(--text); cursor: pointer; font-size: 0.9rem; }
.icon-btn:hover { border-color: var(--primary); }
.icon-btn-danger:hover { border-color: var(--danger); background: var(--danger-soft); }
.voice-bar { display: flex; align-items: center; gap: 0.8rem; flex-wrap: wrap; margin: 0.8rem 0; padding: 0.5rem 0.6rem; background: var(--surface-2); border-radius: 12px; }
.voice-btn { position: relative; }
.voice-btn .mic-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--text-muted); }
.voice-btn.is-listening { background: var(--danger-bg); color: var(--danger-text); border-color: var(--danger-line); }
.voice-btn.is-listening .mic-dot { background: #ef4444; animation: rec-pulse 1.2s ease-in-out infinite; }
@keyframes rec-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.6); } 50% { box-shadow: 0 0 0 7px rgba(239, 68, 68, 0); } }
.voice-hint { font-size: 0.8rem; color: var(--text-muted); flex: 1; min-width: 180px; }
.voice-interim { font-style: italic; color: var(--primary); font-size: 0.9rem; flex-basis: 100%; }
.voice-interim:empty { display: none; }
.editor-text {
    width: 100%; min-height: 55vh; resize: vertical; border: none; outline: none; background: transparent; color: var(--text);
    font-family: var(--font-serif), "Noto Sans Bengali", serif; font-size: 1.12rem; line-height: 1.85; padding: 0.5rem 0.2rem;
}
.editor-foot { font-size: 0.78rem; color: var(--text-muted); margin: 0.4rem 0 0; border-top: 1px solid var(--border); padding-top: 0.5rem; }
.publish-earby { margin-top: -0.5rem; }

/* ---------- 18. Browse menus (Country / Genre / Top reviewed) ---------- */
.nav-left { display: flex; align-items: center; gap: 1.2rem; min-width: 0; }
.browse-links { display: flex; align-items: center; gap: 0.9rem; }
.nav-dd { position: relative; }
.nav-dd > summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 0.25rem; color: var(--text-muted); font-weight: 500; padding: 0.35rem 0; }
.nav-dd > summary::-webkit-details-marker { display: none; }
.nav-dd > summary:hover, .nav-dd[open] > summary { color: var(--primary); }
.nav-dd .caret { font-size: 0.7rem; transition: transform 0.2s ease; }
.nav-dd[open] .caret { transform: rotate(180deg); }
.nav-dd-panel {
    position: absolute; left: 0; top: calc(100% + 10px); z-index: 55; width: 460px; max-height: 70vh; overflow-y: auto;
    background: var(--card-bg); border: 1px solid var(--border-strong); border-radius: 16px; padding: 0.6rem;
    box-shadow: var(--shadow-lift); animation: slide-in 0.2s ease both;
}
.dd-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.15rem; }
.dd-grid a { display: flex; align-items: center; gap: 0.5rem; padding: 0.5rem 0.6rem; border-radius: 10px; text-decoration: none; color: var(--text); font-size: 0.9rem; transition: background-color 0.12s ease, transform 0.12s ease; }
.dd-grid a:hover { background: var(--surface-2); transform: translateX(2px); }
.dd-grid a small { margin-left: auto; font-size: 0.72rem; font-weight: 700; color: var(--primary); background: var(--primary-soft); padding: 0 0.45rem; border-radius: 999px; }
.dd-grid a.is-empty { color: var(--text-muted); }
.dd-grid a.dd-featured { font-weight: 600; }
.nav-dd.in-drawer, .nav-link.in-drawer { width: 100%; }
.nav-dd.in-drawer > summary { width: 100%; padding: 0.75rem 0.7rem; color: var(--text); font-size: 1rem; }
.nav-dd.in-drawer .nav-dd-panel { position: static; width: auto; box-shadow: none; border: none; padding: 0 0 0 0.6rem; max-height: none; }
.nav-dd.in-drawer .dd-grid { grid-template-columns: 1fr; }
.um-group > .nav-link.in-drawer { padding: 0.75rem 0.7rem; color: var(--text); text-decoration: none; }
.visitor-menu { display: none; }
.hamburger { width: 40px; height: 40px; justify-content: center; font-size: 1.2rem; padding: 0; }

/* ---------- 19. Cards: slide-up info, quick rate, premium ---------- */
.community-card { position: relative; }
.card-link { position: absolute; inset: 0; z-index: 1; border-radius: inherit; }
.card-link:focus-visible { outline: 3px solid color-mix(in srgb, var(--primary) 55%, transparent); outline-offset: 2px; }
.card-badges, .info-toggle, .quick-rate { position: relative; z-index: 2; }
.card-badges { position: absolute; }
.card-info {
    position: absolute; inset: auto 0 0 0; z-index: 2; pointer-events: none;
    min-height: 62%; padding: 0.9rem 0.85rem 0.8rem; display: flex; flex-direction: column; gap: 0.35rem;
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.0), rgba(15, 23, 42, 0.92) 22%);
    color: #f8fafc; transform: translateY(101%); transition: transform 0.35s cubic-bezier(.2,.8,.2,1);
}
.community-card:hover .card-info, .community-card:focus-within .card-info, .community-card.show-info .card-info { transform: none; }
.card-info-title { margin: auto 0 0; font-family: var(--font-serif); font-weight: 700; font-size: 0.98rem; line-height: 1.25; }
.card-info-desc { margin: 0; font-size: 0.8rem; line-height: 1.45; opacity: 0.92; display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
.card-info-meta { margin: 0; font-size: 0.72rem; opacity: 0.8; }
.card-info-cta { font-size: 0.8rem; font-weight: 700; color: #fcd34d; }
.community-card:hover .play-hint { opacity: 0; }
.info-toggle {
    position: absolute; right: 0.45rem; top: 0.45rem; width: 30px; height: 30px; border-radius: 50%; border: none;
    background: rgba(255,255,255,0.9); color: #1e293b; font-size: 0.95rem; cursor: pointer; box-shadow: var(--shadow-sm);
    display: none;
}
@media (hover: none) { .info-toggle { display: block; } }
.quick-rate { display: inline-flex; align-items: center; gap: 0.35rem; }
.qr-stars { display: inline-flex; }
.qr-star { background: none; border: none; padding: 0 1px; font-size: 1.05rem; line-height: 1; color: var(--border-strong); cursor: pointer; transition: transform 0.15s cubic-bezier(.3,1.6,.5,1), color 0.12s ease; }
.qr-star.is-on, .qr-star.is-hover { color: var(--accent); }
.qr-star:hover { transform: scale(1.3) rotate(-8deg); }
.qr-num { font-size: 0.82rem; font-weight: 700; color: var(--text); }
.qr-num small { font-weight: 400; color: var(--text-muted); }
.quick-rate.is-saving { opacity: 0.6; }
.quick-rate.is-rated .qr-stars { animation: star-pop 0.4s ease; }
.mine-tag { font-size: 0.7rem; font-weight: 600; color: var(--text-muted); margin-left: 0.4rem; }
.flag-chip { font-size: 0.9rem; line-height: 1; }
.pill-premium { background: linear-gradient(135deg, #fde68a, #f59e0b); color: #78350f; text-decoration: none; }

.premium-box { background: linear-gradient(135deg, var(--accent-soft), var(--card-bg) 70%); border: 1px solid var(--accent-line); border-radius: var(--radius); padding: 1.4rem; margin-bottom: 1.5rem; scroll-margin-top: 5rem; }
.premium-head { display: flex; gap: 1rem; align-items: flex-start; }
.premium-crown { font-size: 2.2rem; animation: bob 3s ease-in-out infinite; }
.premium-head .hint { margin-top: 0; }
.pay-methods { display: flex; flex-wrap: wrap; gap: 0.7rem; align-items: stretch; margin-top: 0.6rem; }
.pay-method { position: relative; cursor: pointer; }
.pay-method input { position: absolute; opacity: 0; pointer-events: none; }
.pay-method span { display: flex; flex-direction: column; min-width: 130px; padding: 0.7rem 1rem; border-radius: 12px; border: 2px solid var(--border); background: var(--card-bg); transition: all 0.15s ease; }
.pay-method small { color: var(--text-muted); font-size: 0.75rem; }
.pay-method input:checked + span { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); transform: translateY(-2px); }
.pay-method input:focus-visible + span { outline: 3px solid color-mix(in srgb, var(--primary) 45%, transparent); }
.pm-bkash strong { color: #e2136e; } .pm-nagad strong { color: #f6921e; } .pm-card strong { color: var(--primary); }
.status-locked { background: var(--accent-soft); color: var(--accent-text); border: 1px dashed var(--accent-line); }
.premium-inputs { display: flex; align-items: center; gap: 0.8rem; flex-wrap: wrap; margin-top: 0.4rem; }
.input-prefix { display: inline-flex; align-items: center; border: 1px solid var(--border-strong); border-radius: 10px; overflow: hidden; background: var(--card-bg); }
.input-prefix span { padding: 0 0.6rem; font-weight: 700; color: var(--text-muted); }
.input-prefix .input { border: none; width: 110px; min-height: 40px; border-radius: 0; }
.input-xs { width: 70px !important; min-height: 34px !important; display: inline-block; margin-left: 0.3rem; }
.earnings { display: flex; gap: 2rem; align-items: center; flex-wrap: wrap; padding: 1.1rem 1.4rem; margin-bottom: 1.5rem; border-radius: var(--radius); background: var(--card-bg); border: 1px solid var(--border); }
.earnings > div { display: flex; flex-direction: column; }
.earnings .hint { flex: 1; min-width: 220px; margin: 0; }
.pay-paid { background: var(--success-bg); color: var(--success-text); }
.pay-pending { background: var(--info-bg); color: var(--info-text); }
.pay-failed, .pay-cancelled { background: var(--danger-bg); color: var(--danger-text); }
.pay-refunded { background: var(--warning-bg); color: var(--warning-text); }
.plain-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.5rem; }
.admin-filters { margin-bottom: 1rem; }
.ebook-drop { position: relative; cursor: pointer; min-height: 110px; margin-bottom: 0.8rem; }
.ebook-drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.new-book-tabs { display: flex; gap: 0.4rem; margin-bottom: 0.8rem; flex-wrap: wrap; }
.nb-tab { padding: 0.5rem 1rem; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--card-bg); color: var(--text); font: inherit; font-weight: 600; font-size: 0.88rem; cursor: pointer; }
.nb-tab.is-active { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.select-sm { flex: 0 1 160px !important; }

/* ---------- 20. Checkout (sandbox gateway) ---------- */
.checkout { max-width: 480px; margin: 0 auto; }
.sandbox-banner { background: var(--info-bg); color: var(--info-text); border-radius: 12px; padding: 0.6rem 0.9rem; font-size: 0.85rem; margin-bottom: 1rem; }
.checkout-card { background: var(--card-bg); border: 1px solid var(--border); border-radius: 20px; box-shadow: var(--shadow-lift); overflow: hidden; }
.checkout-brand { display: flex; align-items: center; gap: 0.8rem; padding: 1rem 1.2rem; color: #fff; background: var(--primary); }
.checkout-bkash .checkout-brand { background: linear-gradient(135deg, #e2136e, #b50f58); }
.checkout-nagad .checkout-brand { background: linear-gradient(135deg, #f6921e, #e0561b); }
.checkout-card .checkout-brand div { display: flex; flex-direction: column; line-height: 1.2; }
.checkout-brand span { font-size: 0.8rem; opacity: 0.9; }
.brand-dot { width: 42px; height: 42px; border-radius: 12px; background: rgba(255,255,255,0.2); display: flex; align-items: center; justify-content: center; font-size: 1.3rem; font-weight: 700; }
.checkout-timer { margin-left: auto; font-variant-numeric: tabular-nums; font-weight: 600; }
.checkout-order { display: flex; align-items: center; gap: 0.8rem; padding: 1rem 1.2rem; border-bottom: 1px solid var(--border); }
.checkout-order > div { display: flex; flex-direction: column; min-width: 0; }
.checkout-cover { width: 48px; aspect-ratio: 3 / 4; border-radius: 4px; flex: 0 0 auto; }
.checkout-cover .cover-initials { font-size: 0.9rem; }
.checkout-cover::before { display: none; }
.checkout-amount { margin-left: auto; font-family: var(--font-serif); font-size: 1.6rem; font-weight: 700; }
.checkout-form { padding: 1.2rem; }
.checkout-bkash .pay-btn { background: #e2136e; box-shadow: none; }
.checkout-nagad .pay-btn { background: #f6921e; box-shadow: none; }
.checkout-cancel { text-align: center; }
.checkout-foot { font-size: 0.75rem; color: var(--text-muted); text-align: center; padding: 0 1.2rem 1rem; margin: 0.3rem 0 0; }

/* ---------- 21. E-reader & Slideshow ---------- */
.container-reader { max-width: 1100px; margin-top: 1rem; }
.reader { --reader-font: 1.2rem; --paper: #fffdf7; --ink: #2b2b2b; --paper-edge: #e9e1cc; display: flex; flex-direction: column; min-height: calc(100vh - 110px); }
.reader.theme-sepia { --paper: #f4ecd8; --ink: #433422; --paper-edge: #dccfae; }
.reader.theme-night { --paper: #161b26; --ink: #d6d9e0; --paper-edge: #262d3d; }
.reader:fullscreen { background: var(--bg); padding: 1rem; }
.reader-bar { display: flex; align-items: center; gap: 0.7rem; flex-wrap: wrap; padding: 0.5rem 0 0.9rem; }
.reader-back { font-size: 1.3rem; text-decoration: none; color: var(--text-muted); padding: 0.2rem 0.5rem; border-radius: 8px; }
.reader-back:hover { background: var(--surface-2); }
.reader-cover { width: 36px; aspect-ratio: 3 / 4; border-radius: 4px; }
.reader-cover .cover-initials { font-size: 0.7rem; }
.reader-cover::before { display: none; }
.reader-titles { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.25; }
.reader-titles strong { font-family: var(--font-serif); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reader-titles span { font-size: 0.8rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reader-modes { display: inline-flex; background: var(--surface-2); border-radius: 999px; padding: 3px; }
.rm-btn { border: none; background: none; padding: 0.4rem 0.9rem; border-radius: 999px; font: inherit; font-size: 0.85rem; font-weight: 600; color: var(--text-muted); cursor: pointer; transition: all 0.15s ease; }
.rm-btn.is-active { background: var(--card-bg); color: var(--text); box-shadow: var(--shadow-sm); }
.reader-tools { display: flex; gap: 0.3rem; align-items: center; }
.tool-btn { min-width: 36px; height: 36px; border-radius: 8px; border: 1px solid var(--border); background: var(--card-bg); color: var(--text); cursor: pointer; font-weight: 700; font-size: 0.85rem; }
.tool-btn:hover { border-color: var(--primary); }
.reader.is-popped #popout-btn { background: var(--primary); color: var(--on-primary); }
.reader-select { height: 36px; border-radius: 8px; border: 1px solid var(--border); background: var(--card-bg); color: var(--text); font: inherit; font-size: 0.85rem; max-width: 170px; }

.reader-stage { position: relative; flex: 1; display: flex; align-items: stretch; gap: 0.6rem; perspective: 1600px; }
.page-deck { position: relative; flex: 1; min-height: 60vh; }
.paper {
    position: absolute; inset: 0; display: flex; flex-direction: column; background: var(--paper); color: var(--ink);
    border-radius: 6px 14px 14px 6px; padding: 1.6rem clamp(1.1rem, 4vw, 3rem) 1.2rem;
    box-shadow: inset 10px 0 18px -12px rgba(0,0,0,0.25), 0 1px 0 var(--paper-edge), 0 3px 0 -1px var(--paper), 0 4px 0 var(--paper-edge),
                0 18px 40px -18px rgba(15, 23, 42, 0.45);
    transition: transform 0.45s cubic-bezier(.2,.8,.2,1), opacity 0.45s ease; transform-origin: left center; outline: none;
}
.paper.enter-right { transform: translateX(40px) rotateY(-8deg); opacity: 0; }
.paper.enter-left { transform: translateX(-40px) rotateY(8deg); opacity: 0; }
.paper.leave-left { transform: translateX(-60px) rotateY(18deg); opacity: 0; }
.paper.leave-right { transform: translateX(60px) rotateY(-18deg); opacity: 0; }
.paper-head { display: flex; justify-content: space-between; font-size: 0.78rem; letter-spacing: 0.04em; text-transform: uppercase; opacity: 0.55; margin-bottom: 0.8rem; font-family: var(--font-sans); }
.paper-text { flex: 1; overflow-y: auto; white-space: pre-wrap; font-family: var(--font-serif), "Noto Sans Bengali", serif; font-size: var(--reader-font); line-height: 1.85; scroll-behavior: smooth; }
.paper-text .w { border-radius: 3px; transition: background-color 0.15s ease, color 0.15s ease; cursor: pointer; }
.paper-text .w.is-read { opacity: 0.55; }
.paper-text .w.is-current { background: var(--accent); color: #111; box-shadow: 0 0 0 2px var(--accent); opacity: 1; }
.paper-empty { opacity: 0.6; font-style: italic; }
.paper-locked { align-items: center; justify-content: center; text-align: center; }
.paywall { max-width: 380px; display: flex; flex-direction: column; align-items: center; gap: 0.6rem; }
.paywall-icon { font-size: 3rem; animation: bob 3s ease-in-out infinite; }
.paywall h2 { margin: 0; font-family: var(--font-serif); }
.paywall p { margin: 0 0 0.6rem; opacity: 0.8; }
.turn { align-self: center; width: 44px; height: 88px; border-radius: 12px; border: 1px solid var(--border); background: var(--card-bg); color: var(--text); font-size: 1.8rem; cursor: pointer; opacity: 0.7; transition: opacity 0.15s ease, transform 0.15s ease; }
.turn:hover:not(:disabled) { opacity: 1; transform: scale(1.05); }
.turn:disabled { opacity: 0.2; cursor: default; }
.reader.is-slideshow .turn { opacity: 0.35; }
.reader.is-slideshow .paper-text { font-size: calc(var(--reader-font) * 1.12); }
.reader-controls { position: sticky; bottom: 0; margin-top: 1rem; padding: 0.6rem 0.9rem calc(0.6rem + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--card-bg) 94%, transparent); backdrop-filter: blur(10px); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-md); z-index: 20; }
.rc-progress { display: flex; align-items: center; gap: 0.8rem; font-size: 0.8rem; color: var(--text-muted); }
.rc-progress input { flex: 1; accent-color: var(--primary); }
.rc-percent { font-weight: 600; color: var(--primary); white-space: nowrap; }
.rc-row { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.3rem; }
.rc-status { flex: 1; min-width: 120px; font-size: 0.85rem; color: var(--text-muted); }
.reader-earby { margin: -6px 0; }
.reader-earby .earby-bubble { display: none; }
body.reader-page .navbar { position: static; }

/* mini player in the pop-out window */
.pip-body { margin: 0; background: var(--card-bg); color: var(--text); font-family: var(--font-sans); }
.pip-player { display: grid; grid-template-columns: 64px 1fr; grid-template-rows: 1fr auto; gap: 0.5rem 0.8rem; padding: 0.8rem; height: 100vh; box-sizing: border-box; }
.pip-player[hidden] { display: none !important; }
.pip-cover { width: 64px; aspect-ratio: 3 / 4; border-radius: 6px; }
.pip-cover .cover-initials { font-size: 1rem; }
.pip-cover::before { display: none; }
.pip-info { min-width: 0; display: flex; flex-direction: column; }
.pip-title { font-family: var(--font-serif); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pip-page { font-size: 0.75rem; color: var(--text-muted); }
.pip-text { margin: 0.3rem 0 0; font-size: 0.85rem; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; font-family: var(--font-serif); }
.pip-controls { grid-column: 1 / -1; display: flex; justify-content: center; gap: 0.6rem; }
.pip-controls button { width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--border); background: var(--card-bg); color: var(--text); font-size: 1rem; cursor: pointer; }
.pip-controls .pip-main { width: 50px; height: 50px; background: var(--primary); color: var(--on-primary); border: none; }

/* ---------- 22. Earby AI assistant ---------- */
.assistant { position: fixed; right: 18px; bottom: 18px; z-index: 45; }
body.has-player .assistant { bottom: 128px; }
body.reader-page .assistant { display: none; }
.assistant-fab { position: relative; display: flex; align-items: center; background: none; border: none; padding: 0; cursor: pointer; }
.assistant-fab .earby { filter: drop-shadow(0 8px 14px rgba(15, 23, 42, 0.3)); transition: transform 0.2s ease; }
.assistant-fab:hover .earby { transform: translateY(-3px) scale(1.05); }
.assistant.is-open .assistant-fab .earby { transform: scale(0.9); }
.fab-greeting {
    position: absolute; right: calc(100% + 6px); bottom: 38px; width: max-content; max-width: 230px; text-align: left;
    background: var(--card-bg); color: var(--text); border: 1px solid var(--border-strong); border-radius: 14px 14px 4px 14px;
    padding: 0.55rem 0.8rem; font-size: 0.85rem; box-shadow: var(--shadow-md); animation: bubble-in 0.45s cubic-bezier(.2,1.4,.4,1) both;
}
.fab-greeting strong { display: block; font-size: 0.9rem; color: var(--primary); }
.fab-greeting span { display: block; color: var(--text-muted); font-size: 0.8rem; margin-top: 2px; }
.fab-ai-badge {
    position: absolute; top: -2px; right: -4px; padding: 1px 6px; border-radius: 999px; font: 800 0.65rem/1.5 var(--font-sans, sans-serif);
    letter-spacing: 0.04em; color: #fff; background: linear-gradient(135deg, #7c3aed, #db2777); border: 2px solid var(--card-bg);
    box-shadow: 0 2px 6px rgba(124, 58, 237, 0.45);
}
.assistant-fab::before {
    content: ""; position: absolute; inset: 4px 2px 10px; border-radius: 50%; border: 2px solid rgba(124, 58, 237, 0.55);
    animation: ai-ring 2.8s ease-out infinite; pointer-events: none;
}
.assistant.is-open .assistant-fab::before { display: none; }
@keyframes ai-ring { 0% { transform: scale(0.85); opacity: 0.9; } 70%, 100% { transform: scale(1.35); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .assistant-fab::before { animation: none; opacity: 0; } }
.assistant-panel {
    position: absolute; right: 0; bottom: calc(100% + 10px); width: min(390px, calc(100vw - 24px)); height: min(560px, calc(100vh - 140px));
    display: flex; flex-direction: column; background: var(--card-bg); border: 1px solid var(--border-strong); border-radius: 20px;
    box-shadow: var(--shadow-lift); overflow: hidden; opacity: 0; transform: translateY(12px) scale(0.97); transform-origin: bottom right;
    transition: opacity 0.2s ease, transform 0.2s ease;
}
.assistant-panel.is-open { opacity: 1; transform: none; }
.assistant-head { display: flex; align-items: center; gap: 0.6rem; padding: 0.6rem 0.8rem; color: #fff; background: linear-gradient(135deg, #4338ca, #7c3aed); }
.assistant-head .assistant-titles { flex: 1; display: flex; flex-direction: column; line-height: 1.2; }
.assistant-head .head-earby { flex: none; }
.assistant-sub { font-size: 0.75rem; opacity: 0.85; }
.head-earby { --earby-cover: #fbbf24; --earby-spine: #b45309; --earby-phones: #f8fafc; }
.head-earby .earby-bubble { display: none; }
.assistant-close, .assistant-clear { background: rgba(255,255,255,0.15); border: none; color: #fff; width: 32px; height: 32px; border-radius: 50%; cursor: pointer; font-size: 1.1rem; }
.assistant-log { flex: 1; overflow-y: auto; padding: 0.9rem; display: flex; flex-direction: column; gap: 0.6rem; background: var(--bg); }
.msg { max-width: 88%; animation: slide-in 0.25s ease both; }
.msg p { margin: 0; padding: 0.6rem 0.8rem; border-radius: 16px; font-size: 0.9rem; line-height: 1.5; overflow-wrap: anywhere; }
.msg-bot p { background: var(--card-bg); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.msg-user { align-self: flex-end; }
.msg-user p { background: var(--primary); color: var(--on-primary); border-bottom-right-radius: 4px; }
.msg-typing p { display: inline-flex; gap: 4px; }
.msg-typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--text-muted); animation: typing 1s infinite; }
.msg-typing span:nth-child(2) { animation-delay: 0.15s; } .msg-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes typing { 0%, 60%, 100% { transform: translateY(0); opacity: 0.4; } 30% { transform: translateY(-4px); opacity: 1; } }
.mini-cards { display: flex; flex-direction: column; gap: 0.4rem; margin-top: 0.45rem; }
.mini-card { display: flex; gap: 0.6rem; padding: 0.5rem; border-radius: 12px; background: var(--card-bg); border: 1px solid var(--border); text-decoration: none; color: var(--text); transition: border-color 0.15s ease, transform 0.15s ease; }
.mini-card:hover { border-color: var(--primary); transform: translateX(2px); }
.mini-cover-wrap img, .mini-cover { width: 42px; height: 56px; border-radius: 4px; object-fit: cover; flex: 0 0 auto; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: 0.8rem; font-family: var(--font-serif); }
.mini-body { display: flex; flex-direction: column; min-width: 0; font-size: 0.8rem; }
.mini-body strong { font-family: var(--font-serif); font-size: 0.9rem; }
.mini-author, .mini-desc { color: var(--text-muted); }
.mini-desc { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-top: 0.15rem; }
.mini-meta { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.mini-rating { color: var(--accent-text); font-weight: 700; } .mini-rating.muted { color: var(--text-muted); font-weight: 400; }
.mini-price { font-weight: 700; color: var(--primary); }
.assistant-chips { display: flex; gap: 0.35rem; flex-wrap: wrap; padding: 0.5rem 0.8rem 0; background: var(--bg); }
.assistant-chips[hidden] { display: none; }
.chip { border: 1px solid var(--primary-line); background: var(--primary-soft); color: var(--primary-dark); border-radius: 999px; padding: 0.3rem 0.7rem; font: inherit; font-size: 0.8rem; cursor: pointer; }
.chip:hover { border-color: var(--primary); }
.assistant-form { display: flex; gap: 0.4rem; padding: 0.6rem; border-top: 1px solid var(--border); background: var(--card-bg); }
.assistant-form .input { min-height: 40px; }
.assistant-mic.is-listening { background: var(--danger-bg); border-color: var(--danger-line); animation: rec-pulse 1.2s infinite; }

/* ---------- 12. Responsive ---------- */
@media (max-width: 860px) {
    .auth-layout { grid-template-columns: 1fr; min-height: 0; gap: 1.25rem; }
    .auth-brand { padding: 1.75rem 1.25rem; }
    .auth-tagline { font-size: 1.6rem; }
    .auth-points { display: none; }
    .admin-columns { grid-template-columns: 1fr; }
    .mp-options .mp-toggle { display: none; }
}

@media (max-width: 600px) {
    .navbar { padding: 0.5rem 0.9rem; flex-wrap: nowrap; }
    .brand { font-size: 1.15rem; }
    .nav-links { gap: 0.7rem; flex-wrap: nowrap; font-size: 0.88rem; }
    .nav-links a { padding: 0.55rem 0; }
    .theme-toggle { width: 34px; height: 34px; font-size: 0.9rem; }
    .nav-user { display: none; }
    .container { margin: 1.25rem auto; padding: 0 1rem; }

    .accent-heading { font-size: 1.75rem; }
    .library-hero { align-items: center; }
    .library-earby { --earby-size: 72px !important; }
    .library-earby .earby-bubble { right: 0; top: auto; bottom: calc(100% + 4px); max-width: 190px; border-radius: 14px 14px 4px 14px; font-size: 0.8rem; }
    .library-hero { padding-top: 3.2rem; }

    .form-row { grid-template-columns: 1fr; }
    .new-book-grid { flex-direction: column; align-items: center; }
    .new-book-fields { width: 100%; }
    .cover-picker { width: 110px; }

    .btn { min-height: var(--tap); }
    .btn-small { min-height: 40px; }
    .btn-link, .btn-link-danger, .page-text-toggle > summary { min-height: 40px; }

    .book-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; }
    .cover-initials { font-size: 2rem; }
    .book-card-body { padding: 0.7rem 0.75rem 0.8rem; }

    .book-hero { flex-wrap: wrap; }
    .book-cover-sm { width: 84px; }
    .book-title { font-size: 1.5rem; }
    .book-earby { display: none; }
    .hero-actions { width: 100%; }
    .hero-actions .btn { flex: 1; }

    .auth-card, .upload-box, .chapters-box, .pages-box, .settings-box, .new-book-form { padding: 1rem; }
    .file-drop { min-height: 170px; }
    .picker-buttons { width: 100%; }
    .picker-btn { flex: 1; }
    .page-row { padding: 0.85rem; }
    .text-panel { grid-template-columns: 1fr; }
    .page-photo img { max-height: 260px; }
    .resume-banner .btn { width: 100%; }

    body.has-player { padding-bottom: 150px; }
    .mini-player { bottom: 0; width: 100%; border-radius: 16px 16px 0 0; padding-left: 0.75rem; padding-right: 0.75rem; }
    .mp-row { flex-wrap: wrap; gap: 0.4rem 0.6rem; }
    .mp-now { flex: 1 1 0; }
    .mp-options { flex: 1 1 100%; justify-content: space-between; }
    .mp-opt select { min-height: 40px; }
    .auth-earby { --earby-size: 110px !important; }
    .auth-earby .earby-bubble { left: 60%; font-size: 0.78rem; max-width: 160px; }
}


@media (max-width: 900px) {
    .hero { grid-template-columns: 1fr; padding: 2rem 1.4rem; }
    .hero-art { display: none; }
    .how-steps { grid-template-columns: 1fr 1fr; }
    .editor-layout { grid-template-columns: 1fr; }
    .editor-sidebar { position: static; }
    .section-list { max-height: 180px; }
    .profile-hero { grid-template-columns: auto 1fr; }
    .profile-stats { grid-column: 1 / -1; grid-template-columns: repeat(4, auto); justify-content: start; }
}
@media (max-width: 960px) {
    /* Account menu becomes a slide-in drawer from the right.
       backdrop-filter on the navbar would trap position:fixed children inside it, so drop it here. */
    .navbar { backdrop-filter: none; -webkit-backdrop-filter: none; background: var(--card-bg); }
    .user-menu-name, .user-menu-btn .caret { display: none; }
    .user-menu-btn { padding: 0.15rem; }
    .user-menu-backdrop { display: block; position: fixed; inset: 0; background: rgba(15, 23, 42, 0.45); opacity: 0; visibility: hidden; transition: opacity 0.25s ease, visibility 0.25s; z-index: 60; }
    .user-menu.is-open .user-menu-backdrop { opacity: 1; visibility: visible; }
    .user-menu-panel {
        position: fixed; top: 0; right: 0; bottom: 0; z-index: 61; width: min(320px, 86vw);
        border-radius: 20px 0 0 20px; padding: 0.75rem 0.75rem calc(1rem + env(safe-area-inset-bottom));
        overflow-y: auto; transform: translateX(100%); opacity: 1; visibility: hidden;
        transition: transform 0.3s cubic-bezier(.2,.8,.2,1), visibility 0.3s;
    }
    .user-menu.is-open .user-menu-panel { transform: none; visibility: visible; }
    .um-close { display: block; }
    .um-mobile-only { display: flex; }
    .um-group a, .um-group button { padding: 0.75rem 0.7rem; font-size: 1rem; }
    body.menu-open { overflow: hidden; }
}
@media (max-width: 600px) {
    .hero-stats { grid-template-columns: repeat(2, auto); gap: 1rem 1.8rem; }
    .how-steps { grid-template-columns: 1fr; }
    .publish-paths { grid-template-columns: 1fr; }
    .reviews-summary { grid-template-columns: 1fr; }
    .kind-picker { grid-template-columns: 1fr; }
    .pw-rules { grid-template-columns: 1fr; }
    .progress-list li { grid-template-columns: 1fr; gap: 0.35rem; }
    .profile-hero { grid-template-columns: 1fr; text-align: center; justify-items: center; }
    .profile-stats { grid-template-columns: repeat(2, auto); }
    .profile-info .hero-actions { justify-content: center; }
    .filter-row .select { flex: 1 1 45%; }
    .shelf-row { grid-auto-columns: 150px; }
    .editor-title { font-size: 1.5rem; }
    .editor-text { min-height: 45vh; font-size: 1.05rem; }
    .cta-band { padding: 1.4rem; }
    .site-footer { flex-direction: column; }
}



@media (max-width: 600px) {
    .assistant { right: 10px; bottom: 10px; }
    body.has-player .assistant { bottom: 150px; }
    .assistant-panel { position: fixed; inset: auto 0 0 0; width: 100%; height: 85vh; border-radius: 20px 20px 0 0; transform-origin: bottom center; }
    .fab-greeting { max-width: 190px; font-size: 0.8rem; }
    .reader-bar { gap: 0.4rem; }
    .reader-tools .tool-btn#fullscreen-btn, .reader-select { display: none; }
    .turn { display: none; }
    .page-deck { min-height: 62vh; }
    .paper { padding: 1.1rem 1rem; }
    .rc-row .mp-toggle { display: none; }
    .pay-method span { min-width: 100px; }
    .checkout-amount { font-size: 1.3rem; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition: none !important; scroll-behavior: auto !important; }
    .book-card:hover { transform: none; }
    .float-letters { display: none; }
    .js-reveal .reveal { opacity: 1; transform: none; }
    .rotator-word { transition: none; }
}


/* ---------- 23. Homepage, movie-site style: spotlight carousel, poster grids, genre rows ---------- */
.spotlight {
    position: relative; height: clamp(400px, 56vh, 540px); margin: 0 0 1.6rem; border-radius: 24px; overflow: hidden;
    background: #0b1020; color: #fff; box-shadow: var(--shadow-lift); isolation: isolate;
}
.spot-slide {
    position: absolute; inset: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 2.5rem;
    padding: 2.6rem 3.2rem 3.4rem; opacity: 0; visibility: hidden; transition: opacity 0.8s ease, visibility 0.8s;
}
.spot-slide.is-active { opacity: 1; visibility: visible; }
.spot-bg {
    position: absolute; inset: -40px; z-index: -2; background-size: cover; background-position: center 25%;
    filter: blur(16px) saturate(1.25) brightness(0.62); transform: scale(1.08);
}
.spot-slide.is-active .spot-bg { animation: spot-zoom 14s ease-out forwards; }
@keyframes spot-zoom { from { transform: scale(1.08); } to { transform: scale(1.2) translateX(-12px); } }
.spot-slide::before {
    content: ""; position: absolute; inset: 0; z-index: -1;
    background: linear-gradient(90deg, rgba(7, 9, 24, 0.94) 0%, rgba(7, 9, 24, 0.66) 48%, rgba(7, 9, 24, 0.12) 100%),
                linear-gradient(0deg, rgba(7, 9, 24, 0.9) 0%, rgba(7, 9, 24, 0) 55%);
}
.spot-body { max-width: 640px; }
.spot-slide.is-active .spot-body > * { animation: spot-rise 0.7s cubic-bezier(.2,.8,.2,1) both; }
.spot-slide.is-active .spot-body > *:nth-child(2) { animation-delay: 0.06s; }
.spot-slide.is-active .spot-body > *:nth-child(3) { animation-delay: 0.12s; }
.spot-slide.is-active .spot-body > *:nth-child(n+4) { animation-delay: 0.18s; }
@keyframes spot-rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
.spot-rank {
    display: inline-block; margin: 0 0 0.7rem; padding: 0.2rem 0.7rem; border-radius: 999px; font-size: 0.75rem; font-weight: 700;
    letter-spacing: 0.06em; text-transform: uppercase; color: #fde68a; background: rgba(251, 191, 36, 0.16); border: 1px solid rgba(251, 191, 36, 0.4);
}
.spot-title { margin: 0 0 0.3rem; font-family: var(--font-serif); font-size: clamp(1.9rem, 3.8vw, 3.1rem); line-height: 1.1; text-shadow: 0 3px 18px rgba(0,0,0,0.45); color: #fff; }
.spot-author { margin: 0 0 0.8rem; font-style: italic; color: rgba(255,255,255,0.85); }
.spot-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.45rem 1rem; margin: 0 0 0.85rem; font-size: 0.85rem; color: rgba(255,255,255,0.88); }
.spot-meta small { opacity: 0.7; }
.spot-tag, .poster-tag { font-weight: 800; letter-spacing: 0.03em; color: #111827; background: #facc15; border-radius: 4px; }
.spot-tag { padding: 0.08rem 0.45rem; font-size: 0.72rem; }
.spot-tag.tag-premium, .poster-tag.tag-premium { background: linear-gradient(135deg, #fbbf24, #f97316); }
.spot-desc { margin: 0 0 1.3rem; max-width: 580px; line-height: 1.6; color: rgba(255,255,255,0.82); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.spot-actions { display: flex; flex-wrap: wrap; gap: 0.7rem; }
.btn-glass { background: rgba(255,255,255,0.12); color: #fff; border: 1px solid rgba(255,255,255,0.35); backdrop-filter: blur(6px); }
.btn-glass:hover { background: rgba(255,255,255,0.22); color: #fff; }
.spot-poster { display: block; width: clamp(170px, 17vw, 230px); border-radius: 10px; overflow: hidden; transform: rotate(-3deg); box-shadow: 0 30px 60px -18px rgba(0,0,0,0.75), 0 0 0 1px rgba(255,255,255,0.12); transition: transform 0.35s ease; }
.spot-poster:hover { transform: rotate(0) scale(1.03); }
.spot-slide.is-active .spot-poster { animation: spot-poster-in 0.9s cubic-bezier(.2,.8,.2,1) both; }
@keyframes spot-poster-in { from { opacity: 0; transform: translateX(40px) rotate(4deg); } to { opacity: 1; transform: rotate(-3deg); } }
.spot-cover { aspect-ratio: 2 / 3; }
.spot-nav {
    position: absolute; top: 50%; z-index: 2; width: 44px; height: 44px; margin-top: -22px; border-radius: 50%; cursor: pointer;
    font-size: 1.6rem; line-height: 1; color: #fff; background: rgba(255,255,255,0.12); border: 1px solid rgba(255,255,255,0.3);
    backdrop-filter: blur(6px); opacity: 0.55; transition: opacity 0.2s ease, background 0.2s ease;
}
.spotlight:hover .spot-nav, .spot-nav:focus-visible { opacity: 1; }
.spot-nav:hover { background: rgba(255,255,255,0.25); }
.spot-prev { left: 12px; } .spot-next { right: 12px; }
.spot-dots { position: absolute; left: 50%; bottom: 16px; z-index: 2; display: flex; gap: 6px; transform: translateX(-50%); }
.spot-dot { width: 22px; height: 4px; padding: 0; border: none; border-radius: 4px; background: rgba(255,255,255,0.35); cursor: pointer; transition: width 0.3s ease, background 0.3s ease; }
.spot-dot.is-active { width: 38px; background: #fff; }
.spot-dot:focus-visible { outline: 2px solid #fde68a; outline-offset: 3px; }

.admin-sync-banner {
    display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin: 0 0 1.6rem;
    padding: 0.9rem 1.1rem; border-radius: var(--radius); background: var(--accent-soft); border: 1px solid var(--accent-line); color: var(--accent-text);
}

.suggest { margin: 0 0 2.4rem; }
.suggest-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0.6rem 1rem; margin-bottom: 1rem; }
.suggest-head h2 { margin: 0; font-size: 0.85rem; font-family: var(--font-sans); font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: var(--primary); }
.suggest-tabs { display: flex; gap: 0.4rem; overflow-x: auto; scrollbar-width: none; }
.suggest-tab {
    flex: none; padding: 0.4rem 0.9rem; border-radius: 999px; border: 1px solid var(--border); background: var(--card-bg);
    color: var(--text-muted); font: 600 0.85rem var(--font-sans); cursor: pointer; transition: all 0.2s ease;
}
.suggest-tab:hover { color: var(--text); border-color: var(--border-strong); }
.suggest-tab.is-active { background: var(--primary); border-color: var(--primary); color: var(--on-primary, #fff); box-shadow: 0 4px 12px -4px color-mix(in srgb, var(--primary) 60%, transparent); }
.suggest-more { text-align: right; margin: 0.4rem 0 0; }

.poster-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 1.3rem 0.95rem; }
.poster-grid[hidden] { display: none; }
.poster { position: relative; min-width: 0; }
.poster-link { position: absolute; inset: 0; z-index: 3; border-radius: 10px; }
.poster-link:focus-visible { outline: 3px solid var(--primary); outline-offset: 3px; }
.poster-art { position: relative; border-radius: 10px; overflow: hidden; box-shadow: var(--shadow-md); transition: transform 0.25s ease, box-shadow 0.25s ease; }
.poster:hover .poster-art { transform: translateY(-5px); box-shadow: var(--shadow-lift); }
.poster-cover { aspect-ratio: 2 / 3; }
.poster-cover .cover-initials { font-size: 2rem; }
.poster-tag { position: absolute; top: 7px; right: 7px; z-index: 2; padding: 0.05rem 0.38rem; font-size: 0.62rem; }
.poster-kind { position: absolute; top: 6px; left: 6px; z-index: 2; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; font-size: 0.8rem; background: rgba(15, 23, 42, 0.55); backdrop-filter: blur(4px); }
.poster-hover {
    position: absolute; inset: 0; z-index: 1; display: flex; flex-direction: column; justify-content: flex-end; gap: 0.5rem; padding: 0.7rem;
    color: #fff; background: linear-gradient(0deg, rgba(10, 12, 32, 0.95) 10%, rgba(10, 12, 32, 0.35)); opacity: 0; transition: opacity 0.25s ease;
}
.poster-hover p { margin: 0; font-size: 0.74rem; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
.poster-play { position: absolute; top: 34%; left: 50%; display: grid; place-items: center; width: 46px; height: 46px; margin: -23px 0 0 -23px; border-radius: 50%; background: var(--primary); color: #fff; font-size: 1.05rem; box-shadow: 0 8px 20px -6px rgba(0,0,0,0.6); transform: scale(0.7); transition: transform 0.25s cubic-bezier(.2,1.4,.4,1); }
.poster:hover .poster-hover, .poster-link:focus-visible + .poster-art .poster-hover { opacity: 1; }
.poster:hover .poster-play { transform: scale(1); }
.poster:hover .book-cover img { transform: scale(1.06); }
.poster-title { margin: 0.5rem 0 0.15rem; font-size: 0.88rem; font-weight: 600; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.poster-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.15rem 0.45rem; margin: 0; font-size: 0.74rem; color: var(--text-muted); }
.poster-star { color: #d97706; font-weight: 700; }
.poster-row { grid-auto-columns: minmax(138px, 150px); gap: 0.95rem; }

.hero-compact { padding: 2rem 2.4rem 1.6rem; }
.hero-compact .hero-title { font-size: clamp(1.8rem, 3.6vw, 2.6rem); }

/* navbar search */

/* library books on the book page + admin */
.library-note { margin: 0.4rem 0 0; font-size: 0.85rem; color: var(--text-muted); }
.book-blurb { margin: 0.6rem 0 0.2rem; max-width: 62ch; line-height: 1.6; color: var(--text); }
.chapter-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 0.4rem; }
.chapter-list a { display: flex; justify-content: space-between; gap: 0.6rem; padding: 0.55rem 0.8rem; border-radius: 10px; border: 1px solid var(--border); text-decoration: none; color: var(--text); background: var(--card-bg); }
.chapter-list a:hover { border-color: var(--primary); color: var(--primary); }
.chapter-list small { color: var(--text-muted); white-space: nowrap; }
.admin-thumb { width: 34px; border-radius: 4px; }
.admin-thumb .cover-initials { font-size: 0.7rem; }
.lang-checks { border: none; padding: 0; margin: 0.6rem 0 1rem; display: flex; flex-wrap: wrap; gap: 0.4rem; }
.lang-checks legend { font-weight: 600; font-size: 0.9rem; margin-bottom: 0.4rem; }
.check-pill { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.3rem 0.7rem; border-radius: 999px; border: 1px solid var(--border); font-size: 0.85rem; cursor: pointer; }
.check-pill:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-dark); }
a.is-busy { pointer-events: none; opacity: 0.85; }

@media (max-width: 760px) {
    .spotlight { height: 470px; border-radius: 18px; margin-left: -4px; margin-right: -4px; }
    .spot-slide { grid-template-columns: 1fr; padding: 1.3rem 1.2rem 2.8rem; gap: 1rem; }
    .spot-poster { display: none; }
    .spot-bg { filter: blur(4px) saturate(1.2) brightness(0.5); inset: -10px; }
    .spot-title { font-size: 1.7rem; }
    .spot-desc { -webkit-line-clamp: 4; font-size: 0.92rem; }
    .spot-nav { display: none; }
    .poster-grid { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 1rem 0.7rem; }
    .poster-row { grid-auto-columns: 118px; }
    .poster-title { font-size: 0.8rem; }
    .poster-hover { display: none; }
    .hero-compact { padding: 1.6rem 1.3rem; }
}
@media (prefers-reduced-motion: reduce) {
    .spot-slide.is-active .spot-bg, .spot-slide.is-active .spot-body > *, .spot-slide.is-active .spot-poster { animation: none; }
}


/* ---------- 24. Hero: open book with letters floating out of it ---------- */
.story-book { position: relative; width: min(380px, 100%); aspect-ratio: 340 / 330; margin: 0 auto; }
.sb-book { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; overflow: visible; animation: sb-bob 6s ease-in-out infinite; }
@keyframes sb-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
.sb-shadow { fill: rgba(15, 23, 42, 0.12); }
.sb-cover { fill: var(--primary); }
.sb-page { fill: var(--earby-pages, #fffaf0); stroke: color-mix(in srgb, var(--primary) 35%, transparent); stroke-width: 2; }
.sb-lines path { fill: none; stroke: color-mix(in srgb, var(--primary) 22%, transparent); stroke-width: 3.5; stroke-linecap: round; }
.sb-spine { stroke: color-mix(in srgb, var(--primary) 45%, transparent); stroke-width: 2; }
.sb-ribbon { fill: var(--accent); }
.sb-turn {
    fill: var(--earby-pages, #fffaf0); stroke: color-mix(in srgb, var(--primary) 35%, transparent); stroke-width: 2;
    transform-origin: 170px 134px; animation: sb-flip 7s ease-in-out infinite;
}
@keyframes sb-flip {
    0%, 38% { transform: scaleX(1); opacity: 0; }
    40% { opacity: 1; filter: brightness(1); }
    55% { filter: brightness(0.86); }
    70% { transform: scaleX(-1); opacity: 1; filter: brightness(1); }
    72%, 100% { transform: scaleX(-1); opacity: 0; }
}
.sb-glow {
    position: absolute; left: 50%; bottom: 22%; width: 70%; height: 55%; transform: translateX(-50%); border-radius: 50%;
    background: radial-gradient(closest-side, color-mix(in srgb, var(--accent) 45%, transparent), transparent);
    filter: blur(8px); animation: sb-glow 3.5s ease-in-out infinite;
}
@keyframes sb-glow { 0%, 100% { opacity: 0.55; transform: translateX(-50%) scale(0.95); } 50% { opacity: 0.95; transform: translateX(-50%) scale(1.05); } }
.sb-letters { position: absolute; inset: 0; pointer-events: none; }
.sb-letters span {
    position: absolute; left: 50%; top: 58%; font-family: var(--font-serif); font-weight: 700; font-size: var(--size); line-height: 1;
    color: var(--primary); opacity: 0; transform: translate(-50%, 0) scale(0.4);
    animation: sb-rise var(--dur) cubic-bezier(.3,.7,.4,1) var(--delay) infinite;
}
.sb-letters span:nth-child(3n+2) { color: var(--accent); }
.sb-letters span:nth-child(4n+3) { color: #db2777; }
.sb-letters span:nth-child(5n+4) { color: #0891b2; }
@keyframes sb-rise {
    0% { opacity: 0; transform: translate(-50%, 0) scale(0.4) rotate(0deg); }
    15% { opacity: 1; }
    75% { opacity: 0.9; }
    100% { opacity: 0; transform: translate(calc(-50% + var(--dx)), -210px) scale(1.15) rotate(var(--rot)); }
}
@media (prefers-reduced-motion: reduce) {
    .sb-letters span { animation: none !important; opacity: 0.85; transform: translate(calc(-50% + var(--dx) * 0.8), var(--ry)) rotate(var(--rot)); }
    .sb-turn { display: none; }
}

/* ---------- 25. Admin console ---------- */
.admin-nav { display: flex; align-items: center; gap: 0.9rem; }
.admin-badge { font-size: 0.8rem; font-weight: 700; padding: 0.25rem 0.65rem; border-radius: 999px; color: #fff; background: linear-gradient(135deg, #0f766e, #0e7490); white-space: nowrap; }
.admin-whoami { flex-basis: 100%; margin: 0.2rem 0 0; }
.today-grid .stat-card { border-top: 3px solid var(--primary); }
.activity-box { margin-bottom: 1.6rem; }
.activity-list { list-style: none; margin: 0; padding: 0; max-height: 420px; overflow-y: auto; }
.activity-list li { display: grid; grid-template-columns: 32px 1fr auto; gap: 0.6rem; align-items: center; padding: 0.55rem 0.2rem; border-bottom: 1px solid var(--border); }
.activity-list li:last-child { border-bottom: none; }
.activity-icon { font-size: 1.1rem; text-align: center; }
.activity-what { display: flex; flex-direction: column; min-width: 0; }
.activity-what a { color: var(--text); text-decoration: none; font-weight: 600; }
.activity-what a:hover { color: var(--primary); }
.activity-what small { color: var(--text-muted); font-size: 0.78rem; }
.activity-list time { font-size: 0.78rem; color: var(--text-muted); white-space: nowrap; }
.admin-user { display: inline-flex; align-items: center; gap: 0.4rem; text-decoration: none; color: var(--text); }
@media (max-width: 960px) {
    .admin-nav { gap: 0.5rem; overflow-x: auto; max-width: 52vw; scrollbar-width: none; }
    .admin-nav .nav-link { font-size: 0.82rem; white-space: nowrap; }
    .admin-badge { display: none; }
}

/* ---------- 26. Whole-book recording + PDF upload ---------- */
.record-progress { display: flex; align-items: center; gap: 0.8rem; margin: 0 0 1.2rem; padding: 0.8rem 1rem; border-radius: var(--radius);
    background: var(--primary-soft); border: 1px solid var(--primary-line); }
.record-progress.is-done { background: var(--success-bg); border-color: transparent; }
.record-icon { font-size: 1.5rem; animation: rec-pulse 1.6s ease-in-out infinite; }
.record-progress.is-done .record-icon { animation: none; }
@keyframes rec-pulse { 50% { transform: scale(1.15); } }
.record-body { flex: 1; display: flex; flex-direction: column; gap: 0.3rem; min-width: 0; }
.record-body .progress { margin: 0; }
.record-detail { color: var(--text-muted); }
.record-compact { margin: 0 0 0.6rem; padding: 0.45rem 0.7rem; }
.record-compact .record-icon { font-size: 1.1rem; }
.record-compact .record-title { font-size: 0.85rem; }
.pdf-upload { display: flex; align-items: center; gap: 0.8rem; flex-wrap: wrap; margin-top: 0.9rem; padding: 0.8rem 1rem; border-radius: var(--radius); border: 1px dashed var(--border-strong); }
.pdf-pick { flex: 1; display: flex; align-items: center; gap: 0.7rem; cursor: pointer; min-width: 220px; }
.pdf-pick input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.pdf-pick-icon { font-size: 1.8rem; }
.pdf-pick span:last-child { display: flex; flex-direction: column; }
.pdf-pick small { color: var(--text-muted); font-size: 0.8rem; }
.pdf-pick:focus-within { outline: 3px solid var(--primary-soft); border-radius: 8px; }


/* ---------- 27. Navbar v2: pill buttons, expanding search, nothing disappears when zoomed ----------
   Width steps (zooming in makes the page "narrower", so these also cover 125%–300% zoom):
     > 1180px  everything with labels
     ≤ 1180px  browse buttons show only their icons
     ≤ 1000px  My Library / Write / Publish / Log in show only their icons
     ≤ 720px   browse buttons move into the ☰ / account drawer
   The search is a round 🔍 button everywhere; clicking it opens the search box. */
.navbar { flex-wrap: nowrap; gap: 0.75rem; }
.nav-left { gap: 1rem; min-width: 0; flex: 0 1 auto; }
.browse-links { display: flex; align-items: center; gap: 0.45rem; }
.nav-links { flex-wrap: nowrap; gap: 0.5rem; min-width: 0; }
.nav-pill, .nav-links a.nav-pill, .nav-dd > summary.nav-pill {
    display: inline-flex; align-items: center; gap: 0.35rem; height: 38px; padding: 0 0.85rem;
    border-radius: 999px; border: 1px solid var(--border); background: var(--card-bg); color: var(--text);
    font-weight: 600; font-size: 0.9rem; text-decoration: none; white-space: nowrap;
    box-shadow: var(--shadow-sm); transition: border-color 0.2s ease, background 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
}
.nav-pill:hover, .nav-links a.nav-pill:hover, .nav-dd[open] > summary.nav-pill {
    color: var(--primary); border-color: var(--primary-line); background: var(--primary-soft); transform: translateY(-1px);
}
.nav-pill.active, .nav-links a.nav-pill.active { color: var(--primary-dark); border-color: var(--primary); background: var(--primary-soft); }
.nav-pill-soft { background: color-mix(in srgb, var(--primary-soft) 55%, var(--card-bg)); border-color: var(--primary-line); }
.nav-ico { font-size: 1rem; line-height: 1; }
.nav-links a.btn { height: 38px; display: inline-flex; align-items: center; }
.nav-dd.in-drawer > summary.nav-pill, .nav-pill.in-drawer { height: auto; border: none; box-shadow: none; background: none; border-radius: 10px; }

/* expanding search */
.nav-search { position: relative; display: flex; align-items: center; height: 38px; border-radius: 999px;
    border: 1px solid var(--border); background: var(--card-bg); box-shadow: var(--shadow-sm);
    transition: box-shadow 0.2s ease, border-color 0.2s ease; }
.nav-search input { width: 0; padding: 0; opacity: 0; border: none; background: transparent; color: var(--text);
    font: 0.9rem var(--font-sans); outline: none; transition: width 0.3s cubic-bezier(.2,.8,.2,1), padding 0.3s ease, opacity 0.2s ease; }
.nav-search-btn { width: 36px; height: 36px; flex: none; border: none; border-radius: 50%; background: none; cursor: pointer; font-size: 1rem; }
.nav-search:hover { border-color: var(--primary-line); }
.nav-search.is-open { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.nav-search.is-open input { width: clamp(140px, 22vw, 340px); padding: 0 0.2rem 0 0.9rem; opacity: 1; }

@media (max-width: 1180px) {
    .browse-links .nav-label { display: none; }
    .browse-links .nav-pill { padding: 0 0.7rem; }
}
@media (max-width: 1000px) {
    .nav-links .nav-pill .nav-label, .nav-publish .nav-label, .nav-signup .nav-label { display: none; }
    .nav-links .nav-pill { padding: 0 0.7rem; }
    .nav-publish { padding: 0 0.8rem; font-size: 1.05rem; }
}
@media (max-width: 720px) {
    .browse-links { display: none; }
    .visitor-menu { display: block; }
    .um-mobile-only { display: flex; }
    .nav-links > .theme-toggle { display: none; }
    /* phones: the open search box becomes a full-width bar under the navbar */
    .nav-search.is-open { position: absolute; left: 0.75rem; right: 0.75rem; top: calc(100% + 0.4rem); z-index: 40; background: var(--card-bg); }
    .nav-search.is-open input { width: 100%; flex: 1; }
}
@media (max-width: 460px) {
    .nav-signup { display: none; }
    .nav-links { gap: 0.35rem; }
    .nav-pill, .nav-links a.nav-pill { padding: 0 0.6rem; }
}

/* admin: the ← Dashboard / ⬇ Export CSV buttons sit a little under the heading */
.page-header > .inline-form { flex-basis: 100%; margin-top: 0.9rem; }

/* ---------- 28. Accounts: forgot password, Google, invites, study files ---------- */
.login-row { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; flex-wrap: wrap; margin: 0.2rem 0 0.9rem; }
.login-row .checkbox { margin: 0; }
.forgot-link { font-size: 0.88rem; font-weight: 600; }
.auth-or { display: flex; align-items: center; gap: 0.7rem; margin: 1rem 0; color: var(--text-muted); font-size: 0.82rem; }
.auth-or::before, .auth-or::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.btn-google { display: inline-flex; align-items: center; justify-content: center; gap: 0.6rem; background: var(--card-bg);
    color: var(--text); border: 1px solid var(--border-strong); font-weight: 600; text-decoration: none; }
.btn-google:hover { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); color: var(--text); }
.g-mark { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; font: 800 0.85rem/1 var(--font-sans);
    color: #fff; background: conic-gradient(#ea4335 0 25%, #fbbc05 0 50%, #34a853 0 75%, #4285f4 0); }
.invite-banner { margin: 0 0 1rem; padding: 0.7rem 0.9rem; border-radius: 12px; background: var(--accent-soft); color: var(--accent-text); border: 1px solid var(--accent-line); font-size: 0.92rem; }
.invite-hero { display: grid; grid-template-columns: auto 1fr; gap: 1.2rem; align-items: center; padding: 1.6rem; border-radius: 20px;
    background: linear-gradient(135deg, var(--primary-soft), var(--card-bg)); border: 1px solid var(--border); margin-bottom: 1.4rem; }
.invite-gift { font-size: 3.2rem; }
.invite-link-row { display: flex; gap: 0.5rem; flex-wrap: wrap; margin: 0.8rem 0; }
.invite-link-row .input { flex: 1 1 260px; font-family: ui-monospace, Menlo, Consolas, monospace; }
.share-row { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.discount-note { margin: 0.4rem 0 0.8rem; color: var(--good); font-weight: 600; }
.price-was { text-decoration: line-through; opacity: 0.6; font-weight: 400; margin-right: 0.3rem; }
@media (max-width: 600px) { .invite-hero { grid-template-columns: 1fr; text-align: center; } }
.friend-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; }
.friend-list li { display: flex; align-items: center; gap: 0.6rem; }
.um-invite { color: var(--primary) !important; font-weight: 600; }
.status-study { background: var(--info-bg); color: var(--info-text); margin-right: 0.3rem; }
.study-intro { margin: 0 0 0.8rem; }

/* offline downloads */
.download-menu { position: relative; display: inline-block; }
.download-menu > summary { list-style: none; cursor: pointer; }
.download-menu > summary::-webkit-details-marker { display: none; }
.download-panel { position: absolute; z-index: 20; top: calc(100% + 6px); left: 0; width: 290px; padding: 0.5rem; border-radius: 14px;
    background: var(--card-bg); border: 1px solid var(--border-strong); box-shadow: var(--shadow-lift); }
.download-head { margin: 0.2rem 0.5rem 0.4rem; font-size: 0.78rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.download-panel a { display: flex; gap: 0.6rem; align-items: center; padding: 0.55rem 0.6rem; border-radius: 10px; color: var(--text); text-decoration: none; }
.download-panel a:hover { background: var(--primary-soft); }
.download-panel a > span:first-child { font-size: 1.3rem; }
.download-panel a small { display: block; color: var(--text-muted); font-size: 0.78rem; }
a.tool-btn { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; color: inherit; }

/* while the search box is open, the browse buttons shrink to icons so nothing overlaps */
.navbar.search-open .browse-links .nav-label { display: none; }
.navbar.search-open .browse-links .nav-pill { padding: 0 0.7rem; }
@media (max-width: 1280px) { .navbar.search-open .nav-links .nav-pill .nav-label { display: none; } .navbar.search-open .nav-links .nav-pill { padding: 0 0.7rem; } }
.nav-signup, .nav-publish { gap: 0; }
.google-error { margin: 0.5rem 0 0; }

/* ---------- 29. Round 8: zoom-safe tabs, account menu, settings, offline, continue reading ---------- */
/* Suggestion tabs wrap onto a second line instead of disappearing off the edge when zoomed in */
.suggest-tabs { flex-wrap: wrap; overflow: visible; }
@media (max-width: 900px) { .suggest-head { flex-direction: column; align-items: flex-start; } }

/* Account menu: scrolls by itself (never the page behind it) and fits the screen at any zoom */
.user-menu-panel { max-height: calc(100vh - 90px); max-height: calc(100dvh - 90px); overflow-y: auto; overscroll-behavior: contain; }
@media (max-width: 960px) { .user-menu-panel { max-height: none; } }
/* the avatar letters sit in the middle of the circle (the header's text rule used to push them out) */
.um-header .avatar { display: inline-flex; align-items: center; justify-content: center; }
.um-header .avatar-initials { color: #fff; font-size: calc(var(--size, 36px) * 0.4); font-weight: 700; }
.um-group .um-sub { margin-left: auto; font-size: 0.72rem; color: var(--text-muted); }
/* browse menus inside the phone drawer show their names */
.in-drawer .nav-label, .user-menu-panel .browse-links .nav-label { display: inline !important; }
.user-menu-panel .nav-dd.in-drawer summary, .user-menu-panel a.in-drawer { justify-content: flex-start; }

/* Dark / light switch is always in the navbar */
.nav-theme { flex: none; }
@media (max-width: 460px) { .nav-theme { width: 34px; height: 34px; } }

/* Settings: one page, quick jump links */
.settings-jump { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0 0 1.2rem; }
.settings-jump a { padding: 0.35rem 0.8rem; border-radius: 999px; border: 1px solid var(--border); background: var(--card-bg); color: var(--text); text-decoration: none; font-size: 0.88rem; }
.settings-jump a:hover { border-color: var(--primary); color: var(--primary); }
.settings-panel { scroll-margin-top: 90px; }

/* Continue reading cards */
.resume-pages { margin: 0.1rem 0 0.4rem; font-size: 0.78rem; color: var(--text-muted); }
.resume-btn { position: relative; z-index: 2; display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.3rem 0.8rem; border-radius: 999px; background: var(--primary); color: var(--on-primary, #fff) !important; font-size: 0.8rem; font-weight: 700; text-decoration: none; }
.resume-btn:hover { filter: brightness(1.08); }

/* Offline download page */
.offline-card { max-width: 760px; margin: 0 auto; }
.offline-top { display: flex; gap: 1.2rem; align-items: center; margin-bottom: 1.4rem; }
.offline-top h1 { margin: 0.2rem 0; font-family: var(--font-serif); }
.offline-cover { width: 96px; flex: none; border-radius: 10px; overflow: hidden; }
.offline-steps { background: var(--card-bg); border: 1px solid var(--border); border-radius: 18px; padding: 1.3rem 1.4rem; box-shadow: var(--shadow-md); }
.offline-progress-head { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.progress-lg { height: 12px; }
.progress .progress-bar, .progress > span { transition: width 0.6s ease; }
.offline-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; margin: 1rem 0; }
.offline-actions [aria-disabled="true"] { opacity: 0.5; pointer-events: none; }
.offline-list { padding-left: 0; list-style: none; display: grid; gap: 0.5rem; color: var(--text-muted); }
.download-main { background: var(--primary-soft); }

/* Reader zoom buttons */
.tool-btn:disabled { opacity: 0.4; cursor: default; }
/* keep the dark/light switch visible on small screens and at high zoom (logged in) */
@media (max-width: 720px) { .nav-links > .theme-toggle.nav-theme { display: inline-flex; } }
@media (max-width: 460px) {
    .nav-links { gap: 0.35rem; }
    .nav-links .nav-pill, .nav-search, .nav-search-btn, .nav-theme { width: 34px; height: 34px; padding: 0; justify-content: center; }
    .nav-publish { padding: 0 0.6rem; height: 34px !important; }
    .brand { font-size: 1.15rem; }
}
/* drawer: Country / Genre look like the other menu items */
.um-group .nav-dd.in-drawer > summary { font-weight: 500; }
.um-group .nav-dd.in-drawer > summary .caret { margin-left: auto; font-size: 0.7rem; color: var(--text-muted); }
.um-group .nav-pill.in-drawer { border: none !important; box-shadow: none !important; font-weight: 500; }
/* the assistant's greeting bubble never covers the open account menu */
body:has(.user-menu.is-open) .assistant { display: none; }
.user-menu.is-open .user-menu-panel .caret { transform: none; }
.user-menu-panel .nav-dd.in-drawer[open] > summary .caret { transform: rotate(180deg); }
.um-group .nav-dd.in-drawer > summary, .um-group .nav-pill.in-drawer { padding: 0.75rem 0.7rem !important; font-size: 1rem; gap: 0.65rem; display: flex; align-items: center; color: var(--text); }
.code-input { font-size: 1.6rem; letter-spacing: 0.4em; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }
.link-btn { background: none; border: none; padding: 0; color: var(--primary); font: inherit; font-weight: 600; cursor: pointer; text-decoration: underline; }
.google-note { display: flex; gap: 0.6rem; align-items: flex-start; }
.g-dot { flex: none; width: 1.6rem; height: 1.6rem; border-radius: 50%; display: grid; place-items: center; font-weight: 800; color: #fff; background: conic-gradient(#ea4335 0 25%, #fbbc05 0 50%, #34a853 0 75%, #4285f4 0); }

/* ---------- 30. Round 9: smooth & fun, publish-in-one, book requests ---------- */
/* Smooth page-to-page navigation (Chrome/Edge 126+ cross-fade the pages; others just load normally) */
/* (no cross-page view transition: it made every click wait for the next page before anything moved) */
/* Theme switch: the circular reveal is animated from JS; switch off the default cross-fade meanwhile */
html.theme-switching::view-transition-old(root), html.theme-switching::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
/* fallback fade for browsers without View Transitions */
html.theme-fading, html.theme-fading *, html.theme-fading *::before, html.theme-fading *::after {
    transition: background-color 0.45s ease, color 0.45s ease, border-color 0.45s ease, fill 0.45s ease, box-shadow 0.45s ease !important;
}
.theme-toggle.is-spinning { animation: theme-spin 0.55s cubic-bezier(.2,.8,.2,1); }
@keyframes theme-spin { from { transform: rotate(-120deg) scale(0.7); } to { transform: none; } }

/* Tactile buttons: a tiny press, a soft lift */
.btn, .nav-pill, .icon-btn, .vote-btn, .suggest-tab, .tool-btn { transition: transform 0.15s ease, box-shadow 0.2s ease, background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease; }
.btn:active, .nav-pill:active, .icon-btn:active, .vote-btn:active, .suggest-tab:active, .tool-btn:active { transform: scale(0.95); }
.btn-primary:hover { box-shadow: 0 8px 20px -8px color-mix(in srgb, var(--primary) 70%, transparent); transform: translateY(-1px); }
.poster:hover .poster-art, .book-card:hover { transform: translateY(-3px); }
.poster-art { transition: transform 0.25s cubic-bezier(.2,.8,.2,1), box-shadow 0.25s ease; }
.flash { animation: flash-in 0.4s cubic-bezier(.2,.8,.2,1) both; }
@keyframes flash-in { from { opacity: 0; transform: translateY(-10px) scale(0.98); } }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .btn:active, .nav-pill:active { transform: none; }
}

/* Publish: one form */
.publish-head { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; align-items: flex-end; }
.publish-side-links { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.publish-form { background: var(--card-bg); border: 1px solid var(--border); border-radius: 22px; padding: clamp(1rem, 3vw, 1.8rem); box-shadow: var(--shadow-md); margin: 1rem 0 2rem; }
.pf-step + .pf-step { margin-top: 1.6rem; padding-top: 1.4rem; border-top: 1px dashed var(--border); }
.pf-step h2 { display: flex; align-items: center; gap: 0.6rem; font-size: 1.15rem; margin: 0 0 0.9rem; }
.pf-num { display: grid; place-items: center; width: 1.9rem; height: 1.9rem; border-radius: 50%; background: var(--primary); color: #fff; font-size: 0.95rem; font-weight: 800; }
.publish-drop { min-height: 150px; border-style: dashed; transition: border-color 0.2s ease, background-color 0.2s ease, transform 0.2s ease; }
.publish-drop.is-dragover { transform: scale(1.01); border-color: var(--primary); background: var(--primary-soft); }
.publish-drop .file-drop-icon { font-size: 2.4rem; transition: transform 0.3s cubic-bezier(.2,.8,.2,1); }
.publish-drop:hover .file-drop-icon, .publish-drop.has-file .file-drop-icon { transform: rotate(-8deg) scale(1.12); }
.pf-files { list-style: none; padding: 0; margin: 0.8rem 0 0; display: flex; flex-wrap: wrap; gap: 0.4rem; }
.pf-files li { padding: 0.25rem 0.7rem; border-radius: 999px; background: var(--surface-2); font-size: 0.82rem; animation: pop-in 0.3s calc(var(--i, 0) * 40ms) both cubic-bezier(.2,.8,.2,1.3); }
@keyframes pop-in { from { opacity: 0; transform: scale(0.6); } }
.pf-visibility { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 0.7rem; margin-bottom: 0.9rem; }
.pf-choice { display: flex; gap: 0.7rem; align-items: flex-start; padding: 0.9rem 1rem; border: 2px solid var(--border); border-radius: 14px; cursor: pointer; transition: border-color 0.2s ease, background-color 0.2s ease; }
.pf-choice:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.pf-choice span { display: flex; flex-direction: column; gap: 0.2rem; }
.pf-choice small { color: var(--text-muted); }
.pf-public-only { transition: opacity 0.25s ease; }
.pf-public-only.is-off { opacity: 0.35; pointer-events: none; }
.pf-rights { margin: 0.6rem 0 1rem; }
.pf-submit { min-width: 220px; }
.request-banner { display: flex; gap: 0.8rem; align-items: center; padding: 0.9rem 1.1rem; border-radius: 16px; background: linear-gradient(120deg, #fef3c7, #fde68a); color: #3b2f05; margin: 0.5rem 0 1rem; }
.request-banner-icon { font-size: 1.8rem; animation: wave 1.6s ease-in-out infinite; transform-origin: 70% 80%; }
@keyframes wave { 0%, 60%, 100% { transform: rotate(0); } 20% { transform: rotate(14deg); } 40% { transform: rotate(-8deg); } }
.add-book-cta { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin: 0.5rem 0 1.5rem; }
.icon-btn { border: 1px solid var(--border); background: var(--card-bg); border-radius: 10px; width: 36px; height: 36px; cursor: pointer; }
.icon-danger:hover { border-color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, var(--card-bg)); }
.publish-item .inline-form { margin: 0; }

/* Book requests */
.requests-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; }
.requests-stats { display: flex; gap: 0.8rem; }
.requests-stats div { background: var(--card-bg); border: 1px solid var(--border); border-radius: 14px; padding: 0.5rem 1rem; text-align: center; }
.requests-stats strong { display: block; font-size: 1.5rem; }
.requests-stats span { font-size: 0.8rem; color: var(--text-muted); }
.requests-layout { display: grid; grid-template-columns: minmax(260px, 360px) 1fr; gap: 1.5rem; align-items: start; margin-top: 1rem; }
@media (max-width: 860px) { .requests-layout { grid-template-columns: 1fr; } }
.request-ask { position: sticky; top: 90px; }
@media (max-width: 860px) { .request-ask { position: static; } }
.request-maybe { display: flex; gap: 0.7rem; align-items: center; padding: 0.6rem; border-radius: 12px; background: var(--primary-soft); margin-bottom: 0.8rem; }
.maybe-cover, .found-cover { width: 44px; flex: none; border-radius: 6px; overflow: hidden; }
.request-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.7rem; }
.request-card { display: grid; grid-template-columns: auto 1fr auto; gap: 0.9rem; align-items: center; padding: 0.9rem; background: var(--card-bg); border: 1px solid var(--border); border-radius: 16px; transition: transform 0.2s ease, box-shadow 0.2s ease; }
.request-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.request-card:target { outline: 3px solid var(--accent); }
@media (max-width: 600px) { .request-card { grid-template-columns: auto 1fr; } .request-actions { grid-column: 1 / -1; } }
.request-body h3 { margin: 0; font-size: 1.05rem; }
.request-meta { margin: 0.15rem 0 0; font-size: 0.82rem; color: var(--text-muted); }
.request-note { margin: 0.3rem 0 0; font-size: 0.85rem; font-style: italic; }
.request-actions { display: flex; gap: 0.4rem; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.vote-btn { display: flex; flex-direction: column; align-items: center; min-width: 52px; padding: 0.35rem 0.5rem; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); cursor: pointer; font-weight: 700; }
.vote-btn:disabled { cursor: default; opacity: 0.8; }
.vote-btn.is-voted { background: var(--primary); border-color: var(--primary); color: #fff; }
.vote-btn.is-bumping .vote-arrow { animation: bump 0.4s cubic-bezier(.2,.8,.2,1.5); }
@keyframes bump { 50% { transform: translateY(-6px) scale(1.3); } }
.vote-pill { display: inline-block; padding: 0.05rem 0.45rem; border-radius: 999px; background: var(--primary-soft); color: var(--primary); font-size: 0.75rem; font-weight: 700; }
.link-mine { position: relative; }
.link-mine-form { position: absolute; right: 0; top: calc(100% + 6px); z-index: 5; display: flex; gap: 0.4rem; padding: 0.6rem; background: var(--card-bg); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-md); min-width: 280px; }
.found-title { margin-top: 2rem; }
.found-list { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 0.6rem; }
.found-list a { display: flex; gap: 0.7rem; align-items: center; padding: 0.6rem; border-radius: 12px; background: var(--card-bg); border: 1px solid var(--border); text-decoration: none; color: var(--text); }
.found-list small { display: block; color: var(--text-muted); font-size: 0.75rem; }
.empty-requests { text-align: center; padding: 2rem 1rem; color: var(--text-muted); }
.empty-requests span { font-size: 3rem; display: block; animation: wave 2.4s ease-in-out infinite; }
.request-chips { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 0.5rem; }
.request-chips a { display: inline-flex; gap: 0.4rem; align-items: center; padding: 0.4rem 0.8rem; border-radius: 999px; border: 1px solid var(--border); background: var(--card-bg); color: var(--text); text-decoration: none; }
.request-chips a:hover { border-color: var(--primary); }
.publish-drop { position: relative; cursor: pointer; }
.publish-drop input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.password-wrap { position: relative; }
.password-wrap .input { padding-right: 2.8rem; }
.pw-match { margin-top: 0.35rem; color: var(--danger); }
.pw-match.is-ok { color: var(--success, #16a34a); }
/* thin loading bar on every click */
.nav-progress { position: fixed; top: 0; left: 0; height: 3px; width: 0; z-index: 200; pointer-events: none;
    background: linear-gradient(90deg, var(--primary), var(--accent)); box-shadow: 0 0 10px var(--primary); opacity: 0; }
.nav-progress.is-loading { opacity: 1; animation: nav-progress 8s cubic-bezier(.1,.7,.2,1) forwards; }
.nav-progress.is-done { width: 100%; opacity: 0; transition: opacity 0.3s ease 0.1s; }
@keyframes nav-progress { 0% { width: 0; } 10% { width: 45%; } 40% { width: 75%; } 100% { width: 94%; } }

/* ---------- 31. Round 10: student discount, EarBook Pay, receipts, highlights, dictionary, streaks ---------- */
/* Student discount */
.student-hero { display: flex; gap: 1rem; align-items: center; margin-bottom: 1.2rem; }
.student-hero-icon { font-size: 2.6rem; width: 72px; height: 72px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 22px;
    background: linear-gradient(135deg, var(--primary-soft), var(--accent-soft)); box-shadow: var(--shadow-md); }
.student-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 1rem; align-items: start; }
.student-aside .pages-box { margin-bottom: 1rem; }
.student-aside h3 { margin: 0 0 0.6rem; font-size: 1rem; }
.how-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.55rem; }
.how-list li { display: flex; gap: 0.6rem; align-items: flex-start; font-size: 0.92rem; }
.how-list span { flex: 0 0 24px; height: 24px; border-radius: 50%; background: var(--primary); color: #fff; font-size: 0.8rem; font-weight: 700; display: grid; place-items: center; }
.privacy-box p { font-size: 0.9rem; margin: 0 0 0.5rem; }
.student-state { display: flex; gap: 0.9rem; align-items: flex-start; padding: 1rem; border-radius: var(--radius); margin-bottom: 1rem; }
.student-state h2 { margin: 0 0 0.3rem; font-size: 1.15rem; }
.student-state p { margin: 0 0 0.5rem; }
.state-icon { font-size: 1.8rem; line-height: 1; }
.state-ok { background: var(--success-bg); color: var(--success-text); }
.state-wait { background: var(--info-bg); color: var(--info-text); }
.state-no { background: var(--warning-bg); color: var(--warning-text); }
.student-card-thumb { display: block; max-width: 260px; width: 100%; border-radius: 10px; margin-top: 0.4rem; box-shadow: var(--shadow-md); }
.student-steps { list-style: none; display: flex; padding: 0; margin: 0; gap: 0.3rem; counter-reset: st; }
.student-steps li { flex: 1; text-align: center; font-size: 0.8rem; padding: 0.45rem 0.3rem; border-radius: 999px; background: var(--surface-2); color: var(--text-muted); }
.student-steps li.done { background: var(--success-bg); color: var(--success-text); }
.student-steps li.now { background: var(--primary); color: #fff; animation: pulse-soft 1.8s ease-in-out infinite; }
@keyframes pulse-soft { 50% { opacity: 0.75; } }
.id-drop { position: relative; display: grid; place-items: center; min-height: 190px; border: 2px dashed var(--border-strong); border-radius: 16px;
    background: var(--surface-2); cursor: pointer; overflow: hidden; margin-bottom: 1rem; transition: border-color 0.2s, background 0.2s; }
.id-drop:hover, .id-drop.is-over { border-color: var(--primary); background: var(--primary-soft); }
.id-drop input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.id-drop-empty { display: flex; flex-direction: column; align-items: center; gap: 0.2rem; text-align: center; padding: 1rem; pointer-events: none; }
.id-drop-icon { font-size: 2.4rem; }
.id-drop-empty small { color: var(--text-muted); }
.id-drop-preview { width: 100%; max-height: 260px; object-fit: contain; pointer-events: none; }
.id-drop.has-photo .id-drop-empty { display: none; }
.check-line { display: flex; gap: 0.5rem; align-items: center; margin: 0.4rem 0 1rem; font-size: 0.92rem; }
/* admin review */
.sv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 1rem; }
.sv-card { display: grid; grid-template-columns: 150px 1fr; gap: 0.8rem; padding: 0.8rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--card-bg); }
.sv-photo img { width: 100%; height: 150px; object-fit: contain; border-radius: 10px; background: var(--surface-2); }
.sv-facts { display: grid; grid-template-columns: auto 1fr; gap: 0.15rem 0.6rem; font-size: 0.85rem; margin: 0.4rem 0; }
.sv-facts dt { color: var(--text-muted); }
.sv-facts dd { margin: 0; }
.sv-auto { font-size: 0.82rem; padding: 0.35rem 0.55rem; border-radius: 8px; background: var(--surface-2); margin: 0 0 0.6rem; }
.sv-auto.is-good { background: var(--success-bg); color: var(--success-text); }
.sv-actions { display: flex; flex-direction: column; gap: 0.4rem; }
.sv-reject { display: flex; gap: 0.4rem; }
.sv-reject select { font-size: 0.8rem; min-width: 0; }
.nav-count { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--danger); color: #fff; font-size: 0.7rem; font-weight: 700; margin-left: 0.25rem; }
@media (max-width: 860px) { .student-layout { grid-template-columns: 1fr; } }
@media (max-width: 480px) { .sv-card { grid-template-columns: 1fr; } .sv-photo img { height: 200px; } }

/* EarBook Pay: the sandbox payment gateway */
.gateway-page .navbar, .gateway-page .site-footer { display: none; }
.gateway-page { min-height: 100vh; background: linear-gradient(180deg, var(--surface-2), var(--bg)) fixed; }
.gateway-page main, .gateway-page .container { padding-top: 2vh; }
.gw-topbar { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; max-width: 940px; margin: 0.4rem auto 1rem; font-size: 0.9rem; color: var(--text-muted); }
.gw-topbar strong { color: var(--text); }
.gw-lock { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; background: var(--success-bg); }
.gw-sandbox { margin-left: auto; font-size: 0.75rem; padding: 0.2rem 0.6rem; border-radius: 999px; background: var(--warning-bg); color: var(--warning-text); cursor: help; }
.gateway { --gw: var(--primary); --gw-dark: var(--primary-dark); display: grid; grid-template-columns: 330px minmax(0, 1fr); max-width: 940px; margin: 0 auto 2rem;
    background: var(--card-bg); border: 1px solid var(--border); border-radius: 22px; box-shadow: var(--shadow-lift); overflow: hidden; }
.gw-bkash { --gw: #e2136e; --gw-dark: #b50f58; }
.gw-nagad { --gw: #f7941d; --gw-dark: #d8431b; }
.gw-card { --gw: #1f3a8a; --gw-dark: #172554; }
.gw-summary { padding: 1.4rem; background: var(--surface-2); border-right: 1px solid var(--border); display: flex; flex-direction: column; gap: 1rem; }
.gw-merchant { display: flex; gap: 0.7rem; align-items: center; }
.gw-merchant div { display: flex; flex-direction: column; line-height: 1.2; }
.gw-merchant small { color: var(--text-muted); font-size: 0.75rem; }
.gw-merchant-logo { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 12px; background: var(--primary); font-size: 1.4rem; }
.gw-item { display: flex; gap: 0.7rem; align-items: center; }
.gw-item > div { display: flex; flex-direction: column; min-width: 0; }
.gw-item small { color: var(--text-muted); font-size: 0.78rem; }
.gw-lines { margin: 0; display: grid; gap: 0.35rem; font-size: 0.92rem; border-top: 1px dashed var(--border-strong); padding-top: 0.8rem; }
.gw-lines > div { display: flex; justify-content: space-between; gap: 0.5rem; }
.gw-lines dt { color: var(--text-muted); } .gw-lines dd { margin: 0; font-variant-numeric: tabular-nums; }
.gw-discount dd, .gw-discount dt { color: var(--good) !important; }
.gw-total { border-top: 1px solid var(--border); padding-top: 0.5rem; margin-top: 0.2rem; font-weight: 700; font-size: 1.15rem; }
.gw-total dt { color: var(--text) !important; }
.gw-meta { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; font-size: 0.8rem; color: var(--text-muted); }
.gw-meta .checkout-timer { margin: 0; padding: 0.15rem 0.5rem; border-radius: 999px; background: var(--card-bg); color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.gw-meta .checkout-timer.is-low { background: var(--danger-bg); color: var(--danger-text); }
.gw-note { font-size: 0.75rem; color: var(--text-muted); margin: auto 0 0; }
.gw-panel { display: flex; flex-direction: column; min-height: 460px; }
.gw-brand { display: flex; align-items: baseline; gap: 0.7rem; flex-wrap: wrap; padding: 1.1rem 1.4rem; color: #fff; background: linear-gradient(135deg, var(--gw), var(--gw-dark)); }
.gw-wordmark { font-size: 1.6rem; font-weight: 800; letter-spacing: -0.02em; font-style: italic; }
.gw-brand-sub { font-size: 0.8rem; opacity: 0.9; }
.gw-amount { margin-left: auto; font-size: 1.4rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.gw-stepper { list-style: none; display: flex; margin: 0; padding: 0.8rem 1.4rem; gap: 0.4rem; border-bottom: 1px solid var(--border); counter-reset: gw; }
.gw-stepper li { flex: 1; font-size: 0.75rem; color: var(--text-muted); display: flex; align-items: center; gap: 0.35rem; counter-increment: gw; }
.gw-stepper li::before { content: counter(gw); font-size: 0.75rem; width: 22px; height: 22px; flex: 0 0 auto; border-radius: 50%; display: grid; place-items: center; font-weight: 700;
    background: var(--surface-2); color: var(--text-muted); transition: background 0.25s, color 0.25s; }
.gw-stepper li.is-now { color: var(--text); font-weight: 600; }
.gw-stepper li.is-now::before { background: var(--gw); color: #fff; box-shadow: 0 0 0 4px color-mix(in srgb, var(--gw) 20%, transparent); }
.gw-stepper li.is-done::before { content: "✓"; background: var(--good); color: #fff; }
.gw-error { margin: 0.9rem 1.4rem 0; padding: 0.6rem 0.8rem; border-radius: 10px; background: var(--danger-bg); color: var(--danger-text); font-size: 0.9rem; }
.gw-form { padding: 1.2rem 1.4rem; flex: 1; }
.gateway.js .gw-step { display: none; }
.gateway.js .gw-step.is-current { display: block; animation: gw-in 0.3s ease; }
@keyframes gw-in { from { opacity: 0; transform: translateX(14px); } }
.gateway:not(.js) .gw-step + .gw-step { margin-top: 1.2rem; padding-top: 1.2rem; border-top: 1px solid var(--border); }
.gw-label { display: block; font-weight: 600; margin-bottom: 0.45rem; font-size: 0.95rem; }
.gw-phone { display: flex; align-items: stretch; border: 2px solid var(--border-strong); border-radius: 12px; overflow: hidden; background: var(--card-bg); }
.gw-phone:focus-within { border-color: var(--gw); }
.gw-phone span { display: grid; place-items: center; padding: 0 0.8rem; background: var(--surface-2); color: var(--text-muted); font-weight: 600; }
.gw-phone input { flex: 1; border: 0; outline: 0; padding: 0.8rem; font-size: 1.25rem; letter-spacing: 0.08em; background: transparent; color: var(--text); min-width: 0; font-variant-numeric: tabular-nums; }
.gw-code { width: 100%; padding: 0.8rem; font-size: 1.6rem; text-align: center; letter-spacing: 0.5em; border: 2px solid var(--border-strong); border-radius: 12px;
    background: var(--card-bg); color: var(--text); font-variant-numeric: tabular-nums; }
.gw-code:focus { outline: 0; border-color: var(--gw); }
.gw-step .input:focus { border-color: var(--gw); }
.is-bad { border-color: var(--danger) !important; animation: gw-shake 0.35s; }
@keyframes gw-shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
.gw-field-error { color: var(--danger); font-size: 0.82rem; margin: 0.35rem 0 0; }
.gw-agree { display: flex; gap: 0.45rem; align-items: center; font-size: 0.85rem; margin: 0.8rem 0 0.2rem; }
.test-hint { font-size: 0.74rem; color: var(--warning-text); margin: 0.35rem 0 0; opacity: 0.85; }
.test-hint::before { content: "🧪 "; }
.gw-resend { font-size: 0.85rem; color: var(--text-muted); margin: 0.6rem 0 0; }
.gw-buttons { display: flex; gap: 0.6rem; margin-top: 1.3rem; }
.gw-btn { flex: 1; padding: 0.85rem 1rem; border-radius: 12px; border: 0; font-weight: 700; font-size: 1rem; cursor: pointer; color: #fff; background: var(--gw);
    transition: transform 0.1s ease, filter 0.2s ease; }
.gw-btn:hover { filter: brightness(1.08); }
.gw-btn:active { transform: scale(0.98); }
.gw-btn-ghost { flex: 0 0 auto; background: var(--surface-2); color: var(--text); }
.gw-3ds { padding: 0.9rem 1rem; border-radius: 12px; background: var(--surface-2); margin-bottom: 1rem; font-size: 0.88rem; }
.gw-3ds p { margin: 0.35rem 0 0.6rem; color: var(--text-muted); }
.gw-3ds dl { margin: 0; display: grid; gap: 0.2rem; }
.gw-3ds dl div { display: flex; justify-content: space-between; } .gw-3ds dt { color: var(--text-muted); } .gw-3ds dd { margin: 0; font-weight: 600; }
.gw-processing { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.5rem; padding: 2rem; text-align: center; }
.gw-processing small { color: var(--text-muted); }
.gw-spinner { width: 54px; height: 54px; border-radius: 50%; border: 5px solid var(--surface-2); border-top-color: var(--gw); animation: spin 0.8s linear infinite; margin-bottom: 0.5rem; }
@keyframes spin { to { transform: rotate(360deg); } }
.gateway.is-processing .checkout-cancel { display: none; }
.gw-panel .checkout-cancel { padding: 0 1.4rem 1.1rem; text-align: center; font-size: 0.85rem; }
/* card picture */
.card-visual { position: relative; width: min(100%, 320px); aspect-ratio: 1.586; margin: 0 auto 1.1rem; perspective: 900px; }
.cv-front, .cv-back { position: absolute; inset: 0; border-radius: 16px; padding: 1rem 1.1rem; color: #fff; backface-visibility: hidden;
    background: linear-gradient(135deg, #334155, #0f172a); box-shadow: 0 14px 30px -12px rgba(0,0,0,.5); transition: transform 0.6s cubic-bezier(.2,.8,.2,1), background 0.4s; }
.card-visual[data-brand=visa] .cv-front, .card-visual[data-brand=visa] .cv-back { background: linear-gradient(135deg, #1e40af, #172554); }
.card-visual[data-brand=mastercard] .cv-front, .card-visual[data-brand=mastercard] .cv-back { background: linear-gradient(135deg, #b45309, #7c2d12); }
.card-visual[data-brand=amex] .cv-front, .card-visual[data-brand=amex] .cv-back { background: linear-gradient(135deg, #0f766e, #134e4a); }
.cv-back { transform: rotateY(180deg); padding: 1.2rem 0; }
.card-visual.is-flipped .cv-front { transform: rotateY(-180deg); }
.card-visual.is-flipped .cv-back { transform: rotateY(0); }
.cv-chip { position: absolute; top: 1.1rem; left: 1.1rem; width: 40px; height: 30px; border-radius: 6px; background: linear-gradient(135deg, #fde68a, #d97706); }
.cv-brand { position: absolute; top: 1rem; right: 1.1rem; font-weight: 800; font-style: italic; letter-spacing: 0.04em; }
.cv-number { position: absolute; left: 1.1rem; right: 1.1rem; top: 48%; font-size: 1.2rem; letter-spacing: 0.12em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cv-name { position: absolute; left: 1.1rem; bottom: 1rem; font-size: 0.78rem; letter-spacing: 0.08em; max-width: 65%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cv-exp { position: absolute; right: 1.1rem; bottom: 1rem; font-size: 0.8rem; }
.cv-strip { display: block; height: 40px; background: #111; }
.cv-cvc { display: block; width: 70%; margin: 1rem auto 0; padding: 0.4rem 0.6rem; background: #f8fafc; color: #111; text-align: right; font-style: italic; border-radius: 4px; }
/* the pretend SMS */
.gw-sms { position: fixed; top: 14px; right: 14px; z-index: 300; width: min(340px, calc(100vw - 28px)); padding: 0.8rem 0.9rem; border-radius: 18px; cursor: pointer;
    background: color-mix(in srgb, var(--card-bg) 88%, transparent); backdrop-filter: blur(12px); border: 1px solid var(--border); box-shadow: var(--shadow-lift);
    transform: translateY(-140%); transition: transform 0.45s cubic-bezier(.2,.9,.3,1.2); }
.gw-sms.is-in { transform: translateY(0); }
.gw-sms-app { display: block; font-size: 0.72rem; color: var(--text-muted); margin-bottom: 0.2rem; }
.gw-sms p { margin: 0.2rem 0; font-size: 0.9rem; }
.gw-sms small { font-size: 0.7rem; color: var(--warning-text); }
@media (max-width: 780px) {
    .gateway { grid-template-columns: 1fr; border-radius: 18px; }
    .gw-summary { border-right: 0; border-bottom: 1px solid var(--border); padding: 1rem; gap: 0.7rem; }
    .gw-note { display: none; }
    .gw-panel { min-height: 0; }
    .gw-form { padding: 1rem; }
    .gw-brand { padding: 0.9rem 1rem; }
    .gw-stepper { padding: 0.7rem 1rem; }
    .gw-stepper li { font-size: 0; gap: 0; justify-content: center; }
    .gw-stepper li.is-now { font-size: 0.75rem; gap: 0.35rem; }
}

/* Receipt */
.receipt-success { text-align: center; margin: 0.5rem auto 1.4rem; max-width: 620px; }
.receipt-check { width: 72px; height: 72px; margin: 0 auto 0.6rem; display: grid; place-items: center; border-radius: 50%; background: var(--good); color: #fff;
    font-size: 2.2rem; font-weight: 800; animation: pop-in 0.5s cubic-bezier(.2,.9,.3,1.4); box-shadow: 0 0 0 10px color-mix(in srgb, var(--good) 18%, transparent); }
@keyframes pop-in { from { transform: scale(0.3); opacity: 0; } }
.receipt-success h1 { margin: 0.2rem 0; }
.receipt-cta { display: flex; gap: 0.6rem; justify-content: center; flex-wrap: wrap; margin-top: 0.8rem; }
.receipt { position: relative; max-width: 720px; margin: 0 auto; padding: 1.8rem; background: var(--card-bg); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow-md); overflow: hidden; }
.receipt::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 6px; background: linear-gradient(90deg, var(--primary), var(--accent)); }
.receipt-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.2rem; }
.receipt-brand { font-size: 1.3rem; display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; }
.receipt-brand small { display: block; width: 100%; font-size: 0.75rem; color: var(--text-muted); }
.receipt-title { text-align: right; }
.receipt-title h2 { margin: 0; font-size: 1.1rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--text-muted); }
.receipt-title span { font-weight: 700; font-variant-numeric: tabular-nums; }
.receipt-stamp { position: absolute; right: 2rem; top: 5.2rem; transform: rotate(-12deg); padding: 0.2rem 0.9rem; border: 3px solid currentColor; border-radius: 8px;
    font-weight: 800; letter-spacing: 0.15em; font-size: 1.3rem; opacity: 0.8; pointer-events: none; }
.stamp-paid { color: var(--good); } .stamp-refunded { color: var(--accent); } .stamp-failed, .stamp-cancelled { color: var(--danger); } .stamp-pending { color: var(--text-muted); }
.receipt-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.8rem 1.4rem; margin: 0 0 1.2rem; }
.receipt-grid dt { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); }
.receipt-grid dd { margin: 0.1rem 0 0; }
.receipt-table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.receipt-table th { text-align: left; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); border-bottom: 2px solid var(--border); padding: 0.5rem 0; }
.receipt-table td { padding: 0.6rem 0; border-bottom: 1px solid var(--border); vertical-align: middle; }
.receipt-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.receipt-discount td { color: var(--good); font-size: 0.9rem; }
.receipt-total td { font-weight: 800; font-size: 1.15rem; border-bottom: 0; }
.receipt-item { display: flex; gap: 0.7rem; align-items: center; }
.receipt-item small { display: block; color: var(--text-muted); font-size: 0.78rem; }
.receipt-cover { width: 40px; aspect-ratio: 3 / 4; border-radius: 4px; flex: 0 0 auto; }
.receipt-cover::before { display: none; }
.receipt-cover .cover-initials { font-size: 0.8rem; }
.receipt-timeline { list-style: none; padding: 0; margin: 1.3rem 0 0; display: flex; gap: 0.4rem; flex-wrap: wrap; }
.receipt-timeline li { flex: 1 1 150px; position: relative; padding: 0.5rem 0.6rem 0.5rem 1.9rem; border-radius: 10px; background: var(--surface-2); font-size: 0.82rem; }
.receipt-timeline li::before { content: "✓"; position: absolute; left: 0.55rem; top: 0.5rem; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center;
    background: var(--good); color: #fff; font-size: 0.7rem; font-weight: 700; }
.receipt-timeline li.fail::before { content: "✕"; background: var(--danger); }
.receipt-timeline li.now::before { content: "…"; background: var(--text-muted); }
.receipt-timeline li.refund::before { content: "↩"; background: var(--accent); }
.receipt-timeline small { display: block; color: var(--text-muted); }
.receipt-foot { margin-top: 1.3rem; font-size: 0.82rem; color: var(--text-muted); }
.receipt-sandbox { padding: 0.5rem 0.7rem; border-radius: 8px; background: var(--warning-bg); color: var(--warning-text); }
.receipt-actions { display: flex; gap: 0.6rem; justify-content: center; margin: 1.2rem 0 2rem; flex-wrap: wrap; }
@media (max-width: 560px) { .receipt { padding: 1.2rem; } .receipt-grid { grid-template-columns: 1fr; } .receipt-stamp { top: 4.2rem; right: 1rem; font-size: 1rem; } }
@media print {
    .navbar, .site-footer, .receipt-actions, .receipt-success, .flash-container, .nav-progress, #earby-assistant, .assistant-fab { display: none !important; }
    body { background: #fff !important; }
    .receipt { box-shadow: none; border: 0; max-width: none; }
}

/* Reader: pink highlights, notes, dictionary */
.paper-text .w.hl { background: rgba(244, 114, 182, 0.38); border-radius: 0; }
.paper-text .w.hl:not(.hl-end) { box-shadow: 0.3em 0 0 0 rgba(244, 114, 182, 0.38); }   /* fill the gap to the next word */
.paper-text .w.hl-end { border-top-right-radius: 4px; border-bottom-right-radius: 4px; }
.paper-text .w.hl-note::after { content: "📝"; font-size: 0.7em; vertical-align: super; margin-left: 1px; }
.paper-text .w.hl-flash { animation: hl-flash 0.8s ease 2; }
@keyframes hl-flash { 50% { background: rgba(236, 72, 153, 0.75); } }
.reader.theme-night .paper-text .w.hl { background: rgba(236, 72, 153, 0.35); }
.reader.theme-night .paper-text .w.hl:not(.hl-end) { box-shadow: 0.3em 0 0 0 rgba(236, 72, 153, 0.35); }
.reader.is-slideshow .paper-text .w.hl { background: none; box-shadow: none; }
.reader.is-slideshow .paper-text .w.hl-note::after { content: none; }
.reader.is-slideshow .notes-btn { display: none; }
.paper-text::selection, .paper-text .w::selection { background: rgba(244, 114, 182, 0.45); }
.notes-btn { position: relative; }
.notes-count { position: absolute; top: -4px; right: -4px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px; background: #ec4899; color: #fff; font-size: 0.65rem; font-weight: 700; display: grid; place-items: center; }
.sel-toolbar { position: fixed; z-index: 120; display: flex; gap: 2px; padding: 4px; border-radius: 12px; background: #1f2937; box-shadow: var(--shadow-lift); }
.sel-toolbar button { border: 0; background: transparent; color: #fff; padding: 0.45rem 0.7rem; border-radius: 8px; font-size: 0.88rem; cursor: pointer; white-space: nowrap; }
.sel-toolbar button:hover { background: rgba(255,255,255,0.12); }
.sel-toolbar button[data-act=highlight] { color: #f9a8d4; }
.ann-pop, .dict-pop { position: fixed; z-index: 125; width: min(360px, calc(100vw - 16px)); padding: 0.9rem; border-radius: 16px; background: var(--card-bg); color: var(--text);
    border: 1px solid var(--border); box-shadow: var(--shadow-lift); animation: pop-up 0.18s ease; }
@keyframes pop-up { from { opacity: 0; transform: translateY(6px) scale(0.98); } }
.ann-quote { margin: 0 0 0.6rem; padding: 0.4rem 0.6rem; border-left: 4px solid #ec4899; background: rgba(244, 114, 182, 0.14); border-radius: 0 8px 8px 0; font-size: 0.9rem; max-height: 110px; overflow: auto; }
.ann-pop textarea { width: 100%; resize: vertical; font: inherit; }
.ann-actions { display: flex; gap: 0.4rem; margin-top: 0.6rem; justify-content: flex-end; flex-wrap: wrap; }
.ann-actions #ann-delete { margin-right: auto; }
.dict-pop { max-height: min(70vh, 460px); overflow-y: auto; }
.dict-close { position: absolute; top: 6px; right: 8px; border: 0; background: transparent; font-size: 1.4rem; line-height: 1; cursor: pointer; color: var(--text-muted); }
.dict-head { display: flex; align-items: baseline; gap: 0.5rem; padding-right: 1.6rem; flex-wrap: wrap; }
.dict-word { font-family: var(--font-serif), "Noto Sans Bengali", serif; font-size: 1.5rem; }
.dict-ph { color: var(--text-muted); font-size: 0.9rem; }
.dict-say { border: 0; background: var(--surface-2); border-radius: 999px; width: 30px; height: 30px; cursor: pointer; }
.dict-root { margin: 0.1rem 0 0.3rem; font-size: 0.8rem; color: var(--text-muted); }
.dict-lang { display: inline-block; font-size: 0.72rem; padding: 0.1rem 0.5rem; border-radius: 999px; background: var(--info-bg); color: var(--info-text); margin: 0.3rem 0 0; }
.dict-sense { margin-top: 0.5rem; }
.dict-pos { font-size: 0.78rem; color: var(--primary); font-style: italic; font-weight: 600; }
.dict-sense ol { margin: 0.2rem 0 0; padding-left: 1.3rem; }
.dict-sense li { margin: 0.15rem 0; }
.dict-ex { margin: 0.2rem 0 0 1.3rem; font-size: 0.85rem; color: var(--text-muted); font-style: italic; }
.dict-note, .dict-tr { font-size: 0.85rem; margin: 0.6rem 0 0; }
.dict-chips { font-size: 0.85rem; margin: 0.6rem 0 0; display: flex; flex-wrap: wrap; gap: 0.3rem; align-items: center; }
.dict-chips span { padding: 0.1rem 0.5rem; border-radius: 999px; background: var(--surface-2); }
.dict-msg { margin: 0.5rem 0; color: var(--text-muted); }
.dict-loading::after { content: ""; display: inline-block; width: 12px; height: 12px; margin-left: 6px; border-radius: 50%; border: 2px solid var(--border); border-top-color: var(--primary); animation: spin 0.7s linear infinite; vertical-align: -2px; }
.dict-src { display: inline-block; margin-top: 0.7rem; font-size: 0.75rem; color: var(--text-muted); }
.notes-drawer { position: fixed; z-index: 115; top: 0; right: 0; bottom: 0; width: min(380px, 100vw); display: flex; flex-direction: column; background: var(--card-bg); color: var(--text);
    border-left: 1px solid var(--border); box-shadow: var(--shadow-lift); animation: drawer-in 0.25s ease; }
@keyframes drawer-in { from { transform: translateX(100%); } }
.notes-drawer header { display: flex; align-items: center; gap: 0.6rem; padding: 1rem; border-bottom: 1px solid var(--border); }
.notes-drawer header .dict-close { position: static; margin-left: 0.2rem; }
.notes-drawer header a { margin-left: auto; font-size: 0.82rem; }
.notes-tip { margin: 0; padding: 0.6rem 1rem; font-size: 0.8rem; color: var(--text-muted); background: var(--surface-2); }
.notes-list { list-style: none; margin: 0; padding: 0.6rem; overflow-y: auto; flex: 1; }
.notes-list li { display: flex; gap: 0.3rem; align-items: flex-start; padding: 0.5rem; border-radius: 12px; }
.notes-list li:hover { background: var(--surface-2); }
.note-go { flex: 1; text-align: left; border: 0; background: transparent; color: inherit; cursor: pointer; font: inherit; display: flex; flex-direction: column; gap: 0.25rem; }
.note-page { font-size: 0.72rem; color: var(--text-muted); font-weight: 700; }
.note-go mark { background: rgba(244, 114, 182, 0.3); color: inherit; padding: 0 2px; font-size: 0.92rem; }
.note-text { font-size: 0.85rem; color: var(--text-muted); }
.note-del { border: 0; background: transparent; cursor: pointer; opacity: 0.55; } .note-del:hover { opacity: 1; }
.notes-empty { color: var(--text-muted); justify-content: center; padding: 2rem 0 !important; }
.badge-toast { position: fixed; z-index: 130; left: 50%; top: 18px; display: flex; gap: 0.7rem; align-items: center; padding: 0.7rem 1.1rem 0.7rem 0.8rem; border-radius: 16px;
    background: var(--card-bg); color: var(--text); border: 1px solid var(--accent-line); box-shadow: var(--shadow-lift); transform: translate(-50%, -160%);
    transition: transform 0.45s cubic-bezier(.2,.9,.3,1.3); max-width: calc(100vw - 24px); }
.badge-toast.is-in { transform: translate(-50%, 0); }
.badge-toast div { display: flex; flex-direction: column; line-height: 1.25; }
.badge-toast small { color: var(--text-muted); font-size: 0.75rem; }
.bt-icon { font-size: 2rem; animation: badge-spin 0.8s ease; }
@keyframes badge-spin { from { transform: scale(0.2) rotate(-120deg); } }
@media (max-width: 640px) {
    .dict-pop, .ann-pop { left: 8px !important; right: 8px; width: auto; top: auto !important; bottom: 8px; border-radius: 18px; }
}
/* printable notes page */
.notes-page-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.7rem; }
.notes-page-list li { padding: 0.8rem 1rem; border-radius: 12px; background: var(--card-bg); border: 1px solid var(--border); border-left: 5px solid #ec4899; }
.notes-page-list mark { background: rgba(244, 114, 182, 0.3); color: inherit; }
.notes-page-list .np-meta { font-size: 0.75rem; color: var(--text-muted); display: flex; justify-content: space-between; gap: 0.5rem; }
.notes-page-list .np-note { margin: 0.4rem 0 0; }

/* Streaks & badges */
.streak-card { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; padding: 1rem 1.2rem; border-radius: var(--radius);
    background: linear-gradient(135deg, #fff7ed, #fef3c7); border: 1px solid var(--accent-line); color: #7c2d12; margin-bottom: 1rem; }
[data-theme=dark] .streak-card { background: linear-gradient(135deg, #2a1606, #2a2006); color: #fed7aa; }
.streak-flame { font-size: 2.6rem; line-height: 1; }
.streak-card.is-cold .streak-flame { filter: grayscale(1); opacity: 0.6; }
.streak-card.is-hot .streak-flame { animation: flame 1.6s ease-in-out infinite; transform-origin: 50% 90%; }
@keyframes flame { 50% { transform: scale(1.08) rotate(-3deg); } }
.streak-num { display: flex; flex-direction: column; line-height: 1.1; }
.streak-num strong { font-size: 1.5rem; }
.streak-num small { font-size: 0.8rem; opacity: 0.85; }
.streak-week { display: flex; gap: 0.3rem; margin-left: auto; }
.streak-week span { display: flex; flex-direction: column; align-items: center; gap: 0.15rem; font-size: 0.68rem; opacity: 0.85; }
.streak-week i { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-style: normal; background: rgba(255,255,255,0.7); border: 1px dashed currentColor; font-size: 0.8rem; }
[data-theme=dark] .streak-week i { background: rgba(0,0,0,0.25); }
.streak-week i.on { background: #f97316; border: 0; color: #fff; }
.streak-week span.today i { box-shadow: 0 0 0 2px #f97316; }
.streak-stats { display: flex; gap: 1rem; font-size: 0.82rem; opacity: 0.9; width: 100%; }
.badge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 0.6rem; }
.badge-tile { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 0.2rem; padding: 0.8rem 0.5rem; border-radius: 14px; background: var(--card-bg); border: 1px solid var(--border); }
.badge-tile .bt-emoji { font-size: 2rem; line-height: 1.1; }
.badge-tile strong { font-size: 0.82rem; }
.badge-tile small { font-size: 0.7rem; color: var(--text-muted); }
.badge-tile.is-earned { border-color: var(--accent-line); background: linear-gradient(180deg, var(--accent-soft), var(--card-bg)); }
.badge-tile.is-locked .bt-emoji { filter: grayscale(1); opacity: 0.35; }
.badge-tile.is-locked strong { color: var(--text-muted); }
.home-streak { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.3rem 0.8rem; border-radius: 999px; background: var(--accent-soft); color: var(--accent-text); font-size: 0.85rem; font-weight: 600; text-decoration: none; }
.home-streak:hover { filter: brightness(0.97); }
@media (max-width: 560px) { .streak-week { margin-left: 0; width: 100%; justify-content: space-between; } }
/* Round 10.1: delete your own books from anywhere */
.book-card-wrap { position: relative; }
.book-card-wrap[hidden] { display: none; }
.card-del-form { position: absolute; top: 8px; right: 8px; z-index: 3; margin: 0; }
.card-del { width: 34px; height: 34px; border-radius: 50%; border: 0; cursor: pointer; background: rgba(15, 23, 42, 0.65); color: #fff;
    font-size: 0.95rem; opacity: 0; transition: opacity 0.15s ease, background 0.15s ease; }
.book-card-wrap:hover .card-del, .card-del:focus-visible { opacity: 1; }
.card-del:hover { background: var(--danger); }
@media (hover: none) { .card-del { opacity: 0.9; } }
.owner-delete { display: inline-flex; margin-left: 0.4rem; vertical-align: middle; }
/* Admin: one tidy menu instead of a crowded navbar */
.admin-menu-btn { gap: 0.45rem; }
.admin-menu-btn .admin-badge { margin: 0; }
.admin-here { font-weight: 600; font-size: 0.9rem; white-space: nowrap; }
.admin-menu-shield { font-size: 1.8rem; width: 48px; height: 48px; display: grid; place-items: center; border-radius: 50%; background: var(--surface-2); }
.admin-menu .um-group a.is-here { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.admin-menu .um-group a .nav-count { margin-left: auto; }
@media (max-width: 520px) { .admin-here { display: none; } }
.rank-explain { font-size: 0.8rem; color: var(--text-muted); margin: 0.2rem 0 0; max-width: 780px; }
.admin-menu-btn .admin-badge { display: inline-flex !important; }
.admin-menu-shield { flex: 0 0 48px; font-size: 1.6rem !important; line-height: 1; }
.scan-health { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.6rem; margin: 0.6rem 0 0; }
.scan-health div { padding: 0.6rem 0.7rem; border-radius: 12px; background: var(--surface-2); }
.scan-health dt { font-size: 1.5rem; font-weight: 800; }
.scan-health dd { margin: 0; font-size: 0.8rem; color: var(--text-muted); }
.scan-health .is-bad dt { color: var(--danger); }

/* ===== 40. One "Browse" menu in the navbar (genre + country + quick links) ===== */
.nav-browse .browse-panel { width: min(720px, calc(100vw - 2rem)); padding: 0.9rem; }
.browse-quick { display: flex; flex-wrap: wrap; gap: 0.4rem; padding-bottom: 0.75rem; margin-bottom: 0.6rem; border-bottom: 1px solid var(--border); }
.browse-quick a { padding: 0.4rem 0.8rem; border-radius: 999px; background: var(--surface-2); color: var(--text); text-decoration: none; font-weight: 600; font-size: 0.88rem; transition: background-color 0.15s ease, color 0.15s ease; }
.browse-quick a:hover { background: var(--primary-soft); color: var(--primary); }
.browse-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.browse-head { margin: 0 0 0.3rem 0.4rem; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-muted); }
.browse-cols .dd-grid { grid-template-columns: 1fr; }
@media (max-width: 1180px) { .browse-links .nav-browse .nav-label { display: inline; } .browse-links .nav-browse .nav-pill { padding: 0 0.85rem; } }

/* ===== 41. Request cards: the title gets the room; the asker sees a status, not "I have it" ===== */
.request-body { min-width: 0; }
.request-actions { max-width: 20rem; }
.request-mine { font-size: 0.85rem; color: var(--text-muted); background: var(--surface-2); padding: 0.4rem 0.75rem; border-radius: 999px; }

/* ===== 42. Admin: short "reason" box next to Remove / Withdraw ===== */
.admin-reason { width: 12rem; height: 32px; padding: 0 0.6rem; font-size: 0.85rem; margin-right: 0.3rem; }
td form:has(.admin-reason) { display: flex; align-items: center; gap: 0.3rem; flex-wrap: wrap; }

/* ===== 43. Contact us form + admin messages ===== */
.hp-field { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.contact-topics { border: none; padding: 0; margin: 0 0 1rem; display: flex; flex-wrap: wrap; gap: 0.45rem; }
.contact-topics legend { font-weight: 600; margin-bottom: 0.5rem; padding: 0; }
.topic-chip input { position: absolute; opacity: 0; pointer-events: none; }
.topic-chip span { display: inline-block; padding: 0.45rem 0.85rem; border-radius: 999px; border: 1px solid var(--border); background: var(--card-bg); cursor: pointer; font-size: 0.9rem; transition: background-color 0.15s ease, border-color 0.15s ease; }
.topic-chip input:checked + span { background: var(--primary-soft); border-color: var(--primary); color: var(--primary-dark); font-weight: 600; }
.topic-chip input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 2px; }
.contact-form textarea { resize: vertical; min-height: 9rem; }
.message-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.75rem; }
.message-card { border: 1px solid var(--border); border-radius: 14px; padding: 0.9rem 1rem; background: var(--card-bg); }
.message-card.is-new { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.message-head { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; }
.message-topic { margin-left: auto; font-weight: 600; font-size: 0.88rem; }
.message-body { white-space: pre-wrap; margin: 0.6rem 0; }
.message-actions { display: flex; gap: 0.5rem; align-items: center; }
.message-reply { border-left: 3px solid var(--primary); background: var(--primary-soft); padding: 0.5rem 0.8rem; border-radius: 0 10px 10px 0; margin: 0.4rem 0 0.7rem; }
.message-reply p { margin: 0.25rem 0 0; white-space: pre-wrap; }
.message-reply-form textarea { width: 100%; resize: vertical; margin-bottom: 0.5rem; }
.message-delete { margin-top: 0.5rem; }

/* ===== 44. Phones: a calm top bar = logo · 🔍 · account (or ☰). Everything else lives in the drawer ===== */
.um-theme .icon-sun { display: none; }
:root[data-theme="dark"] .um-theme .icon-sun { display: inline; }
:root[data-theme="dark"] .um-theme .icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme]) .um-theme .icon-sun { display: inline; }
    :root:not([data-theme]) .um-theme .icon-moon { display: none; }
}
button.um-theme.um-mobile-only { display: none; }
@media (max-width: 720px) {
    .navbar { gap: 0.5rem; }
    .nav-left { flex: 1 1 auto; min-width: 0; }
    .brand { flex-shrink: 0; white-space: nowrap; }
    .nav-links { flex: 0 0 auto; margin-left: auto; gap: 0.45rem; }
    /* these are all in the drawer on phones */
    .nav-links > a.nav-pill, .nav-links > .nav-publish, .nav-links > .nav-signup,
    .nav-links > .theme-toggle.nav-theme, .nav-links > .visitor-login { display: none !important; }
    button.um-theme.um-mobile-only { display: flex; }
    .nav-links .nav-search:not(.is-open), .nav-links .nav-search-btn { width: 40px; height: 40px; }
    .nav-links .nav-search.is-open { width: auto; height: 44px; }
}

/* ===== 45. Phones: the assistant's greeting bubble never covers buttons (just the small Earby stays) ===== */
@media (max-width: 720px) { .fab-greeting { display: none !important; } }
