:root {
    --bg-body: #ffffff;
    --bg-header: #f5f5f5;
    --bg-nav: #eeeeee;
    --bg-panel: #fafafa;
    --bg-card-hover: #f0f0f0;
    --bg-input: #ffffff;
    --bg-dropdown: #ffffff;
    --border: #ddd;
    --border-bright: #ccc;
    --text: #222;
    --text-secondary: #555;
    --text-muted: #999;
    --text-bright: #111;
    --link: #1a1a1a;
    --link-hover: #000;
    --accent: #333;
    --green-muted: #6b8f71;
    --green-light: #e8f0e9;
    --green-mid: #a3bfa8;
    --green-dark: #4a6b4f;
    --faction-sith: #aa2222;
    --faction-republic: #2255aa;
    --faction-imperial: #556677;
    --faction-fringe: #997700;
    --faction-rebel: #bb6622;
    --faction-mandalorian: #228877;
    --faction-separatist: #666;
    --faction-new-republic: #4488cc;
    --font-body: 'Instrument Sans','Avenir Next','Avenir','Trebuchet MS',system-ui,sans-serif;
    --font-serif: 'Instrument Serif','Georgia','Times New Roman','Palatino Linotype',serif;
    --font-mono: 'SF Mono','Menlo','Cascadia Code','Consolas',monospace;
    --max-w: 1200px;
    --transition: 0.15s ease;

    /* ===== MOTION =====
       Lifted from the smart-search component so every surface on the site
       enters and exits with the same character. */
    --ease-out-expo: cubic-bezier(0.22, 1, 0.36, 1);
    --ease-overshoot: cubic-bezier(0.16, 1.3, 0.3, 1);
    --dur-fast: 0.18s;
    --dur-mid: 0.28s;
    --dur-slow: 0.42s;

    /* ===== ELEVATION =====
       Two-part shadows: a wide green-tinted bloom plus a tight neutral
       contact shadow. Flat black shadows are what made the old chrome
       feel cheap next to the search palette. */
    --shadow-sm: 0 2px 8px rgba(74, 107, 79, 0.07), 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 12px 32px rgba(74, 107, 79, 0.13), 0 2px 6px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 18px 50px rgba(74, 107, 79, 0.16), 0 2px 8px rgba(0, 0, 0, 0.05);
    --ring: 0 0 0 4px rgba(107, 143, 113, 0.13);

    /* ===== RADII ===== */
    --radius-sm: 6px;
    --radius-md: 9px;
    --radius-lg: 16px;
    --radius-pill: 999px;
}

*,*::before,*::after { box-sizing: border-box; margin: 0; padding: 0; }
html {
    scroll-behavior: smooth;
    height: 100vh;
    overflow: hidden;
}

body {
    font-family: var(--font-body);
    background: var(--bg-body);
    color: var(--text);
    line-height: 1.55;
    height: 100vh;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    position: relative;
}

/* Animated green orbital-map background */
#orbital-bg {
    position: fixed;
    inset: -10%;
    z-index: -2;
    pointer-events: none;
    opacity: 0.11;
    animation: orbital-drift 60s ease-in-out infinite alternate;
}
#orbital-bg svg { display: block; width: 100%; height: 100%; }

@keyframes orbital-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}
@keyframes orbital-drift {
    0%   { transform: translate(-1.5%, -1%) scale(1.02); }
    100% { transform: translate(1.5%, 1.5%) scale(1.06); }
}
@media (prefers-reduced-motion: reduce) {
    #orbital-bg, #orbital-bg * { animation: none !important; }
}

a { color: var(--link); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--link-hover); text-decoration: underline; }

.site-wrap { display: flex; flex-direction: column; min-height: 100%; height: 100vh; overflow-y: auto; overflow-x: hidden; }

/* ===== HEADER ===== */
.site-header {
    /* Translucent rather than flat grey, so the orbital background and page
       content ghost through as you scroll — same trick as the search overlay. */
    background: rgba(252, 253, 252, 0.82);
    backdrop-filter: blur(14px) saturate(140%);
    -webkit-backdrop-filter: blur(14px) saturate(140%);
    border-bottom: 1px solid rgba(107, 143, 113, 0.16);
    position: sticky;
    top: 0;
    z-index: 100;
}
/* Hairline bloom under the header — reads as depth without a hard shadow. */
.site-header::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    height: 14px;
    pointer-events: none;
    background: linear-gradient(rgba(74, 107, 79, 0.055), transparent);
}

.header-top {
    max-width: var(--max-w);
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 11px 20px 10px;
}

.logo {
    position: relative;
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 30px;
    font-weight: 400;
    color: #111;
    letter-spacing: 0.5px;
    transition: color var(--dur-mid) var(--ease-out-expo);
}
.logo:hover { color: #000; text-decoration: none; }
.logo-accent {
    color: var(--green-dark);
    font-weight: 400;
    transition: color var(--dur-mid) var(--ease-out-expo);
}
.logo:hover .logo-accent { color: var(--green-muted); }
/* Underline sweeps out from the left on hover. */
.logo::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 2px;
    height: 1px;
    background: linear-gradient(90deg, var(--green-mid), transparent);
    transform: scaleX(0);
    transform-origin: left center;
    transition: transform var(--dur-slow) var(--ease-out-expo);
}
.logo:hover::after { transform: scaleX(1); }

.user-bar a {
    border-radius: var(--radius-sm);
    padding: 3px 8px;
    transition: background var(--dur-fast) ease, color var(--dur-fast) ease;
}
.user-bar a:hover { background: var(--green-light); text-decoration: none; }

.user-bar { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.user-bar .user-name { color: var(--text-bright); font-weight: 600; }
.user-bar .dot { color: var(--text-muted); font-size: 10px; }
.user-bar a { color: var(--text-secondary); font-size: 13px; }
.user-bar a:hover { color: #000; }

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}
.header-quote {
    border-left: 1px solid var(--border);
    padding-left: 16px;
    line-height: 1;
}
.header-quote em { font-family: var(--font-serif); color: var(--green-dark); font-size: 15px; font-style: italic; opacity: 0.85; }

/* ===== NAVIGATION ===== */
.main-nav {
    background: transparent;
    border-top: 1px solid rgba(107, 143, 113, 0.13);
}

.nav-list {
    max-width: var(--max-w);
    margin: 0 auto;
    display: flex;
    list-style: none;
    padding: 0 10px;
}

.nav-item { position: relative; }

.nav-link {
    position: relative;
    display: block;
    padding: 10px 14px 9px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: color var(--dur-mid) var(--ease-out-expo);
}
/* Indicator grows from the centre on expo easing instead of the old
   hard #333 border snapping on. */
.nav-link::after {
    content: '';
    position: absolute;
    left: 10px;
    right: 10px;
    bottom: 0;
    height: 2px;
    border-radius: 2px 2px 0 0;
    background: linear-gradient(90deg, var(--green-mid), var(--green-dark), var(--green-mid));
    transform: scaleX(0);
    transform-origin: center;
    transition: transform var(--dur-mid) var(--ease-out-expo);
}
.nav-link:hover,
.nav-item:focus-within > .nav-link,
.nav-item.active .nav-link {
    color: var(--green-dark);
    text-decoration: none;
}
.nav-link:hover::after,
.nav-item:focus-within > .nav-link::after,
.nav-item.active .nav-link::after { transform: scaleX(1); }
.nav-item.active .nav-link { color: var(--text-bright); }

/* Caret affordance on items that actually have a menu — derived from the
   markup with :has(), so index.html needs no extra elements. */
.nav-item:has(.dropdown) > .nav-link {
    padding-right: 24px;
}
.nav-item:has(.dropdown) > .nav-link::before {
    content: '';
    position: absolute;
    right: 12px;
    top: 50%;
    width: 5px;
    height: 5px;
    margin-top: -3px;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    border-radius: 0 0 1px 0;
    opacity: 0.45;
    transform: rotate(45deg);
    transform-origin: center;
    transition: transform var(--dur-mid) var(--ease-out-expo), opacity var(--dur-mid) ease;
}
.nav-item:has(.dropdown):hover > .nav-link::before,
.nav-item:has(.dropdown):focus-within > .nav-link::before {
    opacity: 0.9;
    transform: rotate(225deg) translate(-2px, -2px);
}

/* Dropdown
   Kept in the DOM and toggled with opacity/visibility instead of `display`,
   which is what makes the entrance animatable at all. Mirrors .ss-dropdown. */
.dropdown {
    display: block;
    position: absolute;
    top: calc(100% + 7px);
    left: 0;
    background: var(--bg-dropdown);
    border: 1px solid var(--green-light);
    border-radius: var(--radius-lg);
    min-width: 210px;
    padding: 6px;
    box-shadow: var(--shadow-lg);
    z-index: 200;

    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-9px) scale(0.97);
    transform-origin: top center;
    filter: blur(5px);
    transition: opacity var(--dur-mid) var(--ease-out-expo),
                transform var(--dur-mid) var(--ease-out-expo),
                filter var(--dur-mid) var(--ease-out-expo),
                visibility 0s linear var(--dur-mid);
}
.nav-item:hover > .dropdown,
.nav-item:focus-within > .dropdown {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0) scale(1);
    filter: blur(0);
    transition: opacity var(--dur-mid) var(--ease-out-expo),
                transform var(--dur-slow) var(--ease-overshoot),
                filter var(--dur-mid) var(--ease-out-expo),
                visibility 0s;
}

/* Invisible bridge across the 7px gap so the menu doesn't close when the
   cursor travels from the nav link down into it. */
.dropdown::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 100%;
    height: 10px;
}

/* The sweep line, borrowed straight from .ss-dropdown::before. */
.dropdown::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    height: 2px;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    background: linear-gradient(90deg, transparent, var(--green-mid), transparent);
    transform: scaleX(0);
    transition: transform var(--dur-slow) var(--ease-out-expo);
}
.nav-item:hover > .dropdown::before,
.nav-item:focus-within > .dropdown::before {
    transform: scaleX(1);
    transition-delay: 0.06s;
}

/* Menus on the right-hand end would otherwise run off the viewport. */
.nav-item:last-child > .dropdown,
.nav-item:nth-last-child(2) > .dropdown { left: auto; right: 0; }

