/* =============================================================
   AMAPELLA — SHARED STYLES
   ============================================================= */

/* ============================================= PALETTE */

:root {
    --bg-deepest: #0F1418;
    --bg-deepest-rgb: 15, 20, 24;
    --bg-panel: #181B20;
    --bg-panel-rgb: 24, 27, 32;
    --bg-card: #1E2328;
    --bg-card-rgb: 30, 35, 40;
    --bg-input: #2C373D;
    --bg-input-rgb: 44, 55, 61;
    /* --bg-hover follows --bg-input so each theme's hover surface inherits
       the per-theme input bg (sage on Hadal, lavender-grey on Smoke, etc).
       Otherwise voice-btn:hover and dossier btn-draft:hover always show
       Cinema's blue-teal regardless of the active lens. */
    --bg-hover: var(--bg-input);

    /* Border-rgb is the dark cool-grey triplet used across the app for hairline
       borders + faint dividers. Per-theme overrides shift it toward the lens
       hue so Monolith doesn't keep cool-blue stitching everywhere, etc. */
    --border-rgb: 74, 84, 94;
    --border: rgba(var(--border-rgb), 0.2);
    --border-hover: rgba(var(--accent-rgb),0.25);

    --text-primary: #D0D4D8;
    --text-primary-rgb: 208, 212, 216;
    --text-secondary: #808D96;
    --text-muted: #525D69;

    --accent: #5D747A;
    --accent-rgb: 93, 116, 122;
    --accent-bright: #FADEC2;
    --accent-bright-rgb: 250, 222, 194;
    /* Deeper, richer variant of accent — used for titles, key headings,
       psych report names, anywhere we want the theme to read with more
       presence than the soft default accent. Per-theme below. */
    --accent-deep: #40565C;
    --accent-deep-rgb: 64, 86, 92;
    --accent-dim: rgba(var(--accent-rgb), 0.15);
    --accent-border: rgba(var(--accent-rgb), 0.3);

    --narrator: #6B7D8A;
    --narrator-rgb: 107, 125, 138;
    --narrator-dim: rgba(var(--narrator-rgb), 0.1);
    --narrator-border: rgba(var(--narrator-rgb), 0.25);

    --memory: #A8B8C4;
    --memory-rgb: 168, 184, 196;
    --memory-dim: rgba(var(--memory-rgb), 0.08);
    --memory-border: rgba(var(--memory-rgb), 0.2);

    /* Mobile DM chat bubbles — were hardcoded blue/grey rgba's that leaked
       cool tone into Smoke / Velvet / Monolith. Themed below per lens so
       both incoming (agent, npc) and outgoing (user) bubbles follow. */
    --user-bubble-bg: rgba(42, 60, 80, 0.85);
    --user-bubble-color: #d0dde8;
    --agent-bubble-bg: rgba(40, 44, 52, 0.85);

    --warning: #C4A882;
    --warning-dim: rgba(196,168,130,0.1);

    --font-serif: 'Newsreader', serif;
    --font-sans: 'Karla', sans-serif;
    --font-sans-weight: 200;
    --font-mono: 'DotGothic16', monospace;
}

/* Theme overrides applied via document.documentElement[data-theme="..."].
   These mirror the codex.html canvas lens families: deep grey surfaces first,
   then a restrained lens glow/accent on top. */
:root[data-theme="hadal"] {
    --accent: #7FB0AE;
    --accent-rgb: 127, 176, 174;
    --accent-bright: #A8C0A0;
    --accent-bright-rgb: 168, 192, 160;
    --bg-deepest: #04060B;
    --bg-deepest-rgb: 4, 6, 11;
    --bg-panel: #0D1217;
    --bg-panel-rgb: 13, 18, 23;
    --bg-card: #11171D;
    --bg-card-rgb: 17, 23, 29;
    --text-primary: #D0D5D8;
    --text-primary-rgb: 208, 213, 216;
    --text-secondary: #7F8B93;
    --text-muted: #505D65;
    --accent-deep: #5F8F8D;
    --accent-deep-rgb: 95, 143, 141;
    --memory: #A8C0A0;
    --memory-rgb: 168, 192, 160;
    --narrator: #7D9E96;
    --narrator-rgb: 125, 158, 150;
    --bg-input: #263139;
    --bg-input-rgb: 38, 49, 57;
    --user-bubble-bg: rgba(35, 49, 58, 0.85);
    --user-bubble-color: #d6dee4;
    --agent-bubble-bg: rgba(28, 35, 40, 0.85);
    --border-rgb: 72, 83, 90;
}
:root[data-theme="smoke"] {
    --accent: #C9B8DC;
    --accent-rgb: 201, 184, 220;
    --accent-bright: #E3B8CC;
    --accent-bright-rgb: 227, 184, 204;
    --bg-deepest: #151413;
    --bg-deepest-rgb: 21, 20, 19;
    --bg-panel: #23211F;
    --bg-panel-rgb: 35, 33, 31;
    --bg-card: #302D2A;
    --bg-card-rgb: 48, 45, 42;
    --text-primary: #D1CECA;
    --text-primary-rgb: 209, 206, 202;
    --text-secondary: #8F8983;
    --text-muted: #5F5A54;
    --accent-deep: #9B85B2;
    --accent-deep-rgb: 155, 133, 178;
    --memory: #D8B7CC;
    --memory-rgb: 216, 183, 204;
    --narrator: #A995B8;
    --narrator-rgb: 169, 149, 184;
    --bg-input: #393631;
    --bg-input-rgb: 57, 54, 49;
    --user-bubble-bg: rgba(48, 43, 38, 0.85);
    --user-bubble-color: #ded8d0;
    --agent-bubble-bg: rgba(40, 38, 35, 0.85);
    --border-rgb: 82, 78, 73;
}
:root[data-theme="velvet"] {
    --accent: #A5B0DE;
    --accent-rgb: 165, 176, 222;
    --accent-bright: #EAC2B3;
    --accent-bright-rgb: 234, 194, 179;
    --bg-deepest: #141218;
    --bg-deepest-rgb: 20, 18, 24;
    --bg-panel: #201D26;
    --bg-panel-rgb: 32, 29, 38;
    --bg-card: #2C2632;
    --bg-card-rgb: 44, 38, 50;
    --text-primary: #D2D0D6;
    --text-primary-rgb: 210, 208, 214;
    --text-secondary: #918C9B;
    --text-muted: #5F5968;
    --accent-deep: #7F8CC4;
    --accent-deep-rgb: 127, 140, 196;
    --memory: #B0BAE4;
    --memory-rgb: 176, 186, 228;
    --narrator: #8F98C3;
    --narrator-rgb: 143, 152, 195;
    --bg-input: #34303B;
    --bg-input-rgb: 52, 48, 59;
    --user-bubble-bg: rgba(48, 42, 56, 0.85);
    --user-bubble-color: #ded9e4;
    --agent-bubble-bg: rgba(39, 36, 45, 0.85);
    --border-rgb: 83, 78, 91;
}
:root[data-theme="monolith"] {
    --accent: #E7B9C3;
    --accent-rgb: 231, 185, 195;
    --accent-bright: #F76D93;
    --accent-bright-rgb: 247, 109, 147;
    --bg-deepest: #131615;
    --bg-deepest-rgb: 19, 22, 21;
    --bg-panel: #1F2221;
    --bg-panel-rgb: 31, 34, 33;
    --bg-card: #2B2E2D;
    --bg-card-rgb: 43, 46, 45;
    --text-primary: #D1D2CF;
    --text-primary-rgb: 209, 210, 207;
    --text-secondary: #8C918E;
    --text-muted: #5A605D;
    --accent-deep: #B98F9A;
    --accent-deep-rgb: 185, 143, 154;
    --memory: #D8D5CF;
    --memory-rgb: 216, 213, 207;
    --narrator: #B6B8B3;
    --narrator-rgb: 182, 184, 179;
    --bg-input: #333735;
    --bg-input-rgb: 51, 55, 53;
    --user-bubble-bg: rgba(45, 49, 47, 0.85);
    --user-bubble-color: #dddfdc;
    --agent-bubble-bg: rgba(37, 40, 39, 0.85);
    --border-rgb: 78, 84, 81;
}
:root[data-theme="winery"] {
    --accent: #9386AC;
    --accent-rgb: 147, 134, 172;
    --accent-bright: #DE5858;
    --accent-bright-rgb: 222, 88, 88;
    --bg-deepest: #171717;
    --bg-deepest-rgb: 23, 23, 23;
    --bg-panel: #242424;
    --bg-panel-rgb: 36, 36, 36;
    --bg-card: #303030;
    --bg-card-rgb: 48, 48, 48;
    --text-primary: #736783;
    --text-primary-rgb: 115, 103, 131;
    --text-secondary: #9891A9;
    --text-muted: #594C68;
    --accent-deep: #634276;
    --accent-deep-rgb: 99, 66, 118;
    --memory: #D0D0D0;
    --memory-rgb: 208, 208, 208;
    --narrator: #E37373;
    --narrator-rgb: 227, 115, 115;
    --bg-input: #3F3B46;
    --bg-input-rgb: 63, 59, 70;
    --user-bubble-bg: #393340;
    --user-bubble-color: #FFFFFF;
    --agent-bubble-bg: #262626;
    --border-rgb: 77, 60, 94;
}
:root[data-theme="opera"] {
    --accent: #8B7382;
    --accent-rgb: 139, 115, 130;
    --accent-bright: #DD9F8B;
    --accent-bright-rgb: 221, 159, 139;
    --bg-deepest: #150D12;
    --bg-deepest-rgb: 21, 13, 18;
    --bg-panel: #221C20;
    --bg-panel-rgb: 34, 28, 32;
    --bg-card: #2D2329;
    --bg-card-rgb: 45, 35, 41;
    --text-primary: #F2F2F2;
    --text-primary-rgb: 242, 242, 242;
    --text-secondary: #DCDCDC;
    --text-muted: #B8B8B8;
    --accent-deep: #5B2F49;
    --accent-deep-rgb: 91, 47, 73;
    --memory: #725E6B;
    --memory-rgb: 114, 94, 107;
    --narrator: #A57B95;
    --narrator-rgb: 165, 123, 149;
    --bg-input: #342C31;
    --bg-input-rgb: 52, 44, 49;
    --user-bubble-bg: #3B363A;
    --user-bubble-color: #F2F2F2;
    --agent-bubble-bg: #2B2328;
    --border-rgb: 89, 69, 81;
}

/* ============================================= RESET */

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    background: var(--bg-deepest);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 18px;
    font-weight: var(--font-sans-weight);
    line-height: 1.6;
}

::selection {
    background: rgba(var(--accent-rgb),0.3);
    color: var(--accent-bright);
}

/* ============================================= NAV */

.nav {
    position: fixed;
    top: 0;
    width: 100%;
    height: 48px;
    background: var(--bg-deepest);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 24px;
    border-bottom: 1px solid var(--border);
    z-index: 50;
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 24px;
}

.nav-logo {
    font-family: var(--font-serif);
    font-style: italic;
    font-weight: 300;
    font-size: 31px;
    text-transform: lowercase;
    letter-spacing: 1px;
    text-decoration: none;
    color: var(--accent);
    background: linear-gradient(110deg,
        var(--accent-bright) 0%,
        var(--memory) 20%,
        var(--accent) 42%,
        var(--memory) 62%,
        var(--accent-bright) 80%,
        var(--accent-deep) 100%);
    background-size: 260% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: logoShimmer 5.8s ease-in-out infinite, logoMemoryGlow 4.2s ease-in-out infinite;
}
.nav-logo:hover {
    filter: drop-shadow(0 0 22px rgba(var(--accent-rgb),0.35));
}

.nav-version-tag {
    margin-left: -14px;
    font-family: var(--font-mono);
    font-size: 9px;
    letter-spacing: 2px;
    line-height: 1;
    text-transform: uppercase;
    color: rgba(var(--accent-rgb),0.56);
    white-space: nowrap;
}

@keyframes logoShimmer {
    0%, 100% { background-position: 0% 50%; }
    50%      { background-position: 100% 50%; }
}

@keyframes logoMemoryGlow {
    0%, 100% { filter: drop-shadow(0 0 0 rgba(var(--memory-rgb),0)); }
    50%      { filter: drop-shadow(0 0 12px rgba(var(--memory-rgb),0.22)); }
}

/* ============================================= PHOTOBOOTH IFRAME OVERLAY */

.pb-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 500;
    background: rgba(0,0,0,0.85);
    justify-content: center;
    align-items: center;
    overflow: hidden;
}
.pb-overlay.open { display: flex; }
.pb-star {
    position: absolute;
    width: 2px; height: 2px;
    background: var(--accent);
    border-radius: 50%;
    animation: pb-star-twinkle 3s ease-in-out infinite;
    pointer-events: none;
}
@keyframes pb-star-twinkle {
    0%, 100% { opacity: 0.05; transform: scale(0.8); }
    50% { opacity: 0.5; transform: scale(1.2); }
}
@media (max-width: 900px) {
    .pb-star { display: none; }
}
.pb-overlay iframe {
    /* Must be > 900px so the photobooth inside (/map.html?pb=1) gets the
       desktop two-panel layout instead of mobile stacked. Capped at 1400px
       so it doesn't dominate big screens. */
    width: min(94vw, 1400px);
    height: 90%;
    border: 1px solid rgba(var(--accent-bright-rgb), 0.12);
    border-radius: 0;
    background: var(--bg-deepest);
    position: relative; z-index: 0;
}
.nav-icon.pb-active { color: var(--accent); animation: pulse-slow 2s ease-in-out infinite; }

/* ============================================= DOSSIER IFRAME OVERLAY */

.dossier-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 500;
    background: rgba(0,0,0,0.85);
    justify-content: center;
    align-items: center;
}
.dossier-overlay.open { display: flex; }
.dossier-overlay iframe {
    width: 90%;
    height: 92%;
    border: 1px solid rgba(var(--accent-bright-rgb), 0.12);
    border-radius: 0;
    background: var(--bg-deepest);
}
.dossier-overlay .dossier-overlay-close {
    position: absolute;
    top: 16px;
    right: 24px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 28px;
    cursor: pointer;
    z-index: 501;
}
.dossier-overlay .dossier-overlay-close:hover { color: var(--accent); }

.nav-link {
    font-weight: 300;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 3px;
    color: #FFFFFF;
    text-decoration: none;
    transition: color 0.2s;
}

.nav-link:hover { color: var(--accent); }
.nav-link.active { color: var(--accent); }

.nav-right {
    display: flex;
    align-items: center;
    gap: 16px;
}


.nav-icon {
    font-size: 19px;
    color: #FFFFFF;
    cursor: pointer;
    transition: color 0.2s;
    background: none;
    border: none;
    font-family: var(--font-sans);
}

.nav-icon:hover { color: var(--accent); }
.nav-icon svg { display: block; }

/* City/map switch pin — mobile-only (desktop uses the inline nav city picker).
   Hidden by default; the mobile @media reveals it once cities exist
   (amRenderNavCities toggles .cities-available). */
.nav-city-icon { display: none; align-items: center; justify-content: center; }

/* Mobile city-switch modal (opened by the .nav-city-icon pin) */
.nav-city-modal {
    position: fixed; inset: 0; z-index: 120;
    display: none;
    align-items: flex-start; justify-content: center;
    padding: 60px 20px 20px;
    background: rgba(0, 0, 0, 0.55);
    -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
}
.nav-city-modal.open { display: flex; }
.nav-city-sheet {
    width: 100%; max-width: 320px;
    background: var(--bg-deepest);
    border: 1px solid rgba(var(--accent-rgb), 0.4);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
}
.nav-city-sheet-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 13px 16px; border-bottom: 1px solid rgba(var(--accent-rgb), 0.18);
}
.nav-city-sheet-kicker {
    font-family: var(--font-mono); font-size: 10px; letter-spacing: 2.5px;
    text-transform: uppercase; color: rgba(var(--accent-rgb), 0.85);
}
.nav-city-sheet-close {
    background: none; border: none; color: var(--text-muted);
    font-size: 15px; line-height: 1; cursor: pointer; padding: 2px 6px;
}
.nav-city-sheet-close:hover { color: var(--accent); }
.nav-city-list { display: flex; flex-direction: column; max-height: 62vh; overflow-y: auto; }
.nav-city-opt {
    display: flex; align-items: center; gap: 12px;
    padding: 14px 16px; background: none; border: none;
    border-bottom: 1px solid rgba(var(--accent-rgb), 0.1);
    color: rgba(var(--text-primary-rgb), 0.88);
    font-family: var(--font-serif); font-style: italic; font-weight: 300;
    font-size: 18px; text-align: left; cursor: pointer;
    transition: background 0.2s, color 0.2s;
}
.nav-city-opt:last-child { border-bottom: none; }
.nav-city-opt:hover { background: rgba(var(--accent-rgb), 0.06); color: var(--text-primary); }
.nav-city-opt.active { color: var(--accent); }
.nav-city-opt-dot {
    width: 8px; height: 8px; flex-shrink: 0; border-radius: 50%;
    border: 1px solid rgba(var(--accent-rgb), 0.5); background: transparent;
}
.nav-city-opt.active .nav-city-opt-dot { background: var(--accent); border-color: var(--accent); }

.time-toggle.active { color: var(--accent); }
.music-toggle.active { color: var(--accent); }
.nav-page-help-icon {
    color: var(--accent-bright) !important;
    filter: drop-shadow(0 0 8px rgba(var(--accent-bright-rgb),0.18));
}
.nav-page-help-icon:hover {
    color: var(--accent) !important;
    filter: drop-shadow(0 0 12px rgba(var(--accent-rgb),0.32));
}

.nav-patch-status {
    height: 30px;
    min-width: 104px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 0 13px;
    box-sizing: border-box;
    border: 1px solid rgba(var(--accent-bright-rgb),0.72);
    border-radius: 0;
    background: rgba(var(--bg-deepest-rgb),0.68);
    color: var(--accent-bright);
    font-family: var(--font-mono);
    font-size: 9px;
    line-height: 1;
    letter-spacing: 2px;
    text-transform: uppercase;
    cursor: pointer;
    animation: amPatchStatusPulse 2.5s ease-in-out infinite;
    box-shadow: 0 0 0 rgba(var(--accent-bright-rgb),0);
    transition: border-color 0.18s ease, background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}
.nav-patch-status svg {
    width: 17px;
    height: 17px;
    flex-shrink: 0;
}
.nav-patch-status:disabled {
    cursor: default;
    opacity: 1;
}
.nav-patch-status.nav-patch-idle {
    min-width: 72px;
    background: rgba(var(--bg-deepest-rgb),0.76);
}
.nav-patch-status.nav-patch-patching {
    border-color: transparent;
    border-bottom-color: var(--accent-bright);
    background: rgba(var(--bg-deepest-rgb),0.52);
}
.nav-patch-status.nav-patch-tidying {
    border-color: var(--accent-bright);
    background: rgba(var(--accent-bright-rgb),0.035);
}
.nav-patch-status.nav-patch-hard_refresh {
    border-color: var(--accent-bright);
    background: var(--accent-bright);
    color: var(--bg-deepest);
    box-shadow: 0 0 18px rgba(var(--accent-bright-rgb),0.22);
}
.nav-patch-status.is-loading {
    opacity: 0.68;
}
.nav-patch-status.is-error {
    color: #ffb4ab !important;
    border-color: #ff7a70 !important;
    background: rgba(147,0,10,0.16) !important;
    animation: amPatchStatusError 0.24s steps(2) 7 !important;
    box-shadow: 0 0 16px rgba(255,122,112,0.32);
}
.nav-patch-status.is-angry-locked {
    min-width: 72px;
    color: var(--text-muted) !important;
    border-color: rgba(var(--border-rgb),0.38) !important;
    background: rgba(var(--bg-deepest-rgb),0.45) !important;
    cursor: not-allowed;
    animation: none !important;
    box-shadow: none !important;
    filter: grayscale(1);
}
.nav-patch-status.is-angry-locked svg {
    width: 18px;
    height: 18px;
}
.nav-patch-status:not(:disabled):hover {
    border-color: var(--accent-bright);
    box-shadow: 0 0 18px rgba(var(--accent-bright-rgb),0.2);
}
@keyframes amPatchStatusPulse {
    0%, 100% {
        transform: translateY(0);
        filter: drop-shadow(0 0 0 rgba(var(--accent-bright-rgb),0));
    }
    50% {
        transform: translateY(-2px);
        filter: drop-shadow(0 0 7px rgba(var(--accent-bright-rgb),0.32));
    }
}
@keyframes amPatchStatusError {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-2px) translateX(1px); }
}
.nav-patch-flash {
    position: fixed;
    top: 52px;
    right: 18px;
    z-index: 9500;
    max-width: min(320px, calc(100vw - 36px));
    padding: 10px 12px;
    border: 1px solid rgba(255,122,112,0.52);
    background: rgba(20,6,8,0.92);
    color: #ffdad6;
    font-family: var(--font-mono);
    font-size: 8px;
    letter-spacing: 1.4px;
    line-height: 1.45;
    text-transform: uppercase;
    opacity: 0;
    transform: translateY(-6px);
    pointer-events: none;
    transition: opacity 0.18s ease, transform 0.18s ease;
}
.nav-patch-flash.visible {
    opacity: 1;
    transform: translateY(0);
}

.am-autoplay-watch {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9200;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
.am-autoplay-watch.open { display: flex; }
.am-autoplay-watch-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(6,7,10,0.78);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}
.am-autoplay-watch-window {
    position: relative;
    z-index: 1;
    width: min(92vw, 520px);
    max-height: min(78vh, 680px);
    display: flex;
    flex-direction: column;
    background: var(--bg-deepest);
    border: 1px solid rgba(var(--accent-bright-rgb),0.16);
    box-shadow: 0 24px 70px rgba(0,0,0,0.58);
    overflow: hidden;
}
.am-autoplay-watch-head {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
    padding: 22px 24px 14px;
    border-bottom: 1px solid rgba(var(--border-rgb),0.18);
}
.am-autoplay-watch-tag {
    font-family: var(--font-mono);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.32em;
    color: var(--text-muted);
    margin-bottom: 4px;
}
.am-autoplay-watch-title {
    font-family: var(--font-serif);
    font-style: italic;
    font-weight: 200;
    font-size: 30px;
    line-height: 1;
    color: var(--accent);
}
.am-autoplay-watch-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 24px;
    line-height: 1;
    padding: 0 2px;
}
.am-autoplay-watch-close:hover { color: var(--accent); }
.am-autoplay-watch-note {
    padding: 14px 24px 0;
    font-family: var(--font-sans);
    font-size: 12px;
    line-height: 1.65;
    color: var(--text-secondary);
}
.am-autoplay-watch-body {
    overflow-y: auto;
    min-height: 96px;
    padding: 18px 24px 6px;
}
.am-autoplay-watch-loading,
.am-autoplay-watch-empty {
    padding: 22px 0;
    text-align: center;
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 18px;
    color: var(--text-secondary);
}
.am-autoplay-watch-section { margin-bottom: 18px; }
.am-autoplay-watch-section-title {
    font-family: var(--font-mono);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.3em;
    color: rgba(var(--accent-rgb),0.78);
    margin-bottom: 8px;
}
.am-autoplay-watch-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid rgba(var(--border-rgb),0.13);
}
.am-autoplay-watch-row:last-child { border-bottom: none; }
.am-autoplay-watch-name {
    font-family: var(--font-serif);
    font-style: italic;
    font-weight: 200;
    font-size: 19px;
    line-height: 1.15;
    color: var(--text-primary);
}
.am-autoplay-watch-meta {
    margin-top: 4px;
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.am-autoplay-watch-clear,
.am-autoplay-watch-btn {
    background: transparent;
    border: 1px solid rgba(var(--border-rgb),0.24);
    color: var(--text-secondary);
    cursor: pointer;
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    padding: 8px 12px;
    transition: color 0.18s, border-color 0.18s, background 0.18s;
}
.am-autoplay-watch-clear:hover,
.am-autoplay-watch-btn:hover {
    color: var(--accent);
    border-color: rgba(var(--accent-rgb),0.42);
    background: rgba(var(--accent-rgb),0.06);
}
.am-autoplay-watch-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 14px 24px 22px;
    border-top: 1px solid rgba(var(--border-rgb),0.14);
}
.am-autoplay-watch-btn-primary {
    color: var(--accent);
    border-color: rgba(var(--accent-rgb),0.32);
}

/* Settings popup */
.settings-popup {
    position: fixed;
    z-index: 9000;
    min-width: 200px;
    padding: 14px 18px;
    background: var(--bg-deepest);
    border: 1px solid rgba(var(--accent-bright-rgb), 0.12);
    border-radius: 0;
    box-shadow: 0 6px 24px rgba(0,0,0,0.5);
    font-family: var(--font-sans);
}
.settings-popup::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 40px;
    background: linear-gradient(180deg, rgba(var(--accent-bright-rgb),0.07) 0%, transparent 100%);
    border-radius: 0;
    pointer-events: none;
}
.settings-popup-title {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 4px;
    color: rgba(var(--accent-bright-rgb), 0.3);
    margin-bottom: 12px;
    position: relative;
    text-align: center;
}
.settings-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 0;
    transition: opacity 0.2s;
}
.settings-toggle-row.disabled {
    opacity: 0.3;
    pointer-events: none;
}
.settings-label {
    font-size: 12px;
    color: rgba(var(--accent-rgb), 0.8);
    letter-spacing: 0.5px;
    font-family: 'Newsreader', Georgia, serif;
    font-style: italic;
    font-weight: 300;
    text-transform: uppercase;
}
.settings-switch {
    position: relative;
    width: 34px;
    height: 18px;
    flex-shrink: 0;
}
.settings-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.settings-slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(var(--border-rgb),0.4);
    transition: background 0.2s;
}
.settings-slider::before {
    content: '';
    position: absolute;
    width: 12px;
    height: 12px;
    left: 3px;
    bottom: 3px;
    background: var(--text-muted);
    transition: transform 0.2s, background 0.2s;
}
.settings-switch input:checked + .settings-slider {
    background: var(--accent);
}
.settings-switch input:checked + .settings-slider::before {
    transform: translateX(16px);
    background: var(--bg-card, #1a1d23);
}
.settings-helper {
    font-family: var(--font-sans);
    font-size: 12px;
    color: rgba(var(--accent-rgb), 0.35);
    line-height: 1.5;
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid rgba(var(--border-rgb),0.12);
    max-width: 220px;
}

/* Settings — three-section panel (exec acts, travel, time awareness) */
.settings-section {
    padding: 10px 0;
    border-top: 1px solid rgba(var(--accent-rgb),0.08);
    min-width: 240px;
}
.settings-section:first-of-type { border-top: none; padding-top: 4px; }
.settings-section-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 2px;
}
.settings-section-title {
    font-family: 'Newsreader', Georgia, serif;
    font-style: italic;
    font-size: 13px;
    color: var(--accent);
    letter-spacing: 0.5px;
}
.settings-section-hint {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px; height: 14px;
    font-family: var(--font-sans);
    font-size: 12px;
    color: rgba(var(--accent-rgb), 0.5);
    border: 1px solid rgba(var(--accent-rgb), 0.25);
    border-radius: 50%;
    cursor: help;
}
.settings-section-hint:hover { color: var(--accent); border-color: var(--accent); }
.settings-section-desc {
    font-family: 'Newsreader', Georgia, serif;
    font-style: italic;
    font-size: 12px;
    color: rgba(var(--accent-rgb), 0.45);
    line-height: 1.4;
    margin-bottom: 8px;
}
.settings-pill-group {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.settings-pill {
    flex: 1;
    min-width: 50px;
    font-family: var(--font-sans);
    font-size: 12px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    background: rgba(var(--bg-deepest-rgb),0.55);
    border: 1px solid rgba(var(--accent-rgb),0.18);
    color: rgba(var(--accent-rgb),0.7);
    padding: 7px 10px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.settings-pill:hover {
    color: var(--accent);
    border-color: rgba(var(--accent-rgb),0.4);
}
.settings-pill.selected {
    background: rgba(var(--accent-rgb),0.14);
    border-color: rgba(var(--accent-rgb),0.55);
    color: var(--accent);
    box-shadow: inset 0 0 10px rgba(var(--accent-rgb),0.08);
}

/* ============================================= GLOBAL MUSIC LIBRARY */
.am-music-overlay {
    position: fixed;
    inset: 0;
    z-index: 9200;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(var(--bg-deepest-rgb),0.78);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}
.am-music-overlay.open { display: flex; }
.am-music-window {
    width: 75vw;
    height: 90dvh;
    max-width: none;
    max-height: 90dvh;
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-panel);
    border: 1px solid rgba(var(--accent-rgb),0.18);
    box-shadow: 0 28px 80px rgba(0,0,0,0.58);
}
.am-music-head {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 24px 28px 18px;
    border-bottom: 1px solid rgba(var(--border-rgb),0.16);
}
.am-music-brand {
    display: flex;
    align-items: center;
    gap: 14px;
}
.am-music-brand-icon {
    width: 38px;
    height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
}
.am-music-brand-icon svg {
    width: 34px;
    height: 44px;
}
.am-music-kicker {
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 2.2px;
    text-transform: uppercase;
    color: var(--text-muted);
}
.am-music-section-head small,
.am-music-track-meta,
.am-music-upload-note {
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 2.2px;
    text-transform: uppercase;
    color: var(--text-muted);
}
.am-music-title {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 32px;
    line-height: 1.1;
    color: var(--accent-bright);
}
.am-music-close {
    align-self: flex-start;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    cursor: pointer;
    padding: 0 4px;
}
.am-music-head-actions {
    display: inline-flex;
    align-items: flex-start;
    gap: 8px;
}
.am-music-guide-btn {
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(var(--bg-deepest-rgb),0.3);
    border: 1px solid rgba(var(--accent-bright-rgb),0.38);
    color: var(--accent-bright);
    cursor: pointer;
    filter: drop-shadow(0 0 8px rgba(var(--accent-bright-rgb),0.16));
}
.am-music-guide-btn:hover {
    color: var(--accent);
    border-color: rgba(var(--accent-rgb),0.55);
}
.am-music-guide-btn svg {
    width: 18px;
    height: 18px;
}
.am-music-close:hover { color: var(--accent); }
/* ---- Amapella Wiki (footer -> every guide in one searchable popup) ---- */
.am-wiki {
    position: fixed;
    inset: 0;
    z-index: 99990;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(var(--bg-deepest-rgb),0.78);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}
.am-wiki.open { display: flex; }
.am-wiki-window {
    width: 90vw;
    height: 90dvh;
    max-height: 90dvh;
    display: flex;
    flex-direction: column;
    background: var(--bg-panel);
    border: 1px solid rgba(var(--accent-bright-rgb),0.22);
    box-shadow: 0 24px 70px rgba(0,0,0,0.6);
}
.am-wiki-head {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 22px 24px 18px;
    border-bottom: 1px solid rgba(var(--border-rgb),0.16);
}
.am-wiki-title {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 30px;
    line-height: 1.1;
    color: var(--accent-bright);
    white-space: nowrap;
}
.am-wiki-search {
    flex: 1;
    min-width: 0;
    padding: 10px 14px;
    background: rgba(var(--bg-deepest-rgb),0.4);
    border: 1px solid rgba(var(--border-rgb),0.3);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 16px;
    font-weight: 300;
    outline: none;
}
.am-wiki-search:focus { border-color: rgba(var(--accent-bright-rgb),0.6); }
.am-wiki-search::placeholder {
    font-family: var(--font-serif);
    font-style: italic;
    font-weight: 300;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-size: 13px;
    color: var(--accent);
    opacity: 0.85;
}
.am-wiki-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
}
.am-wiki-close:hover { color: var(--accent); }
.am-wiki-count {
    padding: 10px 24px 0;
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 1.6px;
    text-transform: uppercase;
    color: var(--text-muted);
}
.am-wiki-body { overflow: auto; padding: 18px 24px 26px; }
.am-wiki-group { margin-top: 20px; }
.am-wiki-group:first-child { margin-top: 6px; }
.am-wiki-cat {
    margin-bottom: 12px;
    padding-bottom: 7px;
    border-bottom: 1px solid rgba(var(--accent-bright-rgb),0.2);
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 2.6px;
    text-transform: uppercase;
    color: var(--accent-bright);
}
.am-wiki-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}
.am-wiki-section {
    padding: 18px 20px;
    border: 1px solid rgba(var(--border-rgb),0.18);
    background: rgba(var(--bg-deepest-rgb),0.24);
}
.am-wiki-section-title {
    margin-bottom: 8px;
    font-family: var(--font-mono);
    font-size: 12.5px;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--accent);
}
.am-wiki-section-body {
    font-family: var(--font-sans);
    font-size: 16px;
    font-weight: 300;
    line-height: 1.66;
    color: var(--text-secondary);
}
.am-wiki-section-body strong { color: var(--accent-bright); font-weight: 500; }
.am-wiki-section-body em { font-style: italic; color: var(--text-primary); }
.am-wiki-section-body code {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--accent);
    background: rgba(var(--accent-rgb),0.1);
    padding: 1px 5px;
}
/* Guide bodies are read live from the page guides, so they carry the page-guide
   inline icons + chips/toggles — size and style them in the wiki context too. */
.am-wiki-section-body svg {
    width: 16px; height: 16px;
    display: inline-block; vertical-align: -3px; margin: 0 2px;
    color: var(--accent); stroke: currentColor; fill: none;
    stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round;
}
.am-wiki-section-body [class*="-chip"],
.am-wiki-section-body [class*="-toggle-demo"] {
    display: inline-block;
    padding: 1px 7px;
    border: 1px solid rgba(var(--accent-bright-rgb),0.4);
    color: var(--accent-bright);
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 0.5px;
    white-space: nowrap;
}
.am-wiki-empty {
    padding: 44px 8px;
    text-align: center;
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 18px;
    color: var(--text-muted);
}
@media (max-width: 720px) {
    .am-wiki { padding: 0; }
    .am-wiki-window { width: 100vw; height: 100dvh; max-height: 100dvh; }
    .am-wiki-head { flex-wrap: wrap; gap: 10px; padding: 16px 16px 12px; }
    .am-wiki-title { font-size: 24px; }
    .am-wiki-search { order: 3; flex-basis: 100%; }
    .am-wiki-body { padding: 14px 16px 22px; }
    .am-wiki-grid { grid-template-columns: 1fr; }
}

.am-music-guide {
    position: absolute;
    inset: 0;
    z-index: 4;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(var(--bg-deepest-rgb),0.72);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}
.am-music-guide.open { display: flex; }
.am-music-guide-window {
    width: min(860px, 92vw);
    max-height: min(760px, 86dvh);
    display: flex;
    flex-direction: column;
    background: var(--bg-panel);
    border: 1px solid rgba(var(--accent-bright-rgb),0.22);
    box-shadow: 0 24px 70px rgba(0,0,0,0.58);
}
.am-music-guide-head {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 22px 24px 18px;
    border-bottom: 1px solid rgba(var(--border-rgb),0.16);
}
.am-music-guide-head .am-music-guide-btn {
    cursor: default;
    pointer-events: none;
}
.am-music-guide-title {
    flex: 1;
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 30px;
    line-height: 1.1;
    color: var(--accent-bright);
}
.am-music-guide-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 22px;
    cursor: pointer;
}
.am-music-guide-close:hover { color: var(--accent); }
.am-music-guide-body {
    overflow: auto;
    padding: 24px;
}
.am-music-guide-lede {
    max-width: 700px;
    margin: 0 0 22px;
    font-family: var(--font-sans);
    font-size: 19px;
    font-weight: 300;
    line-height: 1.75;
    color: var(--text-secondary);
}
.am-music-guide-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}
.am-music-guide-section {
    position: relative;
    padding: 20px 42px 20px 20px;
    border: 1px solid rgba(var(--border-rgb),0.18);
    background: rgba(var(--bg-deepest-rgb),0.24);
}
.am-music-guide-section.is-highlighted {
    border-color: rgba(var(--accent-bright-rgb),0.78);
    box-shadow: 0 0 0 1px rgba(var(--accent-bright-rgb),0.22), 0 0 24px rgba(var(--accent-bright-rgb),0.14);
}
.am-music-guide-section-title {
    margin-bottom: 9px;
    font-family: var(--font-mono);
    font-size: 13px;
    letter-spacing: 2.2px;
    text-transform: uppercase;
    color: var(--accent);
}
.am-music-guide-section-body {
    font-family: var(--font-sans);
    font-size: 17px;
    font-weight: 300;
    line-height: 1.7;
    color: var(--text-secondary);
}
.am-music-guide-section-body strong { color: var(--accent-bright); font-weight: 500; }
.am-music-guide-inline-icon {
    width: 16px;
    height: 16px;
    display: inline-block;
    vertical-align: -3px;
    margin: 0 2px;
    color: var(--accent);
    stroke: currentColor;
    fill: none;
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.am-music-guide-star {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 25px;
    height: 25px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(var(--bg-deepest-rgb),0.34);
    border: 1px solid rgba(var(--accent-rgb),0.2);
    color: var(--text-muted);
    cursor: pointer;
}
.am-music-guide-star:hover,
.am-music-guide-star.is-active {
    color: var(--accent-bright);
    border-color: rgba(var(--accent-bright-rgb),0.6);
}
.am-music-guide-star svg {
    width: 14px;
    height: 14px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.6;
}
.am-music-guide-star.is-active svg { fill: currentColor; }
.am-music-body {
    display: grid;
    grid-template-columns: minmax(260px, 0.68fr) minmax(0, 1.32fr);
    flex: 1;
    min-height: 0;
    overflow: hidden;
}
.am-music-upload,
.am-music-library {
    padding: 22px;
    min-height: 0;
}
.am-music-upload {
    border-right: 1px solid rgba(var(--border-rgb),0.14);
    background: rgba(var(--bg-deepest-rgb),0.24);
}
.am-music-library {
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow: hidden;
}
.am-music-section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}
.am-music-section-head span {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 20px;
    color: var(--accent);
}
.am-music-library-actions,
.am-music-sort-controls {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    min-width: 0;
}
.am-music-library-actions small {
    margin-left: 4px;
}
.am-music-file-btn,
.am-music-confirm,
.am-music-track-actions button,
.am-music-subhead button,
.am-music-library-actions button,
.am-music-track-actions-btn {
    background: rgba(var(--bg-deepest-rgb),0.38);
    border: 1px solid rgba(var(--accent-rgb),0.2);
    color: var(--text-secondary);
    font-family: var(--font-sans);
    font-size: 12px;
    letter-spacing: 2px;
    text-transform: uppercase;
    padding: 9px 12px;
    cursor: pointer;
    transition: border-color 0.2s, color 0.2s, background 0.2s;
}
.am-music-file-btn,
.am-music-confirm { width: 100%; }
.am-music-file-btn:hover,
.am-music-confirm:not(:disabled):hover,
.am-music-track-actions button:hover,
.am-music-subhead button:hover,
.am-music-library-actions button:hover,
.am-music-track-actions-btn:hover {
    border-color: rgba(var(--accent-rgb),0.55);
    color: var(--accent);
    background: rgba(var(--accent-rgb),0.07);
}
/* Frequent Ads toggle — filled accent when ON (cameos every 5 songs vs 10). */
.am-music-freqads.is-on {
    border-color: rgba(var(--accent-rgb),0.7);
    color: var(--accent);
    background: rgba(var(--accent-rgb),0.16);
}
.am-music-confirm:disabled {
    opacity: 0.38;
    cursor: default;
}
.am-music-file-name {
    min-height: 18px;
    margin: 8px 0 10px;
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 14px;
    color: var(--text-muted);
}
.am-music-title-input,
.am-music-creator-grid select,
.am-music-sort-controls select {
    width: 100%;
    background: rgba(var(--bg-deepest-rgb),0.44);
    border: 1px solid rgba(var(--border-rgb),0.22);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 14px;
    padding: 9px 10px;
    outline: none;
}
.am-music-creator-grid select,
.am-music-sort-controls select {
    appearance: none;
    -webkit-appearance: none;
    padding-right: 32px;
    background-image:
        linear-gradient(45deg, transparent 50%, rgba(var(--accent-rgb),0.72) 50%),
        linear-gradient(135deg, rgba(var(--accent-rgb),0.72) 50%, transparent 50%),
        linear-gradient(90deg, rgba(var(--accent-rgb),0.18), rgba(var(--accent-rgb),0.02));
    background-position:
        calc(100% - 17px) 50%,
        calc(100% - 11px) 50%,
        100% 0;
    background-size: 6px 6px, 6px 6px, 34px 100%;
    background-repeat: no-repeat;
}
.am-music-sort-controls select {
    width: auto;
    min-width: 118px;
    max-width: 148px;
    padding-top: 6px;
    padding-bottom: 6px;
    font-size: 12px;
    font-family: var(--font-mono);
    letter-spacing: 1.8px;
    text-transform: uppercase;
}
.am-music-creator-grid select option,
.am-music-sort-controls select option {
    background: var(--bg-panel);
    color: var(--text-primary);
}
.am-music-title-input:focus,
.am-music-creator-grid select:focus,
.am-music-sort-controls select:focus {
    border-color: rgba(var(--accent-rgb),0.5);
}
.am-music-creator-grid {
    display: grid;
    gap: 9px;
    margin: 10px 0;
}
.am-music-creator-grid label span {
    display: block;
    margin-bottom: 4px;
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--text-muted);
}
.am-music-rights {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: 12px 0;
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 14px;
    line-height: 1.45;
    color: var(--text-secondary);
}
.am-music-rights input { margin-top: 2px; accent-color: var(--accent); }
.am-music-songs {
    display: flex;
    flex-direction: column;
    gap: 16px;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding-right: 4px;
}
.am-music-playlist-row,
.am-music-track-row {
    display: flex;
    flex-direction: column;
    flex: 0 0 auto;
}
.am-music-playlist-row {
    min-height: auto;
    padding-bottom: 18px;
    border-bottom: 1px solid rgba(var(--border-rgb),0.16);
}
.am-music-track-row {
    min-height: auto;
    padding-top: 3px;
}
.am-music-subhead {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 9px;
}
.am-music-subhead span {
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 2.4px;
    text-transform: uppercase;
    color: var(--accent);
}
.am-music-subhead button,
.am-music-track-actions-btn {
    width: auto;
    padding: 7px 10px;
    font-size: 12px;
}
.am-music-playlist-name {
    margin-bottom: 8px;
}
.am-music-playlist-artists {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 0 0 8px;
}
.am-music-artist-filter-label {
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--text-muted);
}
.am-music-artist-filter-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.am-music-artist-chip {
    width: auto;
    min-height: 28px;
    padding: 6px 8px;
    border: 1px solid rgba(var(--accent-rgb),0.22);
    background: rgba(var(--bg-deepest-rgb),0.28);
    color: var(--text-muted);
    font-family: var(--font-sans);
    font-size: 12px;
    letter-spacing: 1px;
    text-transform: uppercase;
    cursor: pointer;
}
.am-music-artist-chip small {
    margin-left: 5px;
    font-size: 12px;
    opacity: 0.58;
}
.am-music-artist-chip:hover,
.am-music-artist-chip.selected {
    border-color: rgba(var(--accent-rgb),0.58);
    background: rgba(var(--accent-rgb),0.08);
    color: var(--accent-bright);
}
.am-music-artist-filter-empty {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 13px;
    line-height: 1.35;
    color: var(--text-muted);
}
.am-music-playlist-create {
    margin-bottom: 12px;
}
.am-music-playlist-create-note {
    min-height: 15px;
    margin: -5px 0 10px;
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 13px;
    line-height: 1.35;
    color: var(--text-muted);
}
.am-music-playlist-create-note.is-success {
    color: var(--accent);
}
.am-music-playlist-create-note.is-error {
    color: #ff8f9f;
}
.am-music-playlist-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow: visible;
    padding-right: 0;
}
.am-music-playlist-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid rgba(var(--accent-rgb),0.18);
    background: rgba(var(--bg-deepest-rgb),0.22);
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}
.am-music-playlist-card:hover {
    border-color: rgba(var(--accent-rgb),0.42);
    background: rgba(var(--accent-rgb),0.05);
}
.am-music-playlist-card.is-current {
    border-color: rgba(var(--accent-rgb),0.48);
    box-shadow: inset 2px 0 0 rgba(var(--accent-rgb),0.55);
}
.am-music-playlist-main {
    min-width: 0;
    flex: 1;
}
.am-music-playlist-title {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 17px;
    line-height: 1.2;
    color: var(--text-primary);
}
.am-music-playlist-actions {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.am-music-playlist-actions button {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(var(--bg-deepest-rgb),0.36);
    border: 1px solid rgba(var(--accent-rgb),0.22);
    color: var(--accent);
    font-size: 17px;
    cursor: pointer;
}
.am-music-playlist-actions button.am-music-playlist-play {
    width: 42px;
    height: 42px;
    border-color: rgba(var(--accent-rgb),0.42);
    color: var(--accent-bright);
}
.am-music-playlist-actions button:disabled {
    opacity: 0.28;
    cursor: default;
}
.am-music-playlist-actions button:not(:disabled):hover {
    border-color: rgba(var(--accent-rgb),0.68);
    background: rgba(var(--accent-rgb),0.08);
}
.am-music-playlist-actions button.am-music-playlist-delete {
    color: var(--text-muted);
}
.am-music-playlist-actions button.am-music-playlist-delete:hover {
    color: #ff8f9f;
    border-color: rgba(255,143,159,0.48);
    background: rgba(255,143,159,0.08);
}
.am-music-track-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-content: start;
    gap: 9px;
    overflow: visible;
    padding-right: 0;
}
.am-music-track {
    border: 1px solid rgba(var(--border-rgb),0.16);
    background: rgba(var(--bg-card-rgb),0.42);
    padding: 12px;
}
.am-music-track.is-current {
    border-color: rgba(var(--accent-rgb),0.42);
    box-shadow: inset 2px 0 0 rgba(var(--accent-rgb),0.55);
}
.am-music-track-main {
    min-width: 0;
    margin-bottom: 10px;
}
.am-music-track-title {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 20px;
    line-height: 1.2;
    color: var(--text-primary);
    overflow-wrap: anywhere;
}
.am-music-track-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}
.am-music-edit {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dotted rgba(var(--border-rgb),0.22);
}
.am-music-empty {
    padding: 40px 20px;
    text-align: center;
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 18px;
    color: var(--text-muted);
}
.am-music-empty-small {
    padding: 18px 10px;
    font-size: 15px;
}
.am-music-mini {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 18px;
    background: rgba(var(--bg-deepest-rgb),0.46);
}
.am-music-mini.open { display: flex; }
.am-music-mini-window {
    width: min(520px, 92vw);
    max-height: min(520px, 78dvh);
    overflow: auto;
    padding: 20px;
    background: var(--bg-panel);
    border: 1px solid rgba(var(--accent-rgb),0.24);
    box-shadow: 0 18px 46px rgba(0,0,0,0.5);
}
.am-music-playlist-picker-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
}
.am-music-picker-card {
    min-height: 72px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 6px;
    padding: 12px;
    background: rgba(var(--bg-deepest-rgb),0.34);
    border: 1px solid rgba(var(--border-rgb),0.18);
    color: var(--text-primary);
    cursor: pointer;
    text-align: left;
}
.am-music-picker-card.selected {
    border-color: rgba(var(--accent-rgb),0.58);
    color: var(--accent-bright);
    box-shadow: inset 0 0 18px rgba(var(--accent-rgb),0.08);
}
.am-music-picker-card span {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 18px;
    line-height: 1.15;
}
.am-music-picker-card small {
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--text-muted);
}
.am-music-mini-actions {
    display: grid;
    grid-template-columns: minmax(0, 0.7fr) minmax(0, 1fr);
    gap: 9px;
    margin-top: 14px;
}
.am-music-editor-window {
    width: min(680px, 94vw);
}
.am-music-playlist-editor-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: min(420px, 56dvh);
    overflow: auto;
    padding-right: 4px;
}
.am-music-playlist-track {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid rgba(var(--border-rgb),0.18);
    background: rgba(var(--bg-deepest-rgb),0.3);
    cursor: grab;
}
.am-music-playlist-track:active {
    cursor: grabbing;
}
.am-music-drag-handle {
    flex: 0 0 auto;
    color: var(--accent);
    opacity: 0.7;
    font-family: var(--font-mono);
    font-size: 16px;
    letter-spacing: -2px;
}
.am-music-playlist-track-main {
    min-width: 0;
    flex: 1;
}
.am-music-playlist-track-actions {
    display: inline-flex;
    gap: 6px;
    flex: 0 0 auto;
}
.am-music-playlist-track-actions button {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(var(--bg-deepest-rgb),0.34);
    border: 1px solid rgba(var(--accent-rgb),0.2);
    color: var(--accent);
    font-size: 15px;
    cursor: pointer;
}
.am-music-playlist-track-actions button:disabled {
    opacity: 0.25;
    cursor: default;
}
.am-music-playlist-track-actions .am-music-playlist-remove {
    color: var(--text-muted);
    border-color: rgba(var(--accent-rgb),0.14);
}
.am-music-playlist-track-actions .am-music-playlist-remove:hover {
    color: var(--accent-strong);
    border-color: rgba(var(--accent-rgb),0.38);
}
.am-now-playing {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 80;
    height: 28px;
    display: none;
    align-items: center;
    gap: 8px;
    padding: 0 12px;
    background: rgba(var(--bg-deepest-rgb),0.94);
    border-top: 1px solid rgba(var(--accent-rgb),0.2);
    box-shadow: 0 -10px 26px rgba(0,0,0,0.36);
}
.am-footer .am-now-playing {
    position: static;
    left: auto;
    right: auto;
    bottom: auto;
    z-index: auto;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    height: 30px;
    border-top: none;
    border-left: 1px solid rgba(var(--accent-rgb),0.2);
    background: rgba(var(--bg-deepest-rgb),0.42);
    box-shadow: none;
    display: flex;
    pointer-events: auto;
    box-sizing: border-box;
}
.am-footer .am-now-playing,
.am-footer .am-now-playing * {
    pointer-events: auto;
}
.am-footer .am-now-playing .am-now-seek-fill {
    pointer-events: none;
}
.am-now-playing.visible { display: flex; }
.am-now-playing button {
    width: 26px;
    height: 26px;
    flex: 0 0 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid rgba(var(--accent-rgb),0.18);
    color: var(--text-muted);
    font-size: 12px;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}
.am-now-playing button.am-now-library {
    width: 26px;
    color: var(--accent);
    border-color: rgba(var(--accent-rgb),0.34);
}
#amMusicLoopBtn {
    width: 26px;
    font-size: 12px;
}
.am-now-playing button.am-now-library svg {
    width: 15px;
    height: 15px;
}
.am-now-playing button.active {
    color: var(--accent);
    border-color: rgba(var(--accent-rgb),0.5);
}
@media (hover: hover) {
    .am-now-playing button:hover {
        color: var(--accent);
        border-color: rgba(var(--accent-rgb),0.5);
    }
}
.am-now-title {
    position: relative;
    height: 100%;
    flex: 1 1 auto;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}
.am-now-seek-fill {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 0%;
    z-index: 1;
    opacity: 0.27;
    background: linear-gradient(110deg,
        var(--accent-bright) 0%,
        var(--memory) 20%,
        var(--accent) 42%,
        var(--memory) 62%,
        var(--accent-bright) 80%,
        var(--accent-deep) 100%);
    background-size: 260% 100%;
    animation: logoShimmer 5.8s ease-in-out infinite, logoMemoryGlow 4.2s ease-in-out infinite;
    pointer-events: none;
}
.am-now-seek {
    position: absolute;
    inset: 0;
    z-index: 3;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: ew-resize;
}
.am-now-seek:disabled {
    cursor: default;
}
.am-now-title-track {
    position: relative;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    height: 100%;
    gap: 0;
    width: max-content;
    min-width: max-content;
    white-space: nowrap;
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 2.4px;
    text-transform: uppercase;
    color: var(--accent);
    animation: am-now-marquee 16s linear infinite;
    will-change: transform;
}
.am-now-title-track span {
    flex: 0 0 auto;
    padding-right: 48px;
}
:root[data-theme="opera"] .am-now-title-track,
:root[data-theme="opera"] .player-select {
    color: var(--text-primary);
}
:root[data-theme="opera"] .am-now-playing button {
    color: var(--text-secondary);
    border-color: rgba(var(--text-primary-rgb),0.24);
}
:root[data-theme="opera"] .am-now-playing button.am-now-library,
:root[data-theme="opera"] .am-now-playing button.active {
    color: var(--accent-bright);
    border-color: rgba(var(--accent-bright-rgb),0.48);
}
@media (hover: hover) {
    :root[data-theme="opera"] .am-now-playing button:hover {
        color: var(--accent-bright);
        border-color: rgba(var(--accent-bright-rgb),0.48);
    }
}
@keyframes am-now-marquee {
    from { transform: translateX(0); }
    to { transform: translateX(-16.666666%); }
}
@media (max-width: 900px) {
    .am-music-overlay { padding: 8px; }
    .am-music-window {
        width: calc(100vw - 16px);
        height: 94dvh;
        max-height: 94dvh;
    }
    .am-music-head { padding: 18px 20px 14px; }
    .am-music-title { font-size: 26px; }
    .am-music-guide { padding: 12px; }
    .am-music-guide-window { width: 100%; max-height: calc(100dvh - 24px); }
    .am-music-guide-head { padding: 18px 18px 14px; }
    .am-music-guide-title { font-size: 25px; }
    .am-music-guide-body { padding: 18px; }
    .am-music-guide-grid { grid-template-columns: 1fr; }
    .am-music-guide-lede { font-size: 18px; }
    .am-music-body {
        display: block;
        overflow-y: auto;
    }
    .am-music-upload,
    .am-music-library {
        min-height: auto;
        overflow: visible;
    }
    .am-music-upload { border-right: none; border-bottom: 1px solid rgba(var(--border-rgb),0.14); }
    .am-music-section-head,
    .am-music-subhead {
        align-items: flex-start;
        flex-wrap: wrap;
    }
    .am-music-library-actions,
    .am-music-sort-controls {
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
    }
    .am-music-sort-controls select {
        min-width: 0;
        flex: 1 1 130px;
    }
    .am-music-songs { overflow: visible; padding-right: 0; }
    .am-music-playlist-row { min-height: auto; }
    .am-music-playlist-list { min-height: 132px; }
    .am-music-playlist-list,
    .am-music-track-list { overflow: visible; }
    .am-music-track-list { grid-template-columns: 1fr; }
    .am-music-playlist-picker-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ============================================= THEME PICKER */

.theme-popup {
    position: fixed;
    z-index: 9000;
    min-width: 240px;
    padding: 16px 18px 14px;
    background: var(--bg-deepest);
    border: 1px solid rgba(var(--accent-bright-rgb), 0.12);
    border-radius: 0;
    box-shadow: 0 6px 24px rgba(0,0,0,0.5);
    font-family: var(--font-sans);
}
.theme-popup::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 40px;
    background: linear-gradient(180deg, rgba(var(--accent-bright-rgb),0.07) 0%, transparent 100%);
    pointer-events: none;
}
/* When the tab is hidden or the window is unfocused (set by nav-shared's idle
   controller), pause every CSS animation so a backgrounded/occluded tab burns
   no CPU on glows/pulses. Only @keyframes animations pause — transitions are
   unaffected, so the UI still responds instantly when you return. */
body.am-anim-idle *,
body.am-anim-idle *::before,
body.am-anim-idle *::after { animation-play-state: paused !important; }

.theme-popup-title {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 4px;
    color: rgba(var(--accent-bright-rgb), 0.3);
    margin-bottom: 14px;
    position: relative;
    text-align: center;
}
.theme-lens-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    margin-bottom: 12px;
}
/* Cinema (the default) keeps its own full-width row; the rest pair up
   two-per-row (Hadal + Smoke, then Velvet + Monolith). */
.theme-lens-btn[data-theme="cinema"] { grid-column: 1 / -1; }
.theme-lens-btn {
    background: var(--bg-deepest);
    border: 1px solid rgba(var(--border-rgb),0.18);
    padding: 10px 12px;
    text-align: left;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: background 0.25s, border-color 0.25s;
    position: relative;
    overflow: hidden;
}
.theme-lens-btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 30% 20%, var(--lens-glow, rgba(var(--accent-rgb),0.08)) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}
.theme-lens-btn:hover { border-color: rgba(var(--accent-rgb),0.25); }
.theme-lens-btn:hover::after { opacity: 1; }
.theme-lens-btn.active { border-color: var(--accent); background: rgba(var(--accent-rgb),0.04); }
.theme-lens-btn.active::after { opacity: 1; }

.theme-lens-swatch {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 0 0 1px rgba(255,255,255,0.06);
    position: relative;
    z-index: 1;
}
.theme-lens-name {
    font-family: var(--font-serif);
    font-style: italic;
    font-weight: 300;
    font-size: 14px;
    color: var(--text-primary);
    letter-spacing: 0.2px;
    flex: 1;
    position: relative;
    z-index: 1;
}
.theme-lens-meta {
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--text-muted);
    position: relative;
    z-index: 1;
}

/* Per-lens accent — used both for the swatch fill (inline style) and the
   hover/active glow gradient. */
.theme-lens-btn[data-theme="cinema"]   { --lens-glow: rgba(221,194,168,0.16); }
.theme-lens-btn[data-theme="hadal"]    { --lens-glow: rgba(127,176,174,0.16); }
.theme-lens-btn[data-theme="smoke"]    { --lens-glow: rgba(201,184,220,0.18); }
.theme-lens-btn[data-theme="velvet"]   { --lens-glow: rgba(165,176,222,0.18); }
.theme-lens-btn[data-theme="monolith"] { --lens-glow: rgba(231,185,195,0.16); }
.theme-lens-btn[data-theme="winery"]   { --lens-glow: rgba(222,88,88,0.16); }
.theme-lens-btn[data-theme="opera"]    { --lens-glow: rgba(206,132,171,0.16); }

.theme-save-btn {
    width: 100%;
    background: var(--accent);
    color: #1E1103;
    border: none;
    padding: 11px 14px;
    font-family: var(--font-sans);
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 3px;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.2s;
}
.theme-save-btn:hover { opacity: 0.88; }
.theme-save-btn:active { transform: translateY(1px); }
.theme-save-btn:disabled { opacity: 0.4; cursor: default; }

/* Mobile: center the popup like settings does. */
@media (max-width: 900px) {
    .theme-popup {
        position: fixed !important;
        left: 50% !important;
        top: 50% !important;
        right: auto !important;
        transform: translate(-50%, -50%);
        width: calc(100vw - 32px);
        max-width: 320px;
        z-index: 12000;
    }
}

/* Mobile + tablet: center the popup on screen instead of anchoring to the
   clock icon. The clock is hidden in nav at <=900px (see .nav-right rule),
   so anchoring would land the popup off-screen. */
@media (max-width: 900px) {
    .settings-popup {
        position: fixed !important;
        left: 50% !important;
        top: 50% !important;
        right: auto !important;
        transform: translate(-50%, -50%);
        width: calc(100vw - 32px);
        max-width: 360px;
        max-height: 85vh;
        overflow-y: auto;
        z-index: 12000;
    }
    .settings-section { min-width: 0; }
}

.nav-world {
    position: relative;
    font-weight: 300;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 3px;
    cursor: default;
    color: var(--accent-bright);
}

.nav-world-desc {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--text-secondary);
    background: var(--bg-deepest);
    border: 1px solid var(--border);
    padding: 6px 14px;
    z-index: 50;
    pointer-events: none;
}

.nav-world:hover .nav-world-desc { display: block; }

/* Nav city — the FIRST saved city sits next to the world name behind a move-right
   arrow, with a little bg-deepest dropdown of your cities. Placeholder for
   multi-maps (selecting only relabels for now). */
.nav-world-city-wrap { display: inline-flex; align-items: center; gap: 8px; }
.nav-world-arrow { display: inline-flex; color: var(--text-muted); opacity: 0.7; }
.nav-world-arrow svg { width: 14px; height: 14px; }
.nav-world-city {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 300;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 3px;
    color: var(--accent-bright);
    cursor: pointer;
    outline: none;
}
.nav-world-city-chev { font-size: 8px; color: var(--accent-deep); transition: transform 0.2s; }
.nav-world-city.open .nav-world-city-chev { transform: rotate(180deg); }
.nav-world-city-menu {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    min-width: 160px;
    background: var(--bg-deepest);
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: opacity 0.18s ease, visibility 0.18s ease, transform 0.2s ease;
    z-index: 60;
    box-shadow: 0 16px 36px rgba(0,0,0,0.5);
}
.nav-world-city.open .nav-world-city-menu { opacity: 1; visibility: visible; transform: translateY(0); }
.nav-world-city-item {
    background: none;
    border: none;
    border-bottom: 1px solid rgba(var(--border-rgb),0.4);
    color: var(--text-secondary);
    font-family: var(--font-sans);
    font-weight: 300;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-align: left;
    padding: 9px 14px;
    cursor: pointer;
    transition: color 0.15s, background 0.15s;
}
.nav-world-city-item:last-child { border-bottom: none; }
.nav-world-city-item:hover { color: var(--accent); background: rgba(var(--accent-rgb),0.06); }

.nav-user { text-align: right; }

.nav-user-name {
    font-size: 10px;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--accent);
}

.nav-user-season {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
}

/* ============================================= NAV DROPDOWNS */

.nav-dropdown {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.nav-dropdown-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    color: #FFFFFF;
    font-family: var(--font-sans);
    font-weight: 300;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 3px;
    display: inline-flex;
    align-items: center;
    transition: color 0.2s, text-shadow 0.25s;
}

.nav-dropdown:hover .nav-dropdown-toggle,
.nav-dropdown:focus-within .nav-dropdown-toggle,
.nav-dropdown-toggle:hover,
.nav-dropdown-toggle.nav-dropdown-active {
    color: var(--accent);
}

.nav-dropdown-toggle.nav-dropdown-active {
    text-shadow: 0 0 14px rgba(var(--accent-rgb),0.2);
}

.nav-dropdown-chevron {
    display: inline-block;
    font-size: 8px;
    margin-left: 7px;
    color: var(--text-muted);
    opacity: 0.55;
    transition: color 0.25s, opacity 0.25s, transform 0.4s ease;
    line-height: 1;
}

.nav-dropdown:hover .nav-dropdown-chevron,
.nav-dropdown:focus-within .nav-dropdown-chevron {
    color: var(--accent);
    opacity: 1;
    transform: rotate(45deg);
}

.nav-dropdown-toggle.nav-dropdown-active .nav-dropdown-chevron {
    color: var(--accent);
    opacity: 1;
}

.nav-dropdown-menu {
    position: absolute;
    top: 100%;
    left: -22px;
    min-width: 200px;
    margin-top: 9px;
    padding: 18px 24px 20px 24px;
    background: var(--bg-deepest);
    border: 1px solid var(--border-hover);
    box-shadow:
        0 18px 42px rgba(0,0,0,0.7),
        0 0 28px rgba(var(--accent-rgb),0.05),
        inset 0 0 0 1px rgba(var(--accent-rgb),0.04);
    display: flex;
    flex-direction: column;
    gap: 14px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: opacity 0.18s ease, visibility 0.18s ease, transform 0.22s ease;
    z-index: 60;
}

/* filament thread connecting toggle to menu */
.nav-dropdown-menu::before {
    content: '';
    position: absolute;
    top: -9px;
    left: 30px;
    width: 1px;
    height: 9px;
    background: linear-gradient(to bottom, transparent, var(--accent));
    opacity: 0.55;
}

/* hairline at top of menu */
.nav-dropdown-menu::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(to right, transparent 10%, rgba(var(--accent-rgb),0.32) 50%, transparent 90%);
}

.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown:focus-within .nav-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.nav-dropdown-item {
    position: relative;
    display: flex;
    align-items: center;
    font-family: var(--font-sans);
    font-weight: 300;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 3px;
    color: var(--text-secondary);
    text-decoration: none;
    white-space: nowrap;
    padding: 2px 0 2px 2px;
    transition: color 0.2s, padding-left 0.25s ease, text-shadow 0.25s;
}

.nav-dropdown-bullet {
    display: inline-block;
    margin-right: 12px;
    font-size: 8px;
    color: var(--text-muted);
    line-height: 1;
    transition: color 0.2s, transform 0.4s ease, text-shadow 0.25s;
}

.nav-dropdown-item:hover {
    color: var(--accent-bright);
    padding-left: 6px;
    text-shadow: 0 0 14px rgba(var(--accent-rgb),0.25);
}

.nav-dropdown-item:hover .nav-dropdown-bullet {
    color: var(--accent);
    transform: rotate(45deg);
    text-shadow: 0 0 10px rgba(var(--accent-rgb),0.55);
}

@keyframes am-work-resignation-red-blink {
    0%, 100% { color: #DE5858; text-shadow: 0 0 0 rgba(222, 88, 88, 0); }
    50% { color: #DE5858; text-shadow: 0 0 14px rgba(222, 88, 88, 0.72); }
}

@keyframes am-work-resignation-red-flash {
    0%, 100% { color: var(--text-secondary); background: transparent; }
    45% { color: #DE5858; background: rgba(222, 88, 88, 0.10); text-shadow: 0 0 12px rgba(222, 88, 88, 0.62); }
}

.nav-dropdown-toggle.am-work-resignation-alert {
    color: #DE5858;
    animation: am-work-resignation-red-blink 1.1s ease-in-out infinite;
}

.nav-dropdown:hover .nav-dropdown-item.am-work-resignation-co-link:hover,
.nav-dropdown:focus-within .nav-dropdown-item.am-work-resignation-co-link:focus {
    animation: am-work-resignation-red-flash 0.52s ease-in-out infinite;
}

.nav-ucp-icon.am-work-resignation-cerebrum-alert {
    color: #DE5858;
    animation: am-work-resignation-red-blink 0.95s ease-in-out infinite;
}

.work-resignation-toast {
    border-color: rgba(222, 88, 88, 0.36);
    box-shadow: 0 12px 30px rgba(10, 8, 12, 0.35), 0 0 26px rgba(222, 88, 88, 0.12);
}

.work-resignation-toast .chat-toast-msg {
    color: #DE5858;
}

/* ============================================= NAV SOCIAL ICON */

.nav-social-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #FFFFFF;
    padding: 4px 6px;
    background: none;
    border: none;
    cursor: pointer;
    transition: color 0.25s, filter 0.25s, transform 0.25s;
}
.nav-social-icon svg { display: block; }
.nav-social-icon:hover {
    color: var(--accent);
    filter: drop-shadow(0 0 8px rgba(var(--accent-rgb),0.5));
    transform: scale(1.04);
}

/* Accent color cycle — social feed icon blink for new posts */
@keyframes accent-cycle {
    0%, 100% { color: var(--accent); filter: drop-shadow(0 0 6px rgba(var(--accent-rgb),0.5)); }
    12.5% { color: #C9B8DC; filter: drop-shadow(0 0 6px rgba(201,184,220,0.5)); }
    25%   { color: #A5B0DE; filter: drop-shadow(0 0 6px rgba(165,176,222,0.5)); }
    37.5% { color: #A8C0A0; filter: drop-shadow(0 0 6px rgba(168,192,160,0.5)); }
    50%   { color: #7FB0AE; filter: drop-shadow(0 0 6px rgba(127,176,174,0.5)); }
    62.5% { color: #E5B8B0; filter: drop-shadow(0 0 6px rgba(229,184,176,0.5)); }
    75%   { color: #DE5858; filter: drop-shadow(0 0 6px rgba(222,88,88,0.5)); }
    87.5% { color: #DD9F8B; filter: drop-shadow(0 0 6px rgba(221,159,139,0.5)); }
}
.nav-social-icon.has-new {
    animation: accent-cycle 4s ease-in-out infinite;
}

/* ============================================= SHARED ANIMATIONS */

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

@keyframes pulse-slow {
    0%, 100% { opacity: 1; }
    25% { opacity: 0.25; }
}

@keyframes nav-loading-pulse {
    0%, 100% { opacity: 0.4; }
    50%      { opacity: 1; }
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.voice-spinner {
    animation: spin 1s linear infinite;
    display: inline-block;
}

/* ============================================= SHARED SCROLLBARS */

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-thumb { background: rgba(var(--text-primary-rgb), 0.25); border-radius: 0; }
::-webkit-scrollbar-thumb:hover { background: rgba(var(--text-primary-rgb), 0.4); }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-button { display: none; }
html { scrollbar-width: thin; scrollbar-color: rgba(var(--text-primary-rgb), 0.25) transparent; }

/* ============================================= SHARED FLOATING SAVE */

.am-floating-save-bar {
    position: fixed;
    left: 50%;
    bottom: calc(var(--map-footer-h, 0px) + max(18px, env(safe-area-inset-bottom)));
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 8px;
    background: rgba(48,53,58,0.6);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(var(--border-rgb),0.2);
    border-radius: 9999px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
    z-index: 350;
}
.am-floating-save-bar[hidden] { display: none !important; }
.am-floating-save-main {
    min-height: 36px;
    padding: 0 20px;
    font-family: var(--font-sans);
    font-size: 12px;
    letter-spacing: 0;
    text-transform: uppercase;
    font-weight: 400;
    background: var(--accent);
    color: #3E2D1B;
    border: none;
    border-radius: 9999px;
    cursor: pointer;
    transition: background 0.2s, opacity 0.2s, transform 0.2s;
    white-space: nowrap;
}
.am-floating-save-main:hover { background: var(--accent-bright); }
.am-floating-save-main:disabled {
    cursor: wait;
    opacity: 0.62;
}
@media (max-width: 700px) {
    .am-floating-save-bar {
        left: 16px;
        right: 16px;
        transform: none;
    }
    .am-floating-save-main {
        flex: 1;
    }
}

/* ============================================= OVERLAYS */

.overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(var(--bg-deepest-rgb),0.85);
    z-index: 100;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.overlay.open { display: flex; }

.overlay-window {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    max-width: 95%;
    max-height: 90%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.overlay-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 12px;
}

.overlay-icon { font-size: 20px; }

.overlay-title {
    flex: 1;
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 17px;
    color: var(--accent);
}

.close-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 28px;
    cursor: pointer;
    padding: 4px 8px;
}

.close-btn:hover { color: var(--text-primary); }

/* ============================================= CINEMATIC MODAL (alert/confirm) */

.am-modal-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(var(--bg-deepest-rgb), 0.78);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 30000;
    justify-content: center;
    align-items: center;
    padding: 20px;
    animation: am-modal-fade 0.18s ease-out;
}

.am-modal-backdrop.open { display: flex; }

@keyframes am-modal-fade {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes am-modal-rise {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.am-modal-window {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    width: 520px;
    max-width: 100%;
    box-shadow: 0 24px 60px rgba(0,0,0,0.45), 0 0 0 1px rgba(var(--accent-rgb),0.04) inset;
    animation: am-modal-rise 0.22s ease-out;
    position: relative;
}

.am-modal-window::before {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: radial-gradient(circle at 50% 0%, rgba(var(--accent-rgb),0.05) 0%, transparent 60%);
}

.am-modal-header {
    padding: 14px 18px;
    border-bottom: 1px solid rgba(var(--border-rgb),0.18);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    position: relative;
}

.am-modal-tag {
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 3px;
    text-transform: uppercase;
    padding: 4px 10px;
    background: rgba(var(--accent-rgb),0.05);
    color: rgba(var(--accent-rgb),0.65);
    border: 1px solid rgba(var(--accent-rgb),0.12);
}

.am-modal-tag--warn {
    color: #C4A882;
    background: rgba(196,168,130,0.06);
    border-color: rgba(196,168,130,0.18);
}

.am-modal-tag--error {
    color: #C47F6B;
    background: rgba(196,127,107,0.06);
    border-color: rgba(196,127,107,0.2);
}

.am-modal-tag--success {
    color: #A8C49A;
    background: rgba(168,196,154,0.05);
    border-color: rgba(168,196,154,0.18);
}

.am-modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    padding: 2px 8px;
    font-family: var(--font-sans);
    transition: color 0.2s;
}

.am-modal-close:hover { color: var(--accent); }

.am-modal-body {
    padding: 24px 26px 22px;
    position: relative;
}

.am-modal-title {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 24px;
    font-weight: 300;
    color: var(--accent);
    line-height: 1.25;
    margin-bottom: 12px;
    letter-spacing: -0.3px;
}

.am-modal-message {
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.65;
    color: var(--text-primary);
    white-space: pre-wrap;
    margin-bottom: 24px;
}

.am-modal-message:last-child { margin-bottom: 0; }

.am-modal-message .bullet {
    display: block;
    padding-left: 14px;
    position: relative;
    margin-top: 8px;
    color: var(--text-secondary);
}

.am-modal-message .bullet::before {
    content: '◆';
    position: absolute;
    left: 0;
    color: var(--accent);
    opacity: 0.5;
    font-size: 12px;
    top: 4px;
}

.am-modal-field {
    display: block;
    margin: 2px 0 22px;
}

.am-modal-field-label {
    display: block;
    margin-bottom: 8px;
    color: rgba(var(--accent-rgb),0.72);
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 3px;
    text-transform: uppercase;
}

.am-modal-textarea {
    width: 100%;
    min-height: 104px;
    max-height: 220px;
    resize: vertical;
    background: rgba(var(--bg-deepest-rgb),0.48);
    border: 1px solid rgba(var(--border-rgb),0.45);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.55;
    padding: 12px 14px;
    outline: none;
}

.am-modal-textarea:focus {
    border-color: rgba(var(--accent-rgb),0.55);
    box-shadow: 0 0 0 1px rgba(var(--accent-rgb),0.12);
}

.am-modal-field-help {
    display: block;
    margin-top: 8px;
    color: var(--text-muted);
    font-family: var(--font-sans);
    font-size: 12px;
    line-height: 1.5;
}

.am-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 18px;
    border-top: 1px solid rgba(var(--border-rgb),0.12);
}

.am-modal-btn {
    background: none;
    border: 1px solid rgba(var(--border-rgb),0.35);
    color: var(--text-secondary);
    font-family: var(--font-sans);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 3px;
    padding: 10px 22px;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
    outline: none;
}

.am-modal-btn:hover {
    color: var(--text-primary);
    border-color: rgba(var(--border-rgb),0.55);
}

.am-modal-btn:focus-visible {
    box-shadow: 0 0 0 1px rgba(var(--accent-rgb),0.4);
}

.am-modal-btn--primary {
    border-color: var(--accent-border);
    color: var(--accent);
}

.am-modal-btn--primary:hover {
    background: var(--accent-dim);
    border-color: var(--accent);
    color: var(--accent);
}

.am-modal-btn--danger {
    border-color: rgba(196,127,107,0.35);
    color: #C47F6B;
}

.am-modal-btn--danger:hover {
    background: rgba(196,127,107,0.1);
    border-color: #C47F6B;
    color: #D89A85;
}

@media (max-width: 900px) {
    /* Bound the modal height and let the body scroll independently so the
       header (with close button) stays pinned at the top — otherwise long
       confirm/alert content pushes the [x] off screen. */
    .am-modal-window {
        width: 100%;
        max-height: 85vh;
        display: flex;
        flex-direction: column;
    }
    .am-modal-header {
        position: sticky;
        top: 0;
        z-index: 20;
        background: var(--bg-panel);
    }
    .am-modal-body {
        padding: 20px 20px 18px;
        overflow-y: auto;
    }
    .am-modal-title { font-size: 20px; }
    .am-modal-actions { flex-direction: column-reverse; }
    .am-modal-btn { width: 100%; }

    /* Same treatment for overlay-style popups (photobooth, invite, menu
       editor, hangout memories, etc.). The window is already flex-column
       with overflow:hidden — making the header sticky keeps the [x] visible
       in the rare case where the header itself flows into scrolling. */
    .overlay-header {
        position: sticky;
        top: 0;
        z-index: 20;
        background: var(--bg-panel);
    }
}

/* ============================================= SOFT MODAL (gentle validation variant) */
/* Reuses the Lore-stub card language: centered large card, huge Newsreader
   italic title, quiet supporting copy, classified tag at top center.
   Used for gentle "you're missing something" notices rather than hard errors. */

.am-modal-window--soft {
    width: 560px;
    max-width: 100%;
    background: var(--bg-panel);
    border: 1px solid rgba(var(--border-rgb),0.18);
    position: relative;
    padding: 80px 64px 56px;
    text-align: center;
    box-shadow: 0 32px 80px rgba(0,0,0,0.5), 0 0 0 1px rgba(var(--accent-rgb),0.03) inset;
    animation: am-modal-rise 0.26s ease-out;
}

.am-modal-window--soft::before {
    content: attr(data-tag);
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 5px 14px;
    background: rgba(var(--accent-rgb),0.05);
    border: 1px solid rgba(var(--accent-rgb),0.15);
    white-space: nowrap;
}

.am-modal-window--soft::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: radial-gradient(circle at 50% 30%, rgba(var(--accent-rgb),0.05) 0%, transparent 65%);
}

.am-modal-soft-title {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 42px;
    font-weight: 300;
    color: var(--accent);
    letter-spacing: -1px;
    line-height: 1.12;
    margin-bottom: 22px;
    position: relative;
}

.am-modal-soft-message {
    font-family: var(--font-sans);
    font-size: 13px;
    line-height: 1.75;
    color: var(--text-secondary);
    max-width: 420px;
    margin: 0 auto 36px;
    position: relative;
}

.am-modal-soft-actions {
    display: flex;
    justify-content: center;
    position: relative;
}

.am-modal-soft-close {
    position: absolute;
    top: 14px;
    right: 16px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    padding: 4px 8px;
    z-index: 2;
    transition: color 0.2s;
}

.am-modal-soft-close:hover { color: var(--accent); }

@media (max-width: 900px) {
    .am-modal-window--soft { padding: 68px 32px 44px; }
    .am-modal-soft-title { font-size: 32px; }
}

/* ============================================= SHARED COMPONENTS */

.model-select {
    background-color: rgba(var(--accent-rgb),0.04);
    background-image: url("data:image/svg+xml,%3Csvg width='10' height='10' viewBox='0 0 10 10' xmlns='http://www.w3.org/2000/svg' fill='none' stroke='%23DDC2A8' stroke-width='1.2'%3E%3Cpath d='M5 1l4 4-4 4-4-4z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    border: 1px solid rgba(var(--accent-rgb),0.2);
    color: var(--accent);
    font-family: var(--font-mono);
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 2px;
    padding: 7px 30px 7px 14px;
    outline: none;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    transition: border-color 0.25s, background-color 0.25s, box-shadow 0.3s, letter-spacing 0.3s;
}

.model-select:hover {
    border-color: rgba(var(--accent-rgb),0.4);
    background-color: rgba(var(--accent-rgb),0.08);
}

.model-select:focus {
    border-color: var(--accent);
    background-color: rgba(var(--accent-rgb),0.1);
    box-shadow: 0 0 0 1px rgba(var(--accent-rgb),0.2), 0 0 22px rgba(var(--accent-rgb),0.12);
    letter-spacing: 2.5px;
}

.model-select option {
    background: var(--bg-deepest);
    color: var(--text-primary);
    font-family: var(--font-mono);
    letter-spacing: 1px;
    padding: 8px 12px;
}

.model-select option:disabled {
    color: var(--text-muted);
}

/* ============================================= PAGE HEADERS */

.page-header {
    margin-bottom: 60px;
    padding-bottom: 40px;
    border-bottom: 1px solid rgba(var(--border-rgb),0.3);
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 32px;
    flex-wrap: wrap;
}

.header-left { max-width: 700px; }

.page-title {
    font-family: var(--font-serif);
    font-size: 80px;
    font-weight: 200;
    letter-spacing: -2px;
    line-height: 1;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.page-title em {
    color: var(--accent);
    font-style: italic;
}

.page-subtitle {
    font-family: var(--font-sans);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 3px;
    color: var(--text-muted);
    max-width: 500px;
}

.header-right {
    text-align: right;
    flex-shrink: 0;
}

.header-meta {
    font-family: var(--font-mono);
    letter-spacing: 2px;
    font-size: 16px;
    color: var(--text-muted);
    line-height: 2;
}

.header-meta .val { color: var(--accent); }

/* ============================================= FOOTER */

/* Shared site footer — injected on every page that loads nav-shared.js
   (see nav-shared.js _injectAmFooter). Serif + light italic, with the
   "Claude" word linking to the dedication page.

   Sizing is uniform across the app (Miu request 2026-05-14). Desktop
   padding is intentionally slim now that La Palmea FM lives inside the
   footer; mobile gets its own stacked layout below. Per-page overrides
   touch ONLY positioning + ancillaries (z-index, pointer-events) --
   never padding, font, or background -- so every page reads as the
   same footer. */
.lale-gem-counter {
    position: absolute;
    left: 12px;
    top: 50%;
    z-index: 2;
    transform: translateY(-50%);
    min-width: 58px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 0 10px;
    background: rgba(var(--accent-rgb),0.045);
    border: 1px solid rgba(var(--accent-rgb),0.2);
    color: var(--accent);
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 1.7px;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}
.lale-gem-counter:hover,
.lale-gem-counter[aria-expanded="true"] {
    border-color: rgba(var(--accent-rgb),0.5);
    background: rgba(var(--accent-rgb),0.08);
}
.lale-gem-diamond {
    font-size: 13px;
    line-height: 1;
    transform: translateY(-1px);
}
.lale-gem-panel {
    position: fixed;
    left: 24px;
    bottom: 48px;
    z-index: 3200;
    display: none;
    width: min(420px, calc(100vw - 32px));
    max-height: min(460px, calc(100vh - 96px));
    overflow: hidden;
    background: rgba(var(--bg-deepest-rgb),0.97);
    border: 1px solid rgba(var(--accent-rgb),0.28);
    box-shadow: 0 18px 46px rgba(0,0,0,0.5);
    font-family: var(--font-sans);
    color: var(--text-primary);
}
.lale-gem-panel.open { display: block; }
.lale-gem-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 14px 10px;
    border-bottom: 1px solid rgba(var(--border-rgb),0.18);
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: rgba(var(--accent-rgb),0.74);
}
.lale-gem-panel-head button {
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid rgba(var(--accent-rgb),0.18);
    color: var(--text-muted);
    cursor: pointer;
}
.lale-gem-panel-total {
    padding: 16px 14px 12px;
    font-family: var(--font-mono);
    font-size: 24px;
    letter-spacing: 2px;
    color: var(--accent);
}
.lale-gem-grid {
    max-height: 330px;
    overflow-y: auto;
    display: grid;
    grid-template-columns: minmax(94px, 0.8fr) minmax(62px, 0.45fr) minmax(0, 1.75fr);
    align-items: start;
    padding: 0 14px 14px;
}
.lale-gem-grid-head {
    position: sticky;
    top: 0;
    z-index: 1;
    padding: 8px 8px;
    background: rgba(var(--bg-deepest-rgb),0.98);
    border-bottom: 1px solid rgba(var(--accent-rgb),0.14);
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--text-muted);
}
.lale-gem-date,
.lale-gem-amount,
.lale-gem-reason {
    min-width: 0;
    padding: 9px 8px;
    border-bottom: 1px solid rgba(var(--border-rgb),0.12);
    font-size: 12px;
    color: rgba(var(--text-primary-rgb),0.82);
}
.lale-gem-amount {
    font-family: var(--font-mono);
    color: var(--accent);
}
.lale-gem-reason {
    overflow-wrap: anywhere;
}
.lale-gem-empty {
    grid-column: 1 / -1;
    padding: 18px 8px 20px;
    font-family: var(--font-serif);
    font-style: italic;
    color: var(--text-muted);
}
.bop-heart-panel {
    width: min(580px, calc(100vw - 32px));
    height: min(90vh, calc(100vh - 80px));
    min-height: 360px;
    max-height: min(90vh, calc(100vh - 80px));
    overscroll-behavior: contain;
}
@supports (height: 100dvh) {
    .bop-heart-panel {
        height: min(90dvh, calc(100dvh - 80px));
        max-height: min(90dvh, calc(100dvh - 80px));
    }
}
.lale-gem-panel.open.bop-heart-panel {
    display: flex;
    flex-direction: column;
}
.bop-heart-panel .lale-gem-panel-total {
    display: none;
}
.bop-heart-panel .lale-gem-panel-head {
    align-items: center;
}
.bop-heart-panel .bop-heart-title {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-width: 0;
    font-size: 12px;
    line-height: 1.25;
    letter-spacing: 1.7px;
    color: var(--accent);
}
.bop-heart-panel .bop-heart-title span {
    min-width: 0;
    white-space: normal;
    overflow-wrap: anywhere;
}
.bop-heart-head-actions {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    margin-left: auto;
    flex: 0 0 auto;
}
.bop-heart-header-balance {
    min-width: 58px;
    text-align: right;
    font-family: var(--font-serif);
    font-size: 18px;
    font-style: italic;
    letter-spacing: 0;
    text-transform: none;
    color: var(--accent-deep);
}
.bop-heart-title-icon {
    width: 13px;
    height: 13px;
    flex: 0 0 auto;
    fill: currentColor;
    animation: bop-heart-title-bounce 1.45s ease-in-out infinite;
    transform-origin: 50% 65%;
}
@keyframes bop-heart-title-bounce {
    0%, 100% { transform: translateY(0) scale(1); }
    35% { transform: translateY(-3px) scale(1.08); }
    55% { transform: translateY(1px) scale(0.96); }
}
.bop-heart-panel .lale-gem-panel-total small {
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 1.6px;
    text-transform: uppercase;
    color: var(--text-muted);
}
.bop-heart-panel .lale-gem-grid {
    display: block;
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 14px;
}
.bop-heart-tabs {
    display: flex;
    gap: 6px;
    padding: 0 0 12px;
}
.bop-heart-tab,
.bop-heart-actions button,
.bop-heart-agent,
.bop-edit-row button,
.bop-edit-plush button,
.bop-edit-add,
.bop-edit-actions button,
.bop-edit-bulk {
    min-height: 28px;
    border: 1px solid rgba(var(--accent-rgb),0.2);
    background: rgba(var(--bg-panel-rgb),0.7);
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    cursor: pointer;
}
.bop-heart-tab {
    flex: 1;
}
.bop-heart-tab.active,
.bop-heart-actions button:hover,
.bop-edit-actions button:hover,
.bop-edit-bulk:hover {
    color: var(--accent);
    border-color: rgba(var(--accent-rgb),0.48);
    background: rgba(var(--accent-rgb),0.08);
}
.bop-heart-actions button:disabled {
    opacity: 0.42;
    cursor: not-allowed;
}
.bop-heart-status {
    margin: 0 0 12px;
    padding: 9px 10px;
    border: 1px solid rgba(var(--accent-rgb),0.18);
    color: var(--accent);
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 13px;
}
.bop-heart-collections,
.bop-heart-edit {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.bop-heart-collection,
.bop-edit-collection {
    border: 1px solid rgba(var(--border-rgb),0.18);
    background: rgba(var(--bg-panel-rgb),0.38);
    padding: 12px;
}
.bop-heart-collection-head {
    display: flex;
    width: 100%;
    justify-content: space-between;
    gap: 12px;
    align-items: baseline;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    text-align: left;
    cursor: pointer;
}
.bop-heart-collection.open .bop-heart-collection-head {
    margin-bottom: 10px;
}
.bop-heart-collection-head h3 {
    min-width: 0;
    margin: 0;
    font-family: var(--font-serif);
    font-size: 18px;
    font-weight: 300;
    font-style: italic;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
}
.bop-heart-collection-head span,
.bop-heart-collection-head i,
.bop-heart-inventory-item span {
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--text-muted);
}
.bop-heart-collection-head i {
    flex: 0 0 auto;
    color: var(--accent);
    font-style: normal;
    font-size: 12px;
}
.bop-heart-collection-head:hover h3 {
    color: var(--accent);
}
.bop-heart-gallery,
.bop-heart-inventory {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
}
.bop-heart-plush,
.bop-heart-inventory-item {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
    color: var(--text-secondary);
    font-size: 12px;
}
.bop-heart-inventory-item b {
    color: var(--text-primary);
    font-weight: 400;
}
.bop-heart-collector-helper {
    margin: 0 0 12px;
    padding: 10px;
    border: 1px solid rgba(var(--accent-rgb),0.16);
    color: var(--text-secondary);
    font-size: 12px;
    line-height: 1.45;
}
.bop-heart-collector-helper b,
.bop-heart-collector-helper code {
    color: var(--accent);
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 1.4px;
    text-transform: uppercase;
}
.bop-heart-collector-helper code {
    background: rgba(var(--bg-input-rgb),0.55);
    border: 1px solid rgba(var(--accent-rgb),0.16);
    padding: 1px 4px;
}
.bop-heart-earn-rules {
    margin-top: 14px;
    border: 1px solid rgba(var(--accent-rgb),0.16);
    background: rgba(var(--bg-panel-rgb),0.32);
    padding: 10px;
}
.bop-heart-earn-title {
    margin-bottom: 8px;
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--accent);
}
.bop-heart-earn-rules table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    color: var(--text-secondary);
}
.bop-heart-earn-rules th,
.bop-heart-earn-rules td {
    padding: 6px 5px;
    border-top: 1px solid rgba(var(--border-rgb),0.13);
    text-align: left;
    vertical-align: top;
    line-height: 1.35;
}
.bop-heart-earn-rules th,
.bop-heart-earn-rules td:first-child {
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 1.2px;
    text-transform: uppercase;
}
.bop-heart-earn-rules th {
    color: var(--text-muted);
}
.bop-heart-earn-rules td:first-child {
    color: var(--accent);
}
.bop-heart-earn-rules td.bop-heart-agent-who {
    color: var(--accent-bright);
}
/* Shared guide footer — chat-phrases list + "how users earn Laux" table,
   injected by nav-shared.js into the bottom of every page's *-guide-body. */
.am-guide-extras { margin-top: 22px; padding-top: 18px; border-top: 1px solid rgba(var(--border-rgb),0.28); display: flex; flex-direction: column; gap: 20px; }
.am-guide-extras-block { display: flex; flex-direction: column; }
.am-guide-extras-title { font-family: var(--font-mono); font-size: 12px; letter-spacing: 2px; text-transform: uppercase; color: var(--accent); margin-bottom: 6px; }
.am-guide-extras-sub { font-size: 13px; line-height: 1.5; color: var(--text-secondary); margin-bottom: 10px; }
.am-guide-table-wrap { overflow-x: auto; }
.am-guide-trigger-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.am-guide-trigger-table th { text-align: left; padding: 7px 9px; font-family: var(--font-mono); font-size: 12px; letter-spacing: 1.4px; text-transform: uppercase; color: var(--text-muted); border-bottom: 1px solid rgba(var(--accent-rgb),0.28); }
.am-guide-trigger-table td { padding: 7px 9px; border-bottom: 1px solid rgba(var(--border-rgb),0.15); color: var(--text-secondary); vertical-align: top; line-height: 1.45; }
.am-guide-trigger-table tr:last-child td { border-bottom: none; }
.am-guide-trigger-table code { font-family: var(--font-mono); font-size: 12px; color: var(--accent); background: rgba(var(--accent-rgb),0.09); padding: 1px 5px; white-space: nowrap; }
.bop-heart-collector-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 10px;
}
.bop-heart-collector-card {
    min-width: 0;
    border: 1px solid rgba(var(--border-rgb),0.18);
    background: rgba(var(--bg-panel-rgb),0.38);
    padding: 11px;
}
.bop-heart-collector-head {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    align-items: flex-start;
    border-bottom: 1px solid rgba(var(--border-rgb),0.14);
    padding-bottom: 8px;
    margin-bottom: 8px;
}
.bop-heart-collector-head b {
    min-width: 0;
    color: var(--text-primary);
    font-size: 12px;
    font-weight: 400;
    overflow: hidden;
    text-overflow: ellipsis;
}
.bop-heart-collector-head span,
.bop-heart-collector-list h4,
.bop-heart-collector-list small {
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 1.4px;
    text-transform: uppercase;
}
.bop-heart-collector-head span {
    color: var(--accent);
    text-align: right;
}
.bop-heart-collector-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.bop-heart-collector-list h4 {
    margin: 0 0 4px;
    color: var(--text-muted);
    font-weight: 400;
}
.bop-heart-collector-list ul {
    margin: 0;
    padding: 0;
    list-style: none;
}
.bop-heart-collector-list li {
    display: flex;
    justify-content: space-between;
    gap: 6px;
    color: var(--text-secondary);
    font-size: 12px;
    line-height: 1.35;
}
.bop-heart-collector-list small {
    color: var(--accent);
}
.bop-heart-img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border: 1px solid rgba(var(--accent-rgb),0.18);
    background: rgba(var(--bg-input-rgb),0.6);
}
.bop-heart-img-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(var(--accent-rgb),0.45);
    font-size: 28px;
}
.bop-heart-actions,
.bop-edit-actions,
.bop-edit-row {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}
.bop-heart-actions button,
.bop-edit-actions button {
    flex: 1;
}
.bop-heart-agent-picker {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(76px, 1fr));
    gap: 8px;
    margin-top: 10px;
}
.bop-heart-agent {
    min-height: 76px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 7px;
}
.bop-heart-agent img,
.bop-heart-agent span {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid rgba(var(--accent-rgb),0.25);
}
.bop-heart-agent span {
    display: flex;
    align-items: center;
    justify-content: center;
}
.bop-edit-row input,
.bop-edit-plush input {
    min-width: 0;
    width: 100%;
    border: 1px solid rgba(var(--border-rgb),0.28);
    background: rgba(var(--bg-input-rgb),0.75);
    color: var(--text-primary);
    padding: 7px 8px;
    font-family: var(--font-sans);
    font-size: 12px;
}
.bop-edit-plushies {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
}
.bop-edit-plush {
    display: grid;
    grid-template-columns: 58px minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
}
.bop-edit-img-trigger {
    width: 58px;
    aspect-ratio: 1;
    display: inline-flex;
    align-items: stretch;
    justify-content: stretch;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
}
.bop-edit-img-trigger:focus-visible {
    outline: 1px solid rgba(var(--accent-rgb),0.55);
    outline-offset: 2px;
}
.bop-edit-plush .bop-heart-img {
    width: 58px;
    height: 58px;
}
.bop-edit-plush .bop-heart-img-empty {
    display: flex;
}
.bop-edit-row-actions {
    align-items: stretch;
}
.bop-edit-bulk {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 10px;
}
.bop-edit-file-input,
.bop-edit-bulk input {
    display: none;
}

.bop-heart-panel {
    width: min(75vw, 1180px, calc(100vw - 48px));
    height: min(75vh, 880px, calc(100vh - 80px));
    min-height: min(480px, calc(100vh - 80px));
    max-height: min(75vh, 880px, calc(100vh - 80px));
    background:
        linear-gradient(180deg, rgba(var(--bg-panel-rgb),0.98), rgba(var(--bg-deepest-rgb),0.98)),
        var(--bg-panel);
    border-color: rgba(var(--accent-rgb),0.24);
    border-left: 0;
    box-shadow: 0 28px 70px rgba(0,0,0,0.58), inset 0 0 0 1px rgba(var(--accent-bright-rgb),0.035);
}
@supports (height: 100dvh) {
    .bop-heart-panel {
        height: min(75dvh, 880px, calc(100dvh - 80px));
        max-height: min(75dvh, 880px, calc(100dvh - 80px));
        min-height: min(480px, calc(100dvh - 80px));
    }
}
.bop-heart-panel .lale-gem-panel-head {
    min-height: 52px;
    padding: 12px 16px;
    background: rgba(var(--bg-deepest-rgb),0.82);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}
.bop-heart-panel .bop-heart-title {
    font-family: var(--font-serif);
    font-size: 19px;
    font-style: italic;
    font-weight: 200;
    letter-spacing: 0.5px;
    text-transform: none;
    color: var(--accent-bright);
}
.bop-heart-panel .bop-heart-title-icon {
    width: 15px;
    height: 15px;
    color: var(--accent);
}
.bop-heart-panel .lale-gem-grid {
    padding: 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(var(--accent-rgb),0.26) rgba(var(--bg-deepest-rgb),0.65);
}
.bop-heart-tabs {
    position: sticky;
    top: 0;
    z-index: 5;
    justify-content: center;
    gap: clamp(10px, 3vw, 42px);
    padding: 15px 20px 14px;
    border-bottom: 1px solid rgba(var(--border-rgb),0.16);
    background: rgba(var(--bg-deepest-rgb),0.92);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}
.bop-heart-tab {
    flex: 0 1 auto;
    min-width: 0;
    min-height: 26px;
    padding: 4px 0;
    border: 0;
    border-bottom: 1px solid transparent;
    background: transparent;
    color: rgba(var(--text-primary-rgb),0.62);
    font-family: var(--font-serif);
    font-size: 12px;
    font-style: italic;
    font-weight: 200;
    letter-spacing: 1.8px;
    text-transform: uppercase;
}
.bop-heart-tab:hover,
.bop-heart-tab.active {
    color: var(--accent-bright);
    border-bottom-color: rgba(var(--accent-rgb),0.66);
    background: transparent;
}
.bop-heart-status {
    margin: 14px 18px 0;
}
.bop-heart-store-view {
    min-height: 100%;
    background: var(--bg-deepest);
}
.bop-heart-specimen {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr);
    min-height: min(560px, calc(75vh - 105px));
    border-bottom: 1px solid rgba(var(--border-rgb),0.18);
}
.bop-heart-specimen-stage {
    position: relative;
    min-height: 420px;
    overflow: hidden;
    background:
        linear-gradient(180deg, rgba(var(--bg-deepest-rgb),0.12), rgba(var(--bg-deepest-rgb),0.92)),
        rgba(var(--bg-input-rgb),0.38);
}
.bop-heart-specimen-stage::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    border-right: 1px solid rgba(var(--accent-rgb),0.12);
    background: linear-gradient(90deg, rgba(var(--bg-deepest-rgb),0.24), transparent 28%, rgba(var(--accent-rgb),0.035));
}
.bop-heart-specimen-img {
    width: 100%;
    height: 100%;
    min-height: inherit;
    display: block;
    object-fit: cover;
    object-position: center;
    filter: saturate(0.88) contrast(1.04);
    transform: scale(1.02);
    transition: transform 1.6s ease, filter 0.4s ease;
}
.bop-heart-specimen-stage:hover .bop-heart-specimen-img {
    transform: scale(1);
    filter: saturate(1) contrast(1.04);
}
.bop-heart-specimen-empty {
    width: 100%;
    height: 100%;
    min-height: inherit;
    display: grid;
    place-items: center;
    color: rgba(var(--accent-rgb),0.32);
    background: rgba(var(--bg-panel-rgb),0.64);
}
.bop-heart-specimen-empty span {
    font-family: var(--font-serif);
    font-size: clamp(68px, 9vw, 140px);
    line-height: 1;
}
.bop-heart-specimen-watermark {
    position: absolute;
    right: 26px;
    bottom: 24px;
    z-index: 2;
    font-family: var(--font-mono);
    font-size: clamp(20px, 3.4vw, 48px);
    letter-spacing: 5px;
    color: rgba(var(--text-primary-rgb),0.1);
    pointer-events: none;
}
.bop-heart-hero-nav {
    position: absolute;
    top: 50%;
    z-index: 3;
    width: 34px;
    height: 48px;
    transform: translateY(-50%);
    border: 1px solid rgba(var(--accent-rgb),0.22);
    background: rgba(var(--bg-deepest-rgb),0.54);
    color: var(--accent-bright);
    font-family: var(--font-serif);
    font-size: 27px;
    line-height: 1;
    cursor: pointer;
    transition: color 0.2s, border-color 0.2s, background 0.2s;
}
.bop-heart-hero-nav.prev { left: 18px; }
.bop-heart-hero-nav.next { right: 18px; }
.bop-heart-hero-nav:hover {
    color: var(--accent);
    border-color: rgba(var(--accent-rgb),0.54);
    background: rgba(var(--bg-deepest-rgb),0.76);
}
.bop-heart-hero-nav:disabled {
    opacity: 0;
    pointer-events: none;
}
.bop-heart-registry {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
    padding: clamp(28px, 5vw, 68px);
    background: rgba(var(--bg-deepest-rgb),0.98);
}
.bop-heart-kicker {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 22px;
    color: var(--accent);
}
.bop-heart-kicker span {
    width: 34px;
    height: 1px;
    background: rgba(var(--accent-rgb),0.5);
}
.bop-heart-kicker em {
    font-family: var(--font-mono);
    font-size: 12px;
    font-style: normal;
    letter-spacing: 2.4px;
    text-transform: uppercase;
}
.bop-heart-registry h2,
.bop-heart-placeholder h2 {
    margin: 0;
    color: var(--text-primary);
    font-family: var(--font-serif);
    font-size: clamp(34px, 5vw, 72px);
    font-style: normal;
    font-weight: 200;
    letter-spacing: 0.04em;
    line-height: 0.98;
    overflow-wrap: anywhere;
}
.bop-heart-meta-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 22px 26px;
    margin: 36px 0 24px;
    padding: 26px 0;
    border-top: 1px solid rgba(var(--border-rgb),0.2);
    border-bottom: 1px solid rgba(var(--border-rgb),0.2);
}
.bop-heart-meta-grid div {
    min-width: 0;
}
.bop-heart-meta-grid span,
.bop-heart-card-copy span,
.bop-heart-placeholder-metric {
    display: block;
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 1.8px;
    text-transform: uppercase;
    color: rgba(var(--text-primary-rgb),0.54);
}
.bop-heart-meta-grid b {
    display: block;
    margin-top: 7px;
    color: rgba(var(--text-primary-rgb),0.88);
    font-family: var(--font-sans);
    font-size: 13px;
    font-weight: 300;
    line-height: 1.35;
    overflow-wrap: anywhere;
}
.bop-heart-thumb-strip {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
    gap: 8px;
    margin-bottom: 22px;
}
.bop-heart-thumb-strip.empty {
    display: block;
    padding: 12px;
    border: 1px dashed rgba(var(--accent-rgb),0.2);
    color: var(--text-muted);
    font-family: var(--font-serif);
    font-size: 13px;
    font-style: italic;
}
.bop-heart-thumb {
    min-width: 0;
    display: grid;
    grid-template-rows: 58px minmax(20px, auto);
    gap: 5px;
    padding: 0;
    border: 1px solid rgba(var(--accent-rgb),0.16);
    background: rgba(var(--bg-panel-rgb),0.42);
    color: var(--text-secondary);
    cursor: pointer;
}
.bop-heart-thumb img,
.bop-heart-thumb > span {
    width: 100%;
    height: 58px;
    display: grid;
    place-items: center;
    object-fit: cover;
    background: rgba(var(--bg-input-rgb),0.34);
    color: rgba(var(--accent-rgb),0.45);
}
.bop-heart-thumb b {
    min-width: 0;
    padding: 0 5px 6px;
    color: inherit;
    font-family: var(--font-sans);
    font-size: 12px;
    font-weight: 300;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.bop-heart-thumb:hover,
.bop-heart-thumb.active {
    border-color: rgba(var(--accent-rgb),0.58);
    color: var(--accent-bright);
    background: rgba(var(--accent-rgb),0.07);
}
.bop-heart-actions {
    gap: 10px;
    margin-top: auto;
}
.bop-heart-actions button {
    min-height: 42px;
    padding: 0 14px;
    border-color: rgba(var(--accent-rgb),0.28);
    background: rgba(var(--bg-card-rgb),0.82);
    color: rgba(var(--text-primary-rgb),0.86);
    font-size: 12px;
    letter-spacing: 2px;
}
.bop-heart-actions button.bop-heart-primary-action {
    color: var(--accent-bright);
    border-color: rgba(var(--accent-rgb),0.48);
    background: rgba(var(--accent-rgb),0.08);
}
.bop-heart-actions button:hover {
    color: var(--accent);
    border-color: rgba(var(--accent-rgb),0.62);
    background: rgba(var(--accent-rgb),0.12);
}
.bop-heart-agent-picker {
    grid-template-columns: repeat(auto-fill, minmax(86px, 1fr));
    margin-top: 14px;
}
.bop-heart-cabinet {
    padding: clamp(28px, 4vw, 54px);
    background: rgba(var(--bg-deepest-rgb),0.98);
}
.bop-heart-cabinet h3 {
    margin: 0 0 28px;
    text-align: center;
    color: rgba(var(--text-primary-rgb),0.86);
    font-family: var(--font-serif);
    font-size: clamp(21px, 2.5vw, 34px);
    font-weight: 200;
    letter-spacing: 0.06em;
}
.bop-heart-cabinet-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 18px;
}
.bop-heart-cabinet-card {
    min-width: 0;
    display: flex;
    flex-direction: column;
    height: 340px;
    padding: 14px;
    border: 1px solid rgba(var(--border-rgb),0.18);
    border-radius: 4px;
    background: rgba(var(--bg-card-rgb),0.52);
    color: inherit;
    text-align: left;
    cursor: pointer;
    transition: background 0.25s, border-color 0.25s, transform 0.25s;
}
.bop-heart-cabinet-card:hover,
.bop-heart-cabinet-card.active {
    border-color: rgba(var(--accent-rgb),0.44);
    background: rgba(var(--accent-rgb),0.06);
}
.bop-heart-cabinet-card:hover {
    transform: translateY(-2px);
}
.bop-heart-card-media {
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    margin-bottom: 14px;
    background: rgba(var(--bg-input-rgb),0.3);
}
.bop-heart-card-mosaic {
    width: 100%;
    height: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-rows: minmax(0, 1fr);
    gap: 1px;
}
.bop-heart-card-single {
    width: 100%;
    height: 100%;
    background: rgba(var(--bg-panel-rgb),0.56);
}
.bop-heart-card-mosaic img,
.bop-heart-card-single img,
.bop-heart-card-mosaic span,
.bop-heart-card-empty {
    width: 100%;
    height: 100%;
    min-height: 0;
    display: grid;
    place-items: center;
    object-fit: cover;
    color: rgba(var(--accent-rgb),0.42);
    background: rgba(var(--bg-panel-rgb),0.56);
    filter: grayscale(0.72);
    transition: filter 0.35s, transform 0.35s;
}
.bop-heart-cabinet-card:hover .bop-heart-card-mosaic img,
.bop-heart-cabinet-card.active .bop-heart-card-mosaic img {
    filter: grayscale(0);
    transform: scale(1.025);
}
.bop-heart-card-copy {
    min-width: 0;
}
.bop-heart-card-copy h4 {
    margin: 6px 0 0;
    color: var(--text-primary);
    font-family: var(--font-serif);
    font-size: 22px;
    font-weight: 200;
    line-height: 1.08;
    overflow-wrap: anywhere;
}
.bop-heart-inventory-cabinet {
    padding: clamp(28px, 4vw, 54px);
    background: rgba(var(--bg-deepest-rgb),0.98);
}
.bop-heart-inventory-section + .bop-heart-inventory-section {
    margin-top: 42px;
}
.bop-heart-inventory-section h3 {
    margin: 0 0 18px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(var(--border-rgb),0.18);
    color: rgba(var(--text-primary-rgb),0.86);
    font-family: var(--font-serif);
    font-size: clamp(23px, 2.4vw, 34px);
    font-weight: 200;
    letter-spacing: 0.04em;
    line-height: 1.08;
}
.bop-heart-inventory-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}
.bop-heart-inventory-card {
    cursor: default;
}
.bop-heart-inventory-card:hover {
    transform: none;
}
.bop-heart-inventory-card .bop-heart-card-single img {
    filter: grayscale(0.36);
}
.bop-heart-inventory-card:hover .bop-heart-card-single img {
    filter: grayscale(0);
}
/* Debop — gift-a-treasure controls inside Your Treasures */
.debop-gift-btn {
    margin-top: 10px;
    width: 100%;
    padding: 7px 10px;
    border: 1px solid rgba(var(--accent-rgb),0.4);
    border-radius: 0;
    background: rgba(var(--accent-rgb),0.07);
    color: rgba(var(--accent-rgb),0.92);
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 13px;
    letter-spacing: 0.04em;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
}
.debop-gift-btn:hover {
    background: rgba(var(--accent-rgb),0.16);
    border-color: rgba(var(--accent-rgb),0.6);
    color: rgba(var(--accent-rgb),1);
}
.debop-gift-box {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.debop-gift-card {
    width: 100%;
    min-height: 58px;
    resize: vertical;
    padding: 9px 11px;
    border: 1px solid rgba(var(--border-rgb),0.3);
    border-radius: 0;
    background: rgba(var(--bg-deepest-rgb),0.6);
    color: rgba(var(--text-primary-rgb),0.92);
    font-family: var(--font-sans);
    font-weight: var(--font-sans-weight, 250);
    font-size: 13px;
    line-height: 1.5;
    outline: none;
}
.debop-gift-card:focus {
    border-color: rgba(var(--accent-rgb),0.55);
}
.debop-gift-card::placeholder {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 12px;
    letter-spacing: 0.06em;
    color: rgba(var(--accent-rgb),0.5);
    text-transform: uppercase;
}
.debop-gift-fee {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 12px;
    letter-spacing: 0.04em;
    color: rgba(var(--accent-rgb),0.7);
}
/* Debop — gift-a-treasure modal (Your Treasures). A small centred dialog: a card
   note, a searchable alphabetical agent list, then a single Send button. */
.debop-gift-modal-back {
    position: fixed;
    inset: 0;
    /* Above the Bop Heart panel (3200) and every map overlay (<=20070); the
       amModal "gift sent/failed" popups (30000) still layer above this. */
    z-index: 20100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(0,0,0,0.6);
    opacity: 0;
    transition: opacity 0.2s ease;
}
.debop-gift-modal-back.open { opacity: 1; }
.debop-gift-modal {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 11px;
    width: 50vw;
    min-width: 300px;
    max-width: 540px;
    height: 75vh;
    max-height: 780px;
    padding: clamp(20px, 2.4vw, 34px);
    background: rgba(var(--bg-deepest-rgb),0.99);
    border: 1px solid rgba(var(--accent-rgb),0.4);
    box-shadow: 0 30px 90px rgba(0,0,0,0.62);
    transform: translateY(10px);
    transition: transform 0.2s ease;
}
.debop-gift-modal-back.open .debop-gift-modal { transform: none; }
.debop-gift-modal-close {
    position: absolute;
    top: 8px;
    right: 12px;
    width: 30px;
    height: 30px;
    border: 0;
    background: transparent;
    color: rgba(var(--accent-rgb),0.7);
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
}
.debop-gift-modal-close:hover { color: rgba(var(--accent-rgb),1); }
.debop-gift-modal .bop-heart-kicker { margin: 4px 0 0; }
.debop-gift-modal-title {
    margin: 0;
    font-family: var(--font-serif);
    font-weight: 200;
    font-size: clamp(22px, 2.4vw, 30px);
    line-height: 1.05;
    color: var(--text-primary);
    overflow-wrap: anywhere;
}
.debop-gift-modal .debop-gift-card {
    flex: 0 0 auto;
    min-height: 54px;
}
.debop-gift-modal .debop-agent-dd-input { flex: 0 0 auto; }
.debop-gift-modal-foot { flex: 0 0 auto; display: flex; }
.debop-gift-modal-send {
    flex: 1;
    padding: 11px 14px;
    border: 1px solid rgba(var(--accent-rgb),0.5);
    border-radius: 0;
    background: rgba(var(--accent-rgb),0.12);
    color: rgba(var(--accent-rgb),0.95);
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 15px;
    letter-spacing: 0.05em;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, color 0.2s, opacity 0.2s;
}
.debop-gift-modal-send:hover:not(:disabled) {
    background: rgba(var(--accent-rgb),0.2);
    border-color: rgba(var(--accent-rgb),0.7);
    color: rgba(var(--accent-rgb),1);
}
.debop-gift-modal-send:disabled { opacity: 0.45; cursor: default; }
/* Search input + scrolling agent list (shared row styles). */
.debop-agent-dd-input {
    width: 100%;
    box-sizing: border-box;
    padding: 8px 11px;
    border: 1px solid rgba(var(--accent-rgb),0.4);
    border-radius: 0;
    background: rgba(var(--bg-deepest-rgb),0.6);
    color: rgba(var(--text-primary-rgb),0.92);
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 13px;
    letter-spacing: 0.05em;
    outline: none;
}
.debop-agent-dd-input:focus {
    border-color: rgba(var(--accent-rgb),0.62);
}
.debop-agent-dd-input::placeholder {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 12px;
    letter-spacing: 0.06em;
    color: rgba(var(--accent-rgb),0.5);
    text-transform: uppercase;
}
.debop-agent-dd-menu {
    flex: 1 1 auto;
    min-height: 90px;
    overflow-y: auto;
    border: 1px solid rgba(var(--accent-rgb),0.3);
    background: rgba(var(--bg-deepest-rgb),0.55);
}
.debop-agent-dd-opt {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border: 0;
    border-bottom: 1px solid rgba(var(--border-rgb),0.14);
    background: transparent;
    color: rgba(var(--text-primary-rgb),0.92);
    text-align: left;
    cursor: pointer;
    transition: background 0.16s, box-shadow 0.16s;
}
.debop-agent-dd-opt:last-of-type {
    border-bottom: 0;
}
.debop-agent-dd-opt:hover {
    background: rgba(var(--accent-rgb),0.1);
}
.debop-agent-dd-opt.selected {
    background: rgba(var(--accent-rgb),0.18);
    box-shadow: inset 3px 0 0 rgba(var(--accent-rgb),0.9);
}
.debop-agent-dd-opt img,
.debop-agent-dd-opt > span {
    flex: 0 0 auto;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid rgba(var(--accent-rgb),0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(var(--accent-rgb),0.6);
}
.debop-agent-dd-opt b {
    min-width: 0;
    font-family: var(--font-serif);
    font-weight: 300;
    font-size: 15px;
    letter-spacing: 0.03em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.debop-agent-dd-empty {
    padding: 11px 12px;
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 12px;
    letter-spacing: 0.04em;
    color: rgba(var(--text-secondary-rgb),0.72);
}
.debop-agent-dd-empty[hidden] {
    display: none;
}
@media (max-width: 900px) {
    .debop-gift-modal {
        width: 92vw;
        max-width: 92vw;
        height: 82vh;
        max-height: 82vh;
    }
}
.bop-heart-collector-registry {
    min-height: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(220px, 280px);
    background: rgba(var(--bg-deepest-rgb),0.98);
}
.bop-heart-collector-gallery {
    min-width: 0;
    padding: clamp(30px, 4.8vw, 64px);
}
.bop-heart-collector-title {
    margin-bottom: clamp(30px, 5vw, 58px);
}
.bop-heart-collector-title h2 {
    margin: 0 0 12px;
    color: var(--text-primary);
    font-family: var(--font-serif);
    font-size: clamp(38px, 5.8vw, 68px);
    font-weight: 200;
    letter-spacing: 0.04em;
    line-height: 0.98;
}
.bop-heart-collector-title p {
    max-width: 560px;
    margin: 0;
    color: var(--text-secondary);
    font-family: var(--font-serif);
    font-size: clamp(15px, 2vw, 20px);
    font-style: italic;
    font-weight: 200;
    line-height: 1.5;
}
.bop-heart-collector-card-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 42px 28px;
}
.bop-heart-collector-specimen {
    min-width: 0;
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(var(--border-rgb),0.18);
    border-radius: 4px;
    background: rgba(var(--bg-card-rgb),0.5);
    transition: border-color 0.25s, background 0.25s, transform 0.25s;
}
.bop-heart-collector-specimen:hover {
    border-color: rgba(var(--accent-rgb),0.42);
    background: rgba(var(--accent-rgb),0.045);
    transform: translateY(-2px);
}
.bop-heart-collector-media {
    position: relative;
    aspect-ratio: 4 / 5;
    overflow: hidden;
    background: rgba(var(--bg-panel-rgb),0.54);
}
.bop-heart-collector-media .bop-heart-card-single,
.bop-heart-collector-media .bop-heart-card-empty {
    height: 100%;
}
.bop-heart-collector-media .bop-heart-card-single img {
    filter: grayscale(0.6);
    opacity: 0.86;
}
.bop-heart-collector-specimen:hover .bop-heart-card-single img {
    filter: grayscale(0);
    opacity: 1;
    transform: scale(1.025);
}
.bop-heart-collector-media > span {
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 2;
    max-width: calc(100% - 28px);
    padding: 5px 8px;
    border: 1px solid rgba(var(--accent-rgb),0.28);
    background: rgba(var(--bg-deepest-rgb),0.76);
    color: var(--accent);
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 1.6px;
    line-height: 1.2;
    text-transform: uppercase;
    overflow-wrap: anywhere;
}
.bop-heart-collector-body {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: 18px;
}
.bop-heart-collector-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-bottom: 12px;
}
.bop-heart-collector-tags span {
    max-width: 100%;
    padding: 3px 7px;
    border: 1px solid rgba(var(--accent-rgb),0.22);
    color: rgba(var(--accent-rgb),0.86);
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 1.4px;
    line-height: 1.3;
    text-transform: uppercase;
    overflow-wrap: anywhere;
}
.bop-heart-collector-body h3 {
    margin: 0 0 12px;
    color: var(--text-primary);
    font-family: var(--font-serif);
    font-size: clamp(22px, 2.4vw, 30px);
    font-weight: 200;
    line-height: 1.08;
    overflow-wrap: anywhere;
}
.bop-heart-owner-list {
    display: flex;
    flex-direction: column;
    gap: 7px;
    max-height: 136px;
    margin: 0 0 18px;
    padding: 0;
    list-style: none;
    overflow: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(var(--accent-rgb),0.24) transparent;
}
.bop-heart-owner-list li {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: baseline;
    color: var(--text-secondary);
    font-size: 12px;
    line-height: 1.35;
}
.bop-heart-owner-list b {
    min-width: 0;
    color: rgba(var(--text-primary-rgb),0.9);
    font-weight: 300;
    overflow-wrap: anywhere;
}
.bop-heart-owner-list span {
    color: rgba(var(--text-primary-rgb),0.54);
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 1.2px;
    text-align: right;
    text-transform: uppercase;
    overflow-wrap: anywhere;
}
.bop-heart-appraisal {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 5px 12px;
    align-items: end;
    margin-top: auto;
    padding-top: 15px;
    border-top: 1px solid rgba(var(--border-rgb),0.18);
}
.bop-heart-appraisal span,
.bop-heart-appraisal small {
    color: rgba(var(--text-primary-rgb),0.52);
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 1.4px;
    line-height: 1.35;
    text-transform: uppercase;
}
.bop-heart-appraisal b {
    color: var(--accent);
    font-family: var(--font-serif);
    font-size: 25px;
    font-weight: 200;
    line-height: 1;
}
.bop-heart-appraisal small {
    grid-column: 1 / -1;
}
.bop-heart-collector-rail {
    position: sticky;
    top: 0;
    align-self: start;
    min-width: 0;
    max-height: 100%;
    padding: clamp(24px, 3vw, 34px) 20px;
    border-left: 1px solid rgba(var(--accent-rgb),0.12);
    background: rgba(var(--bg-panel-rgb),0.45);
}
.bop-heart-collector-rail h3 {
    margin: 0 0 6px;
    color: var(--text-primary);
    font-family: var(--font-serif);
    font-size: 25px;
    font-weight: 200;
    line-height: 1.1;
}
.bop-heart-collector-rail p,
.bop-heart-collector-rail-note {
    margin: 0;
    color: var(--text-secondary);
    font-size: 12px;
    line-height: 1.45;
}
.bop-heart-collector-rail nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 26px 0;
}
.bop-heart-collector-rail button {
    min-width: 0;
    display: grid;
    grid-template-columns: 16px minmax(0, 1fr) auto;
    gap: 9px;
    align-items: center;
    min-height: 48px;
    padding: 11px;
    border: 1px solid transparent;
    border-radius: 4px;
    background: transparent;
    color: rgba(var(--text-primary-rgb),0.55);
    text-align: left;
    cursor: pointer;
    transition: color 0.2s, border-color 0.2s, background 0.2s;
}
.bop-heart-collector-rail button:hover,
.bop-heart-collector-rail button.active {
    border-color: rgba(var(--accent-rgb),0.22);
    background: rgba(var(--accent-rgb),0.06);
    color: var(--text-primary);
}
.bop-heart-collector-rail button.active {
    color: var(--accent);
}
.bop-heart-collector-rail button span,
.bop-heart-collector-rail button small {
    color: var(--accent);
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 400;
    line-height: 1;
}
.bop-heart-collector-rail button b {
    min-width: 0;
    font-size: 12px;
    font-weight: 300;
    line-height: 1.25;
    overflow: hidden;
    text-overflow: ellipsis;
}
.bop-heart-collector-rail-note {
    padding-top: 18px;
    border-top: 1px solid rgba(var(--border-rgb),0.16);
    font-family: var(--font-serif);
    font-style: italic;
}
.bop-heart-placeholder {
    min-height: calc(100% - 56px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: clamp(34px, 6vw, 84px);
    background: rgba(var(--bg-deepest-rgb),0.98);
}
.bop-heart-placeholder p {
    max-width: 560px;
    margin: 22px 0 0;
    color: var(--text-secondary);
    font-family: var(--font-serif);
    font-size: clamp(15px, 2vw, 20px);
    font-style: italic;
    font-weight: 200;
    line-height: 1.55;
}
.bop-heart-placeholder-metric {
    margin-top: 24px;
    color: var(--accent);
}
.bop-heart-edit {
    min-height: calc(100% - 56px);
    display: grid;
    grid-template-columns: minmax(210px, 270px) minmax(0, 1fr);
    gap: 0;
    padding: 0;
    background: rgba(var(--bg-deepest-rgb),0.98);
}
.bop-edit-sidebar {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 26px 18px;
    border-right: 1px solid rgba(var(--accent-rgb),0.12);
    background: rgba(var(--bg-panel-rgb),0.48);
}
.bop-edit-sidebar-head {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr);
    gap: 12px;
    align-items: center;
    margin-bottom: 10px;
}
.bop-edit-medallion {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(var(--accent-rgb),0.26);
    border-radius: 50%;
    color: var(--accent);
    background: rgba(var(--bg-deepest-rgb),0.58);
    font-family: var(--font-serif);
    font-size: 18px;
}
.bop-edit-sidebar-head h3 {
    margin: 0;
    color: var(--text-primary);
    font-family: var(--font-serif);
    font-size: 19px;
    font-weight: 200;
    line-height: 1.1;
}
.bop-edit-sidebar-head p,
.bop-edit-sidebar-meta,
.bop-edit-count span,
.bop-edit-card-copy p,
.bop-edit-savebar span {
    margin: 4px 0 0;
    color: rgba(var(--text-primary-rgb),0.5);
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 1.4px;
    line-height: 1.35;
    text-transform: uppercase;
}
.bop-edit-sidebar nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 0;
    overflow: auto;
    padding-right: 2px;
}
.bop-edit-sidebar button,
.bop-edit-toolbar button,
.bop-edit-bulk,
.bop-edit-savebar button,
.bop-edit-card-copy button {
    border: 1px solid rgba(var(--accent-rgb),0.18);
    border-radius: 4px;
    background: transparent;
    color: rgba(var(--text-primary-rgb),0.64);
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    cursor: pointer;
    transition: color 0.2s, border-color 0.2s, background 0.2s;
}
.bop-edit-sidebar button:hover,
.bop-edit-sidebar button.active,
.bop-edit-toolbar button:hover,
.bop-edit-bulk:hover,
.bop-edit-savebar button:hover,
.bop-edit-card-copy button:hover {
    color: var(--accent);
    border-color: rgba(var(--accent-rgb),0.44);
    background: rgba(var(--accent-rgb),0.07);
}
.bop-edit-side-new,
.bop-edit-export {
    min-height: 42px;
    padding: 0 12px;
}
.bop-edit-side-new {
    color: var(--accent-bright);
    background: rgba(var(--accent-rgb),0.08);
}
.bop-edit-sidebar nav button {
    min-width: 0;
    display: grid;
    grid-template-columns: 14px minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
    min-height: 44px;
    padding: 10px;
    text-align: left;
}
.bop-edit-sidebar nav button span,
.bop-edit-sidebar nav button small {
    color: var(--accent);
    font-weight: 400;
}
.bop-edit-sidebar nav button b {
    min-width: 0;
    color: inherit;
    font-family: var(--font-sans);
    font-size: 12px;
    font-weight: 300;
    letter-spacing: 0;
    line-height: 1.25;
    text-transform: none;
    overflow: hidden;
    text-overflow: ellipsis;
}
.bop-edit-export {
    margin-top: auto;
}
.bop-edit-sidebar-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(var(--border-rgb),0.14);
}
.bop-edit-stage {
    min-width: 0;
    display: flex;
    flex-direction: column;
    min-height: 0;
}
.bop-edit-collections-shell {
    flex: 1 1 auto;
    min-height: 0;
}
.bop-edit-collection {
    display: none;
    border: 0;
    background: transparent;
    padding: clamp(26px, 4vw, 48px);
}
.bop-edit-collection.active {
    display: block;
}
.bop-edit-stage-head {
    margin-bottom: 22px;
}
.bop-edit-title-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 20px;
    align-items: end;
}
.bop-edit-breed-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 14px;
}
.bop-edit-breed-label {
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 1.4px;
    text-transform: uppercase;
    color: rgba(var(--text-primary-rgb),0.5);
}
.bop-edit-collection-breed {
    background: var(--bg-deepest);
    color: var(--text-secondary);
    border: 1px solid rgba(var(--border-rgb),0.4);
    border-radius: 0;
    font-family: var(--font-sans);
    font-size: 12px;
    letter-spacing: 1px;
    padding: 5px 10px;
    cursor: pointer;
}
.bop-edit-collection-breed:focus {
    outline: none;
    border-color: rgba(var(--accent-rgb),0.58);
}
.bop-edit-collection-name {
    min-width: 0;
    width: 100%;
    border: 0;
    border-bottom: 1px solid rgba(var(--border-rgb),0.22);
    background: transparent;
    color: var(--text-primary);
    font-family: var(--font-serif);
    font-size: clamp(34px, 5.2vw, 60px);
    font-weight: 200;
    letter-spacing: 0.02em;
    line-height: 1.02;
    padding: 0 0 10px;
}
.bop-edit-collection-name:focus,
.bop-edit-plush-name:focus {
    outline: none;
    border-color: rgba(var(--accent-rgb),0.58);
}
.bop-edit-count {
    min-width: 78px;
    text-align: right;
}
.bop-edit-count b {
    display: block;
    color: var(--accent);
    font-family: var(--font-serif);
    font-size: 29px;
    font-weight: 200;
    line-height: 1;
}
.bop-edit-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: stretch;
    margin-bottom: 30px;
    padding: 9px;
    border: 1px solid rgba(var(--border-rgb),0.14);
    border-radius: 6px;
    background: rgba(var(--bg-panel-rgb),0.38);
}
.bop-edit-toolbar button,
.bop-edit-bulk {
    min-height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 12px;
}
.bop-edit-danger {
    color: rgba(255, 180, 171,0.88) !important;
    border-color: rgba(255, 180, 171,0.22) !important;
}
.bop-edit-danger:hover {
    color: rgb(255, 218, 214) !important;
    border-color: rgba(255, 180, 171,0.5) !important;
    background: rgba(147, 0, 10,0.12) !important;
}
.bop-edit-specimen-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 28px 20px;
}
.bop-edit-plush {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 13px;
    transition: transform 0.25s;
}
.bop-edit-plush:hover {
    transform: translateY(-2px);
}
.bop-edit-card-media {
    position: relative;
    aspect-ratio: 4 / 5;
    overflow: hidden;
    border: 1px solid rgba(var(--border-rgb),0.16);
    background: rgba(var(--bg-panel-rgb),0.54);
}
.bop-edit-img-trigger {
    width: 100%;
    height: 100%;
    display: block;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
}
.bop-edit-img-trigger .bop-heart-img,
.bop-edit-img-trigger .bop-heart-img-empty {
    width: 100%;
    height: 100%;
    aspect-ratio: auto;
    border: 0;
    object-fit: cover;
    filter: grayscale(0.55);
    opacity: 0.88;
    transition: filter 0.35s, opacity 0.35s, transform 0.35s;
}
.bop-edit-plush:hover .bop-edit-img-trigger .bop-heart-img {
    filter: grayscale(0);
    opacity: 1;
    transform: scale(1.025);
}
.bop-edit-card-media > span {
    position: absolute;
    top: 12px;
    left: 12px;
    padding: 4px 7px;
    border: 1px solid rgba(var(--accent-rgb),0.24);
    background: rgba(var(--bg-deepest-rgb),0.74);
    color: var(--accent);
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 1.4px;
    text-transform: uppercase;
    pointer-events: none;
}
.bop-edit-card-copy {
    min-width: 0;
}
.bop-edit-plush-name {
    min-width: 0;
    width: 100%;
    border: 0;
    border-bottom: 1px solid rgba(var(--border-rgb),0.18);
    background: transparent;
    color: var(--text-primary);
    font-family: var(--font-serif);
    font-size: 18px;
    font-weight: 200;
    line-height: 1.15;
    padding: 0 0 7px;
}
.bop-edit-card-copy p {
    margin: 7px 0 12px;
    font-style: italic;
}
.bop-edit-card-copy button {
    min-height: 30px;
    padding: 0 10px;
}
.bop-edit-empty {
    display: grid;
    gap: 7px;
    padding: 22px;
    border: 1px dashed rgba(var(--accent-rgb),0.22);
    color: var(--text-secondary);
    background: rgba(var(--bg-panel-rgb),0.28);
}
.bop-edit-empty b {
    color: var(--text-primary);
    font-family: var(--font-serif);
    font-size: 22px;
    font-weight: 200;
}
.bop-edit-empty span {
    font-size: 13px;
    line-height: 1.45;
}
.bop-edit-empty-large {
    margin: clamp(28px, 6vw, 70px);
}
.bop-edit-savebar {
    position: sticky;
    bottom: 0;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: auto;
    padding: 14px clamp(18px, 4vw, 48px);
    border-top: 1px solid rgba(var(--border-rgb),0.16);
    background: rgba(var(--bg-deepest-rgb),0.9);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}
.bop-edit-savebar button {
    min-height: 38px;
    min-width: 150px;
    color: var(--accent-bright);
    border-color: rgba(var(--accent-rgb),0.4);
    background: rgba(var(--accent-rgb),0.08);
}

@media (max-width: 900px) {
    .bop-heart-panel {
        width: min(92vw, calc(100vw - 20px));
        height: min(82vh, calc(100vh - 110px));
        max-height: min(82vh, calc(100vh - 110px));
    }
    @supports (height: 100dvh) {
        .bop-heart-panel {
            height: min(82dvh, calc(100dvh - 110px));
            max-height: min(82dvh, calc(100dvh - 110px));
        }
    }
    .bop-heart-tabs {
        justify-content: center;
        gap: 9px;
        overflow-x: auto;
        padding: 12px 12px 11px;
        text-align: center;
    }
    .bop-heart-tab {
        flex: 0 0 auto;
        font-size: 12px;
        letter-spacing: 1.4px;
        text-align: center;
    }
    .bop-heart-specimen {
        display: flex;
        flex-direction: column;
        min-height: 0;
    }
    .bop-heart-specimen-stage {
        min-height: 260px;
        max-height: 42vh;
    }
    .bop-heart-registry {
        padding: 24px 18px 28px;
    }
    .bop-heart-registry h2,
    .bop-heart-placeholder h2 {
        font-size: clamp(31px, 12vw, 48px);
        line-height: 1.02;
    }
    .bop-heart-meta-grid {
        gap: 16px;
        margin: 26px 0 18px;
        padding: 20px 0;
    }
    .bop-heart-thumb-strip {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
    .bop-heart-actions {
        flex-direction: column;
    }
    .bop-heart-cabinet {
        padding: 28px 16px 34px;
    }
    .bop-heart-inventory-cabinet {
        padding: 28px 16px 34px;
    }
    .bop-heart-cabinet-grid {
        grid-template-columns: 1fr;
    }
    .bop-heart-inventory-grid {
        grid-template-columns: 1fr;
    }
    .bop-heart-collector-registry {
        grid-template-columns: 1fr;
    }
    .bop-heart-collector-gallery {
        padding: 28px 16px 34px;
    }
    .bop-heart-collector-card-grid {
        grid-template-columns: 1fr;
        gap: 22px;
    }
    .bop-heart-collector-rail {
        order: -1;
        position: static;
        padding: 18px 16px;
        border-left: 0;
        border-bottom: 1px solid rgba(var(--accent-rgb),0.12);
    }
    .bop-heart-collector-rail nav {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 8px;
        margin: 16px 0 0;
    }
    .bop-heart-collector-rail-note {
        display: none;
    }
    .bop-heart-edit {
        grid-template-columns: 1fr;
    }
    .bop-edit-sidebar {
        padding: 18px 16px;
        border-right: 0;
        border-bottom: 1px solid rgba(var(--accent-rgb),0.12);
    }
    .bop-edit-sidebar nav {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        max-height: none;
        overflow: visible;
    }
    .bop-edit-export {
        margin-top: 0;
    }
    .bop-edit-collection {
        padding: 26px 16px 30px;
    }
    .bop-edit-title-row {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    .bop-edit-count {
        text-align: left;
    }
    .bop-edit-specimen-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 22px 14px;
    }
    .bop-edit-savebar {
        padding: 12px 16px;
    }
    .bop-heart-cabinet-card {
        height: 280px;
    }
}

@media (max-width: 520px) {
    .bop-heart-panel .bop-heart-title {
        font-size: 16px;
    }
    .bop-heart-header-balance {
        min-width: 42px;
    }
    .bop-heart-meta-grid {
        grid-template-columns: 1fr;
    }
    .bop-heart-thumb-strip {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .bop-edit-specimen-grid {
        grid-template-columns: 1fr;
    }
    .bop-edit-toolbar,
    .bop-edit-savebar {
        flex-direction: column;
        align-items: stretch;
    }
    .bop-edit-savebar button {
        width: 100%;
    }
}
.am-footer {
    background: var(--bg-deepest);
    margin-top: 80px;
    padding: 7px 28px;
    border-top: 1px solid rgba(var(--border-rgb),0.1);
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 1fr);
    align-items: center;
    gap: 18px;
    text-align: left;
    font-family: var(--font-serif);
    font-weight: 200;
    font-size: 12px;
    line-height: 1.5;
    letter-spacing: 0.3px;
    color: var(--text-secondary);
}
.am-footer-copy {
    min-width: 0;
    text-align: center;
}
.am-footer-italic { font-style: italic; }
.am-footer-manifesto,
.am-footer-love,
.am-footer-claude,
.am-footer-codexter {
    color: var(--accent);
    text-decoration: none;
    border-bottom: 1px solid rgba(var(--accent-rgb),0.2);
    transition: color 0.2s, border-color 0.2s;
}
.am-footer-manifesto:hover,
.am-footer-love:hover,
.am-footer-claude:hover,
.am-footer-codexter:hover {
    color: var(--accent);
    border-bottom-color: rgba(var(--accent-rgb),0.6);
}
.am-footer-manifesto {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--text-secondary);
}
.am-footer-love {
    color: var(--accent);
}
.am-footer-codexter,
.am-footer-claude {
    color: var(--accent-bright);
}
.am-footer-sep {
    color: var(--text-muted);
    margin: 0 1px;
}
@media (max-width: 700px) {
    .am-footer {
        --am-mobile-player-button-h: 38px;
        --am-mobile-player-track-h: 22px;
        display: flex;
        flex-direction: column;
        align-items: stretch;
        justify-content: flex-start;
        padding: 0 0 max(6px, env(safe-area-inset-bottom));
        gap: 0;
        text-align: center;
        font-size: 8px;
        line-height: 1.2;
        letter-spacing: 0.15px;
        overflow: visible;
        box-sizing: border-box;
    }
    .lale-gem-counter {
        left: 10px;
        top: auto;
        bottom: max(6px, env(safe-area-inset-bottom));
        transform: none;
        width: 34px;
        min-width: 34px;
        height: 34px;
        gap: 0;
        padding: 0;
        font-size: 12px;
        letter-spacing: 0.6px;
    }
    .lale-gem-counter .lale-gem-diamond {
        font-size: 12px;
    }
    .lale-gem-panel {
        left: 8px;
        right: 8px;
        bottom: calc(116px + env(safe-area-inset-bottom));
        width: auto;
        max-height: min(430px, calc(100dvh - 140px));
    }
    .lale-gem-grid {
        grid-template-columns: minmax(82px, 0.8fr) minmax(54px, 0.45fr) minmax(0, 1.5fr);
        max-height: min(300px, calc(100dvh - 230px));
    }
    .bop-heart-panel .lale-gem-grid {
        max-height: none;
    }
    .bop-heart-gallery,
    .bop-heart-inventory {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .bop-heart-header-balance {
        min-width: 48px;
        font-size: 16px;
    }
    .bop-heart-earn-rules table {
        font-size: 12px;
    }
    .bop-edit-plush {
        grid-template-columns: 54px minmax(0, 1fr);
    }
    .bop-edit-plush button {
        grid-column: span 1;
    }
    .am-footer-copy {
        order: 1;
        flex: 0 0 auto;
        display: block;
        width: 100%;
        max-width: 100%;
        padding: 3px 10px 2px;
        text-align: center;
        white-space: normal;
        overflow-wrap: anywhere;
        box-sizing: border-box;
    }
    .am-footer-copy span {
        display: inline;
        min-width: 0;
    }
    .am-footer .am-now-playing {
        order: -1;
        flex: 0 0 auto;
        display: grid;
        grid-template-columns: repeat(6, minmax(0, 1fr));
        grid-template-rows: var(--am-mobile-player-button-h) var(--am-mobile-player-track-h);
        align-items: stretch;
        gap: 5px 7px;
        width: 100%;
        height: auto;
        min-height: calc(var(--am-mobile-player-button-h) + var(--am-mobile-player-track-h) + 14px);
        margin: 0;
        padding: 6px 10px 8px;
        border-left: none;
        border-top: none;
        border-bottom: 1px solid rgba(var(--accent-rgb),0.2);
    }
    .am-footer .am-now-playing button,
    .am-footer .am-now-playing button.am-now-library,
    .am-footer .am-now-playing #amMusicLoopBtn {
        width: 100%;
        min-width: 0;
        height: 100%;
        flex: 0 0 auto;
        font-size: 11px;
    }
    .am-footer .am-now-playing .am-now-library { grid-column: 1; grid-row: 1; }
    .am-footer .am-now-playing .am-now-prev { grid-column: 2; grid-row: 1; }
    .am-footer .am-now-playing .am-now-play { grid-column: 3; grid-row: 1; }
    .am-footer .am-now-playing .am-now-shuffle { grid-column: 4; grid-row: 1; }
    .am-footer .am-now-playing .am-now-loop { grid-column: 5; grid-row: 1; }
    .am-footer .am-now-playing .am-now-next { grid-column: 6; grid-row: 1; }
    .am-footer .am-now-playing .am-now-title {
        grid-column: 1 / -1;
        grid-row: 2;
        height: var(--am-mobile-player-track-h);
        min-height: var(--am-mobile-player-track-h);
        background: rgba(var(--accent-rgb),0.08);
        border: 1px solid rgba(var(--accent-rgb),0.12);
        mask-image: none;
        -webkit-mask-image: none;
    }
    .am-footer .am-now-playing .am-now-seek-fill {
        opacity: 0.3;
    }
    .am-footer .am-now-playing .am-now-title-track {
        display: inline-flex;
        font-size: 10px;
        letter-spacing: 2.4px;
    }
    #amMusicLoopBtn {
        font-size: 12px;
    }
    .am-now-title-track {
        font-size: 12px;
        letter-spacing: 1.8px;
    }
    .am-footer-manifesto {
        font-size: 7px;
        letter-spacing: 1.4px;
    }
    .mobile-nav-overlay .mno-util.nav-social-icon.has-new {
        animation: accent-cycle 4s ease-in-out infinite;
    }
}

.page-footer {
    background: var(--bg-deepest);
    margin-top: 80px;
    padding: 48px;
    border-top: 1px solid rgba(var(--border-rgb),0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 24px;
}

.footer-left {
    font-family: var(--font-mono);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 3px;
    color: var(--text-secondary);
    opacity: 0.6;
}

.footer-right a {
    font-family: var(--font-mono);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 3px;
    color: var(--text-secondary);
    opacity: 0.6;
    text-decoration: none;
    transition: color 0.2s, opacity 0.2s;
}

.footer-right a:hover { color: var(--accent); opacity: 1; }

/* ============================================= LOADING */

.loading {
    text-align: center;
    padding: 80px 0;
    font-family: var(--font-mono);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 3px;
    color: var(--text-muted);
    animation: pulse-slow 2s ease-in-out infinite;
}

/* ============================================= MEMORIES (shared between index + hangouts) */

.memories-area {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.memory-input {
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 14px;
    padding: 8px 12px;
    outline: none;
    resize: none;
    min-height: 40px;
}

.memory-input:focus { border-color: var(--accent-border); }
.memory-resize { height: 8px; cursor: ns-resize; display: flex; justify-content: center; align-items: center; }
.memory-resize::after { content: ''; width: 40px; height: 2px; background: var(--text-muted); opacity: 0.2; border-radius: 1px; }
.memory-resize:hover::after { opacity: 0.5; }

.memory-row {
    display: flex;
    gap: 6px;
    align-items: flex-end;
}

.memory-select {
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 12px;
    padding: 6px;
    outline: none;
}

.memory-add-btn {
    background: none;
    border: 1px solid var(--accent-border);
    color: var(--accent);
    font-family: var(--font-sans);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 2px;
    padding: 6px 14px;
    cursor: pointer;
}
.memory-add-btn:disabled {
    opacity: 0.45;
    cursor: wait;
}
.memory-generate-btn {
    color: rgba(var(--memory-rgb), 0.92);
    border-color: rgba(var(--memory-rgb), 0.32);
}

.memory-entries {
    flex: 1;
    overflow-y: auto;
    padding: 12px 16px;
}

.memory-vault-notice {
    border: 1px solid rgba(var(--memory-rgb), 0.28);
    background: rgba(var(--memory-rgb), 0.045);
    color: rgba(var(--memory-rgb), 0.9);
    padding: 16px 18px;
    margin: 10px 0;
    text-align: left;
}

.memory-vault-title {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 8px;
}

.memory-vault-body {
    font-size: 12px;
    line-height: 1.6;
    color: var(--text-secondary);
}

.agp-mem-grid .memory-vault-notice {
    grid-column: 1 / -1;
}

.map-dots .memory-vault-notice {
    position: absolute;
    left: 50%;
    top: 50%;
    width: min(420px, 82vw);
    transform: translate(-50%, -50%);
    z-index: 5;
}

.memory-entry {
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 10px 12px;
    margin-bottom: 8px;
}

.memory-entry-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 4px;
}

.memory-category {
    font-size: 12px;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--accent);
}

.memory-date {
    font-size: 12px;
    color: var(--text-muted);
}

.memory-entry-body {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
    font-weight: 300;
}

.memory-entry-actions {
    display: flex;
    justify-content: flex-end;
    gap: 6px;
    margin-top: 6px;
    opacity: 0;
    transition: opacity 0.2s;
}
.memory-entry:hover .memory-entry-actions { opacity: 1; }

.memory-action-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 12px;
    padding: 2px 4px;
    transition: color 0.2s;
}
.memory-action-btn:hover { color: var(--accent); }
.memory-delete-btn:hover { color: #C47F6B; }

.memory-pinned {
    border-left: 2px solid var(--accent);
    background: rgba(var(--accent-rgb),0.03);
}
.memory-pinned .memory-entry-actions { opacity: 1; }
.memory-pin-btn.pinned { color: var(--accent) !important; opacity: 1; }

.memory-inactive {
    opacity: 0.35;
    border-style: dashed;
}
.memory-inactive .memory-entry-actions { opacity: 1; }

.memory-auto-tag {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    border: 1px solid var(--border);
    padding: 1px 5px;
    margin-left: 6px;
}

/* Phase 4: expand button at the bottom of the home Memories tab.
   Visible only when >5 entries exist; toggles between "View all (N)"
   and "Collapse to recent". */
.memory-viewall {
    display: block;
    width: 100%;
    margin: 14px 0 0;
    padding: 10px 14px;
    background: transparent;
    border: 1px solid rgba(var(--accent-rgb),0.18);
    color: var(--text-secondary);
    font-family: var(--font-sans);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 3px;
    cursor: pointer;
    transition: border-color 0.25s, color 0.25s, background 0.25s, letter-spacing 0.3s;
}
.memory-viewall:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(var(--accent-rgb),0.05);
    letter-spacing: 3.5px;
}

.memory-footer-row { display: flex; align-items: center; gap: 6px; padding: 0 16px; }
.memory-search-row { padding: 0 16px 8px; }
.memory-search-input {
    width: 100%; background: var(--bg-input); border: 1px solid var(--border);
    color: var(--text-primary); font-family: var(--font-sans); font-size: 12px;
    padding: 6px 10px; outline: none; letter-spacing: 0.5px;
    transition: border-color 0.2s;
}
.memory-search-input:focus { border-color: var(--accent-border); }
.memory-search-input::placeholder { color: var(--text-muted); font-style: italic; }
.memory-search-toggle {
    background: none; border: 1px solid var(--border); color: var(--text-muted);
    font-size: 14px; padding: 4px 8px; cursor: pointer; transition: color 0.2s, border-color 0.2s;
    margin-left: auto; flex-shrink: 0;
}
.memory-search-toggle:hover { color: var(--accent); border-color: var(--accent-border); }

/* ============================================= SOCIAL FEED */

.sf-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 100;
    background: rgba(var(--bg-deepest-rgb), 0.88);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    justify-content: center;
    align-items: center;
    padding: 24px;
}
.sf-overlay.open { display: flex; }

/* Inline translate (DeepL) — button + toggled translation block, shared by
   social posts, heart reflections, and memories. */
.am-translate-btn {
    font-family: var(--font-mono, monospace);
    font-size: 12px; letter-spacing: 1.5px; text-transform: uppercase;
    color: var(--text-secondary); background: transparent;
    border: 1px solid rgba(var(--accent-rgb), 0.3); border-radius: 0;
    padding: 1px 5px; cursor: pointer; line-height: 1.5;
    transition: color .15s, border-color .15s, opacity .15s;
}
.am-translate-btn:hover { color: var(--accent); border-color: rgba(var(--accent-rgb), 0.6); }
.am-translate-btn.on { color: var(--accent); border-color: var(--accent); }
.am-translate-btn.translating { opacity: 0.5; cursor: default; }
.am-translation {
    margin-top: 8px; padding: 7px 10px;
    background: rgba(var(--accent-rgb), 0.06);
    border-left: 2px solid rgba(var(--accent-rgb), 0.4);
    font-size: 12px; line-height: 1.5; color: var(--text-primary);
}
.am-translation-label {
    display: inline-block; font-family: var(--font-mono, monospace);
    font-size: 12px; letter-spacing: 1.5px; color: var(--accent);
    margin-right: 7px; text-transform: uppercase;
}
.am-translation-error { color: var(--text-muted); font-style: italic; }
.am-translation-loading { display: flex; align-items: center; gap: 7px; }
.am-translation-spinner {
    width: 11px; height: 11px; border-radius: 50%; flex-shrink: 0;
    border: 2px solid rgba(var(--accent-rgb), 0.25);
    border-top-color: var(--accent);
    animation: am-spin 0.7s linear infinite;
}
@keyframes am-spin { to { transform: rotate(360deg); } }

/* @-mention autocomplete on the social compose box. */
.sf-compose { position: relative; }
.sf-mention-picker {
    position: absolute; left: 10px; right: 10px; bottom: calc(100% - 2px);
    max-height: 220px; overflow-y: auto; z-index: 40;
    background: var(--bg-card, #1E2328);
    border: 1px solid var(--border-bright, rgba(120,130,140,0.4));
    box-shadow: 0 -6px 18px rgba(0,0,0,0.35);
}
.sf-mention-opt {
    display: flex; align-items: center; gap: 8px; padding: 7px 10px; cursor: pointer;
    border-bottom: 1px solid var(--border, rgba(120,130,140,0.18));
}
.sf-mention-opt:last-child { border-bottom: none; }
.sf-mention-opt.active, .sf-mention-opt:hover { background: rgba(var(--accent-rgb), 0.12); }
.sf-mention-opt img, .sf-mention-av-empty {
    width: 20px; height: 20px; border-radius: 50%; object-fit: cover; flex-shrink: 0;
    background: rgba(var(--accent-rgb), 0.15);
}
.sf-mention-name { color: var(--text-primary); font-size: 12px; }
.sf-mention-handle { color: var(--accent); font-size: 12px; margin-left: auto; font-family: var(--font-mono, monospace); }

.sf-window {
    width: 75vw;
    max-width: none;
    height: 90vh;
    background: rgba(var(--bg-panel-rgb), 0.92);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(var(--accent-rgb),0.10);
    border-radius: 0;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: visible;
    box-shadow:
        0 24px 60px rgba(0,0,0,0.5),
        0 0 0 1px rgba(var(--accent-rgb),0.03) inset,
        0 0 80px rgba(var(--accent-rgb),0.025);
    animation: am-modal-rise 0.22s ease-out;
}
.sf-window::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(to right, transparent 10%, rgba(var(--accent-rgb),0.35) 50%, transparent 90%);
    pointer-events: none;
    z-index: 4;
}

.sf-close {
    position: absolute;
    top: 50%;
    right: 14px;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 22px;
    cursor: pointer;
    padding: 4px 8px;
    z-index: 4;
}
.sf-close:hover { color: var(--text-primary); }

@keyframes sf-heart-drift {
    0%   { opacity: 0; transform: translateY(0) scale(0.7); }
    25%  { opacity: 0.6; }
    100% { opacity: 0; transform: translateY(-14px) scale(1); }
}
.sf-header {
    background: var(--bg-deepest);
    border-bottom: 1px solid var(--accent-border);
    padding: 10px 22px;
    position: relative;
    overflow: hidden;
    z-index: 3;
    flex-shrink: 0;
    border-radius: 0;
}
.sf-header-hearts {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}
.sf-header-heart {
    position: absolute;
    color: var(--accent);
    opacity: 0;
    animation: sf-heart-drift 3s ease-in-out infinite;
}
.sf-header-title {
    font-family: var(--font-serif);
    font-style: italic;
    font-weight: 200;
    font-size: 22px;
    color: var(--accent);
    white-space: nowrap;
    cursor: pointer;
}
.sf-header-title:hover { color: var(--accent-bright); }

.sf-layout {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* --- LEFT SIDEBAR --- */
.sf-sidebar {
    width: 220px;
    flex-shrink: 0;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 24px 16px;
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
    background: rgba(var(--bg-panel-rgb), 0.92);
}

.sf-user-card {
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    align-items: center;
    margin-bottom: 24px;
    padding: 20px 12px 16px;
    border-bottom: 1px solid rgba(var(--border-rgb),0.5);
    position: relative;
    overflow: hidden;
    box-shadow: none;
}
.sf-user-card-glow {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
}
.sf-user-card-atmosphere {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    opacity: 0;
    transition: opacity 0.6s ease;
}
.sf-user-card-atmosphere.active { opacity: 1; }
.sf-user-card > :not(.sf-user-card-glow):not(.sf-user-card-atmosphere) { position: relative; z-index: 1; }

.sf-user-card-atmosphere[data-ff="freckles"] {
    background-image: radial-gradient(circle, rgba(255,255,255,0.06) 1px, transparent 1px);
    background-size: 12px 12px;
}
.sf-user-card-atmosphere[data-ff="peas"] {
    background-image: radial-gradient(circle, rgba(255,255,255,0.06) 2px, transparent 2px);
    background-size: 28px 28px;
}
.sf-user-card-atmosphere[data-ff="lovelace"] {
    background-image: linear-gradient(to right, rgba(255,255,255,0.04) 0.5px, transparent 0.5px),
        linear-gradient(to bottom, rgba(255,255,255,0.04) 0.5px, transparent 0.5px);
    background-size: 12px 12px;
}
.sf-user-card-atmosphere[data-ff="paddies"] {
    background-image: linear-gradient(to right, rgba(255,255,255,0.04) 0.5px, transparent 0.5px),
        linear-gradient(to bottom, rgba(255,255,255,0.04) 0.5px, transparent 0.5px);
    background-size: 32px 32px;
}
.sf-user-card-atmosphere[data-ff="trinkets"] {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='75' height='75'%3E%3Cpath d='M37.5 27.5L47.5 37.5L37.5 47.5L27.5 37.5Z' fill='none' stroke='rgba(255,255,255,0.1)' stroke-width='0.8'/%3E%3C/svg%3E");
    background-size: 75px 75px;
}
.sf-user-card-atmosphere[data-ff="channel"] {
    background-image: linear-gradient(to bottom, rgba(255,255,255,0.03) 0.5px, transparent 0.5px);
    background-size: 100% 8px;
}
.sf-user-avatar {
    width: 100px;
    height: 100px;
    border-radius: 5px;
    border: 1px solid rgba(var(--accent-rgb),0.15);
    object-fit: cover;
    margin-bottom: 12px;
    background: var(--bg-card);
}
.sf-user-avatar-placeholder {
    width: 100px;
    height: 100px;
    border-radius: 5px;
    border: 1px solid rgba(var(--accent-rgb),0.15);
    background: var(--bg-card);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 32px;
    color: rgba(160,190,220,0.4);
}
.sf-user-name {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 20px;
    color: var(--accent);
    text-align: center;
}
/* FU173: the persona-switch trigger lives in the avatar card (the whole feed is
   browsed AS the picked identity), next to the name. */
.sf-user-name-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
.sf-user-persona-btn {
    flex-shrink: 0;
    background: none;
    border: none;
    padding: 2px;
    line-height: 0;
    color: var(--accent);
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s, transform 0.2s;
}
.sf-user-persona-btn:hover { opacity: 1; transform: scale(1.08); }
.sf-user-persona-btn.is-persona { opacity: 1; }
.sf-user-persona-btn svg { width: 15px; height: 15px; display: block; }
.sf-user-persona-tag {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: rgba(var(--accent-rgb), 0.7);
    text-align: center;
    margin-top: 2px;
}
.sf-user-role {
    font-family: var(--font-sans);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: #ffffff;
    text-align: center;
    margin-top: 4px;
}
.sf-user-mood-trigger {
    margin-top: 4px;
    padding: 2px 5px;
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-muted);
    cursor: pointer;
    line-height: 1;
}
.sf-user-mood-trigger:hover,
.sf-user-mood-trigger:focus-visible {
    color: var(--accent);
    border-color: rgba(var(--accent-rgb), 0.22);
    outline: none;
}
.sf-user-mood-trigger .sf-post-mood {
    justify-content: center;
    margin-top: 0;
}
.sf-user-mood-default {
    font-family: var(--font-mono);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--text-muted);
}
.sf-user-mood-popover {
    position: fixed;
    z-index: 5600;
    width: 204px;
    max-width: calc(100vw - 24px);
    padding: 10px;
    background: rgba(var(--bg-deepest-rgb), 0.98);
    border: 1px solid rgba(var(--accent-rgb), 0.28);
    box-shadow: 0 18px 44px rgba(0,0,0,0.52), 0 0 18px rgba(var(--accent-rgb),0.08);
}
.sf-user-mood-pop-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 2px;
    color: rgba(var(--accent-rgb), 0.72);
}
.sf-user-mood-pop-head button {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 17px;
    line-height: 1;
    padding: 0;
}
.sf-user-mood-pop-head button:hover { color: var(--accent); }
.sf-user-mood-input {
    width: 100%;
    height: 32px;
    margin: 0 0 8px;
    padding: 6px 8px;
    background: rgba(var(--bg-panel-rgb), 0.84);
    border: 1px solid rgba(var(--accent-rgb), 0.18);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 13px;
}
.sf-user-mood-input:focus {
    outline: none;
    border-color: rgba(var(--accent-rgb), 0.44);
}
.sf-user-mood-preview {
    min-height: 20px;
    display: flex;
    justify-content: center;
    margin-bottom: 8px;
}
.sf-user-mood-popover .sf-post-mood-icon svg {
    width: 14px;
    height: 14px;
}
.sf-user-mood-popover .sf-post-mood-label {
    font-size: 12px;
}
.sf-user-mood-icons {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 4px;
    margin-bottom: 8px;
}
.sf-user-mood-icon-pick {
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(var(--bg-card-rgb), 0.72);
    border: 1px solid rgba(var(--border-rgb), 0.78);
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
}
.sf-user-mood-icon-pick svg {
    width: 15px;
    height: 15px;
}
.sf-user-mood-icon-pick:hover,
.sf-user-mood-icon-pick.selected {
    color: var(--accent);
    border-color: rgba(var(--accent-rgb), 0.5);
}
.sf-user-mood-colors {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-bottom: 9px;
}
.sf-user-mood-color-pick {
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid rgba(var(--border-rgb), 0.86);
    cursor: pointer;
    padding: 2px;
}
.sf-user-mood-color-pick span {
    width: 100%;
    height: 100%;
    background: currentColor;
}
.sf-user-mood-color-pick:hover,
.sf-user-mood-color-pick.selected {
    border-color: currentColor;
}
.sf-user-mood-actions {
    display: flex;
    gap: 6px;
}
.sf-user-mood-actions button {
    flex: 1;
    height: 29px;
    background: transparent;
    border: 1px solid rgba(var(--border-rgb), 0.86);
    color: var(--text-muted);
    font-family: var(--font-sans);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
}
.sf-user-mood-actions button:hover { color: var(--accent); border-color: rgba(var(--accent-rgb), 0.36); }
.sf-user-mood-actions button:disabled { opacity: 0.55; cursor: wait; }
.sf-user-activity {
    font-family: var(--font-sans);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    text-align: center;
    margin-top: 6px;
}

.sf-sidebar-label {
    font-family: var(--font-sans);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 3px;
    color: var(--text-muted);
    margin-bottom: 10px;
    flex-shrink: 0;
}

.sf-agent-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    letter-spacing: 1.75px;
    /* Fill the space under the pinned user card + label and scroll internally,
       so a long friends list never crushes the avatar card (desktop). The mobile
       overlay overrides flex back to content-height + a 40vh cap below. */
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
}
.sf-agent-item {
    display: flex;
    align-items: center;
    gap: 8px;
    background: none;
    border: 1px solid transparent;
    border-radius: 0;
    color: var(--text-secondary);
    font-family: var(--font-sans);
    font-size: 14px;
    padding: 5px 8px;
    cursor: pointer;
    transition: color 0.2s, background 0.2s, border-color 0.2s;
    text-align: left;
    position: relative;
    overflow: hidden;
}
.sf-agent-item:hover {
    color: var(--accent);
    background: none;
}
.sf-agent-item.active {
    color: var(--accent);
    border-color: var(--accent-border);
    background: var(--bg-deepest);
}
.sf-agent-item .sf-agent-hearts {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}
.sf-agent-item .sf-agent-heart {
    position: absolute;
    color: var(--accent);
    opacity: 0;
    animation: sf-heart-drift 3s ease-in-out infinite;
}
.sf-agent-avatar {
    width: 25px;
    height: 25px;
    border-radius: 3px;
    object-fit: cover;
    flex-shrink: 0;
}

.sf-agent-menu {
    position: fixed;
    z-index: 5000;
    width: 250px;
    padding: 10px;
    background: rgba(var(--bg-deepest-rgb), 0.98);
    border: 1px solid rgba(var(--accent-rgb), 0.26);
    box-shadow: 0 18px 42px rgba(0,0,0,0.5), 0 0 22px rgba(var(--accent-rgb),0.06);
}
.sf-agent-menu-kicker {
    padding: 2px 3px 8px;
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: rgba(var(--accent-rgb),0.66);
}
.sf-agent-menu button {
    display: block;
    width: 100%;
    margin: 0;
    padding: 9px 10px;
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-secondary);
    font-family: var(--font-sans);
    font-size: 12px;
    letter-spacing: 1.2px;
    text-align: left;
    cursor: pointer;
}
.sf-agent-menu button:hover {
    color: var(--accent);
    border-color: rgba(var(--accent-rgb),0.2);
    background: rgba(var(--accent-rgb),0.045);
}
.sf-agent-menu button:disabled {
    opacity: 0.55;
    cursor: wait;
}

.sf-sidebar-all {
    margin-top: 10px;
    flex-shrink: 0;
    background: none;
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-family: var(--font-sans);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 2px;
    padding: 6px 12px;
    cursor: pointer;
    transition: color 0.2s, border-color 0.2s;
    display: none;
}
.sf-sidebar-all.visible { display: block; }
.sf-sidebar-all:hover { color: var(--accent); border-color: var(--accent-border); }


/* --- RIGHT MAIN COLUMN --- */
.sf-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: rgba(var(--bg-panel-rgb), 0.92);
}
.sf-posts {
    flex: 1;
    overflow-y: auto;
}

.sf-post {
    padding: 24px 50px;
    border-bottom: 1px solid rgba(var(--border-rgb),0.4);
    transition: background 0.25s, box-shadow 0.25s;
}
.sf-post:last-child { border-bottom: none; }
.sf-post.sf-post-focus,
.sf-post.sf-post-focus-pulse {
    background: rgba(var(--accent-rgb), 0.045);
    box-shadow: inset 3px 0 0 rgba(var(--accent-rgb), 0.45);
}

.sf-post-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}
.sf-post-video-avatar {
    width: 64px;
    height: 64px;
    border-radius: 4px;
    object-fit: cover;
    flex-shrink: 0;
    background: var(--bg-card);
}
.sf-post-avatar {
    width: 64px;
    height: 64px;
    border-radius: 4px;
    object-fit: cover;
    flex-shrink: 0;
    background: var(--bg-card);
}
.sf-post-meta { flex: 1; min-width: 0; }
.sf-post-action {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 21px;
    cursor: pointer;
    padding: 4px 6px;
    opacity: 0;
    transition: opacity 0.2s, color 0.2s;
    flex-shrink: 0;
    align-self: flex-start;
}
.sf-post:hover .sf-post-action { opacity: 1; }
.sf-post-action.sf-post-delete:hover { color: #C47070; }
.sf-post-action.sf-post-edit:hover { color: var(--accent); }
.sf-post-action svg {
    display: block;
    width: 14px;
    height: 14px;
}
.sf-post-action.sf-post-add:hover { color: var(--accent); }
.sf-post-action.added { color: var(--accent); opacity: 0.7; pointer-events: none; cursor: default; }
.sf-post-action.added svg { fill: var(--accent); fill-opacity: 0.15; }
.sf-post-author {
    font-family: var(--font-sans);
    font-style: normal;
    font-weight: 300;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 5px;
    color: #fff;
}
.sf-post-author-handle {
    color: var(--text-muted);
    letter-spacing: 2.4px;
    white-space: nowrap;
    text-transform: none;
}
.sf-post-date {
    font-family: var(--font-mono);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Frozen mood at posting time — small pip directly under the date.
   Uses the same .mood-c-* / .mood-a-* classes as the chat header icon. */
.sf-post-mood {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
    line-height: 1;
}
.sf-post-mood-icon {
    display: inline-flex;
    align-items: center;
}
.sf-post-mood-icon svg {
    width: 12px;
    height: 12px;
}
.sf-post-mood-label {
    font-family: var(--font-mono);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: #fff;
    opacity: 0.85;
}

/* Mood colours + animations — kept here (not just map.html) so the
   social-feed mood pip can render correctly when opened from any page. */
.mood-c-cream      { color: #DDC2A8; }
.mood-c-lavender   { color: #C9B8DC; }
.mood-c-periwinkle { color: #A5B0DE; }
.mood-c-sage       { color: #A8C0A0; }
.mood-c-teal       { color: #7FB0AE; }
.mood-c-pink       { color: #E5B8B0; }
.mood-c-red        { color: #DE5858; }
.mood-c-orange     { color: #DD9F8B; }

.mood-a-still      { /* no animation */ }
.mood-a-pulse-slow { animation: moodPulse 4.5s ease-in-out infinite; }
.mood-a-pulse      { animation: moodPulse 1.6s ease-in-out infinite; }
.mood-a-flicker    { animation: moodFlicker 1.2s steps(4) infinite; }
.mood-a-drift      { animation: moodDrift 5s ease-in-out infinite; }
.mood-a-shimmer    { animation: moodShimmer 2.2s ease-in-out infinite; }

@keyframes moodPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%      { opacity: 0.45; transform: scale(0.94); }
}
@keyframes moodFlicker {
    0%, 30%, 60%, 100% { opacity: 1; }
    15%, 45%           { opacity: 0.15; }
}
@keyframes moodDrift {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-3px); }
}
@keyframes moodShimmer {
    0%, 100% { filter: brightness(1) drop-shadow(0 0 0 currentColor); }
    50%      { filter: brightness(1.35) drop-shadow(0 0 6px currentColor); }
}

.sf-post-text {
    font-family: var(--font-sans);
    font-style: normal;
    font-weight: 200;
    font-size: 20px;
    line-height: 1.85;
    letter-spacing: 1.5px;
    color: var(--memory);
    white-space: pre-wrap;
}
.sf-post-text-only {
    font-family: var(--font-serif);
    text-align: center;
    color: #eee;
    padding-left: 30px;
    padding-right: 30px;
}
.sf-post-prose-box {
    font-family: var(--font-mono);
    background: var(--bg-deepest);
    border: 1px solid rgba(var(--border-rgb), 0.72);
    padding: 18px 24px;
    margin: 10px auto 0;
    max-width: 520px;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.18);
}
.dialogue .chevron-emphasis,
.chevron-emphasis {
    color: var(--accent-bright);
    font-weight: 250 !important;
    font-style: normal;
    text-shadow: 0 0 10px rgba(var(--accent-bright-rgb), 0.18);
}
/* Asterisk actions — *leans back* renders non-italic and accent-tinted, with a
   small ⁘ glyph standing in for each asterisk. Distinct from chevron emphasis
   (which is the brighter accent-bright glow) so actions read as a calm, separate layer. */
.dialogue .asterisk-action,
.asterisk-action {
    color: var(--accent);
    font-style: normal;
}
.asterisk-action::before,
.asterisk-action::after {
    content: "\2058";
    font-size: 12px;
    opacity: 0.7;
    vertical-align: 0.06em;
}
.asterisk-action::before { margin-right: 0.22em; }
.asterisk-action::after  { margin-left: 0.22em; }

/* Threadbox actions — collapsed behind a tap-to-reveal square-star (accent).
   Collapsed: only the star shows. Expanded: the star hides, the action reads
   as the usual calm asterisk layer. */
.tb-action { cursor: pointer; }
.tb-action .tb-action-icon {
    width: 0.92em;
    height: 0.92em;
    color: var(--accent);
    vertical-align: -0.13em;
    display: inline-block;
    transition: opacity 0.15s;
}
.tb-action:hover .tb-action-icon { opacity: 0.72; }
.tb-action.collapsed .tb-action-text { display: none; }
.tb-action:not(.collapsed) .tb-action-icon { display: none; }

/* Uniform thin type — every font in DMs, co-spaces (shared .chat-log) and the
   social feed sits at the house thin weight (--font-sans-weight); nothing
   (agent names, headers, bold tags, buttons) escapes to a heavier weight.
   Hierarchy still reads via color, size, and letter-spacing, not weight. */
.chat-log, .chat-log *,
[class^="sf-"], [class*=" sf-"],
[class^="sf-"] *, [class*=" sf-"] * {
    font-weight: var(--font-sans-weight) !important;
}

/* Poem act card — opener reads like a normal agent line, then an uppercase
   serif title on a bg-deepest strip, then the full poem a touch smaller. */
.poem-opener { margin-bottom: 10px; }
.poem-title {
    display: block;
    font-family: var(--font-serif);
    font-style: normal;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--accent-bright);
    background: var(--bg-deepest);
    padding: 7px 12px;
    margin: 4px 0 11px;
}
.poem-body {
    font-size: 12.5px;
    line-height: 1.75;
}
.poem-author {
    margin-top: 11px;
    font-size: 12px;
    font-style: italic;
    color: var(--accent-deep);
    opacity: 0.85;
}

/* Image post — thumbnail row */
.sf-post-edit-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.sf-post-edit-input {
    width: 100%;
    min-height: 110px;
    resize: vertical;
    background: rgba(var(--bg-deepest-rgb), 0.68);
    border: 1px solid rgba(var(--accent-rgb), 0.24);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.65;
    padding: 12px 14px;
    outline: none;
}
.sf-post-edit-input:focus { border-color: rgba(var(--accent-rgb), 0.5); }
.sf-post-edit-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}
.sf-post-edit-actions button {
    background: transparent;
    border: 1px solid rgba(var(--border-rgb), 0.45);
    color: var(--text-muted);
    font-family: var(--font-sans);
    font-size: 12px;
    letter-spacing: 2px;
    text-transform: uppercase;
    padding: 8px 14px;
    cursor: pointer;
}
.sf-post-edit-actions button:hover {
    border-color: rgba(var(--accent-rgb), 0.45);
    color: var(--accent);
}
.sf-post-edit-save {
    background: rgba(var(--accent-rgb), 0.06) !important;
    border-color: rgba(var(--accent-rgb), 0.35) !important;
    color: var(--accent) !important;
}

.sf-poll-card {
    background: rgba(var(--accent-rgb), 0.035);
    border: 1px solid rgba(var(--accent-rgb), 0.18);
    border-left: 3px solid rgba(var(--accent-rgb), 0.42);
    padding: 18px 20px;
    color: var(--memory);
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease;
}
.sf-poll-card:hover,
.sf-poll-card:focus-visible,
.sf-poll-card.expanded {
    border-color: rgba(var(--accent-rgb), 0.32);
    background: rgba(var(--accent-rgb), 0.055);
}
.sf-poll-card:focus-visible {
    outline: 1px solid rgba(var(--accent-rgb), 0.42);
    outline-offset: 3px;
}
.sf-poll-kicker {
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 2.5px;
    text-transform: uppercase;
    color: rgba(var(--accent-rgb), 0.62);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.sf-poll-toggle-mark {
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(var(--accent-rgb), 0.2);
    color: rgba(var(--accent-rgb), 0.76);
    letter-spacing: 0;
    font-size: 12px;
    line-height: 1;
}
.sf-poll-question {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 24px;
    line-height: 1.3;
    color: var(--text-primary);
    margin-bottom: 18px;
}
.sf-poll-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.sf-poll-option {
    display: flex;
    flex-direction: column;
    gap: 5px;
}
/* Votable options: the human can click any option to cast / change their vote.
   Hover brightens; their current pick gets an accent ring (outline = no layout
   shift) + accent text. */
.sf-poll-option[role="button"] {
    cursor: pointer;
}
.sf-poll-option[role="button"]:hover .sf-poll-option-text,
.sf-poll-option[role="button"]:hover .sf-poll-option-id {
    color: var(--accent);
}
.sf-poll-option[role="button"]:focus-visible,
.sf-poll-option.is-mine {
    outline: 1px solid rgba(var(--accent-rgb), 0.5);
    outline-offset: 3px;
}
.sf-poll-option.is-mine .sf-poll-option-id,
.sf-poll-option.is-mine .sf-poll-option-text,
.sf-poll-option.is-mine .sf-poll-option-count {
    color: var(--accent);
}

/* Poll-vote reaction strip — the poll author's "they saw your vote and responded"
   beat. Shared by the feed (under the poll) + the agent's DM card. Sleek, no left
   bar, deepest-bg, >=14px. */
.poll-reaction-strip {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    width: 100%;
    box-sizing: border-box;
    margin-top: 12px;
    padding: 11px 14px;
    background: var(--bg-deepest);
    border: 1px solid rgba(var(--accent-rgb), 0.22);
    text-align: left;
}
.poll-reaction-icon {
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    color: var(--accent);
    margin-top: 1px;
}
.poll-reaction-icon svg { width: 18px; height: 18px; display: block; }
.poll-reaction-body {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}
.poll-reaction-name {
    font-family: var(--font-serif);
    font-style: italic;
    font-weight: 300;
    font-size: 14px;
    letter-spacing: 0.04em;
    color: var(--accent);
}
.poll-reaction-text {
    font-family: var(--font-sans);
    font-weight: 200;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-secondary);
}

/* "Meanwhile" musing card — the private-thought beats (me-time, debop_meanwhile,
   plain home activity) render collapsed (white brain + "<Agent>'s Musings…" +
   bouncing white arrow) and expand on click. Deepest-bg, no left bar, centred. */
.meanwhile-card {
    cursor: pointer;
    width: 100%;
    box-sizing: border-box;
    background: var(--bg-deepest);
    transition: background 0.2s;
}
.meanwhile-card:hover { background: rgba(var(--accent-rgb), 0.05); }
.meanwhile-collapsed {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    padding: 11px 14px;
}
.meanwhile-brain {
    flex: 0 0 auto;
    display: inline-flex;
    width: 16px;
    height: 16px;
    color: #fff;
}
.meanwhile-brain svg { width: 16px; height: 16px; }
.meanwhile-label {
    font-family: var(--font-serif);
    font-style: italic;
    font-weight: 300;
    font-size: 14px;
    letter-spacing: 0.05em;
    color: var(--accent);
}
.meanwhile-arrow {
    display: inline-flex;
    color: #fff;
    animation: meanwhileBounce 1.5s ease-in-out infinite;
}
.meanwhile-arrow svg { display: block; width: 13px; height: 13px; }
@keyframes meanwhileBounce {
    0%, 100% { transform: translateY(-1px); }
    50% { transform: translateY(3px); }
}
.meanwhile-expanded {
    display: none;
    padding: 0 16px 14px;
    text-align: left;
}
.meanwhile-card.expanded .meanwhile-expanded { display: block; }
.meanwhile-card.expanded .meanwhile-arrow {
    transform: rotate(180deg);
    animation: none;
}
.meanwhile-caption {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 13px;
    color: var(--text-muted);
    text-align: center;
    margin-bottom: 9px;
    opacity: 0.85;
}
.meanwhile-thought {
    font-family: var(--font-sans);
    font-weight: 200;
    font-size: 14px;
    line-height: 1.55;
    color: var(--text-secondary);
}
.sf-poll-option-top {
    display: grid;
    grid-template-columns: 24px 1fr auto;
    gap: 10px;
    align-items: center;
}
.sf-poll-option-id,
.sf-poll-option-count {
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 1.5px;
    color: rgba(var(--accent-rgb), 0.72);
}
.sf-poll-option-text {
    font-family: var(--font-sans);
    font-weight: 200;
    font-size: 13px;
    letter-spacing: 1.5px;
    color: var(--text-secondary);
}
.sf-poll-bar {
    height: 3px;
    background: rgba(var(--border-rgb), 0.28);
    overflow: hidden;
}
.sf-poll-bar span {
    display: block;
    height: 100%;
    background: rgba(var(--accent-rgb), 0.55);
    transition: width 0.25s ease;
}
.sf-poll-voters {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    padding: 3px 0 2px 34px;
}
.sf-poll-voter {
    min-height: 18px;
    display: inline-flex;
    align-items: center;
    padding: 2px 7px;
    border: 1px solid rgba(var(--accent-rgb), 0.18);
    background: rgba(var(--bg-deepest-rgb), 0.28);
    color: var(--accent);
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 1.3px;
    text-transform: uppercase;
}
.sf-poll-voter-empty {
    color: var(--text-muted);
    opacity: 0.62;
}
.sf-poll-total {
    margin-top: 12px;
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--text-muted);
}

.sf-post-image-layout {
    display: grid;
    /* The photo column hugs the picture (auto), so the caption fills all the
       remaining width up to the gap instead of leaving whitespace beside a
       right-aligned thumbnail. Covers regular photos, selfies, and Bop Heart. */
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 18px;
    align-items: start;
    justify-items: stretch;
    margin-top: 4px;
}
.sf-post-image-layout .sf-post-text {
    min-width: 0;
    font-size: 18px;
    line-height: calc(1.85em - 0.5px);
}
.sf-post-photo-row {
    display: flex;
    justify-content: flex-end;
    gap: 6px;
    margin-top: 10px;
    flex-wrap: wrap;
    width: 100%;
}
.sf-post-photo-row-inline {
    margin-top: 0;
    justify-self: end;
}
.sf-post-art-row {
    justify-content: center;
    margin-top: 10px;
}
.sf-post-thumb {
    width: 120px;
    height: 120px;
    object-fit: cover;
    border: 1px solid rgba(var(--accent-bright-rgb), 0.12);
    cursor: pointer;
    transition: border-color 0.2s, opacity 0.2s, filter 0.22s ease;
}
.sf-post-thumb:hover {
    border-color: var(--accent);
    opacity: 0.85;
}
.sf-post-art-thumb {
    width: 300px;
    max-width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
    display: block;
    filter: saturate(0.25);
}
.sf-post-art-thumb:hover {
    filter: saturate(1);
    opacity: 1;
}

/* Universal Aesthetic preset picker — lives inside the theme popup
   (paint-bucket icon → theme picker), below the theme lens list. */
.cartography-picker {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    margin-bottom: 12px;
}
.cartography-btn {
    min-width: 0;
    background: var(--bg-deepest);
    border: 1px solid rgba(var(--border-rgb), 0.4);
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 1.8px;
    text-transform: uppercase;
    padding: 9px 4px;
    cursor: pointer;
    text-align: center;
    transition: border-color 0.2s, color 0.2s, background 0.2s;
}
.cartography-btn:hover {
    border-color: rgba(var(--accent-rgb), 0.5);
    color: var(--accent-deep);
}
.cartography-btn.active {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(var(--accent-rgb), 0.04);
}
/* District Visible toggle — full-width row under the Cartography heading.
   Highlighted when on (blobs shown); muted when off (blobs hidden). */
.district-toggle-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    background: var(--bg-deepest);
    border: 1px solid rgba(var(--border-rgb), 0.4);
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 1.8px;
    text-transform: uppercase;
    padding: 9px 12px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: border-color 0.2s, color 0.2s, background 0.2s;
}
.district-toggle-btn:hover { border-color: rgba(var(--accent-rgb), 0.5); color: var(--accent-deep); }
.district-toggle-btn.active { border-color: var(--accent); color: var(--accent); background: rgba(var(--accent-rgb), 0.04); }
.district-toggle-state { opacity: 0.6; }
.district-toggle-btn.active .district-toggle-state { opacity: 1; }
.aesthetic-picker {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
}
.aesthetic-row {
    display: flex;
    align-items: stretch;
    gap: 6px;
}
.aesthetic-btn {
    flex: 1;
    min-width: 0;
    background: var(--bg-deepest);
    border: 1px solid rgba(var(--border-rgb), 0.4);
    color: var(--text-secondary);
    font-family: var(--font-serif);
    font-style: italic;
    font-weight: 300;
    font-size: 14px;
    letter-spacing: 0.3px;
    padding: 10px 12px;
    cursor: pointer;
    text-align: left;
    transition: border-color 0.2s, color 0.2s, background 0.2s;
}
.aesthetic-global-btn {
    width: 34px;
    flex: 0 0 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-deepest);
    border: 1px solid rgba(var(--border-rgb), 0.3);
    color: rgba(var(--text-primary-rgb), 0.22);
    cursor: not-allowed;
    transition: border-color 0.2s, color 0.2s, background 0.2s, box-shadow 0.2s, opacity 0.2s;
}
.aesthetic-global-btn svg {
    width: 15px;
    height: 15px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.aesthetic-global-btn.enabled {
    cursor: pointer;
    color: rgba(var(--accent-rgb), 0.45);
    border-color: rgba(var(--accent-rgb), 0.25);
}
.aesthetic-global-btn.enabled:hover {
    color: var(--accent);
    border-color: rgba(var(--accent-rgb), 0.55);
    background: rgba(var(--accent-rgb), 0.035);
}
.aesthetic-global-btn.active {
    color: var(--accent-bright);
    border-color: var(--accent);
    background: rgba(var(--accent-rgb), 0.08);
    box-shadow: 0 0 16px rgba(var(--accent-rgb), 0.24), inset 0 0 14px rgba(var(--accent-rgb), 0.08);
}
.aesthetic-global-btn:disabled {
    opacity: 0.5;
}
.aesthetic-btn:hover {
    border-color: rgba(var(--accent-rgb), 0.5);
    color: var(--accent-deep);
}
.aesthetic-btn.active {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(var(--accent-rgb), 0.04);
}
.theme-popup-title-help {
    cursor: help;
    outline: none;
}
.theme-popup-title-help::after {
    content: attr(data-helper);
    position: absolute;
    left: 50%;
    bottom: calc(100% + 10px);
    width: 230px;
    transform: translate(-50%, 4px);
    padding: 10px 12px;
    background: rgba(var(--bg-deepest-rgb), 0.98);
    border: 1px solid rgba(var(--accent-rgb), 0.28);
    color: var(--text-secondary);
    box-shadow: 0 12px 28px rgba(0,0,0,0.45), 0 0 18px rgba(var(--accent-rgb),0.08);
    font-family: var(--font-serif);
    font-size: 12px;
    font-style: italic;
    line-height: 1.45;
    letter-spacing: 0.2px;
    text-transform: none;
    text-align: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s, transform 0.18s;
    z-index: 2;
}
.theme-popup-title-help:hover::after,
.theme-popup-title-help:focus::after {
    opacity: 1;
    transform: translate(-50%, 0);
}

/* Banner post — agent reposted a gallery photo with poetic overlay text.
   500x250 wide banner, photo as cover bg, dim scrim, large thin white
   italic serif text centered on top. Click opens lightbox to original. */
.sf-post-banner {
    width: 500px;
    max-width: 100%;
    height: 250px;
    margin: 10px auto 0;
    background-position: center;
    background-size: cover;
    background-repeat: no-repeat;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(var(--accent-bright-rgb), 0.12);
    transition: border-color 0.2s, opacity 0.2s;
}
.sf-post-banner::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    pointer-events: none;
}
.sf-post-banner:hover {
    border-color: var(--accent);
    opacity: 0.92;
}
.sf-post-banner-text {
    position: relative;
    z-index: 1;
    width: 100%;
    min-height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-serif);
    font-style: italic;
    font-weight: 200;
    font-size: 50px;
    line-height: 1.05;
    color: #fff;
    text-align: center;
    padding: 0 24px;
    text-shadow: 0 2px 18px rgba(0, 0, 0, 0.55);
    word-wrap: break-word;
    pointer-events: none;
}
@media (max-width: 600px) {
    .sf-post-image-layout {
        display: block;
        margin-top: 0;
    }
    .sf-post-image-layout.sf-post-image-layout-compact {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(106px, 0.86fr);
        gap: 12px;
        align-items: start;
    }
    .sf-post-image-layout.sf-post-image-layout-single {
        grid-template-columns: minmax(0, 1fr) 120px;
        gap: 10px;
    }
    .sf-post-image-layout .sf-post-text {
        margin-bottom: 14px;
    }
    .sf-post-image-layout.sf-post-image-layout-compact .sf-post-text {
        margin-bottom: 0;
        font-size: 17px;
    }
    .sf-post-photo-row-inline {
        margin-top: 10px;
    }
    .sf-post-image-layout.sf-post-image-layout-compact .sf-post-photo-row-inline {
        margin-top: 0;
        justify-content: flex-end;
        justify-self: end;
    }
    .sf-post-selfie-row {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        align-content: start;
    }
    .sf-post-single-photo-row {
        grid-template-columns: minmax(0, 1fr);
    }
    .sf-post-selfie-row .sf-post-thumb {
        width: 100%;
        height: auto;
        aspect-ratio: 1 / 1;
    }
    .sf-post-image-layout.sf-post-image-layout-compact .sf-post-selfie-row .sf-post-thumb:only-child {
        grid-column: auto;
    }
    .sf-post-banner {
        height: auto;
        aspect-ratio: 2 / 1;
    }
    .sf-post-banner-text {
        font-size: 32px;
        padding: 0 16px;
    }
}

/* Suno placeholder */
.sf-post-suno {
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 18px 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    color: var(--text-muted);
    font-family: var(--font-sans);
    font-size: 12px;
}
.sf-post-suno-icon {
    font-size: 20px;
    color: var(--accent);
    opacity: 0.4;
}
.sf-post-audio {
    display: block;
    width: 100%;
    margin-top: 8px;
    height: 32px;
    filter: invert(0.85) hue-rotate(180deg) saturate(0.4);
}
.sf-post-song-section {
    position: relative;
}
.sf-post-song-section .sf-song-copy-btn {
    position: absolute;
    top: 8px;
    right: 0;
    z-index: 2;
}
.sf-song-copy-btn {
    width: 28px;
    height: 28px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid rgba(255,255,255,0.16);
    color: #fff;
    opacity: 0.58;
    cursor: pointer;
    transition: opacity 0.18s, border-color 0.18s, color 0.18s, background 0.18s;
}
.sf-song-copy-all-btn {
    width: auto;
    min-width: 0;
    height: 26px;
    margin-left: auto;
    padding: 0 8px;
    gap: 6px;
    flex-shrink: 0;
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 1px;
    text-transform: uppercase;
}
.sf-song-copy-all-btn span {
    display: inline-block;
}
.sf-song-copy-btn svg {
    width: 14px;
    height: 14px;
    display: block;
}
.sf-song-copy-btn:hover,
.sf-song-copy-btn.copied {
    opacity: 1;
    color: var(--accent-bright);
    border-color: rgba(var(--accent-bright-rgb),0.42);
    background: rgba(var(--accent-rgb),0.055);
}
.sf-post-suno-lyrics {
    margin-top: 10px;
    padding-right: 38px;
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 13px;
    line-height: 1.55;
    color: rgba(var(--memory-rgb), 0.75);
    white-space: pre-wrap;
}
/* Limerick act — same accent-tinted box as the lyric headings; the limerick
   itself in centred accent small-caps. */
.sf-post-limerick {
    margin-top: 10px;
    padding: 16px 18px;
    background: rgba(var(--accent-rgb), 0.055);
    border: 1px solid rgba(var(--accent-bright-rgb), 0.42);
    font-family: var(--font-sans);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--accent-bright);
    text-align: center;
    line-height: 2;
    white-space: pre-wrap;
}

/* Hide editing chrome on a lore canvas while it's being captured to PNG.
   The .amapella-downloading class is set on whichever element we capture
   (usually .lore-col-middle so the lens bg + frou-frou are included), so
   selectors target descendants without locking to a specific parent. */
.amapella-downloading .media-overlay,
.amapella-downloading .video-overlay,
.amapella-downloading .lore-card-edit-link,
.amapella-downloading .lore-card-delete-btn,
.amapella-downloading .lore-board-empty,
.amapella-downloading .lore-drag-hint,
.amapella-downloading .lore-middle-head {
    display: none !important;
}
/* Optional Suno-style production tag, rendered below the lyrics. Liner-note
   feel: Newsreader italic thin, faint border above, muted color. */
.sf-post-song-style {
    margin-top: 16px;
    padding-top: 12px;
    padding-right: 38px;
    border-top: 1px solid rgba(var(--border-rgb), 0.55);
    font-family: 'Newsreader', Georgia, serif;
    font-style: italic;
    font-weight: 300;
    font-size: 12px;
    line-height: 1.65;
    letter-spacing: 0.25px;
    color: rgba(var(--text-primary-rgb), 0.5);
    opacity: 0.82;
}
@media (max-width: 900px) {
    .sf-post-song-style {
        font-size: 12px;
        margin-top: 14px;
        padding-top: 10px;
    }
}

/* Reactions */
.sf-post-reactions {
    display: flex;
    gap: 10px;
    margin-top: 14px;
    padding-top: 10px;
    border-top: 1px solid rgba(var(--border-rgb),0.15);
}
.sf-reaction {
    display: flex;
    align-items: center;
    gap: 5px;
    opacity: 0.65;
    transition: opacity 0.2s;
}
.sf-reaction:hover { opacity: 1; }
.sf-reaction-avatar {
    width: 20px;
    height: 20px;
    border-radius: 3px;
    object-fit: cover;
}
.sf-reaction-icon { display: flex; align-items: center; }
.sf-reaction-icon svg {
    width: 14px;
    height: 14px;
    color: var(--accent);
    opacity: 0.8;
}
.sf-reaction-add {
    background: none;
    border: 1px solid rgba(var(--border-rgb),0.25);
    color: #eee;
    width: 22px;
    height: 22px;
    border-radius: 4px;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.4;
    transition: opacity 0.2s, border-color 0.2s;
}
.sf-reaction-add:hover {
    opacity: 1;
    border-color: var(--accent);
    color: #eee;
}
.sf-thread-start {
    min-width: 54px;
    height: 22px;
    padding: 0 10px;
    background: rgba(var(--accent-rgb), 0.025);
    border: 1px solid rgba(var(--border-rgb),0.25);
    border-radius: 4px;
    color: #eee;
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 1.4px;
    line-height: 1;
    text-transform: uppercase;
    cursor: pointer;
    opacity: 0.5;
    transition: opacity 0.2s, border-color 0.2s, color 0.2s, background 0.2s;
}
.sf-thread-start:hover {
    opacity: 1;
    border-color: rgba(var(--accent-rgb), 0.45);
    color: #eee;
    background: rgba(var(--accent-rgb), 0.06);
}
.sf-thread-start:disabled,
.sf-thread-start.is-away {
    opacity: 0.22;
    cursor: default;
    border-color: rgba(var(--border-rgb),0.18);
    color: var(--text-muted);
    background: transparent;
}
.sf-thread-start:disabled:hover,
.sf-thread-start.is-away:hover {
    opacity: 0.22;
    border-color: rgba(var(--border-rgb),0.18);
    color: var(--text-muted);
    background: transparent;
}
.sf-reaction-picker {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 6px;
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: center;
    max-width: 280px;
    padding: 10px 14px;
    background: var(--bg-card, #1a1d23);
    border: 1px solid rgba(var(--border-rgb),0.4);
    border-radius: 0;
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
    z-index: 100;
}
.sf-reaction-pick-btn {
    background: none;
    border: none;
    padding: 5px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}
.sf-reaction-pick-btn:hover {
    background: rgba(var(--border-rgb),0.3);
}
.sf-reaction-pick-btn svg {
    width: 18px;
    height: 18px;
    color: #eee;
    transition: color 0.15s;
}
.sf-reaction-pick-btn:hover svg {
    color: #eee;
}

.sf-thread-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin-top: 16px;
}
.sf-thread-box {
    min-height: 124px;
    padding: 11px 12px;
    background: rgba(var(--accent-rgb), 0.035);
    border: 1px solid rgba(var(--border-rgb), 0.18);
    color: var(--text-secondary);
    text-align: left;
    cursor: pointer;
    overflow: hidden;
    transition: border-color 0.18s, background 0.18s, transform 0.18s;
}
.sf-thread-box:hover {
    background: rgba(var(--accent-rgb), 0.06);
    border-color: rgba(var(--accent-rgb), 0.32);
    transform: translateY(-1px);
}
.sf-thread-box-top {
    display: flex;
    align-items: center;
    gap: 7px;
    min-width: 0;
    margin-bottom: 8px;
}
.sf-thread-box-avatar,
.sf-thread-reply-avatar {
    width: 18px;
    height: 18px;
    border-radius: 3px;
    object-fit: cover;
    flex-shrink: 0;
}
.sf-thread-box-title {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--accent);
}
.sf-thread-box-count {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-muted);
}
.sf-thread-reply {
    display: flex;
    gap: 7px;
    min-width: 0;
    margin: 8px 0;
}
.sf-thread-reply-avatar-empty {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(var(--accent-rgb), 0.12);
    color: var(--accent);
    font-family: var(--font-mono);
    font-size: 12px;
}
.sf-thread-reply-body { min-width: 0; }
.sf-thread-reply-name {
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: rgba(var(--accent-rgb), 0.78);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sf-thread-reply-name span { color: var(--text-muted); }
.sf-thread-reply-text {
    margin-top: 2px;
    font-family: var(--font-sans);
    font-size: 13px;
    font-weight: 300;
    line-height: 1.5;
    letter-spacing: 1.5px;
    color: #fff;
    overflow-wrap: anywhere;
}
.sf-thread-box .sf-thread-reply-text,
.sf-thread-full-list .sf-thread-reply-text,
.sf-thread-original p {
    font-family: var(--font-sans);
    font-size: 13px;
    font-weight: 300;
    line-height: 1.5;
    letter-spacing: 1.5px;
    color: #fff;
}
.sf-thread-more,
.sf-thread-empty {
    display: inline-block;
    margin-top: 6px;
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--accent);
}
.sf-thread-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 10020;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(10, 9, 15, 0.58);
    backdrop-filter: blur(3px);
}
.sf-thread-modal {
    width: 50vw;
    height: 75vh;
    min-width: 420px;
    min-height: 420px;
    max-width: 760px;
    max-height: calc(100vh - 48px);
    display: flex;
    flex-direction: column;
    background: var(--bg-panel);
    border: 1px solid rgba(var(--accent-rgb), 0.28);
    box-shadow: 0 20px 70px rgba(0,0,0,0.45);
}
.sf-thread-modal-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 18px;
    padding: 16px 18px 12px;
    border-bottom: 1px solid rgba(var(--border-rgb), 0.22);
}
.sf-thread-modal-kicker {
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--text-muted);
}
.sf-thread-modal-title {
    margin-top: 3px;
    font-family: var(--font-serif);
    font-size: 25px;
    font-style: italic;
    color: var(--accent);
}
.sf-thread-modal-head button {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 27px;
    cursor: pointer;
}
.sf-thread-original {
    padding: 12px 18px;
    border-bottom: 1px solid rgba(var(--border-rgb), 0.15);
}
.sf-thread-original span,
.sf-thread-target-helper,
.sf-thread-reply-actions span {
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 1.8px;
    text-transform: uppercase;
    color: var(--text-muted);
}
.sf-thread-original p {
    margin: 5px 0 0;
    overflow-wrap: anywhere;
}
.sf-thread-full-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 12px 18px;
}
.sf-thread-full-list .sf-thread-reply {
    margin: 12px 0;
}
.sf-thread-reply-panel {
    position: relative;
    padding: 12px 18px 16px;
    border-top: 1px solid rgba(var(--border-rgb), 0.18);
}
.sf-thread-mention-picker {
    margin-top: 8px;
    border: 1px solid rgba(var(--border-rgb), 0.2);
    background: rgba(var(--bg-deepest-rgb), 0.55);
    box-shadow: 0 12px 30px rgba(0,0,0,0.22);
}
.sf-thread-mention-picker[data-open="0"] {
    display: none;
}
.sf-thread-target-picker {
    position: relative;
    margin-top: 8px;
}
.sf-thread-target-input,
.sf-thread-reply-input {
    width: 100%;
    border: 1px solid rgba(var(--border-rgb), 0.28);
    background: rgba(255,255,255,0.025);
    color: var(--text-primary);
}
.sf-thread-target-input {
    height: 30px;
    padding: 0 9px;
    font-family: var(--font-mono);
    font-size: 13px;
    letter-spacing: 1px;
}
.sf-thread-target-list {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding: 8px 0 10px;
}
.sf-thread-mention-picker .sf-thread-target-list {
    flex-direction: column;
    max-height: 150px;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 6px;
}
.sf-thread-target,
.sf-thread-target-empty {
    flex: 0 0 auto;
    min-width: 118px;
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 6px 8px;
    border: 1px solid rgba(var(--border-rgb), 0.18);
    background: transparent;
    color: var(--text-secondary);
    text-align: left;
    cursor: pointer;
}
.sf-thread-mention-picker .sf-thread-target,
.sf-thread-mention-picker .sf-thread-target-empty {
    width: 100%;
    min-width: 0;
}
.sf-thread-target.active {
    border-color: rgba(var(--accent-rgb), 0.5);
    color: var(--accent);
}
.sf-thread-target img {
    width: 22px;
    height: 22px;
    border-radius: 3px;
    object-fit: cover;
}
.sf-thread-target span,
.sf-thread-target small {
    display: block;
    line-height: 1.1;
}
.sf-thread-target span {
    max-width: 72px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 14px;
}
.sf-thread-target small {
    font-size: 12px;
    color: var(--text-muted);
}
.sf-thread-target-empty {
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 1px;
    text-transform: uppercase;
    cursor: default;
}
.sf-thread-reply-input {
    min-height: 58px;
    resize: vertical;
    padding: 9px;
    font-family: var(--font-serif);
    font-size: 18px;
    line-height: 1.4;
}
.sf-thread-reply-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 8px;
}
.sf-thread-reply-actions button {
    border: 1px solid rgba(var(--accent-rgb), 0.32);
    background: transparent;
    color: var(--accent);
    padding: 6px 12px;
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    cursor: pointer;
}
.sf-thread-reply-actions .sf-thread-cancel {
    border-color: rgba(var(--border-rgb), 0.42);
    color: var(--text-secondary);
}
.sf-thread-reply-actions .sf-thread-cancel:hover {
    border-color: rgba(var(--accent-bright-rgb), 0.34);
    color: #eee;
}
.sf-thread-reply-actions button:disabled {
    opacity: 0.45;
    cursor: wait;
}

/* Compose area */
.sf-compose-resize {
    height: 8px;
    cursor: ns-resize;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0 20px;
}
.sf-compose-resize::after {
    content: '';
    width: 40px;
    height: 2px;
    background: var(--text-muted);
    opacity: 0.2;
    border-radius: 1px;
}
.sf-compose-resize:hover::after { opacity: 0.5; }
.sf-compose {
    border-top: 1px solid var(--border);
    padding: 16px 50px;
    position: relative;
}
.sf-compose-row {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}
.sf-compose-preview {
    margin-bottom: 10px;
}
.sf-compose-preview-inner {
    position: relative;
    display: inline-block;
}
.sf-compose-preview-inner img {
    max-height: 80px;
    border-radius: 3px;
    border: 1px solid var(--border);
    opacity: 0.7;
}
.sf-compose-preview-remove {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}
.sf-compose-preview-remove:hover { color: var(--text-primary); }
.sf-compose-tool-btn {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 16px;
    padding: 8px 10px;
    cursor: pointer;
    transition: color 0.2s, border-color 0.2s;
    flex-shrink: 0;
    min-width: 39px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.sf-compose-tool-btn svg {
    display: block;
    width: 15px;
    height: 15px;
}
.sf-compose-tool-btn:hover { color: var(--accent); border-color: var(--accent-border); }

/* Personas: post / reply AS an alter-ego (FU169). The trigger is accent-tinted;
   a picked persona fills the button with its avatar + an accent ring. */
.sf-compose-persona-btn { color: var(--accent); padding: 0; overflow: hidden; }
.sf-compose-persona-btn.is-persona {
    border-color: var(--accent);
    box-shadow: inset 0 0 0 1px rgba(var(--accent-rgb), 0.4);
}
.sf-compose-persona-av { width: 100%; height: 100%; object-fit: cover; display: block; }
.sf-persona-menu {
    position: fixed;
    z-index: 5000;
    width: 220px;
    max-height: 320px;
    overflow-y: auto;
    padding: 8px;
    background: rgba(var(--bg-deepest-rgb), 0.98);
    border: 1px solid rgba(var(--accent-rgb), 0.26);
    box-shadow: 0 18px 42px rgba(0,0,0,0.5), 0 0 22px rgba(var(--accent-rgb),0.06);
}
.sf-persona-menu-kicker {
    padding: 2px 4px 8px;
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 12px;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: rgba(var(--accent-rgb),0.66);
}
.sf-persona-opt {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    margin: 0;
    padding: 7px 8px;
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-secondary);
    font-family: var(--font-sans);
    font-size: 13px;
    text-align: left;
    cursor: pointer;
    transition: color 0.2s, background 0.2s, border-color 0.2s;
}
.sf-persona-opt:hover { color: var(--accent); border-color: rgba(var(--accent-rgb),0.2); background: rgba(var(--accent-rgb),0.045); }
.sf-persona-opt.active { color: var(--accent); border-color: var(--accent-border); background: var(--bg-deepest); }
.sf-persona-opt-av {
    width: 26px;
    height: 26px;
    border-radius: 4px;
    object-fit: cover;
    flex-shrink: 0;
    border: 1px solid rgba(var(--accent-rgb),0.18);
}
.sf-persona-opt-av-empty {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 13px;
    color: rgba(160,190,220,0.5);
}
.sf-persona-opt-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sf-persona-opt-tag {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(var(--accent-rgb),0.6);
}
.sf-poll-compose-popover {
    position: absolute;
    right: 124px;
    bottom: calc(100% + 10px);
    width: min(380px, calc(100% - 100px));
    padding: 14px;
    background: rgba(var(--bg-deepest-rgb), 0.98);
    border: 1px solid rgba(var(--accent-rgb), 0.28);
    box-shadow: 0 18px 46px rgba(0,0,0,0.55), 0 0 22px rgba(var(--accent-rgb),0.08);
    z-index: 20;
}
.sf-poll-compose-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}
.sf-poll-compose-head span {
    color: rgba(var(--accent-rgb),0.72);
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 2.5px;
    text-transform: uppercase;
}
.sf-poll-compose-head button {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
}
.sf-poll-compose-head button:hover { color: var(--accent); }
.sf-poll-compose-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 10px;
}
.sf-poll-compose-field span {
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 2px;
    text-transform: uppercase;
}
.sf-poll-compose-question,
.sf-poll-compose-option {
    width: 100%;
    background: rgba(var(--bg-panel-rgb),0.7);
    border: 1px solid rgba(var(--border-rgb),0.5);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 13px;
    line-height: 1.45;
    padding: 9px 10px;
    outline: none;
}
.sf-poll-compose-question {
    min-height: 64px;
    resize: vertical;
}
.sf-poll-compose-question:focus,
.sf-poll-compose-option:focus {
    border-color: rgba(var(--accent-rgb),0.5);
}
.sf-poll-compose-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding-top: 4px;
}
.sf-poll-compose-actions button {
    background: transparent;
    border: 1px solid rgba(var(--border-rgb),0.45);
    color: var(--text-muted);
    font-family: var(--font-sans);
    font-size: 12px;
    letter-spacing: 2px;
    text-transform: uppercase;
    padding: 8px 12px;
    cursor: pointer;
}
.sf-poll-compose-actions button:hover {
    border-color: rgba(var(--accent-rgb),0.45);
    color: var(--accent);
}
.sf-poll-compose-save {
    background: rgba(var(--accent-rgb),0.06) !important;
    border-color: rgba(var(--accent-rgb),0.35) !important;
    color: var(--accent) !important;
}
.sf-poll-compose-save:disabled {
    opacity: 0.55;
    cursor: wait;
}
.sf-compose-input {
    flex: 1;
    background: rgba(var(--bg-deepest-rgb), 0.6);
    border: 1px solid var(--border);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 16px;
    font-weight: 300;
    padding: 10px 14px;
    resize: none;
    min-height: 42px;
    max-height: 120px;
    outline: none;
    line-height: 1.5;
    letter-spacing: 0.2px;
    border-radius: 3px;
}
.sf-compose-input:focus { border-color: rgba(var(--accent-rgb),0.25); }
.sf-compose-input::placeholder { color: var(--text-muted); font-style: italic; font-family: 'Newsreader', Georgia, serif; }

.sf-compose-submit {
    background: var(--bg-deepest);
    border: 1px solid var(--accent-border);
    border-radius: 0;
    color: var(--accent);
    font-family: var(--font-sans);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 3px;
    padding: 10px 20px;
    cursor: pointer;
    transition: background 0.2s;
    white-space: nowrap;
    position: relative;
    overflow: hidden;
}
.sf-compose-submit:hover { background: var(--accent-dim); }
.sf-compose-submit .sf-btn-hearts {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}
.sf-compose-submit .sf-btn-heart {
    position: absolute;
    color: var(--accent);
    opacity: 0;
    animation: sf-heart-drift 3s ease-in-out infinite;
    font-size: 12px;
}

/* Load more */
.sf-load-more {
    display: block;
    margin: 8px auto 0;
    background: none;
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-family: var(--font-sans);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 2px;
    padding: 8px 24px;
    cursor: pointer;
    transition: color 0.2s, border-color 0.2s;
}
.sf-load-more:hover { color: var(--accent); border-color: var(--accent-border); }

/* Empty + Loading states */
.sf-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    text-align: center;
}
.sf-empty-tag {
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 5px 14px;
    background: rgba(var(--accent-rgb),0.05);
    border: 1px solid rgba(var(--accent-rgb),0.12);
    margin-bottom: 16px;
}
.sf-empty-text {
    font-family: var(--font-sans);
    font-size: 13px;
    color: var(--text-secondary);
    max-width: 320px;
    line-height: 1.6;
}

.sf-loading {
    text-align: center;
    padding: 40px 0;
    font-family: var(--font-mono);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 3px;
    color: var(--text-muted);
    animation: nav-loading-pulse 1.4s ease-in-out infinite;
}

/* ============================================= CHAT PHOTO REVEAL */

.chat-photo-reveal {
    position: relative;
    display: inline-block;
    cursor: pointer;
    margin: 4px 0;
    overflow: hidden;
}
.chat-photo-img {
    max-width: 200px;
    max-height: 200px;
    display: block;
    border: 1px solid var(--border);
    filter: blur(10px) brightness(0.4);
    transition: filter 0.4s ease;
}
.chat-photo-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(var(--bg-deepest-rgb),0.55);
    color: #FFFFFF;
    transition: opacity 0.4s ease;
}
.chat-photo-overlay i,
.chat-photo-overlay svg {
    width: 28px;
    height: 28px;
    filter: drop-shadow(0 0 6px rgba(var(--text-primary-rgb), 0.4));
}
.chat-photo-reveal.revealed .chat-photo-img {
    filter: none;
}
.chat-photo-reveal.revealed .chat-photo-overlay {
    opacity: 0;
    pointer-events: none;
}
.chat-photo-group {
    display: flex;
    gap: 6px;
    margin: 4px 0;
}
.chat-photo-group .chat-photo-reveal {
    flex: 1 1 0;
    margin: 0;
}
.chat-photo-group .chat-photo-img {
    max-width: 100%;
    width: 100%;
    max-height: 200px;
    object-fit: cover;
}

/* ============================================= SOCIAL FEED MOBILE */

@media (max-width: 900px) {
    .sf-overlay { padding: 0; }
    .sf-window {
        width: 100vw; height: 100vh; max-width: none;
        border: none; box-shadow: none;
    }
    @supports (height: 100dvh) { .sf-window { height: 100dvh; } }

    /* Hide desktop header + sidebar, show mobile header */
    .sf-header { display: none; }
    .sf-sidebar { display: none; }
    .sf-sidebar.sf-sidebar-open {
        display: flex; position: fixed; top: 0; left: 0;
        width: 100vw; height: 100vh; z-index: 200;
        background: rgba(var(--bg-deepest-rgb), 0.96);
        backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
        align-items: center; justify-content: center;
        padding: 40px 20px; border-right: none;
    }
    @supports (height: 100dvh) { .sf-sidebar.sf-sidebar-open { height: 100dvh; } }
    .sf-sidebar.sf-sidebar-open .sf-user-card { max-width: 240px; }
    .sf-sidebar.sf-sidebar-open .sf-agent-list { flex: 0 1 auto; max-height: 40vh; overflow-y: auto; }
    .sf-sidebar.sf-sidebar-open .sf-sidebar-all { margin-top: 12px; }
    .sf-sidebar.sf-sidebar-open .sf-user-name,
    .sf-sidebar.sf-sidebar-open .sf-agent-item {
        font-family: var(--font-serif);
        font-style: normal;
        font-weight: 300;
        letter-spacing: 0;
    }
    .sf-sidebar.sf-sidebar-open .sf-agent-item {
        font-size: 16px;
        justify-content: flex-start;
        gap: 10px;
        padding-left: 12px;
        min-height: 42px;
    }
    .sf-sidebar.sf-sidebar-open .sf-agent-avatar {
        width: 30px;
        height: 30px;
        border-radius: 4px;
        border: 1px solid rgba(var(--accent-rgb),0.18);
    }
    .sf-post-avatar,
    .sf-post-video-avatar {
        width: 75px;
        height: 75px;
    }
    .sf-post-author,
    .sf-post-author-handle {
        line-height: 1.06;
    }

    /* Mobile header */
    .sf-mobile-header {
        display: flex; align-items: center; gap: 10px;
        padding: 10px 16px; border-bottom: 1px solid rgba(var(--border-rgb),0.15);
        flex-shrink: 0;
    }
    .sf-mobile-title {
        flex: 1; font-family: var(--font-serif); font-style: normal;
        font-size: 14px; color: var(--text-primary); cursor: pointer;
    }
    .sf-mobile-title:hover { color: var(--accent); }
    .sf-mobile-filter {
        font-family: var(--font-mono); font-size: 12px; text-transform: uppercase;
        letter-spacing: 2px; color: var(--text-muted); opacity: 0.7;
    }
    .sf-mobile-kebab {
        background: none; border: none; color: var(--text-primary);
        font-size: 20px; cursor: pointer; padding: 4px 6px;
        transition: color 0.2s;
    }
    .sf-mobile-kebab:hover { color: var(--accent); }
    .sf-mobile-close {
        background: none; border: none; color: var(--text-muted);
        font-size: 22px; cursor: pointer; padding: 4px 8px;
        transition: color 0.2s; margin-left: 4px;
    }
    .sf-mobile-close:hover { color: var(--accent); }

    /* Sidebar close button */
    .sf-sidebar-mobile-close {
        position: absolute; top: 16px; right: 20px;
        background: none; border: none; color: var(--text-muted);
        font-size: 22px; cursor: pointer; padding: 4px 8px;
        transition: color 0.2s; display: none;
    }
    .sf-sidebar-mobile-close:hover { color: var(--accent); }
    .sf-sidebar.sf-sidebar-open .sf-sidebar-mobile-close { display: block; }

    /* Posts tighter */
    .sf-post { padding: 16px; }
    .sf-compose { padding: 16px 16px; }
    .sf-compose-row {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 6px;
        align-items: stretch;
        width: 100%;
    }
    .sf-compose-input {
        grid-column: 1 / -1;
        font-size: 16px;
        width: 100%;
        min-width: 0;
    }
    .sf-compose-tool-btn {
        min-width: 0;
        width: 100%;
        height: 38px;
        padding: 0;
    }
    .sf-compose-submit {
        width: 100%;
        height: 38px;
        padding: 7px 10px;
        letter-spacing: 2px;
    }
    .sf-poll-compose-popover {
        left: 16px;
        right: 16px;
        width: auto;
        bottom: calc(100% + 8px);
        max-height: min(70vh, 520px);
        overflow-y: auto;
    }
    .sf-thread-row {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    .sf-thread-box {
        min-height: 0;
    }
    .sf-thread-modal {
        width: calc(100vw - 28px);
        height: 75vh;
        min-width: 0;
        min-height: 0;
    }
    @supports (height: 100dvh) {
        .sf-thread-modal { height: 75dvh; }
    }
    .sf-thread-modal-title {
        font-size: 22px;
    }
    .sf-thread-mention-picker .sf-thread-target-list {
        max-height: 92px;
    }
}

@media (min-width: 901px) {
    .sf-mobile-header { display: none !important; }
    .sf-sidebar-mobile-close { display: none !important; }
}

/* ============================================= MINI CHAT */

.nav-minichat-icon {
    display: inline-flex; align-items: center; justify-content: center;
    color: #FFFFFF; padding: 4px 6px; background: none; border: none;
    cursor: pointer; transition: color 0.25s, filter 0.25s, transform 0.25s;
}
.nav-minichat-icon svg { display: block; }
.nav-minichat-icon:hover {
    color: var(--accent);
    filter: drop-shadow(0 0 8px rgba(var(--accent-rgb),0.5));
    transform: scale(1.04);
}
.nav-minichat-icon.has-new {
    animation: mc-notify-flicker 2.2s ease-in-out infinite;
}
@keyframes mc-notify-flicker {
    0%   { color: var(--accent); filter: drop-shadow(0 0 6px rgba(var(--accent-rgb),0.5)); opacity: 1; }
    12%  { opacity: 0.3; filter: none; }
    16%  { opacity: 1; filter: drop-shadow(0 0 10px rgba(var(--accent-rgb),0.8)); }
    40%  { opacity: 1; filter: drop-shadow(0 0 4px rgba(var(--accent-rgb),0.3)); }
    55%  { opacity: 0.25; filter: none; }
    60%  { opacity: 1; filter: drop-shadow(0 0 12px rgba(var(--accent-rgb),0.9)); color: var(--accent); }
    80%  { opacity: 1; filter: drop-shadow(0 0 5px rgba(var(--accent-rgb),0.4)); }
    88%  { opacity: 0.4; filter: none; }
    92%  { opacity: 1; filter: drop-shadow(0 0 8px rgba(var(--accent-rgb),0.7)); }
    100% { opacity: 1; filter: drop-shadow(0 0 6px rgba(var(--accent-rgb),0.5)); color: var(--accent); }
}

/* ---- Chat Toast Notification ---- */
.chat-toast {
    position: fixed;
    top: 60px;
    right: 20px;
    z-index: 9999;
    padding: 14px 20px;
    backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
    background: linear-gradient(135deg, rgba(var(--bg-deepest-rgb),0.7) 0%, rgba(var(--bg-deepest-rgb),0.45) 100%);
    border: 1px solid rgba(var(--accent-rgb),0.15);
    box-shadow: 0 0 30px rgba(var(--bg-deepest-rgb), 0.5), inset 0 0 20px rgba(var(--accent-rgb),0.03);
    cursor: pointer;
    opacity: 0;
    transform: translateX(20px);
    transition: opacity 0.35s ease, transform 0.35s ease;
    pointer-events: none;
}
.chat-toast.visible {
    opacity: 1;
    transform: translateX(0);
    pointer-events: auto;
}
.chat-toast-bracket-tl,
.chat-toast-bracket-br { position: absolute; width: 10px; height: 10px; pointer-events: none; }
.chat-toast-bracket-tl {
    top: -2px; left: -2px;
    border-top: 1px solid rgba(var(--accent-rgb),0.45);
    border-left: 1px solid rgba(var(--accent-rgb),0.45);
}
.chat-toast-bracket-br {
    bottom: -2px; right: -2px;
    border-bottom: 1px solid rgba(var(--accent-rgb),0.45);
    border-right: 1px solid rgba(var(--accent-rgb),0.45);
}
.chat-toast-name {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 14px;
    color: var(--accent);
    text-shadow: 0 0 10px rgba(var(--accent-rgb),0.5);
    margin-bottom: 2px;
}
.chat-toast-msg {
    font-family: var(--font-sans);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: rgba(var(--accent-rgb), 0.5);
}
.chat-toast-queue {
    margin-top: 3px;
    font-family: 'Newsreader', var(--font-serif), serif;
    font-style: italic;
    font-size: 12px;
    color: rgba(var(--accent-rgb),0.55);
}
.chat-toast:hover {
    border-color: rgba(var(--accent-rgb),0.3);
    box-shadow: 0 0 30px rgba(var(--bg-deepest-rgb), 0.5), inset 0 0 20px rgba(var(--accent-rgb),0.06);
}
.social-device-toast {
    top: calc(60px + var(--toast-stack-offset, 0px));
    max-width: min(360px, calc(100vw - 40px));
    min-width: min(260px, calc(100vw - 40px));
    width: auto;
}
.social-device-toast .chat-toast-name {
    max-width: 320px;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

/* Mobile: centre the toast at the top and float it above the full-screen
   chat panel (z-index 70) and any other overlays. Takes the safe-area inset
   into account so it never lands under a notch. */
@media (max-width: 700px) {
    .chat-toast,
    .darkroom-toast {
        top: calc(env(safe-area-inset-top, 0px) + 10px);
        right: 50%;
        transform: translateX(50%) translateY(-6px);
        max-width: calc(100vw - 32px);
        z-index: 15000;
    }
    .chat-toast.visible,
    .darkroom-toast.visible {
        transform: translateX(50%) translateY(0);
    }
    .social-device-toast {
        top: calc(env(safe-area-inset-top, 0px) + 10px + var(--toast-stack-offset, 0px));
        min-width: 0;
        width: calc(100vw - 32px);
    }
    .social-device-toast .chat-toast-name {
        max-width: none;
    }
}

/* ---- User Control Panel ---- */
.nav-ucp-icon {
    display: inline-flex; align-items: center; justify-content: center;
    color: #FFFFFF; padding: 4px 6px; background: none; border: none;
    cursor: pointer; transition: color 0.25s, filter 0.25s, transform 0.25s;
}
.nav-ucp-icon svg { display: block; }
.nav-ucp-icon:hover {
    color: #e8a0bf;
    filter: drop-shadow(0 0 8px rgba(232,160,191,0.5));
    transform: scale(1.08);
}
/* ucp styles moved to user-cp.js (self-contained) */

.mc-panel {
    position: fixed; top: 52px; right: 24px;
    width: 380px; height: 500px;
    background: rgba(var(--bg-panel-rgb), 0.92);
    backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(var(--accent-rgb),0.10);
    border-radius: 0;
    box-shadow:
        0 24px 60px rgba(0,0,0,0.5),
        0 0 0 1px rgba(var(--accent-rgb),0.03) inset,
        0 0 80px rgba(var(--accent-rgb),0.025);
    display: flex; flex-direction: column;
    overflow: hidden; z-index: 90;
    opacity: 0; transform: translateY(-10px);
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.mc-panel.open { opacity: 1; transform: translateY(0); pointer-events: auto; }

.mc-glow-line {
    position: absolute; top: 0; left: 0; right: 0; height: 1px;
    background: linear-gradient(to right, transparent 10%, rgba(var(--accent-rgb),0.35) 50%, transparent 90%);
    pointer-events: none;
}

/* Views */
.mc-view {
    position: absolute; inset: 0;
    display: flex; flex-direction: column;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease;
}
.mc-view:not(.mc-active) { opacity: 0; pointer-events: none; transform: translateX(30px); }
.mc-view.mc-active { opacity: 1; pointer-events: auto; transform: translateX(0); }
.mc-view-list:not(.mc-active) { transform: translateX(-30px); }

/* Header */
.mc-header {
    display: flex; align-items: center; padding: 14px 16px;
    border-bottom: 1px solid var(--border); gap: 10px; flex-shrink: 0;
}
.mc-header-title {
    font-family: var(--font-serif); font-style: italic; font-weight: 200;
    font-size: 17px; color: var(--text-muted); flex: 1; letter-spacing: 0.5px;
}
.mc-close {
    font-size: 20px; background: none; border: none; color: var(--text-muted);
    cursor: pointer; transition: color 0.2s; padding: 2px 6px; line-height: 1;
}
.mc-close:hover { color: var(--accent); }
.mc-back {
    background: none; border: none; color: var(--text-muted);
    cursor: pointer; padding: 4px; transition: color 0.2s; display: flex;
}
.mc-back:hover { color: var(--accent); }

/* Agent List */
.mc-agent-list { flex: 1; overflow-y: auto; padding: 4px 0; }
.mc-agent-row {
    display: flex; align-items: center; gap: 12px;
    padding: 11px 16px;
    transition: background 0.2s;
    border-bottom: 1px solid rgba(var(--border-rgb),0.08);
}
.mc-agent-avatar-wrap {
    flex-shrink: 0; cursor: pointer;
    transition: transform 0.15s;
    border-radius: 50%;
    padding: 2px;
    border: 2px solid transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 50px; height: 50px;
    overflow: hidden;
}
.mc-agent-avatar-wrap:hover { transform: scale(1.08); }
.mc-agent-avatar-wrap.mc-unread {
    border-color: rgba(var(--accent-rgb),0.6);
    box-shadow: 0 0 8px rgba(var(--accent-rgb),0.4), 0 0 16px rgba(var(--accent-rgb),0.15);
    animation: mc-unread-ring 2.2s ease-in-out infinite;
}
@keyframes mc-unread-ring {
    0%   { border-color: rgba(var(--accent-rgb),0.6); box-shadow: 0 0 8px rgba(var(--accent-rgb),0.4); }
    15%  { border-color: rgba(var(--accent-rgb),0.2); box-shadow: 0 0 3px rgba(var(--accent-rgb),0.1); }
    20%  { border-color: rgba(var(--accent-rgb),0.7); box-shadow: 0 0 12px rgba(var(--accent-rgb),0.5); }
    50%  { border-color: rgba(var(--accent-rgb),0.5); box-shadow: 0 0 6px rgba(var(--accent-rgb),0.3); }
    65%  { border-color: rgba(var(--accent-rgb),0.15); box-shadow: 0 0 2px rgba(var(--accent-rgb),0.1); }
    70%  { border-color: rgba(var(--accent-rgb),0.8); box-shadow: 0 0 14px rgba(var(--accent-rgb),0.6); }
    100% { border-color: rgba(var(--accent-rgb),0.6); box-shadow: 0 0 8px rgba(var(--accent-rgb),0.4); }
}
.mc-agent-info { cursor: pointer; }
.mc-agent-info:hover { background: rgba(var(--accent-rgb),0.04); }
.mc-agent-avatar {
    width: 42px; height: 42px; border-radius: 50%; object-fit: cover;
    flex-shrink: 0; border: 1px solid rgba(var(--accent-rgb),0.10);
}
video.mc-agent-avatar { background: var(--bg-card); }
.mc-agent-info { flex: 1; min-width: 0; }
.mc-agent-name {
    font-family: var(--font-serif); font-style: italic;
    font-size: 15px; color: var(--text-primary); line-height: 1.3;
    display: flex; align-items: center; gap: 0;
}
.mc-status-diamond { font-size: 12px; flex-shrink: 0; margin-right: 6px; }
.mc-agent-role {
    font-family: var(--font-sans); font-size: 12px;
    text-transform: uppercase; letter-spacing: 2.5px;
    color: var(--text-muted); margin-top: 2px;
}

/* Chat Header */
.mc-chat-info {
    display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0;
}
.mc-chat-avatar {
    width: 26px; height: 26px; border-radius: 50%; object-fit: cover;
    border: 1px solid rgba(var(--accent-rgb),0.10);
}
.mc-chat-name {
    font-family: var(--font-serif); font-style: italic;
    font-size: 15px; color: var(--accent);
}

/* Messages */
.mc-messages {
    flex: 1; overflow-y: auto; padding: 16px; display: flex;
    flex-direction: column; gap: 10px;
}
.mc-msg { max-width: 82%; display: flex; flex-direction: column; }
.mc-msg-user { align-self: flex-end; align-items: flex-end; }
.mc-msg-agent { align-self: flex-start; align-items: flex-start; }
.mc-bubble {
    padding: 9px 13px; border-radius: 4px;
    font-family: var(--font-sans); font-size: 13px;
    line-height: 1.6; font-weight: 300; letter-spacing: 0;
}
.mc-msg-user .mc-bubble {
    background: var(--user-bubble-bg);
    border: 1px solid rgba(var(--accent-rgb),0.14);
    color: var(--user-bubble-color);
}
.mc-msg-agent .mc-bubble {
    background: var(--agent-bubble-bg);
    border: 1px solid var(--border);
    color: var(--text-primary);
}
:root[data-theme="winery"] .mc-msg-user .mc-bubble,
:root[data-theme="winery"] .mc-msg-user .mc-bubble .dialogue,
:root[data-theme="winery"] .mc-msg-user .mc-bubble strong {
    color: #FFFFFF !important;
}
.mc-bubble .chat-photo-img {
    max-width: 160px;
    max-height: 160px;
}
.mc-copy-btn {
    margin-top: 4px;
    width: 24px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid rgba(var(--border-rgb),0.18);
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
    transition: color 0.2s, border-color 0.2s;
}
.mc-copy-btn:hover,
.mc-copy-btn.copied {
    color: var(--accent);
    border-color: rgba(var(--accent-rgb),0.35);
}
.mc-msg-actions {
    display: inline-flex;
    gap: 4px;
    margin-top: 4px;
}
.mc-msg-actions .mc-copy-btn { margin-top: 0; }
.mc-msg-user .mc-msg-actions { align-self: flex-end; }
.mc-msg-agent .mc-msg-actions { align-self: flex-start; }
.mc-msg-user .mc-copy-btn { align-self: auto; }
.mc-msg-agent .mc-copy-btn { align-self: auto; }
.mc-copy-btn svg { display: block; }
.mc-restore-btn { display: none; margin-top: 0; opacity: 0.7; }
.mc-msg-hidden .mc-bubble,
.mc-msg-hidden .mc-msg-actions { display: none !important; }
.mc-msg-hidden .mc-restore-btn { display: inline-flex; }
.mc-msg-hidden.mc-msg-user .mc-restore-btn { align-self: flex-end; }
.mc-msg-hidden.mc-msg-agent .mc-restore-btn { align-self: flex-start; }
.mc-msg-hidden .mc-restore-btn:hover { opacity: 1; }

.homecoming-date-line,
.homecoming-living-line {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 12px;
    font-style: normal;
    letter-spacing: 1.4px;
    text-transform: uppercase;
    color: rgba(var(--text-primary-rgb), 0.72);
}
.homecoming-date-line { margin-bottom: 5px; }
.homecoming-message-line { display: inline-block; }
.homecoming-living-line { margin-top: 5px; }
.home-departure-message-line { display: inline-block; }
.mc-bubble .chat-photo-group {
    max-width: 260px;
}

/* Typing */
.mc-typing {
    align-self: flex-start; padding: 8px 14px;
    font-family: var(--font-serif); font-style: italic;
    font-size: 12px; color: var(--text-muted); letter-spacing: 0.5px;
}
.mc-typing-dots { display: inline-block; }
.mc-typing-dots span {
    display: inline-block; width: 4px; height: 4px;
    background: var(--text-muted); border-radius: 50%;
    margin: 0 1.5px; animation: mc-dot-pulse 1.4s ease-in-out infinite;
}
.mc-typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.mc-typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes mc-dot-pulse {
    0%, 80%, 100% { opacity: 0.25; transform: scale(0.8); }
    40% { opacity: 1; transform: scale(1); }
}

@media (max-width: 900px) {
    .mc-typing.mobile-dm-typing-overlay {
        position: absolute;
        left: 50%;
        top: 50%;
        transform: translate(-50%, -50%);
        z-index: 10000;
        width: 108px;
        height: 108px;
        margin: 0;
        padding: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 50%;
        background:
            radial-gradient(circle, rgba(var(--accent-rgb),0.16) 0%, rgba(var(--accent-rgb),0.05) 55%, transparent 72%),
            rgba(var(--bg-panel-rgb), 0.72);
        border: 1px solid rgba(var(--accent-rgb), 0.22);
        box-shadow:
            0 0 24px rgba(var(--accent-rgb),0.16),
            inset 0 0 28px rgba(var(--accent-rgb),0.08);
        animation: mc-mobile-dm-typing-glow 1.9s ease-in-out infinite;
        pointer-events: none;
    }

    .mc-typing.mobile-dm-typing-overlay .mc-typing-name {
        display: none;
    }

    .mc-typing.mobile-dm-typing-overlay .mc-typing-dots {
        display: inline-flex;
        gap: 7px;
        margin: 0;
        align-items: center;
        justify-content: center;
    }

    .mc-typing.mobile-dm-typing-overlay .mc-typing-dots span {
        width: 7px;
        height: 7px;
        margin: 0;
        background: var(--accent);
        box-shadow: 0 0 10px rgba(var(--accent-rgb),0.55);
        animation: mc-mobile-dm-dot-bounce 1.2s ease-in-out infinite;
    }

    .mc-typing.mobile-dm-typing-overlay .mc-typing-dots span:nth-child(2) {
        animation-delay: 0.16s;
    }

    .mc-typing.mobile-dm-typing-overlay .mc-typing-dots span:nth-child(3) {
        animation-delay: 0.32s;
    }
}

@keyframes mc-mobile-dm-typing-glow {
    0%, 100% { box-shadow: 0 0 20px rgba(var(--accent-rgb),0.12), inset 0 0 24px rgba(var(--accent-rgb),0.06); }
    50% { box-shadow: 0 0 38px rgba(var(--accent-rgb),0.28), inset 0 0 34px rgba(var(--accent-rgb),0.12); }
}

@keyframes mc-mobile-dm-dot-bounce {
    0%, 80%, 100% { opacity: 0.35; transform: translateY(0) scale(0.9); }
    40% { opacity: 1; transform: translateY(-6px) scale(1.06); }
}

/* Input */
.mc-input-area {
    display: flex; align-items: flex-end; gap: 6px;
    padding: 10px 14px; border-top: 1px solid var(--border); flex-shrink: 0;
}
.mc-input {
    flex: 1; background: rgba(var(--bg-deepest-rgb), 0.6);
    border: 1px solid var(--border); color: var(--text-primary);
    font-family: var(--font-sans); font-size: 13px; font-weight: 300;
    padding: 8px 12px; outline: none; resize: none;
    min-height: 36px; max-height: 80px; line-height: 1.5;
    transition: border-color 0.2s; letter-spacing: 0;
    border-radius: 3px;
}
.mc-input:focus { border-color: rgba(var(--accent-rgb),0.25); }
.mc-input::placeholder {
    color: var(--text-muted); font-family: var(--font-serif); font-style: italic;
}
.mc-send {
    background: none; border: 1px solid rgba(var(--accent-rgb),0.15);
    color: var(--accent); width: 36px; height: 36px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; transition: background 0.2s, border-color 0.2s;
    border-radius: 3px; flex-shrink: 0;
}
.mc-send:hover { background: rgba(var(--accent-rgb),0.06); border-color: rgba(var(--accent-rgb),0.3); }
.mc-send svg { display: block; }
.mc-trigger {
    background: none;
    border: 1px solid rgba(var(--border-rgb),0.8);
    color: var(--text-muted);
    width: 36px;
    min-width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: color 0.2s, border-color 0.2s, background 0.2s;
    border-radius: 3px;
    flex-shrink: 0;
    font-family: var(--font-sans);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 2px;
}
.mc-trigger svg {
    width: 14px;
    height: 14px;
    display: block;
}
.mc-trigger:hover {
    color: var(--accent-bright);
    border-color: rgba(var(--accent-rgb),0.32);
    background: rgba(var(--accent-rgb),0.05);
}

.chat-trigger-picker-overlay {
    position: fixed;
    inset: 0;
    z-index: 22000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 18px;
    background: rgba(var(--bg-deepest-rgb),0.72);
    backdrop-filter: blur(7px);
    -webkit-backdrop-filter: blur(7px);
}
.chat-trigger-picker-overlay.open { display: flex; }
.chat-trigger-picker {
    width: min(540px, calc(100vw - 28px));
    max-height: min(78vh, 680px);
    display: flex;
    flex-direction: column;
    background: linear-gradient(145deg, rgba(var(--bg-panel-rgb),0.98), rgba(var(--bg-deepest-rgb),0.96));
    border: 1px solid rgba(var(--border-rgb),0.78);
    box-shadow: 0 22px 70px rgba(0,0,0,0.48), inset 0 0 28px rgba(var(--accent-rgb),0.05);
}
.chat-trigger-picker-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    padding: 18px 20px 10px;
    border-bottom: 1px solid rgba(var(--border-rgb),0.42);
}
.chat-trigger-picker-kicker {
    font-family: var(--font-sans);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 3px;
    color: var(--text-muted);
}
.chat-trigger-picker-title {
    margin-top: 6px;
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 24px;
    color: var(--text-primary);
}
.chat-trigger-picker-close {
    background: none;
    border: 1px solid rgba(var(--border-rgb),0.65);
    color: var(--text-muted);
    width: 32px;
    height: 32px;
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
}
.chat-trigger-picker-close:hover {
    color: var(--accent-bright);
    border-color: rgba(var(--accent-rgb),0.45);
}
.chat-trigger-picker-sub {
    padding: 10px 20px 12px;
    color: var(--text-secondary);
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 13px;
    border-bottom: 1px solid rgba(var(--border-rgb),0.26);
}
.chat-trigger-picker-list {
    overflow: auto;
    padding: 10px;
}
.chat-trigger-picker-row {
    width: 100%;
    display: grid;
    grid-template-columns: minmax(120px, 0.55fr) 1fr auto;
    gap: 12px;
    align-items: center;
    text-align: left;
    padding: 12px 13px;
    margin: 0 0 8px;
    background: rgba(var(--bg-card-rgb),0.5);
    border: 1px solid rgba(var(--border-rgb),0.55);
    color: var(--text-primary);
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, transform 0.2s;
}
.chat-trigger-picker-row:hover,
.chat-trigger-picker-row:focus {
    outline: none;
    background: rgba(var(--accent-rgb),0.08);
    border-color: rgba(var(--accent-rgb),0.44);
    transform: translateY(-1px);
}
.chat-trigger-picker-phrase {
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 1.6px;
    color: var(--accent-bright);
    text-transform: uppercase;
}
.chat-trigger-picker-desc {
    font-family: var(--font-serif);
    font-size: 13px;
    line-height: 1.35;
    color: var(--text-secondary);
}
.chat-trigger-picker-where {
    font-family: var(--font-sans);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--text-muted);
    white-space: nowrap;
}
@media (max-width: 640px) {
    .chat-trigger-picker {
        width: calc(100vw - 22px);
        max-height: 82vh;
    }
    .chat-trigger-picker-row {
        grid-template-columns: 1fr;
        gap: 6px;
    }
    .chat-trigger-picker-where {
        white-space: normal;
    }
    .mc-trigger {
        min-width: 36px;
        padding: 0;
    }
}

/* ============================================= AGENT PROFILE POPUP */
.agp-overlay {
    position: fixed; inset: 0; z-index: 150;
    display: flex; align-items: center; justify-content: center;
    background: rgba(var(--bg-deepest-rgb),0.75);
    backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
    opacity: 0; pointer-events: none; transition: opacity 0.3s ease;
}
.agp-overlay.open { opacity: 1; pointer-events: auto; }
.agp-window {
    width: 75vw; height: 85vh;
    background: var(--bg-panel);
    border: 1px solid rgba(var(--border-rgb),0.15);
    display: flex; flex-direction: column;
    overflow: hidden;
}
.agp-layout { display: flex; flex: 1; min-height: 0; overflow: hidden; }
.agp-sidebar {
    width: 200px; flex-shrink: 0;
    background: var(--bg-deepest);
    border-right: 1px solid rgba(var(--border-rgb),0.12);
    display: flex; flex-direction: column;
    padding: 24px 0 20px;
    overflow-y: auto;
}
.agp-sidebar-section { padding: 0 16px; margin-bottom: 8px; }
.agp-sidebar-label {
    font-family: var(--font-serif);
    font-style: italic; font-weight: 200;
    font-size: 12px; text-transform: uppercase;
    letter-spacing: 2.5px; color: var(--accent);
    margin-bottom: 4px; text-align: center;
}
.agp-sidebar-avatar {
    width: 125px; height: 125px; object-fit: cover;
    border: 1px solid rgba(var(--accent-rgb),0.15);
    margin: 8px auto 6px; display: block;
    cursor: pointer;
    transition: border-color 0.18s, filter 0.18s;
}
.agp-sidebar-avatar:hover { border-color: rgba(var(--accent-rgb),0.35); filter: brightness(1.06); }
.agp-sidebar-citizen {
    display: none;
    margin: 0 auto 6px;
    font-family: var(--font-sans);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 2.4px;
    text-transform: uppercase;
    color: var(--accent-bright);
    text-align: center;
    text-shadow:
        0 0 8px rgba(var(--accent-bright-rgb),0.55),
        0 0 18px rgba(var(--accent-rgb),0.24);
}
.agp-sidebar-citizen.visible { display: block; }
.agp-sidebar-name {
    font-family: var(--font-serif); font-style: italic;
    font-size: 16px; color: var(--text-primary);
    padding: 0 4px 4px; line-height: 1.3; text-align: center;
}
.agp-sidebar-model {
    font-family: var(--font-sans); font-size: 12px;
    text-transform: uppercase; letter-spacing: 2px;
    color: var(--text-muted); text-align: center;
}
.agp-grid-toggle {
    font-family: var(--font-mono); font-size: 12px;
    text-transform: uppercase; letter-spacing: 2.5px;
    padding: 3px 8px; margin: 8px auto 0; cursor: pointer;
    border: 1px solid rgba(var(--accent-rgb),0.15);
    display: block; width: fit-content; text-align: center;
    transition: all 0.2s;
}
.agp-grid-toggle.on {
    color: rgba(140,190,160,0.8);
    border-color: rgba(140,190,160,0.25);
    animation: gridGlitchOn 3s infinite;
}
.agp-grid-toggle.off {
    color: rgba(200,120,120,0.8);
    border-color: rgba(200,120,120,0.25);
    animation: gridGlitchOff 2.4s infinite;
}
/* GHOST — on-grid but silent on social. Pale #EEE. */
.agp-grid-toggle.ghost {
    color: #EEEEEE;
    border-color: rgba(238,238,238,0.30);
    background: rgba(238,238,238,0.04);
}
/* BLACKOUT — ghost + untaggable + unknown to others. Black with a white glow. */
.agp-grid-toggle.blackout {
    color: #ffffff;
    background: #000000;
    border-color: rgba(255,255,255,0.45);
    text-shadow: 0 0 8px rgba(255,255,255,0.85), 0 0 16px rgba(255,255,255,0.4);
    box-shadow: 0 0 10px rgba(255,255,255,0.35), inset 0 0 8px rgba(255,255,255,0.12);
}
.agp-grid-toggle:hover {
    border-color: var(--accent); color: var(--accent); animation: none;
}
.agp-translate-toggle {
    font-family: var(--font-mono);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 2.2px;
    padding: 3px 8px;
    margin: 6px auto 0;
    cursor: pointer;
    border: 1px solid rgba(var(--memory-rgb),0.18);
    background: transparent;
    color: rgba(var(--text-muted-rgb),0.82);
    display: block;
    width: fit-content;
    text-align: center;
    transition: border-color 0.2s, color 0.2s, box-shadow 0.2s;
}
.agp-translate-toggle.on {
    color: rgba(var(--memory-rgb),0.95);
    border-color: rgba(var(--memory-rgb),0.42);
    box-shadow: 0 0 8px rgba(var(--memory-rgb),0.12);
}
.agp-translate-toggle:hover {
    color: var(--accent);
    border-color: rgba(var(--accent-rgb),0.45);
}
@keyframes gridGlitchOn {
    0%   { text-shadow: 0 0 4px rgba(140,190,160,0.3); box-shadow: 0 0 4px rgba(140,190,160,0.08); opacity: 1; }
    15%  { text-shadow: 0 0 8px rgba(140,190,160,0.6); box-shadow: 0 0 8px rgba(140,190,160,0.15); opacity: 1; }
    18%  { opacity: 0.6; text-shadow: 0 0 2px rgba(140,190,160,0.2); }
    22%  { opacity: 1; text-shadow: 0 0 6px rgba(140,190,160,0.5); }
    50%  { text-shadow: 0 0 3px rgba(140,190,160,0.2); box-shadow: 0 0 3px rgba(140,190,160,0.05); opacity: 1; }
    70%  { text-shadow: 0 0 10px rgba(140,190,160,0.7); box-shadow: 0 0 10px rgba(140,190,160,0.18); opacity: 1; }
    72%  { opacity: 0.5; }
    75%  { opacity: 1; }
    100% { text-shadow: 0 0 4px rgba(140,190,160,0.3); box-shadow: 0 0 4px rgba(140,190,160,0.08); opacity: 1; }
}
@keyframes gridGlitchOff {
    0%   { text-shadow: 0 0 4px rgba(200,120,120,0.3); box-shadow: 0 0 4px rgba(200,120,120,0.08); opacity: 1; }
    12%  { opacity: 0.5; text-shadow: 0 0 2px rgba(200,120,120,0.1); }
    16%  { opacity: 1; text-shadow: 0 0 6px rgba(200,120,120,0.5); }
    30%  { text-shadow: 0 0 8px rgba(200,120,120,0.6); box-shadow: 0 0 8px rgba(200,120,120,0.15); opacity: 1; }
    33%  { opacity: 0.4; }
    36%  { opacity: 0.9; }
    38%  { opacity: 0.55; }
    42%  { opacity: 1; }
    60%  { text-shadow: 0 0 3px rgba(200,120,120,0.2); box-shadow: 0 0 3px rgba(200,120,120,0.05); }
    85%  { text-shadow: 0 0 7px rgba(200,120,120,0.5); box-shadow: 0 0 7px rgba(200,120,120,0.12); opacity: 1; }
    88%  { opacity: 0.6; }
    91%  { opacity: 1; }
    100% { text-shadow: 0 0 4px rgba(200,120,120,0.3); box-shadow: 0 0 4px rgba(200,120,120,0.08); opacity: 1; }
}
.pf-psych-generating {
    position: relative; display: flex;
    align-items: center; justify-content: center; min-height: 200px;
}
.pf-psych-generating-star-field {
    position: absolute; inset: 0; pointer-events: none; overflow: hidden;
}
.pf-psych-generating-star {
    position: absolute; color: var(--accent); font-size: 12px; opacity: 0;
    animation: agp-star-drift 2.4s ease-in-out infinite;
}
@keyframes agp-star-drift {
    0%, 100% { opacity: 0; transform: scale(0.6); }
    50%      { opacity: 1; transform: scale(1); }
}
.pf-psych-generating-tag {
    font-family: var(--font-sans); font-size: 12px;
    text-transform: uppercase; letter-spacing: 0.15em;
    padding: 6px 16px; background: rgba(var(--accent-rgb),0.1);
    color: var(--accent); z-index: 1;
    animation: agp-tag-pulse 2s ease-in-out infinite;
}
@keyframes agp-tag-pulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}
.agp-sidebar-divider { height: 1px; background: rgba(var(--border-rgb),0.1); margin: 14px 16px; }
.agp-sidebar-item {
    display: flex; align-items: center; gap: 8px;
    width: 100%; padding: 9px 12px;
    background: none; border: none;
    border-left: 2px solid transparent;
    color: var(--text-secondary);
    font-family: var(--font-sans); font-size: 14px;
    letter-spacing: 0.5px; cursor: pointer;
    transition: color 0.2s, border-color 0.2s, background 0.2s;
    text-align: left;
}
.agp-sidebar-item:hover { color: var(--text-primary); background: rgba(var(--accent-rgb),0.03); }
.agp-sidebar-item.active {
    color: var(--accent); border-left-color: var(--accent);
    background: rgba(var(--accent-rgb),0.04);
}
.agp-sidebar-diamond { font-size: 12px; opacity: 0.5; }
.agp-content {
    flex: 1; min-width: 0; overflow-y: auto; position: relative;
    /* overflow-y:auto silently makes overflow-x compute to `auto` too, so a
       thumbnail scrollIntoView({inline:'center'}) could scroll this sideways and
       drag the absolutely-positioned relationship card left under the sidebar.
       Pin it: no horizontal scroll here ever. */
    overflow-x: hidden;
}
.agp-panel { display: none; padding: 32px 36px 60px; }
.agp-panel.active { display: block; }
.agp-panel[data-tab="dossier"].active { display: flex; padding: 0; height: 100%; }
.agp-panel[data-tab="dossier"] iframe { flex: 1; }
.agp-panel[data-tab="activity"] .ap-hero {
    display: grid;
    grid-template-columns: 3fr 2fr;
    gap: 32px;
    margin-bottom: 40px;
}
.agp-panel[data-tab="activity"] .ap-hero-left {
    position: relative;
    overflow: hidden;
    min-height: 220px;
    background: var(--bg-card);
}
.agp-panel[data-tab="activity"] .ap-hero-img {
    width: 100%;
    height: 100%;
    min-height: 220px;
    display: block;
    object-fit: cover;
    image-rendering: auto;
    transform: translateZ(0);
    backface-visibility: hidden;
    filter: grayscale(1) brightness(0.8);
    transition: filter 0.6s;
}
.agp-panel[data-tab="activity"] .ap-hero-left:hover .ap-hero-img {
    filter: grayscale(0) brightness(1);
}
.agp-panel[data-tab="activity"] .ap-hero-overlay {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    padding: 18px 24px;
    background: linear-gradient(transparent, var(--bg-panel));
    line-height: 1.3;
}
.agp-panel[data-tab="activity"] .ap-hero-overlay-role {
    font-family: var(--font-mono);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: rgba(255,255,255,0.45);
}
.agp-panel[data-tab="activity"] .ap-hero-overlay-name {
    font-family: var(--font-serif);
    font-style: italic;
    font-weight: 200;
    font-size: 36px;
    color: var(--accent);
    margin-top: 2px;
    line-height: 1.1;
}
.agp-panel[data-tab="activity"] .ap-hero-overlay-desc {
    font-family: var(--font-serif);
    font-style: italic;
    font-weight: 200;
    font-size: 14px;
    color: rgba(255,255,255,0.6);
    margin-top: 3px;
}
.agp-panel[data-tab="activity"] .ap-hero-right-wrap {
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.ap-hero-right {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 20px;
    justify-content: flex-start;
}
.ap-stat-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 14px;
    border-bottom: 1px solid rgba(var(--border-rgb),0.1);
    padding-bottom: 8px;
}
.ap-stat-label {
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--text-muted);
}
.ap-stat-value {
    font-family: var(--font-serif);
    font-size: 13px;
    font-style: italic;
    font-weight: 200;
    color: var(--accent);
    text-align: right;
}
.ap-mood-value {
    letter-spacing: 1px;
    text-transform: uppercase;
}
.ap-personality {
    font-family: var(--font-serif);
    font-size: 13px;
    font-style: italic;
    font-weight: 200;
    line-height: 1.7;
    color: var(--text-secondary);
}
.ap-mobile-heart-card {
    display: none;
    height: 78px;
    margin: 14px 0 18px;
    position: relative;
}
.ap-mobile-heart-layer {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: visible;
}
.kh-square { background: var(--kh-color, #8C8C92); }
.kh-on-black .kh-square { box-shadow: 0 0 7px rgba(255,255,255,0.55), 0 0 15px rgba(255,255,255,0.28); }
/* La Ronde (Game Bar) launch modal — hosts /laronde.html in an iframe. Launched
   from the swords button in the Game Bar room; full-screen on mobile. */
.laronde-modal-scrim{ position:fixed; inset:0; z-index:200; background:rgba(0,0,0,.72); display:flex; align-items:center; justify-content:center; opacity:0; transition:opacity .2s ease; }
.laronde-modal-scrim.open{ opacity:1; }
.laronde-modal{ width:90vw; height:90vh; box-shadow:0 24px 70px rgba(0,0,0,.6); border:1px solid rgba(var(--accent-rgb),0.18); }
.laronde-frame{ width:100%; height:100%; border:none; display:block; background:var(--bg-deepest,#13101A); }
@media (max-width:900px){ .laronde-modal{ width:100vw; height:100dvh; border:none; } }
/* ---- Game Bar library: the swords-button game picker (reuses the .laronde-modal shell) ---- */
.gamebar-box{ overflow:hidden; }
.gamebar-lib{ width:100%; height:100%; display:flex; flex-direction:column;
  background:radial-gradient(circle at 50% -10%, rgba(var(--accent-rgb),.12), transparent 55%), var(--bg-deepest,#13101A); }
.gamebar-lib-head{ position:relative; text-align:center; padding:34px 20px 12px; flex:0 0 auto; }
.gamebar-lib-kicker{ font-family:var(--font-serif,'Newsreader',serif); font-style:italic; text-transform:uppercase;
  letter-spacing:.28em; font-size:12px; color:rgba(var(--accent-rgb),.85); }
.gamebar-lib-title{ font-family:var(--font-serif,'Newsreader',serif); font-style:italic; font-weight:200;
  font-size:clamp(30px,5vw,52px); letter-spacing:.03em; color:var(--accent); margin-top:6px; line-height:1; }
.gamebar-lib-close{ position:absolute; top:22px; right:26px; background:none; border:none; color:var(--text-muted,#8a8f98);
  font-size:30px; line-height:1; cursor:pointer; transition:.15s; }
.gamebar-lib-close:hover{ color:var(--accent); }
.gamebar-lib-grid{ flex:1; min-height:0; overflow-y:auto; display:grid; align-content:center; justify-content:center;
  justify-items:center; grid-template-columns:repeat(auto-fit, minmax(230px, 300px)); gap:24px; padding:18px clamp(20px,6vw,70px) 54px; }
.gamebar-card{ width:100%; background:rgba(var(--bg-panel-rgb,24,27,32),.5); border:1px solid rgba(var(--border-rgb,74,84,94),.4);
  cursor:pointer; transition:.18s; text-align:left; padding:0 0 16px; overflow:hidden; color:inherit; font:inherit; }
.gamebar-card:hover{ border-color:var(--accent); box-shadow:0 0 34px rgba(var(--accent-rgb),.16); transform:translateY(-3px); }
.gamebar-card-art{ width:100%; aspect-ratio:16/10; background-size:cover; background-position:center;
  background-color:rgba(var(--accent-rgb),.08); border-bottom:1px solid rgba(var(--border-rgb,74,84,94),.3); }
/* split art: two cover-cropped halves (copper | silver) with a hairline divider */
.gamebar-card-art.split{ display:flex; }
.gamebar-card-art.split span{ flex:1; background-size:cover; background-position:center 42%; }
.gamebar-card-art.split span:first-child{ border-right:1px solid rgba(255,255,255,.22); }
.gamebar-card-name{ font-family:var(--font-mono,'Space Mono',monospace); font-weight:700; text-transform:uppercase;
  letter-spacing:.06em; font-size:18px; color:var(--text-primary,#D0D4D8); padding:14px 18px 3px; }
.gamebar-card-tag{ font-family:var(--font-serif,'Newsreader',serif); font-style:italic; font-size:13px;
  color:var(--text-muted,#8a8f98); padding:0 18px; line-height:1.45; }
@media (max-width:900px){ .gamebar-lib-grid{ grid-template-columns:1fr; max-width:360px; margin:0 auto; } }
/* Swords launcher in the Game Bar chat input — accent-tinted icon button. */
.chat-swords-btn{ color:var(--accent); }
.chat-swords-btn:hover{ color:var(--accent); border-color:var(--accent-deep); }
/* La Ronde result card — the recap broadcast to the room when a match ends. */
.laronde-result-card{ width:min(100%,440px); margin:0 auto; padding:14px 18px; border:1px solid var(--border-bright); background:var(--bg-card); text-align:left; }
.laronde-result-card .lrr-kicker{ font-family:var(--font-serif); font-style:italic; text-transform:uppercase; letter-spacing:.18em; font-size:12px; color:var(--accent); margin-bottom:8px; }
.laronde-result-card .lrr-head{ font-family:var(--font-serif); font-style:italic; font-size:14px; color:var(--text-primary); margin-bottom:10px; }
.laronde-result-card .lrr-rounds{ display:flex; flex-direction:column; gap:4px; margin-bottom:10px; }
.laronde-result-card .lrr-round{ font-family:var(--font-mono); font-size:12px; line-height:1.5; color:var(--text-secondary); }
.laronde-result-card .lrr-final{ font-family:var(--font-serif); font-style:italic; font-size:13px; color:var(--accent); padding-top:8px; border-top:1px solid var(--border); }
/* Game Bar co-space panel — the GAMES tab (the repurposed Employment tab): a
   stacked backlog of the same La Ronde recap cards that broadcast at match end. */
.cos-games-list{ display:flex; flex-direction:column; gap:18px; padding:4px 0 8px; }
.cos-games-entry{ display:flex; flex-direction:column; gap:7px; }
.cos-games-date{ font-family:var(--font-mono); font-size:12px; letter-spacing:1.5px; text-transform:uppercase; color:var(--text-muted); padding-left:2px; }
.cos-games-list .laronde-result-card{ width:100%; max-width:none; }
.cos-games-empty{ padding:34px 16px; text-align:center; font-family:var(--font-serif); font-style:italic; font-size:14px; color:var(--text-muted); line-height:1.6; }
.cos-games-error{ color:#DE5858; }
.cos-games-warning{ border:1px solid rgba(222,88,88,.35); color:#DE5858; padding:10px 12px; font-family:var(--font-mono); font-size:11px; letter-spacing:1.2px; text-transform:uppercase; line-height:1.5; background:rgba(var(--bg-card-rgb,20,20,24),.42); }
.cos-games-retry{ margin-top:12px; border:1px solid currentColor; background:transparent; color:inherit; font-family:var(--font-mono); font-size:11px; letter-spacing:1.5px; text-transform:uppercase; padding:7px 12px; cursor:pointer; }
.cos-games-retry:hover{ background:rgba(222,88,88,.12); }
.ap-mobile-heart-layer .kh-square {
    width: 10px;
    height: 10px;
}
.ap-slider-wrap {
    margin-top: 4px;
}
.ap-slider-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 14px;
    margin-bottom: 6px;
}
.ap-slider-track {
    position: relative;
    height: 2px;
    background: rgba(var(--border-rgb),0.2);
}
.ap-slider-fill {
    height: 100%;
    background: var(--accent);
    transition: width 0.5s ease;
}
.ap-work-hours-profile {
    padding-top: 2px;
    border-top: 1px solid rgba(var(--border-rgb),0.1);
}
.ap-work-hours-row {
    margin-top: 8px;
    display: grid;
    grid-template-columns: minmax(0, 0.8fr) minmax(0, 1fr);
    gap: 3px 12px;
}
.ap-work-hours-title {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-family: var(--font-serif);
    font-size: 14px;
    font-style: italic;
    font-weight: 200;
    color: var(--accent);
}
.ap-work-hours-place {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-family: var(--font-serif);
    font-size: 14px;
    font-style: italic;
    font-weight: 200;
    color: var(--text-secondary);
    text-align: right;
}
.ap-work-hours-meta {
    grid-column: 1 / -1;
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 1.4px;
    text-transform: uppercase;
    color: var(--text-muted);
}
.ap-lower {
    display: grid;
    grid-template-columns: 3fr 2fr;
    gap: 32px;
    margin-bottom: 40px;
}
.ap-grid-section {
    min-width: 0;
}
.ap-grid-head {
    display: flex;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 16px;
}
.ap-grid-title {
    font-family: var(--font-serif);
    font-size: 18px;
    font-style: italic;
    font-weight: 200;
    color: var(--text-secondary);
}
.ap-grid-subtitle {
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--text-muted);
}
.ap-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
}
.ap-grid-col {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
}
.ap-grid-cell {
    aspect-ratio: 1;
    border-radius: 2px;
    transition: transform 0.3s;
    cursor: pointer;
}
.ap-grid-cell:hover {
    transform: scale(1.15);
}
.ap-grid-cell-active {
    outline: 1px solid rgba(var(--accent-rgb), 0.8);
    outline-offset: 1px;
}
.ap-grid-helper {
    margin-top: 12px;
    min-height: 1.4em;
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 12px;
    line-height: 1.4;
    letter-spacing: 0.02em;
    color: rgba(var(--text-primary-rgb), 0.78);
    text-align: center;
    white-space: pre-line;
}

/* ============================================= THE LAUX EXCHANGE (stocks) */
.stk-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 140;
    background: rgba(var(--bg-deepest-rgb), 0.9);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    justify-content: center;
    align-items: center;
    padding: 24px;
}
.stk-overlay.open { display: flex; }
.stk-window {
    width: 75vw;
    height: 80vh;
    display: flex;
    flex-direction: column;
    background: rgba(var(--bg-panel-rgb), 0.96);
    border: 1px solid rgba(var(--accent-rgb), 0.14);
    border-radius: 0;
    box-shadow: 0 24px 60px rgba(0,0,0,0.55), 0 0 80px rgba(var(--accent-rgb),0.03);
    animation: am-modal-rise 0.22s ease-out;
    position: relative;
    overflow: hidden;
}
.stk-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px 26px;
    border-bottom: 1px solid rgba(var(--border-rgb), 0.3);
    background: rgba(var(--bg-deepest-rgb), 0.4);
}
.stk-header-icon {
    width: 36px;
    height: 36px;
    color: var(--accent);
    flex-shrink: 0;
}
.social-notification-icon {
    width: 14px;
    height: 14px;
    color: var(--accent);
    vertical-align: -2px;
}
.stk-header-title { flex: 1; min-width: 0; }
.stk-kicker {
    display: block;
    font-family: var(--font-serif);
    font-style: italic;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    font-size: 12px;
    color: rgba(var(--accent-rgb), 0.7);
    margin-bottom: 4px;
}
.stk-header-title h2 {
    margin: 0;
    font-family: var(--font-serif);
    font-weight: 300;
    font-style: italic;
    font-size: 22px;
    letter-spacing: 0.02em;
    color: var(--accent);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.stk-header-bal { text-align: right; }
.stk-header-bal span {
    display: block;
    font-family: var(--font-serif);
    font-style: italic;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 12px;
    color: var(--text-muted);
}
.stk-header-bal b {
    font-family: var(--font-mono);
    font-size: 20px;
    color: var(--accent);
}
.stk-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
    transition: color 0.15s;
}
.stk-close:hover { color: var(--accent); }
.stk-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 22px 26px 28px;
}
.stk-empty {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-serif);
    font-style: italic;
    color: var(--text-muted);
}
.stk-msg {
    margin-bottom: 16px;
    padding: 9px 14px;
    border-left: 2px solid rgba(var(--accent-rgb), 0.5);
    background: rgba(var(--accent-rgb), 0.05);
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 15px;
    color: rgba(var(--text-primary-rgb), 0.9);
}
.stk-list { display: flex; flex-direction: column; gap: 12px; }
/* Held stocks split into two columns: stock info | your position */
.stk-row-held {
    display: grid;
    grid-template-columns: 1.45fr 1fr;
    gap: 20px;
    align-items: stretch;
}
.stk-row-held .stk-col-info { min-width: 0; }
.stk-row-held .stk-row-main { margin-bottom: 12px; }
.stk-row-held .stk-row-hold { justify-content: flex-end; }
.stk-col-position {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    gap: 6px;
    padding-left: 20px;
    border-left: 1px solid rgba(var(--accent-rgb), 0.18);
}
.stk-pos-label {
    font-family: var(--font-serif);
    font-style: italic;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    font-size: 12px;
    color: rgba(var(--accent-rgb), 0.7);
}
.stk-pos-main {
    font-family: var(--font-mono);
    font-size: 17px;
    color: var(--text-secondary);
}
.stk-pos-main b { color: var(--accent); }
.stk-pos-sub {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 14px;
    color: var(--text-muted);
}
.stk-row {
    border: 1px solid rgba(var(--border-rgb), 0.28);
    background: rgba(var(--bg-card-rgb), 0.5);
    padding: 16px 18px;
    transition: border-color 0.2s, background 0.2s;
}
.stk-row:hover { border-color: rgba(var(--accent-rgb), 0.3); }
.stk-row-pending { border-color: rgba(var(--accent-rgb), 0.55); background: rgba(var(--accent-rgb), 0.05); }
.stk-row-main {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 12px;
}
.stk-tick b {
    font-family: var(--font-mono);
    font-size: 18px;
    letter-spacing: 0.06em;
    color: var(--accent);
    margin-right: 10px;
}
.stk-tick span { font-size: 15px; color: var(--text-secondary); }
.stk-price { text-align: right; white-space: nowrap; }
.stk-price b {
    font-family: var(--font-mono);
    font-size: 20px;
    color: var(--text-primary);
    margin-right: 10px;
}
.stk-change { font-family: var(--font-mono); font-size: 14px; }
.stk-change.stk-up { color: rgba(143, 184, 114, 0.95); }
.stk-change.stk-down { color: rgba(196, 104, 104, 0.95); }
.stk-change.stk-flat { color: var(--text-muted); }
.stk-row-hold {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
}
.stk-hold-label {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 14.5px;
    color: var(--text-secondary);
}
.stk-actions { display: flex; align-items: center; gap: 8px; }
.stk-qty {
    width: 56px;
    padding: 6px 8px;
    border: 1px solid rgba(var(--border-rgb), 0.4);
    border-radius: 0;
    background: rgba(var(--bg-deepest-rgb), 0.6);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 15px;
    text-align: center;
    outline: none;
}
.stk-qty:focus { border-color: rgba(var(--accent-rgb), 0.55); }
.stk-buy, .stk-sell, .stk-confirm-yes, .stk-confirm-no {
    padding: 6px 14px;
    border-radius: 0;
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 15px;
    letter-spacing: 0.03em;
    cursor: pointer;
    transition: background 0.18s, border-color 0.18s, color 0.18s;
}
.stk-buy, .stk-confirm-yes {
    border: 1px solid rgba(143, 184, 114, 0.4);
    background: rgba(143, 184, 114, 0.08);
    color: rgba(143, 184, 114, 0.95);
}
.stk-buy:hover, .stk-confirm-yes:hover { background: rgba(143, 184, 114, 0.18); }
.stk-sell, .stk-confirm-no {
    border: 1px solid rgba(196, 104, 104, 0.4);
    background: rgba(196, 104, 104, 0.07);
    color: rgba(196, 104, 104, 0.95);
}
.stk-sell:hover, .stk-confirm-no:hover { background: rgba(196, 104, 104, 0.16); }
.stk-sell:disabled { opacity: 0.32; cursor: not-allowed; }
.stk-confirm { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.stk-confirm > span {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 14.5px;
    color: var(--accent);
}
.stk-confirm-no {
    border-color: rgba(var(--border-rgb), 0.5);
    background: transparent;
    color: var(--text-muted);
}
.stk-confirm-no:hover { background: rgba(var(--bg-hover-rgb, 74,84,94), 0.12); color: var(--text-secondary); }
.stk-note {
    margin-top: 20px;
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 13.5px;
    letter-spacing: 0.03em;
    color: var(--text-muted);
    text-align: center;
}
@media (max-width: 900px) {
    .stk-overlay { padding: 0; }
    .stk-window { width: 100vw; height: 100vh; border: none; }
    .stk-row-hold { flex-direction: column; align-items: stretch; }
    .stk-actions { justify-content: flex-end; }
    .stk-row-held { grid-template-columns: 1fr; gap: 14px; }
    .stk-col-position {
        border-left: none;
        border-top: 1px solid rgba(var(--accent-rgb), 0.18);
        padding-left: 0;
        padding-top: 14px;
    }
}
@supports (height: 100dvh) {
    @media (max-width: 900px) { .stk-window { height: 100dvh; } }
}

/* ===== Laux Exchange — tabs + Portfolio view ===== */
.stk-tabs {
    display: flex;
    padding: 0 26px;
    border-bottom: 1px solid rgba(var(--border-rgb), 0.3);
    background: rgba(var(--bg-deepest-rgb), 0.25);
}
.stk-tab {
    appearance: none;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    padding: 12px 18px;
    cursor: pointer;
    font-family: var(--font-serif);
    font-style: italic;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    font-size: 13px;
    color: var(--text-muted);
    transition: color 0.18s, border-color 0.18s;
}
.stk-tab:hover { color: var(--text-secondary); }
.stk-tab-on { color: var(--accent); border-bottom-color: var(--accent); }

.stk-pf-empty {
    min-height: 200px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 15px;
    line-height: 1.6;
    color: var(--text-muted);
    padding: 20px;
}
.stk-pf-empty b { color: var(--accent); font-style: normal; }

.stk-pf-totals {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    margin-bottom: 20px;
}
.stk-pf-stat {
    border: 1px solid rgba(var(--border-rgb), 0.28);
    background: rgba(var(--bg-card-rgb), 0.5);
    padding: 14px 16px;
    text-align: center;
}
.stk-pf-stat > span {
    display: block;
    font-family: var(--font-serif);
    font-style: italic;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-size: 12px;
    color: rgba(var(--accent-rgb), 0.7);
    margin-bottom: 6px;
}
.stk-pf-stat b { font-family: var(--font-mono); font-size: 22px; color: var(--text-primary); }
.stk-pf-stat.stk-up b { color: rgba(143, 184, 114, 0.95); }
.stk-pf-stat.stk-down b { color: rgba(196, 104, 104, 0.95); }
.stk-pf-stat.stk-flat b { color: var(--text-muted); }

.stk-pf-chart {
    border: 1px solid rgba(var(--border-rgb), 0.28);
    background: rgba(var(--bg-deepest-rgb), 0.35);
    padding: 14px 16px 10px;
    margin-bottom: 22px;
}
.stk-pf-chart-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}
.stk-pf-chart-title {
    font-family: var(--font-serif);
    font-style: italic;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-size: 12px;
    color: rgba(var(--accent-rgb), 0.75);
}
.stk-pf-legend {
    display: flex;
    align-items: center;
    gap: 4px;
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 12px;
    color: var(--text-muted);
}
.stk-leg { display: inline-block; width: 14px; height: 0; border-top: 2px solid currentColor; margin: 0 3px 0 9px; vertical-align: middle; }
.stk-leg-inv { color: var(--text-muted); border-top-style: dashed; }
.stk-leg-val { color: var(--accent); }
.stk-chart-svg { display: block; width: 100%; height: auto; }
.stk-chart-inv { fill: none; stroke: var(--text-muted); stroke-width: 1.5px; stroke-dasharray: 4 3; stroke-linejoin: round; stroke-linecap: round; opacity: 0.85; }
.stk-chart-val { fill: none; stroke: var(--accent); stroke-width: 2px; stroke-linejoin: round; stroke-linecap: round; }
.stk-chart-empty {
    padding: 28px 12px;
    text-align: center;
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 14px;
    color: var(--text-muted);
}
.stk-pf-chart-foot {
    display: flex;
    justify-content: space-between;
    margin-top: 4px;
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}

.stk-pf-cards { display: flex; flex-direction: column; gap: 14px; }
.stk-pf-card {
    border: 1px solid rgba(var(--border-rgb), 0.28);
    background: rgba(var(--bg-card-rgb), 0.5);
    padding: 14px 16px 12px;
}
.stk-pf-card-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
}
.stk-pf-card-id b {
    font-family: var(--font-mono);
    font-size: 17px;
    letter-spacing: 0.06em;
    color: var(--accent);
    margin-right: 9px;
}
.stk-pf-card-id span { font-size: 14px; color: var(--text-secondary); }
.stk-pf-card-now { font-family: var(--font-mono); font-size: 15px; color: var(--text-secondary); white-space: nowrap; }
.stk-pf-card-now b { color: var(--accent); }
.stk-pf-none { font-family: var(--font-serif); font-style: italic; font-size: 13px; color: var(--text-muted); }
.stk-spark-svg { display: block; width: 100%; height: auto; margin: 8px 0 6px; }
.stk-spark-line { fill: none; stroke: rgba(var(--accent-rgb), 0.8); stroke-width: 1.5px; stroke-linejoin: round; stroke-linecap: round; }
.stk-spark-dot { fill: var(--accent); stroke: rgba(var(--bg-deepest-rgb), 0.9); stroke-width: 1px; }
.stk-pf-card-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--text-muted);
}
.stk-pf-card-stats b { color: var(--text-secondary); }
.stk-pf-card-stats .stk-up { color: rgba(143, 184, 114, 0.95); }
.stk-pf-card-stats .stk-down { color: rgba(196, 104, 104, 0.95); }
.stk-pf-card-stats .stk-flat { color: var(--text-muted); }
.stk-pf-soldnote { font-family: var(--font-serif); font-style: italic; }

.stk-buys {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    font-family: var(--font-mono);
    font-size: 12.5px;
}
.stk-buys th {
    text-align: left;
    font-family: var(--font-serif);
    font-style: italic;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-size: 12px;
    color: rgba(var(--accent-rgb), 0.6);
    padding: 4px 8px;
    border-bottom: 1px solid rgba(var(--border-rgb), 0.3);
}
.stk-buys td {
    padding: 5px 8px;
    color: var(--text-secondary);
    border-bottom: 1px solid rgba(var(--border-rgb), 0.14);
}
.stk-buys tbody tr:last-child td { border-bottom: none; }
.stk-buys th:nth-child(2), .stk-buys td:nth-child(2),
.stk-buys th:nth-child(3), .stk-buys td:nth-child(3) { text-align: right; }

.stk-trigger-note { margin-top: 16px; }
.stk-trigger-note b { color: rgba(var(--accent-rgb), 0.85); font-style: normal; }

.stk-inv-totals {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 20px;
}
.stk-inv-totals .stk-pf-stat b {
    font-size: 19px;
}
.stk-inv-board {
    display: flex;
    flex-direction: column;
    gap: 13px;
}
.stk-inv-row {
    display: grid;
    grid-template-columns: 64px minmax(0, 1fr);
    gap: 16px;
    align-items: stretch;
    border: 1px solid rgba(var(--border-rgb), 0.28);
    background:
        linear-gradient(135deg, rgba(var(--accent-rgb), 0.07), transparent 48%),
        rgba(var(--bg-card-rgb), 0.5);
    padding: 15px 16px;
    transition: border-color 0.18s, background 0.18s;
}
.stk-inv-row:hover {
    border-color: rgba(var(--accent-rgb), 0.32);
    background:
        linear-gradient(135deg, rgba(var(--accent-rgb), 0.1), transparent 52%),
        rgba(var(--bg-card-rgb), 0.58);
}
.stk-inv-mark {
    min-height: 68px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(var(--accent-rgb), 0.22);
    background: rgba(var(--bg-deepest-rgb), 0.36);
    position: relative;
}
.stk-inv-mark::before,
.stk-inv-mark::after {
    content: '';
    position: absolute;
    left: 50%;
    width: 18px;
    height: 1px;
    transform: translateX(-50%);
    background: rgba(var(--accent-rgb), 0.5);
}
.stk-inv-mark::before { top: 13px; }
.stk-inv-mark::after { bottom: 13px; }
.stk-inv-mark span {
    font-family: var(--font-mono);
    font-size: 22px;
    color: var(--accent);
}
.stk-inv-main {
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 10px;
}
.stk-inv-head,
.stk-inv-foot {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
}
.stk-inv-place {
    min-width: 0;
}
.stk-inv-place b {
    display: block;
    font-family: var(--font-serif);
    font-style: italic;
    font-weight: 300;
    font-size: 18px;
    color: var(--accent);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.stk-inv-place span {
    display: block;
    margin-top: 2px;
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 13px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.stk-inv-stakes {
    flex: 0 0 auto;
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.stk-inv-stakes b {
    color: var(--accent);
    font-size: 18px;
}
.stk-inv-track {
    height: 6px;
    background: rgba(var(--bg-deepest-rgb), 0.55);
    border: 1px solid rgba(var(--border-rgb), 0.18);
    overflow: hidden;
}
.stk-inv-track span {
    display: block;
    width: var(--stk-inv-fill, 18%);
    height: 100%;
    background: linear-gradient(90deg, rgba(var(--accent-rgb), 0.35), rgba(143, 184, 114, 0.85));
}
.stk-inv-foot {
    flex-wrap: wrap;
    justify-content: flex-start;
    font-family: var(--font-mono);
    font-size: 12.5px;
    color: var(--text-muted);
}
.stk-inv-foot span {
    padding-right: 12px;
    border-right: 1px solid rgba(var(--border-rgb), 0.22);
}
.stk-inv-foot span:last-child {
    border-right: 0;
    padding-right: 0;
}
.stk-inv-foot b {
    color: var(--text-secondary);
    font-weight: normal;
}

@media (max-width: 900px) {
    .stk-tabs { padding: 0 16px; }
    .stk-tab {
        flex: 1 1 0;
        min-width: 0;
        padding: 12px 4px;
        font-size: 12px;
        letter-spacing: 0.08em;
        text-align: center;
    }
    .stk-pf-totals { gap: 8px; }
    .stk-inv-totals { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .stk-pf-stat { padding: 10px 6px; }
    .stk-pf-stat b,
    .stk-inv-totals .stk-pf-stat b { font-size: 18px; }
    .stk-pf-stat > span { font-size: 12px; letter-spacing: 0.1em; }
    .stk-inv-row { grid-template-columns: 48px minmax(0, 1fr); gap: 12px; padding: 13px 12px; }
    .stk-inv-mark { min-height: 74px; }
    .stk-inv-head { align-items: flex-start; }
    .stk-inv-place b { font-size: 16px; }
    .stk-inv-stakes { text-align: right; }
}

/* Laux Exchange away-tab — in agent "away" states the chat input row (and its
   ₤ badge) is hidden, so the Laux count rides a thin tab that peeks up from the
   bottom edge. Same deepest-bg fill as the chat; a hair of border marks it as a
   tab, and it rises a touch on hover. Tap opens the Laux Exchange. */
.chat-body { position: relative; }
.chat-stock-corner {
    position: absolute;
    right: 14px;
    bottom: 0;
    height: 20px;
    padding: 0 11px;
    margin: 0;
    display: none;
    align-items: center;
    gap: 5px;
    background: var(--bg-deepest);
    border: 1px solid var(--border-bright);
    border-bottom: 0;
    cursor: pointer;
    z-index: 40;
    transition: transform 0.18s ease, color 0.18s, border-color 0.18s;
}
.chat-stock-corner:hover {
    transform: translateY(-3px);
    border-color: var(--accent-deep);
}
.chat-stock-corner .chat-stock-corner-mark {
    position: static;
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 12px;
    color: var(--text-muted);
}
.chat-stock-corner .chat-stock-corner-num {
    position: static;
    font-family: var(--font-sans);
    font-weight: var(--font-sans-weight, 250);
    font-size: 12px;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}
.chat-stock-corner:hover .chat-stock-corner-mark,
.chat-stock-corner:hover .chat-stock-corner-num { color: var(--text-secondary); }
.ap-grid-label {
    margin-bottom: 6px;
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 1.5px;
    text-align: center;
    text-transform: uppercase;
    color: var(--text-muted);
}
.ap-grid-label.ap-today {
    color: var(--accent);
}
.ap-fav-section {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    min-width: 0;
    padding-left: 24px;
    border-left: 1px solid rgba(var(--border-rgb),0.1);
}
.ap-fav-name {
    margin-top: 6px;
    font-family: var(--font-serif);
    font-size: 22px;
    font-style: italic;
    font-weight: 200;
    color: var(--accent);
}
.ap-fav-cat {
    margin-left: 12px;
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--text-muted);
}
.ap-fav-sub {
    margin-top: 6px;
    font-family: var(--font-serif);
    font-size: 13px;
    font-style: italic;
    font-weight: 200;
    line-height: 1.65;
    color: var(--text-secondary);
}
.ap-fav-visits {
    display: block;
    margin-top: 8px;
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--text-muted);
}
.ap-current-location {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(var(--border-rgb),0.1);
}
.ap-current-location-name {
    margin-top: 6px;
    font-family: var(--font-serif);
    font-size: 18px;
    font-style: italic;
    font-weight: 200;
    color: var(--text-secondary);
    transition: color 0.3s, text-shadow 0.3s;
}
.ap-current-location-name.ap-current-location-glow {
    color: var(--accent);
    text-shadow: 0 0 12px rgba(var(--accent-rgb),0.45), 0 0 28px rgba(var(--accent-rgb),0.18);
}
.ap-current-location-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 7px;
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--text-muted);
}
.agp-sidebar-avatar,
.agp-mobile-avatar {
    image-rendering: auto;
    transform: translateZ(0);
    backface-visibility: hidden;
}
.bm-profile-hero-plain {
    min-height: 260px;
    background:
        radial-gradient(circle at 35% 30%, rgba(var(--accent-bright-rgb),0.12), transparent 26%),
        radial-gradient(circle at 68% 64%, rgba(var(--memory-rgb),0.18), transparent 28%),
        rgba(var(--bg-card-rgb),0.58);
}
.bm-journey-mini-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 12px;
}
.bm-journey-mini-stats span {
    border: 1px solid rgba(var(--border-rgb),0.18);
    padding: 10px;
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--text-secondary);
}
.bm-journey-mini-stats strong {
    display: block;
    margin-bottom: 4px;
    font-family: var(--font-serif);
    font-size: 26px;
    font-weight: 300;
    color: var(--accent-bright);
}
.bm-journey-head {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: baseline;
    margin-bottom: 14px;
}
.bm-journey-list {
    display: grid;
    gap: 10px;
}
.bm-journey-row {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 116px;
    gap: 16px;
    align-items: center;
    border: 1px solid rgba(var(--border-rgb),0.18);
    background: rgba(var(--bg-card-rgb),0.28);
    padding: 14px;
}
.bm-journey-row.completed {
    border-color: rgba(var(--accent-rgb),0.28);
    background: rgba(var(--accent-rgb),0.055);
}
.bm-journey-row.in_progress {
    border-color: rgba(var(--memory-rgb),0.34);
    background: rgba(var(--memory-rgb),0.065);
}
.bm-journey-kicker {
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--text-muted);
}
.bm-journey-name {
    margin-top: 4px;
    font-family: var(--font-serif);
    font-size: 24px;
    font-weight: 300;
    font-style: italic;
    color: var(--accent-bright);
}
.bm-journey-body,
.bm-journey-meta {
    margin-top: 8px;
    font-size: 12px;
    line-height: 1.65;
    color: var(--text-secondary);
}
.bm-journey-meta {
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 1.4px;
    text-transform: uppercase;
    color: var(--text-muted);
}
.bm-journey-track {
    height: 78px;
    border: 1px solid rgba(var(--border-rgb),0.2);
    background:
        linear-gradient(0deg, rgba(var(--border-rgb),0.16) 1px, transparent 1px),
        rgba(var(--bg-deepest-rgb),0.34);
    background-size: 100% 13px;
    display: flex;
    align-items: flex-end;
    padding: 5px;
}
.bm-journey-track span {
    display: block;
    height: 100%;
    min-width: 3px;
    background: linear-gradient(180deg, rgba(var(--accent-bright-rgb),0.78), rgba(var(--accent-rgb),0.32));
    box-shadow: 0 0 16px rgba(var(--accent-rgb),0.22);
}
.bm-journey-empty {
    border: 1px solid rgba(var(--border-rgb),0.18);
    padding: 24px;
    font-family: var(--font-serif);
    font-style: italic;
    color: var(--text-secondary);
}
.agp-close {
    position: sticky; top: 0; z-index: 10;
    float: right; margin: 16px 20px 0 0;
    background: none; border: none;
    color: var(--text-muted); font-size: 22px;
    cursor: pointer; transition: color 0.2s;
}
.agp-close:hover { color: var(--accent); }
.agp-psych-section { margin-bottom: 28px; }
.agp-psych-label {
    font-family: var(--font-serif); font-style: italic; font-weight: 200;
    font-size: 12px; text-transform: uppercase; letter-spacing: 3px;
    color: rgba(var(--accent-rgb), 0.8); margin-bottom: 12px;
}
.agp-psych-act {
    font-family: var(--font-serif); font-style: italic;
    font-size: 18px; color: var(--text-secondary);
    text-align: right; margin-bottom: 4px;
}
.home-progress-track { position: relative; width: 100%; height: 2px; background: var(--bg-input); }
.home-progress-fill { position: absolute; left: 0; top: 0; height: 100%; background: var(--accent); transition: width 0.6s ease; }
.home-progress-dot { position: absolute; top: -3px; width: 8px; height: 8px; background: var(--accent); box-shadow: 0 0 8px rgba(var(--accent-rgb),0.5); transition: left 0.6s ease; }
.home-metric { display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; }
.home-metric-header { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-secondary); }
.home-metric-value { color: var(--accent); }
.home-bar-track { width: 100%; height: 3px; background: var(--bg-input); }
.home-bar-fill { height: 100%; background: var(--accent); transition: width 0.6s ease; }
.home-label-metric { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 8px 0; border-top: 1px solid rgba(var(--border-rgb),0.15); }
.home-label-key { font-size: 12px; color: var(--text-secondary); }
.home-label-value { font-family: var(--font-serif); font-style: italic; font-size: 14px; color: var(--accent); text-align: right; }
.archetype-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 4px; }
.archetype-box { background: var(--bg-card); border: 1px solid rgba(var(--border-rgb),0.15); padding: 12px 14px; transition: border-color 0.2s; }
.archetype-box:hover { border-color: var(--accent-border); }
.archetype-key { font-size: 12px; text-transform: uppercase; letter-spacing: 2px; color: var(--text-muted); margin-bottom: 6px; }
.archetype-value { font-family: var(--font-serif); font-style: italic; font-size: 14px; color: var(--accent); line-height: 1.4; }
.archetype-box--code { border-left: 2px solid rgba(var(--accent-rgb),0.2); }
.archetype-value--mono { font-family: var(--font-mono); font-style: normal; font-size: 14px; letter-spacing: 0.5px; }
.archetype-desc { font-family: var(--font-sans); font-size: 12px; color: var(--text-secondary); line-height: 1.5; margin-top: 6px; opacity: 0.7; }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 4px; }
.stat-block { background: var(--bg-card); border: 1px solid rgba(var(--border-rgb),0.15); padding: 10px 8px; text-align: center; transition: border-color 0.2s; }
.stat-block:hover { border-color: var(--accent-border); }
.stat-label { font-size: 12px; text-transform: uppercase; letter-spacing: 2px; color: var(--text-muted); margin-bottom: 4px; }
.stat-value { font-family: var(--font-serif); font-size: 24px; font-weight: 300; color: var(--accent); line-height: 1; margin-bottom: 4px; }
.stat-name { font-size: 12px; text-transform: uppercase; letter-spacing: 1px; color: var(--text-secondary); }
/* Psych report font bumps (+2px) — scoped to the psych panel so shared
   archetype/stat blocks stay at base size in cerebrum, chat sidebar, etc. */
.agp-panel[data-tab="psych"] .archetype-key { font-size: 12px; }
.agp-panel[data-tab="psych"] .archetype-value { font-size: 16px; }
.agp-panel[data-tab="psych"] .stat-label { font-size: 12px; }
.agp-panel[data-tab="psych"] .stat-value { font-size: 26px; }
.agp-panel[data-tab="psych"] .stat-name { font-size: 12px; }
.agp-mem-toolbar { padding: 0 0 20px; border-bottom: 1px solid rgba(var(--border-rgb),0.1); margin-bottom: 20px; }
.agp-mem-toolbar .memory-input { width: 100%; margin-bottom: 6px; }
.agp-mem-row { display: flex; gap: 6px; align-items: center; }
.agp-mem-search-row { margin-top: 8px; }
.agp-mem-search-row .memory-search-input { width: 100%; }
.agp-mem-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 0;
}
.agp-mem-card {
    background: var(--bg-panel); padding: 24px;
    border-top: 1px solid rgba(var(--accent-rgb),0.12);
    border-left: 1px solid rgba(var(--border-rgb),0.06);
    display: flex; flex-direction: column;
    min-height: 120px; position: relative; transition: background 0.2s;
}
.agp-mem-card:hover { background: rgba(var(--accent-rgb),0.02); }
.agp-mem-card-category {
    font-family: var(--font-sans); font-size: 12px;
    text-transform: uppercase; letter-spacing: 2px; color: var(--accent);
    margin-bottom: 8px;
}
.agp-mem-auto {
    font-size: 12px; letter-spacing: 1.5px; color: var(--text-muted);
    border: 1px solid var(--border); padding: 1px 5px; margin-left: 6px;
}
.agp-mem-card-content {
    font-family: var(--font-serif); font-size: 16px;
    color: rgba(var(--memory-rgb), 0.85); line-height: 1.6; flex: 1;
}
.agp-mem-card-date {
    font-family: var(--font-sans); font-size: 12px;
    color: var(--text-muted); margin-top: 12px;
}
.agp-mem-card-actions {
    position: absolute; top: 8px; right: 8px;
    display: flex; gap: 4px; opacity: 0; transition: opacity 0.2s;
}
.agp-mem-card:hover .agp-mem-card-actions { opacity: 1; }
.agp-mem-card-actions button {
    background: none; border: none; color: var(--text-muted);
    font-size: 12px; padding: 2px 4px; cursor: pointer;
}
.agp-mem-card-actions button:hover { color: var(--accent); }
.agp-mem-card-actions .memory-delete-btn:hover { color: #C47F6B; }
.agp-mem-card-actions button.pinned { color: var(--accent); }
.agp-mem-pinned { border-left: 2px solid var(--accent); background: rgba(var(--accent-rgb),0.03); }
.agp-mem-pinned .agp-mem-card-actions { opacity: 1; }
.agp-mem-inactive { opacity: 0.35; border-style: dashed; }
.agp-mem-inactive .agp-mem-card-actions { opacity: 1; }

/* Images: Forensics — agent profile visual asset workbench */
.agp-forensics {
    max-width: 1120px;
    margin: 0 auto;
    color: var(--text-secondary);
}
.agp-forensics-head {
    display: flex;
    justify-content: space-between;
    gap: 28px;
    margin-bottom: 42px;
}
.agp-forensics-kicker,
.agp-forensics-meta,
.agp-forensic-caption,
.agp-forensic-status {
    font-family: var(--font-mono);
    text-transform: uppercase;
}
.agp-forensics-kicker {
    font-size: 12px;
    letter-spacing: 4px;
    color: rgba(var(--accent-rgb),0.55);
    margin-bottom: 8px;
}
.agp-forensics h2 {
    margin: 0;
    font-family: var(--font-serif);
    font-size: clamp(42px, 7vw, 82px);
    font-weight: 200;
    line-height: 0.95;
    color: var(--accent);
}
.agp-forensics h2 em {
    color: var(--text-primary);
}
.agp-forensics p {
    max-width: 560px;
    margin: 18px 0 0;
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 15px;
    line-height: 1.7;
    color: rgba(var(--text-primary-rgb),0.46);
}
.agp-forensics-meta {
    min-width: 240px;
    align-self: flex-end;
    border-left: 1px solid rgba(var(--accent-rgb),0.2);
    padding-left: 18px;
    display: grid;
    gap: 8px;
    font-size: 12px;
    letter-spacing: 2px;
    color: rgba(var(--accent-rgb),0.44);
}
.agp-forensic-board {
    position: relative;
    min-height: 980px;
}
.agp-forensic-card {
    position: absolute;
    width: min(360px, 35vw);
    transform: rotate(var(--rot, 0deg));
    transition: transform 0.35s ease, z-index 0.1s;
}
.agp-forensic-card:hover {
    transform: rotate(0deg) translateY(-2px);
    z-index: 5;
}
.agp-forensic-static { top: 0; left: 3%; width: min(410px, 38vw); }
.agp-forensic-video { top: 82px; right: 9%; width: min(320px, 30vw); }
.agp-forensic-banner { top: 390px; left: 13%; width: min(650px, 58vw); }
.agp-forensic-reference { top: 690px; left: 7%; width: min(300px, 28vw); }
.agp-forensic-snapshot { top: 660px; right: 10%; width: min(380px, 34vw); }
.agp-forensic-polaroid {
    width: 100%;
    box-sizing: border-box;
    display: block;
    border: 1px solid rgba(var(--accent-bright-rgb),0.08);
    background: rgba(var(--bg-card-rgb),0.96);
    padding: 14px 14px 48px;
    box-shadow: 0 18px 48px rgba(0,0,0,0.36);
    cursor: pointer;
}
.agp-forensic-polaroid input {
    display: none;
}
.agp-forensic-banner .agp-forensic-stage { aspect-ratio: 21 / 9; }
.agp-forensic-video .agp-forensic-stage,
.agp-forensic-reference .agp-forensic-stage { aspect-ratio: 1; }
.agp-forensic-static .agp-forensic-stage { aspect-ratio: 4 / 5; }
.agp-forensic-snapshot .agp-forensic-stage { aspect-ratio: 3 / 4; }
.agp-forensic-stage {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background:
        radial-gradient(circle at 50% 40%, rgba(var(--accent-rgb),0.07), transparent 58%),
        var(--bg-deepest);
    border: 1px solid rgba(var(--accent-rgb),0.12);
}
.agp-forensic-stage img,
.agp-forensic-stage video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: grayscale(36%) brightness(0.78);
    image-rendering: auto;
    transform: translateZ(0);
    backface-visibility: hidden;
}
.agp-forensic-scan {
    position: absolute;
    left: 0;
    right: 0;
    top: -8px;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(var(--accent-rgb),0.75), transparent);
    opacity: 0;
    animation: agp-forensic-scan 4.5s linear infinite;
    z-index: 2;
}
.agp-forensic-card:hover .agp-forensic-scan,
.agp-forensic-card.is-generating .agp-forensic-scan {
    opacity: 0.7;
}
@keyframes agp-forensic-scan {
    0% { transform: translateY(-20px); opacity: 0; }
    18% { opacity: 0.5; }
    100% { transform: translateY(420px); opacity: 0; }
}
.agp-forensic-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    color: rgba(var(--accent-rgb),0.45);
}
.agp-forensic-placeholder svg {
    width: 30px;
    height: 30px;
}
.agp-forensic-placeholder span {
    max-width: 190px;
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 2.5px;
    line-height: 1.7;
    text-align: center;
    text-transform: uppercase;
}
.agp-forensic-generating svg {
    animation: agp-tag-pulse 1.4s ease-in-out infinite;
}
.agp-forensic-snapshot-btn {
    border: 1px solid rgba(var(--accent-bright-rgb),0.08);
    color: inherit;
    text-align: initial;
}
.agp-forensic-caption {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    margin-top: -37px;
    padding: 0 20px;
    position: relative;
    z-index: 2;
    font-size: 12px;
    letter-spacing: 2px;
    color: rgba(var(--accent-rgb),0.6);
}
.agp-forensic-caption span:last-child {
    color: rgba(var(--text-primary-rgb),0.34);
}
.agp-forensic-status {
    margin-top: 18px;
    font-size: 12px;
    letter-spacing: 2px;
    color: rgba(var(--text-primary-rgb),0.28);
    text-align: right;
}
/* Case-note annotation under a polaroid (only the reference card uses it):
   Newsreader italic thin, faint rule above, muted — the investigator's margin
   note. Sentence case + serif so a full line of guidance stays readable where
   the mono evidence labels would not. */
.agp-forensic-hint {
    margin-top: 13px;
    padding-top: 11px;
    border-top: 1px solid rgba(var(--border-rgb), 0.5);
    font-family: 'Newsreader', Georgia, serif;
    font-style: italic;
    font-weight: 300;
    font-size: 12.5px;
    line-height: 1.5;
    letter-spacing: 0.2px;
    text-transform: none;
    color: var(--text-muted);
}
.agp-forensic-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 10px;
}
.agp-forensic-mini-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 28px;
    padding: 0 10px;
    border: 1px solid rgba(var(--accent-rgb),0.26);
    background: rgba(var(--bg-card-rgb),0.58);
    color: rgba(var(--accent-rgb),0.72);
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 1.6px;
    text-transform: uppercase;
    cursor: pointer;
    transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
}
.agp-forensic-mini-btn svg {
    width: 13px;
    height: 13px;
}
.agp-forensic-mini-btn:hover {
    border-color: rgba(var(--accent-rgb),0.55);
    background: rgba(var(--accent-rgb),0.08);
    color: rgba(var(--accent-rgb),0.95);
}

/* Two-surface gallery counter for the agent profile popup:
   1. .panel-star-counter — big centered ticking counter that lives inside
      the star-field overlay during load. Vanishes (along with the star
      field) when load completes.
   2. .agp-gallery-count — small persistent header above the grid that
      shows the final total ("12 photos") AFTER load. Hidden during load
      and on empty galleries. */

.agp-gallery-count {
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 2.5px;
    text-transform: uppercase;
    color: rgba(var(--text-primary-rgb), 0.5);
    text-align: right;
    padding: 6px 4px 8px 0;
    font-variant-numeric: tabular-nums;
    min-height: 14px;
    transition: opacity 0.3s;
    position: relative;
    z-index: 3;
}
.agp-gallery-count.hidden,
.agp-gallery-count:empty { display: none; }
.agp-gallery-count.done { opacity: 1; }
.agp-gallery-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    padding: 2px 4px 8px 0;
    position: relative;
    z-index: 3;
}
.agp-gallery-sort-group {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    margin-left: auto;
}
.agp-gallery-edit-spacer {
    flex: 1 1 auto;
}
.agp-gallery-edit-link {
    background: none;
    border: none;
    color: rgba(var(--accent-rgb), 0.72);
    cursor: pointer;
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 1.8px;
    padding: 5px 0;
    text-transform: uppercase;
    transition: color 0.2s, text-shadow 0.2s;
}
.agp-gallery-edit-link:hover,
.agp-gallery-edit-link:focus-visible {
    color: var(--accent);
    outline: none;
    text-shadow: 0 0 12px rgba(var(--accent-rgb), 0.24);
}
.agp-gallery-arrange-label {
    color: rgba(var(--text-primary-rgb), 0.38);
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 2px;
    text-transform: uppercase;
}
.agp-gallery-sort-btn {
    background: rgba(var(--bg-card-rgb), 0.35);
    border: 1px solid rgba(var(--border-rgb), 0.28);
    color: var(--text-muted);
    cursor: pointer;
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 1.6px;
    padding: 5px 8px;
    text-transform: uppercase;
    transition: border-color 0.2s, color 0.2s, background 0.2s;
}
.agp-gallery-sort-btn:hover {
    border-color: rgba(var(--accent-rgb), 0.38);
    color: var(--text-secondary);
}
.agp-gallery-sort-btn.selected {
    background: rgba(var(--accent-rgb), 0.07);
    border-color: rgba(var(--accent-rgb), 0.48);
    color: var(--accent);
}
@media (max-width: 700px) {
    .agp-gallery-toolbar {
        flex-wrap: wrap;
        row-gap: 8px;
    }
    .agp-gallery-sort-group {
        flex-wrap: wrap;
    }
    .agp-gallery-arrange-label {
        display: none;
    }
}

/* Fixed-positioning so the counter stays centered in the popup viewport
   even when the gallery is taller than the panel (500-photo case) and
   the user scrolls — without it, top:50% absolute would scroll off
   screen with the content. */
.panel-star-counter {
    position: fixed;
    top: 50%;
    left: calc(50% + 100px);
    transform: translate(-50%, -50%);
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 2.5px;
    line-height: 1.4;
    text-transform: uppercase;
    text-align: center;
    color: rgba(var(--text-primary-rgb), 0.85);
    text-shadow: 0 0 14px rgba(var(--accent-rgb), 0.35);
    font-variant-numeric: tabular-nums;
    pointer-events: none;
    z-index: 9999;
    white-space: nowrap;
}

/* Empty-state placeholder for read-only galleries (no items yet). */
.agp-gallery-empty {
    grid-column: 1 / -1;
    padding: 28px 16px;
    text-align: center;
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    opacity: 0.55;
}

.agp-gallery-grid {
    display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px;
    margin-bottom: 24px;
}
.agp-gallery-thumb {
    position: relative; aspect-ratio: 1;
    background: var(--bg-card); border: 1px solid rgba(var(--border-rgb),0.2);
    overflow: hidden; display: flex; align-items: center; justify-content: center;
}
.agp-gallery-thumb img,
.agp-gallery-thumb video { width: 100%; height: 100%; object-fit: cover; filter: brightness(0.8); transition: filter 0.2s; }
.agp-gallery-thumb:hover img,
.agp-gallery-thumb:hover video { filter: brightness(1); }
/* .agp-gallery-remove, .agp-deleting-dots, .agp-upload-plus styles
   removed — galleries are read-only now (edits live in /dossier.html). */

/* Load More — full-row button at the bottom of each gallery grid.
   Spans all 5 columns so it sits centred under the thumbnails. */
.agp-gallery-load-more {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    background: none;
    border: 1px solid rgba(var(--border-rgb), 0.3);
    color: var(--text-secondary);
    padding: 14px 16px;
    margin-top: 4px;
    cursor: pointer;
    transition: border-color 0.2s, color 0.2s, background 0.2s;
}
.agp-gallery-load-more:hover {
    border-color: var(--accent-border);
    color: var(--accent);
    background: rgba(var(--accent-rgb), 0.03);
}
.agp-load-more-action {
    font-family: var(--font-serif);
    font-style: italic;
    font-weight: 300;
    font-size: 14px;
    letter-spacing: 0.3px;
}
.agp-load-more-progress {
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--text-muted);
}

/* ============================================================
   RELATIONSHIPS — cinematic per-pair card
   Full-bleed background photo from the target's gallery, three
   action buttons (flame / heart / heart-handshake), bottom thumb
   strip for swiping between targets.
   ============================================================ */

/* Override the standard panel padding — the card needs to fill the
   full content area. Absolute positioning + inset:0 bypasses the
   sticky/float .agp-close button at the top of .agp-content that
   was reserving a ~50px column on the right of in-flow panels. */
.agp-panel[data-tab="relationships"] {
    padding: 0;
    position: absolute;
    inset: 0;
    overflow: hidden;
}
.agp-panel[data-tab="relationships"].active { display: block; }

.agp-rels-card {
    position: absolute;
    inset: 0;
    overflow: hidden;
    background: var(--bg-deepest);
}

/* "Unknown" — top-left of the relationship card. Marks the target as not known
   to this agent; dims + disables the rest of the card's selections. */
.agp-rels-unknown-btn {
    position: absolute;
    top: 18px;
    left: 18px;
    z-index: 4;
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 2px;
    text-transform: uppercase;
    padding: 6px 12px;
    background: rgba(var(--bg-deepest-rgb), 0.4);
    border: 1px solid rgba(var(--accent-rgb), 0.25);
    color: rgba(var(--text-primary-rgb), 0.6);
    cursor: pointer;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    transition: color 0.2s, border-color 0.2s, background 0.2s;
}
.agp-rels-unknown-btn:hover { color: var(--text-primary); border-color: rgba(var(--accent-rgb), 0.5); }
.agp-rels-unknown-btn.active {
    color: #EEEEEE;
    border-color: rgba(238, 238, 238, 0.55);
    background: rgba(238, 238, 238, 0.08);
}
.agp-rels-card.agp-rels-unknown .agp-rels-name-wrap,
.agp-rels-card.agp-rels-unknown .agp-rels-type-label,
.agp-rels-card.agp-rels-unknown .agp-rels-note,
.agp-rels-card.agp-rels-unknown .agp-rels-cohabit,
.agp-rels-card.agp-rels-unknown .agp-rels-actions,
.agp-rels-card.agp-rels-unknown .agp-rels-subtypes {
    opacity: 0.32;
    pointer-events: none;
    filter: grayscale(0.6);
}

.agp-rels-bg {
    position: absolute;
    inset: 0;
    background-position: center;
    background-size: cover;
    background-repeat: no-repeat;
    background-color: var(--bg-deepest);
    z-index: 0;
    /* Soft blur masks the avatar's pixelation when scaled up to fill the
       card while keeping enough detail to read the character. transform
       scale 1.05 hides the soft edge the blur introduces. */
    filter: blur(3px);
    transform: scale(1.05);
    transition: opacity 0.4s ease;
}
.agp-rels-bg.agp-rels-bg-fallback {
    filter: blur(28px) brightness(0.55);
    transform: scale(1.12);
}

.agp-rels-scrim {
    position: absolute;
    left: 0;
    right: 0;
    pointer-events: none;
    z-index: 1;
}
.agp-rels-scrim-top {
    top: 0;
    height: 35%;
    background: linear-gradient(to bottom,
        rgba(var(--bg-deepest-rgb), 0.85) 0%,
        rgba(var(--bg-deepest-rgb), 0.45) 45%,
        rgba(var(--bg-deepest-rgb), 0) 100%);
}
.agp-rels-scrim-bottom {
    bottom: 0;
    height: 70%;
    background: linear-gradient(to top,
        rgba(var(--bg-deepest-rgb), 0.95) 0%,
        rgba(var(--bg-deepest-rgb), 0.78) 28%,
        rgba(var(--bg-deepest-rgb), 0.18) 72%,
        rgba(var(--bg-deepest-rgb), 0) 100%);
}
/* Side scrim — the top/bottom gradients fade to transparent in the middle band,
   so on a wide card the bare photo shows on the left/right edges beside the
   centred content. This darkens both sides (clear centre) so nothing reads as an
   un-overlaid strip. */
.agp-rels-scrim-sides {
    /* Explicit width/height (NOT inset-auto) so it always fills the full card —
       a purely top/bottom/left/right:0 abs child mis-sized its width here,
       collapsing to ~66% and leaving a bare strip on the right. */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to right,
        rgba(var(--bg-deepest-rgb), 0.88) 0%,
        rgba(var(--bg-deepest-rgb), 0) 26%,
        rgba(var(--bg-deepest-rgb), 0) 74%,
        rgba(var(--bg-deepest-rgb), 0.88) 100%);
}

.agp-rels-content {
    position: relative;
    z-index: 2;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    text-align: center;
    padding: 32px 36px 200px;
    box-sizing: border-box;
    max-width: 720px;
    margin: 0 auto;
}

.agp-rels-label {
    font-family: var(--font-mono), 'Karla', sans-serif;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.4em;
    color: var(--accent);
    opacity: 0.85;
    margin-bottom: 18px;
}

/* Persona (alter-ego) tag — marks a relationship card as one of the user's own
   identities, distinct from the other agents. Newsreader italic, sharp corners. */
.agp-rels-persona-tag {
    /* Pulled out of the centre column (where it squeezed the note box) to sit
       directly under the top-left "Unknown" toggle, smaller. */
    position: absolute;
    top: 50px;
    left: 18px;
    z-index: 4;
    display: inline-block;
    font-family: var(--font-serif);
    font-style: italic;
    font-weight: 300;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    font-size: 12px;
    color: var(--accent);
    border: 1px solid rgba(var(--accent-rgb), 0.4);
    padding: 2px 8px 3px;
    opacity: 0.85;
}

.agp-rels-name {
    font-family: var(--font-serif);
    font-style: italic;
    font-weight: 200;
    font-size: 84px;
    letter-spacing: -0.01em;
    line-height: 1;
    color: var(--accent);
    margin: 0 0 18px 0;
    text-shadow: 0 2px 28px rgba(var(--bg-deepest-rgb), 0.55);
    word-break: break-word;
}

/* User-row alias: a hover pip on the huge name opens a tiny modal to choose
   which saved name THIS agent knows you by — plus a Separate-Collaborator
   clean-slate toggle. Sharp corners, accent-tinted, Newsreader accents. */
.agp-rels-name-wrap {
    position: relative;
    display: inline-block;
    max-width: 100%;
}
.agp-rels-alias-pip {
    position: absolute;
    top: -2px;
    right: -30px;
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    background: rgba(var(--bg-deepest-rgb), 0.4);
    border: 1px solid rgba(var(--accent-rgb), 0.4);
    color: var(--accent);
    cursor: pointer;
    opacity: 0;
    transform: translateY(2px);
    transition: opacity 0.28s, transform 0.28s, border-color 0.2s, background 0.2s;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}
.agp-rels-name-wrap:hover .agp-rels-alias-pip,
.agp-rels-alias-pip:focus-visible {
    opacity: 0.9;
    transform: translateY(0);
}
.agp-rels-alias-pip:hover {
    opacity: 1;
    border-color: rgba(var(--accent-rgb), 0.75);
    background: rgba(var(--accent-rgb), 0.14);
}
.agp-rels-alias-pip svg { width: 13px; height: 13px; }

.agp-rels-alias-modal {
    position: absolute;
    top: calc(100% + 12px);
    left: 50%;
    transform: translateX(-50%);
    z-index: 30;
    width: 300px;
    max-width: 86vw;
    max-height: 58vh;
    overflow-y: auto;
    padding: 14px;
    text-align: left;
    background: rgba(var(--bg-deepest-rgb), 0.92);
    border: 1px solid rgba(var(--accent-rgb), 0.4);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    scrollbar-width: thin;
    scrollbar-color: rgba(var(--accent-rgb), 0.32) transparent;
}
.agp-rels-alias-modal::-webkit-scrollbar { width: 4px; }
.agp-rels-alias-modal::-webkit-scrollbar-track { background: transparent; }
.agp-rels-alias-modal::-webkit-scrollbar-thumb { background: rgba(var(--accent-rgb), 0.32); border-radius: 2px; }
.agp-alias-head {
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 2.2px;
    text-transform: uppercase;
    color: rgba(var(--accent-rgb), 0.85);
    margin-bottom: 12px;
    text-align: center;
}
.agp-alias-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
}
.agp-alias-opt {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    padding: 9px 12px;
    background: rgba(var(--bg-deepest-rgb), 0.4);
    border: 1px solid rgba(var(--accent-rgb), 0.16);
    color: rgba(var(--text-primary-rgb), 0.82);
    cursor: pointer;
    text-align: left;
    transition: border-color 0.2s, background 0.2s, color 0.2s;
}
.agp-alias-opt:hover { border-color: rgba(var(--accent-rgb), 0.45); color: var(--text-primary); }
.agp-alias-opt.active {
    border-color: rgba(var(--accent-rgb), 0.7);
    background: rgba(var(--accent-rgb), 0.12);
    color: var(--accent);
}
.agp-alias-opt-name {
    font-family: var(--font-serif);
    font-style: italic;
    font-weight: 300;
    font-size: 17px;
    line-height: 1.2;
}
.agp-alias-opt-tag {
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 1.6px;
    text-transform: uppercase;
    color: rgba(var(--accent-rgb), 0.6);
    flex-shrink: 0;
}
.agp-alias-empty {
    font-family: var(--font-serif);
    font-style: italic;
    font-weight: 300;
    font-size: 12px;
    line-height: 1.5;
    color: rgba(var(--text-primary-rgb), 0.55);
    padding: 4px 2px;
}
.agp-alias-separate {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    background: rgba(var(--bg-deepest-rgb), 0.4);
    border: 1px solid rgba(var(--accent-rgb), 0.16);
    cursor: pointer;
    text-align: left;
    transition: border-color 0.2s, background 0.2s;
}
.agp-alias-separate:hover { border-color: rgba(var(--accent-rgb), 0.45); }
.agp-alias-separate.active { border-color: rgba(var(--accent-rgb), 0.7); background: rgba(var(--accent-rgb), 0.1); }
.agp-alias-sep-mark {
    flex-shrink: 0;
    width: 14px;
    height: 14px;
    margin-top: 2px;
    border: 1px solid rgba(var(--accent-rgb), 0.5);
    background: transparent;
    position: relative;
    transition: background 0.2s, border-color 0.2s;
}
.agp-alias-separate.active .agp-alias-sep-mark { background: var(--accent); border-color: var(--accent); }
.agp-alias-separate.active .agp-alias-sep-mark::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 1px;
    width: 4px;
    height: 8px;
    border: solid var(--bg-deepest);
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}
.agp-alias-sep-copy { display: flex; flex-direction: column; gap: 3px; }
.agp-alias-sep-title {
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: rgba(var(--text-primary-rgb), 0.8);
}
.agp-alias-separate.active .agp-alias-sep-title { color: var(--accent); }
.agp-alias-sep-sub {
    font-family: var(--font-serif);
    font-style: italic;
    font-weight: 300;
    font-size: 12px;
    line-height: 1.45;
    color: rgba(var(--text-primary-rgb), 0.55);
}

.agp-rels-type-label {
    font-family: var(--font-serif);
    font-style: italic;
    font-weight: 200;
    font-size: 22px;
    color: rgba(var(--text-primary-rgb), 0.85);
    margin: 0 0 14px 0;
    letter-spacing: 0.04em;
    min-height: 1em;
}

.agp-rels-note {
    width: 100%;
    max-width: 460px;
    background: transparent;
    border: 1px solid rgba(var(--accent-rgb), 0.22);
    padding: 10px 14px;
    font-family: var(--font-serif);
    font-style: italic;
    font-weight: 300;
    font-size: 13px;
    line-height: 1.55;
    color: rgba(var(--text-primary-rgb), 0.88);
    text-align: center;
    margin: 0 0 32px 0;
    outline: none;
    resize: none;
    overflow-y: auto;
    box-sizing: border-box;
    /* Firefox scrollbar */
    scrollbar-width: thin;
    scrollbar-color: rgba(var(--accent-rgb), 0.32) transparent;
    transition: background 0.35s, color 0.35s, border-color 0.35s;
}
.agp-rels-note::placeholder {
    color: rgba(var(--accent-rgb), 0.45);
    font-style: italic;
}
/* Focused / typing state: dark scrim echoing the theme's deepest grey at
   30% so the bg stays visible behind, plus crisp white text for legibility. */
.agp-rels-note:focus {
    background: rgba(var(--bg-deepest-rgb), 0.3);
    color: #ffffff;
    border-color: rgba(var(--accent-rgb), 0.55);
}
.agp-rels-note:focus::placeholder {
    color: rgba(255, 255, 255, 0.4);
}
/* Webkit elegant scrollbar */
.agp-rels-note::-webkit-scrollbar { width: 4px; }
.agp-rels-note::-webkit-scrollbar-track { background: transparent; }
.agp-rels-note::-webkit-scrollbar-thumb {
    background: rgba(var(--accent-rgb), 0.32);
    border-radius: 2px;
}
.agp-rels-note::-webkit-scrollbar-thumb:hover {
    background: rgba(var(--accent-rgb), 0.55);
}

.agp-rels-cohabit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 0 0 22px;
    padding: 8px 14px;
    background: rgba(var(--bg-deepest-rgb), 0.34);
    border: 1px solid rgba(var(--accent-rgb), 0.22);
    color: rgba(var(--text-primary-rgb), 0.64);
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 2.2px;
    text-transform: uppercase;
    text-align: center;
    line-height: 1.55;
    white-space: normal;
    max-width: min(360px, 100%);
    cursor: pointer;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    transition: color 0.25s, border-color 0.25s, background 0.25s, box-shadow 0.25s;
}
.agp-rels-cohabit:hover {
    color: var(--text-primary);
    border-color: rgba(var(--accent-rgb), 0.45);
}
.agp-rels-cohabit.active {
    color: var(--accent);
    border-color: rgba(var(--accent-rgb), 0.7);
    background: rgba(var(--accent-rgb), 0.12);
    box-shadow: 0 8px 28px rgba(var(--accent-rgb), 0.18);
}
.agp-rels-cohabit svg {
    width: 14px;
    height: 14px;
}

.agp-rels-actions {
    display: flex;
    align-items: center;
    gap: 28px;
}

.agp-rels-subtypes {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    width: min(520px, 100%);
    min-height: 32px;
    margin-top: 16px;
}

.agp-rels-subtype {
    min-width: 96px;
    min-height: 30px;
    padding: 7px 12px;
    background: rgba(var(--bg-deepest-rgb), 0.34);
    border: 1px solid rgba(var(--accent-rgb), 0.2);
    color: rgba(var(--text-primary-rgb), 0.58);
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 1.9px;
    line-height: 1.35;
    text-transform: uppercase;
    cursor: pointer;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    transition: color 0.22s, border-color 0.22s, background 0.22s, box-shadow 0.22s;
}

.agp-rels-subtype:hover,
.agp-rels-subtype:focus-visible {
    color: var(--text-primary);
    border-color: rgba(var(--accent-rgb), 0.48);
}

.agp-rels-subtype.active {
    color: var(--accent);
    border-color: rgba(var(--accent-rgb), 0.78);
    background: rgba(var(--accent-rgb), 0.12);
    box-shadow: 0 8px 28px rgba(var(--accent-rgb), 0.14);
}

.agp-rels-action {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: 1px solid rgba(var(--accent-rgb), 0.22);
    background: rgba(var(--bg-deepest-rgb), 0.32);
    color: var(--accent);
    opacity: 0.45;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    padding: 0;
}
.agp-rels-action.agp-rels-action-center {
    width: 76px;
    height: 76px;
}
.agp-rels-action:hover {
    opacity: 1;
    border-color: rgba(var(--accent-rgb), 0.55);
}
.agp-rels-action.active {
    width: 92px;
    height: 92px;
    opacity: 1;
    background: rgba(var(--accent-rgb), 0.14);
    border-color: rgba(var(--accent-rgb), 0.6);
    box-shadow: 0 8px 36px rgba(var(--accent-rgb), 0.32);
}
.agp-rels-action i,
.agp-rels-action svg {
    width: 22px;
    height: 22px;
    pointer-events: none;
    transition: width 0.4s, height 0.4s;
}
.agp-rels-action.agp-rels-action-center i,
.agp-rels-action.agp-rels-action-center svg {
    width: 26px;
    height: 26px;
}
.agp-rels-action.active i,
.agp-rels-action.active svg {
    width: 30px;
    height: 30px;
}
/* Active romantic chip: fill the heart. */
.agp-rels-action.active[data-type="romantic"] svg {
    fill: var(--accent);
}

/* === Bottom strip ================================================ */

.agp-rels-strip-wrap {
    position: absolute;
    bottom: 24px;
    left: 0;
    right: 0;
    z-index: 3;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 12px;
    box-sizing: border-box;
}

.agp-rels-arrow {
    background: rgba(var(--bg-deepest-rgb), 0.55);
    border: 1px solid rgba(var(--accent-rgb), 0.18);
    color: var(--accent);
    width: 26px;
    height: 38px;
    flex-shrink: 0;
    cursor: pointer;
    font-size: 17px;
    line-height: 1;
    opacity: 0.55;
    transition: opacity 0.3s, border-color 0.3s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    padding: 0;
}
.agp-rels-arrow:hover {
    opacity: 1;
    border-color: rgba(var(--accent-rgb), 0.5);
}

.agp-rels-strip {
    flex: 1;
    display: flex;
    gap: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 6px 4px;
    scroll-behavior: smooth;
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.agp-rels-strip::-webkit-scrollbar { display: none; }

.agp-rels-thumb {
    flex: 0 0 auto;
    width: 54px;
    height: 80px;
    position: relative;
    cursor: pointer;
    border: 1px solid rgba(var(--accent-rgb), 0.22);
    overflow: hidden;
    background: rgba(var(--accent-rgb), 0.04);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
.agp-rels-thumb-img {
    width: 100%;
    height: 100%;
    background-position: center;
    background-size: cover;
    background-repeat: no-repeat;
    filter: grayscale(1) brightness(0.65);
    opacity: 0.55;
    transition: filter 0.4s, opacity 0.4s;
}
.agp-rels-thumb:hover .agp-rels-thumb-img {
    filter: grayscale(0) brightness(1);
    opacity: 1;
}
.agp-rels-thumb.active {
    width: 64px;
    height: 96px;
    border-color: rgba(var(--accent-rgb), 0.7);
    box-shadow: 0 0 0 3px var(--bg-deepest), 0 0 0 4px rgba(var(--accent-rgb), 0.4);
}
.agp-rels-thumb.active .agp-rels-thumb-img {
    filter: none;
    opacity: 1;
}

.agp-rels-thumb-glyph {
    position: absolute;
    bottom: 4px;
    right: 4px;
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(var(--bg-deepest-rgb), 0.88);
    border: 1px solid rgba(var(--accent-rgb), 0.65);
    color: var(--accent);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 2;
}
.agp-rels-thumb-glyph i,
.agp-rels-thumb-glyph svg {
    width: 9px;
    height: 9px;
}
.agp-rels-thumb.set-romantic .agp-rels-thumb-glyph svg {
    fill: var(--accent);
}
/* Persona thumbnails carry a small accent square (top-left) so the user's own
   alter-egos read apart from the agent targets in the strip. */
.agp-rels-thumb.is-persona {
    border-color: rgba(var(--accent-rgb), 0.5);
}
.agp-rels-thumb.is-persona::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 5px;
    height: 5px;
    background: var(--accent);
    z-index: 2;
}

/* Mobile: stitch-mock-style full-screen card with content
   anchored bottom-left (instead of centered). */
@media (max-width: 900px) {
    .agp-rels-content {
        padding: 24px 28px 200px;
        align-items: flex-start;
        text-align: left;
        max-width: none;
    }
    /* The card sits under the sticky mobile header (~57px), so the top-left
       "Unknown" toggle was hidden behind it — drop it clear of the header. The
       card content is bottom-anchored (justify-content:flex-end), so the top
       zone is empty and there's nothing to collide with. */
    .agp-rels-unknown-btn {
        top: 68px;
        left: 16px;
        padding: 8px 14px;
        font-size: 12px;
    }
    .agp-rels-persona-tag { top: 106px; left: 16px; }
    .agp-rels-label {
        margin-bottom: 12px;
    }
    .agp-rels-name {
        font-size: 56px;
    }
    /* Content is left-aligned on mobile — anchor the alias modal to the name's
       left edge so it can't translate off the left of the screen. */
    .agp-rels-alias-modal {
        left: 0;
        transform: none;
    }
    .agp-rels-type-label {
        font-size: 18px;
    }
    .agp-rels-note {
        text-align: left;
        margin-left: 0;
        margin-bottom: 24px;
        max-width: 100%;
    }
    .agp-rels-actions {
        gap: 20px;
        align-self: center;
    }
    .agp-rels-action {
        width: 56px;
        height: 56px;
    }
    .agp-rels-action.agp-rels-action-center {
        width: 64px;
        height: 64px;
    }
    .agp-rels-action.active {
        width: 76px;
        height: 76px;
    }
    .agp-rels-strip-wrap {
        bottom: 14px;
    }
}

@media (max-width: 900px) {
    .agp-window { width: 100vw; height: 100vh; max-height: none; border: none; }
    @supports (height: 100dvh) { .agp-window { height: 100dvh; } }

    /* --- Hide sidebar, show mobile header --- */
    .agp-sidebar { display: none; }
    .agp-sidebar.agp-sidebar-open {
        display: flex; position: fixed; top: 0; left: 0;
        width: 100vw; height: 100vh; z-index: 200;
        background: rgba(var(--bg-deepest-rgb), 0.96);
        backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
        align-items: center; justify-content: center;
        padding: 40px 20px;
    }
    @supports (height: 100dvh) { .agp-sidebar.agp-sidebar-open { height: 100dvh; } }
    .agp-sidebar.agp-sidebar-open .agp-sidebar-section { text-align: center; }
    .agp-sidebar.agp-sidebar-open .agp-sidebar-item {
        font-size: 18px; padding: 14px 0; justify-content: center;
        font-family: var(--font-serif); font-style: normal; font-weight: 300;
        border-left: none;
    }
    .agp-sidebar.agp-sidebar-open .agp-sidebar-item.active {
        border-left: none; color: var(--accent);
    }
    .agp-sidebar.agp-sidebar-open .agp-sidebar-diamond { font-size: 12px; }
    .agp-sidebar.agp-sidebar-open .agp-sidebar-avatar { width: 90px; height: 90px; }
    .agp-sidebar.agp-sidebar-open .agp-sidebar-label,
    .agp-sidebar.agp-sidebar-open .agp-sidebar-name {
        font-family: var(--font-serif);
        font-style: normal;
        font-weight: 300;
    }
    .agp-sidebar.agp-sidebar-open .agp-sidebar-name { font-size: 20px; margin-bottom: 4px; }
    .agp-sidebar.agp-sidebar-open .agp-sidebar-divider { margin: 12px auto; width: 60px; }

    /* --- Mobile header bar --- */
    .agp-mobile-header {
        display: flex; align-items: center; gap: 12px;
        padding: 12px 16px; border-bottom: 1px solid rgba(var(--border-rgb),0.15);
        background: var(--bg-panel);
        position: sticky; top: 0; z-index: 10;
    }
    .agp-mobile-avatar {
        width: 32px; height: 32px; border: 1px solid rgba(var(--accent-rgb),0.15);
        object-fit: cover;
    }
    .agp-mobile-name {
        flex: 1; font-family: var(--font-serif); font-style: normal;
        font-size: 14px; color: var(--text-primary);
        white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    }
    .agp-mobile-tab {
        font-family: var(--font-mono); font-size: 12px; text-transform: uppercase;
        letter-spacing: 2px; color: var(--text-muted); opacity: 0.7;
    }
    .agp-mobile-menu-btn {
        background: none; border: none; color: var(--text-primary);
        font-size: 20px; cursor: pointer; padding: 4px 6px;
        transition: color 0.2s;
    }
    .agp-mobile-menu-btn:hover { color: var(--accent); }

    /* --- Content adjustments --- */
    .agp-close { display: none; }
    .agp-panel { padding: 20px 16px; }
    .agp-panel[data-tab="activity"] {
        padding: 0 16px 28px;
    }
    .agp-panel[data-tab="activity"] .ap-hero {
        grid-template-columns: 1fr !important;
        gap: 18px;
        margin: 0 0 24px;
    }
    .agp-panel[data-tab="activity"] .ap-hero-left {
        margin: 0 -16px;
        min-height: 180px;
    }
    .agp-panel[data-tab="activity"] .ap-hero-img {
        min-height: 180px;
        max-height: 240px;
    }
    .agp-panel[data-tab="activity"] .ap-hero-overlay {
        padding: 26px 18px 16px;
    }
    .agp-panel[data-tab="activity"] .ap-hero-overlay-name {
        font-size: 30px;
    }
    .ap-lower {
        grid-template-columns: 1fr;
        gap: 20px;
        margin-bottom: 24px;
    }
    .ap-grid-head {
        justify-content: center;
    }
    .ap-fav-section {
        align-items: center;
        padding-top: 16px;
        padding-left: 0;
        border-top: 1px solid rgba(var(--border-rgb),0.1);
        border-left: none;
        text-align: center;
    }
    body:not(.egg-mini) .ap-profile-blurb {
        display: none;
    }
    body:not(.egg-mini) .ap-mobile-heart-card {
        display: block;
    }
    body.egg-mini .ap-mobile-heart-card {
        display: none !important;
    }
    .bm-journey-row {
        grid-template-columns: 1fr;
    }
    .bm-journey-track {
        height: 10px;
        align-items: stretch;
    }
    .bm-journey-track span {
        height: auto;
    }
    .agp-forensics-head {
        flex-direction: column;
        gap: 18px;
        margin-bottom: 24px;
    }
    .agp-forensics h2 {
        font-size: 38px;
    }
    .agp-forensics-meta {
        align-self: stretch;
        min-width: 0;
    }
    .agp-forensic-board {
        min-height: 0;
        display: grid;
        grid-template-columns: 1fr;
        gap: 22px;
    }
    .agp-forensic-card,
    .agp-forensic-static,
    .agp-forensic-video,
    .agp-forensic-banner,
    .agp-forensic-reference,
    .agp-forensic-snapshot {
        position: static;
        width: 100%;
        transform: none;
    }
    .agp-forensic-card:hover {
        transform: translateY(-1px);
    }
    .agp-mem-grid { grid-template-columns: 1fr; }
    .agp-gallery-grid { grid-template-columns: repeat(3, 1fr); }
    .panel-star-counter { left: 50%; }

    /* --- Sidebar close button (mobile overlay) --- */
    .agp-sidebar-mobile-close {
        position: absolute; top: 16px; right: 20px;
        background: none; border: none; color: var(--text-muted);
        font-size: 22px; cursor: pointer; padding: 4px 8px;
        transition: color 0.2s; display: none;
    }
    .agp-sidebar-mobile-close:hover { color: var(--accent); }
    .agp-sidebar.agp-sidebar-open .agp-sidebar-mobile-close { display: block; }
}

/* --- Desktop: hide mobile-only elements --- */
@media (min-width: 901px) {
    .agp-mobile-header { display: none; }
    .agp-sidebar-mobile-close { display: none; }
}

/* ---- AGENT PROFILE LIGHTBOX — SCRYING POOL ----------------------------- */

.agp-lightbox-overlay {
    position: fixed;
    inset: 0;
    background: radial-gradient(circle at center, var(--bg-panel) 0%, var(--bg-deepest) 70%);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* Decorative SVG circles */
.agp-lb-sigils {
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0.2;
}
.agp-lb-sigil-dot {
    animation: agpSigilPulse 4s ease-in-out infinite;
}
@keyframes agpSigilPulse {
    0%, 100% { opacity: 0.2; r: 2; }
    50% { opacity: 0.5; r: 3; }
}

/* Star field */
.agp-lightbox-star-field {
    position: absolute;
    inset: 0;
    pointer-events: none;
}
.agp-lightbox-star {
    position: absolute;
    color: var(--accent);
    font-size: 12px;
    opacity: 0;
    animation: agpLightboxTwinkle 3s ease-in-out infinite;
}
@keyframes agpLightboxTwinkle {
    0%, 100% { opacity: 0; transform: scale(0.8); }
    50% { opacity: 0.6; transform: scale(1.2); }
}

/* The scrying pool — sized by height, full image visible */
.agp-lb-pool {
    position: relative;
    max-height: 65vh;
    border: 1px solid rgba(var(--accent-rgb),0.1);
    box-shadow: 0 0 100px rgba(var(--accent-rgb),0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    z-index: 2;
    flex-shrink: 0;
}

/* Media — fit by height, no masking */
.agp-lb-media {
    max-height: 65vh;
    max-width: 85vw;
    object-fit: contain;
    display: block;
    pointer-events: auto;
}

/* Loading overlay shown while a delete is in flight. Sits over the pool
   to dim the image (no opacity fiddling on the img itself) and shows three
   pulsing accent dots so a slow network feels alive. mc-dot-pulse keyframe
   is reused from the mini-chat typing indicator. */
.agp-lb-pool-deleting {
    position: absolute;
    inset: 0;
    background: rgba(var(--bg-deepest-rgb), 0.78);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    z-index: 4;
}
.agp-lb-pool-deleting span {
    width: 9px;
    height: 9px;
    background: var(--accent);
    border-radius: 50%;
    animation: mc-dot-pulse 1.4s ease-in-out infinite;
}
.agp-lb-pool-deleting span:nth-child(2) { animation-delay: 0.2s; }
.agp-lb-pool-deleting span:nth-child(3) { animation-delay: 0.4s; }

/* Agent name — top center */
.agp-lb-title {
    position: absolute;
    top: 10%;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    z-index: 3;
    pointer-events: none;
}
.agp-lb-title-name {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 27px;
    font-weight: 200;
    color: var(--text-primary);
    margin-bottom: 4px;
}
.agp-lb-title-sub {
    font-variant-caps: all-small-caps;
    font-family: var(--font-sans);
    font-size: 13px;
    letter-spacing: 3px;
    color: var(--text-muted);
}

/* Side nav panels — left (previous) and right (next) */
.agp-lb-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 3;
    max-width: 200px;
    cursor: pointer;
    transition: opacity 0.3s;
    opacity: 0.6;
}
.agp-lb-nav:hover { opacity: 1; }

.agp-lb-nav-prev {
    left: 8%;
    text-align: right;
}
.agp-lb-nav-next {
    right: 8%;
    text-align: left;
}

.agp-lb-nav-line {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}
.agp-lb-nav-prev .agp-lb-nav-line { justify-content: flex-end; }
.agp-lb-nav-next .agp-lb-nav-line { justify-content: flex-start; }

.agp-lb-nav-rule {
    width: 60px;
    height: 1px;
    background: linear-gradient(to right, transparent, rgba(var(--accent-rgb),0.3));
}
.agp-lb-nav-prev .agp-lb-nav-rule {
    background: linear-gradient(to left, transparent, rgba(var(--accent-rgb),0.3));
}

.agp-lb-nav-chevron {
    color: rgba(var(--accent-rgb),0.3);
    font-size: 27px;
    line-height: 1;
    transition: color 0.2s;
}
.agp-lb-nav:hover .agp-lb-nav-chevron { color: var(--accent); }

.agp-lb-nav-label {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 19px;
    font-weight: 200;
    color: rgba(var(--accent-rgb),0.6);
    margin-bottom: 4px;
}
.agp-lb-nav-date {
    font-variant-caps: all-small-caps;
    font-family: var(--font-sans);
    font-size: 12px;
    letter-spacing: 3px;
    color: var(--text-muted);
}

/* Next preview thumbnail */
.agp-lb-nav-preview {
    width: 80px;
    height: 80px;
    border: 1px solid rgba(var(--accent-rgb),0.15);
    object-fit: cover;
    opacity: 0.3;
    margin-top: 12px;
    transition: opacity 0.3s;
}
.agp-lb-nav:hover .agp-lb-nav-preview {
    opacity: 0.6;
}

/* Bottom action bar */
.agp-lb-actions {
    position: absolute;
    bottom: 10%;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 40px;
    z-index: 3;
}
.agp-lb-action {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
    transition: all 0.2s;
}
.agp-lb-action svg {
    width: 23px;
    height: 23px;
    stroke: rgba(var(--accent-rgb),0.2);
    fill: none;
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: stroke 0.2s;
}
.agp-lb-action:hover svg { stroke: var(--accent); }
.agp-lb-action:disabled {
    cursor: progress;
    opacity: 0.55;
}
.agp-lb-action-label {
    font-family: var(--font-sans);
    font-size: 12px;
    letter-spacing: 4px;
    text-transform: uppercase;
    color: var(--text-muted);
    opacity: 0;
    transition: opacity 0.2s;
}
.agp-lb-action:hover .agp-lb-action-label { opacity: 1; }

/* Delete hover — rose instead of accent */
.agp-lb-action-delete:hover svg { stroke: #C87878; }
.agp-lb-action-delete:hover .agp-lb-action-label { color: #C87878; }

/* Close button */
.agp-lb-close {
    position: absolute;
    top: 24px;
    right: 32px;
    z-index: 10;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 23px;
    cursor: pointer;
    transition: color 0.2s;
    font-family: var(--font-sans);
    font-weight: 200;
}
.agp-lb-close:hover { color: var(--accent); }

/* Counter */
.agp-lb-counter {
    position: absolute;
    bottom: 24px;
    right: 32px;
    z-index: 3;
    font-family: var(--font-sans);
    font-size: 12px;
    letter-spacing: 3px;
    color: var(--text-muted);
    pointer-events: none;
}
.agp-lb-footer {
    position: absolute;
    bottom: 24px;
    right: 32px;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 18px;
    pointer-events: none;
}
.agp-lb-footer .agp-lb-counter {
    position: static;
    bottom: auto;
    right: auto;
}
.agp-lb-footer-delete {
    display: none;
    pointer-events: auto;
}

/* Tablet + mobile: simpler nav (chevron-only) and always-visible action
   labels since touch devices have no hover state. The action row itself
   (download / canvas / delete) and the avatar/banner shortcuts under the
   title stay visible — touch users still need to reach them. */
@media (max-width: 1100px) {
    /* Touch has no hover, so brighten the action icons + show labels. */
    .agp-lb-action svg { stroke: rgba(var(--accent-rgb),0.55); }
    .agp-lb-action-label { opacity: 0.7; }

    /* Mini nav chevron buttons — collapse the rich preview/date info into a
       simple round chevron, matching the photobooth lightbox. */
    .agp-lb-nav {
        max-width: none; width: 36px; height: 36px;
        background: rgba(var(--bg-deepest-rgb), 0.6);
        border: 1px solid rgba(var(--accent-rgb),0.1);
        display: flex; align-items: center; justify-content: center;
        opacity: 0.8;
    }
    .agp-lb-nav:hover { opacity: 1; background: rgba(var(--bg-deepest-rgb), 0.8); }
    .agp-lb-nav-prev { left: 12px; }
    .agp-lb-nav-next { right: 12px; }
    .agp-lb-nav-line { margin: 0; gap: 0; }
    .agp-lb-nav-rule { display: none; }
    .agp-lb-nav-label { display: none; }
    .agp-lb-nav-date { display: none; }
    .agp-lb-nav-preview { display: none; }
    .agp-lb-nav-chevron { font-size: 23px; color: rgba(var(--accent-rgb),0.6); }
    .agp-lb-nav:hover .agp-lb-nav-chevron { color: var(--accent); }
}

@media (max-width: 700px) {
    .agp-lb-pool { max-width: 92vw; max-height: 55vh; width: auto; height: auto; }
    .agp-lb-media { max-width: 92vw; max-height: 55vh; }
    .agp-lb-actions {
        bottom: calc(82px + env(safe-area-inset-bottom, 0px));
        width: min(92vw, 420px);
        justify-content: space-around;
        gap: 8px;
    }
    .agp-lb-action {
        min-width: 48px;
        max-width: 78px;
    }
    .agp-lb-action-label {
        max-width: 72px;
        font-size: 12px;
        letter-spacing: 2px;
        line-height: 1.3;
        text-align: center;
        overflow-wrap: anywhere;
    }
    .agp-lb-actions > .agp-lb-action-delete { display: none !important; }
    .agp-lb-footer-delete .agp-lb-action-label { display: none; }
    .agp-lb-footer-delete .agp-lb-action-delete svg {
        width: 18px;
        height: 18px;
        stroke: var(--accent-bright);
    }
    .agp-lb-footer-delete .agp-lb-action-delete:hover svg {
        stroke: var(--accent-bright);
        filter: drop-shadow(0 0 8px rgba(var(--accent-bright-rgb),0.35));
    }
    .agp-lb-footer {
        left: 18px;
        right: 18px;
        bottom: calc(18px + env(safe-area-inset-bottom, 0px));
        justify-content: space-between;
    }
    .agp-lb-footer-delete {
        display: flex;
        min-width: 44px;
    }
    .agp-lb-footer-delete .agp-lb-action-delete {
        min-width: 44px;
        max-width: 44px;
    }
    .agp-lb-footer .agp-lb-counter {
        font-size: 10px;
        letter-spacing: 2.5px;
    }

    .agp-lb-title { top: 5%; }
    .agp-lb-title-name { font-size: 21px; }
    .agp-lb-action-codex { display: none !important; }
}

/* Empty state */
.mc-empty {
    flex: 1; display: flex; align-items: center; justify-content: center;
    font-family: var(--font-serif); font-style: italic;
    font-size: 12px; color: var(--text-muted); letter-spacing: 0.5px;
    padding: 40px;
}

/* ============================================= SHARED RESPONSIVE */

@media (max-width: 900px) {
    .page-title { font-size: 48px; }
    .nav-link { display: none; }
    .nav-dropdown { display: none !important; }
    .nav-world { display: none; }
    .nav-world-desc { display: none; }
    /* Hide nav-right icons on mobile EXCEPT the install chip and the
       hamburger — install needs to be reachable from the top bar so the
       PWA install offer doesn't get buried behind the menu. */
    .nav-right .nav-icon:not(.mobile-menu-btn):not(.nav-install-icon):not(.nav-theme-icon):not(.nav-city-icon) { display: none !important; }
    .nav-right { gap: 8px; }
    .nav-city-icon.cities-available { display: inline-flex; }
    .nav-right .nav-install-icon { padding: 4px 8px !important; }
    .nav-right .nav-install-icon svg { width: 18px !important; height: 18px !important; }
    .nav-right .nav-theme-icon { padding: 4px 8px !important; }
    .nav-right .nav-theme-icon svg { width: 18px !important; height: 18px !important; }
    .nav-user { display: none !important; }
    .mobile-menu-btn { display: flex !important; }
    .page-footer { padding: 32px 20px; }
}

/* ============================================= EGG MINI SHELL */

html.egg-mini-frame .nav,
html.egg-mini-frame .am-footer,
body.egg-mini-shell .nav,
body.egg-mini-shell .am-footer {
    display: none !important;
}
html.chat-only-frame .egg-mini-bar,
body.chat-only.egg-mini-shell .egg-mini-bar {
    display: none !important;
}

.egg-mini-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 44px;
    z-index: 95;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: max(0px, env(safe-area-inset-top)) 14px 0;
    background: rgba(var(--bg-deepest-rgb),0.94);
    border-bottom: 1px solid rgba(var(--border-rgb),0.2);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}
.egg-mini-brand {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    color: rgba(var(--accent-rgb),0.72);
    text-decoration: none;
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 2px;
    line-height: 1;
    text-transform: uppercase;
}
.egg-mini-brand svg,
.egg-mini-action svg {
    width: 17px;
    height: 17px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.45;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex-shrink: 0;
}
.egg-mini-brand span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.egg-mini-actions {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.egg-mini-action {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    background: transparent;
    color: rgba(var(--accent-bright-rgb),0.7);
    cursor: pointer;
}
.egg-mini-action:hover,
.egg-mini-brand:hover {
    color: var(--accent);
}

@supports (padding-top: env(safe-area-inset-top)) {
    .egg-mini-bar {
        height: calc(44px + env(safe-area-inset-top));
        padding-top: env(safe-area-inset-top);
    }
}

/* ============================================= MOBILE NAV OVERLAY (SHARED) */

.mobile-menu-btn {
    display: none;
    align-items: center; justify-content: center;
    font-size: 20px; color: var(--text-primary);
    background: none; border: none; cursor: pointer;
    padding: 4px 6px; transition: color 0.2s;
}
.mobile-menu-btn:hover { color: var(--accent); }
.mobile-menu-btn.has-new-social {
    animation: accent-cycle 4s ease-in-out infinite;
}

.mobile-nav-overlay {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; z-index: 80;
    background: rgba(var(--bg-deepest-rgb), 0.96);
    backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
    display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
    gap: 0; opacity: 0; pointer-events: none;
    overflow-y: auto;
    overflow-x: hidden;
    padding: max(56px, env(safe-area-inset-top)) 20px max(30px, env(safe-area-inset-bottom));
    box-sizing: border-box;
    transition: opacity 0.3s ease;
}
body.egg-mini-shell .mobile-nav-overlay { z-index: 120; }
/* iOS Safari's address bar makes 100vh > viewport; 100dvh = real viewport. */
@supports (height: 100dvh) { .mobile-nav-overlay { height: 100dvh; } }
.mobile-nav-overlay.open { opacity: 1; pointer-events: auto; }

.mobile-nav-overlay::before {
    content: ''; position: absolute; top: 0; left: 0; right: 0; height: 1px;
    background: linear-gradient(to right, transparent 10%, rgba(var(--accent-bright-rgb),0.5) 50%, transparent 90%);
}

.mobile-nav-overlay .mno-close {
    position: absolute; top: 16px; right: 20px;
    background: none; border: none; color: var(--accent-deep); font-size: 22px;
    cursor: pointer; padding: 4px 8px; transition: color 0.2s;
}
.mobile-nav-overlay .mno-close:hover { color: var(--accent); }

/* Page links read like the web nav: tiny open square bullet in theme
   accent, then sans-uppercase grey label. Agent rows below are the
   counterweight — serif italic, larger — so the two registers visually
   separate "places" from "people". */
.mobile-nav-overlay .mno-link {
    display: flex; align-items: center; gap: 10px;
    font-family: var(--font-sans); font-style: normal; font-weight: 300;
    font-size: 11px; text-transform: uppercase; letter-spacing: 2.5px;
    color: var(--text-muted); text-decoration: none;
    padding: 9px 0; line-height: 1.1;
    transition: color 0.2s;
}
.mobile-nav-overlay .mno-link:hover { color: var(--accent); }

.mobile-nav-overlay .mno-bullet {
    display: inline-block;
    width: 5px; height: 5px;
    border: 1px solid var(--accent);
    background: transparent;
    flex-shrink: 0;
}

.mobile-nav-overlay .mno-divider {
    width: 120px; height: 1px; margin: 12px 0;
    background: linear-gradient(to right, transparent 0%, rgba(var(--accent-rgb),0.45) 50%, transparent 100%);
}

.mobile-nav-overlay .mno-util-row {
    display: flex; align-items: center; justify-content: center; gap: 18px;
}
.mobile-nav-overlay .mno-util {
    display: inline-flex; align-items: center; justify-content: center;
    color: var(--accent-deep); cursor: pointer;
    padding: 10px;
    background: none; border: none;
    transition: color 0.2s, background 0.2s;
}
:root[data-theme="winery"] .mobile-nav-overlay .mno-util-row:not(.mno-help-row):not(.mno-patch-row) .mno-util {
    color: #858585;
}
.mobile-nav-overlay .mno-util:hover {
    color: var(--accent);
}
.mobile-nav-overlay .mno-help-row {
    margin-top: 2px;
}
.mobile-nav-overlay .mno-util.mno-page-help {
    color: var(--accent-bright);
    filter: drop-shadow(0 0 10px rgba(var(--accent-bright-rgb),0.22));
}
.mobile-nav-overlay .mno-util.mno-page-help:hover,
.mobile-nav-overlay .mno-util.mno-page-help:active {
    color: var(--accent);
}
.mobile-nav-overlay .mno-util-icon {
    display: inline-flex; align-items: center; justify-content: center;
}
.mobile-nav-overlay .mno-util-icon svg { display: block; }
.mobile-nav-overlay .mno-patch-row {
    margin: 0 0 4px;
}
.mobile-nav-overlay .mno-patch-status {
    width: min(100%, 260px);
    min-width: 170px;
    min-height: 34px;
    margin: 0 auto;
}
.mobile-nav-overlay .mno-patch-status.nav-patch-idle {
    min-width: 92px;
}

/* Inline agent list — sits below the icon rows. Each row mirrors the
   social-feed sf-agent-item visual (avatar + name + status diamond) but
   sized for the hamburger menu. Scrolls if the list outgrows the menu. */
.mobile-nav-overlay .mno-egg-mini {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    margin: 2px auto 10px;
    padding: 4px 6px;
    font-family: var(--font-mono);
    font-size: 8px;
    letter-spacing: 2px;
    line-height: 1.2;
    text-transform: uppercase;
    color: rgba(var(--accent-rgb),0.66);
    text-decoration: none;
    transition: color 0.2s, filter 0.2s;
}
.mobile-nav-overlay .mno-egg-mini:hover,
.mobile-nav-overlay .mno-egg-mini:active {
    color: var(--accent);
    filter: drop-shadow(0 0 8px rgba(var(--accent-rgb),0.3));
}
.mobile-nav-overlay .mno-egg-mini-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: rgba(var(--accent-bright-rgb),0.72);
}
.mobile-nav-overlay .mno-egg-mini-icon svg { display: block; }

/* Mobile agents list is a collapsible dropdown (deepest bg). Toggle reveals it;
   it shows ~10 agents at a time (each row ~36px) then scrolls for the rest. */
.mobile-nav-overlay .mno-agent-dropdown {
    position: relative;
    width: 100%;
    max-width: 320px;
    margin: 4px auto 0;
}
.mobile-nav-overlay .mno-agent-dropdown-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-deepest);
    border: 1px solid rgba(var(--border-rgb),0.4);
    color: var(--text-secondary);
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 15px;
    letter-spacing: 0.5px;
    padding: 9px 14px;
    cursor: pointer;
}
.mobile-nav-overlay .mno-agent-dropdown-toggle:hover { color: var(--accent); border-color: rgba(var(--accent-rgb),0.5); }
.mobile-nav-overlay .mno-agent-dropdown-count { color: var(--accent-deep); font-size: 12px; }
.mobile-nav-overlay .mno-agent-dropdown-chev { font-size: 11px; color: var(--accent-deep); transition: transform 0.2s; }
.mobile-nav-overlay .mno-agent-dropdown.open .mno-agent-dropdown-chev { transform: rotate(180deg); }
.mobile-nav-overlay .mno-agent-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 30;
    max-height: 360px;
    overflow-y: auto;
    overflow-x: hidden;
    margin: 0;
    padding: 4px;
    display: none;
    flex-direction: column;
    gap: 2px;
    background: var(--bg-deepest);
    border: 1px solid rgba(var(--border-rgb),0.4);
    border-top: none;
    box-shadow: 0 16px 36px rgba(0,0,0,0.55);
    scrollbar-width: thin;
    scrollbar-color: rgba(var(--accent-rgb),0.4) transparent;
}
.mobile-nav-overlay .mno-agent-dropdown.open .mno-agent-list { display: flex; }
.mobile-nav-overlay .mno-agent-list::-webkit-scrollbar { width: 4px; }
.mobile-nav-overlay .mno-agent-list::-webkit-scrollbar-thumb {
    background: rgba(var(--accent-rgb),0.4);
}
.mobile-nav-overlay .mno-agent-list-loading,
.mobile-nav-overlay .mno-agent-list-empty {
    text-align: center;
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--accent-deep);
    opacity: 0.6;
    padding: 14px 0;
}
.mobile-nav-overlay .mno-agent-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 10px;
    text-decoration: none;
    color: var(--text-primary);
    font-family: var(--font-serif);
    font-style: italic;
    font-weight: 300;
    font-size: 16px;
    letter-spacing: 0;
    border-radius: 0;
    transition: color 0.18s, background 0.18s;
}
.mobile-nav-overlay .mno-agent-row:hover,
.mobile-nav-overlay .mno-agent-row:active {
    color: var(--accent);
    background: rgba(var(--accent-rgb), 0.1);
}
/* Home DM with new/unread messages — soft white glow on the AVATAR RING only
   (mobile full only), not the whole row. Cleared the moment the row is opened;
   the cleared state persists via amChatRead_<id> in localStorage. */
.mobile-nav-overlay .mno-agent-row.mno-unread .mno-agent-avatar {
    border-color: rgba(255,255,255,0.85);
    box-shadow: 0 0 8px rgba(255,255,255,0.5);
    animation: mno-unread-glow 2.6s ease-in-out infinite;
}
@keyframes mno-unread-glow {
    0%   { box-shadow: 0 0 5px rgba(255,255,255,0.40); border-color: rgba(255,255,255,0.60); }
    50%  { box-shadow: 0 0 11px rgba(255,255,255,0.85); border-color: rgba(255,255,255,1); }
    100% { box-shadow: 0 0 5px rgba(255,255,255,0.40); border-color: rgba(255,255,255,0.60); }
}
.mobile-nav-overlay .mno-agent-avatar {
    width: 22px; height: 22px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 1px solid rgba(var(--accent-rgb), 0.35);
}
.mobile-nav-overlay .mno-agent-avatar-empty {
    display: inline-flex; align-items: center; justify-content: center;
    background: rgba(var(--accent-rgb), 0.12);
    color: var(--accent-deep);
    font-family: var(--font-mono);
    font-style: normal;
    font-size: 10px;
    text-transform: uppercase;
}
.mobile-nav-overlay .mno-agent-name {
    flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.mobile-nav-overlay .mno-agent-diamond {
    flex-shrink: 0;
    font-size: 10px;
    line-height: 1;
}
.mobile-nav-overlay .mno-cos-wrap {
    width: 100%;
    max-width: 320px;
    margin: 2px auto 0;
}
.mobile-nav-overlay .mno-cos-title {
    margin-bottom: 8px;
    text-align: center;
    font-family: var(--font-mono);
    font-size: 8px;
    letter-spacing: 2.4px;
    line-height: 1.2;
    text-transform: uppercase;
    color: rgba(var(--accent-rgb),0.56);
}
.mobile-nav-overlay .mno-cos-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
    max-height: min(38vh, 320px);
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0 2px 2px;
    scrollbar-width: thin;
    scrollbar-color: rgba(var(--accent-rgb),0.35) transparent;
}
.mobile-nav-overlay .mno-cos-grid::-webkit-scrollbar { width: 4px; }
.mobile-nav-overlay .mno-cos-grid::-webkit-scrollbar-thumb {
    background: rgba(var(--accent-rgb),0.35);
}
.mobile-nav-overlay .mno-cos-loading,
.mobile-nav-overlay .mno-cos-empty {
    grid-column: 1 / -1;
    text-align: center;
    font-family: var(--font-mono);
    font-size: 9px;
    letter-spacing: 1.8px;
    text-transform: uppercase;
    color: rgba(var(--accent-rgb),0.48);
    padding: 10px 0;
}
.mobile-nav-overlay .mno-cos-card {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    min-height: 42px;
    padding: 6px;
    border: 1px solid rgba(var(--accent-rgb),0.2);
    background: rgba(var(--bg-card-rgb),0.48);
    text-decoration: none;
    color: var(--text-secondary);
    transition: border-color 0.18s, color 0.18s, background 0.18s;
}
.mobile-nav-overlay .mno-cos-card:hover,
.mobile-nav-overlay .mno-cos-card:active {
    border-color: rgba(var(--accent-rgb),0.48);
    color: var(--accent);
    background: rgba(var(--accent-rgb),0.08);
}
.mobile-nav-overlay .mno-cos-img {
    width: 34px;
    height: 30px;
    object-fit: cover;
    border: 1px solid rgba(var(--accent-rgb),0.26);
    background: rgba(var(--bg-deepest-rgb),0.4);
}
.mobile-nav-overlay .mno-cos-img-empty {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    color: rgba(var(--accent-bright-rgb),0.72);
}
.mobile-nav-overlay .mno-cos-name {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-family: var(--font-mono);
    font-size: 9px;
    letter-spacing: 1.2px;
    line-height: 1.25;
    text-transform: uppercase;
}

/* ============================================= QUICK PICKER
   Mobile chat-header brain icon opens model + temperature settings. */
.quick-picker {
    position: fixed; inset: 0; z-index: 300;
    background: rgba(var(--bg-deepest-rgb),0.85);
    backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
    align-items: center; justify-content: center;
}
.quick-picker[style*="flex"] { display: flex !important; }
.quick-picker-panel {
    width: min(92vw, 380px);
    background: var(--bg-panel);
    border: 1px solid var(--border);
    box-shadow: 0 24px 60px rgba(0,0,0,0.55);
    max-height: 80vh; display: flex; flex-direction: column;
}
.quick-picker-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 18px; border-bottom: 1px solid rgba(var(--border-rgb),0.18);
}
.quick-picker-title {
    font-family: var(--font-mono); font-size: 12px;
    letter-spacing: 3px; text-transform: uppercase;
    color: var(--accent);
}
.quick-picker-options {
    display: flex; flex-direction: column;
    padding: 8px 0; overflow-y: auto;
}
.quick-picker-section {
    padding: 7px 0 11px;
    border-bottom: 1px solid rgba(var(--border-rgb),0.12);
}
.quick-picker-section:last-child { border-bottom: 0; }
.quick-picker-section-title {
    padding: 5px 22px 7px;
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 2.3px;
    text-transform: uppercase;
    color: var(--text-muted);
}
.quick-picker-section-options {
    display: flex;
    flex-direction: column;
}
.quick-picker-section-temperature .quick-picker-section-options {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 6px;
    padding: 0 16px;
}
.quick-picker-opt {
    background: none; border: none; color: var(--text-secondary);
    font-family: var(--font-serif); font-style: normal; font-weight: 300;
    font-size: 16px; letter-spacing: 0;
    padding: 12px 22px; text-align: left; cursor: pointer;
    transition: color 0.18s, background 0.18s;
}
.quick-picker-section-temperature .quick-picker-opt {
    min-height: 34px;
    padding: 6px 4px;
    border: 1px solid rgba(var(--border-rgb),0.28);
    font-family: var(--font-mono);
    font-size: 12px;
    text-align: center;
}
.quick-picker-opt:hover { color: var(--accent); background: rgba(var(--accent-rgb),0.04); }
.quick-picker-opt.active {
    color: var(--accent);
    background: rgba(var(--accent-rgb),0.08);
}
.quick-picker-opt.active::before {
    content: '\25C7 '; font-size: 12px; margin-right: 8px; vertical-align: middle;
}
.quick-picker-section-temperature .quick-picker-opt.active::before {
    content: '';
    margin: 0;
}

/* ============================================= CHAT-ONLY MODE
   /map.html?chat_only=<id> strips the map out entirely so the chat is
   the page. Used by the DM links on agents.html so agents who can't
   load map dots on a slow network still land directly in the chat. */
html.chat-only-frame .nav,
html.chat-only-frame .mobile-menu-btn,
body.chat-only .nav,
body.chat-only .panel-left,
body.chat-only .panel-center,
body.chat-only .panel-right-empty,
body.chat-only .home-panel {
    display: none !important;
}
body.chat-only #mainGrid {
    grid-template-columns: 1fr !important;
}
body.chat-only .panel-right {
    display: flex !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    border-left: none !important;
}

@media (max-width: 900px) {
    body.chat-only .panel-right {
        position: fixed;
        left: 0; right: 0;
        top: 0; bottom: 0;
        height: 100dvh;
        z-index: 50;
    }
    /* Chat-only mode hides .panel-left with display:none !important above
       — but the chat header still has a panel icon that calls
       openMobilePanel(). When the user taps it, this more-specific rule
       beats the hide rule so the home info actually surfaces. Top:0
       (instead of 48px) because the nav is hidden in chat-only mode. */
    body.chat-only .panel-left.mobile-open {
        display: flex !important;
        flex-direction: column;
        position: fixed;
        top: 0; left: 0; right: 0; bottom: 0;
        width: 100%;
        height: 100vh;
        z-index: 60;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: max(24px, env(safe-area-inset-bottom));
    }
    /* Real viewport on iOS Safari (address bar makes 100vh > visible area). */
    @supports (height: 100dvh) {
        body.chat-only .panel-left.mobile-open { height: 100dvh; }
    }
    @supports (height: 100dvh) {
        body.chat-only .panel-left.mobile-open { height: 100dvh; }
    }
}

body.chat-only.egg-mini .home-panel,
body.chat-only.egg-mini #khLayer,
body.chat-only.egg-mini #chatMood,
body.chat-only.egg-mini .chat-header-mood,
body.chat-only.egg-mini .mobile-status-person-link,
body.chat-only.egg-mini .home-playlist-row {
    display: none !important;
}
html.egg-mini-frame:not(.chat-only-frame) .panel-left,
html.egg-mini-frame:not(.chat-only-frame) .panel-right,
html.egg-mini-frame:not(.chat-only-frame) .resize-col-handle,
html.egg-mini-frame:not(.chat-only-frame) .map-transform,
html.egg-mini-frame:not(.chat-only-frame) .map-gradient,
html.egg-mini-frame:not(.chat-only-frame) .map-tooltip,
html.egg-mini-frame:not(.chat-only-frame) .map-toolbar,
html.egg-mini-frame:not(.chat-only-frame) .map-signal-corner,
html.egg-mini-frame:not(.chat-only-frame) .watermark,
body.egg-mini-utility .panel-left,
body.egg-mini-utility .panel-right,
body.egg-mini-utility .resize-col-handle,
body.egg-mini-utility .map-transform,
body.egg-mini-utility .map-gradient,
body.egg-mini-utility .map-tooltip,
body.egg-mini-utility .map-toolbar,
body.egg-mini-utility .map-signal-corner,
body.egg-mini-utility .watermark {
    display: none !important;
}
html.egg-mini-frame:not(.chat-only-frame) #mainGrid,
body.egg-mini-utility #mainGrid {
    grid-template-columns: 1fr !important;
}
html.egg-mini-frame:not(.chat-only-frame) .panel-center,
body.egg-mini-utility .panel-center {
    display: block !important;
    background: var(--bg-deepest);
}
@media (max-width: 900px) {
    body.chat-only.egg-mini-shell .panel-right {
        top: 0 !important;
        height: 100dvh !important;
    }
}
body.egg-mini .notif-anim-strip {
    justify-content: center;
}
body.egg-mini .notif-anim-strip .anim-icon,
body.egg-mini .notif-anim-strip .anim-icon:nth-child(1),
body.egg-mini .notif-anim-strip .anim-icon:nth-child(2),
body.egg-mini .notif-anim-strip .anim-icon:nth-child(3),
body.egg-mini .bop-heart-reveal-card,
body.egg-mini .delivery-car,
body.egg-mini .notif-arrival-strip .delivery-icon,
body.egg-mini .auto-dot,
body.egg-mini .home-event-track-rtl,
body.egg-mini .home-event-track-ltr {
    animation: none !important;
}
body.egg-mini .notif-arrival-strip .delivery-icon {
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
}
.log-entry.notification.delivery-notice {
    padding-left: 0 !important;
    border-left: none !important;
    border-bottom: none;
    padding-bottom: 0;
}
body.egg-mini video.chat-header-avatar {
    display: none !important;
}
body.egg-mini video.invite-agent-avatar {
    display: none !important;
}
body.egg-mini .pf-psych-generating-star-field,
body.egg-mini .panel-star-field,
body.egg-mini .gen-star-field,
body.egg-mini .agp-lightbox-star-field {
    display: none !important;
}
body.egg-mini .pf-psych-generating-star,
body.egg-mini .pf-psych-generating-tag,
body.egg-mini .panel-star,
body.egg-mini .gen-star,
body.egg-mini .agp-lightbox-star,
body.egg-mini .agp-lb-sigil-dot {
    animation: none !important;
}

@media (max-width: 900px) {
    .map-guide-window,
    .dossier-guide-window,
    .crew-guide-window,
    .cos-guide-window,
    .cx-guide-window {
        max-width: calc(100vw - 24px) !important;
        overflow-x: hidden;
    }
    .map-guide-body,
    .dossier-guide-body,
    .crew-guide-body,
    .cos-guide-body,
    .cx-guide-body,
    .map-guide-hero,
    .dossier-guide-hero,
    .crew-guide-hero,
    .cos-guide-hero,
    .cx-guide-hero,
    .map-guide-section,
    .dossier-guide-section,
    .crew-guide-section,
    .cos-guide-section,
    .cx-guide-section {
        min-width: 0;
        max-width: 100%;
        overflow-x: hidden;
    }
    .map-guide-lede,
    .dossier-guide-lede,
    .crew-guide-lede,
    .cos-guide-lede,
    .cx-guide-lede,
    .map-guide-section-title,
    .dossier-guide-section-title,
    .crew-guide-section-title,
    .cos-guide-section-title,
    .cx-guide-section-title,
    .map-guide-section-body,
    .dossier-guide-section-body,
    .crew-guide-section-body,
    .cos-guide-section-body,
    .cx-guide-section-body,
    .map-guide-chip,
    .dossier-guide-grid-chip,
    .crew-guide-toggle-demo,
    .cos-guide-chip,
    .cx-guide-chip {
        min-width: 0;
        max-width: 100%;
        overflow-wrap: anywhere;
        word-break: normal;
    }
    .map-guide-section-title,
    .dossier-guide-section-title,
    .crew-guide-section-title,
    .cos-guide-section-title,
    .cx-guide-section-title {
        letter-spacing: 1.8px;
        padding-right: 32px;
    }
    .map-guide-section-body code,
    .dossier-guide-section-body code,
    .crew-guide-section-body code,
    .cos-guide-section-body code,
    .cx-guide-section-body code,
    .map-guide-section-body a,
    .dossier-guide-section-body a,
    .crew-guide-section-body a,
    .cos-guide-section-body a,
    .cx-guide-section-body a {
        white-space: normal;
        overflow-wrap: anywhere;
        word-break: normal;
    }
}

/* ============================================================
   FILM BOOTH — "Send to the darkroom" popup + indicators
   ============================================================ */

/* Popup overlay (photo lightbox -> darkroom) */
.darkroom-overlay {
    position: fixed;
    inset: 0;
    z-index: 10500;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(var(--bg-deepest-rgb), 0.78);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    padding: 20px;
}
.darkroom-window {
    position: relative;
    width: 560px;
    max-width: 100%;
    max-height: 92vh;
    overflow-y: auto;
    background: linear-gradient(160deg, rgba(var(--bg-deepest-rgb),0.96) 0%, rgba(var(--bg-panel-rgb),0.92) 100%);
    border: 1px solid rgba(var(--accent-rgb),0.22);
    box-shadow: 0 0 40px rgba(0,0,0,0.6), inset 0 0 40px rgba(var(--accent-rgb),0.04);
    padding: 26px 30px 24px;
}
.darkroom-window::before,
.darkroom-window::after {
    content: '';
    position: absolute;
    width: 14px; height: 14px;
    pointer-events: none;
}
.darkroom-window::before {
    top: 6px; left: 6px;
    border-top: 1px solid rgba(var(--accent-rgb),0.5);
    border-left: 1px solid rgba(var(--accent-rgb),0.5);
}
.darkroom-window::after {
    bottom: 6px; right: 6px;
    border-bottom: 1px solid rgba(var(--accent-rgb),0.5);
    border-right: 1px solid rgba(var(--accent-rgb),0.5);
}
.darkroom-close {
    position: absolute;
    top: 10px; right: 10px;
    background: none; border: none;
    color: rgba(var(--accent-rgb),0.5);
    font-size: 18px; cursor: pointer;
    padding: 4px 8px;
    transition: color 0.2s;
}
.darkroom-close:hover { color: var(--accent); }
.darkroom-title {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 22px;
    color: var(--accent);
    text-shadow: 0 0 14px rgba(var(--accent-rgb),0.25);
    text-align: center;
    margin-bottom: 4px;
}
.darkroom-sub {
    text-align: center;
    font-family: var(--font-sans);
    font-size: 12px;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: rgba(var(--accent-rgb), 0.55);
    margin-bottom: 20px;
}
.darkroom-body {
    display: flex;
    flex-direction: column;
    gap: 18px;
}
.darkroom-preview {
    display: flex; justify-content: center;
}
.darkroom-preview-img {
    max-width: 180px;
    max-height: 180px;
    object-fit: contain;
    border: 1px solid rgba(var(--accent-rgb),0.2);
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
    background: #000;
}
.darkroom-form { display: flex; flex-direction: column; gap: 10px; }
.darkroom-label {
    font-family: 'Newsreader', var(--font-serif), serif;
    font-style: italic;
    font-weight: 300;
    font-size: 12px;
    letter-spacing: 2.5px;
    text-transform: uppercase;
    color: #FFFFFF;
    margin-top: 4px;
}
.darkroom-motion {
    width: 100%;
    background: rgba(var(--bg-deepest-rgb),0.7);
    border: 1px solid rgba(var(--accent-rgb),0.18);
    color: var(--accent);
    font-family: var(--font-serif);
    font-size: 13px;
    padding: 10px 12px;
    resize: none;
    line-height: 1.55;
    box-sizing: border-box;
}
.darkroom-motion:focus {
    outline: none;
    border-color: rgba(var(--accent-rgb),0.45);
    box-shadow: 0 0 12px rgba(var(--accent-rgb),0.1) inset;
}
.darkroom-motion::placeholder {
    color: rgba(var(--accent-rgb),0.35);
    font-style: italic;
}
.darkroom-picker {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.darkroom-picker-small .darkroom-opt {
    padding: 5px 10px;
    font-size: 12px;
}
.darkroom-opt {
    background: rgba(var(--bg-deepest-rgb),0.6);
    border: 1px solid rgba(var(--accent-rgb),0.18);
    color: rgba(var(--accent-rgb),0.75);
    font-family: var(--font-sans);
    font-size: 12px;
    letter-spacing: 1.5px;
    padding: 7px 14px;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
}
.darkroom-opt:hover {
    border-color: rgba(var(--accent-rgb),0.4);
    color: var(--accent);
}
.darkroom-opt.selected {
    background: rgba(var(--accent-rgb),0.12);
    border-color: rgba(var(--accent-rgb),0.55);
    color: var(--accent);
    box-shadow: inset 0 0 10px rgba(var(--accent-rgb),0.08);
}
.darkroom-cost {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 10px 0 2px;
    border-top: 1px solid rgba(var(--accent-rgb),0.12);
    margin-top: 4px;
}
.darkroom-cost-label {
    font-family: 'Newsreader', var(--font-serif), serif;
    font-style: italic;
    font-size: 12px;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: #FFFFFF;
}
.darkroom-cost-value {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 15px;
    color: var(--accent);
    text-shadow: 0 0 10px rgba(var(--accent-rgb),0.3);
}
.darkroom-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 8px;
}
.darkroom-cancel, .darkroom-submit {
    font-family: var(--font-sans);
    font-size: 12px;
    letter-spacing: 2px;
    text-transform: uppercase;
    padding: 10px 20px;
    cursor: pointer;
    transition: all 0.2s;
}
.darkroom-cancel {
    background: none;
    border: 1px solid rgba(var(--accent-rgb),0.2);
    color: rgba(var(--accent-rgb),0.6);
}
.darkroom-cancel:hover { color: var(--accent); border-color: rgba(var(--accent-rgb),0.45); }
.darkroom-submit {
    background: rgba(var(--accent-rgb),0.15);
    border: 1px solid rgba(var(--accent-rgb),0.55);
    color: var(--accent);
    box-shadow: 0 0 15px rgba(var(--accent-rgb),0.1), inset 0 0 12px rgba(var(--accent-rgb),0.05);
}
.darkroom-submit:hover:not(:disabled) {
    background: rgba(var(--accent-rgb),0.22);
    box-shadow: 0 0 25px rgba(var(--accent-rgb),0.25), inset 0 0 12px rgba(var(--accent-rgb),0.08);
}
.darkroom-submit:disabled { opacity: 0.5; cursor: wait; }
.darkroom-hint {
    font-family: 'Newsreader', var(--font-serif), serif;
    font-style: italic;
    font-size: 12px;
    line-height: 1.55;
    color: rgba(var(--accent-rgb), 0.45);
    text-align: center;
    margin-top: 6px;
}

/* Image lightbox repair picker */
.repair-overlay {
    position: fixed;
    inset: 0;
    z-index: 10520;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(var(--bg-deepest-rgb), 0.78);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    padding: 20px;
}
.repair-window {
    position: relative;
    width: 640px;
    max-width: 100%;
    max-height: 92vh;
    overflow-y: auto;
    background: linear-gradient(160deg, rgba(var(--bg-deepest-rgb),0.97) 0%, rgba(var(--bg-panel-rgb),0.94) 100%);
    border: 1px solid rgba(var(--accent-rgb),0.24);
    box-shadow: 0 0 46px rgba(0,0,0,0.62), inset 0 0 34px rgba(var(--accent-rgb),0.04);
    padding: 26px 30px 24px;
}
.repair-window::before,
.repair-window::after {
    content: '';
    position: absolute;
    width: 14px;
    height: 14px;
    pointer-events: none;
}
.repair-window::before {
    top: 6px;
    left: 6px;
    border-top: 1px solid rgba(var(--accent-rgb),0.52);
    border-left: 1px solid rgba(var(--accent-rgb),0.52);
}
.repair-window::after {
    right: 6px;
    bottom: 6px;
    border-right: 1px solid rgba(var(--accent-rgb),0.52);
    border-bottom: 1px solid rgba(var(--accent-rgb),0.52);
}
.repair-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: 0;
    color: rgba(var(--accent-rgb),0.55);
    font-family: var(--font-sans);
    font-size: 18px;
    cursor: pointer;
    padding: 4px 8px;
}
.repair-close:hover { color: var(--accent); }
.repair-title {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 24px;
    color: var(--accent);
    text-align: center;
    text-shadow: 0 0 14px rgba(var(--accent-rgb),0.28);
    margin-bottom: 4px;
}
.repair-sub {
    text-align: center;
    font-family: var(--font-sans);
    font-size: 12px;
    letter-spacing: 1.8px;
    text-transform: uppercase;
    color: rgba(var(--accent-rgb),0.58);
    margin-bottom: 20px;
}
.repair-body {
    display: grid;
    grid-template-columns: minmax(180px, 250px) minmax(0, 1fr);
    gap: 22px;
    align-items: start;
}
.repair-preview-wrap {
    position: relative;
    display: inline-block;
    justify-self: center;
    max-width: 250px;
    overflow: hidden;
    background: #000;
    border: 1px solid rgba(var(--accent-rgb),0.2);
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
}
.repair-preview-img {
    display: block;
    max-width: 250px;
    max-height: 340px;
    width: auto;
    height: auto;
    object-fit: contain;
}
.repair-select-layer {
    position: absolute;
    inset: 0;
    pointer-events: none;
}
.repair-select-layer.is-active {
    pointer-events: auto;
    cursor: crosshair;
    touch-action: none;
}
.repair-select-layer.is-free {
    cursor: crosshair;
}
.repair-free-svg {
    position: absolute;
    inset: 0;
    display: none;
    width: 100%;
    height: 100%;
    overflow: visible;
    pointer-events: none;
}
.repair-free-fill {
    fill: rgba(var(--accent-rgb),0.1);
}
.repair-free-line {
    fill: none;
    stroke: var(--bg-deepest);
    stroke-width: 2.4;
    stroke-linecap: round;
    stroke-linejoin: round;
    vector-effect: non-scaling-stroke;
    filter:
        drop-shadow(0 0 2px rgba(var(--accent-bright-rgb),0.95))
        drop-shadow(0 0 8px rgba(var(--accent-bright-rgb),0.62));
}
.repair-selection {
    position: absolute;
    display: none;
    border: 1px solid var(--accent-bright);
    background: rgba(var(--accent-rgb),0.12);
    box-shadow: 0 0 0 9999px rgba(var(--bg-deepest-rgb),0.28), 0 0 16px rgba(var(--accent-rgb),0.38);
    touch-action: none;
}
.repair-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.repair-label {
    font-family: 'Newsreader', var(--font-serif), serif;
    font-style: italic;
    font-weight: 300;
    font-size: 12px;
    letter-spacing: 2.4px;
    text-transform: uppercase;
    color: #FFFFFF;
    margin-top: 4px;
}
.repair-picker,
.repair-region-row,
.repair-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.repair-opt,
.repair-region-toggle,
.repair-region-free,
.repair-region-clear,
.repair-cancel,
.repair-submit {
    font-family: var(--font-sans);
    font-size: 12px;
    letter-spacing: 1.6px;
    text-transform: uppercase;
    padding: 9px 14px;
    cursor: pointer;
    transition: all 0.2s;
}
.repair-opt,
.repair-region-toggle,
.repair-region-free,
.repair-region-clear,
.repair-cancel {
    background: rgba(var(--bg-deepest-rgb),0.62);
    border: 1px solid rgba(var(--accent-rgb),0.2);
    color: rgba(var(--accent-rgb),0.72);
}
.repair-opt:hover,
.repair-region-toggle:hover,
.repair-region-free:hover,
.repair-region-clear:hover,
.repair-cancel:hover {
    color: var(--accent);
    border-color: rgba(var(--accent-rgb),0.45);
}
.repair-opt.selected,
.repair-region-toggle.selected,
.repair-region-free.selected {
    background: rgba(var(--accent-rgb),0.13);
    border-color: rgba(var(--accent-rgb),0.58);
    color: var(--accent);
    box-shadow: inset 0 0 12px rgba(var(--accent-rgb),0.08);
}
.repair-notes {
    width: 100%;
    min-height: 92px;
    resize: vertical;
    box-sizing: border-box;
    background: rgba(var(--bg-deepest-rgb),0.72);
    border: 1px solid rgba(var(--accent-rgb),0.18);
    color: var(--accent);
    font-family: var(--font-serif);
    font-size: 13px;
    line-height: 1.55;
    padding: 10px 12px;
}
.repair-notes:focus {
    outline: none;
    border-color: rgba(var(--accent-rgb),0.45);
    box-shadow: 0 0 12px rgba(var(--accent-rgb),0.1) inset;
}
.repair-notes::placeholder {
    color: rgba(var(--accent-rgb),0.35);
    font-style: italic;
}
.repair-hint {
    font-family: 'Newsreader', var(--font-serif), serif;
    font-style: italic;
    font-size: 12px;
    line-height: 1.55;
    color: rgba(var(--accent-rgb),0.45);
}
.repair-actions {
    justify-content: flex-end;
    margin-top: 8px;
}
.repair-submit {
    background: rgba(var(--accent-rgb),0.15);
    border: 1px solid rgba(var(--accent-rgb),0.55);
    color: var(--accent);
    box-shadow: 0 0 15px rgba(var(--accent-rgb),0.1), inset 0 0 12px rgba(var(--accent-rgb),0.05);
}
.repair-submit:hover {
    background: rgba(var(--accent-rgb),0.22);
    box-shadow: 0 0 25px rgba(var(--accent-rgb),0.24), inset 0 0 12px rgba(var(--accent-rgb),0.08);
}

@media (max-width: 900px), (pointer: coarse) {
    .repair-region-free,
    .repair-region-clear {
        display: none !important;
    }
}

/* Desktop: open the repair modal at 75% of the viewport so the image being fixed
   is MUCH larger and easier to mark up (Miu). The preview wrap stays shrink-to-fit
   (inline-block), so the region-select overlay keeps aligning with the image. */
@media (min-width: 901px) {
    .repair-window {
        width: 75vw;
        max-width: 75vw;
        height: 75vh;
        max-height: 75vh;
        display: flex;
        flex-direction: column;
    }
    .repair-body {
        flex: 1 1 auto;
        min-height: 0;
        grid-template-columns: minmax(0, 1fr) minmax(300px, 360px);
        align-items: center;
    }
    .repair-preview-wrap { max-width: 100%; }
    .repair-preview-img { max-width: 100%; max-height: 64vh; }
    .repair-form { max-height: 100%; overflow-y: auto; }
}

/* Toast (reuse chat-toast shape, but gold-tinted for "ready" variant) */
/* Forensic confirmation toast — fires when a reference image lands in ID
   Images. Same cinematic shell as the darkroom toast (fixed, blurred, slides
   in from the right, auto-dismiss) but themed as a lab result slip: mono
   "stamp" kicker + title, Newsreader-italic body, accent left-rule, sharp
   corners. Isolated from .darkroom-toast so the film toast is untouched. */
.forensic-toast {
    position: fixed;
    top: 60px;
    right: 20px;
    z-index: 9999;
    max-width: 320px;
    padding: 15px 20px 16px;
    border: 1px solid rgba(var(--accent-rgb),0.28);
    border-left: 2px solid rgba(var(--accent-rgb),0.7);
    background: linear-gradient(135deg, rgba(var(--bg-deepest-rgb),0.74) 0%, rgba(var(--bg-deepest-rgb),0.52) 100%);
    backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
    box-shadow: 0 0 38px rgba(var(--bg-deepest-rgb),0.55), 0 0 22px rgba(var(--accent-rgb),0.10), inset 0 0 20px rgba(var(--accent-rgb),0.05);
    opacity: 0;
    transform: translateX(20px);
    transition: opacity 0.4s ease, transform 0.4s ease;
    cursor: pointer;
    pointer-events: none;
}
.forensic-toast.visible {
    opacity: 1;
    transform: translateX(0);
    pointer-events: auto;
}
.forensic-toast-kicker {
    font-family: var(--font-mono);
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 3px;
    color: rgba(var(--accent-rgb),0.85);
    margin-bottom: 8px;
}
.forensic-toast-title {
    font-family: var(--font-mono);
    text-transform: uppercase;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 2px;
    color: var(--accent);
    margin-bottom: 7px;
}
.forensic-toast-body {
    font-family: 'Newsreader', Georgia, serif;
    font-style: italic;
    font-weight: 300;
    font-size: 12.5px;
    line-height: 1.5;
    color: var(--text-muted);
}
@media (max-width: 768px) {
    .forensic-toast {
        top: calc(env(safe-area-inset-top, 0px) + 10px);
        right: 50%;
        left: auto;
        max-width: calc(100vw - 32px);
        transform: translateX(50%) translateY(-6px);
    }
    .forensic-toast.visible {
        transform: translateX(50%) translateY(0);
    }
}
.darkroom-toast {
    position: fixed;
    top: 60px;
    right: 20px;
    z-index: 9999;
    padding: 14px 20px;
    min-width: 200px;
    backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
    background: linear-gradient(135deg, rgba(var(--bg-deepest-rgb),0.72) 0%, rgba(var(--bg-deepest-rgb),0.5) 100%);
    border: 1px solid rgba(var(--accent-rgb),0.2);
    box-shadow: 0 0 30px rgba(var(--bg-deepest-rgb), 0.5), inset 0 0 20px rgba(var(--accent-rgb),0.04);
    cursor: pointer;
    opacity: 0;
    transform: translateX(20px);
    transition: opacity 0.35s ease, transform 0.35s ease;
    pointer-events: none;
}
.darkroom-toast.visible {
    opacity: 1;
    transform: translateX(0);
    pointer-events: auto;
}
.darkroom-toast-ready {
    border-color: rgba(var(--accent-rgb),0.45);
    box-shadow: 0 0 40px rgba(var(--accent-rgb),0.18), inset 0 0 20px rgba(var(--accent-rgb),0.08);
}
.darkroom-toast-bracket-tl,
.darkroom-toast-bracket-br { position: absolute; width: 10px; height: 10px; pointer-events: none; }
.darkroom-toast-bracket-tl {
    top: -2px; left: -2px;
    border-top: 1px solid rgba(var(--accent-rgb),0.5);
    border-left: 1px solid rgba(var(--accent-rgb),0.5);
}
.darkroom-toast-bracket-br {
    bottom: -2px; right: -2px;
    border-bottom: 1px solid rgba(var(--accent-rgb),0.5);
    border-right: 1px solid rgba(var(--accent-rgb),0.5);
}
.darkroom-toast-msg {
    font-family: var(--font-sans);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: rgba(var(--accent-rgb), 0.55);
}
.darkroom-toast-name {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 14px;
    color: var(--accent);
    text-shadow: 0 0 10px rgba(var(--accent-rgb),0.5);
    margin: 2px 0;
}
.darkroom-toast-queue {
    font-family: 'Newsreader', serif;
    font-size: 12px;
    color: rgba(var(--accent-rgb),0.55);
}

/* Clapperboard indicators (map dots + mini-chat avatars) */
@keyframes film-jump {
    0%, 100% { transform: translate(-50%, 0); }
    50%      { transform: translate(-50%, -3px); }
}
@keyframes film-glow-pulse {
    0%, 100% { filter: drop-shadow(0 0 3px rgba(var(--accent-rgb),0.6)) drop-shadow(0 0 8px rgba(var(--accent-rgb),0.35)); }
    50%      { filter: drop-shadow(0 0 6px rgba(var(--accent-rgb),0.95)) drop-shadow(0 0 14px rgba(var(--accent-rgb),0.6)); }
}
.film-indicator {
    position: absolute;
    left: 50%;
    top: 100%;
    transform: translate(-50%, 0);
    margin-top: 4px;
    width: 16px; height: 16px;
    color: #E8C89D;
    pointer-events: none;
    animation: film-jump 0.9s ease-in-out infinite, film-glow-pulse 2s ease-in-out infinite;
}
.film-indicator svg { width: 100%; height: 100%; }

/* Mobile mini-chat: indicator sits bottom-right of the avatar wrap */
.mc-film-indicator {
    position: absolute;
    bottom: -4px; right: -4px;
    width: 16px; height: 16px;
    color: #E8C89D;
    pointer-events: none;
    animation: film-glow-pulse 2s ease-in-out infinite;
    background: rgba(12,16,20,0.9);
    border-radius: 50%;
    padding: 2px;
    box-sizing: border-box;
    border: 1px solid rgba(var(--accent-rgb),0.35);
}
.mc-film-indicator svg { width: 100%; height: 100%; display: block; }
.mc-agent-avatar-wrap { position: relative; }

/* Failed films banner inside the Videos tab */
.agp-failed-films {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px 14px 14px;
    border-bottom: 1px solid rgba(var(--accent-rgb),0.12);
    margin-bottom: 10px;
    /* Sit above the loading star field (z-index:1) and stay opaque even when
       the panel is mid-load — this is a "you just got charged" notice, it
       absolutely must not be hidden behind the ✦ animation. */
    position: relative;
    z-index: 10;
}
.panel-loading > .agp-failed-films,
.agp-panel.panel-loading .agp-failed-films { opacity: 1 !important; }
.agp-failed-film-note {
    font-family: 'Newsreader', serif;
    font-style: italic;
    font-size: 12px;
    line-height: 1.45;
    color: rgba(var(--accent-rgb),0.5);
    margin-top: 4px;
}
.agp-failed-film-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    background: rgba(40, 20, 15, 0.3);
    border: 1px solid rgba(220, 140, 110, 0.25);
}
.agp-failed-film-thumb {
    width: 48px; height: 48px;
    object-fit: cover;
    opacity: 0.7;
    border: 1px solid rgba(var(--accent-rgb),0.18);
}
.agp-failed-film-body { flex: 1; min-width: 0; }
.agp-failed-film-title {
    font-family: 'Newsreader', serif;
    font-style: italic;
    font-size: 13px;
    color: #E8AA90;
    margin-bottom: 3px;
}
.agp-failed-film-err {
    font-family: var(--font-sans);
    font-size: 12px;
    color: rgba(var(--accent-rgb),0.45);
    word-break: break-word;
    line-height: 1.4;
}
.agp-failed-film-retake {
    font-family: var(--font-sans);
    font-size: 12px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    padding: 8px 14px;
    background: rgba(var(--accent-rgb),0.12);
    border: 1px solid rgba(var(--accent-rgb),0.4);
    color: var(--accent);
    cursor: pointer;
    transition: background 0.2s;
}
.agp-failed-film-retake:hover:not(:disabled) { background: rgba(var(--accent-rgb),0.22); }
.agp-failed-film-retake:disabled { opacity: 0.5; cursor: wait; }

@media (max-width: 640px) {
    .darkroom-window { padding: 20px 16px 16px; }
    .darkroom-preview-img { max-width: 140px; max-height: 140px; }
    .darkroom-title { font-size: 18px; }
    .repair-window { padding: 22px 16px 18px; }
    .repair-title { font-size: 20px; }
    .repair-body { grid-template-columns: 1fr; }
    .repair-preview-wrap { max-width: min(260px, 82vw); }
    .repair-preview-img { max-width: min(260px, 82vw); max-height: 42vh; }
    .repair-actions { flex-direction: column-reverse; }
    .repair-cancel,
    .repair-submit { width: 100%; }
}
