/* ============================================
   Kronoscript - Deep Teal Modern Theme
   ============================================ */

:root {
    /* Anchors */
    --mst-ink:       #1a1f2e;  /* near-black, primary text + dark surfaces */
    --mst-ink-soft:  #2b3142;
    --mst-canvas:    #fafaf7;  /* near-white page canvas */
    --mst-card:      #ffffff;
    --mst-surface-2: #f3f3ee;  /* subtle raised surface / bubbles */
    --mst-border:    #e6e6df;

    /* Accent: deep teal */
    --mst-primary:   #0f6466;  /* deep teal */
    --mst-primary-2: #144f52;  /* darker */
    --mst-primary-3: #1a8a8d;  /* brighter, for hover */
    --mst-accent:    #d4a84a;  /* lighter gold secondary */
    --mst-accent-2:  #b8871a;  /* deeper gold for hover/shadow */

    /* Visibility / relationship tier palette — shared with My Network */
    --tier-public:        #dc3545;  /* red — broad/exposed */
    --tier-acquaintances: #3b82f6;  /* sky blue — breezy, casual */
    --tier-friends:       #10b981;  /* emerald — the friendly middle */
    --tier-family:        #eab308;  /* brilliant gold — the precious inner circle */
    --tier-private:       #6c757d;

    /* Text */
    --mst-text:      #1a1f2e;
    --mst-muted:     #6b7280;

    /* Surfaces (legacy names kept as aliases so existing classes keep working) */
    --mst-bg:        var(--mst-canvas);
    --mst-dark:      var(--mst-ink);
    --mst-secondary: var(--mst-primary-3);
    --mst-gold:      var(--mst-accent);
    --mst-gold-light:#fbd9cb;
    --mst-light:     #e6f2f2;

    /* Elevation */
    --mst-shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.04);
    --mst-shadow:    0 1px 3px rgba(16, 24, 40, 0.06), 0 10px 30px -16px rgba(16, 24, 40, 0.18);
    --mst-shadow-lg: 0 20px 60px -20px rgba(16, 24, 40, 0.35);

    /* Radii */
    --mst-radius:    16px;
    --mst-radius-sm: 10px;
    --mst-radius-lg: 22px;

    /* Type */
    --mst-font-serif: 'Fraunces', 'Instrument Serif', Georgia, serif;
    --mst-font-sans:  'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
}

/* Dark mode */
[data-theme="dark"] {
    --mst-ink:       #e7e9ee;
    --mst-ink-soft:  #c8ccd6;
    --mst-canvas:    #0f131c;
    --mst-card:      #161b27;
    --mst-surface-2: #1b2130;
    --mst-border:    #242b3c;
    --mst-primary:   #2dd4bf;
    --mst-primary-2: #14b8a6;
    --mst-primary-3: #5eead4;
    --mst-accent:    #d4a84a;
    --mst-accent-2:  #b8871a;
    --mst-text:      #e7e9ee;
    --mst-muted:     #8a92a6;
    --mst-bg:        var(--mst-canvas);
    --mst-dark:      var(--mst-ink);
    --mst-secondary: var(--mst-primary-3);
    --mst-light:     #10303a;
    --mst-shadow:    0 1px 3px rgba(0,0,0,0.5), 0 10px 30px -16px rgba(0,0,0,0.7);
}

html {
    font-size: 15px;
    position: relative;
    min-height: 100%;
    /* Sticky navbar is ~88px tall — reserve that much space at the top
       of every programmatic scroll (anchor jumps, scrollIntoView, focus
       jumps) so the target doesn't end up under the navbar. */
    scroll-padding-top: 96px;
}

@media (min-width: 768px) {
    html { font-size: 16px; }
}

body {
    /* Sticky footer pattern: body is a flex column with min-height = viewport,
       so the <footer class="mt-auto"> in _Layout pushes itself to the bottom
       on short pages. Removed the old `margin-bottom: 60px` which paired with
       the old absolute-positioned 60px footer (now flows in normal order). */
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background-color: var(--mst-canvas);
    color: var(--mst-text);
    font-family: var(--mst-font-sans);
    font-feature-settings: "ss01", "cv11";
    -webkit-font-smoothing: antialiased;
    letter-spacing: -0.005em;
}

h1, h2, h3, h4, h5 {
    font-family: var(--mst-font-serif);
    font-weight: 600;
    letter-spacing: -0.015em;
    color: var(--mst-ink);
}

[data-theme="dark"] h1,
[data-theme="dark"] h2,
[data-theme="dark"] h3,
[data-theme="dark"] h4,
[data-theme="dark"] h5,
[data-theme="dark"] h6 { color: var(--mst-ink); }

/* Dark mode: force Bootstrap utility classes onto CSS variables */
[data-theme="dark"] {
    color: var(--mst-text);
}
[data-theme="dark"] .text-muted        { color: var(--mst-muted) !important; }
[data-theme="dark"] .text-dark         { color: var(--mst-text) !important; }
[data-theme="dark"] .text-body         { color: var(--mst-text) !important; }
[data-theme="dark"] .text-body-secondary { color: var(--mst-muted) !important; }
[data-theme="dark"] .text-black        { color: var(--mst-text) !important; }
[data-theme="dark"] small,
[data-theme="dark"] .small              { color: inherit; }
[data-theme="dark"] .bg-light           { background-color: var(--mst-surface-2) !important; color: var(--mst-text) !important; }
[data-theme="dark"] .bg-white           { background-color: var(--mst-card) !important; color: var(--mst-text) !important; }
[data-theme="dark"] .card,
[data-theme="dark"] .card * { color: var(--mst-text); }
[data-theme="dark"] .card .text-muted,
[data-theme="dark"] .card small { color: var(--mst-muted) !important; }
[data-theme="dark"] .bg-success-subtle  { background-color: rgba(45,212,191,0.15) !important; color: var(--mst-primary-3) !important; }
[data-theme="dark"] .text-success       { color: var(--mst-primary-3) !important; }
[data-theme="dark"] .bg-secondary,
[data-theme="dark"] .badge.bg-secondary { background-color: var(--mst-surface-2) !important; color: var(--mst-text) !important; }
[data-theme="dark"] .dropdown-menu      { background-color: var(--mst-card); border-color: var(--mst-border); color: var(--mst-text); }
[data-theme="dark"] .dropdown-item      { color: var(--mst-text); }
[data-theme="dark"] .dropdown-item:hover,
[data-theme="dark"] .dropdown-item:focus{ background-color: var(--mst-surface-2); color: var(--mst-ink); }
[data-theme="dark"] .modal-content      { background-color: var(--mst-card); color: var(--mst-text); border: 1px solid var(--mst-border); }
[data-theme="dark"] .modal-header,
[data-theme="dark"] .modal-footer       { border-color: var(--mst-border); }
[data-theme="dark"] .btn-close          { filter: invert(1) grayscale(100%) brightness(180%); }
[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select        { background-color: var(--mst-surface-2); color: var(--mst-text); border-color: var(--mst-border); }
[data-theme="dark"] .form-control::placeholder { color: var(--mst-muted); }
[data-theme="dark"] input[type="number"],
[data-theme="dark"] input[type="text"],
[data-theme="dark"] textarea,
[data-theme="dark"] select              { color-scheme: dark; }
[data-theme="dark"] a                   { color: var(--mst-primary-3); }
[data-theme="dark"] a:hover             { color: var(--mst-primary); }
[data-theme="dark"] .list-group-item    { background-color: var(--mst-card); color: var(--mst-text); border-color: var(--mst-border); }
[data-theme="dark"] .list-group-item-action:hover,
[data-theme="dark"] .list-group-item-action:focus { background-color: var(--mst-surface-2); color: var(--mst-ink); }
[data-theme="dark"] .card-header.bg-white { background-color: var(--mst-card) !important; color: var(--mst-text); border-color: var(--mst-border); }
.conv-name { color: var(--mst-ink); }
[data-theme="dark"] .conv-name { color: #ffffff !important; }

/* Navbar icons are always white regardless of theme */
.navbar .btn-outline-secondary svg,
.navbar .btn-outline-primary svg,
.navbar .theme-toggle svg,
.navbar .dropdown-toggle svg { color: #fff !important; stroke: #fff !important; }

/* Links */
a { color: var(--mst-primary); text-decoration: none; }
a:hover { color: var(--mst-primary-3); }

/* Buttons */
.btn {
    border-radius: var(--mst-radius-sm);
    font-weight: 500;
    letter-spacing: -0.005em;
    transition: background-color .14s ease, color .14s ease, transform .08s ease, box-shadow .14s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
    background-color: var(--mst-primary);
    border-color: var(--mst-primary);
    color: #fff;
}
.btn-primary:hover, .btn-primary:focus {
    background-color: var(--mst-primary-2);
    border-color: var(--mst-primary-2);
    color: #fff;
}
.btn-outline-primary {
    color: var(--mst-primary);
    border-color: var(--mst-primary);
    background: transparent;
}
.btn-outline-primary:hover {
    background-color: var(--mst-primary);
    border-color: var(--mst-primary);
    color: #fff;
}
.btn-outline-secondary {
    color: var(--mst-muted);
    border-color: var(--mst-border);
    background: transparent;
}
.btn-outline-secondary:hover {
    background: var(--mst-surface-2);
    color: var(--mst-ink);
    border-color: var(--mst-border);
}

/* Focus rings */
.btn:focus, .btn:active:focus, .btn-link.nav-link:focus,
.form-control:focus, .form-check-input:focus, .form-select:focus {
    box-shadow: 0 0 0 3px rgba(15, 100, 102, 0.18);
    border-color: var(--mst-primary);
    outline: none;
}

/* Cards */
.card {
    border-radius: var(--mst-radius);
    background: var(--mst-card);
    border: 1px solid var(--mst-border);
    box-shadow: var(--mst-shadow-sm);
}
.card.shadow-sm { box-shadow: var(--mst-shadow) !important; }

/* Form controls */
.form-control, .form-select {
    border-radius: var(--mst-radius-sm);
    border-color: var(--mst-border);
    background-color: var(--mst-card);
    color: var(--mst-text);
}
.form-control.bg-light, .form-select.bg-light { background-color: var(--mst-surface-2) !important; }
.form-control::placeholder { color: var(--mst-muted); }

/* Diff highlighting removed — edits surface as a small 'edited' note under the post */
.diff-added,
.diff-changed,
.diff-removed {
    background: none;
    color: inherit;
    font-weight: inherit;
    text-decoration: none;
    opacity: 1;
}

/* Inline comments panel under feed/timeline cards */
.post-comments-inline {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--mst-border);
}
.post-comments-inline .pci-empty {
    font-size: 0.78rem;
    color: var(--mst-muted);
    text-align: center;
    padding: 6px 0;
}
.post-comments-inline .pci-row {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    margin-bottom: 8px;
    background: var(--mst-surface-2);
    border: 1px solid var(--mst-border);
    border-radius: var(--mst-radius-sm);
    padding: 8px 10px;
}
.post-comments-inline .pci-avatar {
    width: 26px; height: 26px;
    border-radius: 50%;
    background: var(--mst-primary);
    color: #fff;
    font-weight: 700;
    font-size: 11px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
}
.post-comments-inline .pci-avatar img { width: 26px; height: 26px; object-fit: cover; }
.post-comments-inline .pci-body { flex: 1; min-width: 0; }
.post-comments-inline .pci-meta {
    display: flex; gap: 6px; align-items: center; flex-wrap: wrap;
    font-size: 0.7rem;
}
.post-comments-inline .pci-meta strong { font-size: 0.78rem; color: var(--mst-text); }
.post-comments-inline .pci-meta time   { color: var(--mst-muted); }
.post-comments-inline .pci-text { font-size: 0.84rem; color: var(--mst-text); margin-top: 2px; }
.post-comments-inline .pci-form {
    display: flex; gap: 6px; margin-top: 6px;
}
.post-comments-inline .pci-form input {
    flex: 1;
    background: var(--mst-card);
    border: 1px solid var(--mst-border);
    border-radius: 999px;
    padding: 6px 12px;
    font-size: 0.82rem;
    color: var(--mst-text);
    outline: none;
}
.post-comments-inline .pci-form input:focus { border-color: var(--mst-primary); }
.post-comments-inline .pci-form button {
    background: var(--mst-primary);
    color: #fff;
    border: none;
    border-radius: 999px;
    padding: 4px 14px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
}
.post-comments-inline .pci-form button:hover { background: var(--mst-primary-2); }
/* Threaded replies on inline comments — one indent level, marked with a
   left rail so the conversation reads as a thread. */
.post-comments-inline .pci-actions { margin-top: 4px; }
.post-comments-inline .pci-reply-btn {
    background: none; border: none; padding: 0;
    color: var(--mst-muted);
    font-size: 0.74rem; font-weight: 600;
    cursor: pointer;
}
.post-comments-inline .pci-reply-btn:hover { color: var(--mst-primary); }
.post-comments-inline .pci-reply-mount:not(:empty) { margin-top: 6px; }
.post-comments-inline .pci-replies:not(:empty) {
    margin-top: 8px;
    padding-left: 10px;
    border-left: 2px solid var(--mst-border);
}
.post-comments-inline .pci-replies .pci-row { margin-bottom: 6px; }
.post-comments-inline .pci-replies .pci-row:last-child { margin-bottom: 0; }

/* Post expand/collapse — surfaced as a "Read more" / "Read less" link
   that's actually visible. The old 3-dot icon was easy to miss. */
.btn-expand-post {
    background: none;
    border: none;
    color: var(--mst-primary);
    cursor: pointer;
    padding: 2px 0;
    margin-left: 4px;
    vertical-align: baseline;
    font-weight: 600;
    font-size: inherit;
    transition: color .1s ease;
}
.btn-expand-post:hover { color: var(--mst-primary-2, var(--mst-secondary)); text-decoration: underline; }
.btn-expand-label::before { content: "… "; color: var(--mst-muted); }
.post-expand-wrap.expanded .post-preview-text { display: none; }
.post-expand-wrap.expanded .post-full-text { display: block !important; }
.post-expand-wrap.expanded .btn-expand-label::before { content: ""; }

/* Article feed preview: full article-layout markup is rendered inside a
   collapsible wrapper so the card keeps its newspaper / book look both
   when collapsed and expanded. The collapse uses a max-height clamp +
   fade-out at the bottom; "Read more" toggles `.expanded` on the
   surrounding .post-expand-wrap to drop the clamp. */
.post-article-collapse {
    position: relative;
    max-height: 26em;
    overflow: hidden;
    transition: max-height 0.25s ease;
}
.post-article-collapse::after {
    content: "";
    position: absolute;
    left: 0; right: 0; bottom: 0;
    height: 5em;
    background: linear-gradient(to bottom, rgba(255,255,255,0), #fbfaf6 90%);
    pointer-events: none;
}
.feed-card-book .post-article-collapse::after {
    background: linear-gradient(to bottom, rgba(255,255,255,0), #fbf7ee 90%);
}
[data-theme="dark"] .feed-card-newspaper .post-article-collapse::after {
    background: linear-gradient(to bottom, rgba(34,31,23,0), #221f17 90%);
}
[data-theme="dark"] .feed-card-book .post-article-collapse::after {
    background: linear-gradient(to bottom, rgba(42,36,24,0), #2a2418 90%);
}
.post-expand-wrap.expanded .post-article-collapse { max-height: none; }
.post-expand-wrap.expanded .post-article-collapse::after { display: none; }
.post-expand-wrap.is-fully-shown .post-article-collapse { max-height: none; }
.post-expand-wrap.is-fully-shown .post-article-collapse::after { display: none; }
.btn-expand-article { margin-top: 6px; }

/* Tighter article look inside the feed card — smaller headline and
   paragraph type than the Detail page so multiple cards still read as a
   feed. The two-column flow is preserved on newspaper. */
.article-feed-preview { margin: 0; padding: 0; }
.article-feed-preview .article-headline {
    font-size: 1.35rem !important;
    line-height: 1.2;
    margin: 0 0 4px 0;
}
.article-feed-preview .article-byline {
    font-size: 0.78rem;
    color: var(--mst-muted);
    margin-bottom: 8px;
}
.article-feed-preview .article-prose {
    font-size: 0.94rem;
    line-height: 1.55;
}
.article-feed-preview.article-newspaper .article-prose.article-news-grid {
    column-gap: 22px;
}
.article-feed-preview.article-newspaper .article-news-col-1 > p:first-of-type::first-letter {
    font-size: 2.6rem;
    padding: 2px 6px 0 0;
}
.article-feed-preview.article-newspaper .article-news-col-2 {
    padding-left: 12px;
    margin-left: -12px;
}
@media (max-width: 575px) {
    /* Phone-narrow feed cards: collapse the journal grid sooner. */
    .article-feed-preview.article-newspaper .article-prose.article-news-grid {
        grid-template-columns: 1fr;
        column-gap: 0;
    }
    .article-feed-preview.article-newspaper .article-news-col-2 {
        border-left: none;
        padding-left: 0;
        margin-left: 0;
        margin-top: 8px;
    }
}
.article-feed-preview.article-book {
    /* Loosen the chapter-page max-width so the card uses the column it has. */
    max-width: 100%;
    padding: 0;
}
.article-feed-preview.article-book .article-headline {
    font-size: 1.4rem !important;
}
.article-feed-preview.article-book .article-prose > p:first-of-type::first-letter {
    font-size: 2.2rem;
}
.article-feed-preview .article-image { margin-bottom: 10px; }
.article-feed-preview .art-img-h-2 img,
.article-feed-preview .art-img-h-3 img,
.article-feed-preview .art-img-h-4 img,
.article-feed-preview .art-img-h-5 img,
.article-feed-preview .art-img-h-6 img,
.article-feed-preview .art-img-h-7 img,
.article-feed-preview .art-img-h-8 img {
    /* On the feed, very tall thumbs would dominate the card — clamp height. */
    max-height: 220px;
}

/* Lightweight toast (Share link copy feedback, etc.) */
.kron-toast {
    position: fixed;
    left: 50%;
    bottom: 28px;
    transform: translate(-50%, 12px);
    background: rgba(20,20,20,0.92);
    color: #fff;
    padding: 8px 16px;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 500;
    letter-spacing: 0.01em;
    box-shadow: 0 4px 18px rgba(0,0,0,0.25);
    opacity: 0;
    z-index: 2000;
    pointer-events: none;
    transition: opacity 180ms ease, transform 180ms ease;
}
.kron-toast.visible { opacity: 1; transform: translate(-50%, 0); }

/* Comment like button — small heart that fills when active */
.btn-comment-like {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    padding: 0;
    color: var(--mst-muted);
    font-size: 0.75rem;
    line-height: 1;
    cursor: pointer;
    transition: color 0.12s ease, transform 0.08s ease;
}
.btn-comment-like svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.btn-comment-like:hover { color: #d6336c; }
.btn-comment-like:active { transform: scale(1.15); }
.btn-comment-like.is-liked { color: #d6336c; }
.btn-comment-like.is-liked svg { fill: currentColor; stroke: currentColor; }
.btn-comment-like .comment-like-count { font-weight: 500; }
.btn-comment-like:not(.is-liked) .comment-like-count:empty { display: none; }

/* Translate button feedback */
.btn-translate-post { transition: color .15s ease, opacity .15s ease; }
.btn-translate-post.is-loading { opacity: 0.55; pointer-events: none; }
.btn-translate-post.is-loading svg { animation: kron-pulse 900ms ease-in-out infinite; }
.btn-translate-post.is-translated,
.btn-translate-post.is-translated svg { color: var(--mst-primary); }
@keyframes kron-pulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.35; }
}

/* Split-button caret next to the translate icon — narrow, borderless. */
.translate-group .dropdown-toggle-split {
    padding: 0 6px;
    min-width: 0;
    line-height: 1;
}
.translate-group .dropdown-toggle-split::after {
    margin-left: 0;
    border-top-color: currentColor;
    opacity: 0.6;
}
.translate-group .dropdown-toggle-split:hover::after { opacity: 1; }
.translate-menu {
    min-width: 200px;
    max-height: 320px;
    overflow-y: auto;
    /* Solid background + ring so it reads clearly over busy content. */
    background-color: #fff;
    border: 1px solid rgba(0, 0, 0, 0.12);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.18);
}
/* When Bootstrap actually opens the menu (.show), force a viewport-level
   stacking context so it paints over later feed cards / next posts.
   Bootstrap's data-bs-strategy="fixed" sets position:fixed inline, but if
   it doesn't, we still need to win — hence the !important escalation. */
.translate-menu.show {
    position: fixed !important;
    z-index: 3000 !important;
}
[data-theme="dark"] .translate-menu {
    background-color: #1d2627;
    color: #e5e5e5;
    border-color: rgba(255, 255, 255, 0.12);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.55);
}
.translate-menu .dropdown-header { color: var(--mst-muted); font-size: 0.72rem; letter-spacing: 0.06em; text-transform: uppercase; }
.translate-menu .dropdown-item { color: inherit; }
.translate-menu .dropdown-item:hover,
.translate-menu .dropdown-item:focus { background-color: rgba(15, 100, 102, 0.10); color: inherit; }
[data-theme="dark"] .translate-menu .dropdown-item:hover,
[data-theme="dark"] .translate-menu .dropdown-item:focus { background-color: rgba(255, 255, 255, 0.06); }

/* Guided product tour */
.kron-tour-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1900;
    pointer-events: auto;
}
.kron-tour-popup {
    background: #fff;
    color: #1a1a1a;
    border-radius: 12px;
    padding: 16px 18px 14px;
    box-shadow: 0 14px 40px rgba(0,0,0,0.35);
    width: min(360px, calc(100vw - 24px));
    z-index: 2000;
    font-size: 0.92rem;
    line-height: 1.5;
}
[data-theme="dark"] .kron-tour-popup {
    background: #1e2425;
    color: #e5e5e5;
    box-shadow: 0 14px 40px rgba(0,0,0,0.6);
}
.kron-tour-popup .kron-tour-counter {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--mst-primary);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 6px;
}
.kron-tour-popup .kron-tour-title {
    margin: 0 0 6px;
    font-size: 1.05rem;
    font-weight: 600;
}
.kron-tour-popup .kron-tour-body {
    margin-bottom: 14px;
    white-space: pre-wrap;
}
.kron-tour-popup .kron-tour-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}
.kron-tour-popup .kron-tour-skip {
    color: var(--mst-muted);
    text-decoration: none;
}
.kron-tour-popup .kron-tour-skip:hover { color: var(--mst-primary); }

/* Spotlight ring on the anchored element. !important beats inline z-index on
   existing elements (e.g. the feed action bar uses style="z-index:3"). */
.kron-tour-highlight {
    position: relative !important;
    z-index: 1950 !important;
    box-shadow: 0 0 0 3px var(--mst-accent, #f0c040), 0 0 18px 4px rgba(240,192,64,0.55);
    border-radius: 8px;
    transition: box-shadow 180ms ease;
}
/* The navbar creates its own stacking context at z-index:1040, so step 7's
   anchor would otherwise sit below the overlay. Lift the whole navbar above
   the overlay whenever the tour is active. */
body.kron-tour-active .navbar { z-index: 1960; }

/* Start Here (/Home/GettingStarted) */
.gs-page {
    max-width: 920px;
    margin: 0 auto;
    padding-bottom: 3rem;
}
.gs-hero {
    text-align: center;
    padding: 2.5rem 1rem 2rem;
}
.gs-hero-kicker {
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--mst-accent);
    margin-bottom: 0.5rem;
}
.gs-hero-title {
    font-family: 'Fraunces', 'Cormorant Garamond', Georgia, serif;
    font-weight: 600;
    font-size: clamp(1.8rem, 4vw, 2.4rem);
    line-height: 1.3;
    letter-spacing: -0.01em;
    margin: 0 0 0.75rem;
    color: var(--mst-text, #1a1a1a);
    overflow-wrap: break-word;
}
.gs-hero-sub {
    color: var(--mst-muted);
    font-size: 1.05rem;
    line-height: 1.55;
    max-width: 640px;
    margin: 0 auto;
}

.gs-paths {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin: 1rem 0 2.5rem;
}
@media (max-width: 720px) {
    .gs-paths { grid-template-columns: 1fr; }
}
.gs-path-card {
    position: relative;
    text-align: left;
    background: var(--mst-surface, #fff);
    border: 1px solid rgba(0,0,0,0.06);
    border-radius: 16px;
    padding: 1.5rem 1.4rem 1.25rem;
    box-shadow: 0 6px 18px rgba(0,0,0,0.05);
    cursor: pointer;
    transition: transform 150ms ease, box-shadow 150ms ease, border-color 150ms ease;
    overflow: hidden;
}
.gs-path-card::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(15,100,102,0.04), transparent 60%);
    pointer-events: none;
}
.gs-path-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 32px rgba(0,0,0,0.10);
    border-color: var(--mst-accent);
}
.gs-path-card:focus-visible {
    outline: 3px solid var(--mst-accent);
    outline-offset: 2px;
}
.gs-path-kicker {
    position: relative;
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    padding: 3px 10px;
    border-radius: 999px;
    margin-bottom: 0.9rem;
}
.gs-path-why .gs-path-kicker {
    background: rgba(240,192,64,0.18);
    color: #8a6b1e;
}
.gs-path-how .gs-path-kicker {
    background: rgba(15,100,102,0.14);
    color: var(--mst-primary);
}
.gs-path-title {
    font-family: 'Fraunces', 'Cormorant Garamond', Georgia, serif;
    font-weight: 600;
    font-size: 1.4rem;
    letter-spacing: -0.005em;
    margin: 0 0 0.55rem;
    color: var(--mst-text, #1a1a1a);
    position: relative;
}
.gs-path-body {
    color: var(--mst-muted);
    font-size: 0.95rem;
    line-height: 1.55;
    margin: 0 0 1rem;
    position: relative;
}
.gs-path-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    position: relative;
}
.gs-path-length {
    font-size: 0.8rem;
    color: var(--mst-muted);
}
.gs-path-cta {
    font-weight: 600;
    color: var(--mst-primary);
    font-size: 0.92rem;
}
.gs-path-card:hover .gs-path-cta { color: var(--mst-primary-2, #0d5a5c); }

/* Feature grid */
.gs-section-title {
    font-family: 'Fraunces', 'Cormorant Garamond', Georgia, serif;
    font-weight: 600;
    font-size: 1.6rem;
    text-align: center;
    margin: 0 0 1.25rem;
    color: var(--mst-text, #1a1a1a);
}
.gs-features { margin-bottom: 2.5rem; }
.gs-feature-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}
@media (max-width: 900px) { .gs-feature-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .gs-feature-grid { grid-template-columns: 1fr; } }
.gs-feature {
    display: flex;
    gap: 0.8rem;
    padding: 1rem;
    background: var(--mst-surface, #fff);
    border: 1px solid rgba(0,0,0,0.06);
    border-radius: 12px;
}
.gs-feature-icon {
    flex: 0 0 auto;
    font-size: 1.4rem;
    line-height: 1;
}
.gs-feature h4 {
    margin: 0 0 0.2rem;
    font-size: 0.98rem;
    font-weight: 600;
    color: var(--mst-text, #1a1a1a);
}
.gs-feature p {
    margin: 0;
    color: var(--mst-muted);
    font-size: 0.85rem;
    line-height: 1.45;
}

.gs-final {
    text-align: center;
    padding: 1.5rem 0 0;
    border-top: 1px solid rgba(0,0,0,0.06);
}

/* Dark-mode tweaks */
[data-theme="dark"] .gs-path-card,
[data-theme="dark"] .gs-feature {
    background: var(--mst-surface-2, #1d2627);
    border-color: rgba(255,255,255,0.08);
    box-shadow: 0 6px 18px rgba(0,0,0,0.35);
}
[data-theme="dark"] .gs-path-card:hover {
    box-shadow: 0 14px 32px rgba(0,0,0,0.5);
}
[data-theme="dark"] .gs-final { border-top-color: rgba(255,255,255,0.08); }

/* ── Start-Here v2 ──────────────────────────────────────────────── */
.gs-hero-v2 { padding: 3rem 1rem 2rem; }
.gs-rotator { position: relative; min-height: 1.2em; }
.gs-rotator .gs-rot {
    position: absolute;
    inset: 0;
    opacity: 0;
    transform: translateY(6px);
    transition: opacity .55s ease, transform .55s ease;
}
.gs-rotator .gs-rot.active {
    opacity: 1;
    transform: translateY(0);
    position: relative; /* lifts above the absolute siblings for height */
}

.gs-cta-row {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.75rem;
}
.gs-cta-primary {
    box-shadow: 0 6px 18px rgba(15, 100, 102, 0.25);
}

/* Live sample memory card */
.gs-sample-wrap {
    margin: 1rem 0 3rem;
    padding: 1rem;
    text-align: center;
}
.gs-sample-label,
.gs-sample-caption {
    color: var(--mst-muted);
    font-size: 0.88rem;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    margin: 0 0 0.75rem;
}
.gs-sample-caption {
    margin: 1rem 0 0;
    text-transform: none;
    letter-spacing: 0;
    font-style: italic;
    font-size: 0.92rem;
}
.gs-sample-card {
    text-align: left;
    background: var(--mst-surface, #fff);
    border: 1px solid rgba(0,0,0,0.08);
    border-radius: 14px;
    padding: 0;
    box-shadow: 0 14px 36px rgba(0,0,0,0.10);
    max-width: 620px;
    margin: 0 auto;
    overflow: hidden;
    transform: rotate(-0.25deg);
    transition: transform .25s ease, box-shadow .25s ease;
}
.gs-sample-card:hover {
    transform: rotate(0);
    box-shadow: 0 18px 44px rgba(0,0,0,0.14);
}
.gs-sample-strip {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 1rem;
    background: linear-gradient(90deg, #4a3a22 0%, #6b542f 100%);
    color: #f5ecdb;
    font-size: 0.82rem;
}
.gs-sample-strip-icon { font-size: 1rem; }
.gs-sample-strip-label { font-weight: 600; letter-spacing: 0.02em; }
.gs-sample-strip-era { margin-left: auto; opacity: 0.75; font-style: italic; }
.gs-sample-head {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem 0.5rem;
}
.gs-sample-avatar {
    flex: 0 0 auto;
    width: 40px; height: 40px;
    border-radius: 50%;
    background: #c8a572;
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700;
}
.gs-sample-author { font-weight: 600; color: var(--mst-text, #1a1a1a); }
.gs-sample-date { font-size: 0.82rem; color: var(--mst-muted); }
.gs-sample-title {
    font-family: 'Fraunces', 'Cormorant Garamond', Georgia, serif;
    font-weight: 600;
    font-size: 1.5rem;
    line-height: 1.2;
    margin: 0.5rem 1.25rem 0.5rem;
    color: var(--mst-text, #1a1a1a);
}
.gs-sample-body {
    font-family: 'Fraunces', 'Cormorant Garamond', Georgia, serif;
    font-size: 1.02rem;
    line-height: 1.65;
    margin: 0 1.25rem 1rem;
    color: var(--mst-text, #1a1a1a);
}
.gs-sample-footer {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    padding: 0.75rem 1.25rem 1rem;
    border-top: 1px solid rgba(0,0,0,0.06);
}
.gs-sample-tag {
    font-size: 0.8rem;
    color: var(--mst-primary);
    background: rgba(15,100,102,0.08);
    padding: 2px 8px;
    border-radius: 999px;
}
.gs-sample-tag-profile {
    color: #8a6a32;
    background: rgba(200,165,114,0.16);
}
.gs-sample-react {
    margin-left: auto;
    font-size: 0.85rem;
    color: var(--mst-muted);
}
.gs-sample-react + .gs-sample-react { margin-left: 0; }

/* "What people make" — three sample pillars */
.gs-uses { margin: 0 0 3rem; }
.gs-uses-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}
@media (max-width: 720px) { .gs-uses-grid { grid-template-columns: 1fr; } }
.gs-use {
    padding: 0.5rem 0.5rem 0.5rem 0;
    background: transparent;
    border: none;
    border-radius: 0;
    text-align: left;
}
.gs-use-eyebrow {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-style: italic;
    font-size: 1.05rem;
    color: var(--mst-primary, #c8a572);
    letter-spacing: 0.08em;
    margin-bottom: 6px;
}
.gs-use h4 {
    font-family: 'Cormorant Garamond', 'Fraunces', Georgia, serif;
    font-style: italic;
    font-weight: 600;
    font-size: 1.4rem;
    margin: 0 0 0.6rem;
    color: var(--mst-text, #1a1a1a);
    letter-spacing: -0.005em;
}
.gs-use p {
    margin: 0;
    color: var(--mst-muted);
    font-size: 0.96rem;
    line-height: 1.6;
    max-width: 32ch;
}

/* Quiet promises grid — restrained two-column statements, no check icons */
.gs-promises {
    background: transparent;
    padding: 0;
    border-radius: 0;
    margin: 3rem 0 3rem;
}
.gs-promise-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 28px 56px;
    margin-top: 1.25rem;
}
@media (max-width: 720px) { .gs-promise-grid { grid-template-columns: 1fr; gap: 24px; } }
.gs-promise h5 {
    font-family: 'Cormorant Garamond', 'Fraunces', Georgia, serif;
    font-style: italic;
    font-weight: 600;
    font-size: 1.1rem;
    margin: 0 0 0.35rem;
    color: var(--mst-text, #1a1a1a);
    letter-spacing: -0.005em;
}
.gs-promise p {
    margin: 0;
    color: var(--mst-muted);
    font-size: 0.92rem;
    line-height: 1.55;
}

.gs-final {
    text-align: center;
    padding: 2rem 0 0;
    border-top: 1px solid rgba(0,0,0,0.06);
}
.gs-final-title {
    font-family: 'Fraunces', 'Cormorant Garamond', Georgia, serif;
    font-size: 1.8rem;
    font-weight: 600;
    margin: 0 0 0.5rem;
    color: var(--mst-text, #1a1a1a);
}
.gs-final-sub { margin: 0 auto; max-width: 520px; }

[data-theme="dark"] .gs-sample-card {
    background: var(--mst-surface-2, #1d2627);
    border-color: rgba(255,255,255,0.08);
}
[data-theme="dark"] .gs-sample-footer { border-top-color: rgba(255,255,255,0.08); }
[data-theme="dark"] .gs-sample-author,
[data-theme="dark"] .gs-sample-title,
[data-theme="dark"] .gs-sample-body,
[data-theme="dark"] .gs-use h4,
[data-theme="dark"] .gs-promise h5,
[data-theme="dark"] .gs-final-title,
[data-theme="dark"] .gs-hero-title { color: var(--mst-text, #f5ecdb); }

.post-edited-note {
    font-size: 0.72rem;
    color: var(--mst-muted);
    font-style: italic;
    letter-spacing: 0.01em;
}

/* Post body */
.post-body {
    white-space: pre-wrap;
    line-height: 1.65;
    font-size: 1rem;
    color: var(--mst-text);
}
.post-body p { margin-bottom: 0.8em; }

/* Badge tweaks */
.bg-success-subtle {
    background-color: var(--mst-light) !important;
}

/* Footer — single elegant line of links + a quiet copyright row */
.footer {
    background-color: transparent;
    color: var(--mst-muted);
    border-top: 1px solid rgba(0,0,0,0.06);
    font-size: 0.78rem;
}
.footer a { color: var(--mst-muted); text-decoration: none; }
.footer a:hover { color: var(--mst-primary); text-decoration: none; }
.footer-fine {
    letter-spacing: 0.01em;
}
.footer-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 14px;
    column-gap: 14px;
    row-gap: 6px;
}
.footer-brand { color: var(--mst-text); font-weight: 600; }
.footer-sep { color: rgba(0,0,0,0.20); user-select: none; }
[data-theme="dark"] .footer-sep { color: rgba(255,255,255,0.18); }
.footer-bottom {
    margin-top: 6px;
    font-size: 0.72rem;
    opacity: 0.75;
}
.footer-bottom .footer-sep { margin: 0 6px; }

/* Navbar — deep teal bar, sticky at top */
.navbar {
    background: linear-gradient(180deg, var(--mst-primary) 0%, var(--mst-primary-2) 100%) !important;
    border-bottom: 1px solid rgba(0,0,0,0.25);
    box-shadow: 0 2px 8px rgba(15,100,102,0.25) !important;
    position: sticky;
    top: 0;
    z-index: 1040;
    /* Promote the bar to its own compositor layer. Without this,
       Chromium (Edge) can paint a page element that has its OWN
       composited layer (e.g. a section with isolation:isolate) ABOVE
       the sticky nav even though the nav's z-index is higher — the
       "Thank you. / subscription runs through…" hero text bleeding
       over the navbar on /Premium. translateZ(0) forces the nav onto
       a layer so it composites above scrolling content. */
    transform: translateZ(0);
    /* iPhone PWA (apple-mobile-web-app-capable + black-translucent status bar):
       extend the teal under the notch so brand and icons aren't clipped. */
    padding-top: env(safe-area-inset-top);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
}
/* Scope to the top-level nav header ONLY. A bare `header` selector
   here leaked position:sticky + z-index:1040 onto EVERY <header> on
   the page — including <header class="premium-hero">, which then
   tied the navbar's z-index and, being later in the DOM, painted its
   "Thank you. / subscription runs through…" text OVER the navbar.
   body > header matches just the nav (a direct child of body); nested
   headers (premium-hero, kron-drawer-header, chat-dock-header) are
   left to their own styles. */
body > header { position: sticky; top: 0; z-index: 1040; }
[data-theme="dark"] .navbar {
    background: linear-gradient(180deg, #0a2a2b 0%, #061a1b 100%) !important;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
.navbar-brand-ks {
    color: #fff !important;
    font-family: 'Cormorant Garamond', 'Fraunces', Georgia, serif;
    font-weight: 700;
    font-style: italic;
    letter-spacing: 0.02em;
    font-size: 2rem !important;
    text-shadow: 0 1px 3px rgba(0,0,0,0.25);
    line-height: 1;
}
.navbar-brand-ks img { height: 48px !important; width: auto; }

.nav-link-gold {
    color: #fff !important;
    font-weight: 500;
}
.nav-link-gold svg { color: #fff !important; stroke: #fff !important; }
.nav-link-gold:hover,
.nav-link-gold:focus { color: var(--mst-accent) !important; }
.nav-link-gold:hover svg,
.nav-link-gold:focus svg { color: var(--mst-accent) !important; stroke: var(--mst-accent) !important; }
.nav-link-gold:hover .nav-icon-label,
.nav-link-gold:focus .nav-icon-label { color: var(--mst-accent) !important; }
.nav-icon-label {
    font-size: 0.72rem;
    letter-spacing: 0.02em;
    color: #fff !important;
    font-weight: 500;
}

/* Navbar user dropdown name white */
.navbar .nav-link.dropdown-toggle,
.navbar .nav-link.dropdown-toggle.nav-link-gold { color: #fff !important; }
.navbar .nav-link.dropdown-toggle::after { color: #fff !important; border-top-color: #fff !important; }

/* Start Here button: white outline on teal navbar */
.navbar .btn-outline-primary {
    color: #fff !important;
    border-color: #fff !important;
    background: transparent;
}
.navbar .btn-outline-primary:hover,
.navbar .btn-outline-primary:focus {
    background: #fff;
    color: var(--mst-primary) !important;
    border-color: #fff !important;
}

/* Navbar icon buttons (theme toggle, tips) — outlined on teal */
.navbar .btn-outline-secondary {
    color: #fff;
    border-color: rgba(255,255,255,0.35);
    background: transparent;
}
.navbar .btn-outline-secondary:hover {
    background: rgba(255,255,255,0.12);
    color: #fff;
    border-color: rgba(255,255,255,0.6);
}
.navbar .btn-outline-primary {
    color: #fff;
    border-color: var(--mst-accent);
    background: transparent;
}
.navbar .btn-outline-primary:hover {
    background: var(--mst-accent);
    border-color: var(--mst-accent);
    color: var(--mst-ink);
}
.navbar .dropdown-toggle::after { color: rgba(255,255,255,0.7); }
.navbar .navbar-toggler { border-color: rgba(255,255,255,0.4); }
.navbar .navbar-toggler-icon { filter: invert(1) brightness(1.5); }

/* User dropdown — editorial section labels, no emoji, comfortable rows. */
/* Any open Bootstrap dropdown sits above the sticky navbar so it
   can't be clipped by it or by neighboring stacking contexts. */
.dropdown-menu.show {
    z-index: 1080;
}

.user-dropdown {
    min-width: 240px;
    padding: 6px 0;
    border: 1px solid var(--mst-border);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    /* On short screens the menu (premium section + admin + additional
       services + footer) can run past the viewport, leaving Sign out
       unreachable. Cap it to the viewport and let it scroll. */
    max-height: calc(100vh - 70px);
    overflow-y: auto;
    overscroll-behavior: contain;
}
.user-dropdown .dropdown-item {
    padding: 8px 16px;
    font-size: 0.95rem;
    color: var(--mst-text);
}
.user-dropdown .dropdown-item:hover,
.user-dropdown .dropdown-item:focus {
    background: rgba(160,110,60,0.08);
    color: var(--mst-primary);
}
.user-dropdown .dropdown-divider { margin: 6px 0; opacity: 0.5; }
/* Muted leading icons for the "my content" tool group (Drafts, Working
   Index, Export, Deleted). Sized to align with the menu text baseline. */
.user-dropdown .dd-ico {
    width: 15px;
    height: 15px;
    margin-right: 0.55rem;
    vertical-align: -2px;
    opacity: 0.55;
}
.user-dropdown-eyebrow {
    font-family: 'Inter', system-ui, sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.22em;
    font-size: 0.66rem;
    color: var(--mst-primary, #c8a572);
    padding: 10px 16px 4px;
    margin: 0;
    font-weight: 600;
}
[data-theme="dark"] .user-dropdown-eyebrow { color: var(--mst-accent); }
.user-dropdown-admin { color: var(--mst-primary) !important; }

/* Mobile navbar: user dropdown always visible on the top bar; the collapsed
   menu lays nav items out as wrapping rows rather than a tall column. */
@media (max-width: 767.98px) {
    /* Tighten the brand on phones — 2rem + 48px logo eats half the
       topbar otherwise. */
    .navbar-brand-ks { font-size: 1.35rem !important; gap: 0.4rem !important; }
    .navbar-brand-ks img { height: 32px !important; }

    .navbar .navbar-mobile-user .nav-link.dropdown-toggle {
        padding: 0.45rem 0.85rem;
        font-weight: 600;
        border: 1px solid rgba(255,255,255,0.35);
        border-radius: 999px;
        line-height: 1.1;
        min-height: 40px;
        display: inline-flex;
        align-items: center;
    }
    .navbar .navbar-mobile-user .dropdown-menu { right: 0; left: auto; }

    /* Hamburger: bump touch target and align the toggler icon. */
    .navbar .navbar-toggler {
        padding: 0.5rem 0.65rem;
        min-width: 44px;
        min-height: 40px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .navbar-collapse .nav-main-icons {
        flex-direction: row !important;
        flex-wrap: wrap;
        justify-content: space-around;
        width: 100%;
        margin-left: 0 !important;
        margin-right: 0 !important;
        row-gap: 0.25rem;
    }
    .navbar-collapse .nav-main-icons .nav-item { flex: 0 0 auto; }
    .navbar-collapse .nav-main-icons .nav-link { padding: 0.4rem 0.5rem !important; }
    .navbar-collapse .nav-main-icons .nav-icon-label { font-size: 0.7rem; }

    .navbar-collapse .nav-utility {
        flex-direction: row !important;
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.5rem !important;
        width: 100%;
        margin: 0.5rem 0 0 !important;
    }
    .navbar-collapse .nav-utility .nav-item { margin: 0; }
}

/* Relationship tier dot (shared between sidebar + visibility selectors) */
.tier-dot {
    display: inline-block;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    margin-right: 8px;
    vertical-align: middle;
    flex-shrink: 0;
}
/* Visibility select: color each option by tier */
select.visibility-select option[value="Public"]         { color: var(--tier-public); }
select.visibility-select option[value="Acquaintances"]  { color: var(--tier-acquaintances); }
select.visibility-select option[value="Friends"]        { color: var(--tier-friends); }
select.visibility-select option[value="Family"]         { color: var(--tier-family); }
select.visibility-select option[value="Private"]        { color: var(--tier-private); }

/* Tag bubbles */
.tag-bubble {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background-color: var(--mst-light);
    color: var(--mst-primary);
    border: 1px solid var(--mst-accent);
    border-radius: 20px;
    padding: 4px 10px 4px 12px;
    font-size: 0.85rem;
    font-weight: 500;
}
.tag-bubble button {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    color: var(--mst-muted);
    font-size: 1rem;
    line-height: 1;
}
.tag-bubble button:hover { color: #dc3545; }

/* Gold nav links */
.nav-link-gold {
    color: var(--mst-gold) !important;
    font-weight: 500;
    letter-spacing: 0.03em;
    transition: color 0.15s;
}
.nav-link-gold:hover,
.nav-link-gold:focus {
    color: var(--mst-gold-light) !important;
}

/* Icon + label nav style */
.nav-icon-label {
    font-size: 0.62rem;
    letter-spacing: 0.05em;
    font-weight: 600;
    margin-top: 2px;
    text-transform: uppercase;
    line-height: 1;
}

/* Navbar dropdown fix */
.dropdown-item:active {
    background-color: var(--mst-primary);
}

/* ── Full-page landing background ── */
body.landing-body {
    background:
        radial-gradient(ellipse 80% 50% at 80% 0%, rgba(184,135,26,0.20) 0%, transparent 55%),
        radial-gradient(ellipse 70% 60% at 10% 90%, rgba(15,100,102,0.40) 0%, transparent 60%),
        linear-gradient(160deg, #0a1f24 0%, #0e2e34 45%, #061a1d 100%);
    background-attachment: fixed;
    margin-bottom: 0;
    color: #f4f1e6;
}

/* Auth pages — clean white canvas with a subtle teal corner accent */
body.auth-body {
    background:
        radial-gradient(circle at 100% 0%, rgba(15,100,102,0.06) 0%, transparent 35%),
        radial-gradient(circle at 0% 100%, rgba(184,135,26,0.05) 0%, transparent 30%),
        #ffffff;
    background-attachment: fixed;
    color: var(--mst-text);
}

.auth-wrap { min-height: calc(100vh - 200px); display: flex; align-items: center; }
.auth-card {
    background: #ffffff;
    border: 1px solid var(--mst-border);
    border-radius: 18px;
    box-shadow: 0 12px 40px -12px rgba(15,100,102,0.18), 0 2px 8px rgba(0,0,0,0.04);
    overflow: hidden;
}
.auth-title {
    font-family: var(--mst-font-serif);
    color: var(--mst-primary);
    font-weight: 700;
    letter-spacing: -0.01em;
    font-size: 1.85rem;
}
.auth-sub { color: var(--mst-muted); font-size: 0.95rem; }
.auth-card .form-label { font-size: 0.82rem; font-weight: 600; color: var(--mst-text); }
.auth-card .btn-primary {
    background: linear-gradient(135deg, var(--mst-primary) 0%, var(--mst-primary-2) 100%);
    border: none;
    border-radius: 12px;
    padding: 0.7rem;
    font-weight: 600;
    box-shadow: 0 4px 16px rgba(15,100,102,0.35);
}
.auth-card .btn-primary:hover { box-shadow: 0 6px 24px rgba(15,100,102,0.5); }
body.landing-body header,
body.landing-body .footer {
    display: none !important;
}
body.landing-body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(circle at 22% 18%, rgba(45,212,191,0.10) 0%, transparent 38%),
        radial-gradient(circle at 78% 72%, rgba(232,128,91,0.06) 0%, transparent 42%);
    pointer-events: none;
    z-index: 0;
}
body.landing-body > * { position: relative; z-index: 1; }

.landing-page-wrap {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
.footer-landing {
    background: rgba(0,0,0,0.35) !important;
    color: rgba(255,255,255,0.5) !important;
    border-top: 1px solid rgba(255,255,255,0.08);
    margin-top: 0 !important;
}

/* ── Hero ── */
.landing-hero {
    padding: 5rem 1.5rem 4rem;
    max-width: 900px;
    margin: 0 auto;
}
.hero-logo {
    height: 200px;
    width: auto;
    filter: drop-shadow(0 4px 32px rgba(201,162,39,0.5));
}
.hero-title {
    font-family: 'Cormorant Garamond', 'Fraunces', Georgia, serif;
    font-size: clamp(2.8rem, 6vw, 4.4rem);
    font-weight: 700;
    font-style: italic;
    background: linear-gradient(135deg, #f4d97e 0%, #e8c25a 50%, #d4a84a 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    letter-spacing: 0.01em;
    margin-bottom: 0;
    line-height: 1;
    filter: drop-shadow(0 2px 14px rgba(212,168,74,0.25));
}
.landing-hero .hero-headline {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-style: italic;
    font-weight: 600;
    color: rgba(244,241,230,0.98);
    font-size: clamp(1.7rem, 3.4vw, 2.4rem);
    letter-spacing: -0.005em;
    margin: 0 auto;
    max-width: 820px;
    line-height: 1.3;
    text-shadow: 0 2px 18px rgba(45,212,191,0.22);
}
.landing-hero .tagline {
    color: rgba(244,241,230,0.6);
    font-size: 0.78rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    font-weight: 500;
    margin-top: 0.4rem;
}
.hero-lead {
    color: rgba(244,241,230,0.78);
    font-size: 1.1rem;
    max-width: 580px;
    margin: 0 auto;
    line-height: 1.7;
    font-weight: 400;
}
.btn-hero-gold {
    background: linear-gradient(135deg, #f4d97e 0%, #d4a84a 100%);
    color: #0a1f24;
    border: none;
    box-shadow: 0 6px 22px rgba(212,168,74,0.4), inset 0 1px 0 rgba(255,255,255,0.4);
    font-weight: 600;
    border-radius: 12px;
    padding: 0.85rem 2.2rem;
    transition: box-shadow 0.2s, transform 0.18s;
}
.btn-hero-gold:hover {
    box-shadow: 0 10px 32px rgba(212,168,74,0.6), inset 0 1px 0 rgba(255,255,255,0.4);
    transform: translateY(-2px);
    color: #0a1f24;
}
.btn-hero-outline {
    color: rgba(244,241,230,0.95);
    border: 1.5px solid rgba(244,241,230,0.35);
    background: rgba(244,241,230,0.04);
    backdrop-filter: blur(6px);
    border-radius: 12px;
    padding: 0.85rem 2.2rem;
    font-weight: 500;
    transition: border-color 0.2s, color 0.2s, background 0.2s;
}
.btn-hero-outline:hover {
    border-color: rgba(45,212,191,0.7);
    color: #2dd4bf;
    background: rgba(45,212,191,0.08);
}

/* ── Quill Script ── */
.quill-section {
    padding: 2rem 1.5rem 0;
    min-height: 4rem;
}
.quill-stage {
    display: inline-block;
    min-height: 3.5rem;
    transition: opacity 0.6s ease;
}
.quill-stage.quill-fade-out {
    opacity: 0;
}
.quill-text {
    font-family: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
    font-size: clamp(1.5rem, 3.5vw, 2.4rem);
    font-style: italic;
    font-weight: 500;
    color: rgba(244,241,230,0.92);
    letter-spacing: 0.005em;
    line-height: 1.4;
    text-shadow: 0 2px 16px rgba(45,212,191,0.18);
}

/* ── Bottom image + Celtic frame ── */
.landing-bottom-img-wrap {
    padding: 0 2rem 4rem;
    margin: 0 auto;
    box-sizing: border-box;
}
.landing-bottom-img {
    max-width: 100%;
    width: 100%;
    display: block;
}

.landing-inline-footer {
    padding: 2rem 0 2.5rem;
    color: rgba(255,255,255,0.35);
    font-size: 0.8rem;
    letter-spacing: 0.05em;
}

/* ── Landing: pillars (Today / Together / Forever) ────────────────
   Three confident statements. No icons, no boxes — just typography
   on the dark canvas. Numerals as roman so the eye reads them as
   chapter marks, not bullet points. */
.landing-pillars {
    max-width: 1100px;
    margin: 0 auto;
    padding: 5rem 2rem 4rem;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 64px;
    color: rgba(244,241,230,0.92);
}
@@media (max-width: 900px) {
    .landing-pillars {
        grid-template-columns: 1fr;
        gap: 48px;
        padding: 3rem 1.5rem 2rem;
    }
}
.landing-pillar-eyebrow {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-style: italic;
    font-size: 1.2rem;
    color: rgba(212,168,74,0.85);
    letter-spacing: 0.1em;
    margin-bottom: 8px;
}
.landing-pillar-title {
    font-family: 'Cormorant Garamond', 'Fraunces', Georgia, serif;
    font-style: italic;
    font-weight: 600;
    font-size: 2rem;
    color: rgba(244,241,230,0.98);
    margin: 0 0 14px;
    letter-spacing: -0.005em;
}
.landing-pillar p {
    font-size: 1.02rem;
    line-height: 1.65;
    color: rgba(244,241,230,0.75);
    margin: 0;
    max-width: 32ch;
}

/* ── Landing: a single-page glimpse so visitors see what a story
   looks like inside the product. Cream paper on the dark canvas;
   nothing else fights for attention. */
.landing-glimpse {
    padding: 4rem 1.5rem;
    display: flex;
    justify-content: center;
}
.landing-glimpse-page {
    max-width: 640px;
    width: 100%;
    background: #fdf8ee;
    color: #2b241c;
    border-radius: 12px;
    padding: 56px 64px;
    box-shadow: 0 30px 80px rgba(0,0,0,0.4);
    font-family: 'Cormorant Garamond', 'Fraunces', Georgia, serif;
    line-height: 1.7;
    font-size: 1.12rem;
    transform: rotate(-0.3deg);
}
@@media (max-width: 600px) {
    .landing-glimpse-page {
        padding: 36px 28px;
        font-size: 1.02rem;
        transform: none;
    }
}
.landing-glimpse-eyebrow {
    font-family: 'Inter', system-ui, sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.22em;
    font-size: 0.7rem;
    color: rgba(0,0,0,0.4);
    margin-bottom: 14px;
}
.landing-glimpse-title {
    font-family: 'Cormorant Garamond', 'Fraunces', Georgia, serif;
    font-weight: 600;
    font-size: 1.8rem;
    line-height: 1.2;
    margin: 0 0 6px;
    letter-spacing: -0.005em;
}
.landing-glimpse-date {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-style: italic;
    color: rgba(0,0,0,0.5);
    font-size: 0.95rem;
    margin-bottom: 18px;
}
.landing-glimpse-page p { margin: 0 0 14px; text-align: justify; hyphens: auto; }
.landing-glimpse-page p:last-child { margin-bottom: 0; }
.landing-glimpse-page p:first-of-type::first-letter {
    font-family: 'Cormorant Garamond', 'Fraunces', Georgia, serif;
    font-weight: 600;
    float: left;
    font-size: 3.2rem;
    line-height: 0.95;
    padding: 4px 8px 0 0;
    color: #b08a3d;
}

/* ── Landing: closing block ──────────────────────────────────── */
.landing-closing {
    padding: 5rem 1.5rem 3rem;
    color: rgba(244,241,230,0.92);
}
.landing-closing h3 {
    font-family: 'Cormorant Garamond', 'Fraunces', Georgia, serif;
    font-style: italic;
    font-weight: 600;
    font-size: clamp(1.8rem, 4vw, 2.6rem);
    color: rgba(244,241,230,0.98);
    margin: 0;
    letter-spacing: -0.005em;
}

/* Celtic golden frame */
.celtic-frame {
    position: relative;
    display: inline-block;
    width: 100%;
    border: 3px double var(--mst-gold);
    box-shadow:
        0 0 0 1px rgba(201,162,39,0.2),
        0 0 0 7px rgba(9,26,15,0.9),
        0 0 0 10px var(--mst-gold),
        0 0 0 12px rgba(201,162,39,0.3),
        0 0 0 18px rgba(9,26,15,0.7),
        0 0 0 20px rgba(201,162,39,0.15),
        0 12px 50px rgba(0,0,0,0.7);
    padding: 10px;
    background: rgba(9,26,15,0.4);
}
/* Celtic corner shamrocks */
.cf-corner {
    position: absolute;
    font-size: 1.6rem;
    line-height: 1;
    color: var(--mst-gold);
    text-shadow: 0 0 10px rgba(201,162,39,0.8), 0 0 20px rgba(201,162,39,0.4);
    z-index: 2;
}
.cf-tl { top: -22px;  left: -22px;  transform: rotate(0deg); }
.cf-tr { top: -22px;  right: -22px; transform: rotate(90deg); }
.cf-br { bottom: -22px; right: -22px; transform: rotate(180deg); }
.cf-bl { bottom: -22px; left: -22px;  transform: rotate(270deg); }

/* Scrollbar */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--mst-bg); }
::-webkit-scrollbar-thumb { background: var(--mst-accent); border-radius: 4px; }

/* ── 3-column layout: left ~17.5%, center ~50%, right ~32.5% ── */
@media (min-width: 768px) {
    .col-sidebar {
        align-self: flex-start;
    }
    /* Left sidebar (first in row) */
    .row > .col-sidebar:first-child {
        flex: 0 0 17.5% !important;
        width: 17.5% !important;
        max-width: 17.5% !important;
    }
    /* Right sidebar (last in row) */
    .row > .col-sidebar:last-child {
        flex: 0 0 22.5% !important;
        width: 22.5% !important;
        max-width: 22.5% !important;
    }
    .col-main {
        flex: 0 0 60% !important;
        width: 60% !important;
        max-width: 60% !important;
    }
}

/* ── Chronological Timeline ── */
.timeline-year-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 1.5rem 0 1rem;
}

.timeline-line-segment {
    flex: 1;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--mst-accent) 20%, var(--mst-accent) 80%, transparent);
    border-radius: 2px;
    opacity: 0.55;
}

.timeline-year-badge {
    background: var(--mst-card);
    color: var(--mst-primary);
    border: 1px solid var(--mst-accent);
    border-radius: 20px;
    padding: 4px 16px;
    font-family: 'Georgia', 'Cormorant Garamond', serif;
    font-weight: 700;
    font-size: 0.95rem;
    white-space: nowrap;
    box-shadow: 0 2px 6px rgba(184, 135, 26, 0.18);
    letter-spacing: 0.02em;
}

/* ── Post media: fixed 16:9 aspect ratio spanning full column ── */
.post-media-wrap {
    position: relative;
    width: 100%;
    padding-top: 56.25%; /* 16:9 */
    overflow: hidden;
    border-radius: 8px;
    background: #000;
}
.post-media-wrap img,
.post-media-wrap video {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
/* Inline pasted images in the body textarea preview */
.pasted-img-preview {
    max-width: 100%;
    border-radius: 6px;
    margin-top: 8px;
    display: block;
}

/* ============================================
   Quick Story — clean modern composer
   ============================================ */
.quick-story-card {
    position: relative;
    background: var(--mst-card) !important;
    border: 2px solid var(--mst-accent) !important;
    border-radius: var(--mst-radius) !important;
    box-shadow:
        0 6px 20px -8px rgba(184,135,26,0.25),
        var(--mst-shadow) !important;
    overflow: visible !important;
    margin-top: 14px !important;
}
/* Inline replacement for the old floating pseudo-element label. Reads
   cleanly in dark mode and doesn't fight the card's stacking context. */
.quick-story-tag {
    display: inline-block;
    background: var(--mst-accent);
    color: #fff;
    font-family: var(--mst-font-sans);
    font-size: 0.6rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    padding: 1px 8px;
    border-radius: 999px;
    text-transform: uppercase;
    margin-bottom: 8px;
    box-shadow: 0 1px 3px rgba(184,135,26,0.20);
}
.quick-story-card .card-body { padding: 14px 16px !important; }

/* ============================================
   Full Story page-style editor
   ============================================ */
.story-page {
    position: relative;
    background: #fffefa;
    border: 1px solid var(--mst-border);
    border-radius: var(--mst-radius);
    box-shadow:
        0 1px 0 rgba(0,0,0,0.04),
        0 12px 36px -16px rgba(15,100,102,0.18);
    padding: 36px 48px 60px;
    min-height: 520px;
}
[data-theme="dark"] .story-page {
    background: #1b2130;
}
@@media (max-width: 600px) {
    .story-page { padding: 24px 18px 56px; }
}

.story-title-input {
    width: 100%;
    border: none;
    background: transparent;
    font-family: var(--mst-font-serif);
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--mst-ink);
    padding: 2px 0 6px;
    outline: none;
    border-bottom: 1px dashed transparent;
    margin-bottom: 10px;
}
.story-title-input::placeholder { color: var(--mst-muted); font-style: italic; }
.story-title-input:focus { border-bottom-color: var(--mst-border); }

.story-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 2px;
    margin-bottom: 10px;
    padding: 6px 8px;
    background: var(--mst-surface-2);
    border-radius: 10px;
    column-gap: 4px;
    row-gap: 6px;
}
/* Visual group separator — the bar between formatting buttons,
   the image controls, and the mode/stats cluster. */
.story-toolbar .story-tool-sep {
    width: 1px;
    background: var(--mst-border);
    margin: 4px 4px;
    align-self: stretch;
}

/* Make the toolbar stick to the top of the viewport while writing
   so the user always has formatting controls in reach — especially
   important on mobile when the editor takes the whole screen. */
.story-toolbar-sticky {
    position: sticky;
    top: 8px;
    z-index: 10;
    backdrop-filter: blur(6px);
}
@@media (max-width: 768px) {
    .story-toolbar-sticky { top: 0; border-radius: 0; }
    .story-tool { width: 36px; height: 36px; }  /* bigger touch targets */
}

.story-toolbar-spacer { flex: 1 1 auto; min-width: 6px; }
/* On wider screens, push the meta cluster (toggle + stats + autosave)
   to its own line *visually* by forcing a wrap before it. Keeps the
   formatting buttons clean on top, meta on the bottom. */
.story-toolbar .story-toolbar-break {
    flex-basis: 100%;
    height: 0;
    margin: 0;
}
.story-stats {
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 0.78rem;
    color: var(--mst-muted, #6b6258);
    padding: 0 8px;
    font-variant-numeric: tabular-nums;
}
.story-stats-bottom {
    margin-top: 6px;
    font-size: 0.74rem;
    color: var(--mst-muted, #6b6258);
}
.story-autosave {
    display: inline-block;
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 0.72rem;
    color: var(--mst-muted, #6b6258);
    font-style: italic;
    padding: 0 6px;
    min-width: 0;
}
.story-editor-drag-over {
    outline: 2px dashed var(--mst-primary, #c8a572);
    outline-offset: 4px;
    background: rgba(200,165,114,0.05);
}

/* Section labels used to group fields in the Create-story form
   (Date · Publish-as · Layout · Audience+place · Tags). The eyebrow
   gives the dense form some breathing room and a clear sense of
   what each chunk is for. */
.story-meta-section-label {
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--mst-primary, #c8a572);
    margin: 4px 0 6px;
    padding-top: 8px;
    border-top: 1px solid rgba(0,0,0,0.06);
}
.story-meta-section-label:first-of-type {
    border-top: none;
    padding-top: 0;
}
/* Hover/focus info chip beside a section label — carries the longer
   explanation in a tooltip so the form stays uncluttered. */
.meta-hint {
    display: inline-flex;
    align-items: center;
    margin-left: 6px;
    color: var(--mst-muted);
    opacity: 0.6;
    cursor: help;
    vertical-align: middle;
    transition: opacity 0.15s, color 0.15s;
}
.meta-hint:hover,
.meta-hint:focus {
    opacity: 1;
    color: var(--mst-primary);
    outline: none;
}

/* Inline-photos premium toggle in the toolbar */
.story-inline-toggle {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 0.78rem;
    color: var(--mst-text);
    padding: 2px 8px;
    border-radius: 999px;
    cursor: pointer;
    user-select: none;
}
.story-inline-toggle input[type="checkbox"] {
    accent-color: var(--mst-primary, #c8a572);
}
.story-inline-toggle.is-gated {
    cursor: not-allowed;
    opacity: 0.6;
}
.story-inline-toggle.is-gated input[type="checkbox"] {
    pointer-events: none;
}
.story-inline-toggle-badge {
    display: inline-block;
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 1px 5px;
    border-radius: 8px;
    color: #fff;
    background: var(--mst-primary, #c8a572);
}

/* Editor + rendered inline images. Note: published bodies emit a
   bare <img> (no wrapper) so the float / clear / margin actually
   takes effect inside the paragraph container. The editor surface
   also targets the same image directly. */
.post-body img,
.post-full-text img,
.story-editor img {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
}
/* Default for inline images with no position class — centered block.
   Position classes below override this when set. */
.post-body img:not([class*="img-pos-"]):not([class*="img-float-"]),
.post-full-text img:not([class*="img-pos-"]):not([class*="img-float-"]),
.story-editor img:not([class*="img-pos-"]):not([class*="img-float-"]) {
    display: block;
    margin: 12px auto;
}
/* Paragraph containers in the post body need to clear their floats
   so the next paragraph starts cleanly. */
.post-body, .post-full-text { overflow: hidden; }
/* 2×3 inline-image position grid — the premium picker that appears
   in the editor toolbar when an inline image is selected. Six cells
   map to top/bottom × left/center/right. */
.story-img-pos-grid {
    display: inline-grid;
    grid-template-columns: repeat(3, 22px);
    grid-template-rows: repeat(2, 22px);
    gap: 2px;
    padding: 2px;
    background: var(--mst-surface-2, rgba(0,0,0,0.04));
    border-radius: 6px;
    margin: 0 4px;
    vertical-align: middle;
}
.story-img-pos-cell {
    width: 22px; height: 22px;
    border: 1px solid transparent;
    background: var(--mst-card);
    color: var(--mst-muted, #6b6258);
    border-radius: 4px;
    font-size: 0.78rem;
    line-height: 20px;
    text-align: center;
    cursor: pointer;
    padding: 0;
}
.story-img-pos-cell:hover {
    background: var(--mst-primary, #c8a572);
    color: #fff;
    border-color: var(--mst-primary, #c8a572);
}
.story-img-pos-cell.is-active {
    background: var(--mst-primary, #c8a572);
    color: #fff;
    border-color: var(--mst-primary, #c8a572);
}

/* The six position classes themselves. left/right cells float the
   image so prose wraps around; center cells make it a centered block.
   "bottom-" cells add `clear:both` so the float starts on a new line
   *below* whatever came before — gives the visual "image at bottom of
   paragraph" effect inside flowing text. */
img.img-pos-top-left {
    float: left;
    clear: left;
    margin: 4px 14px 8px 0;
    max-width: 48%;
    display: inline;
}
img.img-pos-top-right {
    float: right;
    clear: right;
    margin: 4px 0 8px 14px;
    max-width: 48%;
    display: inline;
}
img.img-pos-top-center {
    float: none;
    display: block;
    clear: both;
    margin: 8px auto 14px;
    max-width: 80%;
}
img.img-pos-bottom-left {
    float: left;
    clear: both;
    margin: 14px 14px 4px 0;
    max-width: 48%;
    display: inline;
}
img.img-pos-bottom-right {
    float: right;
    clear: both;
    margin: 14px 0 4px 14px;
    max-width: 48%;
    display: inline;
}
img.img-pos-bottom-center {
    float: none;
    display: block;
    clear: both;
    margin: 14px auto 8px;
    max-width: 80%;
}

/* Legacy float helpers — preserved so older saved posts keep
   rendering. Newer posts use img-pos-*-* above. */
img.img-float-left {
    float: left;
    margin: 4px 14px 8px 0;
    max-width: 48%;
    display: inline;
}
img.img-float-right {
    float: right;
    margin: 4px 0 8px 14px;
    max-width: 48%;
    display: inline;
}
img.img-block {
    float: none;
    display: block;
    margin: 14px auto;
    max-width: 80%;
}
/* When a paragraph ends, clear lingering floats so the next paragraph
   starts on a fresh line (mirrors what a book reader expects). */
.book-story-body-inline p,
.book-story-body-inline div {
    overflow: hidden; /* contain floats inside a paragraph */
}
.book-story-body-inline::after,
.post-body::after,
.post-full-text::after {
    content: "";
    display: block;
    clear: both;
}
/* Editor visual cue when an inline image is selected — outline so the
   float buttons in the toolbar feel connected to the chosen image. */
.story-editor img.story-img-selected {
    outline: 2px solid var(--mst-primary, #c8a572);
    outline-offset: 2px;
}
/* ── Tier A premium typography ────────────────────────────────────
   When the post's author is currently premium, their card / detail
   body picks up book-quality typography polish: justified text with
   hyphenation, a drop cap on the first paragraph, and a small gold
   accent rule under the title. The class is applied at render time
   so a lapsed subscription naturally downgrades the look. */
.feed-card-premium .post-body,
.post-body.post-body-premium {
    text-align: justify;
    hyphens: auto;
    -webkit-hyphens: auto;
}
.feed-card-premium .post-body::first-letter,
.post-body.post-body-premium::first-letter {
    font-family: 'Fraunces', Georgia, serif;
    font-weight: 600;
    float: left;
    font-size: 2.6rem;
    line-height: 0.95;
    padding: 4px 8px 0 0;
    color: var(--mst-primary, #c8a572);
}
.feed-card-premium h5,
.feed-card-premium .post-title,
.post-body-premium-title {
    position: relative;
}
.feed-card-premium h5::after,
.feed-card-premium .post-title::after {
    content: "";
    display: block;
    width: 36px; height: 2px;
    background: var(--mst-primary, #c8a572);
    margin-top: 6px;
    border-radius: 2px;
}

/* Premium cover hero — full-width image with title overlay at the
   top of a premium author's feed card. The image is the lead photo
   from the post; a gradient overlay ensures the title is readable
   on any photo background. */
.feed-cover {
    display: block;
    position: relative;
    height: 280px;
    background-color: #2b241c;
    background-size: cover;
    background-repeat: no-repeat;
    border-top-left-radius: 14px;
    border-top-right-radius: 14px;
    overflow: hidden;
    text-decoration: none;
    color: #fff;
}
.feed-cover:hover { color: #fff; text-decoration: none; }
.feed-cover-overlay {
    position: absolute; inset: 0;
    background: linear-gradient(180deg,
        rgba(0,0,0,0) 35%,
        rgba(0,0,0,0.15) 55%,
        rgba(0,0,0,0.75) 100%);
    pointer-events: none;
}
.feed-cover-title {
    position: absolute;
    left: 20px; right: 20px; bottom: 38px;
    font-family: 'Fraunces', Georgia, serif;
    font-weight: 600;
    font-size: 1.6rem;
    line-height: 1.15;
    color: #fff;
    text-shadow: 0 2px 8px rgba(0,0,0,0.5);
    margin: 0;
    z-index: 1;
}
.feed-cover-meta {
    position: absolute;
    left: 20px; bottom: 14px;
    font-size: 0.78rem;
    color: rgba(255,255,255,0.85);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    text-shadow: 0 1px 4px rgba(0,0,0,0.5);
    z-index: 1;
}
@@media (max-width: 600px) {
    .feed-cover { height: 220px; }
    .feed-cover-title { font-size: 1.3rem; left: 14px; right: 14px; bottom: 32px; }
    .feed-cover-meta { left: 14px; bottom: 12px; }
}

/* Mobile: floats compete too hard with reading width — collapse to
   full-width blocks under 600px. Covers both legacy float-* and the
   new img-pos-* classes. */
@@media (max-width: 600px) {
    .story-editor img.img-float-left,
    .story-editor img.img-float-right,
    .post-inline-img img.img-float-left,
    .post-inline-img img.img-float-right,
    img.img-float-left,
    img.img-float-right,
    img[class*="img-pos-"][class*="-left"],
    img[class*="img-pos-"][class*="-right"] {
        float: none !important;
        display: block;
        margin: 12px auto;
        max-width: 100%;
    }
}
.story-tool {
    background: transparent;
    border: none;
    color: var(--mst-text);
    width: 32px;
    height: 30px;
    border-radius: 6px;
    font-size: 0.95rem;
    cursor: pointer;
    transition: background-color .1s ease;
}
.story-tool:hover { background: var(--mst-card); }
.story-tool-sep {
    width: 1px;
    background: var(--mst-border);
    margin: 4px 4px;
}

.story-editor {
    min-height: 360px;
    outline: none;
    font-family: 'Georgia', 'Cormorant Garamond', serif;
    font-size: 1.05rem;
    line-height: 1.75;
    color: var(--mst-text);
    padding: 4px 2px;
}
.story-editor:empty::before {
    content: attr(data-placeholder);
    color: var(--mst-muted);
    font-style: italic;
    pointer-events: none;
}
.story-editor h2 {
    font-family: var(--mst-font-serif);
    font-size: 1.4rem;
    margin: 16px 0 6px;
    color: var(--mst-ink);
}
.story-editor blockquote {
    border-left: 3px solid var(--mst-accent);
    padding: 4px 14px;
    background: rgba(184,135,26,0.05);
    margin: 12px 0;
    font-style: italic;
}
.story-editor p { margin: 8px 0 12px; }
.story-editor img { max-width: 100%; border-radius: 8px; margin: 8px 0; display: block; }

.story-page-actions {
    position: absolute;
    top: 28px;
    right: 24px;
    display: flex;
    gap: 8px;
}
/* "Enhance" dropdown — folds the premium tools (voice/video/AI/polish/
   dictate) behind one button. Anchored under its trigger in the action rail. */
.story-enhance-wrap { position: relative; display: inline-flex; }
.story-enhance-panel {
    position: absolute;
    top: 50px;
    right: 0;
    width: 232px;
    background: #fff;
    border: 1px solid #e2dbc6;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.18);
    padding: 10px;
    z-index: 1200;
}
.story-enhance-head {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #8a7a52;
    font-weight: 600;
    margin: 2px 4px 8px;
}
.story-enhance-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 3px 4px;
}
.story-enhance-row + .story-enhance-row { margin-top: 2px; }
.story-enhance-label { font-size: 0.9rem; color: #3a3326; }
.story-enhance-upsell {
    display: block;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #eee4cb;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--mst-accent-2, #9a6b00);
    text-decoration: none;
}
.story-enhance-upsell:hover { text-decoration: underline; }
.story-action-btn {
    position: relative;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: rgba(15,100,102,0.1);
    border: 1.5px solid var(--mst-primary);
    color: var(--mst-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: color .12s ease, border-color .12s ease, background .12s ease, transform .1s ease, box-shadow .12s ease;
    box-shadow: 0 2px 6px rgba(15,100,102,0.15);
}
.story-action-btn:hover {
    color: #fff;
    background: var(--mst-primary);
    border-color: var(--mst-primary);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(15,100,102,0.32);
}
.story-action-btn svg {
    width: 20px; height: 20px;
    fill: none; stroke: currentColor; stroke-width: 1.8;
    stroke-linecap: round; stroke-linejoin: round;
}
/* Music variant — gold-tinted */
.story-action-btn[data-bs-target*="Music"] {
    background: rgba(234,179,8,0.14);
    border-color: var(--mst-accent);
    color: var(--mst-accent-2);
    box-shadow: 0 2px 6px rgba(234,179,8,0.18);
}
.story-action-btn[data-bs-target*="Music"]:hover {
    background: var(--mst-accent);
    border-color: var(--mst-accent);
    color: var(--mst-ink);
    box-shadow: 0 6px 16px rgba(234,179,8,0.35);
}
.story-action-badge {
    position: absolute;
    top: -3px;
    right: -3px;
    background: var(--mst-accent);
    color: var(--mst-ink);
    font-size: 0.6rem;
    font-weight: 700;
    border-radius: 999px;
    padding: 1px 6px;
    line-height: 1.2;
}

.story-meta {
    background: var(--mst-card);
    border: 1px solid var(--mst-border);
    border-radius: var(--mst-radius-sm);
    padding: 12px 14px;
}

/* Tooltips: white text on teal, narrow, force above the icon */
.tooltip { z-index: 1090 !important; }
.tooltip .tooltip-inner {
    background: rgba(15,100,102,0.96) !important;
    color: #fff !important;
    font-size: 0.72rem;
    padding: 4px 9px;
    border-radius: 8px;
    white-space: nowrap;
    max-width: 240px;
}
.tooltip.bs-tooltip-top .tooltip-arrow::before,
.tooltip.bs-tooltip-auto[data-popper-placement^="top"] .tooltip-arrow::before {
    border-top-color: rgba(15,100,102,0.96) !important;
}
.tooltip.bs-tooltip-bottom .tooltip-arrow::before,
.tooltip.bs-tooltip-auto[data-popper-placement^="bottom"] .tooltip-arrow::before {
    border-bottom-color: rgba(15,100,102,0.96) !important;
}

/* ============================================
   Sidebar rail — flatter visual hierarchy
   ============================================ */
.rail-section {
    margin-bottom: 14px;
    padding: 12px 14px;
    background: var(--mst-card);
    border: 1px solid var(--mst-border);
    border-radius: var(--mst-radius);
    box-shadow: var(--mst-shadow-sm);
}
.rail-head {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--mst-muted);
    font-weight: 700;
    margin-bottom: 8px;
}
.rail-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.rail-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 8px;
    color: var(--mst-text);
    text-decoration: none;
    font-size: 0.86rem;
    transition: background-color .12s ease;
}
.rail-link:hover { background: var(--mst-surface-2); color: var(--mst-text); }
.rail-list-divider { border-top: 1px solid var(--mst-border); margin-top: 6px; padding-top: 6px; }
.rail-friend-link { gap: 10px; }
.rail-friend-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail-tag {
    flex-shrink: 0;
    font-size: 0.66rem;
    color: var(--mst-muted);
    font-weight: 500;
    letter-spacing: 0.02em;
    background: var(--mst-surface-2);
    border-radius: 999px;
    padding: 1px 7px;
}
.rail-tag-online {
    background: rgba(34,197,94,0.15);
    color: #16a34a;
    font-weight: 600;
}
.rail-week-pill {
    font-size: 0.66rem;
    font-weight: 600;
    color: var(--mst-primary);
    background: rgba(15,100,102,0.1);
    border-radius: 999px;
    padding: 1px 7px;
}
.rail-footer-link {
    display: block;
    text-align: right;
    font-size: 0.76rem;
    color: var(--mst-primary);
    padding: 6px 4px 0;
    text-decoration: none;
}
.rail-footer-link:hover { color: var(--mst-primary-2); text-decoration: underline; }
.rail-empty { font-size: 0.8rem; color: var(--mst-muted); padding: 0 4px; }

/* Collapsible rail sections (My Network, Recently Active, Tips) */
.rail-collapsible summary {
    cursor: pointer;
    user-select: none;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 2px 4px;
    border-radius: 6px;
}
.rail-collapsible summary::-webkit-details-marker { display: none; }
.rail-collapsible summary::before {
    content: "▾";
    font-size: 0.7rem;
    color: var(--mst-muted);
    width: 10px;
    transition: transform .15s ease;
    display: inline-block;
}
.rail-collapsible:not([open]) summary::before { transform: rotate(-90deg); }
.rail-collapsible summary:hover { background: var(--mst-surface-2); }

/* Tips & Announcements rail card */
.rail-tips-list {
    list-style: none;
    padding: 0;
    margin: 8px 0 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.rail-tips-list li {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    padding: 4px 6px;
    font-size: 0.78rem;
    line-height: 1.35;
}
.rail-tip-text { color: var(--mst-text); }

/* Compose card — emphasized (overrides default rail-section bg) */
.rail-compose {
    background: linear-gradient(135deg, rgba(15,100,102,0.08), rgba(234,179,8,0.06)) !important;
    padding: 12px !important;
}
.rail-compose-primary {
    background: var(--mst-primary) !important;
    color: #fff !important;
    border-color: var(--mst-primary) !important;
}

/* Mini square buttons inside .rail-compose (theme toggle, "+ new
   story"). Equal-sized squares so the row reads as a cluster of
   tools rather than a primary CTA. */
.rail-mini-btn {
    flex: 1 1 0;
    aspect-ratio: 1 / 1;
    max-height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--mst-card);
    border: 1px solid var(--mst-border);
    border-radius: 6px;
    color: var(--mst-text);
    text-decoration: none;
    cursor: pointer;
    padding: 0;
    transition: background-color .15s, border-color .15s, transform .1s;
}
.rail-mini-btn:hover {
    background: var(--mst-light);
    border-color: var(--mst-accent);
    color: var(--mst-primary);
}
.rail-mini-btn:active { transform: scale(0.96); }

/* Premium CTA — the full-width button that pulls the eye in the
   sidebar. Gold gradient, subtle shadow, scales lightly on hover.
   The static "Premium Member" badge reuses the same shape but
   doesn't pretend to be clickable. */
.rail-premium-cta,
.rail-premium-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 10px 14px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.92rem;
    letter-spacing: 0.02em;
    text-decoration: none;
    background: linear-gradient(135deg, var(--mst-accent), var(--mst-accent-2));
    color: #fff;
    border: none;
    box-shadow: 0 2px 6px rgba(184, 135, 26, 0.25);
    transition: transform .12s ease, box-shadow .12s ease;
}
.rail-premium-cta:hover {
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(184, 135, 26, 0.35);
}
.rail-premium-badge {
    cursor: default;
    /* Slightly desaturated for the already-a-member case so it reads
       as a status indicator, not a buy-me button. */
    background: linear-gradient(135deg, #d4a84a, #b8871a);
    opacity: 0.92;
}
.rail-premium-icon { font-size: 1.05rem; line-height: 1; }
.rail-premium-text { line-height: 1; }

/* Family Group action bar — the elegant row of buttons that sits
   under the title/badge/description block. Spacer pushes the
   Edit/Delete/Leave management actions to the right edge. */
.fg-action-bar {
    padding: 10px 12px;
    background: linear-gradient(135deg, rgba(15,100,102,0.04), rgba(234,179,8,0.03));
    border: 1px solid var(--mst-border);
    border-radius: 8px;
}
.fg-action-spacer { flex: 1 1 auto; min-width: 4px; }

/* On This Day card — soft tinted (overrides default rail-section bg) */
.rail-on-this-day {
    background: linear-gradient(135deg, rgba(15,100,102,0.06), rgba(234,179,8,0.08)) !important;
    border-left: 3px solid var(--mst-accent) !important;
}
.rail-otd-row { font-size: 0.82rem; line-height: 1.35; margin-bottom: 6px; }
.rail-otd-row:last-child { margin-bottom: 0; }
.rail-otd-year {
    display: inline-block;
    font-size: 0.66rem;
    background: var(--mst-card);
    border: 1px solid var(--mst-border);
    color: var(--mst-muted);
    border-radius: 999px;
    padding: 1px 8px;
    margin-right: 4px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.rail-otd-link { color: var(--mst-text); text-decoration: none; font-weight: 500; }
.rail-otd-link:hover { color: var(--mst-primary); text-decoration: underline; }

/* Today's Prompt / Announcement card (shared base) */
.rail-prompt {
    border-left: 4px solid var(--mst-primary) !important;
}
.rail-prompt-gold { border-left-color: var(--mst-accent) !important; }
.rail-prompt-teal { border-left-color: var(--mst-primary) !important; }

/* Rotator card: fixed-size box, JS auto-fits text inside. */
.rail-rotator {
    border-left: 4px solid var(--mst-primary) !important;
    transition: opacity .22s ease, border-color .22s ease;
    height: 170px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}
.rail-rotator.rail-rotator-fading { opacity: 0; }
.rail-rotator:has(.tips-badge-prompt)  { border-left-color: var(--mst-accent) !important; }
.rail-rotator:has(.tips-badge-warning) { border-left-color: #ef4444 !important; }
.rail-rotator:has(.tips-badge-new)     { border-left-color: var(--mst-accent) !important; }
.rail-rotator-badge { display: inline-block; align-self: flex-start; flex-shrink: 0; }
.rail-rotator-text {
    flex-grow: 1;
    margin: 8px 0 4px !important;
    overflow: hidden;
    display: flex;
    align-items: center;
    line-height: 1.4;
    /* font-size set dynamically by JS to fit; default starting size: */
    font-size: 0.92rem;
}
.rail-rotator-btn { align-self: flex-start; flex-shrink: 0; }
.rail-prompt-text {
    font-family: var(--mst-font-serif);
    font-style: italic;
    font-size: 0.92rem;
    color: var(--mst-text);
    line-height: 1.4;
    margin-bottom: 8px;
}
.rail-prompt-btn {
    display: inline-block;
    background: var(--mst-accent);
    color: var(--mst-ink);
    text-decoration: none;
    padding: 5px 12px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
    transition: background-color .12s ease;
}
.rail-prompt-btn:hover { background: var(--mst-accent-2); color: #fff; }

/* Coming Soon (collapsed by default) */
.rail-coming summary {
    cursor: pointer;
    padding: 6px 4px;
    border-radius: 8px;
    user-select: none;
}
.rail-coming summary::-webkit-details-marker { display: none; }
.rail-coming summary::before {
    content: "▸ ";
    color: var(--mst-muted);
    transition: transform .15s ease;
    display: inline-block;
}
.rail-coming[open] summary::before { content: "▾ "; }
.rail-coming summary:hover { background: var(--mst-surface-2); }
.rail-coming-body { padding: 0 6px 4px; }
.rail-coming-sub {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--mst-primary);
    font-weight: 700;
    margin-bottom: 4px;
}
.rail-coming-list {
    list-style: none;
    padding: 0;
    margin: 0 0 6px;
    font-size: 0.78rem;
    color: var(--mst-text);
}
.rail-coming-list li { padding: 3px 4px; border-bottom: 1px solid var(--mst-border); }
.rail-coming-list li:last-child { border-bottom: none; }

/* Ko-fi tip jar — warm, subtle card that sits just before Coming Soon */
.rail-kofi { text-align: center; }
.rail-kofi-head {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--mst-text);
    margin-bottom: 8px;
}
.rail-kofi-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #ff5e5b;
    color: #fff !important;
    font-weight: 600;
    font-size: 0.85rem;
    padding: 7px 14px;
    border-radius: 999px;
    text-decoration: none;
    box-shadow: 0 2px 6px rgba(255, 94, 91, 0.35);
    transition: background 0.15s ease, transform 0.15s ease;
}
.rail-kofi-btn:hover {
    background: #e85451;
    color: #fff !important;
    transform: translateY(-1px);
}
.rail-kofi-cup { font-size: 1rem; line-height: 1; }
.rail-kofi-sub {
    font-size: 0.72rem;
    color: var(--mst-muted);
    margin: 8px 0 0;
}

/* Centered single-column main content */
.col-main {
    /* No ads ever, so let the content column breathe — 820 px reads
       comfortably on a wide laptop while still leaving the sidebar
       room. Bumped from the earlier 720 px cap. */
    max-width: 820px;
    margin-left: auto;
    margin-right: auto;
}
.col-sidebar {
    min-width: 240px;
    padding-right: 8px;
}
.col-sidebar .card {
    box-shadow: none;
}

/* Floating feedback button (legacy class — kept in case any page outside
   the layout still references it). */
.feedback-fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--mst-primary);
    color: #fff;
    border: none;
    box-shadow: var(--mst-shadow-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1030;
    transition: transform .12s ease, background-color .12s ease;
}
.feedback-fab:hover { background: var(--mst-primary-2); transform: translateY(-2px); }
.feedback-fab svg { width: 22px; height: 22px; stroke: #fff; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ── Floating chat dock ────────────────────────────────────────────────
   The bubble (.chat-fab) anchors to the bottom-right; clicking it slides
   open the .chat-dock panel as a visual extension of the bubble. The
   dock contains a pinned "feedback to admin" composer at the top and
   the user's recent conversations below — same data the inbox shows,
   tightened for a corner overlay.                                     */
.chat-fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--mst-primary);
    color: #fff;
    border: none;
    box-shadow: 0 6px 20px rgba(0,0,0,0.18);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1040;
    cursor: pointer;
    transition: transform .12s, background-color .12s, box-shadow .12s;
}
.chat-fab:hover {
    background: var(--mst-primary-2, var(--mst-secondary));
    transform: translateY(-2px) scale(1.04);
    box-shadow: 0 10px 28px rgba(0,0,0,0.22);
}
.chat-fab[aria-expanded="true"] {
    background: var(--mst-primary-2, var(--mst-secondary));
}
.chat-fab svg {
    width: 26px; height: 26px;
    stroke: #fff;
    fill: none;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.chat-fab-badge {
    position: absolute;
    top: -4px; right: -4px;
    min-width: 22px; height: 22px;
    border-radius: 999px;
    background: #d54545;
    color: #fff;
    font-weight: 700;
    font-size: 0.72rem;
    display: flex; align-items: center; justify-content: center;
    padding: 0 6px;
    border: 2px solid #fff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.chat-dock {
    position: fixed;
    right: 24px;
    bottom: 96px;
    width: 360px;
    max-height: calc(100vh - 140px);
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid var(--mst-border);
    border-radius: 16px;
    box-shadow: 0 16px 40px rgba(0,0,0,0.18);
    z-index: 1039;
    overflow: hidden;
    animation: chat-dock-pop 0.18s ease-out;
    transform-origin: bottom right;
}
[data-theme="dark"] .chat-dock {
    background: #1d1b16;
    border-color: rgba(217,212,197,0.18);
    box-shadow: 0 16px 40px rgba(0,0,0,0.5);
}
@keyframes chat-dock-pop {
    from { opacity: 0; transform: translateY(8px) scale(0.96); }
    to   { opacity: 1; transform: translateY(0)   scale(1);    }
}

.chat-dock-header {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--mst-border);
    background: linear-gradient(180deg, rgba(255,255,255,0.95), rgba(255,255,255,0.85));
}
[data-theme="dark"] .chat-dock-header {
    background: linear-gradient(180deg, rgba(34,31,23,0.95), rgba(34,31,23,0.8));
}
.chat-dock-title {
    flex: 1;
    font-weight: 700;
    color: var(--mst-primary);
    font-size: 1rem;
}
.chat-dock-open-all {
    color: var(--mst-muted);
    text-decoration: none;
    font-size: 0.78rem;
    font-weight: 600;
}
.chat-dock-open-all:hover { color: var(--mst-primary); }
.chat-dock-close {
    background: none;
    border: none;
    color: var(--mst-muted);
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
    margin-left: 4px;
}
.chat-dock-close:hover { color: var(--mst-text); }

/* Pinned feedback row at the top — collapsible composer */
.chat-dock-feedback {
    border-bottom: 1px solid var(--mst-border);
    background: rgba(160,110,60,0.06);
}
[data-theme="dark"] .chat-dock-feedback { background: rgba(217,199,154,0.07); }
.chat-dock-feedback-row {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    background: none;
    border: none;
    padding: 10px 14px;
    cursor: pointer;
    text-align: left;
    color: inherit;
}
.chat-dock-feedback-row:hover { background: rgba(160,110,60,0.10); }
[data-theme="dark"] .chat-dock-feedback-row:hover { background: rgba(217,199,154,0.10); }
.chat-dock-feedback-icon { font-size: 1.4rem; flex-shrink: 0; }
.chat-dock-feedback-label {
    flex: 1; min-width: 0;
    display: flex; flex-direction: column; gap: 1px;
}
.chat-dock-feedback-title { font-weight: 600; font-size: 0.92rem; color: var(--mst-text); }
.chat-dock-feedback-sub { color: var(--mst-muted); font-size: 0.74rem; }
.chat-dock-chevron {
    color: var(--mst-muted);
    transition: transform .15s;
    font-size: 0.9rem;
}
.chat-dock-feedback-row[aria-expanded="true"] .chat-dock-chevron {
    transform: rotate(180deg);
}
.chat-dock-feedback-form {
    padding: 0 14px 12px 14px;
}
.chat-dock-feedback-form textarea {
    width: 100%;
    border-radius: 12px;
    border: 1px solid var(--mst-border);
    padding: 10px 12px;
    font-size: 0.9rem;
    line-height: 1.4;
    resize: vertical;
    min-height: 70px;
    max-height: 180px;
    background: #fff;
    color: var(--mst-text);
}
[data-theme="dark"] .chat-dock-feedback-form textarea {
    background: #2a2620;
    border-color: rgba(217,212,197,0.18);
}
.chat-dock-feedback-form textarea:focus {
    outline: none;
    border-color: var(--mst-primary);
}
.chat-dock-feedback-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 8px;
}
.chat-dock-feedback-status {
    font-size: 0.78rem;
    color: var(--mst-muted);
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.chat-dock-feedback-send {
    background: var(--mst-primary);
    color: #fff;
    border: none;
    border-radius: 18px;
    padding: 6px 16px;
    font-size: 0.84rem;
    font-weight: 600;
    cursor: pointer;
}
.chat-dock-feedback-send:hover:not(:disabled) {
    background: var(--mst-primary-2, var(--mst-secondary));
}
.chat-dock-feedback-send:disabled { opacity: 0.5; cursor: not-allowed; }

/* Conversation list inside the dock */
.chat-dock-list {
    flex: 1 1 auto;
    overflow-y: auto;
    background: #fff;
}
[data-theme="dark"] .chat-dock-list { background: #1d1b16; }
.chat-dock-loading {
    padding: 20px;
    text-align: center;
    color: var(--mst-muted);
    font-size: 0.86rem;
}
.chat-dock-empty {
    padding: 28px 18px;
    text-align: center;
    color: var(--mst-muted);
}
.chat-dock-empty-icon { font-size: 2rem; opacity: 0.6; margin-bottom: 6px; }
.chat-dock-empty-title { font-weight: 600; color: var(--mst-text); font-size: 0.95rem; margin-bottom: 2px; }
.chat-dock-empty-sub { font-size: 0.82rem; }

.chat-dock-conv {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    text-decoration: none;
    color: inherit;
    border-bottom: 1px solid var(--mst-border);
    transition: background-color .12s;
}
.chat-dock-conv:last-child { border-bottom: none; }
.chat-dock-conv:hover { background: rgba(160,110,60,0.06); color: inherit; }
[data-theme="dark"] .chat-dock-conv:hover { background: rgba(217,199,154,0.07); }
.chat-dock-avatar { flex-shrink: 0; }
.chat-dock-avatar img,
.chat-dock-avatar-fallback {
    width: 36px; height: 36px;
    border-radius: 50%;
    object-fit: cover;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--mst-light, #f5efe6);
    color: var(--mst-primary);
    font-weight: 700;
    font-size: 0.78rem;
}
.chat-dock-conv-body { flex: 1 1 auto; min-width: 0; }
.chat-dock-conv-row1 {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.chat-dock-conv-name {
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--mst-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.chat-dock-conv.is-unread .chat-dock-conv-name {
    font-weight: 800;
    color: var(--mst-primary);
}
.chat-dock-conv-time {
    color: var(--mst-muted);
    font-size: 0.7rem;
    flex-shrink: 0;
}
.chat-dock-conv-preview {
    color: var(--mst-muted);
    font-size: 0.78rem;
    margin-top: 1px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.chat-dock-conv.is-unread .chat-dock-conv-preview {
    color: var(--mst-text);
    font-weight: 600;
}
.chat-dock-conv-unread {
    background: var(--mst-primary);
    color: #fff;
    border-radius: 999px;
    padding: 1px 8px;
    font-size: 0.7rem;
    font-weight: 700;
    flex-shrink: 0;
    align-self: center;
}

.chat-dock-footer {
    padding: 10px 14px;
    border-top: 1px solid var(--mst-border);
    background: #fafaf6;
    text-align: center;
}
[data-theme="dark"] .chat-dock-footer {
    background: rgba(255,255,255,0.03);
}
.chat-dock-new {
    color: var(--mst-primary);
    font-weight: 600;
    text-decoration: none;
    font-size: 0.86rem;
}
.chat-dock-new:hover { color: var(--mst-primary-2, var(--mst-secondary)); }

/* "Look offline" toggle in the dock + Messages footer: small, muted,
   sits below the "+ New message" link. Clicking the checkbox flips
   ShowOnlineStatus on the user record and broadcasts the change via
   the presence hub so other viewers' dots update immediately. */
.chat-dock-look-offline {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 0.78rem;
    color: var(--mst-muted);
    margin-top: 6px;
    cursor: pointer;
    user-select: none;
}
.chat-dock-look-offline input[type="checkbox"] {
    width: 14px;
    height: 14px;
    margin: 0;
    cursor: pointer;
}

/* List/Thread panels live inside the same dock; only one is visible at a
   time. Both stretch to fill the dock between the header and the bottom
   edge so the inner sections (list / composer) scroll naturally. */
.chat-dock-panel {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
}
.chat-dock-panel-list { /* same baseline */ }
.chat-dock-panel-thread {
    background: #f7f5ef;
}
[data-theme="dark"] .chat-dock-panel-thread { background: #14110d; }

/* Thread-mode header — back arrow + small avatar + name + "expand to full
   page" + close. The list-mode header keeps its own simpler layout. */
.chat-dock-header-thread {
    background: linear-gradient(180deg, rgba(255,255,255,0.95), rgba(255,255,255,0.85));
    gap: 8px;
}
[data-theme="dark"] .chat-dock-header-thread {
    background: linear-gradient(180deg, rgba(34,31,23,0.95), rgba(34,31,23,0.8));
}
.chat-dock-back {
    background: var(--mst-light, #f5efe6);
    color: var(--mst-primary);
    border: none;
    width: 32px; height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
    display: flex; align-items: center; justify-content: center;
    transition: background-color .12s;
}
.chat-dock-back:hover { background: rgba(160,110,60,0.20); }
.chat-dock-thread-avatar {
    flex-shrink: 0;
}
.chat-dock-thread-avatar img,
.chat-dock-thread-avatar-fallback {
    width: 32px; height: 32px;
    border-radius: 50%;
    object-fit: cover;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--mst-light, #f5efe6);
    color: var(--mst-primary);
    font-weight: 700;
    font-size: 0.74rem;
}
.chat-dock-thread-name {
    flex: 1;
    min-width: 0;
    font-weight: 700;
    color: var(--mst-text);
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.95rem;
}
.chat-dock-thread-name:hover { color: var(--mst-primary); }
.chat-dock-thread-expand {
    color: var(--mst-muted);
    text-decoration: none;
    font-size: 1rem;
    padding: 0 4px;
}
.chat-dock-thread-expand:hover { color: var(--mst-primary); }

/* Scrolling thread inside the dock */
.chat-dock-thread {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 12px 12px 4px 12px;
    background: #f7f5ef;
    background-image: radial-gradient(circle at 1px 1px, rgba(160,110,60,0.06) 1px, transparent 1px);
    background-size: 22px 22px;
}
[data-theme="dark"] .chat-dock-thread {
    background: #14110d;
    background-image: radial-gradient(circle at 1px 1px, rgba(217,199,154,0.05) 1px, transparent 1px);
}
.chat-dock-thread-empty {
    text-align: center;
    color: var(--mst-muted);
    padding: 30px 16px;
}
.chat-dock-thread-empty > div:first-child { font-size: 1.8rem; opacity: 0.6; margin-bottom: 6px; }

.chat-dock-row {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    margin-bottom: 8px;
}
.chat-dock-row.is-continuation { margin-top: -4px; }
.chat-dock-row.is-me { justify-content: flex-end; }
.chat-dock-row.is-them { justify-content: flex-start; }

.chat-dock-row-avatar {
    width: 26px; height: 26px;
    flex-shrink: 0;
    display: flex;
    align-items: flex-end;
}
.chat-dock-row-avatar img,
.chat-dock-row-avatar-fallback,
.chat-dock-row-avatar .chat-dock-thread-avatar-fallback {
    width: 26px; height: 26px;
    border-radius: 50%;
    object-fit: cover;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--mst-light, #f5efe6);
    color: var(--mst-primary);
    font-weight: 700;
    font-size: 0.66rem;
}
.chat-dock-row-bubblegroup {
    display: flex;
    flex-direction: column;
    max-width: 78%;
    min-width: 0;
}
.chat-dock-row.is-me .chat-dock-row-bubblegroup { align-items: flex-end; }
.chat-dock-row.is-them .chat-dock-row-bubblegroup { align-items: flex-start; }
.chat-dock-bubble {
    padding: 7px 12px;
    border-radius: 16px;
    line-height: 1.4;
    font-size: 0.88rem;
    word-wrap: break-word;
    overflow-wrap: anywhere;
    box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}
.chat-dock-row.is-me .chat-dock-bubble {
    background: var(--mst-primary);
    color: #fff;
    border-radius: 16px 16px 4px 16px;
}
.chat-dock-row.is-them .chat-dock-bubble {
    background: #fff;
    color: var(--mst-text);
    border: 1px solid var(--mst-border);
    border-radius: 16px 16px 16px 4px;
}
[data-theme="dark"] .chat-dock-row.is-them .chat-dock-bubble {
    background: #2a2620;
    border-color: rgba(217,212,197,0.15);
    color: var(--mst-text);
}
.chat-dock-row.is-continuation.is-me .chat-dock-bubble { border-radius: 16px 4px 4px 16px; }
.chat-dock-row.is-continuation.is-them .chat-dock-bubble { border-radius: 4px 16px 16px 4px; }
.chat-dock-row-time {
    font-size: 0.66rem;
    color: var(--mst-muted);
    margin-top: 2px;
    padding: 0 4px;
}
.chat-dock-row.is-continuation .chat-dock-row-time { display: none; }

/* Composer at the bottom of the inline thread */
.chat-dock-composer {
    flex-shrink: 0;
    padding: 8px 10px;
    border-top: 1px solid var(--mst-border);
    background: #fff;
    display: flex;
    gap: 6px;
    align-items: flex-end;
}
[data-theme="dark"] .chat-dock-composer { background: #1d1b16; }
.chat-dock-composer textarea {
    flex: 1;
    resize: none;
    border-radius: 18px;
    padding: 8px 14px;
    min-height: 36px;
    max-height: 120px;
    overflow-y: auto;
    border: 1px solid var(--mst-border);
    background: var(--mst-light, #f5efe6);
    color: var(--mst-text);
    font-size: 0.88rem;
    line-height: 1.4;
    transition: border-color .12s, background-color .12s;
}
.chat-dock-composer textarea:focus {
    outline: none;
    border-color: var(--mst-primary);
    background: #fff;
}
[data-theme="dark"] .chat-dock-composer textarea {
    background: #2a2620;
    border-color: rgba(217,212,197,0.15);
}
[data-theme="dark"] .chat-dock-composer textarea:focus {
    background: #322d24;
}
.chat-dock-send-btn {
    width: 36px; height: 36px;
    border-radius: 50%;
    border: none;
    background: var(--mst-primary);
    color: #fff;
    font-size: 0.92rem;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    cursor: pointer;
    transition: background-color .12s, transform .12s;
}
.chat-dock-send-btn:hover:not(:disabled) {
    background: var(--mst-primary-2, var(--mst-secondary));
    transform: translateY(-1px);
}
.chat-dock-send-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.chat-dock-send-error {
    color: #b34141;
    font-size: 0.74rem;
    padding: 4px 12px 8px 12px;
    background: #fff;
}
[data-theme="dark"] .chat-dock-send-error { background: #1d1b16; }

/* Make the conversation rows in list mode look like real buttons (they
   used to be <a> tags). The list element rules expect block-level. */
.chat-dock-conv {
    width: 100%;
    background: none;
    border: none;
    text-align: left;
    cursor: pointer;
}
.chat-dock-conv:focus { outline: none; background: rgba(160,110,60,0.08); }

@media (max-width: 575px) {
    .chat-dock {
        right: 12px;
        left: 12px;
        width: auto;
        bottom: 84px;
        max-height: calc(100vh - 120px);
    }
    .chat-fab { right: 16px; bottom: 16px; width: 52px; height: 52px; }
    .chat-fab svg { width: 24px; height: 24px; }
}

/* Tips popover (navbar dropdown) */
.tips-dot {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--mst-accent);
    box-shadow: 0 0 0 2px var(--mst-primary);
}
.tips-popover {
    min-width: 320px;
    max-width: 360px;
    background: var(--mst-card);
    border: 1px solid var(--mst-border);
    border-radius: var(--mst-radius);
    box-shadow: var(--mst-shadow-lg);
    overflow: hidden;
}
.tips-popover-head {
    font-family: var(--mst-font-serif);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--mst-accent-2);
    padding: 12px 16px 8px;
    border-bottom: 1px solid var(--mst-border);
    background: linear-gradient(135deg, rgba(184,135,26,0.08), rgba(15,100,102,0.06));
}
[data-theme="dark"] .tips-popover-head { color: var(--mst-accent); }
.tips-popover-list {
    list-style: none;
    padding: 10px 14px 14px;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 60vh;
    overflow-y: auto;
}
.tips-popover-list li {
    font-size: 0.82rem;
    color: var(--mst-text);
    display: flex;
    align-items: flex-start;
    gap: 8px;
    line-height: 1.4;
}
.tips-badge {
    display: inline-block;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    padding: 2px 6px;
    border-radius: 4px;
    flex-shrink: 0;
    margin-top: 1px;
}
.tips-badge-new     { background: var(--mst-accent); color: #fff; }
.tips-badge-info    { background: rgba(15,100,102,0.14); color: var(--mst-primary); }
.tips-badge-tip     { background: var(--mst-surface-2); color: var(--mst-muted); }
.tips-badge-warning { background: #fde8e8; color: #8b2020; }
.tips-badge-prompt  { background: var(--mst-accent); color: #fff; }

/* Feed media thumbnails on home cards */
.feed-media-grid {
    display: grid;
    gap: 4px;
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 100%;
    aspect-ratio: 2 / 1;   /* height never exceeds half the width */
}
.feed-media-grid-1 { grid-template-columns: 1fr; }
.feed-media-grid-2 { grid-template-columns: 1fr 1fr; }
.feed-media-grid-3 { grid-template-columns: 2fr 1fr; grid-template-rows: 1fr 1fr; }
.feed-media-grid-3 .feed-media-thumb-btn:first-child { grid-row: span 2; }
.feed-media-grid-4 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }

.feed-media-thumb-btn {
    position: relative;
    padding: 0;
    border: none;
    background: none;
    overflow: hidden;
    border-radius: var(--mst-radius-sm);
    cursor: pointer;
    height: 100%;
    min-height: 0;
}

.feed-media-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border: 1px solid var(--mst-border);
    background: var(--mst-surface-2);
    border-radius: var(--mst-radius-sm);
    display: block;
}
.feed-media-more {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.5);
    color: #fff;
    font-size: 1.4rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--mst-radius-sm);
}

/* Lightbox */
.kron-lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.92);
    z-index: 2050;
    display: flex !important;
    align-items: center;
    justify-content: center;
}
.kron-lightbox[aria-hidden="true"] { display: none !important; }
.kron-lightbox-stage {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 18px;
    width: 100%;
    max-width: 96vw;
    padding: 0 70px;
}
.kron-lightbox-content {
    max-width: 60vw;
    max-height: 76vh;
    flex-shrink: 0;
}
.kron-lightbox-content img,
.kron-lightbox-content video {
    max-width: 60vw;
    max-height: 76vh;
    border-radius: 6px;
    display: block;
}
@media (max-width: 900px) {
    .kron-lightbox-stage { flex-direction: column; padding: 0 12px; gap: 8px; }
    .kron-lightbox-content { max-width: 92vw; }
    .kron-lightbox-content img,
    .kron-lightbox-content video { max-width: 92vw; max-height: 50vh; }
}

.kron-lightbox-bubbles {
    width: 240px;
    max-height: 70vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 4px 4px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.25) transparent;
}
.kron-lightbox-bubbles::-webkit-scrollbar { width: 4px; }
.kron-lightbox-bubbles::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.25); border-radius: 2px; }
@media (max-width: 900px) { .kron-lightbox-bubbles { width: 100%; max-height: 22vh; flex-direction: row; overflow-x: auto; } }

.kron-bubble {
    background: rgba(255,255,255,0.96);
    color: var(--mst-text);
    border-radius: 14px;
    padding: 8px 10px;
    box-shadow: 0 6px 18px rgba(0,0,0,0.35);
    display: flex;
    gap: 8px;
    align-items: flex-start;
    font-size: 0.78rem;
    line-height: 1.35;
    position: relative;
    flex-shrink: 0;
}
.kron-bubble.right  { border-bottom-right-radius: 4px; }
.kron-bubble.left   { border-bottom-left-radius: 4px; }
.kron-bubble-avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--mst-primary);
    color: #fff;
    font-weight: 700;
    font-size: 11px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.kron-bubble-avatar img { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; }
.kron-bubble-body { flex: 1; min-width: 0; }
.kron-bubble-author { font-weight: 600; font-size: 0.74rem; color: var(--mst-primary); }
.kron-bubble-time   { font-size: 0.66rem; color: var(--mst-muted); margin-left: 4px; }
.kron-bubble-delete {
    background: #dc3545;
    border: none;
    color: #fff;
    width: 16px; height: 16px;
    border-radius: 50%;
    font-size: 0.65rem;
    font-weight: 700;
    line-height: 1;
    padding: 0;
    margin-left: auto;
    cursor: pointer;
    flex: 0 0 auto;
    transition: background .12s ease, transform .12s ease;
}
.kron-bubble-delete:hover { background: #c82333; transform: scale(1.18); }

.kron-lightbox-footer {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    width: min(560px, 90vw);
}
.kron-lightbox-comment-form {
    display: flex;
    gap: 6px;
    width: 100%;
    background: rgba(0,0,0,0.5);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 999px;
    padding: 4px 6px 4px 14px;
}
.kron-lightbox-comment-form input {
    flex: 1;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 0.85rem;
    outline: none;
}
.kron-lightbox-comment-form input::placeholder { color: rgba(255,255,255,0.6); }
.kron-lightbox-comment-form button {
    background: var(--mst-accent);
    color: var(--mst-ink);
    border: none;
    border-radius: 999px;
    padding: 4px 14px;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
}
.kron-lightbox-comment-form button:hover { background: var(--mst-accent-2); color: #fff; }
.kron-lightbox-close {
    position: absolute;
    top: 18px;
    right: 22px;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 2.4rem;
    line-height: 1;
    cursor: pointer;
    opacity: 0.8;
}
.kron-lightbox-close:hover { opacity: 1; }
.kron-lightbox-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.22);
    color: #fff;
    font-size: 1.8rem;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    cursor: pointer;
    transition: background .12s ease;
}
.kron-lightbox-arrow:hover { background: rgba(255,255,255,0.22); }
.kron-lightbox-arrow.left  { left: 18px; }
.kron-lightbox-arrow.right { right: 18px; }
.kron-lightbox-counter {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255,255,255,0.8);
    font-size: 0.82rem;
    background: rgba(0,0,0,0.4);
    padding: 4px 10px;
    border-radius: 999px;
}

/* Sticky left sidebar so the feed scrolls beside it. When the rail is
   taller than the viewport, we let it scroll INTERNALLY — pinned to
   the top of the page, with its own thin scrollbar — so the bottom
   items (Coming Soon, On-This-Day) stay reachable while the main feed
   scrolls separately. Replaces the older approach of stripping the
   sticky class entirely on tall rails (the user wanted the rail to
   keep floating with them). */
@media (min-width: 768px) {
    .col-sidebar.sticky-rail {
        position: sticky;
        top: 88px;
        align-self: flex-start;
        max-height: calc(100vh - 100px);
        overflow-y: auto;
        /* Discreet scrollbar — visible on hover, ghosted otherwise. */
        scrollbar-width: thin;
        scrollbar-color: rgba(160,110,60,0.30) transparent;
        padding-right: 4px;
    }
    .col-sidebar.sticky-rail::-webkit-scrollbar {
        width: 6px;
    }
    .col-sidebar.sticky-rail::-webkit-scrollbar-thumb {
        background: rgba(160,110,60,0.18);
        border-radius: 3px;
    }
    .col-sidebar.sticky-rail:hover::-webkit-scrollbar-thumb {
        background: rgba(160,110,60,0.40);
    }
}

/* On This Day — sepia memoir card with a calendar icon. Shows the user's
   own past posts whose event date matches today's calendar day. */
.on-this-day-card {
    background: linear-gradient(180deg, rgba(160,110,60,0.10), rgba(160,110,60,0.03));
    border: 1px solid rgba(160,110,60,0.30);
    border-left: 3px solid #a06e3c;
    border-radius: var(--mst-radius);
    padding: 14px 16px;
    margin-bottom: 16px;
}
[data-theme="dark"] .on-this-day-card {
    background: linear-gradient(180deg, rgba(190,140,80,0.14), rgba(190,140,80,0.03));
}
.on-this-day-head {
    display: flex; align-items: center; gap: 8px;
    margin-bottom: 8px;
}
.on-this-day-icon { font-size: 1rem; }
.on-this-day-title {
    font-family: 'Georgia', serif;
    font-weight: 700;
    color: #6d4720;
    font-size: 0.95rem;
}
[data-theme="dark"] .on-this-day-title { color: #d6a878; }
.on-this-day-row {
    display: block;
    padding: 6px 0;
    border-top: 1px dashed rgba(160,110,60,0.20);
    text-decoration: none;
    color: var(--mst-text);
    transition: color 0.15s;
}
.on-this-day-row:first-of-type { border-top: none; padding-top: 0; }
.on-this-day-row:hover { color: var(--mst-primary); }
.on-this-day-when {
    display: inline-block;
    background: rgba(160,110,60,0.18);
    color: #6d4720;
    border-radius: 999px;
    padding: 1px 9px;
    font-size: 0.70rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-right: 8px;
    vertical-align: middle;
}
[data-theme="dark"] .on-this-day-when { color: #d6a878; background: rgba(190,140,80,0.18); }
.on-this-day-text {
    font-family: 'Georgia', serif;
    font-style: italic;
    font-size: 0.92rem;
}

/* Timeline zoom tabs */
.zoom-tabs {
    display: inline-flex;
    background: var(--mst-surface-2);
    border-radius: 10px;
    padding: 3px;
    gap: 2px;
}
.zoom-tabs a {
    padding: 4px 14px;
    font-size: 0.82rem;
    color: var(--mst-muted);
    border-radius: 8px;
    font-weight: 500;
}
.zoom-tabs a.active {
    background: var(--mst-card);
    color: var(--mst-ink);
    box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}

/* Unified timeline tabs — both sort (Recent/Chronological) and zoom
   (Decade/Year/Month) live in one underline-tab row to match. */
.timeline-tabs {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    border-bottom: 1px solid var(--mst-border);
    flex-wrap: wrap;
}
.timeline-tab {
    padding: 6px 12px;
    color: var(--mst-muted);
    font-size: 0.82rem;
    font-weight: 600;
    text-decoration: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: color 0.15s, border-color 0.15s;
}
.timeline-tab:hover { color: var(--mst-primary); }
.timeline-tab.active {
    color: var(--mst-primary);
    border-bottom-color: var(--mst-primary);
}
.timeline-tabs-sep {
    width: 1px;
    height: 14px;
    background: var(--mst-border);
    margin: 0 6px;
    align-self: center;
}
.quick-story-card .quick-story-textarea,
.quick-story-card .tag-search-input,
.quick-story-card .quick-story-textarea::placeholder,
.quick-story-card .tag-search-input::placeholder {
    font-family: var(--mst-font-sans);
    font-size: 0.82rem;
    line-height: 1.4;
}
.btn-quick-media {
    background: rgba(15,100,102,0.08);
    border: 1.5px solid var(--mst-primary);
    color: var(--mst-primary);
    border-radius: var(--mst-radius-sm);
    padding: 5px 9px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.8rem;
    box-shadow: 0 1px 3px rgba(15,100,102,0.12);
    transition: color .12s ease, border-color .12s ease, background .12s ease, transform .1s ease, box-shadow .12s ease;
    position: relative;
}
.btn-quick-media:hover {
    color: #fff;
    background: var(--mst-primary);
    border-color: var(--mst-primary);
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(15,100,102,0.3);
}
.btn-quick-media.quick-music-btn {
    background: rgba(234,179,8,0.12);
    border-color: var(--mst-accent);
    color: var(--mst-accent-2);
    box-shadow: 0 1px 3px rgba(234,179,8,0.15);
}
.btn-quick-media.quick-music-btn:hover {
    background: var(--mst-accent);
    border-color: var(--mst-accent);
    color: var(--mst-ink);
    box-shadow: 0 4px 10px rgba(234,179,8,0.35);
}
.btn-quick-media svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.btn-quick-media .media-count-badge,
.btn-quick-media .music-set-badge {
    display: inline-block;
    background: var(--mst-primary);
    color: #fff;
    font-size: 0.62rem;
    font-weight: 700;
    border-radius: 999px;
    padding: 1px 6px;
    margin-left: 2px;
}
.btn-quick-media .music-set-badge { background: var(--mst-accent); color: var(--mst-ink); }

/* Memory Music chip under the textarea once a URL is set */
.quick-music-chip {
    margin-top: 6px;
    background: rgba(184,135,26,0.08);
    border: 1px solid rgba(184,135,26,0.4);
    border-radius: 999px;
    padding: 4px 12px;
    font-size: 0.78rem;
    color: var(--mst-text);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.quick-music-chip a { color: var(--mst-accent-2); }

/* Quick Story upload progress */
.quick-upload-status {
    margin-top: 8px;
    padding: 10px 12px;
    background: var(--mst-surface-2);
    border: 1px solid var(--mst-border);
    border-radius: var(--mst-radius-sm);
    font-size: 0.82rem;
    color: var(--mst-text);
}
.quick-upload-status .qup-label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
    font-weight: 500;
}
.quick-upload-status .qup-bar {
    height: 6px;
    background: var(--mst-card);
    border-radius: 999px;
    overflow: hidden;
    border: 1px solid var(--mst-border);
}
.quick-upload-status .qup-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--mst-primary) 0%, var(--mst-primary-3) 100%);
    width: 0%;
    transition: width 0.18s ease;
}
.quick-upload-status.qup-success {
    background: rgba(34,197,94,0.10);
    border-color: rgba(34,197,94,0.45);
    color: var(--mst-text);
    font-weight: 600;
}
.quick-upload-status.qup-error {
    background: rgba(239,68,68,0.10);
    border-color: rgba(239,68,68,0.45);
    color: #b91c1c;
}

/* Memory Music chip on rendered posts */
.post-music-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(184,135,26,0.1);
    border: 1px solid rgba(184,135,26,0.5);
    color: var(--mst-accent-2);
    border-radius: 999px;
    padding: 3px 12px;
    font-size: 0.78rem;
    text-decoration: none;
    transition: background-color .12s ease;
}
.post-music-chip:hover { background: rgba(184,135,26,0.18); color: var(--mst-accent-2); }
[data-theme="dark"] .post-music-chip { color: var(--mst-accent); }

/* ============================================
   Working Index — table layout
   ============================================ */
.working-table-wrap {
    background: var(--mst-card);
    border: 1px solid var(--mst-border);
    border-radius: var(--mst-radius);
    box-shadow: var(--mst-shadow-sm);
    overflow: auto;
    max-height: 75vh;
}
/* Grid-based row so columns share the available width and the table
   never side-scrolls. Year column is fixed-narrow; the six fields each
   take 1fr. Mood is no longer a column — clicking the year pill opens
   a popover with the 5 options. */
.working-table {
    width: 100%;
    display: block;
}
.wt-row {
    display: grid;
    grid-template-columns: 56px repeat(6, minmax(0, 1fr));
    border-bottom: 1px solid var(--mst-border);
    align-items: stretch;
}
.wt-row > div {
    padding: 5px 6px;
    display: flex;
    align-items: center;
    min-width: 0;
}
.wt-row.wt-head > div {
    background: var(--mst-surface-2);
    font-size: 0.62rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--mst-muted);
    font-weight: 700;
    padding: 6px;
    border-bottom: 2px solid var(--mst-border);
    line-height: 1.15;
}
.wt-row:not(.wt-head):hover > div { background: rgba(15,100,102,0.03); }

.wt-year-col {
    text-align: center;
    background: var(--mst-card);
    border-right: 1px solid var(--mst-border);
    justify-content: center;
}
.wt-year-pill {
    display: inline-block;
    font-family: var(--mst-font-serif);
    font-weight: 700;
    font-size: 0.82rem;
    color: #fff;
    background: var(--mst-primary);
    border-radius: 6px;
    padding: 2px 8px;
    line-height: 1.1;
    cursor: pointer;
    border: none;
    transition: background-color .2s ease, transform .1s;
}
.wt-year-pill:hover { transform: scale(1.05); }
.wt-year-pill.mood-great   { background: #16a34a; }
.wt-year-pill.mood-good    { background: #65a30d; }
.wt-year-pill.mood-neutral { background: #6b7280; }
.wt-year-pill.mood-tough   { background: #d97706; }
.wt-year-pill.mood-heavy   { background: #b91c1c; }

.wt-cell-col { min-width: 0; }

.wt-cell { transition: background-color .14s ease; }
.wt-cell:focus-within { background: rgba(15,100,102,0.06); }
.wt-cell.cell-saved { background: rgba(34,197,94,0.14); }

/* Mood popover — anchored to the year pill on click. Compact column
   of 5 swatch buttons with labels so the colors finally have space
   to breathe and read clearly. */
.wt-mood-popover {
    position: fixed;
    z-index: 1080;
    background: #fff;
    border: 1px solid var(--mst-border);
    border-radius: 12px;
    box-shadow: 0 12px 28px rgba(0,0,0,0.18);
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 140px;
}
[data-theme="dark"] .wt-mood-popover {
    background: #1d1b16;
    border-color: rgba(217,212,197,0.18);
    color: var(--mst-text);
}
.wt-mood-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 10px;
    border: none;
    background: none;
    border-radius: 8px;
    cursor: pointer;
    text-align: left;
    color: var(--mst-text);
    font-size: 0.88rem;
    font-weight: 500;
    transition: background-color .1s;
}
.wt-mood-option:hover {
    background: rgba(160,110,60,0.08);
}
.wt-mood-option.is-active {
    background: rgba(15,100,102,0.10);
    font-weight: 700;
}
.wt-mood-swatch {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    flex-shrink: 0;
}

/* Soft column tints for visual scanning */
.wt-row:not(.wt-head) .wt-cell-col[data-field="MainEvent"]    { background: rgba(184,135,26,0.04); }
.wt-row:not(.wt-head) .wt-cell-col[data-field="Residence"]    { background: rgba(29,78,216,0.04); }
.wt-row:not(.wt-head) .wt-cell-col[data-field="SchoolJob"]    { background: rgba(15,100,102,0.04); }
.wt-row:not(.wt-head) .wt-cell-col[data-field="Relationship"] { background: rgba(236,72,153,0.04); }
.wt-row:not(.wt-head) .wt-cell-col[data-field="Vacation"]     { background: rgba(245,158,11,0.04); }
.wt-row:not(.wt-head) .wt-cell-col[data-field="Other"]        { background: rgba(107,114,128,0.04); }

.wt-cell-value {
    outline: none;
    font-size: 0.78rem;
    color: var(--mst-text);
    line-height: 1.3;
    min-height: 1.2em;
    cursor: text;
    width: 100%;
    word-wrap: break-word;
    overflow-wrap: anywhere;
}
.wt-cell-value:empty::before {
    content: "";
    color: var(--mst-muted);
    opacity: 0.45;
    font-style: italic;
}
.wt-cell:focus-within .wt-cell-value:empty::before { content: ""; }

.wt-emoji { font-size: 0.85rem; margin-right: 2px; }

/* ============================================
   Working Index (private life grid)
   ============================================ */
.working-hero {
    background: linear-gradient(135deg, rgba(15,100,102,0.08), rgba(184,135,26,0.08));
    border: 1px solid var(--mst-border);
    border-left: 4px solid var(--mst-accent);
    border-radius: var(--mst-radius);
    padding: 18px 20px;
}

/* ── Overview band: density + mood arc ─────────────────────────────
   Sits above the table so the user reads "your life at a glance"
   before scrolling through the decades. */
.working-overview {
    background: var(--mst-card);
    border: 1px solid var(--mst-border);
    border-radius: 14px;
    padding: 14px 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
[data-theme="dark"] .working-overview { background: rgba(255,255,255,0.04); }
.working-overview-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.working-overview-pct {
    font-weight: 700;
    color: var(--mst-primary);
    margin-left: 4px;
}
.working-progress {
    flex: 1;
    min-width: 120px;
    height: 8px;
    border-radius: 999px;
    background: rgba(0,0,0,0.06);
    overflow: hidden;
}
[data-theme="dark"] .working-progress { background: rgba(255,255,255,0.08); }
.working-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--mst-primary), var(--mst-accent));
    transition: width .3s ease;
}
.working-mood-arc {
    display: flex;
    flex-wrap: nowrap;
    gap: 3px;
    overflow-x: auto;
    padding: 6px 0;
}
.working-arc-dot {
    flex-shrink: 0;
    width: 14px;
    height: 14px;
    border-radius: 4px;
    cursor: pointer;
    transition: transform .12s, box-shadow .12s;
}
.working-arc-dot:hover {
    transform: scale(1.4);
    box-shadow: 0 0 0 2px rgba(0,0,0,0.1);
}
.working-arc-legend {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    font-size: 0.78rem;
    color: var(--mst-muted);
}
.working-legend-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 3px;
    margin-right: 4px;
    vertical-align: -1px;
}

/* ── Decade collapsibles ───────────────────────────────────────────
   Each decade is a <details> so default semantics handle keyboard +
   accessibility. Summary doubles as a clickable header strip with a
   density chip, a mini mood arc, and a chevron. */
.wt-decade {
    background: var(--mst-card);
    border: 1px solid var(--mst-border);
    border-radius: 14px;
    margin-bottom: 12px;
    /* No overflow:hidden here — it would clip the Other + Mood columns
       on the right when the table is wider than the card. The rounded
       corners still read fine without it. */
}
[data-theme="dark"] .wt-decade { background: rgba(255,255,255,0.03); }
.wt-decade[open] { box-shadow: 0 4px 14px rgba(0,0,0,0.04); }
.wt-decade-current { border-color: var(--mst-primary); }
.wt-decade-head {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 18px;
    cursor: pointer;
    list-style: none;
    user-select: none;
    background: linear-gradient(180deg, rgba(255,255,255,0.6), rgba(255,255,255,0));
}
.wt-decade-head::-webkit-details-marker { display: none; }
[data-theme="dark"] .wt-decade-head { background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0)); }
.wt-decade-current .wt-decade-head { background: linear-gradient(180deg, rgba(15,100,102,0.10), rgba(15,100,102,0)); }
.wt-decade-label {
    font-family: 'Fraunces', 'Cormorant Garamond', Georgia, serif;
    font-weight: 700;
    font-size: 1.4rem;
    color: var(--mst-primary);
    line-height: 1;
}
.wt-decade-suffix {
    font-size: 0.7em;
    opacity: 0.7;
    margin-left: 1px;
}
.wt-decade-density {
    font-size: 0.82rem;
    color: var(--mst-muted);
    background: rgba(0,0,0,0.04);
    padding: 3px 10px;
    border-radius: 999px;
    font-weight: 600;
}
[data-theme="dark"] .wt-decade-density { background: rgba(255,255,255,0.06); }
.wt-decade-arc {
    display: inline-flex;
    gap: 3px;
    flex: 1;
}
.wt-decade-arc-dot {
    width: 12px;
    height: 12px;
    border-radius: 3px;
}
.wt-decade-chevron {
    color: var(--mst-muted);
    font-size: 0.95rem;
    transition: transform .15s;
}
.wt-decade[open] .wt-decade-chevron { transform: rotate(180deg); }
.wt-decade > .working-table {
    margin: 0 0 12px 0;
    padding: 0 8px;
    /* Grid layout fits the available width — no horizontal scroll. */
}

/* "Write about it" chip — tiny call-to-action that appears on a
   filled cell on hover/focus. Click takes the user to Posts/Create
   with the year + cell text pre-filled. */
.wt-cell { position: relative; }
.wt-write-chip {
    position: absolute;
    bottom: 4px;
    right: 4px;
    background: var(--mst-primary);
    color: #fff;
    border: none;
    border-radius: 999px;
    padding: 2px 8px;
    font-size: 0.7rem;
    font-weight: 600;
    cursor: pointer;
    opacity: 0;
    transform: translateY(2px);
    transition: opacity .12s, transform .12s, background-color .12s;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    z-index: 5;
}
.wt-cell:hover .wt-write-chip:not([hidden]),
.wt-cell:focus-within .wt-write-chip:not([hidden]) {
    opacity: 1;
    transform: translateY(0);
}
.wt-write-chip:hover {
    background: var(--mst-primary-2, var(--mst-secondary));
}

/* Multi-item picker: shown when the user clicks "Write about it" on
   a cell that contains multiple comma/and-separated items. */
.wt-write-picker {
    position: fixed;
    inset: 0;
    z-index: 1060;
    background: rgba(0,0,0,0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.wt-write-picker-inner {
    position: relative;
    background: #fff;
    border-radius: 14px;
    padding: 22px 22px 18px 22px;
    max-width: 420px;
    width: 100%;
    box-shadow: 0 16px 40px rgba(0,0,0,0.25);
}
[data-theme="dark"] .wt-write-picker-inner { background: #1d1b16; color: var(--mst-text); }
.wt-write-picker-close {
    position: absolute;
    top: 8px; right: 12px;
    background: none;
    border: none;
    font-size: 1.6rem;
    line-height: 1;
    color: var(--mst-muted);
    cursor: pointer;
}
.wt-write-picker-title {
    font-weight: 700;
    color: var(--mst-primary);
    margin-bottom: 12px;
}
.wt-write-picker-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.wt-write-picker-option {
    background: rgba(160,110,60,0.08);
    border: 1px solid rgba(160,110,60,0.30);
    border-radius: 10px;
    padding: 10px 14px;
    text-align: left;
    color: var(--mst-text);
    cursor: pointer;
    font-size: 0.95rem;
    transition: background-color .12s, border-color .12s;
}
.wt-write-picker-option:hover {
    background: rgba(160,110,60,0.18);
    border-color: var(--mst-primary);
}

/* Briefly flash a row when the user clicks a mood-arc dot to jump to
   that year — orientation cue. */
.wt-row-flash {
    animation: wtRowFlash 1.1s ease-out;
}
@keyframes wtRowFlash {
    0%   { background: rgba(15,100,102,0.18); }
    100% { background: transparent; }
}
.working-hero h2 {
    font-family: var(--mst-font-serif);
    color: var(--mst-primary);
    font-weight: 700;
    margin: 0;
    font-size: 1.6rem;
}
.working-toolbar { font-size: 0.85rem; }

.working-empty {
    text-align: center;
    padding: 50px 20px;
    background: var(--mst-card);
    border: 2px dashed var(--mst-border);
    border-radius: var(--mst-radius);
}
.working-empty-icon { font-size: 3rem; margin-bottom: 8px; }
.working-empty h5 { font-family: var(--mst-font-serif); }

.working-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.working-row {
    background: var(--mst-card);
    border: 1px solid var(--mst-border);
    border-radius: var(--mst-radius);
    padding: 14px 16px 12px;
    box-shadow: var(--mst-shadow-sm);
    position: relative;
    transition: box-shadow .14s ease;
}
.working-row:hover { box-shadow: var(--mst-shadow); }

.working-row-head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}
.working-year-pill {
    font-family: var(--mst-font-serif);
    font-weight: 700;
    font-size: 1.5rem;
    color: #fff;
    background: var(--mst-primary);
    border-radius: 12px;
    padding: 4px 14px;
    line-height: 1.1;
    min-width: 90px;
    text-align: center;
    transition: background-color .2s ease;
}
.working-year-pill.mood-great   { background: #16a34a; }
.working-year-pill.mood-good    { background: #65a30d; }
.working-year-pill.mood-neutral { background: #6b7280; }
.working-year-pill.mood-tough   { background: #d97706; }
.working-year-pill.mood-heavy   { background: #b91c1c; }

.working-mood-picker { display: inline-flex; gap: 4px; }
.mood-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    padding: 0;
    transition: transform .12s ease, border-color .12s ease;
    opacity: 0.55;
}
.mood-dot:hover { transform: scale(1.18); opacity: 1; }
.mood-dot.active { opacity: 1; border-color: var(--mst-card); box-shadow: 0 0 0 2px rgba(0,0,0,0.12); }

.working-delete {
    background: transparent;
    border: none;
    color: var(--mst-muted);
    font-size: 1.4rem;
    line-height: 1;
    padding: 0 6px;
    cursor: pointer;
    border-radius: 8px;
}
.working-delete:hover { color: #b91c1c; background: rgba(239,68,68,0.08); }

.working-cells {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 8px;
}
.working-cell {
    background: var(--mst-surface-2);
    border: 1px solid transparent;
    border-radius: var(--mst-radius-sm);
    padding: 8px 10px 6px;
    transition: border-color .12s ease, background-color .14s ease;
    min-height: 64px;
    display: flex;
    flex-direction: column;
}
.working-cell:focus-within { border-color: var(--mst-primary); background: var(--mst-card); }
.working-cell.cell-saved { background: rgba(34,197,94,0.12); }

/* Distinct soft tints per column type */
.working-cell[data-field="MainEvent"]    { background: linear-gradient(135deg, rgba(184,135,26,0.10), rgba(184,135,26,0.04)); }
.working-cell[data-field="Residence"]    { background: linear-gradient(135deg, rgba(29,78,216,0.10), rgba(29,78,216,0.04)); }
.working-cell[data-field="SchoolJob"]    { background: linear-gradient(135deg, rgba(15,100,102,0.10), rgba(15,100,102,0.04)); }
.working-cell[data-field="Relationship"] { background: linear-gradient(135deg, rgba(236,72,153,0.10), rgba(236,72,153,0.04)); }
.working-cell[data-field="Family"]       { background: linear-gradient(135deg, rgba(34,197,94,0.10), rgba(34,197,94,0.04)); }
.working-cell[data-field="Vacation"]     { background: linear-gradient(135deg, rgba(245,158,11,0.10), rgba(245,158,11,0.04)); }
.working-cell[data-field="Other"]        { background: linear-gradient(135deg, rgba(107,114,128,0.10), rgba(107,114,128,0.04)); }

.working-cell-label {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--mst-muted);
    font-weight: 600;
    margin-bottom: 2px;
}
.working-cell-emoji { font-size: 0.85rem; margin-right: 2px; }
.working-cell-value {
    font-size: 0.88rem;
    color: var(--mst-text);
    outline: none;
    line-height: 1.35;
    flex: 1;
    cursor: text;
    min-height: 1.2em;
}
.working-cell-value:empty::before {
    content: attr(data-placeholder);
    color: var(--mst-muted);
    opacity: 0.5;
    font-style: italic;
}

.working-notes summary {
    cursor: pointer;
    font-size: 0.75rem;
    color: var(--mst-muted);
    padding: 4px 0;
    list-style: none;
}
.working-notes summary::before { content: "▸ "; transition: transform .15s ease; display: inline-block; }
.working-notes[open] summary::before { content: "▾ "; }
.working-notes-value {
    background: var(--mst-surface-2);
    padding: 8px 12px;
    border-radius: var(--mst-radius-sm);
    margin-top: 4px;
    min-height: 60px;
}
.quick-media-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}
.quick-media-preview .thumb {
    width: 64px;
    height: 64px;
    border-radius: 8px;
    border: 1px solid var(--mst-border);
    object-fit: cover;
    background: var(--mst-surface-2);
}
.quick-media-preview .thumb-video {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    color: var(--mst-muted);
    padding: 4px;
    text-align: center;
    word-break: break-word;
}
.quick-story-textarea {
    min-height: 2.4em;
    overflow: hidden;
    resize: none;
}
.btn-quick-story {
    background: var(--mst-primary);
    color: #fff !important;
    border: 1px solid var(--mst-primary);
    font-weight: 600;
    letter-spacing: -0.005em;
    border-radius: var(--mst-radius-sm);
}
.btn-quick-story:hover {
    background: var(--mst-primary-2);
    border-color: var(--mst-primary-2);
    color: #fff;
}

/* Comments: off-white rounded bubbles, slightly indented */
.comment-row {
    margin-left: 1.2rem;
    background: var(--mst-surface-2);
    border: 1px solid var(--mst-border);
    border-radius: var(--mst-radius);
    padding: 12px 16px !important;
    margin-top: 12px !important;
}

/* Threaded comment reply: lighter fill + thin connector */
.comment-reply {
    margin-left: 1.8rem;
    padding: 10px 14px;
    background: var(--mst-card);
    border: 1px solid var(--mst-border);
    border-radius: var(--mst-radius-sm);
    position: relative;
    margin-top: 10px;
}
.comment-reply::before {
    content: "";
    position: absolute;
    top: 18px;
    left: -0.9rem;
    width: 0.75rem;
    height: 1px;
    background: var(--mst-border);
}

/* Global search popover (small bubble — positioned by JS) */
.nav-search-popover {
    position: fixed;
    top: 64px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2050;
    background: var(--mst-card);
    border: 1px solid var(--mst-border);
    border-radius: var(--mst-radius);
    box-shadow: var(--mst-shadow-lg);
    padding: 10px;
    width: min(380px, 92vw);
}
.nav-search-popover::before {
    content: "";
    position: absolute;
    top: -8px;
    left: var(--caret-left, 50%);
    transform: translateX(-50%) rotate(45deg);
    width: 14px;
    height: 14px;
    background: var(--mst-card);
    border-left: 1px solid var(--mst-border);
    border-top: 1px solid var(--mst-border);
}
.nav-search-input-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
    border: 1px solid var(--mst-border);
    border-radius: var(--mst-radius-sm);
    padding: 4px 8px;
    background: var(--mst-surface-2);
    position: relative;
    z-index: 1;
}
.nav-search-input-wrap svg { color: var(--mst-muted); flex-shrink: 0; }
.nav-search-input-wrap input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    font-size: 0.9rem;
    color: var(--mst-text);
    padding: 4px 0;
}
.nav-search-input-wrap input::placeholder { color: var(--mst-muted); }
.nav-search-clear {
    background: transparent;
    border: none;
    color: var(--mst-muted);
    font-size: 1.2rem;
    line-height: 1;
    padding: 0 4px;
    cursor: pointer;
}
.nav-search-clear:hover { color: var(--mst-ink); }

/* Inline search results card injected into the main column */
.search-results-card {
    background: var(--mst-card);
    border: 1px solid var(--mst-border);
    border-left: 4px solid var(--mst-primary);
    border-radius: var(--mst-radius);
    box-shadow: var(--mst-shadow-sm);
    padding: 14px 16px;
    margin-bottom: 16px;
}
.search-results-card .src-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}
.search-results-card .src-head h6 {
    font-family: var(--mst-font-serif);
    color: var(--mst-primary);
    margin: 0;
    font-weight: 700;
}
.search-results-card .src-close {
    background: transparent;
    border: none;
    color: var(--mst-muted);
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 6px;
}
.search-results-card .src-close:hover { color: var(--mst-ink); background: var(--mst-surface-2); }
.nav-search-section { margin-top: 10px; }
.nav-search-section:first-child { margin-top: 0; }
.nav-search-section-head {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--mst-accent-2);
    font-weight: 700;
    margin-bottom: 4px;
    padding: 0 4px;
}
.nav-search-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--mst-radius-sm);
    color: var(--mst-text);
    text-decoration: none;
    font-size: 0.88rem;
    transition: background-color .12s ease;
}
.nav-search-row:hover { background: var(--mst-surface-2); color: var(--mst-text); }
.nav-search-row .nsr-avatar {
    width: 28px; height: 28px; border-radius: 50%;
    background: var(--mst-light); color: var(--mst-primary);
    font-weight: 700; font-size: 11px;
    display: inline-flex; align-items: center; justify-content: center;
    flex-shrink: 0; overflow: hidden;
}
.nav-search-row .nsr-avatar img { width: 28px; height: 28px; object-fit: cover; }
.nav-search-row .nsr-body { flex: 1; min-width: 0; }
.nav-search-row .nsr-title { font-weight: 600; }
.nav-search-row .nsr-meta { font-size: 0.74rem; color: var(--mst-muted); }
.nav-search-row .nsr-feature-icon {
    width: 28px; height: 28px;
    border-radius: 8px;
    background: rgba(15,100,102,0.1);
    color: var(--mst-primary);
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 0.95rem;
}
.nav-search-empty {
    text-align: center;
    color: var(--mst-muted);
    padding: 24px 12px;
    font-size: 0.88rem;
}

/* Profile field visibility selector */
.field-vis-btn {
    color: var(--mst-muted);
    text-decoration: none;
    font-size: 0.7rem;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.field-vis-btn:hover { color: var(--mst-primary); }
.field-vis-btn svg { width: 12px; height: 12px; stroke: currentColor; fill: none; stroke-width: 1.8; }
.field-vis-dropdown .dropdown-menu .field-vis-opt { display: flex; align-items: center; gap: 8px; font-size: 0.85rem; }
.field-vis-dropdown .dropdown-menu .field-vis-opt svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 1.8; }
.profile-field { position: relative; }
/* Visibility dropdown lives inside a profile field card. Without help it
   gets painted under the next-row sibling cards (no stacking context on
   .profile-field). Force the open menu above siblings, and combined with
   data-bs-strategy="fixed" on the toggle the menu escapes the card. */
.field-vis-dropdown .dropdown-menu { z-index: 2100; }
.profile-field:has(.dropdown.show) { z-index: 50; }

/* ─── Modernized profile page ──────────────────────────────────────────
   Hero band → stats strip → tabs (About / Stories / Badges / Dashboard).
   Replaces the old shell+overlay+grid layout. */

.profile-hero {
    border-radius: var(--mst-radius);
    background: var(--mst-card);
    border: 1px solid var(--mst-border);
    box-shadow: var(--mst-shadow);
    /* NOTE: no overflow:hidden here. It used to clip the cover gradient
       to the rounded corners, but it ALSO clipped the "Add … as" /
       "More" dropdowns rendered inside the hero body, so they vanished
       under the next card. The clipping now lives on the cover element
       (which is the only thing that needs corner-rounding); the hero
       can let its dropdowns overflow freely. */
}
.profile-hero-cover {
    height: 180px;
    background: linear-gradient(135deg, var(--mst-primary) 0%, var(--mst-primary-2, var(--mst-secondary)) 100%);
    background-size: cover;
    background-position: center;
    overflow: hidden;
    border-top-left-radius: var(--mst-radius);
    border-top-right-radius: var(--mst-radius);
}
.profile-hero.no-bg .profile-hero-cover { height: 100px; }
/* Body sits BELOW the cover; only the avatar overlaps. This keeps the
   name and meta from being painted over the cover image (which made them
   unreadable when a photo background was set). */
.profile-hero-body {
    display: flex;
    align-items: flex-start;
    gap: 18px;
    padding: 12px 1.25rem 1.1rem 1.25rem;
    flex-wrap: wrap;
}
.profile-hero-avatar {
    border-radius: 50%;
    background: var(--mst-card);
    padding: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    line-height: 0;
    flex: 0 0 auto;
    margin-top: -68px; /* only the avatar overlaps the cover */
}
.profile-hero-avatar img {
    width: 120px !important;
    height: 120px !important;
    border-radius: 50%;
    object-fit: cover;
}
.profile-hero-identity {
    flex: 1 1 auto;
    min-width: 0;
    padding-top: 4px;
}
.profile-hero-name {
    font-size: 1.65rem;
    font-weight: 700;
    color: var(--mst-text);
    line-height: 1.15;
    word-break: break-word;
}
.profile-hero-handle { color: var(--mst-muted); font-size: 0.9rem; }
.profile-hero-meta { margin-top: 6px; display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.profile-hero-meta-item { color: var(--mst-muted); font-size: 0.88rem; }
.profile-hero-meta-flags { display: inline-flex; gap: 4px; align-items: center; }
.profile-hero-meta-flags img { border-radius: 2px; box-shadow: 0 0 0 1px rgba(0,0,0,0.1); }
.profile-hero-actions {
    display: flex;
    gap: 6px;
    align-items: center;
    padding-bottom: 6px;
    flex-wrap: wrap;
}
.profile-hero-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px; height: 38px;
    border-radius: 10px;
    background: rgba(0,0,0,0.04);
    color: var(--mst-primary);
    border: 1px solid var(--mst-border);
    text-decoration: none;
    transition: background 0.15s, transform 0.15s, color 0.15s;
    padding: 0;
}
.profile-hero-btn:hover {
    background: var(--mst-primary);
    color: #fff;
    transform: translateY(-1px);
}
.profile-hero-btn-danger { color: #dc3545; }
.profile-hero-btn-danger:hover { background: #dc3545; color: #fff; }
[data-theme="dark"] .profile-hero-btn { background: rgba(255,255,255,0.06); }
.profile-hero-more-menu .dropdown-item { font-size: 0.88rem; padding: 6px 14px; }
.profile-hero-more-menu .dropdown-item:hover { color: #dc3545 !important; background: rgba(220,53,69,0.06); }
/* Keep the hero's "Add … as" / "More" dropdowns above the cards that
   follow the hero on the profile page (member-since, timeline, etc.). */
.profile-hero .dropdown-menu { z-index: 2100; }

@media (max-width: 575px) {
    .profile-hero-cover { height: 120px; }
    .profile-hero.no-bg .profile-hero-cover { height: 64px; }
    .profile-hero-body { padding: 10px 1rem 1rem 1rem; }
    .profile-hero-avatar { margin-top: -52px; }
    .profile-hero-avatar img { width: 96px !important; height: 96px !important; }
    .profile-hero-name { font-size: 1.35rem; }
    .profile-hero-actions { width: 100%; padding-top: 6px; }
}

/* Stats strip — 4 quick numbers under the hero */
.profile-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    border-radius: var(--mst-radius);
    background: var(--mst-card);
    border: 1px solid var(--mst-border);
    box-shadow: var(--mst-shadow);
    overflow: hidden;
}
.profile-stat {
    padding: 10px 10px;
    text-align: center;
    border-right: 1px solid var(--mst-border);
    text-decoration: none;
    color: inherit;
    transition: background 0.15s;
}
.profile-stat:last-child { border-right: none; }
a.profile-stat {
    cursor: pointer;
    border-bottom: 2px solid transparent;
}
a.profile-stat:hover {
    background: rgba(15,100,102,0.06);
    color: inherit;
    border-bottom-color: var(--mst-primary);
}
a.profile-stat:hover .profile-stat-num { color: var(--mst-primary); }
/* Quieter, more refined stats — serif italic-ish numbers, very small caps label */
.profile-stat-num {
    font-family: 'Georgia', 'Cormorant Garamond', serif;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--mst-text);
    line-height: 1.15;
    letter-spacing: 0.01em;
}
.profile-stat-label {
    font-size: 0.62rem;
    text-transform: uppercase;
    letter-spacing: 0.10em;
    color: var(--mst-muted);
    margin-top: 3px;
    font-weight: 500;
}
@media (max-width: 575px) {
    .profile-stats { grid-template-columns: repeat(2, 1fr); }
    .profile-stat { border-bottom: 1px solid var(--mst-border); }
    .profile-stat:nth-child(2) { border-right: none; }
    .profile-stat:nth-child(odd) { border-right: 1px solid var(--mst-border); }
    .profile-stat:nth-last-child(-n+2) { border-bottom: none; }
    .profile-stat-num { font-size: 0.98rem; }
}

/* Collapsible profile sections — each section has a clickable header bar
   and a body that toggles open/closed. Replaces the old tabbed layout. */
.profile-sections { display: flex; flex-direction: column; gap: 10px; }
.profile-section {
    background: var(--mst-card);
    border: 1px solid var(--mst-border);
    border-radius: var(--mst-radius);
    box-shadow: var(--mst-shadow);
    overflow: hidden;
}
.profile-section-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: transparent;
    border: none;
    padding: 12px 16px;
    text-align: left;
    cursor: pointer;
    color: var(--mst-text);
    font-weight: 600;
    font-size: 0.95rem;
    transition: background 0.15s;
}
.profile-section-toggle:hover { background: rgba(15,100,102,0.04); }
.profile-section-toggle:focus-visible {
    outline: 2px solid var(--mst-primary);
    outline-offset: -2px;
}
.profile-section-title { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
/* One-line preview of what's inside, so users don't have to expand a
   collapsed Settings section to remember what it covers. */
.profile-section-preview {
    color: var(--mst-muted);
    font-weight: 400;
    font-size: 0.78rem;
}
@media (max-width: 575px) {
    .profile-section-preview { display: none; }
}
.profile-section-count {
    display: inline-block;
    background: rgba(15,100,102,0.10);
    color: var(--mst-primary);
    font-size: 0.7rem;
    font-weight: 700;
    padding: 1px 7px;
    border-radius: 999px;
}
.profile-section-chevron {
    color: var(--mst-muted);
    font-size: 0.9rem;
    transition: transform 0.2s;
    transform: rotate(0deg);
}
.profile-section-toggle.collapsed .profile-section-chevron { transform: rotate(-90deg); }

/* Engage-bar grouping — subtle vertical dividers between react/comment,
   share/translate, and the "Open" link, so each control reads as part
   of a logical group instead of a flat row of seven things. */
.engage-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.engage-bar .engage-group {
    display: inline-flex;
    align-items: center;
    gap: 12px;
}
.engage-bar .engage-divider {
    width: 1px;
    height: 16px;
    background: var(--mst-border);
    align-self: center;
}

/* Subtle press-feel for primary/outline buttons on hover. Keeps things
   under 120ms so it never feels in the way. */
.btn-primary:hover,
.btn-outline-primary:hover,
.btn-warning:hover,
.btn-outline-warning:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(15,100,102,0.18);
    transition: transform 0.10s ease, box-shadow 0.10s ease;
}
.btn-primary:active,
.btn-outline-primary:active {
    transform: translateY(0);
}

/* Mobile nav — switch the icon-on-top-of-label layout to icon-beside-label
   on phones, where the vertical layout was stealing two rows of header
   real estate. The dropdown menu still expands as Bootstrap default. */
@media (max-width: 991.98px) {
    .nav-main-icons .nav-link.d-flex {
        flex-direction: row !important;
        gap: 8px;
        padding: 8px 12px !important;
    }
    .nav-main-icons .nav-icon-label {
        margin-top: 0 !important;
    }
}

/* Comment thread line — visual continuity from the parent comment to
   each reply, especially helpful on phones where indent alone is easy
   to lose track of. */
.comment-reply {
    position: relative;
    padding-left: 16px;
}
.comment-reply::before {
    content: "";
    position: absolute;
    left: 4px; top: 0; bottom: 6px;
    width: 2px;
    background: var(--mst-border);
    border-radius: 1px;
}
[data-theme="dark"] .comment-reply::before { background: rgba(255,255,255,0.10); }
.profile-section-body {
    padding: 0 16px 16px 16px;
    border-top: 1px solid var(--mst-border);
    padding-top: 14px;
}

/* About — clean dl rows, no card-per-field */
.profile-about-list { margin: 0; padding: 0; }
.profile-about-row {
    display: grid;
    grid-template-columns: 160px 1fr auto;
    gap: 16px;
    align-items: center;
    padding: 11px 0;
    border-bottom: 1px solid var(--mst-border);
}
.profile-about-row:last-child { border-bottom: none; }
.profile-about-row dt {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--mst-muted);
    margin: 0;
}
.profile-about-row dd { margin: 0; color: var(--mst-text); }
.profile-about-vis { justify-self: end; }
@media (max-width: 575px) {
    .profile-about-row { grid-template-columns: 1fr auto; }
    .profile-about-row dt { grid-column: 1 / -1; padding-bottom: 2px; }
    .profile-about-row dd { grid-column: 1; }
    .profile-about-vis { grid-column: 2; grid-row: 2; }
}

/* Stories — thumbnail grid */
.profile-stories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
}
.profile-story-card {
    display: flex;
    flex-direction: column;
    border-radius: 10px;
    overflow: hidden;
    background: var(--mst-card);
    border: 1px solid var(--mst-border);
    text-decoration: none;
    color: inherit;
    transition: transform 0.15s, box-shadow 0.15s;
}
.profile-story-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    color: inherit;
}
.profile-story-thumb {
    aspect-ratio: 16 / 9;
    background-size: cover;
    background-position: center;
    background-color: var(--mst-light, #f0ece1);
    position: relative;
}
.profile-story-thumb.no-thumb {
    background: linear-gradient(135deg, rgba(15,100,102,0.10), rgba(15,100,102,0.04));
    display: flex; align-items: center; justify-content: center;
}
.profile-story-thumb-year {
    font-family: 'Georgia', serif;
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--mst-primary);
    opacity: 0.5;
}
.profile-story-meta { padding: 10px 12px; }
.profile-story-year { font-size: 0.75rem; color: var(--mst-muted); font-weight: 600; }
.profile-story-title {
    font-weight: 700;
    margin-top: 4px;
    font-size: 0.95rem;
    color: var(--mst-text);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.profile-story-preview {
    margin-top: 4px;
    font-size: 0.88rem;
    color: var(--mst-muted);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Profile card with optional background image */
.profile-card-shell {
    border-radius: var(--mst-radius);
    background: var(--mst-card);
    border: 1px solid var(--mst-border);
    box-shadow: var(--mst-shadow);
    overflow: hidden;
    background-size: cover;
    background-position: center;
}
.profile-card-shell.has-bg .profile-card-overlay {
    /* 0-4-25-4-0 wash: image visible at top and bottom, soft band mid-card */
    background: linear-gradient(180deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0.04) 25%, rgba(255,255,255,0.25) 50%, rgba(255,255,255,0.04) 75%, rgba(255,255,255,0) 100%);
    backdrop-filter: none;
}
[data-theme="dark"] .profile-card-shell.has-bg .profile-card-overlay {
    background: linear-gradient(180deg, rgba(22,27,39,0) 0%, rgba(22,27,39,0.05) 25%, rgba(22,27,39,0.3) 50%, rgba(22,27,39,0.05) 75%, rgba(22,27,39,0) 100%);
}
.profile-card-shell.has-bg { min-height: 280px; }
.profile-card-shell.user-name-card.has-bg { min-height: 110px; }
.profile-card-shell.user-name-card .profile-card-overlay { padding: 1rem 1.25rem; }
.profile-card-shell.user-name-card.has-bg h3 { color: #fff; text-shadow: 0 1px 4px rgba(0,0,0,0.6); }
.profile-action-link, .profile-action-link svg { color: var(--mst-primary) !important; }
.profile-action-link:hover, .profile-action-link:hover svg { color: var(--mst-primary-2) !important; }
.profile-card-shell.has-bg h3 {
    color: #fff;
    text-shadow: 0 1px 4px rgba(0,0,0,0.7);
}
[data-theme="dark"] .profile-card-shell.has-bg h3 { color: #fff; }
.profile-card-overlay {
    padding: 1.5rem;
}
.profile-card-shell .card.bg-light { backdrop-filter: blur(4px); background: rgba(255,255,255,0.92) !important; }
[data-theme="dark"] .profile-card-shell .card.bg-light { background: rgba(27,33,48,0.92) !important; }

/* Presence dot — sits on the bottom-right of any avatar/wrapper */
.presence-dot {
    position: relative;
    display: inline-block;
}
.presence-dot::after {
    content: "";
    position: absolute;
    right: -1px;
    bottom: -1px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #9ca3af;
    border: none;
    box-shadow: 0 0 0 1px rgba(0,0,0,0.12);
    transition: background-color .2s ease;
}
.presence-dot.is-online::after { background: #22c55e; }
/* Away: amber. Same dot, different fill. Offline = no class = grey
   default. Hidden users (those who picked "Look offline") never get
   either class applied, so their dot stays grey. */
.presence-dot.is-away::after { background: #f59e0b; }

/* Inline 'online'/'offline' label */
.presence-label {
    font-size: 0.7rem;
    color: var(--mst-muted);
    font-weight: 500;
    letter-spacing: 0.02em;
}
.presence-label.is-online { color: #22c55e; }
.presence-label.is-away   { color: #f59e0b; }
.presence-dot.size-sm::after { width: 11px; height: 11px; right: 0; bottom: 0; }
.presence-dot.size-lg::after { width: 18px; height: 18px; right: 0; bottom: 0; }

/* Reaction picker: pops above the like button on hover/focus */
.reaction-wrap {
    display: inline-block;
    position: relative;
}
.reaction-picker {
    position: absolute;
    bottom: calc(100% + 6px);
    left: 0;
    background: var(--mst-card);
    border: 1px solid var(--mst-border);
    border-radius: 999px;
    box-shadow: var(--mst-shadow);
    padding: 4px 8px;
    display: none;
    gap: 2px;
    z-index: 30;
}
.reaction-wrap:hover .reaction-picker,
.reaction-wrap:focus-within .reaction-picker { display: inline-flex; }

/* Notification bell dropdown — pops below the navbar Alerts button */
.notif-menu {
    width: 360px;
    max-width: calc(100vw - 24px);
    padding: 0;
    border: 1px solid rgba(0,0,0,0.1);
    box-shadow: 0 10px 28px rgba(0,0,0,0.18);
    z-index: 2050;
}
[data-theme="dark"] .notif-menu {
    background-color: #1d2627;
    border-color: rgba(255,255,255,0.12);
    box-shadow: 0 10px 28px rgba(0,0,0,0.55);
}
.notif-menu-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-bottom: 1px solid rgba(0,0,0,0.06);
}
[data-theme="dark"] .notif-menu-head { border-bottom-color: rgba(255,255,255,0.08); }
.notif-menu-body {
    max-height: 420px;
    overflow-y: auto;
}
.notif-item {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 10px 14px;
    border-bottom: 1px solid rgba(0,0,0,0.04);
    text-decoration: none;
    color: inherit;
    transition: background-color 0.12s ease;
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background-color: rgba(0,0,0,0.03); color: inherit; }
[data-theme="dark"] .notif-item:hover { background-color: rgba(255,255,255,0.04); }
.notif-item.unread { background-color: rgba(15,100,102,0.06); }
[data-theme="dark"] .notif-item.unread { background-color: rgba(240,192,64,0.07); }
.notif-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--mst-surface-2, #eee);
    color: var(--mst-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    flex-shrink: 0;
    overflow: hidden;
}
.notif-avatar img { width: 100%; height: 100%; object-fit: cover; }
.notif-text { font-size: 0.88rem; line-height: 1.35; }
.notif-time { font-size: 0.72rem; color: var(--mst-muted); margin-top: 2px; }
.notif-empty { padding: 28px 14px; }

/* Notification type color tags — left border stripe */
.notif-item { border-left: 3px solid transparent; }
.notif-item.notif-comment        { border-left-color: #2563eb; }
.notif-item.notif-mention        { border-left-color: #9333ea; }
.notif-item.notif-reply          { border-left-color: var(--mst-primary); }
.notif-item.notif-friendrequest  { border-left-color: #f59e0b; }
.notif-item.notif-friendaccepted { border-left-color: #10b981; }
.notif-item.notif-announcement   { border-left-color: #f0c040; background: rgba(240,192,64,0.05); }

/* User Dashboard (rendered above Settings) */
.dash-card {
    background: var(--mst-card);
    border: 1px solid var(--mst-border);
    border-radius: var(--mst-radius);
    box-shadow: var(--mst-shadow-sm);
    padding: 20px 22px;
    margin-bottom: 20px;
}
.dash-head { margin-bottom: 14px; }
.dash-title { color: var(--mst-primary); margin-bottom: 2px; }
.dash-stats {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
    margin-bottom: 18px;
}
@media (max-width: 720px) {
    .dash-stats { grid-template-columns: repeat(2, 1fr); }
}
.dash-stat {
    text-align: center;
    padding: 12px 6px;
    background: var(--mst-surface-2, #f7f7f7);
    border-radius: 10px;
}
[data-theme="dark"] .dash-stat { background: rgba(255,255,255,0.04); }
.dash-stat-value {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--mst-primary);
    line-height: 1.1;
}
.dash-stat-label { font-size: 0.78rem; color: var(--mst-muted); margin-top: 4px; }
.dash-stat-label small { font-size: 0.7rem; opacity: 0.7; }

.dash-tiers {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-top: 6px;
    border-top: 1px solid var(--mst-border);
    margin-top: 6px;
}
.dash-tier-label {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 6px;
}
.dash-tier-circles {
    /* Fill the full width of the dashboard card; only start scrolling
       horizontally once avatars overflow that width. No premature 4-avatar cap. */
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    align-items: center;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    width: 100%;
    padding: 4px 2px;
    scrollbar-width: thin;
}
.dash-tier-circles::-webkit-scrollbar { height: 6px; }
.dash-tier-circles::-webkit-scrollbar-thumb { background: var(--mst-border); border-radius: 3px; }
.dash-circle {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 2px solid;
    background: var(--mst-surface-2, #eee);
    color: var(--mst-text);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1rem;
    text-decoration: none;
    overflow: hidden;
    transition: transform 0.1s ease;
    flex: 0 0 auto;
    scroll-snap-align: start;
}
.dash-circle:hover { transform: scale(1.08); color: var(--mst-text); }
.dash-circle img { width: 100%; height: 100%; object-fit: cover; }
.dash-circle-more {
    color: var(--mst-muted);
    border-color: var(--mst-border);
    font-size: 0.78rem;
    cursor: default;
}

.dash-badges { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--mst-border); }
.dash-section-title { color: var(--mst-primary); margin-bottom: 4px; }
.dash-badges-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 8px;
}
.dash-badge {
    position: relative;
    padding: 10px 12px;
    border: 1px dashed var(--mst-border);
    border-radius: 10px;
    background: var(--mst-surface-2, #f7f7f7);
    text-align: center;
}
[data-theme="dark"] .dash-badge { background: rgba(255,255,255,0.03); }
.dash-badge-locked { opacity: 0.55; }
.dash-badge-emoji { font-size: 1.4rem; display: block; margin-bottom: 2px; }
.dash-badge-name { font-size: 0.8rem; font-weight: 600; }
.dash-badge-lock { position: absolute; top: 4px; right: 6px; font-size: 0.7rem; }

/* Achievement ladders — five cards, one per ladder, with badge image + progress */
.dash-badge-summary {
    font-family: 'Fraunces', 'Cormorant Garamond', Georgia, serif;
    font-size: 1.05rem;
    color: var(--mst-primary);
    text-align: center;
    padding: 6px 10px;
    background: rgba(15,100,102,0.06);
    border-radius: 8px;
}
.ladder-grid {
    /* Fixed 3-column grid on desktop. Cards stack vertically so the bigger badge
       sits cleanly above the title/progress, and 3 cards fit in the dashboard
       column without crowding. Falls back to 2 / 1 columns on narrower viewports. */
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
}
@media (max-width: 900px) { .ladder-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 540px) { .ladder-grid { grid-template-columns: 1fr; } }
.ladder-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 8px;
    padding: 14px 14px 12px;
    background: var(--mst-card);
    border: 1px solid var(--mst-border);
    border-radius: 14px;
}
[data-theme="dark"] .ladder-card { background: rgba(255,255,255,0.04); }
.ladder-card.not-yet { opacity: 0.55; }
.ladder-badge {
    /* Transparent badges sit directly on the card — no white frame. */
    width: 140px;
    height: 140px;
    object-fit: contain;
    background: transparent;
    border: none;
    padding: 0;
}
.ladder-body { width: 100%; }

/* Badge hover zoom — bigger preview floats above the badge on hover/focus.
   The popover uses `position: fixed` so it escapes the dashboard's nested
   stacking contexts (`.dash-card` ancestors trap absolute popovers below
   sibling cards above). The actual top/left are computed in JS from the
   badge's bounding rect; we keep the visual transform here for the
   scale-in animation. */
.badge-hover-wrap {
    position: relative;
    display: inline-block;
    line-height: 0;
}
.badge-hover-zoom {
    position: fixed;
    top: 0;
    left: 0;
    transform: scale(0.6);
    transform-origin: bottom center;
    width: 280px;
    background: #fff;
    border: 1px solid var(--mst-border);
    border-radius: 16px;
    padding: 12px 12px 14px;
    box-shadow: 0 16px 40px rgba(0,0,0,0.28);
    opacity: 0;
    pointer-events: none;
    transition: transform 180ms ease, opacity 180ms ease;
    z-index: 99999;
    text-align: center;
}
.badge-hover-zoom img {
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
    object-fit: contain;
    display: block;
}
.badge-hover-title {
    margin-top: 8px;
    font-family: 'Fraunces', 'Cormorant Garamond', Georgia, serif;
    font-weight: 700;
    font-size: 1.15rem;
    color: var(--mst-primary);
    line-height: 1.1;
}
.badge-hover-wrap:hover .badge-hover-zoom,
.badge-hover-wrap:focus-within .badge-hover-zoom {
    transform: scale(1);
    opacity: 1;
    pointer-events: auto;
}
[data-theme="dark"] .badge-hover-zoom {
    background: #1d2627;
    border-color: rgba(255,255,255,0.1);
}
[data-theme="dark"] .badge-hover-zoom img { background: #fff; border-radius: 8px; }
[data-theme="dark"] .badge-hover-title { color: var(--mst-accent); }
.ladder-card.not-yet .ladder-badge { filter: grayscale(1); }
.ladder-body { flex: 1; min-width: 0; }
.ladder-title { font-weight: 700; color: var(--mst-text); line-height: 1.2; }
.ladder-name {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--mst-muted);
    margin-top: 2px;
}
.ladder-meta { font-size: 0.82rem; color: var(--mst-text); margin-top: 4px; }
.ladder-level { color: var(--mst-muted); font-size: 0.78rem; }
.ladder-progress {
    height: 6px;
    background: var(--mst-surface-2, #eee);
    border-radius: 999px;
    overflow: hidden;
    margin-top: 6px;
}
.ladder-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--mst-primary), var(--mst-accent));
    transition: width 0.3s ease;
}
.ladder-next { font-size: 0.72rem; color: var(--mst-muted); margin-top: 4px; }

/* Level-up celebration modal */
.level-up-modal {
    border: none;
    border-radius: 18px;
    box-shadow: 0 20px 60px rgba(15,100,102,0.35);
    background: linear-gradient(160deg, #fff 0%, #fff8e6 100%);
    overflow: hidden;
}
[data-theme="dark"] .level-up-modal {
    background: linear-gradient(160deg, #1d2627 0%, #2a2010 100%);
    color: #f0e6c0;
}
.level-up-eyebrow {
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--mst-accent);
    margin-bottom: 6px;
}
.level-up-badge {
    width: 144px;
    height: 144px;
    object-fit: contain;
    background: transparent;
    border: none;
    filter: drop-shadow(0 8px 24px rgba(15,100,102,0.25));
    animation: kron-levelup-pop 0.5s ease-out;
}
@keyframes kron-levelup-pop {
    0%   { transform: scale(0.3); opacity: 0; }
    60%  { transform: scale(1.08); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}
.level-up-title {
    font-family: 'Fraunces', 'Cormorant Garamond', Georgia, serif;
    font-weight: 700;
    color: var(--mst-primary);
}
[data-theme="dark"] .level-up-title { color: var(--mst-accent); }
.level-up-ladder {
    font-size: 0.85rem;
    color: var(--mst-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.level-up-next { font-size: 0.92rem; color: var(--mst-text); }

/* Admin tool grid — replaces the cramped row of small buttons */
.admin-tool-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
}
.admin-tool-card {
    display: block;
    padding: 16px 18px;
    background: var(--mst-card);
    border: 1px solid var(--mst-border);
    border-radius: 12px;
    text-decoration: none;
    color: var(--mst-text);
    transition: transform 0.1s ease, box-shadow 0.1s ease, border-color 0.1s ease;
}
.admin-tool-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--mst-shadow);
    border-color: var(--mst-primary);
    color: var(--mst-text);
}
.admin-tool-primary { border-color: var(--mst-primary); }
.admin-tool-attention { border-color: #dc3545; background: rgba(220,53,69,0.04); }
.admin-tool-attention:hover { border-color: #dc3545; }
.admin-tool-icon { font-size: 1.6rem; margin-bottom: 4px; }
.admin-tool-name { font-weight: 600; margin-bottom: 2px; }
.admin-tool-desc { color: var(--mst-muted); font-size: 0.78rem; line-height: 1.35; }

/* Account "danger zone" panels in Settings */
.account-danger-zone .border { border-color: rgba(220,53,69,0.25) !important; }

/* Onboarding progress card on Home for new users (auto-hides at 3/3) */
.ob-card {
    background: var(--mst-card);
    border: 1px solid var(--mst-accent);
    border-radius: 14px;
    padding: 16px 18px;
    box-shadow: var(--mst-shadow-sm);
}
.ob-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 12px;
}
.ob-title { font-weight: 700; color: var(--mst-primary); }
.ob-sub { font-size: 0.78rem; color: var(--mst-muted); }
.ob-progress {
    flex: 1;
    height: 8px;
    background: var(--mst-surface-2, #eee);
    border-radius: 999px;
    overflow: hidden;
    max-width: 240px;
}
.ob-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--mst-primary), var(--mst-accent));
    transition: width 0.3s ease;
}
.ob-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.ob-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    background: var(--mst-surface-2, #f8f8f8);
}
[data-theme="dark"] .ob-item { background: rgba(255,255,255,0.04); }
.ob-item.done { opacity: 0.6; }
.ob-item.done .ob-text { text-decoration: line-through; }
.ob-check {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--mst-card);
    border: 1px solid var(--mst-border);
    text-align: center;
    line-height: 20px;
    font-size: 0.85rem;
    font-weight: 700;
    flex-shrink: 0;
}
.ob-item.done .ob-check { background: var(--mst-primary); color: #fff; border-color: var(--mst-primary); }
.ob-text { flex: 1; font-size: 0.88rem; line-height: 1.45; }
.ob-cta { margin-left: auto; flex-shrink: 0; }

/* Empty-feed card (Home) */
.empty-feed-card {
    background: var(--mst-card);
    border: 1px dashed var(--mst-border);
    border-radius: 14px;
    padding: 32px 20px;
    text-align: center;
}
.empty-feed-icon { font-size: 2.4rem; margin-bottom: 6px; }

/* Channel posts — admin-curated topical content with a yellow accent so they
   stand apart from personal stories on the home feed. */
.post-card-channel {
    background: linear-gradient(180deg, rgba(240,192,64,0.08), rgba(240,192,64,0.02) 70%, transparent);
    border-left: 3px solid #f0c040 !important;
}
[data-theme="dark"] .post-card-channel {
    background: linear-gradient(180deg, rgba(240,192,64,0.10), rgba(240,192,64,0.02) 70%, transparent);
}
.post-channel-strip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    background: rgba(240,192,64,0.18);
    border-bottom: 1px solid rgba(240,192,64,0.35);
    font-size: 0.78rem;
    border-top-left-radius: inherit;
    border-top-right-radius: inherit;
}
.post-channel-strip-detail {
    border-radius: 999px;
    border: 1px solid rgba(240,192,64,0.45);
    display: inline-flex;
    width: auto;
    padding: 4px 12px;
}
.post-channel-icon { font-size: 1rem; line-height: 1; }
.post-channel-name { font-weight: 700; color: #8a6b1e; }
[data-theme="dark"] .post-channel-name { color: #f0c040; }
.post-channel-tag {
    margin-left: auto;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-size: 0.65rem;
    color: var(--mst-muted);
}
.post-channel-strip-detail .post-channel-tag { margin-left: 8px; }
a.post-channel-strip { cursor: pointer; }
a.post-channel-strip:hover { background: rgba(240,192,64,0.28); }

/* Biographical / managed-account posts — fictional or historical-figure
   profiles get a sepia accent so readers know it's not a real person.
   Visually distinct from yellow channel posts; the two can stack
   (e.g., Caesar in the History channel). */
.post-card-biographical {
    background: linear-gradient(180deg, rgba(160,110,60,0.10), rgba(160,110,60,0.03) 70%, transparent);
    border-left: 3px solid #a06e3c !important;
}
[data-theme="dark"] .post-card-biographical {
    background: linear-gradient(180deg, rgba(190,140,80,0.14), rgba(190,140,80,0.03) 70%, transparent);
}
.post-bio-strip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    background: rgba(160,110,60,0.18);
    border-bottom: 1px solid rgba(160,110,60,0.35);
    font-size: 0.78rem;
    border-top-left-radius: inherit;
    border-top-right-radius: inherit;
}
.post-bio-strip-detail {
    border-radius: 999px;
    border: 1px solid rgba(160,110,60,0.45);
    display: inline-flex;
    width: auto;
    padding: 4px 12px;
}
.post-bio-icon { font-size: 1rem; line-height: 1; }
.post-bio-name { font-weight: 700; color: #6d4720; font-family: Georgia, "Times New Roman", serif; }
[data-theme="dark"] .post-bio-name { color: #d6a878; }
.post-bio-era {
    color: var(--mst-muted);
    font-style: italic;
    font-size: 0.78rem;
}
.post-bio-tag {
    margin-left: auto;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-size: 0.65rem;
    color: var(--mst-muted);
}
.post-bio-strip-detail .post-bio-tag { margin-left: 8px; }
a.post-bio-strip { cursor: pointer; }
a.post-bio-strip:hover { background: rgba(160,110,60,0.28); }
.profile-bio-banner {
    background: linear-gradient(180deg, rgba(160,110,60,0.18), rgba(160,110,60,0.08));
    border: 1px solid rgba(160,110,60,0.35);
    border-left: 3px solid #a06e3c;
    border-radius: 8px;
    padding: 10px 14px;
    /* Breathing room between the bio banner and the headline / byline
       that follows it ("Winston Churchill · 1899" on the bio's stories,
       or the article header on a single bio post). */
    margin-bottom: 24px;
}
[data-theme="dark"] .profile-bio-banner {
    background: linear-gradient(180deg, rgba(190,140,80,0.20), rgba(190,140,80,0.08));
}

/* User typeahead — admin channel writer + (future) other admin pickers */
.user-typeahead-wrap { position: relative; }
.user-typeahead-results {
    position: absolute;
    top: 100%; left: 0; right: 0;
    z-index: 1080;
    max-height: 280px;
    overflow-y: auto;
    display: none;
    margin-top: 2px;
}
.user-typeahead-item { cursor: pointer; }
.user-typeahead-item.active,
.user-typeahead-item:hover {
    background: rgba(15,100,102,0.08);
    color: inherit;
}

/* Channel tiles on /Channel index */
.channel-tile {
    display: block;
    padding: 12px 14px;
    border-radius: var(--mst-radius);
    border: 1px solid var(--mst-border);
    text-decoration: none;
    color: var(--mst-text);
    transition: transform 0.15s, box-shadow 0.15s;
}
.channel-tile:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    color: var(--mst-text);
}
.channel-tile-head {
    display: flex; align-items: center; gap: 8px;
    font-weight: 700;
    margin-bottom: 4px;
}
.channel-tile-icon { font-size: 1.2rem; }
.channel-tile-name { flex: 1; }
.channel-tile-count {
    font-weight: 500;
    font-size: 0.75rem;
    color: var(--mst-muted);
}
.channel-tile-desc {
    color: var(--mst-muted);
    font-size: 0.88rem;
    margin-bottom: 4px;
}
.channel-tile-writer {
    font-size: 0.72rem;
    color: var(--mst-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Biography listing tiles — sepia accent matching post-card-biographical */
.bio-tile {
    display: block;
    padding: 14px;
    border-radius: var(--mst-radius);
    border: 1px solid rgba(160,110,60,0.35);
    border-left: 3px solid #a06e3c;
    background: linear-gradient(180deg, rgba(160,110,60,0.08), transparent);
    text-decoration: none;
    color: var(--mst-text);
    transition: transform 0.15s, box-shadow 0.15s;
}
.bio-tile:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(160,110,60,0.18);
    color: var(--mst-text);
}
.bio-tile-head {
    display: flex; align-items: center; gap: 10px;
    margin-bottom: 6px;
}
.bio-tile-avatar {
    width: 48px; height: 48px;
    border-radius: 50%;
    object-fit: cover;
    flex: 0 0 48px;
    background: rgba(160,110,60,0.15);
}
.bio-tile-name {
    font-family: 'Georgia', serif;
    font-weight: 700;
    font-size: 1.05rem;
    line-height: 1.15;
    color: #6d4720;
}
[data-theme="dark"] .bio-tile-name { color: #d6a878; }
.bio-tile-era {
    font-size: 0.75rem;
    color: var(--mst-muted);
    font-style: italic;
}
.bio-tile-summary {
    font-size: 0.88rem;
    color: var(--mst-muted);
    margin-top: 2px;
}
.bio-tile-count {
    font-size: 0.72rem;
    color: var(--mst-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 4px;
}

/* Home feed sort bar — small Latest / Popular pills above the cards. */
.feed-sort-bar {
    display: inline-flex;
    gap: 4px;
    padding: 3px;
    border-radius: 999px;
    background: rgba(0,0,0,0.04);
    border: 1px solid var(--mst-border);
    font-size: 0.78rem;
}
[data-theme="dark"] .feed-sort-bar { background: rgba(255,255,255,0.05); }
.feed-sort-btn {
    padding: 3px 12px;
    border-radius: 999px;
    color: var(--mst-muted);
    text-decoration: none;
    font-weight: 600;
    transition: background 0.15s, color 0.15s;
}
.feed-sort-btn:hover { color: var(--mst-primary); }
.feed-sort-btn.active {
    background: var(--mst-primary);
    color: #fff;
}
.feed-sort-btn.active:hover { color: #fff; }

/* Tier filter — segmented pill control on the Friends page.
   Each button's left edge gets a colored dot matching its tier. */
.tier-filter-group {
    display: inline-flex;
    gap: 0;
    padding: 3px;
    border-radius: 999px;
    background: rgba(0,0,0,0.04);
    border: 1px solid var(--mst-border);
    font-size: 0.78rem;
}
[data-theme="dark"] .tier-filter-group { background: rgba(255,255,255,0.05); }
.tier-filter-btn {
    padding: 4px 12px 4px 22px;
    border: none;
    background: transparent;
    border-radius: 999px;
    color: var(--mst-muted);
    font-weight: 600;
    cursor: pointer;
    position: relative;
    transition: background 0.15s, color 0.15s;
}
/* Tier filter hide. Two-class !important so it beats Bootstrap's
   .d-flex (display:flex !important) that the network rows carry —
   a plain inline display:none can't override that. */
.network-item.tier-hidden { display: none !important; }
.tier-filter-btn::before {
    content: "";
    position: absolute;
    left: 8px;
    top: 50%;
    width: 8px; height: 8px;
    border-radius: 50%;
    transform: translateY(-50%);
    background: var(--tier-acquaintances);
}
.tier-filter-btn[data-tier-color="friends"]::before { background: var(--tier-friends); }
.tier-filter-btn[data-tier-color="family"]::before  { background: var(--tier-family); }
/* 'All' button — three small dots arranged left to right so it reads
   as 'every tier' rather than borrowing one tier's colour. */
.tier-filter-btn[data-tier-color="all"] {
    padding-left: 36px;
}
.tier-filter-btn[data-tier-color="all"]::before {
    background:
        radial-gradient(circle at 4px 50%,  var(--tier-acquaintances) 0 3px, transparent 3.5px),
        radial-gradient(circle at 12px 50%, var(--tier-friends)       0 3px, transparent 3.5px),
        radial-gradient(circle at 20px 50%, var(--tier-family)        0 3px, transparent 3.5px);
    width: 24px;
    height: 8px;
    border-radius: 0;
    left: 6px;
}
.tier-filter-btn:hover { color: var(--mst-text); background: rgba(0,0,0,0.04); }
.tier-filter-btn.active {
    background: var(--mst-card);
    color: var(--mst-text);
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

/* Colourful tier pills under the Connections search box — each pill is
   filled with its tier's signature colour so the choice reads at a
   glance. Pure visual variant; the actual filter behaviour comes from
   the same .tier-filter-btn handler the older strip uses. */
.tier-pill-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.tier-pill {
    border-radius: 999px;
    padding: 6px 16px;
    font-size: 0.82rem;
    font-weight: 600;
    border: 1px solid transparent;
    cursor: pointer;
    transition: transform .12s, box-shadow .12s, opacity .12s;
    line-height: 1.1;
    color: #fff;
}
.tier-pill::before { display: none; }   /* hide the dot inherited from tier-filter-btn */
.tier-pill { padding-left: 16px; }      /* override the dot reservation */
.tier-pill.tier-pill-all {
    background: linear-gradient(90deg,
        var(--tier-acquaintances) 0%,
        var(--tier-friends) 50%,
        var(--tier-family) 100%);
    color: #fff;
}
.tier-pill.tier-pill-family       { background: var(--tier-family);       color: #2b241c; }
.tier-pill.tier-pill-friends      { background: var(--tier-friends);      color: #fff; }
.tier-pill.tier-pill-acquaint     { background: var(--tier-acquaintances); color: #fff; }
.tier-pill:not(.active) { opacity: 0.55; }
.tier-pill:hover { opacity: 1; transform: translateY(-1px); box-shadow: 0 3px 8px rgba(0,0,0,0.10); }
.tier-pill.active { opacity: 1; box-shadow: 0 1px 3px rgba(0,0,0,0.18), inset 0 0 0 2px rgba(255,255,255,0.4); }

/* Quick filter pills (Channels / Biographies on/off). One click toggles
   the user's per-feed-pref without having to open Settings. */
.feed-filter-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid var(--mst-border);
    background: var(--mst-card);
    color: var(--mst-text);
    font-size: 0.78rem;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, opacity 0.15s;
}
.feed-filter-btn:hover {
    border-color: var(--mst-primary);
}
.feed-filter-btn .feed-filter-state {
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-size: 0.62rem;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 999px;
}
.feed-filter-btn.is-on .feed-filter-state {
    background: var(--mst-primary);
    color: #fff;
}
.feed-filter-btn.is-off {
    opacity: 0.6;
    color: var(--mst-muted);
}
.feed-filter-btn.is-off .feed-filter-state {
    background: rgba(0,0,0,0.10);
    color: var(--mst-muted);
}
[data-theme="dark"] .feed-filter-btn.is-off .feed-filter-state {
    background: rgba(255,255,255,0.10);
}
.feed-filter-btn.is-off .feed-filter-icon { filter: grayscale(60%); }

/* Admin: signup-ordinal badge (#1 = first ever signup) */
.user-ordinal-badge {
    background: rgba(15,100,102,0.10);
    color: var(--mst-primary);
    font-family: 'Georgia', serif;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}
[data-theme="dark"] .user-ordinal-badge {
    background: rgba(120,200,200,0.12);
    color: #8fd2d4;
}

/* Media reorder grid — drag-to-reorder thumbnails on Create + Edit so the
   writer picks which photo becomes the home-feed cover. Uses HTML5 drag &
   drop; tiles carry the form input that submits the new order. */
.media-reorder-grid {
    /* Two columns of tile-rows on wider screens, one column on narrow. */
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 8px;
    padding: 8px;
    background: rgba(0,0,0,0.02);
    border: 1px dashed var(--mst-border);
    border-radius: 8px;
}
[data-theme="dark"] .media-reorder-grid { background: rgba(255,255,255,0.03); }
.media-reorder-tile {
    position: relative;
    width: 110px;
    height: 110px;
    border-radius: 6px;
    overflow: hidden;
    cursor: grab;
    background: #000;
    transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s;
    user-select: none;
    flex: 0 0 auto;
}
.media-tile-row > .media-reorder-tile { aspect-ratio: auto; }
.media-reorder-tile:active { cursor: grabbing; }
.media-reorder-tile.dragging { opacity: 0.45; transform: scale(0.97); }
.media-reorder-tile.drag-over { box-shadow: 0 0 0 3px var(--mst-primary); }
.media-reorder-tile img,
.media-reorder-tile video {
    width: 100%; height: 100%; object-fit: cover; display: block;
    pointer-events: none; /* let drag events fire on the tile, not the img */
}
.media-reorder-grip {
    position: absolute; top: 4px; right: 6px;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.6);
    font-size: 0.95rem;
    pointer-events: none;
}
.media-reorder-badge {
    position: absolute; bottom: 4px; left: 6px;
    background: rgba(0,0,0,0.65); color: #fff;
    padding: 1px 6px; border-radius: 4px;
    font-size: 0.62rem; text-transform: uppercase; letter-spacing: 0.05em;
}
.media-reorder-remove {
    position: absolute; top: 4px; left: 4px;
    width: 22px; height: 22px;
    background: rgba(0,0,0,0.6);
    color: #fff;
    border: none;
    border-radius: 50%;
    font-size: 0.75rem;
    line-height: 1;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    padding: 0;
    transition: background 0.15s;
}
.media-reorder-remove:hover { background: #dc3545; }

/* Per-tile media row — a thumbnail tile on the left + a layout-position
   panel on the right. The panel makes the picker much more findable than
   the old tiny corner overlay. */
.media-tile-row {
    display: flex;
    align-items: stretch;
    gap: 10px;
    padding: 6px;
    border: 1px solid var(--mst-border);
    border-radius: 8px;
    background: var(--mst-card);
}
.media-tile-row .media-reorder-tile {
    flex: 0 0 auto;
}
.media-layout-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 4px;
    padding: 4px 6px;
}
.media-layout-panel-label {
    font-size: 0.66rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--mst-muted);
    font-weight: 600;
}
.media-layout-panel-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 3px;
    width: 64px; height: 64px;
    background: rgba(0,0,0,0.06);
    padding: 3px;
    border-radius: 6px;
}
/* Finer 4-col × 8-row picker — used in newspaper / book mode for more
   precise spans. Cells are tiny but density is the point: shift-click
   selects rectangles for any size from 1 cell up to 32. */
.media-layout-panel-grid.layout-grid-fine {
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(8, 1fr);
    width: 88px; height: 176px;
    gap: 2px;
    padding: 3px;
}
.layout-grid-fine .media-layout-cell { border-radius: 1px; }
[data-theme="dark"] .media-layout-panel-grid { background: rgba(255,255,255,0.06); }
.media-layout-cell {
    background: rgba(0,0,0,0.10);
    border: none;
    border-radius: 2px;
    cursor: pointer;
    padding: 0;
    transition: background 0.10s, transform 0.10s;
}
[data-theme="dark"] .media-layout-cell { background: rgba(255,255,255,0.10); }
.media-layout-cell:hover {
    background: rgba(15,100,102,0.35);
    transform: scale(1.10);
}
.media-layout-cell.active {
    background: var(--mst-primary);
    box-shadow: 0 0 0 1px var(--mst-primary-2, var(--mst-secondary)) inset;
}
.media-layout-panel-current {
    font-size: 0.78rem;
    color: var(--mst-text);
    font-weight: 600;
}
.media-layout-panel-hint {
    font-size: 0.68rem;
    color: var(--mst-muted);
    font-style: italic;
}

/* Shown in place of the per-image positioning grid on Standard
   personal posts for non-admin users — the grid stays exclusive
   to Newspaper/Book posts (and admin previews) until premium
   ships. */
.media-layout-locked {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1px dashed rgba(160,110,60,0.40);
    border-radius: 10px;
    background: rgba(160,110,60,0.06);
    color: var(--mst-text);
    max-width: 320px;
}
[data-theme="dark"] .media-layout-locked {
    background: rgba(217,199,154,0.08);
    border-color: rgba(217,199,154,0.30);
}
.media-layout-locked-icon { font-size: 1.4rem; flex-shrink: 0; }
.media-layout-locked-body { min-width: 0; }
.media-layout-locked-title {
    font-weight: 700;
    font-size: 0.86rem;
    color: var(--mst-primary);
    line-height: 1.2;
}
.media-layout-locked-sub {
    font-size: 0.74rem;
    color: var(--mst-muted);
    margin-top: 2px;
}

/* ── Premium badge + gate ──────────────────────────────────────────
   Small ⭐ chip that sits next to any premium-tagged feature, and a
   replacement card for when the feature is locked. Today (enforcement
   off) the gate is unused — every view's IsAvailableAsync returns true
   so the actual feature renders alongside the badge. When enforcement
   flips on, non-subscribers see the gate where the feature used to be. */
.premium-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(240,192,64,0.18);
    border: 1px solid rgba(240,192,64,0.55);
    color: #8a5a00;
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    line-height: 1.2;
    vertical-align: 2px;
    cursor: help;
}
.premium-badge-star { font-size: 0.74rem; }
[data-theme="dark"] .premium-badge {
    background: rgba(240,192,64,0.18);
    border-color: rgba(240,192,64,0.5);
    color: #f0c040;
}

.premium-gate {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border: 1px dashed rgba(240,192,64,0.55);
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(240,192,64,0.08), rgba(160,110,60,0.06));
    color: var(--mst-text);
    max-width: 460px;
}
[data-theme="dark"] .premium-gate {
    background: linear-gradient(135deg, rgba(240,192,64,0.10), rgba(217,199,154,0.06));
    border-color: rgba(240,192,64,0.40);
}
.premium-gate-icon { font-size: 1.6rem; flex-shrink: 0; line-height: 1; padding-top: 2px; }
.premium-gate-body { flex: 1; min-width: 0; }
.premium-gate-title {
    font-weight: 700;
    font-size: 0.98rem;
    color: var(--mst-primary);
    line-height: 1.2;
}
.premium-gate-sub {
    color: var(--mst-muted);
    font-size: 0.84rem;
    margin: 4px 0 8px 0;
    line-height: 1.4;
}
.premium-gate-cta {
    display: inline-block;
    font-weight: 700;
    color: var(--mst-primary);
    text-decoration: none;
    font-size: 0.86rem;
}
.premium-gate-cta:hover {
    color: var(--mst-primary-2, var(--mst-secondary));
    text-decoration: underline;
}

/* ── People profiles (NPC cards) ───────────────────────────────────
   Grid of "people you write about" — non-member profiles created by
   the user. Bubble avatar + name + relation, click → full profile. */
.people-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 14px;
}
.people-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px;
    background: var(--mst-card);
    border: 1px solid var(--mst-border);
    border-radius: 14px;
    text-decoration: none;
    color: var(--mst-text);
    transition: transform .12s, box-shadow .12s, border-color .12s;
}
.people-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(0,0,0,0.08);
    border-color: rgba(160,110,60,0.45);
    color: var(--mst-text);
}
[data-theme="dark"] .people-card { background: rgba(255,255,255,0.04); }
.people-card-avatar {
    width: 56px; height: 56px; flex-shrink: 0;
}
.people-card-avatar img,
.people-card-initials {
    width: 56px; height: 56px;
    border-radius: 50%;
    object-fit: cover;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--mst-light, #f5efe6);
    color: var(--mst-primary);
    font-weight: 800;
    font-size: 1.1rem;
    letter-spacing: 0.02em;
}
.people-card-body { flex: 1; min-width: 0; }
.people-card-name {
    font-weight: 700;
    font-size: 0.98rem;
    line-height: 1.2;
    color: var(--mst-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.people-card-relation {
    font-size: 0.8rem;
    color: var(--mst-muted);
    margin-top: 2px;
}
.people-card-range {
    font-family: 'Fraunces', 'Cormorant Garamond', Georgia, serif;
    font-size: 0.85rem;
    color: var(--mst-primary);
    margin-top: 4px;
    letter-spacing: 0.03em;
}
.people-card-linked {
    font-size: 0.72rem;
    color: #2a7a2a;
    margin-top: 4px;
    font-weight: 600;
}

/* Two-section layout split by PersonProfileKind. Family bubbles fill
   the family tree; everyone else lives in the second block and feeds
   the friendship arc graph. Border colour is the at-a-glance signal
   for which kind a card belongs to. */
.people-section { margin-bottom: 28px; }
.people-section-title {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: 'Fraunces', Georgia, serif;
    font-size: 1.05rem;
    letter-spacing: 0.02em;
    margin-bottom: 10px;
    color: var(--mst-text);
}
/* "Just a thought" toggle — a third icon beside dictate + attach-media.
   Filled state when active so it reads as toggled-on. */
.btn-quick-media.quick-thought-btn.is-active {
    background: var(--mst-primary);
    border-color: var(--mst-primary);
    color: #fff;
}
/* Recorded-audio clip on a feed card — a compact native player bar, not a
   stretched box (audio has no visual frame, so it must not size like a photo). */
.feed-audio-clip {
    display: block;
    width: 100%;
    max-width: 340px;
    height: 40px;
}

/* Thought marker on a feed card — a muted bubble where a story shows its era. */
.thought-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--mst-muted);
    font-size: 0.78rem;
    vertical-align: middle;
    cursor: help;
}

/* Family / Friends filter pills on the People (Connections) index. */
.people-filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.people-filter-btn {
    border: 1px solid var(--mst-border);
    background: var(--mst-card);
    color: var(--mst-muted);
    border-radius: 999px;
    padding: 4px 14px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.people-filter-btn:hover { border-color: var(--mst-primary); color: var(--mst-primary); }
.people-filter-btn.is-active {
    background: var(--mst-primary);
    border-color: var(--mst-primary);
    color: #fff;
}
.people-section-dot {
    width: 10px; height: 10px; border-radius: 50%;
    display: inline-block;
}
.people-section-dot[data-kind="Family"]       { background: #c8a572; }
.people-section-dot[data-kind="Friend"]       { background: #4a7fb0; }

/* Kind-specific left border on cards. Family keeps the existing neutral
   ring; Friend / Colleague / Acquaintance / Other each get a thicker
   coloured rail on the leading edge so the cards read at a glance. */
.people-card[data-kind="Friend"]       { border-left: 4px solid #4a7fb0; }
.people-card[data-kind="Colleague"]    { border-left: 4px solid #6b8f6b; }
.people-card[data-kind="Acquaintance"] { border-left: 4px solid #9c9c9c; }
.people-card[data-kind="Other"]        { border-left: 4px solid #b58a5e; }

.people-card-kind-tag {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 1px 6px;
    border-radius: 8px;
    margin-top: 2px;
    color: #fff;
}
.people-card-kind-tag[data-kind="Friend"]       { background: #4a7fb0; }
.people-card-kind-tag[data-kind="Colleague"]    { background: #6b8f6b; }
.people-card-kind-tag[data-kind="Acquaintance"] { background: #9c9c9c; }
.people-card-kind-tag[data-kind="Other"]        { background: #b58a5e; }
.people-card-met { font-size: 0.78rem; }

/* ── Book mode ─────────────────────────────────────────────────────
   Horizontal page-turn memoir reader. Each page is one viewport-width
   slide inside a scroll-snap container; the toolbar shows prev/next
   buttons + "page N of M"; arrow keys, swipe, and clicking a TOC
   entry all turn pages. Print CSS at the bottom strips the toolbar
   and prints each page on its own physical sheet. */
.book-shell {
    max-width: 1265px; /* ~15% wider than the old 1100 so each page uses more space */
    margin: 0 auto;
    color: #2b241c;
    font-family: 'Fraunces', 'Cormorant Garamond', Georgia, serif;
}
/* Back-to-feed link at the top of the book / tree pages. The book and
   tree are full-bleed reading surfaces with their own toolbars, so the
   default top-nav back path isn't obvious; this gives the user a clear
   exit. Inter sans for contrast against the serif page. */
.book-back-row,
.tree-back-row {
    margin: 0 0 16px;
}
.book-back-link,
.tree-back-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 0.82rem;
    color: var(--mst-muted, #6b6258);
    text-decoration: none;
    padding: 6px 12px;
    border-radius: 999px;
    border: 1px solid var(--mst-border, #e9e3d7);
    background: var(--mst-card, #fff);
    transition: color .12s, border-color .12s, background .12s;
}
.book-back-link:hover,
.tree-back-link:hover {
    color: var(--mst-primary, #0f6466);
    border-color: var(--mst-primary, #0f6466);
    text-decoration: none;
}

/* Family Tree full-page shell — same max-width as the book shell
   (1100 px) so the page reads as a self-contained surface, not a
   full-bleed canvas wider than the header. The tree drawing itself
   can be much wider; the inner scroll container handles horizontal
   panning the same way the book pages do. */
.tree-shell {
    /* +15% display area (1100 -> 1265 wide; the frame height is bumped to
       match in the view) so the tree gets a bigger window — not more space
       between bubbles. */
    max-width: 1265px;
    margin: 0 auto;
    padding: 0 16px;
}
.tree-main {
    width: 100%;
}

/* ── Bubble detail card ────────────────────────────────────────────
   Museum-placard sidebar. Slides in from the right when the viewer
   clicks a bubble's portrait. Carries the person's name, life span,
   kinship to viewer, bio, and recent tagged stories — without leaving
   the tree. A "View full profile" link inside opens the dedicated
   page for users who want more. Scrim dims the canvas behind. */
.bubble-detail-panel {
    position: fixed;
    inset: 0;
    z-index: 1500;
    pointer-events: none;
    visibility: hidden;
}
.bubble-detail-panel.is-open {
    pointer-events: auto;
    visibility: visible;
}
.bubble-detail-scrim {
    position: absolute;
    inset: 0;
    background: rgba(26, 24, 18, 0);
    transition: background .25s ease;
    cursor: pointer;
}
.bubble-detail-panel.is-open .bubble-detail-scrim {
    background: rgba(26, 24, 18, 0.28);
}
.bubble-detail-body {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(440px, 92vw);
    background: #fdf9ef;
    border-left: 1px solid #d8c69c;
    box-shadow: -16px 0 40px rgba(0, 0, 0, 0.18);
    transform: translateX(100%);
    transition: transform .32s cubic-bezier(0.22, 0.61, 0.36, 1);
    overflow-y: auto;
    padding: 32px 28px 28px;
    font-family: 'Inter', system-ui, sans-serif;
    color: #2b241c;
}
.bubble-detail-panel.is-open .bubble-detail-body {
    transform: translateX(0);
}

.bubble-detail-spinner,
.bubble-detail-error {
    padding: 60px 0;
    text-align: center;
    color: #8a7355;
    font-size: 0.85rem;
}

.bubble-detail {
    position: relative;
}
.bubble-detail-close {
    position: absolute;
    top: -12px;
    right: -12px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid #d8c69c;
    background: #fff;
    font-size: 1.1rem;
    color: #5a4520;
    cursor: pointer;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .12s, color .12s;
}
.bubble-detail-close:hover { background: #f1e3c5; }
.bubble-detail-portrait {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid #3b78c2;
    margin: 0 auto 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.10);
}
.bubble-detail-portrait.is-profile {
    border-color: #c8a572;
    border-style: dashed;
}
.bubble-detail-portrait img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.bubble-detail-initials {
    font-family: 'Fraunces', Georgia, serif;
    font-size: 2.4rem;
    font-weight: 600;
    color: #5a4520;
}
.bubble-detail-name {
    font-family: 'Fraunces', 'Cormorant Garamond', Georgia, serif;
    font-size: 1.6rem;
    font-weight: 600;
    text-align: center;
    margin: 0 0 4px;
    line-height: 1.15;
}
.bubble-detail-nickname {
    text-align: center;
    font-family: 'Fraunces', Georgia, serif;
    font-style: italic;
    font-size: 0.96rem;
    color: #8a7355;
    margin-bottom: 6px;
}
.bubble-detail-kinship {
    text-align: center;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--mst-primary, #0f6466);
    font-weight: 600;
    margin: 8px 0 4px;
}
.bubble-detail-range {
    text-align: center;
    font-family: 'Fraunces', Georgia, serif;
    font-style: italic;
    font-size: 0.92rem;
    color: #5a4520;
    margin-bottom: 4px;
}
.bubble-detail-place {
    text-align: center;
    font-size: 0.8rem;
    color: #6b6258;
    margin-bottom: 14px;
}
.bubble-detail-bio {
    font-family: 'Fraunces', Georgia, serif;
    font-size: 0.96rem;
    line-height: 1.55;
    color: #2b241c;
    margin: 16px 0;
    padding: 14px 0;
    border-top: 1px solid #e7d8b0;
    border-bottom: 1px solid #e7d8b0;
}
.bubble-detail-section {
    margin-top: 22px;
}
.bubble-detail-eyebrow {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: #8a7355;
    font-weight: 600;
    margin-bottom: 10px;
}
.bubble-detail-stories {
    list-style: none;
    padding: 0;
    margin: 0;
}
.bubble-detail-stories li { margin-bottom: 8px; }
.bubble-detail-stories a {
    display: flex;
    gap: 10px;
    align-items: baseline;
    padding: 8px 10px;
    border-radius: 6px;
    background: #f6efdb;
    color: #2b241c;
    text-decoration: none;
    transition: background .12s;
}
.bubble-detail-stories a:hover { background: #ede0bf; }
.bubble-detail-story-year {
    font-family: 'Fraunces', Georgia, serif;
    font-style: italic;
    font-size: 0.85rem;
    color: var(--mst-primary, #0f6466);
    min-width: 44px;
    font-weight: 600;
}
.bubble-detail-story-title {
    flex: 1 1 auto;
    font-size: 0.9rem;
    line-height: 1.3;
}
.bubble-detail-open {
    display: block;
    margin-top: 22px;
    padding: 10px 14px;
    border-radius: 999px;
    border: 1px solid var(--mst-primary, #0f6466);
    background: transparent;
    text-align: center;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--mst-primary, #0f6466);
    text-decoration: none;
    transition: background .12s, color .12s;
}
.bubble-detail-open:hover {
    background: var(--mst-primary, #0f6466);
    color: #fff;
    text-decoration: none;
}

/* Side toolbar — vertical column docked to the left of the canvas
   so it doesn't compete with the tree's first row for space. Sticky
   so it follows as the user scrolls/pans. */
.tree-toolbar {
    position: sticky;
    top: 8px;
    left: 8px;
    float: left;
    z-index: 20;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    padding: 6px;
    margin: 8px;
    background: #fff;
    border: 1px solid #d8c69c;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.10);
}
.tree-toolbar-btn {
    background: #fff;
    border: 1px solid transparent;
    border-radius: 4px;
    padding: 4px 6px;
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 0.78rem;
    color: #5a4520;
    cursor: pointer;
    line-height: 1.2;
    white-space: nowrap;
    transition: background .12s, border-color .12s;
}
.tree-toolbar-btn:hover { background: #f7efdb; border-color: #d8c69c; }
.tree-toolbar-btn-wide  { padding: 4px 8px; font-size: 0.72rem; }
.tree-toolbar-label {
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 0.7rem;
    font-weight: 600;
    color: #5a4520;
    text-align: center;
    padding: 2px 0;
    letter-spacing: 0.04em;
}
.tree-toolbar-divider {
    height: 1px;
    background: #e7d8b0;
    margin: 4px 2px;
}

/* Send / Copy this tree to a group — surfaced as a thin card under
   the tree picker. One row per eligible group, with Copy (outline)
   and Send (filled) on the right. */
.tree-send {
    border: 1px solid var(--mst-border, #e9e3d7);
    background: var(--mst-card, #fff);
}
.tree-send-head {
    margin-bottom: 8px;
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 0.86rem;
}
.tree-send-head strong { color: var(--mst-text, #2a241c); }
.tree-send-rows {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.tree-send-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border: 1px solid var(--mst-border, #e9e3d7);
    border-radius: 8px;
    background: var(--mst-surface-2, #fbf7ef);
}
.tree-send-name {
    flex: 1 1 auto;
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 0.92rem;
    color: var(--mst-text, #2a241c);
    font-weight: 500;
}
[data-theme="dark"] .book-shell { color: #ece3d3; }
.book-shell a { color: var(--mst-primary); text-decoration: none; }
.book-shell a:hover { text-decoration: underline; }

.book-empty {
    text-align: center;
    padding: 80px 20px;
    background: #fdf8ee;
    border-radius: 18px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.05);
}
[data-theme="dark"] .book-empty { background: #1d1915; }
.book-empty-mark { font-size: 2.6rem; }
.book-empty h2 {
    font-family: 'Fraunces', Georgia, serif;
    margin-top: 12px;
}

.book-toolbar {
    display: flex; align-items: center; gap: 8px;
    margin-bottom: 8px;
    padding: 6px 10px;
    flex-wrap: wrap;
    row-gap: 6px;
}
@@media (max-width: 600px) {
    .book-toolbar { padding: 6px 4px; gap: 6px; }
    .book-toolbar .btn { padding: 2px 8px; font-size: 0.78rem; }
}
.book-nav-btn {
    width: 36px; height: 36px;
    border-radius: 50%;
    border: 1px solid var(--mst-border, #e9e3d7);
    background: var(--mst-card);
    color: var(--mst-text);
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
    transition: background .12s, border-color .12s, transform .12s;
}
.book-nav-btn:hover {
    background: var(--mst-primary, #c8a572);
    color: #fff;
    border-color: var(--mst-primary, #c8a572);
}
.book-page-readout {
    font-family: 'Fraunces', Georgia, serif;
    font-size: 1rem;
    min-width: 5em;
    text-align: center;
    color: var(--mst-muted, #6b6258);
}
.book-toolbar-spacer { flex: 1; }

.book-pages {
    display: flex;
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    height: calc(100vh - 220px);
    min-height: 520px;
    border-radius: 16px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.08);
    background: #efe5d2;
    outline: none;
}
[data-theme="dark"] .book-pages { background: #15110d; }

/* Hide the scroll bar — the toolbar is the canonical way to move. */
.book-pages::-webkit-scrollbar { display: none; }
.book-pages { scrollbar-width: none; }

/* Two-page spread: each spread fills the viewport and snaps; inside it two
   .book-page halves sit side by side with a center spine. On phones the
   spread becomes 200%-wide and pages snap one at a time (see media query). */
.book-spread {
    flex: 0 0 100%;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: row;
    align-items: stretch;
    scroll-snap-align: start;
    scroll-snap-stop: always;
    position: relative;
    transform-origin: center center;
    will-change: transform;
}
/* Center spine — a soft gutter line + inward shadow so the two halves read
   as one open book rather than two flat cards. */
.book-spread::after {
    content: "";
    position: absolute;
    top: 18px;
    bottom: 18px;
    left: 50%;
    width: 2px;
    transform: translateX(-1px);
    background: linear-gradient(to right, rgba(0,0,0,0.18), rgba(0,0,0,0.06));
    box-shadow: -8px 0 14px -8px rgba(0,0,0,0.22), 8px 0 14px -8px rgba(0,0,0,0.22);
    pointer-events: none;
    z-index: 2;
}
[data-theme="dark"] .book-spread::after {
    background: linear-gradient(to right, rgba(0,0,0,0.55), rgba(0,0,0,0.3));
}
.book-page {
    flex: 0 0 50%;
    width: 50%;
    height: 100%;
    display: flex;
    align-items: stretch;
    justify-content: center;
    padding: 28px 22px;
    box-sizing: border-box;
}
/* Blank left page that precedes a chapter / section opener. */
.book-page-blank .book-page-frame {
    box-shadow: none;
    background: transparent;
}
[data-theme="dark"] .book-page-blank .book-page-frame { background: transparent; }
/* Lift + slide page-turn cue (applied to the leaving spread by JS). The
   scroll-snap does the real navigation; this just sells the motion. */
@keyframes bookTurnForward {
    0%   { transform: translateX(0) scale(1);        box-shadow: none; }
    45%  { transform: translateX(-26px) scale(0.985); box-shadow: -24px 0 40px -20px rgba(0,0,0,0.4); }
    100% { transform: translateX(0) scale(1);        box-shadow: none; }
}
@keyframes bookTurnBack {
    0%   { transform: translateX(0) scale(1);        box-shadow: none; }
    45%  { transform: translateX(26px) scale(0.985);  box-shadow: 24px 0 40px -20px rgba(0,0,0,0.4); }
    100% { transform: translateX(0) scale(1);        box-shadow: none; }
}
.book-spread.book-turning-forward { animation: bookTurnForward 0.5s ease; }
.book-spread.book-turning-back    { animation: bookTurnBack 0.5s ease; }
@media (prefers-reduced-motion: reduce) {
    .book-spread.book-turning-forward,
    .book-spread.book-turning-back { animation: none; }
}
/* Phones: no room for a spread — show one page at a time, snap per page,
   hide the spine. The spread just becomes a 200%-wide flow of two pages. */
@media (max-width: 899px) {
    .book-page { flex: 0 0 100%; width: 100%; scroll-snap-align: start; scroll-snap-stop: always; }
    .book-spread { scroll-snap-align: none; scroll-snap-stop: normal; }
    .book-spread::after { display: none; }
    .book-page-blank { display: none; } /* skip the recto blanks on mobile */
}

/* ── Realistic 3D page-flip (desktop, toggleable) ──────────────────────
   A turning "leaf" rotates around the spine: its FRONT is the page you're
   leaving, its BACK is the page coming in, and the destination page is
   revealed underneath. The real scroll position jumps at the end (the
   overlay covers it), so scroll-snap never flashes. Built/torn-down by JS. */
.book-pages { position: relative; }
.book-anim-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 0.82rem;
    color: var(--mst-muted, #6b6258);
    cursor: pointer;
    user-select: none;
    margin-right: 4px;
}
.book-anim-toggle input { accent-color: var(--mst-primary, #0f6466); cursor: pointer; }
.book-flip-overlay {
    position: absolute;
    inset: 0;
    z-index: 50;
    perspective: 2400px;
    perspective-origin: 50% 50%;
    pointer-events: none;
    overflow: hidden;
    border-radius: 16px;
}
.book-flip-static { position: absolute; inset: 0; display: flex; flex-direction: row; }
.book-flip-half { flex: 0 0 50%; width: 50%; height: 100%; display: flex; }
.book-flip-leaf {
    position: absolute;
    top: 0;
    height: 100%;
    width: 50%;
    transform-style: preserve-3d;
    will-change: transform;
    z-index: 2;
}
.book-flip-leaf-right { left: 50%; transform-origin: left center; }
.book-flip-leaf-left  { left: 0;   transform-origin: right center; }
.book-flip-face {
    position: absolute;
    inset: 0;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    overflow: hidden;
    display: flex;
}
.book-flip-back { transform: rotateY(180deg); }
/* Clones inside the flip fill their half (override the 50% spread sizing). */
.book-flip-overlay .book-page { flex: 0 0 100% !important; width: 100% !important; }
/* A soft shade that deepens as the leaf passes the spine, selling the fold. */
.book-flip-shade {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(to var(--shade-dir, left), rgba(0,0,0,0.28), rgba(0,0,0,0) 55%);
    opacity: 0;
}
@media (prefers-reduced-motion: reduce) {
    .book-flip-overlay { display: none; }
}

.book-page-frame {
    width: 100%;
    max-width: 720px;
    height: 100%;
    background: #fdf8ee;
    border-radius: 12px;
    box-shadow: 0 6px 24px rgba(0,0,0,0.08);
    padding: 36px 44px 28px;
    display: flex;
    flex-direction: column;
    /* A page is a fixed leaf — no scrollbar inside it, like a real book page.
       (Stories longer than one page currently clip; flowing them across pages
       is a separate "pagination" feature.) */
    overflow: hidden;
    font-size: 1.05rem;
    line-height: 1.65;
}
[data-theme="dark"] .book-page-frame { background: #1d1915; }
.book-page-footer {
    margin-top: auto;
    padding-top: 14px;
    text-align: center;
}
.book-page-number {
    font-family: 'Fraunces', Georgia, serif;
    color: var(--mst-muted, #6b6258);
    font-size: 0.85rem;
    font-variant-numeric: tabular-nums;
}
.book-page-footer {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
}
.book-page-footer .book-page-number {
    margin-left: auto;
}
.book-page-words {
    font-family: 'Fraunces', Georgia, serif;
    color: var(--mst-muted, #6b6258);
    font-size: 0.78rem;
    font-style: italic;
    font-variant-numeric: tabular-nums;
}
.book-chapter-meta {
    margin-top: 14px;
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 0.85rem;
    color: var(--mst-muted, #6b6258);
    font-style: italic;
}

/* Cover */
.book-cover-content {
    margin: auto;
    text-align: center;
}
.book-cover-eyebrow {
    text-transform: uppercase; letter-spacing: 0.4em;
    font-size: 0.78rem; color: var(--mst-primary);
    margin-bottom: 16px;
    font-family: 'Inter', system-ui, sans-serif;
}
.book-cover-title {
    font-family: 'Fraunces', Georgia, serif;
    font-weight: 600;
    font-size: clamp(2.2rem, 5vw, 3.4rem);
    line-height: 1.1;
    margin: 0;
    letter-spacing: -0.01em;
}
.book-cover-rule {
    width: 64px; height: 2px;
    background: var(--mst-primary);
    margin: 22px auto;
}
.book-cover-meta {
    font-style: italic;
    color: var(--mst-muted, #6b6258);
    font-size: 1rem;
}
.book-cover-portrait {
    width: 120px; height: 120px;
    border-radius: 50%;
    object-fit: cover;
    margin-top: 32px;
    border: 3px solid #fff;
    box-shadow: 0 4px 14px rgba(0,0,0,0.15);
}

.book-section-title {
    font-family: 'Fraunces', Georgia, serif;
    font-weight: 600;
    font-size: 1.6rem;
    text-align: center;
    margin: 0 0 24px;
    letter-spacing: 0.02em;
}
.book-toc-body {
    /* The TOC may be long; let it scroll inside the page rather than
       overflowing the slide. */
    overflow-y: auto;
    padding-right: 8px;
}
.book-toc-decade { margin-bottom: 24px; }
.book-toc-decade h3 {
    font-family: 'Fraunces', Georgia, serif;
    font-weight: 600;
    font-size: 1.15rem;
    border-bottom: 1px solid rgba(0,0,0,0.1);
    padding-bottom: 4px;
    margin-bottom: 8px;
}
.book-toc-list {
    list-style: none;
    padding: 0; margin: 0;
}
.book-toc-list li {
    display: flex;
    align-items: baseline;
    gap: 12px;
    padding: 2px 0;
}
.book-toc-list li a {
    display: flex;
    align-items: baseline;
    gap: 10px;
    width: 100%;
    color: inherit;
    cursor: pointer;
}
.book-toc-list li a:hover {
    background: rgba(200,165,114,0.08);
    text-decoration: none;
}
.book-toc-year {
    flex: 0 0 auto;
    width: 48px;
    font-variant-numeric: tabular-nums;
    color: var(--mst-primary);
    font-weight: 600;
}
.book-toc-title {
    flex: 0 1 auto;
}
.book-toc-dots {
    flex: 1 1 auto;
    border-bottom: 1px dotted rgba(0,0,0,0.25);
    margin: 0 4px 4px;
    min-width: 12px;
}
.book-toc-pagenum {
    flex: 0 0 auto;
    font-variant-numeric: tabular-nums;
    color: var(--mst-muted, #6b6258);
    min-width: 2em;
    text-align: right;
}

/* Decade title page — large centered banner */
.book-decade-page-content,
.book-chapter-page-content {
    margin: auto;
    text-align: center;
    width: 100%;
}
.book-decade-rule {
    width: 100px; height: 2px;
    background: var(--mst-primary);
    margin: 20px auto;
}
.book-decade-title {
    font-family: 'Fraunces', Georgia, serif;
    font-weight: 600;
    font-size: clamp(2rem, 5vw, 3rem);
    margin: 0;
    letter-spacing: 0.02em;
    color: var(--mst-primary);
}
.book-chapter-eyebrow {
    text-transform: uppercase; letter-spacing: 0.4em;
    font-size: 0.78rem; color: var(--mst-primary);
    margin-bottom: 12px;
    font-family: 'Inter', system-ui, sans-serif;
}
.book-chapter-title {
    font-family: 'Fraunces', Georgia, serif;
    font-weight: 600;
    font-size: clamp(1.6rem, 4vw, 2.4rem);
    margin: 0;
    letter-spacing: 0.01em;
}
.book-anchor {
    display: block;
    position: relative;
    top: -1px;
    height: 0;
    overflow: hidden;
}

/* Toc sub-list (chapters listed under a year with multiple chapters) */
.book-toc-sublist {
    list-style: none;
    padding: 0 0 0 48px;
    margin: 4px 0 6px;
}
.book-toc-sublist li a {
    color: var(--mst-muted, #6b6258);
    font-size: 0.95rem;
}
.book-toc-bullet {
    color: var(--mst-primary);
    flex: 0 0 auto;
    width: 16px;
    text-align: center;
}
.book-toc-year-row { display: block; }

/* Story page — head with title/date on left, tick+edit on right */
.book-story-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}
.book-story-head-left { min-width: 0; flex: 1 1 auto; }
.book-story-actions {
    display: flex; gap: 6px; align-items: center; flex-shrink: 0;
}
.book-tick,
.book-edit {
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 0.72rem;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid var(--mst-border, #e9e3d7);
    background: var(--mst-card);
    color: var(--mst-muted, #6b6258);
    cursor: pointer;
    text-decoration: none;
    transition: background .12s, color .12s, border-color .12s;
}
.book-tick:hover,
.book-edit:hover {
    border-color: var(--mst-primary, #c8a572);
    color: var(--mst-primary, #c8a572);
    text-decoration: none;
}
.book-tick.is-on {
    background: #2e7d4f;
    color: #fff;
    border-color: #2e7d4f;
}
.book-tick.is-on:hover {
    background: #266a42;
    border-color: #266a42;
    color: #fff;
}
.book-hide {
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 0.72rem;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid var(--mst-border, #e9e3d7);
    background: var(--mst-card);
    color: var(--mst-muted, #6b6258);
    cursor: pointer;
    transition: background .12s, color .12s, border-color .12s;
}
.book-hide:hover {
    background: #a94442;
    color: #fff;
    border-color: #a94442;
}

/* ── Inline "edit in book" — the textarea + Save/Cancel toolbar that
   appears BELOW the rendered story when the user clicks ✎ Edit in book.
   The rendered prose and every photo (lead, wrap, gallery) stay on
   screen, framed as a "before" reference. The textarea is the editor.
   A subtle divider + eyebrow label makes the split obvious. */
.book-edit-form {
    display: none;
    margin-top: 24px;
    padding-top: 18px;
    border-top: 1px dashed var(--mst-border, #e9e3d7);
    position: relative;
}
.book-edit-form::before {
    content: "Editing";
    position: absolute;
    top: -10px;
    left: 12px;
    padding: 0 8px;
    background: var(--mst-card, #fff);
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 0.66rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--mst-primary, #c8a572);
}
.book-story-body-wrap.is-editing .book-edit-form { display: block; }
.book-edit-textarea {
    width: 100%;
    min-height: 280px;
    padding: 14px 16px;
    border: 1px solid var(--mst-border, #e9e3d7);
    border-radius: 6px;
    background: #fffdf7;
    font-family: 'Fraunces', Georgia, serif;
    font-size: 1.02rem;
    line-height: 1.65;
    color: var(--mst-ink, #2a241c);
    resize: vertical;
}
.book-edit-textarea:focus {
    outline: none;
    border-color: var(--mst-primary, #c8a572);
    box-shadow: 0 0 0 3px rgba(200, 165, 114, 0.18);
}
.book-edit-help {
    margin-top: 10px;
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 0.78rem;
    color: var(--mst-muted, #6b6258);
    line-height: 1.45;
}
.book-edit-help strong { color: var(--mst-ink, #2a241c); font-weight: 600; }
.book-edit-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-top: 12px;
    flex-wrap: wrap;
}

/* "book-only edit" badge in the date line — surfaces that the prose
   on the page has been retouched for the book and offers a revert. */
.book-override-badge {
    margin-left: 6px;
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 0.72rem;
    color: var(--mst-primary, #c8a572);
    letter-spacing: 0.02em;
    text-transform: uppercase;
}
.book-override-revert {
    background: transparent;
    border: 0;
    padding: 0 2px;
    margin-left: 4px;
    color: var(--mst-muted, #6b6258);
    text-decoration: underline;
    cursor: pointer;
    font: inherit;
    text-transform: none;
    letter-spacing: 0;
}
.book-override-revert:hover { color: var(--mst-primary, #c8a572); }

.book-story-title {
    font-family: 'Fraunces', Georgia, serif;
    font-weight: 600;
    font-size: 1.4rem;
    margin: 0 0 4px;
    line-height: 1.25;
}
.book-story-date {
    font-style: italic;
    color: var(--mst-muted, #6b6258);
    font-size: 0.92rem;
    margin-bottom: 12px;
}
.book-story-body {
    text-align: justify;
    hyphens: auto;
}
/* Drop-cap on the first letter of the first paragraph. */
.book-story-body::first-letter {
    font-family: 'Fraunces', Georgia, serif;
    font-weight: 600;
    float: left;
    font-size: 3.2rem;
    line-height: 0.95;
    padding: 4px 8px 0 0;
    color: var(--mst-primary);
}
.book-story-figure {
    margin: 14px auto;
    text-align: center;
}
.book-story-figure img {
    max-width: 80%;
    max-height: 38vh;
    width: auto;
    height: auto;
    border-radius: 4px;
    margin: 0 auto;
    display: inline-block;
    object-fit: contain;
}
.book-story-figure-lead {
    margin: 0 auto 16px;
    text-align: center;
}
.book-story-figure-lead img {
    /* The lead photo gets a slightly larger ceiling than inline figures
       because it's the story's opening image — but still capped so the
       prose underneath is visible without scrolling on most screens. */
    max-height: 42vh;
}
/* In-page photo grid — sits above the prose (replaces the old single lead).
   Photos flow by size: small = thirds, medium = halves, large bleeds to full
   width so smaller photos wrap under it. A lone photo centers at its natural
   size. More specific than the global .book-photo-size-* caps so large wins. */
.book-story-page-photos {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin: 0 0 16px;
    align-items: flex-start;
    justify-content: center;
}
.book-story-page-photos .book-photo { margin: 0; flex: 0 1 auto; }
.book-story-page-photos .book-photo img {
    width: 100%;
    height: auto;
    max-height: 40vh;
    object-fit: contain;
    border-radius: 4px;
    display: block;
}
.book-story-page-photos .book-photo-size-small  { flex-basis: calc(33.333% - 8px); max-width: calc(33.333% - 8px); }
.book-story-page-photos .book-photo-size-medium { flex-basis: calc(50% - 6px);     max-width: calc(50% - 6px); }
.book-story-page-photos .book-photo-size-large  { flex-basis: 100%;                max-width: 100%; }
.book-story-page-photos .book-photo:only-child     { flex-basis: auto; max-width: 100%; }
.book-story-page-photos .book-photo:only-child img { width: auto; max-width: 100%; max-height: 42vh; margin: 0 auto; }
/* Strip below the body: default = natural aspect ratio (no crop) so
   the photo reads as a full image, not a thumbnail. Each figure picks
   its width by BookSize. Use a flex row instead of a fixed-cell grid
   so wide and tall photos sit side by side without distortion. */
.book-story-gallery {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 16px;
    align-items: flex-start;
}
.book-story-gallery figure {
    margin: 0;
    flex: 0 0 auto;
}
.book-story-gallery .book-photo img {
    max-height: 220px;
    width: auto;
    height: auto;
    max-width: 100%;
    object-fit: contain;
    border-radius: 4px;
    display: block;
}
/* Size hints affect max-height of the natural-ratio image. */
.book-story-gallery .book-photo.book-photo-size-small img  { max-height: 130px; }
.book-story-gallery .book-photo.book-photo-size-medium img { max-height: 200px; }
.book-story-gallery .book-photo.book-photo-size-large img  { max-height: 320px; }
/* Crop toggle: when the user explicitly chooses square-crop on the
   strip, we go back to the old gallery-thumb look (object-fit:cover +
   fixed aspect). */
.book-story-gallery .book-photo.book-photo-crop img {
    object-fit: cover;
    aspect-ratio: 1 / 1;
    height: 140px;
    max-height: 140px;
    width: 140px;
}

/* Print: drop the viewport-based caps and the size cap so photos
   print at the full page width like proper book illustrations. */
@@media print {
    .book-story-figure img,
    .book-story-figure-lead img {
        max-width: 100%;
        max-height: none;
    }
    .book-story-gallery img {
        height: 180px;
    }
}

.book-colophon-content {
    margin: auto;
    text-align: center;
    font-style: italic;
    color: var(--mst-muted, #6b6258);
}
.book-rule {
    width: 80px; height: 1px;
    background: rgba(0,0,0,0.25);
    margin: 0 auto 18px;
}
.book-colophon-tip { font-style: normal; margin-top: 18px; }

/* Print: each slide becomes a physical page; toolbar disappears. */
@@media print {
    body { background: #fff; }
    .navbar, .sidebar, .col-sidebar, footer, .alert, .btn,
    .book-toolbar { display: none !important; }
    .book-shell {
        max-width: none;
        margin: 0; padding: 0;
        font-size: 11pt;
    }
    .book-pages {
        display: block !important;
        height: auto !important;
        min-height: 0 !important;
        overflow: visible !important;
        background: #fff !important;
        box-shadow: none !important;
        border-radius: 0 !important;
    }
    .book-page {
        flex: none !important;
        width: 100% !important;
        height: auto !important;
        padding: 0 !important;
        page-break-after: always;
    }
    .book-page-frame {
        max-width: none;
        box-shadow: none !important;
        border-radius: 0 !important;
        padding: 18mm 16mm;
        overflow: visible !important;
    }
    .book-story-actions { display: none !important; }
    .book-story a { color: inherit; text-decoration: none; }
}

/* ── Organize editor v2 (two-column drag-drop) ───────────────────
   LEFT: chapter boxes (drop targets), each with a small drop zone
   that holds the story bubbles assigned to it. Subchapters nest
   inside their parent's card.
   RIGHT: story library — every story as a bubble with photo, grouped
   by year. Drag a bubble from the right onto a left-side chapter to
   assign it. */
.organize-shell-v2 { max-width: 1280px; margin: 0 auto; }

/* TOC-page Organize CTA — sits right under the "Contents" title. */
.book-toc-head {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; flex-wrap: wrap;
    margin-bottom: 24px;
}
.book-toc-organize-btn {
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 0.84rem;
    padding: 6px 14px;
    border-radius: 999px;
    border: 1px solid var(--mst-primary, #c8a572);
    color: var(--mst-primary, #c8a572);
    background: transparent;
    text-decoration: none;
}
.book-toc-organize-btn:hover {
    background: var(--mst-primary, #c8a572);
    color: #fff;
    text-decoration: none;
}

/* Top: create-chapter bar */
.organize-top-bar {
    background: var(--mst-card);
    border: 1px solid var(--mst-border);
    border-radius: 14px;
    padding: 12px 16px;
    margin-bottom: 14px;
}
.organize-create-chapter {
    display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
}
.organize-create-chapter input[type="text"] {
    flex: 1 1 240px;
}
.organize-create-chapter .year-pick { flex: 0 0 110px; }
.organize-plus {
    font-size: 1.4rem;
    color: var(--mst-primary, #c8a572);
    font-weight: 700;
    line-height: 1;
}

/* Two-column split */
.organize-split {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
    gap: 14px;
}
@@media (max-width: 900px) {
    .organize-split { grid-template-columns: 1fr; }
}
.organize-col-title {
    font-family: 'Fraunces', Georgia, serif;
    font-weight: 600;
    margin-bottom: 10px;
}
.organize-empty-hint {
    color: var(--mst-muted, #6b6258);
    font-style: italic;
    padding: 12px;
    border: 1px dashed var(--mst-border);
    border-radius: 12px;
    text-align: center;
}

/* Chapter cards (left column) */
.organize-chapter-card {
    background: var(--mst-card);
    border: 1px solid var(--mst-border);
    border-radius: 12px;
    padding: 12px 14px;
    margin-bottom: 12px;
}
.organize-chapter-sub {
    background: rgba(200,165,114,0.05);
    border-style: dashed;
    margin-left: 18px;
    margin-top: 8px;
}
.organize-chapter-head {
    display: flex; align-items: center; gap: 8px;
    flex-wrap: wrap;
}
.organize-chapter-year {
    font-family: 'Fraunces', Georgia, serif;
    font-weight: 700;
    color: var(--mst-primary);
    flex: 0 0 auto;
    min-width: 3em;
}
.organize-chapter-title {
    font-family: 'Fraunces', Georgia, serif;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    background: transparent;
    flex: 1 1 auto;
    min-width: 100px;
    border-bottom: 1px solid transparent;
    padding: 2px 0;
}
.organize-chapter-title:focus {
    outline: none;
    border-bottom-color: var(--mst-primary);
}
.organize-chapter-meta {
    display: flex; align-items: center; justify-content: space-between;
    margin-top: 4px; margin-bottom: 6px;
}
.organize-unassigned-box {
    background: rgba(0,0,0,0.02);
    border-style: dotted;
}
.organize-unassigned-label {
    font-family: 'Fraunces', Georgia, serif;
    font-style: italic;
    color: var(--mst-muted, #6b6258);
}

/* Drop zones — flex-wrap so bubbles tile */
.organize-drop-zone {
    display: flex; flex-wrap: wrap; gap: 6px;
    min-height: 44px;
    padding: 8px;
    border-radius: 8px;
    background: rgba(0,0,0,0.02);
    transition: background .12s;
}
[data-theme="dark"] .organize-drop-zone { background: rgba(255,255,255,0.03); }
.organize-drop-zone.organize-drop-zone-source {
    background: transparent;
    padding: 4px 0;
    min-height: 0;
}

/* Subchapter add inline form */
.organize-add-sub {
    display: flex; gap: 6px; margin-top: 8px;
}
.organize-add-sub input[type="text"] { flex: 1; }

/* Subchapters container */
.organize-subs {
    margin-top: 4px;
}

/* Bubbles — small variant for cards (left), full variant for the library (right) */
.organize-bubble {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--mst-card);
    border: 1px solid var(--mst-border);
    border-radius: 999px;
    padding: 4px 10px 4px 4px;
    cursor: grab;
    user-select: none;
    transition: transform .1s, box-shadow .1s;
    position: relative;
}
.organize-bubble:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
.organize-bubble.organize-bubble-sm {
    padding: 2px 8px 2px 2px;
    font-size: 0.78rem;
}
.organize-bubble-art {
    width: 34px; height: 34px;
    border-radius: 50%;
    overflow: hidden;
    background: var(--mst-light, #f5efe6);
    display: inline-flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.organize-bubble.organize-bubble-sm img,
.organize-bubble.organize-bubble-sm .organize-bubble-icon {
    width: 26px; height: 26px;
    border-radius: 50%;
    overflow: hidden;
}
.organize-bubble.organize-bubble-sm img { object-fit: cover; }
.organize-bubble.organize-bubble-sm .organize-bubble-icon {
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--mst-light, #f5efe6);
    font-size: 0.9rem;
}
.organize-bubble-art img { width: 100%; height: 100%; object-fit: cover; }
.organize-bubble-icon { font-size: 1.1rem; }
.organize-bubble-title,
.organize-bubble-mini-title {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.organize-bubble-mini-title { max-width: 110px; }
.organize-bubble-badge {
    position: absolute;
    top: -4px; right: -4px;
    background: #2e7d4f;
    color: #fff;
    width: 16px; height: 16px;
    border-radius: 50%;
    font-size: 0.66rem;
    line-height: 16px;
    text-align: center;
    border: 1px solid #fff;
}
.organize-bubble[data-assigned="1"] {
    opacity: 0.78;
}
.organize-bubble-ghost {
    opacity: 0.4;
    background: rgba(200,165,114,0.15);
}
.organize-bubble-dragging {
    cursor: grabbing;
}
.organize-bubble.is-saving {
    opacity: 0.5;
    pointer-events: none;
}
.organize-bubble.is-hidden {
    opacity: 0.4;
    text-decoration: line-through;
    text-decoration-color: rgba(0,0,0,0.4);
}
.organize-bubble-hide-form {
    display: inline-flex;
    margin-left: 4px;
}
.organize-bubble-hide {
    border: none;
    background: transparent;
    padding: 0 2px;
    font-size: 0.78rem;
    cursor: pointer;
    color: var(--mst-muted, #6b6258);
    opacity: 0.6;
    transition: opacity .12s, transform .12s;
}
.organize-bubble-hide:hover {
    opacity: 1;
    transform: scale(1.15);
}

/* Auto-create-by-year button sits next to the create form */
.organize-top-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.organize-auto-year { margin-left: auto; }

/* Year piles on the right */
.organize-year-pile {
    border: 1px solid var(--mst-border);
    background: var(--mst-card);
    border-radius: 12px;
    padding: 10px 12px;
    margin-bottom: 10px;
}
.organize-year-pile-head {
    font-family: 'Fraunces', Georgia, serif;
    color: var(--mst-primary);
    margin-bottom: 6px;
}

/* ── Premium page (refreshed 2026-05-17) ────────────────────────
   Editorial replacement for the old feature-catalog dump. Two-tier
   side-by-side cards, then a sequence of restrained "what you get"
   sections, then a single CTA. Same editorial language as the
   landing and Start-here pages — quiet typography, gold accents
   sparingly, no card-chrome where whitespace will do. */
.premium-hero {
    padding: 36px 0 28px;
    border-bottom: 1px solid var(--mst-border);
    margin-bottom: 44px;
    /* NOTE: previously had isolation:isolate here. It forced the hero
       onto its own compositor layer, which in Chromium/Edge painted
       the italic title + subscription line OVER the sticky navbar.
       Removed — the hero is plain flow content above the plan cards,
       so it never needed its own stacking context. The nav is now
       layer-promoted (see .navbar transform) as the real safeguard. */
    position: relative;
    overflow: hidden;
}
.premium-hero-eyebrow {
    font-family: 'Inter', system-ui, sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.22em;
    font-size: 0.74rem;
    color: var(--mst-primary, #c8a572);
    margin-bottom: 12px;
}
.premium-hero-title {
    font-family: 'Cormorant Garamond', 'Fraunces', Georgia, serif;
    font-style: italic;
    font-weight: 600;
    font-size: clamp(1.5rem, 2.6vw, 2rem);
    letter-spacing: -0.005em;
    line-height: 1.5;
    margin: 0;
    color: var(--mst-text);
    display: block;
    overflow-wrap: break-word;
}
.premium-hero-lead {
    font-size: 1.04rem;
    line-height: 1.65;
    color: var(--mst-muted);
    max-width: 60ch;
    margin: 0;
}
.premium-hero-meta { color: var(--mst-muted); margin: 0; }

/* Two-tier plans, side by side */
.premium-plans {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin: 0 0 48px;
}
@media (max-width: 800px) { .premium-plans { grid-template-columns: 1fr; } }
.premium-plan {
    background: var(--mst-card);
    border: 1px solid var(--mst-border);
    border-radius: 16px;
    padding: 28px 28px 24px;
    display: flex;
    flex-direction: column;
}
.premium-plan-family {
    border-color: var(--mst-primary, #c8a572);
    background: linear-gradient(180deg, rgba(200,165,114,0.05), transparent 40%);
}
.premium-plan-eyebrow {
    font-family: 'Inter', system-ui, sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.22em;
    font-size: 0.72rem;
    color: var(--mst-primary, #c8a572);
    margin-bottom: 6px;
}
.premium-plan-price { margin-bottom: 10px; line-height: 1; }
.premium-plan-amount {
    font-family: 'Cormorant Garamond', 'Fraunces', Georgia, serif;
    font-style: italic;
    font-weight: 600;
    font-size: 2.6rem;
    color: var(--mst-text);
}
.premium-plan-period {
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 0.86rem;
    color: var(--mst-muted);
    margin-left: 4px;
}
.premium-plan-tagline {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-style: italic;
    font-size: 1.05rem;
    color: var(--mst-text);
    margin: 0 0 16px;
    border-bottom: 1px solid var(--mst-border);
    padding-bottom: 14px;
}
.premium-plan-features {
    list-style: none;
    padding: 0;
    margin: 0 0 22px;
    flex: 1 1 auto;
}
.premium-plan-features li {
    padding: 6px 0 6px 18px;
    position: relative;
    font-size: 0.94rem;
    line-height: 1.55;
    color: var(--mst-text);
}
.premium-plan-features li::before {
    content: "·";
    position: absolute;
    left: 0;
    color: var(--mst-primary, #c8a572);
    font-weight: 700;
    font-size: 1.4rem;
    line-height: 1.1;
}
.premium-plan-features strong { font-weight: 600; }
.premium-plan-cta {
    display: inline-block;
    padding: 12px 28px;
    border-radius: 10px;
    background: var(--mst-text);
    color: var(--mst-card);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.96rem;
    text-align: center;
    transition: opacity .12s;
}
.premium-plan-cta:hover { opacity: 0.88; color: var(--mst-card); }
.premium-plan-cta-family {
    background: var(--mst-primary, #c8a572);
    color: #fff;
}
.premium-plan-cta-family:hover { color: #fff; }
.premium-plan-current {
    font-style: italic;
    color: var(--mst-muted);
    font-size: 0.94rem;
}

/* Why-Family math callout */
.premium-math {
    background: rgba(200,165,114,0.06);
    border-left: 3px solid var(--mst-primary, #c8a572);
    padding: 20px 24px;
    margin: 0 0 48px;
    border-radius: 0 10px 10px 0;
}
.premium-math h3 {
    font-family: 'Cormorant Garamond', 'Fraunces', Georgia, serif;
    font-style: italic;
    font-weight: 600;
    font-size: 1.4rem;
    margin: 0 0 10px;
    color: var(--mst-text);
}
.premium-math p {
    margin: 0;
    line-height: 1.65;
    color: var(--mst-text);
    max-width: 60ch;
}

/* "What it looks like" three-pillar block */
.premium-glance {
    margin: 0 0 48px;
}
.premium-glance > h3 {
    font-family: 'Cormorant Garamond', 'Fraunces', Georgia, serif;
    font-style: italic;
    font-weight: 600;
    font-size: 1.6rem;
    margin: 0 0 8px;
    color: var(--mst-text);
}
.premium-glance-sub {
    color: var(--mst-muted);
    max-width: 60ch;
    margin: 0 0 24px;
    line-height: 1.6;
}
.premium-glance-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 36px;
}
@media (max-width: 800px) {
    .premium-glance-grid { grid-template-columns: 1fr; gap: 28px; }
}
.premium-glance-card .premium-glance-eyebrow {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-style: italic;
    font-size: 1.05rem;
    color: var(--mst-primary, #c8a572);
    margin-bottom: 6px;
}
.premium-glance-card h4 {
    font-family: 'Cormorant Garamond', 'Fraunces', Georgia, serif;
    font-style: italic;
    font-weight: 600;
    font-size: 1.25rem;
    margin: 0 0 10px;
    color: var(--mst-text);
}
.premium-glance-card p {
    margin: 0;
    color: var(--mst-muted);
    font-size: 0.94rem;
    line-height: 1.6;
    max-width: 32ch;
}

/* AI assistance block */
.premium-ai {
    margin: 0 0 48px;
}
.premium-ai h3 {
    font-family: 'Cormorant Garamond', 'Fraunces', Georgia, serif;
    font-style: italic;
    font-weight: 600;
    font-size: 1.5rem;
    margin: 0 0 14px;
    color: var(--mst-text);
}
.premium-ai p {
    color: var(--mst-text);
    line-height: 1.7;
    margin: 0 0 14px;
    max-width: 64ch;
    font-size: 1.02rem;
}
.premium-ai p:last-child { margin-bottom: 0; }
.premium-ai em { color: var(--mst-muted); }

/* Closing CTA */
.premium-closing {
    text-align: center;
    padding: 36px 16px 8px;
    margin: 0 0 36px;
}
.premium-closing h3 {
    font-family: 'Cormorant Garamond', 'Fraunces', Georgia, serif;
    font-style: italic;
    font-weight: 600;
    font-size: 1.7rem;
    color: var(--mst-text);
    margin: 0 0 10px;
}
.premium-closing p {
    color: var(--mst-muted);
    max-width: 48ch;
    margin: 0 auto 20px;
    line-height: 1.6;
}

/* Premium Services page (the ad-hoc catalog) */
.ps-hero {
    padding: 40px 0 28px;
    border-bottom: 1px solid var(--mst-border);
    margin-bottom: 36px;
    position: relative;
    isolation: isolate;
    overflow: hidden;
}
.ps-hero-eyebrow {
    font-family: 'Inter', system-ui, sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.22em;
    font-size: 0.74rem;
    color: var(--mst-primary, #c8a572);
    margin-bottom: 12px;
}
.ps-hero-title {
    font-family: 'Cormorant Garamond', 'Fraunces', Georgia, serif;
    font-style: italic;
    font-weight: 600;
    font-size: clamp(1.7rem, 3vw, 2.2rem);
    letter-spacing: -0.005em;
    line-height: 1.4;
    margin: 0 0 14px;
    color: var(--mst-text);
    display: block;
    overflow-wrap: break-word;
}
.ps-hero-lead {
    color: var(--mst-muted);
    line-height: 1.65;
    max-width: 62ch;
    margin: 0;
    font-size: 1.02rem;
}
.ps-section { margin: 0 0 40px; }
.ps-section-name {
    font-family: 'Cormorant Garamond', 'Fraunces', Georgia, serif;
    font-style: italic;
    font-weight: 600;
    font-size: 1.4rem;
    color: var(--mst-primary, #c8a572);
    margin: 0 0 18px;
    letter-spacing: -0.005em;
}
.ps-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
@media (max-width: 800px) { .ps-grid { grid-template-columns: 1fr; } }
.ps-card-link {
    text-decoration: none;
    color: inherit;
    display: block;
    height: 100%;
}
.ps-card {
    background: var(--mst-card);
    border: 1px solid var(--mst-border);
    border-radius: 12px;
    padding: 22px 24px;
    height: 100%;
    transition: transform .12s, border-color .12s, box-shadow .12s;
    display: flex;
    flex-direction: column;
}
.ps-card-link:hover .ps-card {
    border-color: var(--mst-primary, #c8a572);
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(0,0,0,0.06);
}
.ps-card-eyebrow {
    font-size: 1.4rem;
    margin-bottom: 8px;
    color: var(--mst-primary, #c8a572);
}
.ps-card-name {
    font-family: 'Cormorant Garamond', 'Fraunces', Georgia, serif;
    font-style: italic;
    font-weight: 600;
    font-size: 1.2rem;
    color: var(--mst-text);
    margin: 0 0 8px;
}
.ps-card-desc {
    color: var(--mst-muted);
    font-size: 0.92rem;
    line-height: 1.55;
    margin: 0 0 14px;
    flex: 1 1 auto;
}
.ps-card-arrow {
    font-family: 'Inter', system-ui, sans-serif;
    color: var(--mst-primary, #c8a572);
    font-size: 0.82rem;
    font-weight: 600;
}
.ps-closing {
    text-align: center;
    padding: 36px 16px 16px;
    border-top: 1px solid var(--mst-border);
    margin-top: 16px;
}
.ps-closing h3 {
    font-family: 'Cormorant Garamond', 'Fraunces', Georgia, serif;
    font-style: italic;
    font-weight: 600;
    font-size: 1.6rem;
    color: var(--mst-text);
    margin: 0 0 10px;
}
.ps-closing p {
    color: var(--mst-muted);
    max-width: 52ch;
    margin: 0 auto 20px;
    line-height: 1.6;
}

/* Premium Services pointer at the bottom of the Premium page */
.premium-services-pointer {
    text-align: center;
    padding: 28px 16px;
    margin-top: 16px;
    border-top: 1px solid var(--mst-border);
}
.premium-services-pointer p {
    color: var(--mst-muted);
    max-width: 56ch;
    margin: 0 auto 8px;
    font-size: 0.94rem;
    line-height: 1.5;
}
.premium-services-pointer a {
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 0.86rem;
    color: var(--mst-primary, #c8a572);
    text-decoration: none;
    font-weight: 600;
}
.premium-services-pointer a:hover { text-decoration: underline; }

/* ── Page header (shared) ─────────────────────────────────────────
   Editorial header used on logged-in surfaces — Connections, People
   profiles, Eras, etc. Eyebrow + italic serif title + restrained
   lead paragraph, optional CTA on the right. */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    flex-wrap: wrap;
    padding: 28px 0 24px;
    border-bottom: 1px solid var(--mst-border);
    margin: 16px 0 28px;
    scroll-margin-top: 110px;
    position: relative;
    z-index: 0;
}
.page-header-titles { min-width: 0; max-width: 60ch; }
.page-header-eyebrow {
    font-family: 'Inter', system-ui, sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.22em;
    font-size: 0.72rem;
    color: var(--mst-primary, #c8a572);
    margin: 0 0 10px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.page-header-title {
    font-family: 'Cormorant Garamond', 'Fraunces', Georgia, serif;
    font-style: italic;
    font-weight: 600;
    font-size: clamp(1.5rem, 3vw, 2rem);
    line-height: 1.4;
    color: var(--mst-text);
    margin: 0 0 8px;
    letter-spacing: -0.005em;
    overflow-wrap: break-word;
}
.page-header-lead {
    color: var(--mst-muted);
    line-height: 1.6;
    margin: 0;
    font-size: 0.98rem;
}

/* ── Empty state helper ───────────────────────────────────────────
   Used on every page that can be empty (Eras, Era map, Profiles,
   Book, Organize). Single look across the product so the user
   recognises "nothing here yet, here's how to start." */
.empty-state {
    padding: 48px 24px;
}
.empty-state .empty-state-mark {
    font-size: 2.6rem;
    line-height: 1;
    margin-bottom: 4px;
}
.empty-state h4 {
    font-family: 'Fraunces', Georgia, serif;
    font-weight: 600;
    color: var(--mst-text);
    margin: 0;
}
.empty-state p {
    max-width: 38ch;
    margin-left: auto;
    margin-right: auto;
}

/* ── Connections hub ──────────────────────────────────────────────
   Three editorial pillars that gather Profiles, Eras, Era map under
   a single nav entry. Restrained typography, roman-numeral eyebrows,
   no emoji-as-icon. Same voice as the landing and Premium pages. */
.connections-hero {
    padding: 24px 0 24px;
    border-bottom: 1px solid var(--mst-border);
    margin-bottom: 32px;
}
.connections-hero-eyebrow {
    font-family: 'Inter', system-ui, sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.22em;
    font-size: 0.72rem;
    color: var(--mst-primary, #c8a572);
    margin: 0 0 10px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.connections-hero-title {
    font-family: 'Cormorant Garamond', 'Fraunces', Georgia, serif;
    font-style: italic;
    font-weight: 600;
    font-size: clamp(1.6rem, 3.5vw, 2.2rem);
    color: var(--mst-text);
    margin: 0 0 10px;
    letter-spacing: -0.005em;
}
.connections-hero-lead {
    color: var(--mst-muted);
    line-height: 1.6;
    max-width: 56ch;
    margin: 0;
    font-size: 1.0rem;
}
.connections-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}
.connections-tile {
    display: block;
    padding: 22px 24px 20px;
    background: var(--mst-card);
    border: 1px solid var(--mst-border);
    border-radius: 14px;
    text-decoration: none;
    color: var(--mst-text);
    transition: transform .12s, box-shadow .12s, border-color .12s;
    min-height: 168px;
}
.connections-tile:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(0,0,0,0.08);
    border-color: var(--mst-primary, #c8a572);
    color: var(--mst-text);
}
.connections-tile-eyebrow {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-style: italic;
    font-size: 1.1rem;
    color: var(--mst-primary, #c8a572);
    letter-spacing: 0.08em;
    margin-bottom: 8px;
}
.connections-tile-body { min-width: 0; }
.connections-tile-title {
    font-family: 'Cormorant Garamond', 'Fraunces', Georgia, serif;
    font-style: italic;
    font-weight: 600;
    font-size: 1.4rem;
    margin: 0 0 10px;
    color: var(--mst-text);
    letter-spacing: -0.005em;
}
.connections-tile-desc {
    font-size: 0.94rem;
    color: var(--mst-muted, #6b6258);
    line-height: 1.55;
    margin: 0;
}
.connections-tile-stat {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--mst-border);
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 0.78rem;
    color: var(--mst-primary, #c8a572);
    letter-spacing: 0.02em;
    text-transform: uppercase;
    font-weight: 600;
}

/* ── Life Chapters ────────────────────────────────────────────────
   The Index list — one card per chapter with member avatars. */
.chapter-list {
    display: flex; flex-direction: column; gap: 12px;
}
.chapter-card {
    background: var(--mst-card);
    border: 1px solid var(--mst-border);
    border-left: 4px solid #777;
    border-radius: 12px;
    padding: 14px 16px;
}
.chapter-card[data-category="Work"]         { border-left-color: #4a7fb0; }
.chapter-card[data-category="School"]       { border-left-color: #c97b3f; }
.chapter-card[data-category="University"]   { border-left-color: #8a4a8a; }
.chapter-card[data-category="Religious"]    { border-left-color: #6f60a8; }
.chapter-card[data-category="Hobby"]        { border-left-color: #2e7d4f; }
.chapter-card[data-category="Neighborhood"] { border-left-color: #b08a3d; }
.chapter-card[data-category="Online"]       { border-left-color: #3a8a8a; }
.chapter-card[data-category="Travel"]       { border-left-color: #c97b3f; }
.chapter-card[data-category="Family"]       { border-left-color: #a94442; }
.chapter-card-head {
    display: flex; justify-content: space-between; align-items: flex-start;
    gap: 12px; flex-wrap: wrap;
}
.chapter-card-title-group {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 8px;
    min-width: 0;
    flex: 1 1 auto;
}
.chapter-card-name { font-weight: 700; font-size: 1.02rem; }
.chapter-card-years {
    font-family: 'Fraunces', Georgia, serif;
    font-size: 0.86rem;
    color: var(--mst-primary);
    font-variant-numeric: tabular-nums;
    background: rgba(200,165,114,0.10);
    padding: 1px 8px;
    border-radius: 999px;
}
.chapter-card-roster {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 6px;
}
.chapter-card-count {
    flex: 0 0 auto;
    font-style: italic;
}
.chapter-cat-tag {
    display: inline-block;
    font-size: 0.66rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.06em;
    padding: 1px 6px; border-radius: 8px;
    color: #fff; background: #777;
}
.chapter-cat-tag[data-category="Work"]         { background: #4a7fb0; }
.chapter-cat-tag[data-category="School"]       { background: #c97b3f; }
.chapter-cat-tag[data-category="University"]   { background: #8a4a8a; }
.chapter-cat-tag[data-category="Religious"]    { background: #6f60a8; }
.chapter-cat-tag[data-category="Hobby"]        { background: #2e7d4f; }
.chapter-cat-tag[data-category="Neighborhood"] { background: #b08a3d; }
.chapter-cat-tag[data-category="Online"]       { background: #3a8a8a; }
.chapter-cat-tag[data-category="Travel"]       { background: #c97b3f; }
.chapter-cat-tag[data-category="Family"]       { background: #a94442; }

.chapter-card-avatars {
    display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px;
}
.chapter-avatar {
    width: 36px; height: 36px; border-radius: 50%;
    overflow: hidden; display: inline-flex; align-items: center; justify-content: center;
    background: var(--mst-light, #f5efe6);
    color: var(--mst-primary); font-weight: 800; font-size: 0.78rem;
    text-decoration: none; border: 1px solid var(--mst-border);
}
.chapter-avatar img { width: 100%; height: 100%; object-fit: cover; }
.chapter-avatar.more {
    background: var(--mst-border, #e9e3d7);
    color: var(--mst-muted, #6b6258);
    font-weight: 700;
    font-size: 0.72rem;
}

/* The member picker on the chapter form. Cards toggle a checked
   state via the hidden checkbox so the parent label is the click
   surface. */
.chapter-member-picker {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 10px;
}
.chapter-member-choice {
    display: flex; flex-direction: column; align-items: center; gap: 6px;
    padding: 8px; border: 1px solid var(--mst-border);
    border-radius: 10px; cursor: pointer; text-align: center;
    background: var(--mst-card);
    transition: border-color .12s, transform .12s, box-shadow .12s;
}
.chapter-member-choice input { display: none; }
.chapter-member-choice:has(input:checked) {
    border-color: var(--mst-primary, #c8a572);
    box-shadow: 0 0 0 2px rgba(200,165,114,0.25);
}
.chapter-member-bubble {
    width: 56px; height: 56px; border-radius: 50%;
    overflow: hidden; display: inline-flex; align-items: center; justify-content: center;
    background: var(--mst-light, #f5efe6);
    color: var(--mst-primary); font-weight: 800; font-size: 1.1rem;
}
.chapter-member-bubble img { width: 100%; height: 100%; object-fit: cover; }
.chapter-member-name {
    font-size: 0.82rem; line-height: 1.2; overflow-wrap: anywhere;
}

/* ── Groups (Family / Friends / Mixed) ───────────────────────────
   Class is still 'FamilyGroup' in code for DB reasons; user-facing
   label is 'Group'. Cards mirror the chapter-card pattern so the
   editorial palette stays consistent across surfaces. */
.group-list {
    display: flex; flex-direction: column; gap: 12px;
}
.group-card {
    display: block;
    background: var(--mst-card);
    border: 1px solid var(--mst-border);
    border-left: 4px solid #777;
    border-radius: 12px;
    padding: 14px 16px;
    text-decoration: none;
    color: var(--mst-text);
    transition: border-color .12s, transform .12s, box-shadow .12s;
}
.group-card:hover {
    border-left-color: var(--mst-primary, #c8a572);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
    color: var(--mst-text);
}
.group-card[data-kind="Family"]  { border-left-color: #a94442; }
.group-card[data-kind="Friends"] { border-left-color: #4a7fb0; }
.group-card[data-kind="Mixed"]   { border-left-color: #8a4a8a; }

.group-card-head {
    display: flex; justify-content: space-between; align-items: flex-start;
    gap: 12px; flex-wrap: wrap;
}
.group-card-title-group {
    display: flex; align-items: baseline; flex-wrap: wrap;
    gap: 8px; min-width: 0; flex: 1 1 auto;
}
.group-card-name { font-weight: 700; font-size: 1.05rem; }
.group-card-role {
    font-size: 0.7rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.08em;
    padding: 2px 8px; border-radius: 999px;
    color: var(--mst-muted, #6b6258);
    background: var(--mst-light, #f5efe6);
    border: 1px solid var(--mst-border);
    white-space: nowrap;
}
.group-card-desc { margin: 4px 0 0; }
.group-card-count { font-style: italic; margin-top: 2px; }
.group-kind-tag {
    display: inline-block;
    font-size: 0.66rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.06em;
    padding: 1px 6px; border-radius: 8px;
    color: #fff; background: #777;
}
.group-kind-tag[data-kind="Family"]  { background: #a94442; }
.group-kind-tag[data-kind="Friends"] { background: #4a7fb0; }
.group-kind-tag[data-kind="Mixed"]   { background: #8a4a8a; }

/* Kind selector — three radio-card options on Create / Edit. */
.kind-choice {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
}
.kind-choice-option {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 12px 14px; border: 1px solid var(--mst-border);
    border-radius: 10px; cursor: pointer; background: var(--mst-card);
    transition: border-color .12s, box-shadow .12s;
    margin: 0;
}
.kind-choice-option input[type="radio"] {
    margin-top: 3px; flex-shrink: 0;
    accent-color: var(--mst-primary, #c8a572);
}
.kind-choice-option:has(input:checked) {
    border-color: var(--mst-primary, #c8a572);
    box-shadow: 0 0 0 2px rgba(200,165,114,0.18);
}
.kind-choice-label { display: flex; flex-direction: column; gap: 2px; }
.kind-choice-title { font-weight: 700; font-size: 0.96rem; }
.kind-choice-sub {
    font-size: 0.82rem; color: var(--mst-muted, #6b6258); line-height: 1.3;
}

/* ── Life Map (bubble timeline) ──────────────────────────────────
   The canvas is absolutely-positioned content inside a scroll box.
   pxPerYear in JS drives every horizontal coordinate. */
.lifemap-wrap {
    background: var(--mst-card);
    border: 1px solid var(--mst-border);
    border-radius: 14px;
    padding: 14px;
}
.lifemap-categories {
    display: flex; flex-wrap: wrap; gap: 4px; align-items: center;
}
.lifemap-cat-pill {
    border: 1px solid var(--mst-border);
    background: transparent;
    color: var(--mst-text);
    border-radius: 999px;
    padding: 2px 10px;
    font-size: 0.78rem;
    cursor: pointer;
}
.lifemap-cat-pill.active {
    background: var(--mst-primary, #c8a572);
    color: #fff;
    border-color: var(--mst-primary, #c8a572);
}
.lifemap-scroll {
    overflow-x: auto;
    overflow-y: hidden;
    cursor: grab;
    background:
      repeating-linear-gradient(90deg,
        transparent 0,
        transparent 27px,
        rgba(0,0,0,0.03) 27px,
        rgba(0,0,0,0.03) 28px);
    border-radius: 10px;
}
.lifemap-canvas {
    position: relative;
    /* width + height set inline by JS */
}
.lifemap-axis {
    position: absolute; top: 0; left: 0; right: 0;
    border-bottom: 1px solid var(--mst-border);
}
.lifemap-tick {
    position: absolute; top: 0; bottom: 0;
    width: 1px;
}
.lifemap-tick.major  { background: rgba(0,0,0,0.18); }
.lifemap-tick.minor  { background: rgba(0,0,0,0.08); }
.lifemap-tick.faint  { background: transparent; }
.lifemap-tick-label {
    position: absolute; top: 2px; left: 3px;
    font-size: 0.72rem; color: var(--mst-muted, #6b6258);
    font-family: 'Fraunces', Georgia, serif;
}
.lifemap-today {
    position: absolute;
    width: 2px;
    background: rgba(200, 70, 70, 0.55);
}
.lifemap-today span {
    position: absolute; top: -2px; left: 4px;
    font-size: 0.7rem; color: rgba(200, 70, 70, 0.9);
    background: var(--mst-card);
    padding: 0 4px; border-radius: 4px;
}
.lifemap-bubble {
    position: absolute;
    border: 2px solid #777;
    border-radius: 18px;
    padding: 6px 10px;
    box-sizing: border-box;
    cursor: pointer;
    transition: transform .12s, box-shadow .12s;
    display: flex; flex-direction: column; gap: 4px;
    overflow: hidden;
}
.lifemap-bubble:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(0,0,0,0.12);
    z-index: 5;
}
.lifemap-bubble.ongoing {
    border-right-style: dashed;
}
.lifemap-bubble-label {
    font-size: 0.82rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    pointer-events: none;
}
.lifemap-avatars {
    display: flex; flex-direction: row; gap: 4px; align-items: center;
    flex: 1; min-height: 0; overflow: hidden;
}
.lifemap-avatar {
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 50%; overflow: hidden;
    background: var(--mst-light, #f5efe6);
    color: var(--mst-primary); font-weight: 800;
    border: 1px solid rgba(0,0,0,0.08);
    flex: 0 0 auto;
    text-decoration: none;
}
.lifemap-avatar img { width: 100%; height: 100%; object-fit: cover; }
.lifemap-avatar.more {
    background: rgba(0,0,0,0.08); color: var(--mst-muted, #6b6258);
    font-size: 0.78rem; text-align: center;
}

/* Detail panel under the canvas, fed by clicking a bubble. */
.lifemap-detail .lifemap-member {
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    text-decoration: none; color: var(--mst-text);
    width: 90px; text-align: center;
}
.lifemap-detail .lifemap-member-name {
    font-size: 0.82rem; line-height: 1.2;
}

/* Profile detail header — bigger avatar + meta on the left, action
   buttons on the right. */
.person-detail-head {
    display: flex;
    align-items: flex-start;
    gap: 18px;
    flex-wrap: wrap;
}
.person-detail-avatar { width: 88px; height: 88px; flex-shrink: 0; }
.person-detail-avatar img,
.person-detail-initials {
    width: 88px; height: 88px;
    border-radius: 50%;
    object-fit: cover;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--mst-light, #f5efe6);
    color: var(--mst-primary);
    font-weight: 800;
    font-size: 1.6rem;
}
.person-detail-meta { flex: 1; min-width: 0; }
.person-detail-name {
    font-family: 'Fraunces', 'Cormorant Garamond', Georgia, serif;
    font-weight: 700;
    font-size: 1.8rem;
    color: var(--mst-text);
    margin: 0;
    line-height: 1.1;
}
.person-detail-relation {
    color: var(--mst-muted);
    font-style: italic;
    margin-top: 2px;
}
.person-detail-range {
    color: var(--mst-primary);
    font-family: 'Fraunces', 'Cormorant Garamond', Georgia, serif;
    margin-top: 6px;
    letter-spacing: 0.04em;
}
.person-detail-places > div { margin-top: 4px; }
.person-detail-linked {
    background: rgba(34,139,34,0.10);
    color: #2a7a2a;
    border: 1px solid rgba(34,139,34,0.25);
    border-radius: 999px;
    padding: 4px 12px;
    font-size: 0.82rem;
    font-weight: 600;
    display: inline-block;
}
.person-detail-actions { flex-shrink: 0; }
.person-detail-bio {
    background: rgba(160,110,60,0.06);
    border-left: 3px solid rgba(160,110,60,0.5);
    padding: 12px 16px;
    border-radius: 8px;
    line-height: 1.55;
}
[data-theme="dark"] .person-detail-bio { background: rgba(217,199,154,0.08); }
@media (max-width: 575px) {
    .media-tile-row { flex-direction: column; align-items: center; }
    .media-layout-panel { align-items: center; }
}

/* "Connect your memory to this story" — call-to-action that appears at
   the bottom of channel articles, inviting readers to write their own
   memory of the event. The new memory carries an "inspired by" chip
   linking back, and the source article surfaces a count of connected
   memories. Designed to feel like a quiet invitation, not a hard CTA —
   it's editorial, not marketing. */
.connect-memory-bar {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 18px 20px;
    border-top: 1px solid var(--mst-border);
    border-bottom: 1px solid var(--mst-border);
    background: rgba(160,110,60,0.05);
}
.connect-memory-btn {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    border-radius: 10px;
    border: 1px dashed rgba(160,110,60,0.5);
    background: rgba(255,255,255,0.5);
    color: var(--mst-text);
    text-decoration: none;
    transition: background-color .15s, border-color .15s, transform .12s;
}
.connect-memory-btn:hover {
    background: rgba(255,255,255,0.85);
    border-color: var(--mst-accent);
    color: var(--mst-text);
    transform: translateY(-1px);
}
[data-theme="dark"] .connect-memory-btn {
    background: rgba(255,255,255,0.04);
    border-color: rgba(217,199,154,0.30);
}
[data-theme="dark"] .connect-memory-btn:hover {
    background: rgba(255,255,255,0.08);
    border-color: var(--mst-accent);
}
.connect-memory-icon { font-size: 1.4rem; flex-shrink: 0; }
.connect-memory-label { display: flex; flex-direction: column; gap: 2px; }
.connect-memory-title { font-weight: 600; font-size: 0.98rem; }
.connect-memory-sub { font-size: 0.78rem; color: var(--mst-muted); }
.connect-memory-count {
    align-self: flex-end;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--mst-primary);
    text-decoration: none;
}
.connect-memory-count:hover { text-decoration: underline; }

/* Inline chip on the home-feed channel card — quieter than the full
   "Connect your memory" CTA on the detail page, but still discoverable. */
.connect-memory-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    padding: 4px 12px;
    border-radius: 999px;
    background: rgba(160,110,60,0.08);
    border: 1px solid rgba(160,110,60,0.30);
    color: var(--mst-primary);
    font-size: 0.78rem;
    font-weight: 600;
    text-decoration: none;
}
.connect-memory-chip:hover {
    background: rgba(160,110,60,0.18);
    color: var(--mst-primary);
}
.connect-memory-chip-icon { opacity: 0.85; }

/* Flag-button language picker (Profile → Look & language). Two big
   tappable buttons, side by side, with the active one outlined. */
.lang-flag-picker {
    display: inline-flex;
    gap: 8px;
    flex-wrap: wrap;
}
.lang-flag-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 12px;
    border: 2px solid var(--mst-border);
    background: #fff;
    color: var(--mst-text);
    cursor: pointer;
    font-size: 0.92rem;
    font-weight: 600;
    transition: border-color .12s, background-color .12s, transform .12s;
}
.lang-flag-btn:hover {
    border-color: var(--mst-primary);
    transform: translateY(-1px);
}
.lang-flag-btn.is-active {
    border-color: var(--mst-primary);
    background: rgba(160,110,60,0.08);
    color: var(--mst-primary);
}
.lang-flag-btn .lang-flag {
    /* legacy — flags removed; kept so any old markup still renders. */
    font-size: 1.4rem;
    line-height: 1;
}

/* ── Mobile side drawer ─────────────────────────────────────────────
   Replaces the bootstrap navbar collapse on phones. The hamburger
   slides this in from the right; backdrop catches taps outside. */
.kron-drawer-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 1050;
    opacity: 0;
    transition: opacity .2s ease;
}
.kron-drawer-backdrop.is-open { opacity: 1; }
.kron-drawer {
    position: fixed;
    top: 0; right: 0; bottom: 0;
    width: 86%;
    max-width: 340px;
    background: var(--mst-surface, #fbf7ef);
    box-shadow: -10px 0 28px rgba(0,0,0,0.18);
    z-index: 1051;
    transform: translateX(100%);
    transition: transform .25s ease-out;
    display: flex;
    flex-direction: column;
    /* iOS notch / Dynamic Island — bleed safe-area inset onto the drawer
       itself so the header sits under the status bar correctly. */
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
}
.kron-drawer.is-open { transform: translateX(0); }
[data-theme="dark"] .kron-drawer {
    background: #1d1b16;
    box-shadow: -10px 0 28px rgba(0,0,0,0.5);
}
.kron-drawer-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    padding: 18px 20px 14px;
    border-bottom: 1px solid var(--mst-border);
    background: transparent;
    color: var(--mst-text);
}
.kron-drawer-title {
    font-weight: 600;
    font-family: 'Cormorant Garamond', 'Fraunces', Georgia, serif;
    font-style: italic;
    font-size: 1.55rem;
    letter-spacing: 0.005em;
    color: var(--mst-text);
}
.kron-drawer-close {
    background: none;
    border: none;
    color: var(--mst-muted, #8a8170);
    font-size: 1.75rem;
    line-height: 1;
    padding: 0 6px;
    cursor: pointer;
    transition: color .12s;
}
.kron-drawer-close:hover { color: var(--mst-text); }
.kron-drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 6px 0 18px 0;
    -webkit-overflow-scrolling: touch;
}
.kron-drawer-link {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 20px;
    min-height: 48px;
    color: var(--mst-text);
    text-decoration: none;
    border-bottom: 1px solid rgba(0,0,0,0.04);
    font-size: 0.98rem;
    width: 100%;
    background: none;
    border-left: none;
    border-right: none;
    border-top: none;
    text-align: left;
    cursor: pointer;
    transition: background-color .12s, color .12s;
}
.kron-drawer-link:hover,
.kron-drawer-link:active {
    background: rgba(160,110,60,0.08);
    color: var(--mst-primary);
}
[data-theme="dark"] .kron-drawer-link {
    border-bottom-color: rgba(255,255,255,0.06);
    color: var(--mst-text);
}
[data-theme="dark"] .kron-drawer-link:hover,
[data-theme="dark"] .kron-drawer-link:active {
    background: rgba(217,199,154,0.10);
    color: var(--mst-accent);
}
.kron-drawer-link svg { color: var(--mst-primary); flex-shrink: 0; }
[data-theme="dark"] .kron-drawer-link svg { color: var(--mst-accent); }
.kron-drawer-icon-emoji {
    width: 22px;
    text-align: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}
/* Eyebrow label between the primary nav and the secondary text links.
   Mirrors .page-header-eyebrow so the drawer reads as part of the same
   editorial system as the page surfaces. */
.kron-drawer-section {
    font-family: 'Inter', system-ui, sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.22em;
    font-size: 0.68rem;
    color: var(--mst-primary, #c8a572);
    margin: 18px 20px 4px;
    padding: 0;
}
[data-theme="dark"] .kron-drawer-section { color: var(--mst-accent); }
/* Text-only links (no SVG) — sit under the eyebrow. Indent so the label
   lines up with the text of the icon-bearing links above, and drop weight
   so they read as secondary. */
.kron-drawer-link-text {
    padding-left: 56px;
    padding-top: 12px;
    padding-bottom: 12px;
    min-height: 44px;
    font-size: 0.94rem;
    color: var(--mst-muted, #6c6557);
    border-bottom-color: transparent;
}
.kron-drawer-link-text:hover,
.kron-drawer-link-text:active {
    color: var(--mst-primary);
    background: rgba(160,110,60,0.06);
}
[data-theme="dark"] .kron-drawer-link-text { color: var(--mst-muted, #b3a98f); }
.kron-drawer-divider {
    margin: 12px 20px;
    border-color: var(--mst-border);
    opacity: 0.6;
}
.kron-drawer-logout-form { margin: 0; padding: 0; }
.kron-drawer-logout {
    color: #b34141 !important;
}
.kron-drawer-logout:hover {
    background: rgba(179,65,65,0.08) !important;
    color: #b34141 !important;
}
/* Lock body scroll while drawer is open so the page underneath
   doesn't scroll behind the panel. */
body.kron-drawer-open { overflow: hidden; }
@media (min-width: 768px) {
    /* Drawer is mobile-only — never shows on tablet/desktop. */
    .kron-drawer,
    .kron-drawer-backdrop { display: none !important; }
}

/* Translate button: standard blue globe everywhere it appears so the
   icon reads as "translate" without ambiguity. */
.translate-globe svg {
    color: #1e90ff;
    stroke: #1e90ff;
    fill: none;
}
.translate-globe:hover svg {
    color: #0d6efd;
    stroke: #0d6efd;
}
[data-theme="dark"] .lang-flag-btn {
    background: rgba(255,255,255,0.05);
    border-color: rgba(217,212,197,0.18);
    color: var(--mst-text);
}
[data-theme="dark"] .lang-flag-btn.is-active {
    background: rgba(217,199,154,0.14);
    border-color: var(--mst-accent);
    color: var(--mst-accent);
}
[data-theme="dark"] .connect-memory-chip {
    background: rgba(217,199,154,0.10);
    border-color: rgba(217,199,154,0.30);
    color: var(--mst-accent);
}

/* "Inspired by" chip on a post that's a memory of another story —
   sits in the post header next to the channel/bio strips. */
.memory-of-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(160,110,60,0.10);
    border: 1px solid rgba(160,110,60,0.30);
    color: inherit;
    font-size: 0.82rem;
}
.memory-of-chip:hover {
    background: rgba(160,110,60,0.18);
    color: inherit;
}
.memory-of-chip-icon { opacity: 0.8; }
.memory-of-chip-label { color: var(--mst-muted); }
.memory-of-chip-name { font-weight: 600; }

/* Banner shown at the top of the Create form when the writer arrived
   via "Connect your memory" — reminds them what they're responding to. */
.memory-of-banner {
    display: flex;
    gap: 14px;
    padding: 14px 18px;
    border-radius: 10px;
    background: rgba(160,110,60,0.08);
    border: 1px solid rgba(160,110,60,0.30);
}
.memory-of-banner .memory-of-icon { font-size: 1.6rem; }
.memory-of-banner .memory-of-text { flex: 1; min-width: 0; }
[data-theme="dark"] .memory-of-banner {
    background: rgba(217,199,154,0.08);
    border-color: rgba(217,199,154,0.25);
}

/* ── Direct messages ───────────────────────────────────────────────────
   Three goals for the chat surface:
   1. Reads instantly as "messages app" (header + scrolling thread + bottom
      composer + bubbles), not a generic card with a list.
   2. Bubbles align by author — me right, them left — with avatars only on
      the first row of a sender's run.
   3. Day dividers separate runs across days; consecutive same-day messages
      from the same sender stack tightly.                                */
.chat-card {
    display: flex;
    flex-direction: column;
    height: 78vh;
    min-height: 500px;
    background: #fff;
    border: 1px solid var(--mst-border);
    border-radius: 16px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.06);
    overflow: hidden;
}
[data-theme="dark"] .chat-card {
    background: #1d1b16;
    border-color: rgba(217,212,197,0.15);
}
.chat-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--mst-border);
    background: linear-gradient(180deg, rgba(255,255,255,0.95), rgba(255,255,255,0.85));
    flex-shrink: 0;
}
[data-theme="dark"] .chat-header {
    background: linear-gradient(180deg, rgba(34,31,23,0.95), rgba(34,31,23,0.8));
}
.chat-back-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px; height: 36px;
    border-radius: 50%;
    background: var(--mst-light, #f5efe6);
    color: var(--mst-primary);
    text-decoration: none;
    font-size: 1.2rem;
    line-height: 1;
    flex-shrink: 0;
    transition: background-color .12s;
}
.chat-back-btn:hover { background: rgba(160,110,60,0.20); color: var(--mst-primary); }
.chat-header-user { display: flex; align-items: center; gap: 10px; min-width: 0; }
.chat-header-text { display: flex; flex-direction: column; min-width: 0; }
.chat-header-name {
    font-weight: 700;
    color: var(--mst-text);
    line-height: 1.2;
    font-size: 1rem;
}
.chat-header-name:hover { color: var(--mst-primary); }
.chat-header-username { color: var(--mst-muted); font-size: 0.78rem; }

/* The scrolling thread itself — slightly tinted background separates it
   visually from the header/composer surfaces. */
.chat-thread {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 18px 18px 4px 18px;
    background: #f7f5ef;
    background-image:
        radial-gradient(circle at 1px 1px, rgba(160,110,60,0.06) 1px, transparent 1px);
    background-size: 24px 24px;
}
[data-theme="dark"] .chat-thread {
    background: #14110d;
    background-image:
        radial-gradient(circle at 1px 1px, rgba(217,199,154,0.05) 1px, transparent 1px);
}

/* Empty state in an open conversation */
.chat-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--mst-muted);
    text-align: center;
    padding: 40px 20px;
}
.chat-empty-icon { font-size: 2.4rem; margin-bottom: 8px; opacity: 0.6; }
.chat-empty-title { font-weight: 600; color: var(--mst-text); margin-bottom: 4px; }
.chat-empty-sub { font-size: 0.88rem; }

/* Day divider — small chip in the centre of a thin line */
.chat-day-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 18px 0 10px 0;
    color: var(--mst-muted);
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.chat-day-divider::before,
.chat-day-divider::after {
    content: ""; flex: 1; height: 1px; background: var(--mst-border);
}
.chat-day-divider span { font-weight: 600; }

/* One message row — me on the right, them on the left.
   Continuation rows tighten the vertical spacing and skip the avatar. */
.chat-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    margin-bottom: 12px;
}
.chat-row.is-continuation { margin-top: -8px; }
.chat-row.is-me {
    justify-content: flex-end;
}
.chat-row.is-them {
    justify-content: flex-start;
}
.chat-avatar-slot {
    width: 32px; height: 32px;
    flex-shrink: 0;
    display: flex;
    align-items: flex-end;
}
.chat-avatar-fallback {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: var(--mst-light, #f5efe6);
    color: var(--mst-primary);
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: 700;
    font-size: 0.78rem;
}
.chat-bubble-group {
    display: flex;
    flex-direction: column;
    max-width: 70%;
    min-width: 0;
}
.chat-row.is-me .chat-bubble-group { align-items: flex-end; }
.chat-row.is-them .chat-bubble-group { align-items: flex-start; }
.chat-bubble {
    padding: 9px 14px;
    border-radius: 18px;
    line-height: 1.45;
    font-size: 0.95rem;
    word-wrap: break-word;
    overflow-wrap: anywhere;
    box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}
.chat-row.is-me .chat-bubble {
    background: var(--mst-primary);
    color: #fff;
    border-radius: 18px 18px 4px 18px;
}
.chat-row.is-them .chat-bubble {
    background: #fff;
    color: var(--mst-text);
    border: 1px solid var(--mst-border);
    border-radius: 18px 18px 18px 4px;
}
[data-theme="dark"] .chat-row.is-them .chat-bubble {
    background: #2a2620;
    border-color: rgba(217,212,197,0.15);
    color: var(--mst-text);
}
.chat-row.is-continuation.is-me .chat-bubble { border-radius: 18px 4px 4px 18px; }
.chat-row.is-continuation.is-them .chat-bubble { border-radius: 4px 18px 18px 4px; }
.chat-time {
    font-size: 0.7rem;
    color: var(--mst-muted);
    margin-top: 3px;
    padding: 0 4px;
}
.chat-row.is-continuation .chat-time { display: none; }

/* Composer at the bottom: rounded textarea + circular send button */
.chat-composer {
    flex-shrink: 0;
    padding: 10px 12px 12px 12px;
    border-top: 1px solid var(--mst-border);
    background: #fff;
}
[data-theme="dark"] .chat-composer { background: #1d1b16; }
.chat-composer-form {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}
.chat-composer-input {
    flex: 1;
    resize: none;
    border-radius: 22px;
    padding: 10px 18px;
    min-height: 42px;
    max-height: 140px;
    overflow-y: auto;
    border: 1px solid var(--mst-border);
    background: var(--mst-light, #f5efe6);
    color: var(--mst-text);
    font-size: 0.95rem;
    line-height: 1.4;
    transition: border-color .12s, background-color .12s;
}
.chat-composer-input:focus {
    outline: none;
    border-color: var(--mst-primary);
    background: #fff;
}
[data-theme="dark"] .chat-composer-input {
    background: #2a2620;
    border-color: rgba(217,212,197,0.15);
}
[data-theme="dark"] .chat-composer-input:focus {
    background: #322d24;
}
.chat-composer-send {
    width: 42px; height: 42px;
    border-radius: 50%;
    border: none;
    background: var(--mst-primary);
    color: #fff;
    font-size: 1rem;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    cursor: pointer;
    transition: background-color .12s, transform .12s;
}
.chat-composer-send:hover:not(:disabled) {
    background: var(--mst-primary-2, var(--mst-secondary));
    transform: translateY(-1px);
}
.chat-composer-send:disabled { opacity: 0.5; cursor: not-allowed; }
.chat-composer-error {
    color: #b34141;
    font-size: 0.78rem;
    margin-top: 4px;
    padding: 0 12px;
}

@media (max-width: 575px) {
    .chat-card { height: calc(100vh - 110px); border-radius: 0; }
    .chat-bubble-group { max-width: 82%; }
}

/* ── Inbox / messages list ────────────────────────────────────────────
   Replaces the row of tier-coloured circles + "list of names" with a
   stacked conversation list that reads as messages: avatar, name, last
   message preview, time, unread chip. */
.inbox-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    flex-wrap: wrap;
    gap: 8px;
}
.inbox-page-title {
    font-weight: 800;
    color: var(--mst-primary);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.5rem;
}
.inbox-page-title .inbox-icon { font-size: 1.3rem; }
.inbox-unread-pill {
    background: var(--mst-primary);
    color: #fff;
    font-size: 0.7rem;
    padding: 2px 9px;
    border-radius: 999px;
    font-weight: 700;
}
.inbox-new-btn {
    background: var(--mst-primary);
    color: #fff;
    border: none;
    border-radius: 22px;
    padding: 8px 16px;
    font-weight: 600;
    font-size: 0.88rem;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: background-color .12s, transform .12s;
}
.inbox-new-btn:hover {
    background: var(--mst-primary-2, var(--mst-secondary));
    color: #fff;
    transform: translateY(-1px);
}

.inbox-search-row { margin-bottom: 14px; }
.inbox-search-row .form-control { border-radius: 22px; padding: 10px 18px; }

.inbox-conversations {
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: #fff;
    border: 1px solid var(--mst-border);
    border-radius: 14px;
    overflow: hidden;
}
[data-theme="dark"] .inbox-conversations {
    background: #1d1b16;
    border-color: rgba(217,212,197,0.15);
}
.inbox-conversation {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    text-decoration: none;
    color: inherit;
    border-bottom: 1px solid var(--mst-border);
    transition: background-color .12s;
}
.inbox-conversation:last-child { border-bottom: none; }
.inbox-conversation:hover {
    background: rgba(160,110,60,0.06);
    color: inherit;
}
[data-theme="dark"] .inbox-conversation:hover { background: rgba(217,199,154,0.07); }
.inbox-conversation-avatar { flex-shrink: 0; }
.inbox-conversation-body { flex: 1 1 auto; min-width: 0; }
.inbox-conversation-row1 {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.inbox-conversation-name {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--mst-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.inbox-conversation.is-unread .inbox-conversation-name { font-weight: 800; color: var(--mst-primary); }
.inbox-conversation-time {
    color: var(--mst-muted);
    font-size: 0.74rem;
    flex-shrink: 0;
}
.inbox-conversation-preview {
    color: var(--mst-muted);
    font-size: 0.84rem;
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.inbox-conversation.is-unread .inbox-conversation-preview {
    color: var(--mst-text);
    font-weight: 600;
}
.inbox-conversation-unread {
    background: var(--mst-primary);
    color: #fff;
    border-radius: 999px;
    padding: 2px 9px;
    font-size: 0.74rem;
    font-weight: 700;
    flex-shrink: 0;
    align-self: center;
}

.inbox-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--mst-muted);
    background: #fff;
    border: 1px dashed var(--mst-border);
    border-radius: 14px;
}
[data-theme="dark"] .inbox-empty { background: #1d1b16; border-color: rgba(217,212,197,0.15); }
.inbox-empty-icon { font-size: 2.4rem; margin-bottom: 8px; opacity: 0.6; }
.inbox-empty-title { font-weight: 700; color: var(--mst-text); margin-bottom: 4px; font-size: 1.05rem; }
.inbox-empty-sub { font-size: 0.88rem; margin-bottom: 14px; }

/* Per-item mute list (Settings → Feed filters) — checkbox list of every
   channel and every biographical account. Compact and readable so a long
   list doesn't feel like a wall of checkboxes. */
.mute-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 4px 12px;
    margin-bottom: 6px;
}
.mute-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.10s;
}
.mute-item:hover { background: rgba(0,0,0,0.03); }
[data-theme="dark"] .mute-item:hover { background: rgba(255,255,255,0.04); }
.mute-item input[type="checkbox"] { flex: 0 0 auto; margin: 0; }
.mute-item-icon { font-size: 1rem; flex: 0 0 auto; }
.mute-item-body { flex: 1; min-width: 0; line-height: 1.2; font-size: 0.88rem; }
.mute-item-sub {
    display: block;
    color: var(--mst-muted);
    font-size: 0.75rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Card-level skin for posts in newspaper / book mode — gives the wrapper
   card a distinct paper texture so the page stops looking like every
   other post card. The article-layout markup inside still controls the
   typography. */
.post-skin-newspaper {
    background: #fbfaf6 !important;
    border: 1px solid #d9d4c5 !important;
    border-top: 4px double #2a2520 !important;
}
.post-skin-newspaper .card-body { padding: 1.6rem 1.4rem; }
[data-theme="dark"] .post-skin-newspaper {
    background: #221f17 !important;
    border-color: rgba(217,212,197,0.18) !important;
    border-top: 4px double #d9d4c5 !important;
}
.post-skin-book {
    background: #fbf7ee !important;
    border: 1px solid #d9c79a !important;
    box-shadow: 0 8px 28px rgba(160,110,60,0.14) !important;
    border-radius: 6px !important;
}
.post-skin-book .card-body { padding: 1.8rem 2rem; }
[data-theme="dark"] .post-skin-book {
    background: #2a2418 !important;
    border-color: rgba(217,199,154,0.20) !important;
}

/* ── Newspaper / book article layout ─────────────────────────────────
   Used on the Detail page for channel posts (newspaper) and biographical
   posts (book chapter). Each post's images can be positioned around the
   body text via a 9-cell grid set on the Edit page. */
.article-layout {
    font-family: 'Georgia', 'Cormorant Garamond', serif;
    color: var(--mst-text);
}
.article-head {
    text-align: center;
    border-bottom: 1px solid var(--mst-border);
    padding-bottom: 14px;
    margin-bottom: 18px;
}
.article-headline {
    font-size: 2.0rem;
    font-weight: 700;
    line-height: 1.15;
    color: var(--mst-text);
    margin: 0 0 6px 0;
    letter-spacing: -0.005em;
}
.article-byline {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: var(--mst-muted);
}
.article-tagged {
    font-size: 0.85rem;
    color: var(--mst-muted);
    margin-top: 4px;
    font-style: italic;
}
.article-prose {
    line-height: 1.7;
    font-size: 1.02rem;
    color: var(--mst-text);
}
.article-prose > p {
    /* Each paragraph stands on its own — no top margin on the first so the
       drop-cap aligns with the column rule. break-inside avoids splitting a
       paragraph awkwardly across newspaper columns. */
    margin: 0 0 0.9em 0;
    break-inside: avoid-column;
}
.article-prose > p:last-child { margin-bottom: 0; }
.article-prose::after {
    /* Clear floats inside the body so the next sibling lays out cleanly. */
    content: ""; display: block; clear: both;
}

/* Newspaper — channel posts. The body is a real 2-column CSS grid (not
   multicol) so floats inside each journal column wrap text within that
   column instead of leaking across both. The 4×8 placement grid maps to
   journal columns: cols 0-1 → left col, cols 2-3 → right col. Heroes
   (width 3+) are siblings of the grid and span the article. */
.article-newspaper .article-headline {
    font-family: 'Fraunces', 'Cormorant Garamond', Georgia, serif;
    font-size: 2.4rem;
    font-weight: 800;
}
.article-newspaper .article-prose.article-news-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 32px;
    text-align: justify;
    hyphens: auto;
    /* Override the generic column rules so we don't get a vertical bar
       between the cols by default — the gap alone reads as separation. */
    column-count: auto;
    column-rule: none;
}
.article-newspaper .article-news-col {
    min-width: 0;
    /* New block formatting context — contains floats. */
    overflow: hidden;
}
.article-newspaper .article-news-col-2 {
    /* Subtle vertical rule sitting at the start of the right column,
       inside the gap. */
    border-left: 1px solid var(--mst-border);
    padding-left: 16px;
    margin-left: -16px;
}
@media (max-width: 767.98px) {
    .article-newspaper .article-prose.article-news-grid {
        grid-template-columns: 1fr;
        column-gap: 0;
        text-align: left;
    }
    .article-newspaper .article-news-col-2 {
        border-left: none;
        padding-left: 0;
        margin-left: 0;
        margin-top: 12px;
    }
}
/* Drop cap on the first paragraph of the left journal column. */
.article-newspaper .article-news-col-1 > p:first-of-type::first-letter {
    font-family: 'Fraunces', 'Cormorant Garamond', Georgia, serif;
    font-size: 3.4rem;
    font-weight: 700;
    line-height: 0.9;
    float: left;
    padding: 4px 8px 0 0;
    color: var(--mst-primary);
}
/* Image classes inside a journal column need to be sized to the column,
   not the full article — width 1 covers half the column, width 2+ fills it. */
.article-newspaper .article-news-col .article-image.art-img-w-1 {
    max-width: 50%;
    min-width: 0;
}
.article-newspaper .article-news-col .article-image.art-img-w-2,
.article-newspaper .article-news-col .article-image.art-img-fill {
    max-width: 100%;
    min-width: 0;
    float: none;
    display: block;
    margin: 12px 0;
}
.art-img-fill {
    display: block;
    width: 100%;
    margin: 12px 0;
    float: none;
}
.art-img-fill img { width: 100%; }

/* Book — biographical posts. Single wider column, more luxurious leading,
   chapter-page feel with a centered ornament between the byline and the
   first paragraph. */
.article-book {
    max-width: 600px;
    margin: 0 auto;
    padding: 0 8px;
}
.article-book .article-head {
    border-bottom: none;
    padding-bottom: 28px;
    position: relative;
}
.article-book .article-head::after {
    /* Tiny dingbat between the byline and the body. */
    content: "❦";
    position: absolute;
    bottom: 4px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 1.05rem;
    color: var(--mst-accent);
    opacity: 0.8;
}
.article-book .article-headline {
    font-family: 'Fraunces', 'Cormorant Garamond', Georgia, serif;
    font-style: italic;
    font-size: 1.95rem;
    font-weight: 600;
}
.article-book .article-byline {
    letter-spacing: 0.10em;
    margin-top: 6px;
}
.article-book .article-prose {
    font-size: 1.04rem;
    line-height: 1.85;
    text-align: justify;
    hyphens: auto;
    padding-top: 4px;
}
.article-book .article-prose > p:first-of-type::first-letter {
    font-family: 'Fraunces', 'Cormorant Garamond', Georgia, serif;
    font-size: 2.8rem;
    font-weight: 600;
    line-height: 0.95;
    float: left;
    padding: 4px 8px 0 0;
    color: var(--mst-accent);
}

/* Image positioning — same 9-cell grid as the picker.
   Vertical band controls insertion point (top, middle, bottom);
   horizontal axis controls float / centering. Sizes are constrained
   to keep the article readable. */
.article-image {
    margin: 0 0 14px 0;
}
.article-image img {
    display: block;
    width: 100%;
    height: auto;
    object-fit: cover;
    border-radius: 4px;
}
.article-image figcaption {
    font-size: 0.78rem;
    color: var(--mst-muted);
    font-style: italic;
    text-align: center;
    margin-top: 6px;
}

/* Image placement on the 4×8 grid:
     col 0          → float left
     col + width = 4 (anchored right) → float right
     width 4 (full)  → block hero, breaks newspaper columns
     anything else   → block centered
   Width on the page = (LayoutWidth / 4) × column width, with a small min so
   single-cell images aren't a postage stamp. */
.art-img-left {
    float: left;
    margin: 4px 18px 10px 0;
}
.art-img-right {
    float: right;
    margin: 4px 0 10px 18px;
}
.art-img-center {
    display: block;
    margin: 12px auto;
}
.art-img-hero {
    display: block;
    margin: 18px 0 22px 0;
    width: 100%;
    column-span: all; /* breaks newspaper 2-col flow when supported */
}
.art-img-hero img { width: 100%; }

/* Width by span (n / 4 of the article column). Newspaper article = 2
   columns, so 4 grid cols span the entire spread; book = 1 column, so
   4 grid cols span the chapter width. */
.art-img-w-1 { max-width: 28%; min-width: 140px; }
.art-img-w-2 { max-width: 50%; min-width: 180px; }
.art-img-w-3 { max-width: 75%; }
.art-img-w-4 { max-width: 100%; }

/* Tall spans get an aspect-ratio so the float pushes against more lines
   of body text. */
.art-img-h-2 img { aspect-ratio: 4 / 3; object-fit: cover; }
.art-img-h-3 img { aspect-ratio: 3 / 4; object-fit: cover; }
.art-img-h-4 img,
.art-img-h-5 img { aspect-ratio: 2 / 3; object-fit: cover; }
.art-img-h-6 img,
.art-img-h-7 img,
.art-img-h-8 img { aspect-ratio: 9 / 16; object-fit: cover; }

/* Heroes use a wider aspect since they span the full article width. */
.art-img-hero.art-img-h-1 img { aspect-ratio: 21 / 9; }
.art-img-hero.art-img-h-2 img { aspect-ratio: 16 / 9; }
.art-img-hero.art-img-h-3 img { aspect-ratio: 4 / 3; }
.art-img-hero.art-img-h-4 img,
.art-img-hero.art-img-h-5 img,
.art-img-hero.art-img-h-6 img,
.art-img-hero.art-img-h-7 img,
.art-img-hero.art-img-h-8 img { aspect-ratio: 1 / 1; }

@media (max-width: 575px) {
    /* Tight phones: floats break — full-width all images. */
    .art-img-left, .art-img-right, .art-img-center, .art-img-hero,
    .art-img-w-1, .art-img-w-2, .art-img-w-3, .art-img-w-4 {
        float: none;
        max-width: 100%;
        margin: 12px 0;
    }
}

/* ── Home feed cards: newspaper / book skin ────────────────────────────
   Apply when the post's LayoutStyle (or its channel/bio fallback) puts it
   in article mode. Lighter than the Detail page treatment — title goes
   serif, the card gets a subtle paper background and a thin top rule. */
.feed-card-newspaper {
    background: #fbfaf6 !important;
    border: 1px solid #e2dcc7 !important;
    border-top: 3px double #2a2520 !important;
}
.feed-card-newspaper .post-title-headline {
    font-family: 'Fraunces', 'Cormorant Garamond', Georgia, serif;
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--mst-text);
    line-height: 1.2;
    margin-bottom: 4px;
}
[data-theme="dark"] .feed-card-newspaper {
    background: #221f17 !important;
    border-color: rgba(217,212,197,0.20) !important;
    border-top: 3px double #d9d4c5 !important;
}
.feed-card-book {
    background: #fbf7ee !important;
    border: 1px solid #e6d6ab !important;
    border-radius: 6px !important;
}
.feed-card-book .post-title-headline {
    font-family: 'Fraunces', 'Cormorant Garamond', Georgia, serif;
    font-style: italic;
    font-weight: 600;
    font-size: 1.2rem;
    color: var(--mst-primary);
    line-height: 1.2;
}
[data-theme="dark"] .feed-card-book {
    background: #2a2418 !important;
    border-color: rgba(230,214,171,0.20) !important;
}
[data-theme="dark"] .feed-card-book .post-title-headline { color: var(--mst-accent); }

/* Focal-point indicator dot — tells the writer where the cover-crop will
   center on this picture. Sits on top of the tile thumbnail; positioned
   via per-tile CSS variables so we don't have to re-render to move it. */
.media-focus-dot {
    position: absolute;
    width: 14px; height: 14px;
    margin-left: -7px; margin-top: -7px;
    left: var(--focus-x, 50%); top: var(--focus-y, 50%);
    border-radius: 50%;
    background: rgba(255,255,255,0.95);
    box-shadow: 0 0 0 2px rgba(0,0,0,0.55), 0 1px 4px rgba(0,0,0,0.45);
    pointer-events: none;
    transition: left 0.15s, top 0.15s;
}

/* Site announcement banner — sits between the navbar and main content.
   Three severity flavors mapped to the existing palette. Dismissible
   per user; admin bumping the version re-shows it to everyone. */
.site-banner {
    width: 100%;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    font-size: 0.88rem;
}
.site-banner-inner {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 8px 0;
    flex-wrap: wrap;
}
.site-banner-text { line-height: 1.4; }
.site-banner-link {
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}
.site-banner-close {
    background: none;
    border: none;
    color: inherit;
    opacity: 0.6;
    font-size: 1.4rem;
    line-height: 1;
    padding: 0 4px;
    cursor: pointer;
    transition: opacity 0.15s;
}
.site-banner-close:hover { opacity: 1; }
.site-banner-info {
    background: rgba(15,100,102,0.10);
    color: #0a4f51;
}
.site-banner-info .site-banner-link { color: var(--mst-primary); }
.site-banner-warning {
    background: rgba(240,192,64,0.20);
    color: #6b4e10;
}
.site-banner-warning .site-banner-link { color: #6b4e10; }
.site-banner-critical {
    background: rgba(220,53,69,0.16);
    color: #80212c;
}
.site-banner-critical .site-banner-link { color: #80212c; }
[data-theme="dark"] .site-banner-info    { background: rgba(120,200,200,0.16); color: #a7e0e0; }
[data-theme="dark"] .site-banner-warning { background: rgba(240,200,80,0.18); color: #f0c060; }
[data-theme="dark"] .site-banner-critical{ background: rgba(220,80,90,0.20); color: #ffaaa5; }

/* What's new modal — soft sepia memoir look so it reads as a release note,
   not a system alert. Body text preserves newlines with white-space:pre-line. */
.whats-new-modal-content {
    border: none;
    border-radius: 14px;
    box-shadow: 0 12px 36px rgba(0,0,0,0.18);
    overflow: hidden;
}
.whats-new-head {
    background: linear-gradient(180deg, rgba(184,135,26,0.12), rgba(184,135,26,0.02));
    border-bottom: 1px solid rgba(184,135,26,0.25);
    align-items: center;
}
.whats-new-tag {
    background: var(--mst-accent);
    color: #fff;
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 2px 9px;
    border-radius: 999px;
}
.whats-new-modal-content .modal-title {
    font-family: 'Georgia', serif;
    color: var(--mst-primary);
}
.whats-new-body {
    white-space: pre-line;
    line-height: 1.55;
    font-size: 0.95rem;
}

/* Cookie consent banner — quiet inline notice, dismissible. Floats just
   above the bottom edge as a card so it doesn't feel like a system alert. */
.cookie-banner {
    position: fixed;
    bottom: 12px; left: 50%;
    transform: translateX(-50%);
    max-width: min(640px, calc(100% - 24px));
    background: rgba(40,42,55,0.96);
    color: #fff;
    padding: 10px 14px;
    z-index: 1900;
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 0.82rem;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.20);
    backdrop-filter: blur(6px);
}
.cookie-banner a { color: #f0c060; }
.cookie-banner button { flex-shrink: 0; }
@media (max-width: 600px) {
    .cookie-banner {
        bottom: 0; left: 0; right: 0;
        max-width: none;
        transform: none;
        border-radius: 0;
        text-align: left;
        gap: 10px;
    }
}

/* Footer columns */
.footer ul li a { color: var(--mst-primary); text-decoration: none; }
.footer ul li a:hover { text-decoration: underline; }
.reaction-opt {
    background: none;
    border: none;
    padding: 4px 6px;
    border-radius: 999px;
    cursor: pointer;
    color: var(--mst-muted);
    transition: transform .1s ease, color .1s ease, background .1s ease;
}
.reaction-opt:hover { transform: scale(1.18); background: var(--mst-surface-2); }
.reaction-opt[data-reaction="0"]:hover { color: #ef4444; }
.reaction-opt[data-reaction="1"]:hover { color: #2563eb; }
.reaction-opt[data-reaction="2"]:hover { color: #f59e0b; }
.reaction-opt[data-reaction="3"]:hover { color: var(--mst-primary); }
.reaction-opt[data-reaction="4"]:hover { color: #6b7280; }
.reaction-opt svg { width: 18px; height: 18px; stroke: currentColor; fill: currentColor; }
.reaction-opt[data-reaction="3"] svg,
.reaction-opt[data-reaction="4"] svg { fill: none; }

/* Reacted-state colors per reaction type on the main button */
.icon-action.like-btn[data-reaction="0"].liked { color: #ef4444; }
.icon-action.like-btn[data-reaction="1"].liked { color: #2563eb; }
.icon-action.like-btn[data-reaction="2"].liked { color: #f59e0b; }
.icon-action.like-btn[data-reaction="3"].liked { color: var(--mst-primary); }
.icon-action.like-btn[data-reaction="4"].liked { color: #6b7280; }
.icon-action.like-btn .reaction-icon { display: inline-flex; align-items: center; }

/* Borderless icon actions on post cards (like, comment) */
.icon-action {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: none;
    padding: 4px 6px;
    color: var(--mst-muted);
    font-size: 0.88rem;
    text-decoration: none;
    line-height: 1;
    cursor: pointer;
    border-radius: 8px;
    transition: color .1s ease, background-color .1s ease, transform .08s ease;
}
.icon-action svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-action:hover { color: var(--mst-ink); background: var(--mst-surface-2); }
.icon-action.like-btn.liked { color: #ef4444; }
.icon-action.like-btn.liked svg { fill: #ef4444; stroke: #ef4444; transform: scale(1.08); transition: transform .1s ease; }

/* Tag bubbles */
.tag-bubble {
    display: inline-flex;
    align-items: center;
    background: var(--mst-light);
    color: var(--mst-primary);
    border: 1px solid transparent;
    border-radius: 999px;
    padding: 3px 10px 3px 6px;
    font-size: 0.78rem;
    font-weight: 500;
}
.tag-bubble button {
    background: none;
    border: none;
    color: var(--mst-primary);
    font-size: 1rem;
    line-height: 1;
    padding: 0 2px 0 6px;
    cursor: pointer;
    opacity: 0.7;
}
.tag-bubble button:hover { opacity: 1; }

/* ============================================
   Onboarding overlay (Get Started)
   ============================================ */
.kron-onboard-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(18, 43, 28, 0.72);
    backdrop-filter: blur(3px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.kron-onboard-modal {
    background: #fffdf3;
    border: 2px solid var(--mst-gold);
    border-radius: 18px;
    max-width: 640px;
    width: 100%;
    box-shadow: 0 30px 80px rgba(0,0,0,0.5);
    overflow: hidden;
    position: relative;
}
.kron-onboard-close {
    position: absolute;
    top: 10px;
    right: 14px;
    background: transparent;
    border: none;
    font-size: 1.4rem;
    color: var(--mst-muted);
    cursor: pointer;
    z-index: 5;
}
.kron-onboard-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 253, 243, 0.92);
    border: 1px solid var(--mst-gold);
    font-size: 1.6rem;
    color: var(--mst-primary);
    cursor: pointer;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    z-index: 5;
    box-shadow: 0 2px 8px rgba(0,0,0,0.18);
    transition: color 0.12s ease, transform 0.12s ease, background 0.12s ease;
}
.kron-onboard-arrow:hover {
    color: var(--mst-accent);
    background: #fff;
}
.kron-onboard-arrow.left  { left: 10px; }
.kron-onboard-arrow.right { right: 10px; }
.kron-onboard-arrow.left:hover  { transform: translateY(-50%) translateX(-2px); }
.kron-onboard-arrow.right:hover { transform: translateY(-50%) translateX(2px); }
.kron-onboard-slide {
    padding: 28px 28px 12px;
    text-align: center;
    display: none;
}
.kron-onboard-slide.active { display: block; }
.kron-onboard-illustration {
    width: 100%;
    aspect-ratio: 10 / 9;
    background: linear-gradient(135deg, var(--mst-light) 0%, #fff8df 100%);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 14px;
    border: 1px solid var(--mst-gold);
    position: relative;
}
.kron-onboard-illustration img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}
.kron-onboard-illustration--placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 5rem;
    border-style: dashed;
    aspect-ratio: 10 / 9;
}
.kron-onboard-title {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--mst-primary);
    margin-bottom: 4px;
}
.kron-onboard-tagline {
    font-style: italic;
    color: var(--mst-accent);
    font-weight: 600;
    font-size: 0.88rem;
    margin-bottom: 6px;
}
.kron-onboard-body {
    color: var(--mst-text);
    font-size: 0.85rem;
    line-height: 1.4;
    margin-bottom: 4px;
}
.kron-onboard-caption {
    margin-top: 10px;
    font-size: 0.72rem;
    color: #9a9788;
    font-style: italic;
    line-height: 1.3;
}
.kron-onboard-example {
    font-size: 0.82rem;
    color: var(--mst-muted);
    font-style: italic;
    margin-top: 10px;
    padding: 8px 12px;
    background: #fdfaea;
    border-left: 3px solid var(--mst-gold);
    text-align: left;
}
.kron-onboard-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    padding: 10px 0 6px;
}
.kron-onboard-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #d9d6c3;
    border: none;
    cursor: pointer;
    transition: background 0.15s;
}
.kron-onboard-dot.active { background: var(--mst-gold); }
.kron-onboard-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 24px 20px;
    gap: 10px;
}
.kron-onboard-nav .dont-show {
    font-size: 0.78rem;
    color: var(--mst-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

/* === Invite system ============================================== */
/* Inviter attribution banner — shown above the Register form when
   the URL carries a valid ?invite= token. */
.invite-attribution {
    display: flex; align-items: flex-start; gap: 14px;
    padding: 16px 18px;
    background: var(--mst-surface, #fbf7ef);
    border: 1px solid var(--mst-border);
    border-left: 4px solid var(--mst-primary, #c8a572);
    border-radius: 12px;
}
.invite-attribution-avatar {
    width: 48px; height: 48px; border-radius: 50%;
    overflow: hidden; flex-shrink: 0;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--mst-light, #f5efe6);
    color: var(--mst-primary, #c8a572);
    font-weight: 700; font-size: 1.2rem;
    border: 1px solid var(--mst-border);
}
.invite-attribution-avatar img { width: 100%; height: 100%; object-fit: cover; }
.invite-attribution-text { min-width: 0; flex: 1; }
.invite-attribution-eyebrow {
    font-family: 'Inter', system-ui, sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.22em;
    font-size: 0.66rem;
    color: var(--mst-primary, #c8a572);
    margin: 0 0 2px;
}
.invite-attribution-name {
    font-family: 'Cormorant Garamond', 'Fraunces', Georgia, serif;
    font-style: italic;
    font-weight: 600;
    font-size: 1.35rem;
    color: var(--mst-text);
    margin: 0;
    line-height: 1.1;
}
.invite-attribution-message {
    margin: 8px 0 0;
    padding: 0 0 0 12px;
    border-left: 2px solid var(--mst-border);
    color: var(--mst-muted, #6b6258);
    font-size: 0.9rem;
    line-height: 1.5;
}

/* Invite form mode picker — promoted from inline style on Invite.cshtml */
.invite-mode-row { display: flex; gap: 12px; flex-wrap: wrap; }
.invite-mode-card {
    flex: 1 1 240px;
    border: 1.5px solid var(--mst-border);
    border-radius: var(--mst-radius);
    padding: 14px 16px;
    cursor: pointer;
    display: flex; align-items: center; gap: 12px;
    background: var(--mst-card);
    transition: border-color .12s, box-shadow .12s, background .12s;
    margin: 0;
}
.invite-mode-card:hover { border-color: var(--mst-primary); }
.invite-mode-card input { display: none; }
.invite-mode-card.selected,
.invite-mode-card:has(input:checked) {
    border-color: var(--mst-primary);
    box-shadow: 0 0 0 3px rgba(200,165,114,0.18);
    background: rgba(200,165,114,0.05);
}
.invite-mode-icon {
    width: 36px; height: 36px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--mst-light, #f5efe6);
    color: var(--mst-primary, #c8a572);
    flex-shrink: 0;
}
.invite-mode-title { font-weight: 600; color: var(--mst-text); }
.invite-mode-sub { font-size: 0.82rem; color: var(--mst-muted, #6b6258); margin-top: 2px; line-height: 1.35; }

/* Invite-sent confirmation page */
.invite-sent-wrap { max-width: 560px; margin: 0 auto; }
.invite-sent-card {
    background: var(--mst-card);
    border: 1px solid var(--mst-border);
    border-radius: 14px;
    padding: 36px 32px;
    text-align: center;
}
.invite-sent-eyebrow {
    font-family: 'Inter', system-ui, sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.22em;
    font-size: 0.72rem;
    color: var(--mst-primary, #c8a572);
    margin: 0 0 6px;
}
.invite-sent-title {
    font-family: 'Cormorant Garamond', 'Fraunces', Georgia, serif;
    font-style: italic;
    font-weight: 600;
    font-size: 1.85rem;
    color: var(--mst-text);
    margin: 0 0 14px;
}
.invite-sent-lead { color: var(--mst-muted, #6b6258); margin: 0 0 24px; }
.invite-sent-link {
    background: var(--mst-surface, #fbf7ef);
    border: 1px solid var(--mst-border);
    border-radius: 10px;
    padding: 12px;
    margin: 0 0 14px;
}
.invite-sent-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* 'Invite their version' CTA — viral-loop surface on post Detail for the
   author. Editorial palette, low-contrast container, gold chip per name. */
.add-version-cta {
    padding: 16px 18px;
    background: var(--mst-surface, #fbf7ef);
    border: 1px solid var(--mst-border);
    border-left: 4px solid var(--mst-primary, #c8a572);
    border-radius: 12px;
}
.add-version-eyebrow {
    font-family: 'Inter', system-ui, sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.22em;
    font-size: 0.7rem;
    color: var(--mst-primary, #c8a572);
    margin: 0 0 4px;
}
.add-version-lead {
    font-family: 'Cormorant Garamond', 'Fraunces', Georgia, serif;
    font-style: italic;
    font-size: 1.05rem;
    color: var(--mst-text);
    margin: 0 0 10px;
    line-height: 1.4;
}
.add-version-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.add-version-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    background: var(--mst-card);
    border: 1px solid var(--mst-border);
    color: var(--mst-text);
    border-radius: 999px;
    font-size: 0.9rem;
    text-decoration: none;
    transition: border-color .12s, transform .12s, box-shadow .12s;
}
.add-version-chip strong { color: var(--mst-primary, #c8a572); font-weight: 600; }
.add-version-chip:hover {
    border-color: var(--mst-primary, #c8a572);
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(0,0,0,0.05);
    color: var(--mst-text);
}

/* iOS Add-to-Home-Screen hint — anchored bottom-center on iPhone Safari,
   shown once until dismissed. Sits above any fixed footer / safe area. */
.ios-install-hint {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom));
    z-index: 1080;
    background: var(--mst-surface, #fbf7ef);
    border: 1px solid var(--mst-border);
    border-left: 4px solid var(--mst-primary, #c8a572);
    border-radius: 12px;
    padding: 12px 12px 12px 14px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    display: flex;
    align-items: center;
    gap: 8px;
}
.ios-install-hint-text {
    flex: 1;
    font-size: 0.9rem;
    line-height: 1.35;
    color: var(--mst-text);
}
.ios-install-hint-text strong {
    display: block;
    font-family: 'Cormorant Garamond', 'Fraunces', Georgia, serif;
    font-style: italic;
    font-weight: 600;
    font-size: 1.05rem;
    color: var(--mst-text);
    margin-bottom: 2px;
}
.ios-install-hint-sub { color: var(--mst-muted, #6b6258); font-size: 0.85rem; }
.ios-install-hint-sub em { font-style: normal; font-weight: 600; color: var(--mst-text); }
.ios-share-glyph {
    display: inline-block;
    color: var(--mst-primary, #c8a572);
    font-weight: 700;
    padding: 0 2px;
}
.ios-install-hint-close {
    background: none;
    border: none;
    color: var(--mst-muted, #6b6258);
    font-size: 1.4rem;
    line-height: 1;
    padding: 4px 8px;
    cursor: pointer;
}
.ios-install-hint-close:hover { color: var(--mst-text); }
@media (min-width: 768px) {
    /* Desktop never needs this — Safari iOS only. */
    .ios-install-hint { display: none !important; }
}

/* === Welcome page ============================================== */
/* Post-email-confirm landing. Editorial palette, three numbered
   action cards (write / avatar / invite), inviter attribution
   when present. */
.welcome-wrap {
    max-width: 720px;
    margin: 0 auto;
    padding: 28px 16px 60px;
}
.welcome-hero { text-align: center; padding: 8px 0 22px; }
.welcome-eyebrow {
    font-family: 'Inter', system-ui, sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.22em;
    font-size: 0.72rem;
    color: var(--mst-primary, #c8a572);
    margin: 0 0 10px;
}
.welcome-title {
    font-family: 'Cormorant Garamond', 'Fraunces', Georgia, serif;
    font-style: italic;
    font-weight: 600;
    font-size: 2.6rem;
    color: var(--mst-text);
    margin: 0 0 12px;
    line-height: 1.05;
}
.welcome-lead {
    color: var(--mst-muted, #6b6258);
    font-size: 1.08rem;
    line-height: 1.55;
    max-width: 540px;
    margin: 0 auto;
}

.welcome-inviter {
    display: flex; align-items: flex-start; gap: 14px;
    padding: 16px 18px;
    background: var(--mst-surface, #fbf7ef);
    border: 1px solid var(--mst-border);
    border-left: 4px solid var(--mst-primary, #c8a572);
    border-radius: 12px;
    margin: 24px auto 28px;
    max-width: 560px;
}
.welcome-inviter-avatar {
    width: 56px; height: 56px; border-radius: 50%; overflow: hidden;
    background: var(--mst-light, #f5efe6);
    color: var(--mst-primary, #c8a572);
    font-weight: 700; font-size: 1.3rem;
    display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid var(--mst-border);
    flex-shrink: 0;
}
.welcome-inviter-avatar img { width: 100%; height: 100%; object-fit: cover; }
.welcome-inviter-eyebrow {
    font-family: 'Inter', system-ui, sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.22em;
    font-size: 0.66rem;
    color: var(--mst-primary, #c8a572);
    margin: 0 0 2px;
}
.welcome-inviter-name {
    font-family: 'Cormorant Garamond', 'Fraunces', Georgia, serif;
    font-style: italic;
    font-weight: 600;
    font-size: 1.35rem;
    color: var(--mst-text);
    margin: 0 0 4px;
}
.welcome-inviter-cta {
    font-size: 0.9rem;
    color: var(--mst-primary, #c8a572);
    text-decoration: none;
}
.welcome-inviter-cta:hover { color: var(--mst-text); }

.welcome-step-title {
    font-family: 'Cormorant Garamond', 'Fraunces', Georgia, serif;
    font-style: italic;
    font-weight: 600;
    font-size: 1.6rem;
    color: var(--mst-text);
    margin: 28px 0 4px;
    text-align: center;
}
.welcome-step-sub {
    color: var(--mst-muted, #6b6258);
    font-size: 0.95rem;
    text-align: center;
    margin: 0 0 18px;
}

.welcome-steps {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.welcome-step {
    display: flex;
    gap: 18px;
    padding: 18px 20px;
    background: var(--mst-card);
    border: 1px solid var(--mst-border);
    border-radius: 14px;
    transition: border-color .12s, box-shadow .12s;
}
.welcome-step:hover {
    border-color: var(--mst-primary, #c8a572);
    box-shadow: 0 6px 16px rgba(0,0,0,0.05);
}
.welcome-step.is-done {
    opacity: 0.7;
    background: var(--mst-surface, #fbf7ef);
}
.welcome-step-num {
    font-family: 'Cormorant Garamond', 'Fraunces', Georgia, serif;
    font-style: italic;
    font-weight: 700;
    font-size: 1.5rem;
    color: var(--mst-primary, #c8a572);
    line-height: 1;
    padding-top: 4px;
    min-width: 24px;
}
.welcome-step-body h3 {
    font-family: 'Cormorant Garamond', 'Fraunces', Georgia, serif;
    font-style: italic;
    font-weight: 600;
    font-size: 1.3rem;
    color: var(--mst-text);
    margin: 0 0 4px;
}
.welcome-step-body p {
    color: var(--mst-muted, #6b6258);
    font-size: 0.95rem;
    line-height: 1.5;
    margin: 0 0 12px;
}
.welcome-step-done {
    font-size: 0.9rem;
    color: var(--mst-primary, #c8a572);
}

.welcome-footer {
    margin-top: 32px;
    text-align: center;
    display: flex;
    justify-content: center;
    gap: 4px;
    flex-wrap: wrap;
}

/* === Book view — per-photo owner controls =====================
   Hover-revealed grip + options menu on each photo in book mode.
   Wrap (none/left/right), size (S/M/L), hide-from-book. */
.book-photo { position: relative; }
.book-photo img { display: block; max-width: 100%; }

.book-photo-controls {
    position: absolute;
    top: 8px;
    right: 8px;
    display: inline-flex;
    gap: 4px;
    z-index: 5;
    /* Dimmed by default so the picture stays the focus; full opacity
       on hover / focus / when the menu is open so the writer knows
       these are interactive. Always visible (not display:none) so
       the drag/menu affordance discoverable on touch devices too. */
    opacity: 0.45;
    transition: opacity .15s;
}
.book-photo:hover .book-photo-controls,
.book-photo:focus-within .book-photo-controls,
.book-photo.is-menu-open .book-photo-controls {
    opacity: 1;
}
@media (hover: none) {
    /* Touch devices: no hover state, so keep the controls fully visible. */
    .book-photo-controls { opacity: 1; }
}
.book-photo-grip,
.book-photo-menu-btn {
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    font-size: 0.95rem;
    line-height: 1;
    cursor: pointer;
    transition: background-color .12s;
}
.book-photo-grip { cursor: grab; }
.book-photo-grip:active { cursor: grabbing; }
.book-photo-grip:hover,
.book-photo-menu-btn:hover { background: rgba(0, 0, 0, 0.78); }

.book-photo-menu-wrap { position: relative; }
.book-photo-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 220px;
    background: var(--mst-card);
    border: 1px solid var(--mst-border);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16);
    padding: 10px 12px;
    z-index: 10;
}
.book-photo-menu-section { padding: 6px 0; }
.book-photo-menu-section + .book-photo-menu-section {
    border-top: 1px solid var(--mst-border);
}
.book-photo-menu-label {
    font-family: 'Inter', system-ui, sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    font-size: 0.62rem;
    color: var(--mst-primary, #c8a572);
    margin-bottom: 4px;
}
.book-photo-menu-row { display: flex; gap: 4px; flex-wrap: wrap; }
.book-photo-opt {
    background: var(--mst-surface, #fbf7ef);
    border: 1px solid var(--mst-border);
    color: var(--mst-text);
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 0.82rem;
    cursor: pointer;
    transition: background-color .12s, border-color .12s;
}
.book-photo-opt:hover { border-color: var(--mst-primary); }
.book-photo-opt.is-on {
    background: var(--mst-primary, #c8a572);
    color: #fff;
    border-color: var(--mst-primary, #c8a572);
}
/* 3×3 position picker — top/middle/bottom × left/center/right. */
.book-photo-pos-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
    width: max-content;
}
.book-photo-pos {
    width: 30px; height: 28px;
    display: flex; align-items: center; justify-content: center;
    background: var(--mst-surface, #fbf7ef);
    border: 1px solid var(--mst-border);
    color: var(--mst-text);
    border-radius: 6px;
    font-size: 0.95rem; line-height: 1;
    cursor: pointer;
    transition: background-color .12s, border-color .12s;
}
.book-photo-pos:hover { border-color: var(--mst-primary); }
.book-photo-pos.is-on {
    background: var(--mst-primary, #c8a572);
    color: #fff;
    border-color: var(--mst-primary, #c8a572);
}
.book-photo-hide-btn {
    background: none;
    border: 1px solid var(--mst-border);
    color: #b34141;
    border-radius: 6px;
    padding: 5px 10px;
    font-size: 0.85rem;
    cursor: pointer;
    width: 100%;
}
.book-photo-hide-btn:hover { background: rgba(179, 65, 65, 0.08); }

/* AI photo restoration trigger — same shape as the hide button so
   the menu's rhythm is consistent, but gold so it reads as a
   "premium move", not a destructive one. */
.book-photo-restore-btn {
    background: none;
    border: 1px solid var(--mst-border);
    color: #8a6020;
    border-radius: 6px;
    padding: 5px 10px;
    font-size: 0.85rem;
    cursor: pointer;
    width: 100%;
    transition: background .12s, border-color .12s;
}
.book-photo-restore-btn:hover {
    background: rgba(212, 168, 74, 0.12);
    border-color: var(--mst-accent, #d4a84a);
}
.book-photo-restore-btn:disabled {
    opacity: 0.6;
    cursor: wait;
}

/* Wrap modes — photos float inside the body, text wraps around. */
.book-photo-wrap {
    margin: 4px 0 10px;
}
.book-photo-wrap-left {
    float: left;
    margin-right: 18px;
    margin-bottom: 6px;
}
.book-photo-wrap-right {
    float: right;
    margin-left: 18px;
    margin-bottom: 6px;
}

/* Size modifiers — applied as a max-width on the figure. The wrapped
   floats need a width or the float won't bite. */
.book-photo-size-small  { max-width: 30%; }
.book-photo-size-medium { max-width: 50%; }
.book-photo-size-large  { max-width: 75%; }
.book-photo-wrap.book-photo-size-small  { width: 28%; }
.book-photo-wrap.book-photo-size-medium { width: 42%; }
.book-photo-wrap.book-photo-size-large  { width: 60%; }

/* Center position — a full-width-ish block, no float, centered. Clears any
   prior float so it sits on its own line. Wider than the float sizes since
   it isn't sharing the line with text. */
.book-photo-center {
    display: block;
    clear: both;
    margin: 12px auto;
}
.book-photo-center.book-photo-size-small  { max-width: 45%; }
.book-photo-center.book-photo-size-medium { max-width: 70%; }
.book-photo-center.book-photo-size-large  { max-width: 100%; }

/* Clearfix so the body grows to contain any floated photos — without
   this the gallery strip / hidden-photos panel rides up over a
   wrap-left/right figure, which reads as 'wrap doesn't work' even
   though the float is firing. content needs the empty string literal;
   bare 'content: ;' is invalid and the whole rule was being discarded. */
.book-story-body::after {
    content: "";
    display: table;
    clear: both;
}

/* Hidden-photos collapse panel — sits below the gallery strip,
   owner-only (the view only renders for the owner). */
.book-photo-hidden-panel {
    margin-top: 16px;
    padding: 8px 12px;
    border: 1px dashed var(--mst-border);
    border-radius: 10px;
    background: var(--mst-surface, #fbf7ef);
}
.book-photo-hidden-panel summary {
    cursor: pointer;
    font-family: 'Inter', system-ui, sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    font-size: 0.7rem;
    color: var(--mst-muted, #6b6258);
}
.book-photo-hidden-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 8px;
    margin-top: 10px;
}
.book-photo-hidden-grid .book-photo {
    border-radius: 8px;
    overflow: hidden;
    background: var(--mst-card);
    border: 1px solid var(--mst-border);
}
.book-photo-hidden-grid .book-photo img {
    opacity: 0.55;
    aspect-ratio: 1 / 1;
    object-fit: cover;
}
.book-photo-bring-back-form { margin: 0; padding: 6px 8px 8px; }
.book-photo-bring-back {
    width: 100%;
    background: var(--mst-primary, #c8a572);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 5px 8px;
    font-size: 0.78rem;
    cursor: pointer;
}
.book-photo-bring-back:hover { filter: brightness(0.93); }

/* Drag-while-reordering visual cue */
.book-photo.is-dragging { opacity: 0.4; }
.book-photo.is-drag-over { outline: 2px dashed var(--mst-primary, #c8a572); }

/* Drop-into-prose hint — when the user drags a photo over the body
   text, a gold vertical guide lights up the side the photo will land
   on (left half → wrap-left, right half → wrap-right). Subtle
   background tint reinforces the active half. */
.book-story-body.is-drop-target {
    position: relative;
    transition: background-color .12s;
}
.book-story-body.is-drop-target::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    width: 50%;
    pointer-events: none;
    background: linear-gradient(to right, rgba(200, 165, 114, 0.16), rgba(200, 165, 114, 0));
    border-left: 3px solid var(--mst-primary, #c8a572);
    z-index: 1;
}
.book-story-body.is-drop-target-left::before {
    left: 0;
    border-left: 3px solid var(--mst-primary, #c8a572);
    border-right: 0;
}
.book-story-body.is-drop-target-right::before {
    left: 50%;
    background: linear-gradient(to left, rgba(200, 165, 114, 0.16), rgba(200, 165, 114, 0));
    border-left: 0;
    border-right: 3px solid var(--mst-primary, #c8a572);
}

/* Drop hint on the gallery strip — dragging a wrapped photo back here
   clears the wrap and returns it to the row. Dashed gold outline
   signals "release here to send back to the gallery". */
.book-story-gallery.is-drop-target {
    outline: 2px dashed var(--mst-primary, #c8a572);
    outline-offset: 4px;
    background: rgba(200, 165, 114, 0.08);
    border-radius: 6px;
}

/* Per-paragraph spacing — splitting the body into <p>s for anchor
   targeting needs explicit margin (Bootstrap reset zeroes them). */
.book-story-para {
    margin: 0 0 1em;
}
.book-story-para:last-child { margin-bottom: 0; }

/* Paragraph drop hint — the gold guide on the page side already shows
   which side the photo will wrap on; this rule adds a horizontal
   indicator on the exact paragraph the photo will anchor in front of,
   so the writer can see "this is where it goes" before releasing. */
.book-story-para.is-drop-anchor {
    box-shadow: 0 -3px 0 0 var(--mst-primary, #c8a572);
    padding-top: 4px;
    transition: box-shadow .08s ease, padding-top .08s ease;
}
.book-story-para.is-drop-anchor-after {
    box-shadow: 0 3px 0 0 var(--mst-primary, #c8a572);
    padding-bottom: 4px;
    transition: box-shadow .08s ease, padding-bottom .08s ease;
}

/* Landing: multi-voice interaction sample. Replaces the book-preview
   page mock-up. Shows the core social-recollection feature: one
   author posts, a friend pushes back, a parent confirms the friend.
   That arc is the product in microcosm. */
.landing-interaction-wrap {
    max-width: 720px;
    margin: 0 auto;
    padding: 24px 16px 8px;
}
.landing-interaction-label {
    font-family: 'Inter', system-ui, sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.22em;
    font-size: 0.72rem;
    color: var(--mst-primary, #c8a572);
    text-align: center;
    margin: 0 0 14px;
}
.landing-interaction {
    background: var(--mst-card, #fff);
    border: 1px solid var(--mst-border);
    border-radius: 14px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.06);
    overflow: hidden;
}
.landing-interaction-post { padding: 22px 24px 20px; }
.landing-interaction-head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}
.landing-interaction-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--mst-light, #f5efe6);
    color: var(--mst-primary, #c8a572);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    flex-shrink: 0;
    border: 1px solid var(--mst-border);
}
/* Three quiet character tints so the avatars don't look interchangeable. */
.landing-interaction-avatar-a { background: #e9e0c7; color: #7a5a25; }
.landing-interaction-avatar-s { background: #d7e3df; color: #2e5b4e; }
.landing-interaction-avatar-l { background: #e4d5d0; color: #8a4434; }

.landing-interaction-name {
    font-weight: 600;
    color: var(--mst-text);
    font-size: 0.98rem;
}
.landing-interaction-relation {
    color: var(--mst-muted, #6b6258);
    font-weight: 400;
    font-style: italic;
    font-size: 0.88rem;
}
.landing-interaction-meta {
    color: var(--mst-muted, #6b6258);
    font-size: 0.82rem;
}
.landing-interaction-title {
    font-family: 'Cormorant Garamond', 'Fraunces', Georgia, serif;
    font-style: italic;
    font-weight: 600;
    font-size: 1.55rem;
    color: var(--mst-text);
    margin: 4px 0 10px;
    line-height: 1.15;
}
.landing-interaction-body {
    font-family: 'Cormorant Garamond', 'Fraunces', Georgia, serif;
    font-size: 1.08rem;
    line-height: 1.55;
    color: var(--mst-text);
    margin: 0;
}

.landing-interaction-thread {
    border-top: 1px solid var(--mst-border);
    background: var(--mst-surface, #fbf7ef);
    padding: 8px 24px 16px;
}
.landing-interaction-comment {
    display: flex;
    gap: 12px;
    padding: 14px 0;
}
.landing-interaction-comment + .landing-interaction-comment {
    border-top: 1px solid rgba(0, 0, 0, 0.06);
}
/* Nested reply — indented so the thread reads as 'someone replied to
   the previous reply.' */
.landing-interaction-comment-nested {
    padding-left: 40px;
    position: relative;
}
.landing-interaction-comment-nested::before {
    content: "";
    position: absolute;
    left: 18px;
    top: 18px;
    width: 14px;
    height: 14px;
    border-left: 2px solid var(--mst-border);
    border-bottom: 2px solid var(--mst-border);
    border-bottom-left-radius: 6px;
}
.landing-interaction-comment .landing-interaction-avatar {
    width: 34px;
    height: 34px;
    font-size: 0.9rem;
}
.landing-interaction-comment-body { flex: 1; min-width: 0; }
.landing-interaction-comment-body p {
    margin: 4px 0 0;
    color: var(--mst-text);
    font-size: 0.95rem;
    line-height: 1.5;
}
.landing-interaction-comment-body p em {
    color: var(--mst-primary, #c8a572);
    font-style: normal;
    font-weight: 600;
}

.landing-interaction-caption {
    margin: 18px auto 0;
    max-width: 540px;
    text-align: center;
    font-family: 'Cormorant Garamond', 'Fraunces', Georgia, serif;
    font-style: italic;
    font-size: 1.05rem;
    color: var(--mst-muted, #6b6258);
    line-height: 1.5;
}

@media (max-width: 540px) {
    .landing-interaction-post { padding: 18px 16px 16px; }
    .landing-interaction-thread { padding: 4px 16px 12px; }
    .landing-interaction-title { font-size: 1.35rem; }
    .landing-interaction-body { font-size: 1rem; }
}

/* === Admin layout ============================================== */
/* Admin pages span the full container — no NetworkSidebar, no
   narrow main column. Driven by _ViewStart in Views/Admin so each
   admin view keeps its existing markup; CSS just suppresses the
   gutter and widens the content column. */
body.admin-page .col-sidebar { display: none !important; }
body.admin-page .col-main {
    flex: 0 0 100% !important;
    max-width: 100% !important;
}
/* Some admin views use bare bootstrap cols (no col-main / col-sidebar)
   — Users.cshtml at least. Force any direct child .row > .col-md-2
   that contains the NetworkSidebar to collapse, and widen its sibling. */
body.admin-page .row > .col-md-2:has(> [data-component=NetworkSidebar]) { display: none !important; }

/* Editorial header used across admin pages — matches the .page-header
   pattern on user-facing surfaces so admin still feels part of the site. */
.admin-page-header {
    margin: 28px 0 24px;
    padding: 0 0 18px;
    border-bottom: 1px solid var(--mst-border);
    scroll-margin-top: 110px;
    position: relative;
    z-index: 0;
}
.admin-page-eyebrow {
    font-family: 'Inter', system-ui, sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.22em;
    font-size: 0.72rem;
    color: var(--mst-primary, #c8a572);
    margin: 0 0 6px;
}
/* Admin titles drop italic — italic Cormorant ascenders kept clipping
   into the sticky navbar even at modest sizes. Plain serif at the same
   weight still reads editorial without the bleed. */
.admin-page-title {
    font-family: 'Cormorant Garamond', 'Fraunces', Georgia, serif;
    font-weight: 600;
    font-size: 1.55rem;
    color: var(--mst-text);
    margin: 0;
    line-height: 1.3;
    overflow-wrap: break-word;
}
.admin-wide { width: 100%; }

/* === Premium: compact feature grid ============================
   Replaces the verbose 'What it actually looks like' prose with a
   tight icon + label + one-line grid. Marco: 'images speak more than
   all the verbose blob you have.' SVG glyphs (not emoji) keep the
   editorial tone. */
.premium-grid {
    margin: 0 0 40px;
}
.premium-grid-eyebrow {
    font-family: 'Inter', system-ui, sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.22em;
    font-size: 0.72rem;
    color: var(--mst-primary, #c8a572);
    margin: 0 0 14px;
    text-align: center;
}
.premium-grid-items {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
}
.premium-grid-card {
    background: var(--mst-card);
    border: 1px solid var(--mst-border);
    border-radius: 12px;
    padding: 18px 16px 14px;
    transition: border-color .12s, transform .12s, box-shadow .12s;
}
.premium-grid-card:hover {
    border-color: var(--mst-primary, #c8a572);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}
.premium-grid-icon {
    width: 28px;
    height: 28px;
    color: var(--mst-primary, #c8a572);
    margin-bottom: 8px;
    display: block;
}
.premium-grid-card h4 {
    font-family: 'Cormorant Garamond', 'Fraunces', Georgia, serif;
    font-style: italic;
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--mst-text);
    margin: 0 0 4px;
}
.premium-grid-card p {
    font-size: 0.88rem;
    color: var(--mst-muted, #6b6258);
    margin: 0;
    line-height: 1.4;
}

/* === Checkout success page ==================================== */
.checkout-success-wrap {
    max-width: 640px;
    margin: 0 auto;
    padding: 48px 20px;
}
.checkout-success-card {
    background: var(--mst-card);
    border: 1px solid var(--mst-border);
    border-left: 4px solid var(--mst-primary, #c8a572);
    border-radius: 14px;
    padding: 36px 32px;
    text-align: center;
}
.checkout-success-eyebrow {
    font-family: 'Inter', system-ui, sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.22em;
    font-size: 0.72rem;
    color: var(--mst-primary, #c8a572);
    margin: 0 0 8px;
}
.checkout-success-title {
    font-family: 'Cormorant Garamond', 'Fraunces', Georgia, serif;
    font-style: italic;
    font-weight: 600;
    font-size: 2rem;
    color: var(--mst-text);
    margin: 0 0 16px;
}
.checkout-success-lead {
    color: var(--mst-muted, #6b6258);
    line-height: 1.6;
    margin: 0 0 16px;
    text-align: left;
}
.checkout-success-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
    margin: 28px 0 14px;
}
.checkout-success-receipt {
    margin-top: 18px;
    color: var(--mst-muted, #6b6258);
    font-size: 0.85rem;
}
.checkout-success-receipt code {
    background: var(--mst-surface, #fbf7ef);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.82rem;
}

/* Admin analytics table — tabular-nums on every numeric cell so column
   numbers align vertically regardless of digit count. Inter for the
   numbers (proper tabular figures), gold weighting on the Total column. */
.analytics-table { font-variant-numeric: tabular-nums; }
.analytics-table th { font-family: 'Inter', system-ui, sans-serif; font-weight: 600; }
.analytics-table td { font-family: 'Inter', system-ui, sans-serif; }
.analytics-table thead th { border-bottom: 1px solid var(--mst-border); }
.analytics-table tbody tr td:nth-last-child(1) {
    background: rgba(200, 165, 114, 0.06);
}
.analytics-table thead th:nth-last-child(1) {
    background: rgba(200, 165, 114, 0.10);
    color: var(--mst-primary, #c8a572);
}

/* === Admin Users — wide table with sticky first 4 columns ===== */
.admin-users-scroll {
    overflow-x: auto;
    overflow-y: hidden;
    border: 1px solid var(--mst-border);
    border-radius: 10px;
    background: var(--mst-card);
    margin: 0 0 24px;
}
.admin-users-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 0.82rem;
    margin: 0;
}
.admin-users-table thead th {
    background: var(--mst-surface, #fbf7ef);
    color: var(--mst-muted, #6b6258);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-size: 0.66rem;
    padding: 10px 12px;
    border-bottom: 1px solid var(--mst-border);
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 3;
}
.admin-users-table tbody td {
    padding: 10px 12px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
    vertical-align: middle;
    background: var(--mst-card);
    white-space: nowrap;
}
/* Hover tint must be drawn over an opaque base on sticky cells or the
   scrolled columns underneath bleed through. Non-sticky cells can use
   semi-transparent — there's nothing behind them visually. */
.admin-users-table tbody tr:hover td { background-color: #faf6ec; }
.admin-users-num { font-variant-numeric: tabular-nums; color: var(--mst-text); }
.admin-users-todo { color: var(--mst-muted, #b3aa8c); font-style: italic; }

/* Sticky first 4 columns. Pixel offsets correspond to column widths
   below — keep them in sync with col-num/-user/-last/-first widths.
   Background MUST be fully opaque or the scrolled columns bleed through.
   Hex colors hardcoded (no var indirection) so a theme/var failure can't
   accidentally render the sticky cells transparent. background-clip
   stops painting at the cell edge so the column border doesn't show
   through, and isolation pins each cell in its own stacking context. */
.admin-users-sticky {
    position: sticky;
    z-index: 10;
    background-color: #ffffff !important;
    background-image: none !important;
    background-clip: padding-box !important;
    isolation: isolate;
}
.admin-users-table thead th.admin-users-sticky {
    z-index: 11; /* header sticky over body sticky */
    background-color: #fbf7ef !important;
}
[data-theme="dark"] .admin-users-sticky { background-color: #161b27 !important; }
[data-theme="dark"] .admin-users-table thead th.admin-users-sticky { background-color: #1b2130 !important; }
/* Each sticky column is pinned to ONE fixed width so the next column's
   `left` offset lands exactly at its trailing edge. Previously the widths
   were ranges (min != max), so a column rendering narrower than its max
   opened a gap between sticky columns that showed the scrolling content
   through — the "transparent between last name and username" bug. */
.admin-users-col-num   { left: 0;     min-width: 70px;  max-width: 70px;  width: 70px; }
.admin-users-col-user  { left: 70px;  min-width: 240px; max-width: 240px; width: 240px; }
.admin-users-col-last  { left: 310px; min-width: 150px; max-width: 150px; width: 150px; }
.admin-users-col-first { left: 460px; min-width: 150px; max-width: 150px; width: 150px; }
/* Right edge gets a subtle shadow so it's clear the rest scrolls. */
.admin-users-col-first { box-shadow: 6px 0 6px -4px rgba(0, 0, 0, 0.10); }
.admin-users-table tbody tr:hover .admin-users-sticky { background-color: #faf6ec !important; }
[data-theme="dark"] .admin-users-table tbody tr:hover .admin-users-sticky { background-color: #1f2638 !important; }

/* Long values in the sticky columns must NOT bleed into the next
   column. text-overflow:ellipsis on a <td> alone is unreliable — the
   table renderer happily paints overflowing text through sibling
   cells. Wrap each value in .admin-users-cell-clip (display:block
   + overflow:hidden + ellipsis) so the clip is guaranteed. Plus
   contain:paint on the td so painting stops at the cell boundary
   even when overflow rules get confused. */
.admin-users-col-user,
.admin-users-col-last,
.admin-users-col-first {
    overflow: hidden;
}
.admin-users-cell-clip {
    display: block;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.admin-users-handle,
.admin-users-email {
    display: block;
    max-width: 100%;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

.admin-users-col-actions { min-width: 480px; }
.admin-users-handle { font-weight: 700; color: var(--mst-text); font-size: 0.86rem; }
.admin-users-email  { color: var(--mst-muted, #6b6258); font-size: 0.72rem; }
.admin-users-flags  { margin-top: 4px; display: flex; gap: 4px; flex-wrap: wrap; }

.admin-flag {
    font-size: 0.62rem;
    padding: 1px 6px;
    border-radius: 6px;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    white-space: nowrap;
}
.admin-flag-super         { background: var(--mst-primary, #c8a572); color: #fff; }
.admin-flag-admin         { background: var(--mst-accent, #d9c79a); color: #1a1a1a; }
.admin-flag-bio           { background: #6b62a8; color: #fff; }
.admin-flag-banned        { background: #b34141; color: #fff; }
.admin-flag-banned-temp   { background: #f4b942; color: #5a4520; }
.admin-flag-unverified    { background: #f4d35e; color: #5a4520; }
.admin-flag-locked        { background: #888; color: #fff; }

.admin-status-pill {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #fff;
    background: #888;
    white-space: nowrap;
}
.admin-status-basic    { background: #aaa; }
.admin-status-personal { background: var(--mst-primary, #c8a572); }
.admin-status-family   { background: #2e7d4f; }
.admin-status-legacy   { background: #6b62a8; }
.admin-status-lapsed   { background: #b85c5c; }

.admin-users-actions {
    display: flex;
    gap: 4px;
    flex-wrap: nowrap;
    align-items: center;
}
.admin-users-btn {
    font-size: 0.72rem;
    font-weight: 600;
    padding: 4px 9px;
    border-radius: 6px;
    border: 1px solid var(--mst-border);
    background: var(--mst-card);
    color: var(--mst-text);
    text-decoration: none;
    line-height: 1.2;
    cursor: pointer;
    white-space: nowrap;
    transition: border-color .12s, background-color .12s;
}
.admin-users-btn:hover { border-color: var(--mst-primary); color: var(--mst-text); }
.admin-users-btn-warn    { border-color: #f4b942; color: #8a6020; }
.admin-users-btn-warn:hover    { background: rgba(244, 185, 66, 0.10); }
.admin-users-btn-good    { border-color: #2e7d4f; color: #1e5a36; }
.admin-users-btn-good:hover    { background: rgba(46, 125, 79, 0.10); }
.admin-users-btn-danger  { border-color: #b34141; color: #8a2828; }
.admin-users-btn-danger:hover  { background: rgba(179, 65, 65, 0.10); }
.admin-users-btn-premium { border-color: var(--mst-primary); color: var(--mst-primary); }
.admin-users-btn-premium:hover { background: rgba(200, 165, 114, 0.10); }

/* Banned rows: subtle red left edge. Bio rows: subtle purple. */
.admin-users-banned td.admin-users-sticky:first-child { box-shadow: inset 3px 0 0 #b34141; }
.admin-users-bio    td.admin-users-sticky:first-child { box-shadow: inset 3px 0 0 #6b62a8; }

/* Admin Users filter pills + sortable column headers */
.admin-users-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.admin-users-filter {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border: 1px solid var(--mst-border);
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--mst-text);
    background: var(--mst-card);
    text-decoration: none;
    transition: border-color .12s, background-color .12s;
}
.admin-users-filter:hover {
    border-color: var(--mst-primary, #c8a572);
    color: var(--mst-text);
}
.admin-users-filter.is-on {
    background: var(--mst-primary, #c8a572);
    color: #fff;
    border-color: var(--mst-primary, #c8a572);
}
.admin-users-filter-count {
    font-size: 0.66rem;
    background: rgba(0, 0, 0, 0.08);
    padding: 1px 6px;
    border-radius: 999px;
    font-weight: 700;
}
.admin-users-filter.is-on .admin-users-filter-count {
    background: rgba(255, 255, 255, 0.25);
}

/* Sortable header link — inherits the th's styling, just makes the
   whole label clickable with a subtle arrow. */
.admin-users-sort {
    color: inherit;
    text-decoration: none;
    display: inline-block;
    width: 100%;
}
.admin-users-sort:hover {
    color: var(--mst-primary, #c8a572);
}
.admin-users-sort.admin-users-sort-active {
    color: var(--mst-primary, #c8a572);
}
.admin-users-sort.text-end {
    text-align: right;
}

/* === Family plan coverage banners (Premium index) + management page === */
.family-plan-banner {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    border: 1px solid var(--mst-border);
    border-radius: 12px;
    margin: 0 0 24px;
    flex-wrap: wrap;
}
.family-plan-banner-owner {
    background: rgba(46, 125, 79, 0.06);
    border-left: 4px solid #2e7d4f;
    justify-content: space-between;
}
.family-plan-banner-covered {
    background: rgba(200, 165, 114, 0.06);
    border-left: 4px solid var(--mst-primary, #c8a572);
}
.family-plan-banner-eyebrow {
    font-family: 'Inter', system-ui, sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.22em;
    font-size: 0.66rem;
    color: var(--mst-primary, #c8a572);
    margin: 0 0 4px;
}
.family-plan-banner-line {
    margin: 0;
    color: var(--mst-text);
    font-size: 0.98rem;
    line-height: 1.4;
}

/* /Premium/FamilyMembers page */
.family-members-wrap {
    max-width: 760px;
    margin: 0 auto;
    padding: 0 0 60px;
}
.family-members-seats {
    background: var(--mst-surface, #fbf7ef);
    border: 1px solid var(--mst-border);
    border-radius: 10px;
    padding: 14px 18px;
    margin: 0 0 24px;
}
.family-members-seats-line {
    margin: 0;
    font-size: 1.05rem;
    color: var(--mst-text);
}
.family-members-section-title {
    font-family: 'Cormorant Garamond', 'Fraunces', Georgia, serif;
    font-style: italic;
    font-weight: 600;
    font-size: 1.4rem;
    color: var(--mst-text);
    margin: 26px 0 12px;
}
.family-members-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.family-members-card {
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--mst-card);
    border: 1px solid var(--mst-border);
    border-radius: 12px;
    padding: 12px 16px;
}
.family-members-eligible { background: var(--mst-surface, #fbf7ef); }
.family-members-avatar {
    width: 44px; height: 44px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    background: var(--mst-light, #f5efe6);
    color: var(--mst-primary, #c8a572);
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 1rem;
    border: 1px solid var(--mst-border);
}
.family-members-avatar img { width: 100%; height: 100%; object-fit: cover; }
.family-members-body { flex: 1; min-width: 0; }
.family-members-name { font-weight: 700; color: var(--mst-text); }
.family-members-handle { font-size: 0.82rem; }
.family-members-form { margin: 0; }
.family-members-empty {
    background: var(--mst-surface, #fbf7ef);
    border: 1px dashed var(--mst-border);
    border-radius: 12px;
    padding: 18px;
    color: var(--mst-muted, #6b6258);
}
.family-members-empty a { color: var(--mst-primary, #c8a572); }

/* === Book view side arrows + page-turn animation =============== */
/* Large left/right arrows floating outside the page-frame. Click to
   turn a page. Hidden by JS on first / last page. */
.book-arrows {
    position: relative;
    z-index: 4;
    pointer-events: none;
}
.book-side-arrow {
    position: absolute;
    top: 50vh;
    transform: translateY(-50%);
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: 1px solid var(--mst-border);
    background: var(--mst-card);
    color: var(--mst-primary, #c8a572);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
    cursor: pointer;
    pointer-events: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform .15s ease, box-shadow .15s ease, background .15s;
}
.book-side-arrow:hover {
    transform: translateY(-50%) scale(1.08);
    box-shadow: 0 8px 26px rgba(0, 0, 0, 0.12);
    background: var(--mst-surface, #fbf7ef);
}
.book-side-arrow:active { transform: translateY(-50%) scale(0.96); }
.book-side-arrow svg { width: 28px; height: 28px; }
.book-side-arrow-prev { left: 10px; }
.book-side-arrow-next { right: 10px; }
[data-theme=dark] .book-side-arrow {
    background: #1d1915;
    border-color: rgba(255, 255, 255, 0.10);
}
@media (max-width: 720px) {
    /* On phones the arrows would crowd the page frame — bring them
       inside the page padding and shrink slightly. */
    .book-side-arrow { width: 44px; height: 44px; }
    .book-side-arrow svg { width: 22px; height: 22px; }
    .book-side-arrow-prev { left: 4px; }
    .book-side-arrow-next { right: 4px; }
}

/* Page-turn motion now lives with the .book-spread rules above
   (lift + slide via bookTurnForward / bookTurnBack). */

/* === Family Tree picker — switch between personal + group trees === */
.tree-picker {
    background: var(--mst-surface, #fbf7ef);
    border: 1px solid var(--mst-border);
    border-radius: 12px;
    padding: 12px 14px;
}
.tree-picker-label {
    font-family: 'Inter', system-ui, sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.22em;
    font-size: 0.66rem;
    color: var(--mst-primary, #c8a572);
    margin: 0 0 8px;
}
.tree-picker-pills {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.tree-picker-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border: 1px solid var(--mst-border);
    border-radius: 999px;
    background: var(--mst-card);
    color: var(--mst-text);
    font-size: 0.86rem;
    font-weight: 600;
    text-decoration: none;
    transition: border-color .12s, background-color .12s;
}
.tree-picker-pill:hover {
    border-color: var(--mst-primary, #c8a572);
    color: var(--mst-text);
}
.tree-picker-pill.is-active {
    background: var(--mst-primary, #c8a572);
    color: #fff;
    border-color: var(--mst-primary, #c8a572);
}
/* Subtle left dot keyed to the tier so 'family' / 'friends' / 'mixed'
   / 'personal' are visually distinct in the picker. */
.tree-picker-pill::before {
    content: ;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--tier-family);
}
.tree-picker-pill-personal::before { background: var(--mst-primary, #c8a572); }
.tree-picker-pill-family::before   { background: #a94442; }
.tree-picker-pill-friends::before  { background: #4a7fb0; }
.tree-picker-pill-mixed::before    { background: #8a4a8a; }
.tree-picker-pill.is-active::before { background: rgba(255, 255, 255, 0.65); }

.tree-picker-pill-role {
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 1px 6px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.06);
    color: inherit;
}
.tree-picker-pill.is-active .tree-picker-pill-role {
    background: rgba(255, 255, 255, 0.20);
}
.tree-picker-share {
    margin: 10px 0 0;
}
.tree-picker-share a, .tree-picker-empty a {
    color: var(--mst-primary, #c8a572);
}

/* ── Recording modal (voice + video) ─────────────────────────────────
   Full-screen overlay with the camera preview / audio level meter
   centred. Lives in _RecordingModal.cshtml and is opened by
   window.kronosRecorder.open({ mode, postId, onSaved }). */
.recorder-modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
}
.recorder-modal[hidden] { display: none; }
.recorder-modal-scrim {
    position: absolute;
    inset: 0;
    background: rgba(26, 24, 18, 0.55);
    cursor: pointer;
}
.recorder-modal-body {
    position: relative;
    background: #fdf9ef;
    border-radius: 14px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.32);
    width: min(640px, 92vw);
    padding: 32px 28px 24px;
    font-family: 'Inter', system-ui, sans-serif;
    color: #2b241c;
}
.recorder-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 1px solid #d8c69c;
    background: #fff;
    font-size: 1.1rem;
    color: #5a4520;
    cursor: pointer;
    line-height: 1;
}
.recorder-title {
    font-family: 'Fraunces', Georgia, serif;
    font-size: 1.4rem;
    margin: 0 0 6px;
    color: #2b241c;
}
.recorder-subtitle {
    color: #6b6258;
    font-size: 0.88rem;
    line-height: 1.5;
    margin: 0 0 18px;
}
.recorder-stage {
    background: #1b1814;
    border-radius: 10px;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    position: relative;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.recorder-preview {
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: #1b1814;
}
.recorder-meter {
    width: 70%;
    height: 28px;
    display: flex;
    align-items: center;
}
.recorder-meter-bar {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 4px;
    overflow: hidden;
}
.recorder-meter-bar span {
    display: block;
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #2dd4bf, #d4a84a);
    border-radius: 4px;
    transition: width .08s ease-out;
}
.recorder-timer {
    position: absolute;
    bottom: 10px;
    right: 14px;
    font-family: 'Fraunces', Georgia, serif;
    font-variant-numeric: tabular-nums;
    color: #fff;
    font-size: 1rem;
    background: rgba(0, 0, 0, 0.45);
    padding: 2px 10px;
    border-radius: 999px;
}
.recorder-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}
.recorder-btn-stop {
    background: #b34141;
    border-color: #b34141;
}
.recorder-status {
    font-size: 0.82rem;
    color: #6b6258;
    line-height: 1.4;
    min-height: 1.2em;
}

/* Permission pre-roll — shown BEFORE the browser prompt so the user
   knows what's about to happen (many users freeze when the browser
   pops the permission dialog). */
.recorder-preroll {
    background: #fdf9ef;
    border: 1px dashed #d8c69c;
    border-radius: 8px;
    padding: 16px 18px;
    margin-bottom: 14px;
    color: #2b241c;
    font-size: 0.92rem;
    line-height: 1.5;
}
.recorder-preroll p { margin: 0 0 10px; }
.recorder-preroll-tip {
    color: #6b6258;
    font-size: 0.82rem;
}

/* Denied recovery — shown when the browser explicitly blocks
   camera/mic. We can't unblock from the page so we walk the user
   through it step by step. */
.recorder-denied {
    margin-top: 12px;
    padding: 14px 16px;
    background: #fef2dc;
    border: 1px solid #d8c69c;
    border-radius: 8px;
    color: #5a4520;
    font-size: 0.88rem;
    line-height: 1.5;
}
.recorder-denied ol { margin: 6px 0 0 1.2em; padding: 0; }
.recorder-denied li { margin-bottom: 4px; }

/* Premium-locked badge on the recording action buttons. Subtle star
   in the corner signals "this is premium" without hiding the
   feature from non-subscribers (discoverability matters). */
.story-action-premium-dot {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #d4a84a;
    color: #2b241c;
    font-size: 0.62rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

/* ── Premium upgrade nudge modal ─────────────────────────────────
   Shown when a non-premium user clicks into a premium feature.
   Brief, polite, links to /Premium. */
.premium-upgrade-modal {
    position: fixed;
    inset: 0;
    z-index: 2100;
    display: flex;
    align-items: center;
    justify-content: center;
}
.premium-upgrade-modal[hidden] { display: none; }
.premium-upgrade-scrim {
    position: absolute;
    inset: 0;
    background: rgba(26, 24, 18, 0.55);
    cursor: pointer;
}
.premium-upgrade-body {
    position: relative;
    background: #fdf9ef;
    border-radius: 14px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.32);
    width: min(420px, 92vw);
    padding: 32px 28px 24px;
    text-align: center;
    font-family: 'Inter', system-ui, sans-serif;
    color: #2b241c;
}
.premium-upgrade-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 1px solid #d8c69c;
    background: #fff;
    font-size: 1.1rem;
    color: #5a4520;
    cursor: pointer;
    line-height: 1;
}
.premium-upgrade-mark {
    width: 56px;
    height: 56px;
    margin: 0 auto 14px;
    border-radius: 50%;
    background: linear-gradient(135deg, #d4a84a, #b8871a);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.7rem;
    box-shadow: 0 4px 14px rgba(184, 135, 26, 0.35);
}
.premium-upgrade-title {
    font-family: 'Fraunces', 'Cormorant Garamond', Georgia, serif;
    font-size: 1.4rem;
    margin: 0 0 8px;
}
.premium-upgrade-why {
    color: #6b6258;
    font-size: 0.9rem;
    line-height: 1.5;
    margin: 0 0 18px;
}
.premium-upgrade-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

/* ── AI Story Assistant drawer ───────────────────────────────────
   Slides in from the bottom-right with the model's follow-up
   questions for the writer's current draft. Editorial styling —
   serif "Help me remember" eyebrow, italic questions, an Insert
   button per question that drops the text into the editor. */
.ai-suggest-panel {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 1600;
    width: min(420px, 92vw);
    max-height: 70vh;
    background: #fdf9ef;
    border: 1px solid #d8c69c;
    border-radius: 12px;
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.18);
    overflow-y: auto;
    font-family: 'Inter', system-ui, sans-serif;
    color: #2b241c;
}
.ai-suggest-panel[hidden] { display: none; }
.ai-suggest-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px 6px;
}
.ai-suggest-eyebrow {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: #8a7355;
    font-weight: 600;
}
.ai-suggest-close {
    background: transparent;
    border: 0;
    font-size: 1.2rem;
    color: #5a4520;
    cursor: pointer;
    line-height: 1;
}
.ai-suggest-body { padding: 0 18px 16px; }
.ai-suggest-loading,
.ai-suggest-empty {
    padding: 14px 0;
    color: #6b6258;
    font-size: 0.88rem;
    font-style: italic;
}
.ai-suggest-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.ai-suggest-list li {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 12px 0;
    border-top: 1px solid rgba(212, 168, 74, 0.18);
}
.ai-suggest-list li:first-child { border-top: 0; }
.ai-suggest-q {
    font-family: 'Fraunces', Georgia, serif;
    font-size: 0.98rem;
    line-height: 1.4;
    flex: 1 1 auto;
    color: #2b241c;
}
.ai-suggest-insert {
    flex: 0 0 auto;
    background: var(--mst-primary, #0f6466);
    color: #fff;
    border: 0;
    border-radius: 999px;
    padding: 5px 12px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .12s;
}
.ai-suggest-insert:hover { background: var(--mst-primary-2, #144f52); }

/* Time-capsule fieldset on Post Create / Edit — visible eyebrow + a
   pair of release fields when the user opts in. */
.time-capsule-block {
    margin-top: 12px;
    border: 1px dashed var(--mst-border, #e7d8b0);
    border-radius: 8px;
    padding: 12px 14px;
    background: rgba(212, 168, 74, 0.04);
}
.time-capsule-block-head {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 0.84rem;
    color: var(--mst-text, #2b241c);
    font-weight: 600;
    margin-bottom: 6px;
}
.time-capsule-block-body {
    display: none;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 10px;
}
.time-capsule-block.is-on .time-capsule-block-body { display: flex; }
.time-capsule-block-body label {
    font-size: 0.78rem;
    color: var(--mst-muted, #6b6258);
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1 1 220px;
}
.time-capsule-block-help {
    width: 100%;
    font-size: 0.78rem;
    color: var(--mst-muted, #6b6258);
    line-height: 1.45;
    margin: 4px 0 0;
}

/* In-book audio + video embed. Same wrap / size grammar as photos so
   the writer's mental model is one thing. Audio + video clips live in
   their own end-of-page block (.book-story-audio / .book-story-video)
   rather than mixed in with the photo strip. */
.book-story-audio,
.book-story-video {
    margin: 18px 0 4px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.book-photo-audio,
.book-photo-video {
    background: rgba(212, 168, 74, 0.06);
    border: 1px solid var(--mst-border, #e7d8b0);
    border-radius: 8px;
    padding: 10px 12px;
    margin: 0;
}
.book-photo-audio audio { width: 100%; }
.book-photo-video video {
    width: 100%;
    max-height: 480px;
    border-radius: 6px;
    background: #1b1814;
    display: block;
}
.book-photo-audio .book-photo-audio-caption,
.book-photo-video .book-photo-audio-caption {
    font-family: 'Fraunces', Georgia, serif;
    font-style: italic;
    font-size: 0.85rem;
    color: var(--mst-muted, #6b6258);
    margin-top: 6px;
    text-align: center;
}

/* Time-capsule pending badge on the writer's own draft list. */
.time-capsule-pending {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.72rem;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(212, 168, 74, 0.18);
    color: #8a6020;
    font-weight: 600;
    letter-spacing: 0.04em;
}

/* Eras list/timeline view toggle — shared between LifeChapters/Index and
   LifeChapters/Map so both pages read as two views of the same thing. */
.era-view-toggle {
    display: inline-flex;
    gap: 0;
    border: 1px solid var(--mst-border, rgba(0,0,0,0.12));
    border-radius: 999px;
    padding: 2px;
    background: rgba(0,0,0,0.02);
}
.era-view-pill {
    padding: 4px 16px;
    border-radius: 999px;
    font-size: 0.85rem;
    color: var(--mst-muted, #6a6a6a);
    text-decoration: none;
    line-height: 1.4;
    transition: background 0.15s, color 0.15s;
}
.era-view-pill:hover { color: var(--mst-text, #2b241c); }
.era-view-pill.is-active {
    background: var(--mst-primary, #0f6466);
    color: #fff;
}
.era-view-pill.is-active:hover { color: #fff; }

/* Book "People in these pages" index — classic dotted-leader index:
   name left, page numbers right, dotted rule filling the gap. */
.book-people-index { list-style: none; margin: 0; padding: 0; }
.book-people-index-row {
    display: flex;
    align-items: baseline;
    gap: 6px;
    padding: 5px 0;
    font-family: 'Cormorant Garamond', 'Fraunces', Georgia, serif;
    font-size: 1.05rem;
}
.book-people-index-name { white-space: nowrap; }
.book-people-index-dots {
    flex: 1 1 auto;
    border-bottom: 1px dotted var(--mst-border, rgba(0,0,0,0.25));
    transform: translateY(-3px);
    min-width: 18px;
}
.book-people-index-pages { white-space: nowrap; color: var(--mst-muted); font-variant-numeric: tabular-nums; }

/* AI polish diff — inside the polish modal we DO want add/remove to
   read clearly (the global .diff-added/.diff-removed are neutralised
   elsewhere). Green = kept/added, struck red = removed. */
.ai-polish-diff {
    max-height: 320px;
    overflow-y: auto;
    padding: 12px 14px;
    border: 1px solid var(--mst-border);
    border-radius: 8px;
    background: var(--mst-canvas, #fbf9f4);
    line-height: 1.6;
    white-space: pre-wrap;
    font-family: 'Cormorant Garamond', 'Fraunces', Georgia, serif;
    font-size: 1.05rem;
}
.ai-polish-diff .diff-added {
    background: rgba(40, 150, 90, 0.16);
    color: #1f7a47;
    border-radius: 3px;
}
.ai-polish-diff .diff-removed {
    background: rgba(200, 60, 60, 0.12);
    color: #b23b3b;
    text-decoration: line-through;
    border-radius: 3px;
}