.dropdown a {
    display: block;
    padding: 7px 12px;
    font-size: 13px;
    color: var(--text);
    border-radius: var(--radius-md);
    transition: background var(--dur-fast) ease, color var(--dur-fast) ease;
}
.dropdown a:hover {
    background: var(--green-light);
    color: var(--text-bright);
    text-decoration: none;
}

/* Staggered reveal. Delays live only in the open state so closing snaps
   shut cleanly rather than unwinding item by item. */
.dropdown a, .dropdown .mega-heading {
    opacity: 0;
    transform: translateY(6px);
    transition: opacity var(--dur-fast) ease,
                transform var(--dur-fast) ease,
                background var(--dur-fast) ease,
                color var(--dur-fast) ease;
}
.nav-item:hover > .dropdown a, .nav-item:focus-within > .dropdown a,
.nav-item:hover > .dropdown .mega-heading, .nav-item:focus-within > .dropdown .mega-heading {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.3s var(--ease-out-expo),
                transform 0.3s var(--ease-out-expo),
                background var(--dur-fast) ease,
                color var(--dur-fast) ease;
}
.nav-item:hover > .dropdown > *:nth-child(1),  .nav-item:focus-within > .dropdown > *:nth-child(1)  { transition-delay: 0.03s; }
.nav-item:hover > .dropdown > *:nth-child(2),  .nav-item:focus-within > .dropdown > *:nth-child(2)  { transition-delay: 0.055s; }
.nav-item:hover > .dropdown > *:nth-child(3),  .nav-item:focus-within > .dropdown > *:nth-child(3)  { transition-delay: 0.08s; }
.nav-item:hover > .dropdown > *:nth-child(4),  .nav-item:focus-within > .dropdown > *:nth-child(4)  { transition-delay: 0.105s; }
.nav-item:hover > .dropdown > *:nth-child(5),  .nav-item:focus-within > .dropdown > *:nth-child(5)  { transition-delay: 0.13s; }
.nav-item:hover > .dropdown > *:nth-child(6),  .nav-item:focus-within > .dropdown > *:nth-child(6)  { transition-delay: 0.155s; }
.nav-item:hover > .dropdown > *:nth-child(7),  .nav-item:focus-within > .dropdown > *:nth-child(7)  { transition-delay: 0.18s; }
.nav-item:hover > .dropdown > *:nth-child(8),  .nav-item:focus-within > .dropdown > *:nth-child(8)  { transition-delay: 0.2s; }
.nav-item:hover > .dropdown > *:nth-child(n+9), .nav-item:focus-within > .dropdown > *:nth-child(n+9) { transition-delay: 0.22s; }

/* Mega dropdown */
.dropdown-mega {
    display: flex;
    flex-direction: row;
    min-width: 500px;
    padding: 14px 8px;
    gap: 0;
}

.mega-col {
    position: relative;
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 0 10px;
}
/* Divider fades out at both ends instead of a hard rule edge to edge. */
.mega-col::after {
    content: '';
    position: absolute;
    top: 4px;
    bottom: 4px;
    right: 0;
    width: 1px;
    background: linear-gradient(transparent, var(--green-light) 22%, var(--green-light) 78%, transparent);
}
.mega-col:last-child::after { display: none; }

/* Serif italic section labels, matching .ss-section in the search palette. */
.mega-heading {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 13px;
    font-weight: 400;
    text-transform: none;
    color: var(--green-dark);
    letter-spacing: 0;
    padding: 4px 8px 5px;
}
.mega-heading.mt { margin-top: 14px; }

.mega-col a {
    padding: 5px 8px;
    font-size: 12.5px;
    border-radius: var(--radius-md);
}
.mega-col a:hover { background: var(--green-light); }

/* Mega columns stagger by column, since their links aren't direct children. */
.nav-item:hover > .dropdown-mega > .mega-col:nth-child(1) > *,
.nav-item:focus-within > .dropdown-mega > .mega-col:nth-child(1) > * { transition-delay: 0.04s; }
.nav-item:hover > .dropdown-mega > .mega-col:nth-child(2) > *,
.nav-item:focus-within > .dropdown-mega > .mega-col:nth-child(2) > * { transition-delay: 0.09s; }
.nav-item:hover > .dropdown-mega > .mega-col:nth-child(3) > *,
.nav-item:focus-within > .dropdown-mega > .mega-col:nth-child(3) > * { transition-delay: 0.14s; }

@media (prefers-reduced-motion: reduce) {
    .dropdown, .dropdown a, .dropdown .mega-heading, .dropdown::before,
    .nav-link::after, .nav-link::before, .logo::after {
        transition-duration: 0.01s !important;
        transition-delay: 0s !important;
        filter: none !important;
    }
    .dropdown { transform: none !important; }
}

/* ===== MAIN CONTENT ===== */
.main-content {
    flex: 1;
    max-width: var(--max-w);
    width: 100%;
    margin: 0 auto;
    padding: 24px 20px 80px;
}

/* ===== LOGIN ===== */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 80vh;
}
.login-box {
    width: 100%;
    max-width: 340px;
    padding: 32px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-panel);
}
.login-box h2 {
    font-family: var(--font-mono);
    font-size: 22px;
    font-weight: 700;
    color: var(--text-bright);
    margin-bottom: 4px;
}
.login-box h2 span { color: #888; }
.login-box .login-subtitle {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 24px;
}
.login-field {
    margin-bottom: 14px;
}
.login-field label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}
.login-field input {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg-input);
    font-family: var(--font-body);
    font-size: 14px;
    color: var(--text);
}
.login-field input:focus {
    outline: none;
    border-color: #999;
}
.login-error {
    font-size: 13px;
    color: #cc3333;
    margin-bottom: 12px;
    display: none;
}
.login-error.visible { display: block; }
.login-btn {
    width: 100%;
    padding: 10px;
    background: #333;
    color: #fff;
    border: 1px solid #333;
    border-radius: 4px;
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--transition);
}
.login-btn:hover { background: #555; }

/* ===== HOMEPAGE ===== */
.home-welcome {
    text-align: center;
    padding: 28px 20px;
    margin-bottom: 28px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-panel);
}
.home-welcome h2 { font-size: 22px; color: var(--text-bright); margin-bottom: 8px; }
.home-welcome p { color: var(--text-secondary); font-size: 14px; max-width: 600px; margin: 0 auto; }

.home-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 20px;
}

.home-section {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
}

.home-section-title {
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-bright);
    background: var(--bg-nav);
    border-bottom: 1px solid var(--border);
}

.home-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 14px;
    border-bottom: 1px solid #eee;
    transition: background var(--transition);
}
.home-item:last-child { border-bottom: none; }
.home-item:hover { background: var(--bg-card-hover); }

.home-item .faction-icon {
    height: 20px;
    width: auto;
    flex-shrink: 0;
}

.item-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #ccc;
    flex-shrink: 0;
}

.home-item .item-info { flex: 1; min-width: 0; }
.home-item .item-name {
    font-size: 13px;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.home-item .item-author { font-size: 11px; color: var(--text-muted); }

/* Faction icons — default size (inline in tables/lists) */
.faction-icon {
    height: 18px;
    width: auto;
    vertical-align: middle;
    display: inline-block;
    margin-right: 1px;
}

/* ===== CHARACTER BROWSE (two-panel) ===== */
.browse-layout {
    display: flex;
    gap: 20px;
    min-height: 60vh;
}
.browse-sidebar {
    width: 280px;
    flex-shrink: 0;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-panel);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.browse-sidebar-header {
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-bright);
    background: var(--bg-nav);
    border-bottom: 1px solid var(--border);
    display: flex;
    gap: 8px;
    align-items: center;
}
.browse-sidebar-header select {
    flex: 1;
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 4px 8px;
    border-radius: 3px;
    font-family: var(--font-body);
    font-size: 12px;
}
.browse-char-list {
    flex: 1;
    overflow-y: auto;
    max-height: 70vh;
}
.browse-char-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 14px;
    font-size: 13px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: background var(--transition);
}
.browse-char-item:hover { background: var(--bg-card-hover); }
.browse-char-item.selected { background: var(--bg-card-hover); border-left: 3px solid #333; }
.browse-char-item .bci-cost {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-secondary);
    min-width: 24px;
    text-align: right;
}
.browse-char-item .bci-name { flex: 1; }
.browse-detail {
    flex: 1;
    min-width: 0;
}
.browse-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 300px;
    color: var(--text-muted);
    font-size: 14px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-panel);
}
.browse-sidebar .empty-msg {
    padding: 20px 14px;
    color: var(--text-muted);
    font-size: 13px;
    text-align: center;
}

@media (max-width: 700px) {
    .browse-layout { flex-direction: column; }
    .browse-sidebar { width: 100%; }
    .browse-char-list { max-height: 200px; }
}

/* ===== CHARACTER SEARCH ===== */
.search-form {
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-panel);
    padding: 16px;
    margin-bottom: 20px;
}
.search-row {
    display: flex;
    gap: 16px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}
.search-group { flex: 1; min-width: 140px; }
.search-group-wide { flex: 2; }
.search-label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}
.search-input {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg-input);
    font-family: var(--font-body);
    font-size: 13px;
    color: var(--text);
}
.search-input:focus { outline: none; border-color: #999; }
.search-sel {
    padding: 4px 6px;
    border: 1px solid var(--border);
    border-radius: 3px;
    background: var(--bg-input);
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text);
}
.search-range {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-muted);
    flex-wrap: wrap;
}
.search-scrollbox {
    height: 110px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg-input);
    padding: 4px 6px;
}
.search-scrollbox-tall { height: 150px; }
.search-scrollbox-sm { height: 80px; }
.sbox-item {
    display: block;
    font-size: 12px;
    color: var(--text);
    padding: 1px 0;
    cursor: pointer;
    white-space: nowrap;
}
.sbox-item input { margin-right: 4px; vertical-align: middle; cursor: pointer; }
.sbox-link { color: var(--text); text-decoration: none; }
.sbox-link:hover { text-decoration: underline; }
.search-multi {
    width: 100%;
    height: 120px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg-input);
    font-family: var(--font-body);
    font-size: 12px;
    color: var(--text);
    padding: 2px;
}
.search-multi option { padding: 2px 4px; }
.search-checks {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 12px;
}
.search-check {
    font-size: 13px;
    color: var(--text);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
}
.search-check input { margin: 0; cursor: pointer; }
.search-actions {
    display: flex;
    gap: 8px;
    padding-top: 4px;
}
.btn-secondary {
    background: #fff;
    color: var(--text);
    border-color: var(--border);
}
.btn-secondary:hover { background: var(--bg-card-hover); }

/* ===== SQUAD EDITOR GRID =====
 * Two working panels side by side: the squad being built, and the character
 * pool to build it from. Giving each a surface and a gutter stops them from
 * reading as one undifferentiated wall of rows.
 */
.squad-editor-grid {
    display: flex;
    gap: 24px;
    margin-top: 18px;
    align-items: flex-start;
}
.se-left { flex: 1; min-width: 0; }
.se-right {
    flex: 1;
    min-width: 0;
    background: rgba(232, 240, 233, 0.34);
    border: 1px solid var(--green-light);
    border-radius: var(--radius-lg);
    padding: 14px;
}
.se-av-hd {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
    padding-bottom: 9px;
    border-bottom: 1px solid var(--green-light);
}
.se-av-hd strong {
    font-family: var(--font-serif);
    font-style: italic;
    font-weight: 400;
    font-size: 16px;
    color: var(--green-dark);
}
.se-rem-badge {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    font-size: 11.5px;
    color: var(--green-dark);
    background: #fff;
    border: 1px solid var(--green-light);
    border-radius: var(--radius-pill);
    padding: 3px 11px;
    white-space: nowrap;
}
.se-av-scroll { max-height: 620px; overflow-y: auto; }
@media (max-width: 800px) {
    .squad-editor-grid { flex-direction: column; gap: 18px; }
    .se-right { width: 100%; }
}

/* ===== SQUAD ACTIONS BAR ===== */
.squad-actions-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

/* ===== CHARACTER COMMENTS PAGE ===== */
.comments-filter-bar {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    flex-wrap: wrap;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-panel);
    margin-bottom: 16px;
}
.cf-group { flex: 1; min-width: 140px; }
.cf-actions { display: flex; gap: 6px; align-items: flex-end; padding-bottom: 1px; }
.cf-count { font-size: 13px; color: var(--text-secondary); padding: 8px 0; }
.cf-comment {
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-panel);
    padding: 12px 14px;
    margin-bottom: 8px;
}
.cf-comment-char { margin-bottom: 6px; font-size: 14px; font-weight: 600; }
.cf-comment-char a { color: var(--text-bright); }
.cf-comment-meta {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
    font-size: 13px;
}
.cf-comment-text { font-size: 14px; color: var(--text); line-height: 1.5; }
.cf-pagination {
    display: flex;
    gap: 4px;
    padding: 12px 0;
    flex-wrap: wrap;
    align-items: center;
}
.cf-page-btn {
    padding: 5px 10px;
    border: 1px solid var(--border);
    border-radius: 3px;
    background: var(--bg-input);
    font-family: var(--font-body);
    font-size: 12px;
    color: var(--text);
    cursor: pointer;
}
.cf-page-btn:hover { background: var(--bg-card-hover); }
.cf-page-btn.active { background: #333; color: #fff; border-color: #333; }

/* ===== CHARACTER COMPARE ===== */
.compare-layout {
    display: flex;
    gap: 20px;
}
.compare-side {
    flex: 1;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-panel);
    overflow: hidden;
}
.compare-header {
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-bright);
    background: var(--bg-nav);
    border-bottom: 1px solid var(--border);
}
.compare-selectors {
    display: flex;
    gap: 8px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
}
.compare-sel {
    flex: 1;
    padding: 6px 8px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg-input);
    font-family: var(--font-body);
    font-size: 12px;
    color: var(--text);
}
.compare-body { padding: 14px; }
.compare-faction { margin-bottom: 6px; }
.compare-name { font-size: 18px; color: var(--text-bright); margin-bottom: 12px; }
.compare-stat {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
    font-size: 13px;
    border-bottom: 1px solid #eee;
}
.compare-stat span { color: var(--text-secondary); }
.compare-stat strong { font-family: var(--font-mono); color: var(--text-bright); }
.compare-section {
    padding: 8px 0;
    font-size: 13px;
}
.compare-section strong { display: block; margin-bottom: 4px; color: var(--text-bright); }
.compare-section ul { list-style: none; padding-left: 0; }
.compare-section li {
    padding: 2px 0;
    color: var(--text-secondary);
    font-size: 12px;
}
.compare-section li::before { content: "• "; color: var(--text-muted); }
.compare-section p { color: var(--text-secondary); font-size: 12px; }
.cmp-diff { font-size: 11px; margin-left: 6px; font-weight: 400; }
.cmp-pos { color: #228822; }
.cmp-neg { color: #aa2222; }

@media (max-width: 640px) {
    .compare-layout { flex-direction: column; }
}

/* ===== CHARACTER BROWSE (table - old) ===== */
.page-title {
    font-family: var(--font-serif);
    font-size: 28px;
    font-weight: 400;
    color: var(--text-bright);
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--green-light);
}

.browse-controls {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.browse-controls input,
.browse-controls select {
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 8px 12px;
    border-radius: 4px;
    font-family: var(--font-body);
    font-size: 13px;
    transition: border-color var(--transition);
}
.browse-controls input:focus,
.browse-controls select:focus {
    outline: none;
    border-color: #999;
}
.browse-controls input { flex: 1; min-width: 200px; }

/*
 * Shared data table. Used by every list on the site, so the priorities are
 * scanability down a column and a clear row rhythm — not decoration.
 */
.char-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.char-table th {
    text-align: left;
    padding: 9px 12px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    white-space: nowrap;
    border-bottom: 1.5px solid var(--green-light);
}
/* Abbreviated headers (HP, Def, SA…) carry a title attribute; show that it's
   there rather than leaving users to discover it by accident. */
.char-table th[title] { cursor: help; }
.char-table th[title]:hover { color: var(--green-dark); }
.char-table td {
    padding: 9px 12px;
    border-bottom: 1px solid rgba(107, 143, 113, 0.11);
    vertical-align: middle;
}
.char-table tbody tr {
    transition: background var(--dur-fast) ease;
}
.char-table tbody tr:hover { background: rgba(232, 240, 233, 0.55); }
.char-table tbody tr:last-child td { border-bottom: none; }

/* Numeric columns: tabular figures so digits line up vertically. */
.char-table .col-stat {
    font-family: var(--font-mono);
    font-size: 12.5px;
    font-variant-numeric: tabular-nums;
    text-align: center;
    color: var(--text-secondary);
    width: 1%;
}
.char-table .col-cost {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    color: var(--text-bright);
    font-weight: 600;
    text-align: center;
    width: 1%;
    white-space: nowrap;
}
.char-table .col-set { font-size: 11px; color: var(--text-muted); white-space: nowrap; }
/* Name column takes the slack, so it reads as the primary column. */
.char-table td:has(> a:not(.faction-icon)) { min-width: 0; }

/* ===== CHARACTER DETAIL ===== */
.detail-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 20px;
}
.detail-header .faction-icon {
    height: 40px;
    width: auto;
}
.detail-header h1 { font-size: 24px; color: var(--text-bright); flex: 1; }
.detail-header .cost-badge {
    font-family: var(--font-mono);
    font-size: 22px;
    font-weight: 700;
    color: var(--text-bright);
    background: var(--bg-nav);
    padding: 6px 14px;
    border-radius: 6px;
    border: 1px solid var(--border);
}

.stat-block {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1px;
    background: var(--border);
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 20px;
}
.stat-cell { background: var(--bg-panel); padding: 14px 12px; text-align: center; }
.stat-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 4px;
}
.stat-value {
    font-family: var(--font-mono);
    font-size: 28px;
    font-weight: 700;
    color: var(--text-bright);
}

.detail-meta {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
    padding: 14px;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 6px;
}
.meta-item .meta-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}
.meta-item .meta-value { font-size: 14px; color: var(--text-bright); }

.ability-section { margin-bottom: 20px; }
.ability-section h3 {
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-bright);
    padding-bottom: 8px;
    margin-bottom: 10px;
    border-bottom: 1px solid var(--border);
}

.ability-item {
    padding: 8px 12px;
    margin-bottom: 4px;
    border-radius: 4px;
    border-left: 3px solid #ccc;
    background: var(--bg-panel);
}
.ability-item:hover { border-left-color: #888; }
.ability-name { font-weight: 700; color: var(--text-bright); font-size: 14px; }
.ability-desc { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }

/* ===== COMMANDER EFFECTS LIST ===== */
.ce-showing { font-size: 13px; color: var(--text-secondary); margin-bottom: 12px; }
.ce-table { table-layout: fixed; width: 100%; }
.ce-table th, .ce-table td { vertical-align: top; overflow-wrap: anywhere; word-break: break-word; }
.ce-table col.ce-col-faction { width: 14%; }
.ce-table col.ce-col-commander { width: 26%; }
.ce-table col.ce-col-cost { width: 8%; }
.ce-table col.ce-col-effect { width: 52%; }
.ce-table .ce-commander { font-weight: 600; color: var(--text-bright); }
.ce-table .ce-effect { font-size: 13px; color: var(--text-secondary); line-height: 1.45; }
.ce-pager {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
    margin: 12px 0;
}
.ce-page-btn {
    min-width: 32px;
    padding: 5px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: #fff;
    font-size: 13px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.15s;
}
.ce-page-btn:hover:not(:disabled) { background: var(--green-light); border-color: var(--green-mid); color: var(--green-dark); }
.ce-page-btn.active { background: var(--green-dark); border-color: var(--green-dark); color: #fff; font-weight: 600; }
.ce-page-btn:disabled { opacity: 0.4; cursor: default; }
.ce-page-ellipsis { padding: 0 4px; color: var(--text-muted); }

/* ===== GLOSSARY SELECTOR ===== */
.gloss-selector-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 22px;
    flex-wrap: wrap;
}
.gloss-selector-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--green-dark);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.gloss-select {
    flex: 1;
    min-width: 240px;
    max-width: 480px;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-input);
    font-family: var(--font-body);
    font-size: 14px;
}
.gloss-select:focus { outline: none; border-color: var(--green-mid); }

.flavor-text {
    padding: 14px 16px;
    margin-bottom: 20px;
    font-style: italic;
    color: var(--text-secondary);
    border-left: 3px solid #ccc;
    background: var(--bg-panel);
    border-radius: 0 6px 6px 0;
}

/* ===== SQUAD DETAIL ===== */
.squad-header { margin-bottom: 20px; }
.squad-header h1 { font-size: 22px; color: var(--text-bright); margin-bottom: 6px; }
.squad-meta-row {
    display: flex;
    gap: 16px;
    font-size: 13px;
    color: var(--text-secondary);
    flex-wrap: wrap;
    align-items: center;
}

.squad-table { width: 100%; border-collapse: collapse; font-size: 13px; margin-bottom: 20px; }
.squad-table th {
    text-align: center;
    padding: 8px 6px;
    background: var(--bg-nav);
    color: var(--text-bright);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--border-bright);
}
.squad-table th:nth-child(4) { text-align: left; }
.squad-table td {
    padding: 6px 6px;
    border-bottom: 1px solid #eee;
    text-align: center;
    vertical-align: middle;
}
.squad-table td:nth-child(4) { text-align: left; }
.squad-table tbody tr:hover { background: var(--bg-card-hover); }
.squad-table .stat-num { font-family: var(--font-mono); color: var(--text); }
.squad-table .cost-num { font-family: var(--font-mono); color: var(--text-bright); font-weight: 600; }

.squad-stats {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
    padding: 16px;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 6px;
    margin-bottom: 20px;
}
.squad-stat-item .ss-label {
    font-size: 10px;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.5px;
}
.squad-stat-item .ss-value {
    font-family: var(--font-mono);
    font-size: 20px;
    font-weight: 700;
    color: var(--text-bright);
}

.copy-paste {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 14px 16px;
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-secondary);
    white-space: pre-line;
    margin-bottom: 20px;
    line-height: 1.6;
    cursor: pointer;
    transition: border-color var(--transition);
}
.copy-paste:hover { border-color: #999; }
.copy-paste-label {
    font-family: var(--font-body);
    font-size: 11px;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 8px;
    letter-spacing: 0.5px;
}

/* ===== RATINGS ===== */
.rating-section {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
    padding: 14px;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 6px;
}
.avg-rating {
    font-family: var(--font-mono);
    font-size: 28px;
    font-weight: 700;
    color: #bb8800;
}
.rating-count { font-size: 12px; color: var(--text-muted); }
.rating-label { font-size: 12px; color: var(--text-secondary); }
.star-rating { display: flex; gap: 2px; }
.star {
    font-size: 20px;
    color: #ccc;
    cursor: pointer;
    transition: color var(--transition);
}
.star:hover, .star.active { color: #bb8800; }

/* ===== COMMENTS ===== */
.comments-section { margin-top: 24px; }
.comments-section h3 {
    font-size: 14px;
    text-transform: uppercase;
    color: var(--text-bright);
    letter-spacing: 0.5px;
    padding-bottom: 8px;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--border);
}
.comment {
    padding: 12px 14px;
    margin-bottom: 8px;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 6px;
}
.comment-header { display: flex; justify-content: space-between; margin-bottom: 6px; }
.comment-author { font-weight: 700; color: var(--text-bright); font-size: 13px; }
.comment-date { font-size: 11px; color: var(--text-muted); }
.comment-body { font-size: 14px; color: var(--text); }

.comment-form {
    margin-top: 16px;
    padding: 14px;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 6px;
}
.comment-form label { display: block; font-size: 13px; color: var(--text-secondary); margin-bottom: 6px; }
.comment-form .hint { font-size: 11px; color: var(--text-muted); font-style: italic; }
.comment-form textarea {
    width: 100%;
    min-height: 80px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 10px;
    border-radius: 4px;
    font-family: var(--font-body);
    font-size: 13px;
    resize: vertical;
    margin-top: 6px;
}
.comment-form textarea:focus { outline: none; border-color: #999; }

.btn {
    display: inline-block;
    padding: 8px 20px;
    background: #333;
    color: #fff;
    border: 1px solid #333;
    border-radius: 4px;
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--transition);
    margin-top: 8px;
}
.btn:hover { background: #555; }

/* ===== COMING SOON ===== */
.coming-soon { text-align: center; padding: 60px 20px; }
.coming-soon h2 { font-size: 20px; color: var(--text-bright); margin-bottom: 10px; }
.coming-soon p { color: var(--text-secondary); font-size: 14px; }
.coming-soon .cs-icon { font-size: 48px; margin-bottom: 16px; display: block; }

/* ===== PAGINATION ===== */
.pager {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 18px 0 4px;
    padding: 10px 4px 0;
    border-top: 1px solid var(--green-light);
}
.pager-quiet { justify-content: flex-end; border-top: none; padding-top: 0; }
.pager-btn {
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 600;
    color: var(--green-dark);
    background: #fff;
    border: 1px solid var(--green-light);
    border-radius: var(--radius-pill);
    padding: 6px 15px;
    cursor: pointer;
    transition: background var(--dur-fast) ease,
                border-color var(--dur-fast) ease,
                box-shadow var(--dur-mid) var(--ease-out-expo),
                transform 0.1s ease;
}
.pager-btn:hover:not(:disabled) {
    background: var(--green-light);
    border-color: var(--green-mid);
    box-shadow: var(--shadow-sm);
}
.pager-btn:active:not(:disabled) { transform: scale(0.97); }
.pager-btn:focus-visible { outline: none; box-shadow: var(--ring); }
.pager-btn:disabled { opacity: 0.38; cursor: default; }
.pager-pos {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 14px;
    color: var(--text-secondary);
}
.pager-total {
    margin-left: auto;
    font-size: 12px;
    color: var(--text-muted);
}
.list-loading, .list-empty, .list-error {
    padding: 18px 4px;
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 14px;
    color: var(--text-muted);
}
.list-error { font-family: var(--font-body); font-style: normal; font-size: 13px; color: #a32020; }
@media (max-width: 560px) {
    .pager { flex-wrap: wrap; }
    .pager-total { margin-left: 0; width: 100%; }
}

/* Squad editor save error — shows the actual Firestore failure. */
.se-err {
    margin: 10px 0 0;
    padding: 9px 12px;
    border: 1px solid rgba(204, 51, 51, 0.28);
    border-left-width: 3px;
    border-radius: var(--radius-md);
    background: rgba(204, 51, 51, 0.05);
    color: #a32020;
    font-size: 12.5px;
    line-height: 1.45;
    animation: fadeIn 0.25s var(--ease-out-expo) both;
}

/* ===== FOOTER ===== */
.site-footer {
    position: relative;
    background: linear-gradient(rgba(232, 240, 233, 0.30), rgba(232, 240, 233, 0.55));
    border-top: 1px solid rgba(107, 143, 113, 0.16);
    padding: 14px 20px 16px;
    margin-top: auto;
}
/* Mirrors the sweep line in the search dropdown, sitting on the top edge. */
.site-footer::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: -1px;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--green-mid), transparent);
    opacity: 0.7;
}
.footer-inner {
    max-width: var(--max-w);
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    text-align: center;
    font-size: 12px;
    color: var(--text-muted);
}
.site-footer .gm-footer-quote {
    font-family: 'Instrument Serif', 'Georgia', 'Times New Roman', serif;
    font-style: italic;
    font-size: 18px;
    color: var(--green-dark);
    margin: 0;
    line-height: 1.2;
}
.footer-inner a { color: var(--text-secondary); font-size: 12px; }
.footer-inner a:hover { color: var(--green-dark); }
.copyright { color: var(--text-muted); }
.site-footer .gm-footer-quote {
    transition: color var(--dur-slow) var(--ease-out-expo);
}
.site-footer:hover .gm-footer-quote { color: var(--green-muted); }

/* ===== ANIMATIONS ===== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}
.main-content > * { animation: fadeIn 0.2s ease; }

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
    .home-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .stat-block { grid-template-columns: repeat(2, 1fr); }
    .dropdown-mega { min-width: 340px; flex-wrap: wrap; }
    .mega-col { min-width: 140px; }
}

@media (max-width: 640px) {
    .home-grid { grid-template-columns: 1fr; }
    .header-top { flex-direction: column; gap: 8px; }
    .header-quote { display: none; }
    .nav-list { flex-wrap: wrap; justify-content: center; }
    .nav-link { padding: 8px 10px; font-size: 12px; }
    .stat-block { grid-template-columns: repeat(2, 1fr); }
    .detail-header { flex-wrap: wrap; }
    .footer-inner { flex-direction: column; gap: 6px; text-align: center; }
    .dropdown-mega { min-width: 260px; }
    .squad-meta-row { flex-direction: column; gap: 6px; }
    .browse-controls { flex-direction: column; }
    .browse-controls input { min-width: unset; }
}

/* ===== HOME WELCOME ===== */
.home-welcome {
    max-width: var(--max-w);
    margin: 0 auto;
}
.home-intro {
    color: var(--text-secondary);
    font-size: 15px;
    line-height: 1.6;
    max-width: 720px;
    margin-bottom: 32px;
}
.home-cols {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 20px;
}
@media (max-width: 1000px) {
    .home-cols { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.home-col {
    border: 1px solid var(--green-light);
    border-radius: 12px;
    background: rgba(232, 240, 233, 0.25);
    padding: 16px 18px;
}
.home-col-title {
    font-family: var(--font-serif);
    font-size: 19px;
    font-weight: 400;
    color: var(--green-dark);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--green-light);
}
.home-list { display: flex; flex-direction: column; gap: 10px; }
.home-list .empty-msg {
    color: var(--text-muted);
    font-size: 13px;
    font-style: italic;
    padding: 8px 0;
}
.home-list-item { font-size: 13px; line-height: 1.4; }
.home-list-item a { font-weight: 600; }
.home-list-item .home-list-by { color: var(--text-muted); display: block; font-size: 12px; }
@media (max-width: 760px) {
    .home-cols { grid-template-columns: 1fr; }
}

/* ===== CONTRIBUTE LANDING ===== */
.contrib-landing {
    text-align: center;
    padding: 30px 20px 80px;
    max-width: 640px;
    margin: 0 auto;
}
.contrib-hero {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-bottom: 4px;
    padding: 40px 20px 12px;
    position: relative;
}
.contrib-hero::before {
    content: '';
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 420px;
    height: 280px;
    background: radial-gradient(ellipse at center, var(--green-light) 0%, transparent 70%);
    opacity: 0.7;
    z-index: -1;
    pointer-events: none;
}
.contrib-landing > .contrib-btn { margin-bottom: 36px; }
.contrib-logo {
    font-family: var(--font-serif);
    font-size: 84px;
    font-weight: 700;
    color: #111;
    letter-spacing: 0.5px;
    margin-bottom: 0;
    display: inline-block;
    cursor: pointer;
    transition: transform 0.3s ease;
}
.contrib-logo span { color: var(--green-muted); font-weight: 400; transition: color 0.3s, letter-spacing 0.3s; }
.contrib-logo:hover { transform: scale(1.04); text-decoration: none; color: #111; }
.contrib-logo:hover span { color: var(--green-dark); letter-spacing: 2px; }
.contrib-sub {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 32px;
    font-style: italic;
}
.contrib-caption {
    font-style: italic;
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 28px;
    min-height: 20px;
    transition: opacity 0.4s ease;
}
.contrib-stats {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.contrib-stat-card {
    background: var(--green-light);
    border: 1px solid var(--green-mid);
    border-radius: 12px;
    padding: 20px 24px;
    min-width: 120px;
    flex: 1;
    transition: transform 0.2s, box-shadow 0.2s;
}
.contrib-stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(74,107,79,0.12);
}
.contrib-stat-num {
    font-family: var(--font-serif);
    font-size: 32px;
    font-weight: 700;
    color: var(--green-dark);
    line-height: 1.1;
}
.contrib-stat-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--green-muted);
    margin-top: 4px;
}
.contrib-progress-bar {
    width: 100%;
    height: 8px;
    background: var(--green-light);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 32px;
}
.contrib-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--green-mid), var(--green-dark));
    border-radius: 4px;
    transition: width 1s ease;
}

/* ===== HOME HERO + COLLAPSING TOPBAR ===== */
.home-hero {
    will-change: transform, opacity;
    transition: opacity 0.1s linear;
}
.home-hero-progress {
    max-width: 460px;
    margin: 28px auto 0;
}
.home-hero-progress-bar {
    width: 100%;
    height: 14px;
    background: var(--green-light);
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--green-mid);
}
.home-hero-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--green-mid), var(--green-dark));
    border-radius: 8px;
    transition: width 1.2s ease;
}
.home-hero-progress-label {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-top: 8px;
    font-size: 13px;
    color: var(--green-muted);
}
.home-hero-progress-label strong {
    font-family: var(--font-serif);
    font-size: 22px;
    color: var(--green-dark);
}

.home-topbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 50;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid rgba(163, 191, 168, 0.4);
    transform: translateY(-100%);
    opacity: 0;
    transition: transform 0.35s ease, opacity 0.35s ease;
    pointer-events: none;
}
.home-topbar.visible {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
}
.home-topbar-inner {
    max-width: 640px;
    margin: 0 auto;
    padding: 8px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
}
.home-topbar-logo {
    font-family: var(--font-serif);
    font-size: 20px;
    font-weight: 700;
    color: #111;
    flex: none;
    text-decoration: none;
}
.home-topbar-logo span { color: var(--green-muted); font-weight: 400; }
.home-topbar-caption {
    flex: 1;
    margin: 0;
    min-height: 0;
    font-size: 12px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.home-topbar-logo:hover { text-decoration: none; }
.home-topbar-progress {
    flex: none;
    width: 140px;
    height: 8px;
    background: var(--green-light);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}
.home-topbar-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--green-mid), var(--green-dark));
    border-radius: 4px;
}
.home-topbar-pct {
    position: absolute;
    right: -34px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 12px;
    font-weight: 600;
    color: var(--green-dark);
}
.home-topbar-progress { margin-right: 34px; }
.home-topbar-enter {
    flex: none;
    font-size: 12px;
    font-weight: 600;
    color: var(--green-dark);
    text-decoration: none;
    white-space: nowrap;
    padding: 5px 12px;
    border: 1px solid var(--green-mid);
    border-radius: 20px;
    transition: background 0.2s, color 0.2s;
}
.home-topbar-enter:hover {
    background: var(--green-dark);
    color: #fff;
    text-decoration: none;
}
.home-enter-link {
    display: inline-block;
    margin-top: 16px;
    font-size: 13px;
    color: var(--green-muted);
    text-decoration: none;
    transition: color 0.2s, letter-spacing 0.2s;
}
.home-enter-link:hover {
    color: var(--green-dark);
    letter-spacing: 0.3px;
    text-decoration: none;
}

.home-spacer { height: 70vh; }

/* Features section — what Green Milk does that Bloo Milk can't */
.home-features {
    max-width: 720px;
    margin: 56px auto 0;
    text-align: center;
}
.home-features-title {
    font-family: var(--font-serif);
    font-size: 28px;
    font-weight: 700;
    color: var(--text-bright);
    line-height: 1.25;
}
.home-features-sub {
    font-size: 14px;
    color: var(--green-muted);
    margin-top: 6px;
    margin-bottom: 28px;
}
.home-features-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    text-align: left;
}
.home-feature {
    display: flex;
    gap: 12px;
    padding: 16px 18px;
    border: 1px solid var(--green-light);
    border-radius: 12px;
    background: rgba(232, 240, 233, 0.3);
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}
.home-feature:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(74, 107, 79, 0.12);
    border-color: var(--green-mid);
}
.home-feature-check {
    flex: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--green-dark);
    color: #fff;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 2px;
}
.home-feature h3 {
    font-size: 15px;
    font-weight: 700;
    color: var(--green-dark);
    margin-bottom: 4px;
    line-height: 1.3;
}
.home-feature p {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.45;
}
.home-features-note {
    font-size: 13px;
    font-style: italic;
    color: var(--text-muted);
    margin-top: 24px;
}
@media (max-width: 640px) {
    .home-features-grid { grid-template-columns: 1fr; }
}

/* Site quote footer */
.gm-footer {
    text-align: center;
    max-width: 560px;
    margin: 0 auto;
    padding: 40px 20px 24px;
    border-top: 1px solid var(--green-light);
}
.gm-footer-quote {
    font-family: 'Instrument Serif', 'Georgia', 'Times New Roman', serif;
    font-style: italic;
    font-size: 24px;
    line-height: 1.3;
    color: var(--green-dark);
    margin-bottom: 14px;
}
.gm-footer-rights {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.5;
}

/* Redesigned stat strip — lighter, integrated */
.home-statline {
    display: flex;
    justify-content: center;
    align-items: stretch;
    gap: 0;
    margin: 8px auto 0;
    max-width: 560px;
    border: 1px solid var(--green-light);
    border-radius: 14px;
    background: rgba(232, 240, 233, 0.35);
    overflow: hidden;
}
.home-stat {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 16px 10px;
    border-right: 1px solid var(--green-light);
}
.home-stat:last-child { border-right: none; }
.home-stat-num {
    font-family: var(--font-serif);
    font-size: 26px;
    font-weight: 700;
    color: var(--green-dark);
    line-height: 1;
}
.home-stat-num em {
    font-style: normal;
    font-size: 13px;
    color: var(--green-muted);
    margin-left: 1px;
}
.home-stat-label {
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--green-muted);
    text-align: center;
}
@media (max-width: 560px) {
    .home-statline { flex-wrap: wrap; }
    .home-stat { flex: 1 1 50%; border-bottom: 1px solid var(--green-light); }
}

.contrib-btn-pinned {
    box-shadow: 0 6px 20px rgba(74, 107, 79, 0.3);
}
.contrib-btn-pinned:hover {
    box-shadow: 0 10px 26px rgba(74, 107, 79, 0.38);
}
.pinned-btn-wrap {
    position: sticky;
    bottom: 28px;
    z-index: 60;
    display: flex;
    justify-content: center;
    pointer-events: none;
    margin-top: -64px;
}
.pinned-btn-wrap .contrib-btn { pointer-events: auto; }
.contrib-lb-empty {
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
    font-style: italic;
    padding: 16px 12px;
}
.contrib-leaderboard {
    margin-bottom: 32px;
    text-align: left;
}
.contrib-leaderboard h3 {
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--green-dark);
    margin-bottom: 12px;
    padding-bottom: 8px;
    text-align: center;
    border-bottom: 2px solid var(--green-light);
}
.contrib-lb-table {
    width: 100%;
    max-width: 360px;
    margin: 0 auto;
    border-collapse: collapse;
    font-size: 14px;
}
.contrib-lb-table td, .contrib-lb-table th {
    padding: 6px 12px;
    border-bottom: 1px solid #eee;
    text-align: left;
}
.contrib-lb-table th {
    font-size: 11px;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.5px;
}
.contrib-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 36px;
    background: var(--green-dark);
    color: #fff;
    border-radius: 50px;
    font-family: var(--font-body);
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    border: none;
    cursor: pointer;
}
.contrib-btn::before {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s ease;
}
.contrib-btn:hover {
    background: var(--green-muted);
    box-shadow: 0 4px 20px rgba(75,107,79,0.2);
    text-decoration: none;
    color: #fff;
}
.contrib-btn:hover::before {
    left: 100%;
}
.contrib-btn svg {
    transition: transform 0.3s ease;
}

/* Text-swap hover: whole label+arrow slides out right, a fresh copy slides in from left */
.contrib-btn .btn-swap {
    position: relative;
    display: inline-flex;
    align-items: center;
}
.contrib-btn .btn-layer {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.35s ease;
}
.contrib-btn .btn-layer.btn-in {
    position: absolute;
    left: 0;
    top: 0;
    transform: translateX(-130%);
    opacity: 0;
}
.contrib-btn:hover .btn-layer.btn-out {
    transform: translateX(130%);
    opacity: 0;
}
.contrib-btn:hover .btn-layer.btn-in {
    transform: translateX(0);
    opacity: 1;
}
.contrib-btn-sm {
    padding: 10px 24px;
    font-size: 14px;
}
.contrib-popup {
    max-width: 400px;
    margin: 0 auto;
    padding: 36px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: linear-gradient(180deg, #fafafa 0%, #fff 100%);
    text-align: left;
    box-shadow: 0 12px 40px rgba(0,0,0,0.14);
}
.contrib-blurred {
    filter: blur(7px);
    pointer-events: none;
    user-select: none;
    transition: filter 0.3s ease;
}
.contrib-overlay {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(255, 255, 255, 0.35);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    animation: fadeIn 0.25s ease;
}
.contrib-overlay .contrib-popup {
    width: 100%;
    animation: overlay-pop 0.3s cubic-bezier(0.34, 1.4, 0.64, 1);
}
@keyframes overlay-pop {
    from { transform: translateY(14px) scale(0.97); opacity: 0; }
    to { transform: translateY(0) scale(1); opacity: 1; }
}
.contrib-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-input);
    font-family: var(--font-body);
    font-size: 14px;
    color: var(--text);
    margin-bottom: 8px;
    transition: border-color 0.2s;
}
.contrib-input:focus { outline: none; border-color: var(--green-mid); box-shadow: 0 0 0 3px var(--green-light); }
textarea.contrib-input { resize: vertical; }
.contrib-page {
    max-width: 900px;
    margin: 0 auto;
    padding: 32px 20px 80px;
}
.contrib-cols {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}
.contrib-col { flex: 1; min-width: 280px; }
.contrib-card {
    border: 1px solid var(--border);
    border-radius: 16px;
    background: linear-gradient(180deg, #fafafa 0%, #fff 100%);
    padding: 24px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
    transition: box-shadow 0.2s;
}
.contrib-card:hover {
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}
.contrib-card-title {
    font-family: var(--font-serif);
    font-size: 18px;
    margin-bottom: 16px;
    color: var(--text-bright);
    padding-bottom: 10px;
    border-bottom: 2px solid var(--green-light);
}
.contrib-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.3px;
    color: var(--text-secondary);
    margin-bottom: 4px;
    margin-top: 12px;
}
.contrib-msg {
    font-size: 12px;
    color: var(--text-muted);
}
.contrib-msg-ok { color: var(--green-dark); }
.contrib-msg-err { color: #aa2222; }
.contrib-list {
    max-height: 300px;
    overflow-y: auto;
    border-radius: 8px;
    border: 1px solid #eee;
    background: #fff;
}
.contrib-list-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-bottom: 1px solid #f5f5f5;
    font-size: 13px;
    transition: background 0.15s;
}
.contrib-list-item:last-child { border-bottom: none; }
.contrib-list-item:hover { background: #fafafa; }
.contrib-list-status { font-size: 14px; min-width: 18px; text-align: center; }
.contrib-list-name { font-weight: 600; color: var(--text-bright); }
.contrib-list-preview { color: var(--text-muted); font-size: 11px; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.contrib-list-actions {
    margin-left: auto;
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.15s;
}
.contrib-list-item:hover .contrib-list-actions { opacity: 1; }
.contrib-act-btn {
    border: 1px solid var(--border);
    background: #fff;
    border-radius: 6px;
    width: 26px;
    height: 26px;
    font-size: 13px;
    line-height: 1;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.15s;
}
.contrib-act-btn:hover { background: var(--green-light); border-color: var(--green-mid); color: var(--green-dark); }
.contrib-act-del { color: #c0392b; font-size: 16px; font-weight: 700; }
.contrib-act-del:hover { background: #fbeaea; border-color: #e0a0a0; color: #b34646; }
.contrib-cancel-edit {
    border: none;
    background: none;
    color: var(--green-muted);
    font-size: 12px;
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
    cursor: pointer;
    text-decoration: underline;
    margin-left: 6px;
}
.contrib-cancel-edit:hover { color: var(--green-dark); }

/* ===== SMART SEARCH ===== */
.smart-search { position: relative; max-width: 580px; margin: 18px auto 30px; }
.ss-box {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-input);
    border: 1px solid var(--border-bright);
    border-radius: 999px;
    padding: 12px 18px;
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
}
.ss-box:focus-within {
    border-color: var(--green-mid);
    box-shadow: 0 0 0 4px rgba(107, 143, 113, 0.13), 0 8px 28px rgba(74, 107, 79, 0.10);
}
.ss-icon { color: var(--text-muted); flex-shrink: 0; transition: color 0.25s ease; }
.ss-box:focus-within .ss-icon { color: var(--green-dark); }
.ss-box input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    font-family: var(--font-body);
    font-size: 15px;
    color: var(--text);
}
.ss-box input::placeholder { color: var(--text-muted); }
.ss-kbd {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-muted);
    border: 1px solid var(--border);
    border-bottom-width: 2px;
    border-radius: 5px;
    padding: 1px 7px;
    flex-shrink: 0;
}
.ss-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    z-index: 60;
    background: var(--bg-dropdown);
    border: 1px solid var(--green-light);
    border-radius: 16px;
    box-shadow: 0 18px 50px rgba(74, 107, 79, 0.16), 0 2px 8px rgba(0, 0, 0, 0.05);
    max-height: 420px;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 6px;
}
.ss-dropdown::before {
    content: '';
    position: sticky;
    top: 0;
    display: block;
    height: 2px;
    margin: -6px -6px 4px;
    background: linear-gradient(90deg, transparent, var(--green-mid), transparent);
    animation: ss-sweep 0.7s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.ss-dropdown.ss-opening {
    animation: ss-open 0.38s cubic-bezier(0.22, 1, 0.36, 1) both;
    transform-origin: top center;
}
@keyframes ss-open {
    from { opacity: 0; transform: translateY(-10px) scale(0.97); filter: blur(5px); }
    to   { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); }
}
@keyframes ss-sweep {
    from { transform: scaleX(0); }
    to   { transform: scaleX(1); }
}
.ss-section {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 13px;
    color: var(--green-dark);
    padding: 8px 12px 4px;
    animation: ss-item-in 0.3s ease both;
}
.ss-item {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    padding: 7px 12px;
    border-radius: 9px;
    font-size: 14px;
    color: var(--text);
    text-decoration: none;
    animation: ss-item-in 0.32s cubic-bezier(0.22, 1, 0.36, 1) both;
    transition: background 0.12s ease;
}
.ss-item:hover, .ss-item.ss-active {
    background: var(--green-light);
    text-decoration: none;
    color: var(--text-bright);
}
.ss-item-main { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ss-item-main mark { background: var(--green-light); color: var(--green-dark); border-radius: 3px; padding: 0 1px; }
.ss-item:hover .ss-item-main mark, .ss-item.ss-active .ss-item-main mark { background: var(--green-mid); color: #fff; }
.ss-item-sub { font-size: 12px; color: var(--text-muted); flex-shrink: 0; }
@keyframes ss-item-in {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
    .ss-dropdown.ss-opening, .ss-item, .ss-section, .ss-dropdown::before { animation: none !important; }
}

/* ===== GLOBAL SEARCH OVERLAY ===== */
#ss-overlay {
    position: fixed;
    inset: 0;
    z-index: 300;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 13vh 20px 0;
}
#ss-overlay[hidden] { display: none; }
.ss-overlay-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(250, 252, 250, 0.40);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}
#ss-overlay.ss-open .ss-overlay-backdrop {
    animation: ss-bd-in 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes ss-bd-in {
    from { opacity: 0; backdrop-filter: blur(0px); -webkit-backdrop-filter: blur(0px); }
    to   { opacity: 1; backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
}
.ss-palette {
    position: relative;
    z-index: 1;
    width: min(640px, 94vw);
}
#ss-overlay.ss-open .ss-palette {
    animation: ss-palette-in 0.5s cubic-bezier(0.16, 1.3, 0.3, 1) both;
}
@keyframes ss-palette-in {
    0%   { opacity: 0; transform: translateY(-48px) scale(0.95); filter: blur(8px); }
    55%  { filter: blur(0); }
    100% { opacity: 1; transform: translateY(0) scale(1); filter: none; }
}
#ss-overlay.ss-closing .ss-palette { animation: ss-palette-out 0.18s ease both; }
#ss-overlay.ss-closing .ss-overlay-backdrop { animation: ss-bd-out 0.2s ease both; }
@keyframes ss-palette-out {
    from { opacity: 1; transform: translateY(0) scale(1); }
    to   { opacity: 0; transform: translateY(-20px) scale(0.97); filter: blur(4px); }
}
@keyframes ss-bd-out {
    from { opacity: 1; }
    to   { opacity: 0; }
}
.ss-palette-search { max-width: none; margin: 0; }
.ss-palette .ss-box {
    padding: 15px 20px;
    box-shadow: 0 24px 70px rgba(44, 64, 48, 0.18), 0 4px 14px rgba(0, 0, 0, 0.06);
}
.ss-palette .ss-box input { font-size: 16px; }
.ss-palette .ss-dropdown { max-height: 52vh; }
@media (prefers-reduced-motion: reduce) {
    #ss-overlay.ss-open .ss-palette, #ss-overlay.ss-open .ss-overlay-backdrop,
    #ss-overlay.ss-closing .ss-palette, #ss-overlay.ss-closing .ss-overlay-backdrop { animation: none !important; }
}

/* ===== CLAIM FLOW ===== */
.login-box-wide { max-width: 420px; }
.reg-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 18px;
    border-bottom: 1px solid var(--green-light);
    padding-bottom: 0;
}
.reg-tab {
    flex: 1;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 8px 4px;
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: color var(--transition), border-color var(--transition);
}
.reg-tab:hover { color: var(--green-dark); }
.reg-tab.active { color: var(--green-dark); border-bottom-color: var(--green-mid); }
.field-hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; font-style: italic; }
.pending-badge {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--faction-fringe);
    border: 1px solid var(--faction-fringe);
    border-radius: 99px;
    padding: 1px 8px;
    margin-left: 6px;
}
.claim-card {
    max-width: 560px;
    background: var(--bg-panel);
    border: 1px solid var(--green-light);
    border-radius: 14px;
    padding: 26px 28px;
    box-shadow: 0 16px 48px rgba(74, 107, 79, 0.08);
    font-size: 14px;
    line-height: 1.6;
}
.claim-card .claim-big { font-family: var(--font-serif); font-size: 22px; margin-bottom: 8px; }
.claim-card .claim-big em { color: var(--green-dark); }
.claim-code {
    font-family: var(--font-mono);
    font-size: 34px;
    letter-spacing: 4px;
    color: var(--green-dark);
    background: var(--green-light);
    border: 1px dashed var(--green-mid);
    border-radius: 10px;
    text-align: center;
    padding: 18px;
    margin: 18px 0 10px;
    user-select: all;
}
.claim-note { color: var(--text-secondary); font-size: 13px; margin-top: 14px; }
.claim-check-row { display: flex; align-items: center; gap: 12px; margin-top: 8px; }
.claim-check-result { font-size: 13px; color: var(--text-muted); font-style: italic; }
.claim-verified { border-color: var(--green-mid); }

/* ===== PERSONALITY DETAILS ===== */
::selection { background: var(--green-light); color: var(--green-dark); }
a:hover { color: var(--green-dark); text-decoration-color: var(--green-mid); text-underline-offset: 2px; }
.home-welcome .page-title { font-size: 34px; border-bottom: none; padding-bottom: 0; margin-bottom: 6px; }
.home-welcome .page-title em { font-style: italic; color: var(--green-dark); }
.home-stats {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 14px;
    letter-spacing: 0.2px;
}
.home-stats .home-stat-dot { color: var(--green-mid); padding: 0 6px; }
.home-intro em { font-family: var(--font-serif); font-style: italic; color: var(--green-dark); font-size: 1.07em; }
.home-col { transition: border-color var(--transition), background var(--transition); }
.home-col:hover { border-color: var(--green-mid); background: rgba(232, 240, 233, 0.45); }
.empty-msg { font-family: var(--font-serif); }

/* ===== DESIGN PASS — sage & serif across the site ===== */

/* Navigation — superseded by the HEADER/NAVIGATION sections above.
   The old rules used `animation: dd-in ... both`, whose fill state pinned
   the dropdown's opacity and transform and blocked the new transitions. */

/* Buttons */
.btn {
    background: var(--green-dark);
    border-color: var(--green-dark);
    border-radius: 8px;
    transition: background var(--transition), transform 0.1s ease;
}
.btn:hover { background: #3a5840; }
.btn:active { transform: scale(0.98); }
.btn-secondary { background: #fff; color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: var(--green-light); border-color: var(--green-mid); color: var(--green-dark); }

/* Inputs — sage focus everywhere */
.search-input:focus, .search-sel:focus, .compare-sel:focus, .login-field input:focus,
.browse-sidebar-header select:focus, textarea:focus {
    outline: none;
    border-color: var(--green-mid);
    box-shadow: 0 0 0 3px rgba(107, 143, 113, 0.14);
}

/* Login / register */
.login-box {
    border-radius: 14px;
    border-color: var(--green-light);
    box-shadow: 0 16px 48px rgba(74, 107, 79, 0.10);
}
.login-box h2 {
    font-family: var(--font-serif);
    font-style: italic;
    font-weight: 400;
    font-size: 28px;
}
.login-box h2 span { color: var(--green-dark); }

/* Tables */
.char-table th {
    background: var(--green-light);
    color: var(--green-dark);
    border-bottom: 2px solid var(--green-mid);
}
.char-table tbody tr:hover { background: rgba(232, 240, 233, 0.45); }
.char-table .col-cost { color: var(--green-dark); }

/* Character detail */
.detail-header h1 { font-family: var(--font-serif); font-weight: 400; font-size: 30px; }
.detail-header .cost-badge {
    background: var(--green-light);
    border-color: var(--green-mid);
    color: var(--green-dark);
}
.stat-value { color: var(--green-dark); }
.ability-section h3, .comments-section h3 {
    font-family: var(--font-serif);
    font-style: italic;
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
    font-size: 18px;
    color: var(--green-dark);
    border-bottom-color: var(--green-light);
}
.ability-name { color: var(--text-bright); }
.ability-name:hover { color: var(--green-dark); }
.flavor-text {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 15px;
    color: var(--text-secondary);
}

/* Scrollbars (WebKit) — quiet sage */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--green-mid); border-radius: 99px; border: 2px solid #fff; }
::-webkit-scrollbar-thumb:hover { background: var(--green-dark); }

/* ===== SQUAD EDITOR PIECES ===== */
/* One character in the squad being built. Rows were 3px tall with a hard
   grey rule under each — dense and hard to hit. */
.se-piece {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 7px 8px;
    margin: 0 -8px;
    border-radius: var(--radius-md);
    border-bottom: 1px solid rgba(107, 143, 113, 0.12);
    font-size: 13.5px;
    transition: background var(--dur-fast) ease;
}
.se-piece:hover { background: rgba(232, 240, 233, 0.55); }
.se-piece:last-child { border-bottom: none; }
.se-pc {
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 11px;
    min-width: 22px;
}
.se-cost {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    color: var(--green-dark);
    min-width: 30px;
    text-align: right;
}
.se-pname { flex: 1; min-width: 0; }
.se-piece .se-rm {
    cursor: pointer; background: none; border: none;
    color: var(--text-muted); font-size: 15px; line-height: 1; padding: 0 4px;
    border-radius: var(--radius-sm);
    opacity: 0;
    transition: opacity var(--dur-fast) ease, color var(--dur-fast) ease;
}
/* Reveal the remove control on hover or keyboard focus, so a long roster
   isn't a column of red crosses competing with the names. */
.se-piece:hover .se-rm, .se-piece:focus-within .se-rm { opacity: 1; }
.se-piece .se-rm:hover { color: #aa2222; }
.se-piece .se-rm:focus-visible { opacity: 1; outline: none; box-shadow: var(--ring); }
.se-empty {
    font-family: var(--font-serif);
    font-style: italic;
    color: var(--text-muted);
    font-size: 13px;
    padding: 6px 0;
}

/* Reinforcement / Reserve sub-section headers in squad list */
.se-slot-header {
    margin-top: 12px;
    padding-top: 7px;
    border-top: 2px solid var(--green-light);
    font-size: 12px;
    font-weight: 600;
    color: var(--green-dark);
}
.se-slot-empty {
    color: var(--text-muted);
    font-size: 12px;
    font-style: italic;
    margin: 3px 0 0;
}

/* ===== CHARACTER POPUP ===== */
#char-popup-overlay {
    position: fixed; inset: 0; z-index: 9000;
    background: rgba(255,255,255,0.18);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}
.char-popup {
    position: fixed;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 4px 32px rgba(0,0,0,0.13), 0 1px 4px rgba(0,0,0,0.07);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
/* Titlebar / drag handle */
.cp-titlebar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px 12px;
    border-bottom: 1px solid var(--border);
    cursor: grab;
    user-select: none;
    flex-shrink: 0;
    background: var(--bg-panel);
}
.cp-titlebar:active { cursor: grabbing; }
.cp-header-inner { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.cp-name {
    font-family: var(--font-serif);
    font-size: 24px;
    font-weight: 400;
    color: var(--text-bright);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cp-cost {
    font-family: var(--font-mono);
    font-size: 26px;
    font-weight: 700;
    color: var(--text-bright);
    padding-left: 12px;
    white-space: nowrap;
}
.cp-close {
    background: none; border: none; color: var(--text-muted);
    font-size: 18px; cursor: pointer; padding: 0 0 0 8px; line-height: 1; flex-shrink: 0;
}
.cp-close:hover { color: var(--text); }
/* Counts As bar */
.cp-counts-as {
    border-bottom: 1px solid var(--border);
    padding: 5px 18px;
    font-size: 12px;
    color: var(--text-secondary);
    flex-shrink: 0;
}
/* Body two-column layout */
.cp-body { display: flex; flex: 1; overflow: hidden; }
.cp-left {
    flex: 0 0 190px;
    padding: 14px 16px;
    border-right: 1px solid var(--border);
    overflow-y: auto;
    font-size: 13px;
}
.cp-right {
    flex: 1;
    padding: 14px 18px;
    overflow-y: auto;
    font-size: 13px;
}
/* Stats */
.cp-stat-row { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 5px; }
.cp-stat-label { font-weight: 600; color: var(--text-secondary); }
.cp-stat-val { font-family: var(--font-mono); font-size: 16px; font-weight: 700; color: var(--text-bright); }
.cp-divider { border-top: 1px solid var(--border); margin: 10px 0; }
.cp-meta-row { margin-bottom: 3px; font-size: 12px; color: var(--text-secondary); }
.cp-meta-label { color: var(--text); font-weight: 600; }
.cp-mini-placeholder { margin-top: 14px; height: 110px; }
/* Ability sections */
.cp-section { margin-bottom: 14px; }
.cp-section-hd {
    font-family: var(--font-serif);
    font-size: 16px;
    font-weight: 400;
    color: var(--text-bright);
    border-bottom: 1px solid var(--border);
    padding-bottom: 4px;
    margin-bottom: 7px;
}
.cp-ability-row { display: flex; gap: 6px; margin-bottom: 5px; line-height: 1.45; font-size: 13px; }
.cp-ability-bullet { flex-shrink: 0; color: var(--green-mid); margin-top: 1px; }
.cp-ability-name { font-weight: 600; color: var(--text-bright); text-decoration: none; }
.cp-ability-name:hover { color: var(--green-dark); text-decoration: underline; }
.cp-ability-desc { color: var(--text-secondary); }
.cp-flavor {
    margin-top: 10px; font-style: italic;
    color: var(--text-secondary); font-size: 12px;
    border-top: 1px solid var(--border); padding-top: 8px;
}
/* Resize handle */
.cp-resize-handle {
    position: absolute; bottom: 0; right: 0;
    width: 20px; height: 20px; cursor: se-resize;
    background: linear-gradient(135deg, transparent 60%, var(--border) 60%);
    border-radius: 0 0 8px 0;
}
/* Clickable name links in available chars table */
.se-char-link { color: var(--text); text-decoration: none; font-weight: 500; }
.se-char-link:hover { color: var(--green-dark); text-decoration: underline; }

/* ===== SQUAD EDITOR (Bloo Milk-style) ===== */

/* Header bar */
.se-header { display:flex; align-items:baseline; gap:12px; flex-wrap:wrap; margin-bottom:4px; }
.se-title   { font-size:20px; font-weight:700; margin:0; }
.se-hlinks  { display:flex; gap:10px; align-items:center; }
.se-hl      { font-size:13px; color:var(--green-dark); text-decoration:none; cursor:pointer; }
.se-hl:hover{ text-decoration:underline; }
.se-hl-on   { font-weight:700; }
.se-hl-del  { color:#bb3333; }
.se-hl-del:hover { color:#880000; }

/* Collapsible modify form */
.se-mform        { background:var(--card-bg); border:1px solid var(--border); border-radius:6px; padding:12px 14px; margin-bottom:10px; }
.se-mform-row    { display:flex; flex-wrap:wrap; gap:8px; margin-bottom:8px; align-items:flex-end; }
.se-mform-btns   { display:flex; align-items:center; }

/* Section dropdown row */
.se-section-row  { margin-bottom:8px; }
.se-section-sel  { font-size:13px; min-width:200px; max-width:420px; }

/* Two-column layout */
.se-layout { display:flex; gap:16px; flex-wrap:wrap; align-items:flex-start; }
.se-left   { flex:0 0 auto; min-width:280px; max-width:500px; width:100%; }
.se-right  { flex:1; min-width:280px; }

/* Left: squad character table */
.se-sq-hd   { display:flex; justify-content:space-between; align-items:center; margin-bottom:5px; }
.se-pts-badge { font-family:var(--font-mono); font-size:16px; font-weight:700; }
.se-sq-wrap { overflow-x:auto; border:1px solid var(--border); border-radius:4px; }
.se-sq-table{ width:100%; border-collapse:collapse; font-size:12px; }
.se-sq-table th, .se-sq-table td { padding:3px 5px; text-align:left; border-bottom:1px solid var(--border); white-space:nowrap; }
.se-sq-table th { background:var(--card-bg); font-size:11px; font-weight:600; color:var(--text-muted); }
.se-sq-table .se-rm { cursor:pointer; background:none; border:none; color:#bb3333; font-size:14px; line-height:1; padding:0 4px; }
.se-sq-table .se-rm:hover { color:#880000; }
.se-cn  { max-width:180px; overflow:hidden; text-overflow:ellipsis; }
.se-cnt { color:var(--text-muted); font-size:10px; }
.se-empty-row { color:var(--text-muted); font-style:italic; padding:8px; text-align:center; }
.se-slot-tr .se-slot-td { background:var(--section-bg,#f2f8f2); font-size:11px; font-weight:600; color:var(--green-dark); padding:4px 6px; border-top:2px solid var(--green-light); }
.se-sq-foot { margin-top:5px; font-size:12px; }
.se-sq-foot a { color:var(--text-muted); text-decoration:none; }
.se-sq-foot a:hover { color:#bb3333; }
.se-sq-opts { display:flex; flex-wrap:wrap; gap:10px; align-items:center; margin-top:10px; }

/* Right: available characters */
.se-av-hd  { display:flex; justify-content:space-between; align-items:center; margin-bottom:5px; }
.se-rem-badge { font-size:12px; color:var(--text-muted); }
.se-av-scroll { max-height:62vh; overflow-y:auto; border:1px solid var(--border); border-radius:4px; }

/* Available chars table */
.se-av-table { width:100%; border-collapse:collapse; font-size:12px; }
.se-av-table th, .se-av-table td { padding:3px 5px; text-align:left; border-bottom:1px solid var(--border); white-space:nowrap; }
.se-av-table th { background:var(--card-bg); font-size:11px; color:var(--text-muted); font-weight:600; }
.se-sort { cursor:pointer; user-select:none; }
.se-sort:hover { color:var(--green-dark); }
.se-arr    { font-size:10px; color:var(--text-muted); margin-left:2px; }
.se-arr.on { color:var(--green-dark); }
.se-ad {
    cursor: pointer;
    background: var(--green-dark);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    padding: 2px 9px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.5;
    transition: background var(--dur-fast) ease, transform 0.1s ease;
}
.se-ad:hover { background: var(--green-muted); color: #fff; }
.se-ad:active { transform: scale(0.92); }
.se-ad:focus-visible { outline: none; box-shadow: var(--ring); }

/* ===== SQUAD DETAIL VIEW =====
 *
 * The roster table carries eleven columns of dense numbers. Readability here
 * comes from grouping rather than decoration: identity on the left (set,
 * faction, cost, name), the four core stats banded together in the middle,
 * and the ability counts trailing off in lighter type on the right. The bands
 * give the eye something to track along a row without adding gridlines.
 */
.sd-wrap { max-width: 1100px; }

/* ---- Header ---- */
.sd-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 14px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--green-light);
    flex-wrap: wrap;
}
.sd-header-left { flex: 1; min-width: 0; }
.sd-title {
    font-family: var(--font-serif);
    font-size: 32px;
    line-height: 1.15;
    font-weight: 400;
    color: var(--text-bright);
    display: flex;
    align-items: center;
    gap: 11px;
    flex-wrap: wrap;
    margin-bottom: 7px;
}
.sd-title .faction-icon { height: 26px; }
.sd-meta {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 13px;
    color: var(--text-muted);
    flex-wrap: wrap;
}
.sd-author { font-weight: 600; color: var(--text-secondary); }
.sd-date { font-family: var(--font-serif); font-style: italic; }

/* Points as the one big number on the page. */
.sd-pts {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    font-size: 34px;
    line-height: 1;
    font-weight: 700;
    color: var(--green-dark);
    white-space: nowrap;
    text-align: right;
}
.sd-pts-max { font-size: 19px; color: var(--text-muted); font-weight: 400; }
.sd-pts-label {
    display: block;
    font-family: var(--font-body);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-top: 5px;
}

/* ---- Rating strip ---- */
.sd-rating-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 22px;
    font-size: 13px;
    border: none;
    border-radius: var(--radius-lg);
    padding: 10px 16px;
    margin-bottom: 18px;
    background: rgba(232, 240, 233, 0.5);
    color: var(--text-muted);
}
.sd-rating-bar strong {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    color: var(--text-bright);
    font-size: 14px;
}

/* ---- Two-column body ---- */
.sd-body { display: flex; gap: 28px; align-items: flex-start; flex-wrap: wrap; }
.sd-left { flex: 1; min-width: 0; overflow-x: auto; }
.sd-sidebar { flex: 0 0 250px; font-size: 13px; }

/* ---- Roster table ---- */
.sd-table { width: 100%; margin-bottom: 0; }
.sd-table td { padding-top: 10px; padding-bottom: 10px; }

/* Band the four core stats so they read as one group. */
.sd-table th:nth-child(n+5):nth-child(-n+8),
.sd-table td:nth-child(n+5):nth-child(-n+8) {
    background: rgba(232, 240, 233, 0.34);
}
.sd-table th:nth-child(5), .sd-table td:nth-child(5) { border-left: 1px solid rgba(107, 143, 113, 0.14); }
.sd-table th:nth-child(8), .sd-table td:nth-child(8) { border-right: 1px solid rgba(107, 143, 113, 0.14); }
/* Ability counts are secondary — let them recede. */
.sd-table td:nth-child(n+9) { color: var(--text-muted); font-size: 11.5px; }

.sd-char-link {
    color: var(--text-bright);
    font-weight: 500;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: color var(--dur-fast) ease, border-color var(--dur-fast) ease;
}
.sd-char-link:hover {
    color: var(--green-dark);
    border-bottom-color: var(--green-mid);
    text-decoration: none;
    cursor: pointer;
}

/* ---- Reinforcements / reserves ---- */
.sd-slot-hd {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 16px;
    font-weight: 400;
    color: var(--green-dark);
    margin: 26px 0 8px;
    padding-top: 16px;
    border-top: 1px solid var(--green-light);
}
.sd-slot-empty {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 13px;
    color: var(--text-muted);
    margin: 4px 0 12px;
}

/* ---- Sidebar ---- */
.sd-sidebar > * + * { margin-top: 18px; }
.sd-stats-table {
    width: 100%;
    border-collapse: collapse;
    background: rgba(232, 240, 233, 0.4);
    border-radius: var(--radius-lg);
    overflow: hidden;
}
.sd-stats-table tr + tr .sd-sk,
.sd-stats-table tr + tr .sd-sv { border-top: 1px solid rgba(255, 255, 255, 0.85); }
.sd-sk {
    font-weight: 500;
    color: var(--text-secondary);
    padding: 8px 0 8px 14px;
    padding-right: 12px;
    font-size: 12.5px;
    white-space: nowrap;
}
.sd-sv {
    font-size: 13px;
    color: var(--text-bright);
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    text-align: right;
    padding: 8px 14px 8px 0;
    font-weight: 600;
}
.sd-copy-hd, .sd-dup-hd {
    font-family: var(--font-serif);
    font-style: italic;
    font-weight: 400;
    font-size: 14px;
    color: var(--green-dark);
    margin-bottom: 6px;
}
.sd-copy-ta {
    width: 100%;
    height: 190px;
    font-family: var(--font-mono);
    font-size: 11px;
    line-height: 1.55;
    border: 1px solid var(--green-light);
    border-radius: var(--radius-md);
    padding: 10px 12px;
    resize: vertical;
    color: var(--text-secondary);
    background: #fff;
    transition: border-color var(--dur-mid) var(--ease-out-expo), box-shadow var(--dur-mid) var(--ease-out-expo);
}
.sd-copy-ta:focus { outline: none; border-color: var(--green-mid); box-shadow: var(--ring); }

@media (max-width: 900px) {
    .sd-body { gap: 20px; }
    .sd-sidebar { flex: 1 1 100%; }
    .sd-pts { font-size: 28px; }
}

/* Also fix cp-name as a link */
a.cp-name { color: var(--text-bright); text-decoration: none; }
a.cp-name:hover { color: var(--green-dark); text-decoration: underline; }

/* ===== PRINT ===== */
@media print {
    .site-header, .site-footer, .comment-form, .btn, .browse-controls, .star-rating { display: none; }
    .main-content { padding: 0; max-width: 100%; }
}
