:root {
    --bg-main: #060913;
    --bg-secondary: #0b1120;
    --card-bg: rgba(13, 20, 36, 0.82);
    --card-hover: rgba(20, 30, 54, 0.94);
    --accent: #0ea5e9;
    --accent-hover: #0284c7;
    --accent-sky: #38bdf8;
    --accent-cyan: #06b6d4;
    --accent-bright: #67e8f9;
    --accent-purple: #8b5cf6;
    --accent-glow: rgba(14, 165, 233, 0.35);
    --accent-dim: rgba(14, 165, 233, 0.12);
    --border-color: rgba(56, 189, 248, 0.18);
    --border-hover: rgba(56, 189, 248, 0.55);
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 18px;
    --transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    max-width: 100vw;
    overflow-x: hidden;
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    width: 100%;
}

/* Ambient glows removed for clean, non-laggy UI */
.ambient-glow-top,
.ambient-glow-bottom {
    display: none !important;
}

.app-container {
    max-width: 1920px;
    margin: 0 auto;
    padding: 12px 28px 24px;
    width: 100%;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: relative;
    z-index: 1;
    min-width: 0;
}

/* Header */
.studio-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: nowrap;
    gap: 14px;
    background: rgba(13, 18, 31, 0.7);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    padding: 10px 20px;
    border-radius: var(--radius-lg);
    box-shadow: 0 8px 32px -4px rgba(0, 0, 0, 0.4);
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
}

.brand {
    display: flex;
    align-items: center;
    gap: 16px;
}

.brand-logo {
    position: relative;
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(139, 92, 246, 0.2));
    border: 1px solid rgba(59, 130, 246, 0.4);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

.logo-pulse {
    position: absolute;
    inset: -3px;
    border-radius: calc(var(--radius-md) + 3px);
    border: 1.5px solid var(--accent-cyan);
    opacity: 0.4;
    animation: pulseRing 3s infinite;
}

@keyframes pulseRing {
    0% { transform: scale(0.96); opacity: 0.6; }
    50% { transform: scale(1.04); opacity: 0.1; }
    100% { transform: scale(0.96); opacity: 0.6; }
}

.brand-title-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand h1 {
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: #fff;
}

.brand h1 span {
    background: linear-gradient(135deg, #60a5fa, #c084fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.brand-version-badge {
    font-size: 10px;
    font-weight: 800;
    color: #38bdf8;
    background: rgba(56, 189, 248, 0.15);
    border: 1px solid rgba(56, 189, 248, 0.3);
    padding: 2px 7px;
    border-radius: 6px;
    letter-spacing: 0.5px;
}

.tagline {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.tagline strong {
    color: #93c5fd;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 18px;
}

.system-status {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.25);
    padding: 6px 12px;
    border-radius: 20px;
}

.status-indicator {
    width: 7px;
    height: 7px;
    border-radius: 50%;
}

.status-indicator.online {
    background: #10b981;
    box-shadow: 0 0 8px #10b981;
}

.status-label {
    font-size: 11px;
    font-weight: 700;
    color: #34d399;
    letter-spacing: 0.2px;
}

/* User Profile & Auth */
.auth-bar {
    display: flex;
    align-items: center;
    gap: 12px;
}

.discord-login-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: #4752c4;
    color: #fff;
    padding: 8px 18px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    transition: var(--transition);
    box-shadow: 0 4px 14px rgba(88, 101, 242, 0.35);
}

.discord-login-btn:hover {
    background: #4752c4;
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(88, 101, 242, 0.5);
}

.discord-icon {
    width: 18px;
    height: 18px;
}

.user-profile-badge {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    padding: 4px 14px 4px 6px;
    border-radius: 30px;
    backdrop-filter: blur(12px);
}

.user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 2px solid var(--accent);
    object-fit: cover;
}

.user-meta {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-size: 13px;
    font-weight: 700;
    color: #fff;
    line-height: 1.2;
}

.drops-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 800;
    color: #38bdf8;
    background: rgba(56, 189, 248, 0.15);
    padding: 2px 8px;
    border-radius: 10px;
    border: 1px solid rgba(56, 189, 248, 0.3);
    margin-top: 2px;
}

.admin-trigger-btn {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    /* FIX HERMES-1 (2026-10-14): audit_a11y.py mierzyl kontrast 1.15 --
       #000 na gradientie #f59e0b->#d97706 jest niewidoczny (need 4.5).
       Amber bg ~rel luminance 0.45 wymaga ciemniejszego tekstu: #1a1205
       daje kontrast ~10. Gesty czarny zamieniony na bardzo ciemny braz. */
    color: #1a1205;
    font-size: 10px;
    font-weight: 900;
    text-transform: uppercase;
    border: none;
    border-radius: 6px;
    /* FIX HERMES-1: tap target 61x38 < 44px (HIG) -- min-height 44px */
    min-height: 44px;
    padding: 5px 12px;
    cursor: pointer;
    transition: var(--transition);
}

.admin-trigger-btn:hover {
    filter: brightness(1.2);
    transform: translateY(-1px);
}

.logout-link {
    color: var(--text-muted);
    font-size: 12px;
    text-decoration: none;
    transition: var(--transition);
    margin-left: 4px;
    /* FIX HERMES-1 (2026-10-14): tap 20-31px szerokosci < 44px HIG.
       padding-left/right 14px daje hit-area >=44px bez zmiany wygladu
       tekstu (inline element rosnie tylko w poziomie). */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    min-width: 44px;
    padding: 0 14px;
}

.logout-link:hover {
    color: #f87171;
}

/* Workspace Layout */
.studio-workspace {
    display: grid;
    grid-template-columns: minmax(360px, 440px) minmax(0, 1fr);
    gap: 24px;
    align-items: start;
    min-width: 0;
    width: 100%;
}

.studio-workspace > * {
    min-width: 0;
}

@media (max-width: 1180px) {
    .studio-workspace {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}

/* Controls Panel (Left Workspace) */
.controls-panel {
    background: var(--card-bg);
    backdrop-filter: blur(24px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
    position: relative;
    box-shadow: 0 12px 36px -8px rgba(0, 0, 0, 0.5);
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
}

.controls-scroll-area {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 24px 24px 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-height: 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
}

.controls-scroll-area::-webkit-scrollbar {
    width: 6px;
}

.controls-scroll-area::-webkit-scrollbar-track {
    background: transparent;
}

.controls-scroll-area::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.18);
    border-radius: 4px;
}

.controls-scroll-area::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.32);
}

.controls-action-dock {
    flex-shrink: 0;
    padding: 14px 16px 18px 16px;
    background: rgba(11, 15, 25, 0.96);
    backdrop-filter: blur(20px);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 -10px 28px rgba(0, 0, 0, 0.45);
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 10;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.group-title {
    font-size: 13px;
    font-weight: 800;
    color: #f1f5f9;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.group-step {
    width: 20px;
    height: 20px;
    background: rgba(59, 130, 246, 0.2);
    border: 1px solid rgba(59, 130, 246, 0.4);
    color: #93c5fd;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 800;
}

.popout-trigger-btn {
    background: rgba(59, 130, 246, 0.15);
    border: 1px solid rgba(59, 130, 246, 0.35);
    color: #93c5fd;
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: var(--transition);
}

.popout-trigger-btn:hover {
    background: var(--accent);
    color: #fff;
    transform: translateY(-1px);
}

/* Active Character Card (Showcase) */
.active-char-card {
    display: flex;
    align-items: center;
    gap: 14px;
    background: rgba(13, 18, 31, 0.85);
    border: 1.5px solid rgba(59, 130, 246, 0.4);
    box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.4), 0 0 16px var(--accent-glow);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    position: relative;
    overflow: hidden;
}

.active-char-avatar-frame {
    position: relative;
    width: 58px;
    height: 58px;
    flex-shrink: 0;
}

.active-char-img {
    width: 100%;
    height: 100%;
    border-radius: var(--radius-sm);
    object-fit: cover;
    border: 1.5px solid rgba(59, 130, 246, 0.6);
    background: #000;
}

.active-char-mini-icon {
    position: absolute;
    bottom: -4px;
    right: -4px;
    font-size: 13px;
    background: rgba(0, 0, 0, 0.8);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 1px 3px;
}

.active-char-details {
    display: flex;
    flex-direction: column;
    gap: 3px;
    flex: 1;
    min-width: 0;
}

.active-char-name-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.active-char-name {
    font-size: 16px;
    font-weight: 800;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.active-char-badge {
    font-size: 9px;
    font-weight: 800;
    color: #c084fc;
    background: rgba(192, 132, 252, 0.15);
    border: 1px solid rgba(192, 132, 252, 0.35);
    padding: 1px 6px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.active-char-species {
    font-size: 12px;
    font-weight: 600;
    color: #38bdf8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Active Character Traits Wrap */
.active-char-traits-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 4px;
}

.trait-pill {
    font-size: 10px;
    font-weight: 600;
    font-family: 'JetBrains Mono', monospace;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #cbd5e1;
    padding: 2px 7px;
    border-radius: 4px;
    white-space: nowrap;
    transition: var(--transition);
}

.trait-pill:hover {
    border-color: rgba(59, 130, 246, 0.5);
    color: #93c5fd;
}

.change-char-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    flex-shrink: 0;
}

.change-char-btn:hover {
    background: rgba(59, 130, 246, 0.2);
    color: #93c5fd;
    border-color: var(--accent);
}

/* Quick Archetype Pills with Avatars */
.quick-archetype-pills {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.pills-label {
    font-size: 11px;
    color: #cbd5e1;
    font-weight: 600;
}

.quick-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 4px 10px 4px 6px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.pill-avatar {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    object-fit: cover;
}

.quick-pill:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.2);
}

.quick-pill.active {
    background: rgba(59, 130, 246, 0.2);
    border-color: var(--accent);
    color: #93c5fd;
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.3);
}

/* Prompt Chips Bar */
.prompt-chips-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 2px;
}

.chips-hint {
    font-size: 11px;
    color: #cbd5e1;
    font-weight: 600;
}

.prompt-chips {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.chip-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #e2e8f0;
    font-size: 11px;
    font-weight: 600;
    padding: 4px 9px;
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition);
}

.chip-btn:hover {
    background: rgba(59, 130, 246, 0.25);
    color: #fff;
    border-color: var(--accent);
    transform: translateY(-1px);
}

.subgroup-title {
    font-size: 12px;
    font-weight: 800;
    color: #e2e8f0;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 4px;
    display: inline-block;
}

/* Inputs & Textareas */
textarea, select {
    box-sizing: border-box;
    width: 100%;
    background: rgba(10, 14, 26, 0.85);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: #f8fafc;
    padding: 12px 14px;
    font-family: inherit;
    font-size: 13px;
    line-height: 1.5;
    outline: none;
    transition: var(--transition);
    resize: vertical;
}

textarea:focus, select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.25);
    background: rgba(10, 14, 26, 0.95);
}

.subgroup-hint {
    font-size: 11px;
    color: #cbd5e1;
    font-weight: 500;
}

/* ==================================================================== */
/* LUXURY ASPECT RATIO GRID SELECTOR                                    */
/* ==================================================================== */
.aspect-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.aspect-card {
    background: rgba(12, 17, 30, 0.85);
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    position: relative;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.aspect-card:hover {
    background: rgba(20, 28, 50, 0.95);
    border-color: rgba(59, 130, 246, 0.5);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4), 0 0 12px rgba(59, 130, 246, 0.2);
}

.aspect-card.active {
    background: linear-gradient(145deg, rgba(37, 99, 235, 0.22), rgba(13, 18, 31, 0.9));
    border-color: #38bdf8;
    box-shadow: 0 0 20px rgba(56, 189, 248, 0.3), inset 0 0 14px rgba(56, 189, 248, 0.1);
}

.aspect-wireframe-wrap {
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.aspect-shape-box {
    border: 1.5px solid var(--text-muted);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    background: rgba(255, 255, 255, 0.03);
    transition: var(--transition);
}

.aspect-shape-box.square {
    width: 38px;
    height: 38px;
}

.aspect-shape-box.portrait {
    width: 26px;
    height: 44px;
}

.aspect-shape-box.landscape {
    width: 46px;
    height: 28px;
}

.aspect-wire-crosshair {
    position: absolute;
    inset: 4px;
    border: 1px dashed rgba(255, 255, 255, 0.15);
    border-radius: 2px;
}

.aspect-ratio-wire {
    font-size: 9px;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    color: var(--text-muted);
    z-index: 1;
}

.aspect-card.active .aspect-shape-box {
    border-color: #38bdf8;
    background: rgba(56, 189, 248, 0.12);
    box-shadow: 0 0 12px rgba(56, 189, 248, 0.4);
}

.aspect-card.active .aspect-ratio-wire {
    color: #fff;
}

.aspect-meta {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
}

.aspect-title-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.aspect-title {
    font-size: 13px;
    font-weight: 800;
    color: #ffffff;
    letter-spacing: 0.2px;
}

.aspect-check-icon {
    font-size: 10px;
    color: transparent;
    transition: var(--transition);
}

.aspect-card.active .aspect-check-icon {
    color: #38bdf8;
}

.aspect-res {
    font-size: 10px;
    font-family: 'JetBrains Mono', monospace;
    color: var(--text-muted);
}

.aspect-price-tag {
    font-size: 12px;
    font-weight: 800;
    color: #38bdf8;
    background: rgba(56, 189, 248, 0.12);
    border: 1px solid rgba(56, 189, 248, 0.3);
    padding: 2px 8px;
    border-radius: 12px;
    margin-top: 2px;
    transition: var(--transition);
}

.aspect-card.active .aspect-price-tag {
    background: #38bdf8;
    color: #0b1120;
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.5);
}

/* ==================================================================== */
/* MODULAR NEURAL ENHANCERS GRID                                        */
/* ==================================================================== */
.addons-badge {
    font-size: 11px;
    font-weight: 800;
    color: #38bdf8;
    background: rgba(56, 189, 248, 0.15);
    border: 1px solid rgba(56, 189, 248, 0.35);
    padding: 2px 8px;
    border-radius: 12px;
}

.enhancers-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

@media (max-width: 640px) {
    .enhancers-grid {
        grid-template-columns: 1fr;
    }
}

.enhancer-card {
    background: rgba(12, 17, 30, 0.85);
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.enhancer-card:hover {
    background: rgba(20, 28, 50, 0.95);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

.enhancer-card.active {
    background: linear-gradient(145deg, rgba(37, 99, 235, 0.2), rgba(12, 17, 30, 0.95));
    border-color: #38bdf8;
    box-shadow: 0 0 16px rgba(56, 189, 248, 0.25);
}

.enhancer-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.enhancer-title-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.enhancer-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.enhancer-name-col {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.enhancer-name-row {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.enhancer-name {
    font-size: 13px;
    font-weight: 800;
    color: #fff;
    line-height: 1.2;
}

.enhancer-tag {
    font-size: 9px;
    font-weight: 800;
    text-transform: uppercase;
    padding: 1px 6px;
    border-radius: 4px;
    letter-spacing: 0.3px;
}

.enhancer-tag.remacri { background: rgba(56, 189, 248, 0.15); color: #38bdf8; border: 1px solid rgba(56, 189, 248, 0.3); }
.enhancer-tag.face { background: rgba(168, 85, 247, 0.15); color: #c084fc; border: 1px solid rgba(168, 85, 247, 0.3); }
.enhancer-tag.hand { background: rgba(16, 185, 129, 0.15); color: #6ee7b7; border: 1px solid rgba(16, 185, 129, 0.3); }
.enhancer-tag.nsfw { background: rgba(244, 63, 94, 0.15); color: #fda4af; border: 1px solid rgba(244, 63, 94, 0.3); }

.enhancer-price-pill {
    font-size: 11px;
    font-weight: 800;
    color: #60a5fa;
}

.enhancer-desc {
    font-size: 11px;
    color: #cbd5e1;
    font-weight: 500;
    line-height: 1.45;
    margin: 0;
}

/* Custom Cyberpunk Toggle Switch */
.switch {
    position: relative;
    display: inline-block;
    /* HERMES-1 audyt tap-target: track byl 38x20 -- klikalny obszar
       (.slider inset:0) mial 20px wysokosci < 32px WCAG 2.5.5.
       .switch = 44x32 (border-box): .slider (inset:0) pokrywa cala ta
       przestrzen, wiec hit-area = 44x32. Widoczny track (38x20) rysuje
       wnetrze .slider przez jego wlasny background + border-radius. */
    width: 44px;
    height: 32px;
    box-sizing: border-box;
    flex-shrink: 0;
    margin-left: 8px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    /* inset:0 pokrywa CALY .switch (44x32) -> to jest pelna hit-area.
       Widoczny track rysuje background na srodku: 38x20, wycentrowany. */
    inset: 0;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: .25s ease;
}

/* Widoczny track (38x20) -- oddzielny element wizualny wewnatrz .slider.
   background/border/radius tracku przeniesione na ::after, zeby nie
   powiekszac obszaru klikalnego (pseudoelement nie jest event target). */
.slider::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 38px;
    height: 20px;
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    transition: .25s ease;
}

/* Galka toggle'a. Pozycjonowana wzgledem widocznego tracku (.slider::after,
   38x20 wycentrowany w .switch 44x32), NIE wzgledem .switch -- inaczej galka
   wyplynela poza tor. Tor: left 3px..35px, top 6px..26px (w ukladzie .switch). */
.slider:before {
    position: absolute;
    content: "";
    height: 12px;
    width: 12px;
    left: 6px;
    bottom: 10px;
    background-color: #94a3b8;
    border-radius: 50%;
    transition: .25s ease;
}

input:checked + .slider::after {
    background-color: rgba(37, 99, 235, 0.5);
    border-color: #38bdf8;
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.4);
}

input:checked + .slider:before {
    transform: translateX(18px);
    background-color: #38bdf8;
    box-shadow: 0 0 6px #38bdf8;
}

/* Style Select & Negative Box */
.style-filter-row {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.flex-1 { flex: 1; }

.select-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.select-wrapper select {
    width: 100%;
    appearance: none;
    padding-right: 32px;
    cursor: pointer;
    font-weight: 600;
}

.select-chevron {
    position: absolute;
    right: 12px;
    color: var(--text-muted);
    pointer-events: none;
    font-size: 14px;
}

.negative-box {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 6px;
}

/* Live Cost Summary Bar */
.cost-summary-bar {
    background: rgba(10, 14, 26, 0.95);
    border: 1.5px solid rgba(59, 130, 246, 0.3);
    border-radius: var(--radius-md);
    padding: 10px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: inset 0 0 12px rgba(59, 130, 246, 0.1);
}

.summary-breakdown {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #cbd5e1;
}

.summary-divider {
    color: #94a3b8;
    font-weight: 700;
}

.summary-breakdown strong {
    color: #93c5fd;
}

.summary-total {
    display: flex;
    align-items: center;
    gap: 8px;
}

.total-label {
    font-size: 11px;
    color: #cbd5e1;
    text-transform: uppercase;
    font-weight: 800;
    letter-spacing: 0.5px;
}

.total-val {
    font-size: 15px;
    font-weight: 900;
    color: #38bdf8;
    font-family: 'JetBrains Mono', monospace;
    text-shadow: 0 0 12px rgba(56, 189, 248, 0.5);
}

/* Result Meta Bar */
.result-meta-bar {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    width: 100%;
    margin-top: 10px;
    margin-bottom: 8px;
}

.meta-tag {
    font-size: 11px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 6px;
    letter-spacing: 0.3px;
}

.meta-tag.char { background: rgba(59, 130, 246, 0.15); color: #93c5fd; border: 1px solid rgba(59, 130, 246, 0.35); }
.meta-tag.aspect { background: rgba(255, 255, 255, 0.05); color: #cbd5e1; border: 1px solid var(--border-color); }
.meta-tag.addons { background: rgba(168, 85, 247, 0.15); color: #d8b4fe; border: 1px solid rgba(168, 85, 247, 0.35); }
.meta-tag.cost { background: rgba(56, 189, 248, 0.15); color: #67e8f9; border: 1px solid rgba(56, 189, 248, 0.35); font-weight: 800; }

/* Client Alert */
.client-alert {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #fca5a5;
    animation: fadeIn 0.3s ease;
}

/* Generate CTA Button */
.generate-btn {
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, #0369a1, #075985);
    border: none;
    border-radius: var(--radius-md);
    padding: 16px 24px;
    cursor: pointer;
    min-height: 44px;
    box-sizing: border-box;
    box-shadow: 0 6px 20px -4px rgba(2, 132, 199, 0.4);
    transition: var(--transition);
}

.generate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 32px -4px rgba(37, 99, 235, 0.7);
    filter: brightness(1.1);
}

.generate-btn:active {
    transform: translateY(0);
}

.generate-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    position: relative;
    z-index: 1;
}

.btn-text {
    font-size: 14.5px;
    font-weight: 800;
    color: #fff;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

.btn-subtext {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.75);
    font-weight: 500;
}

/* FIX HERMES-1 (2026-10-15 22:5x): czesc "refund" guzika generacji.
   audit_a11y (viewport 1440, stan cancel-mode, guzik renderowany dynamicznie
   przez setGenerateButtonState w app.js) zgłaszal:
   (1) CONTRAST 3.24 < 4.5 — .btn-subtext rgba(255,255,255,.75) na
       gradiencie #dc2626 -> #991b1b; blend dawał [246,201,201].
       Bialy #fff na #dc2626 = 4.83:1 (WCAG AA PASS). Przyciemnialem tylko
       subtekst w trybie cancel — base .btn-subtext bez zmian.
   (2) TAP 132x23 < 44px — .cancel-gen-btn (padding 3px 10px, ~23px wys.).
       Fix wzorcem juz ustalonym w repo (.nav-segment-btn::after,
       .btn-new-chat::after): rozszerzenie obszaru kliknięcia pseudo-
       elementem, layout wizualny bez zmian.
   Dowod: audit_a11y.py po zmianie — 0 contrast, 0 tap, 0 overflow na 3 VP. */
.btn-cancel-mode .btn-subtext {
    color: #ffffff;
}

.cancel-gen-btn {
    position: relative;
}

.cancel-gen-btn::after {
    content: "";
    position: absolute;
    top: -10px;
    right: -10px;
    bottom: -10px;
    left: -10px;
    min-width: 44px;
    min-height: 44px;
    z-index: 0;
}

.btn-shimmer {
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transform: skewX(-20deg);
    animation: shimmerSweep 4s infinite;
}

@keyframes shimmerSweep {
    0% { left: -100%; }
    20% { left: 200%; }
    100% { left: 200%; }
}

/* Viewport Panel (Right) */
.viewport-panel {
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-width: 0;
    width: 100%;
    overflow: hidden;
}

/* Progress Box */
.progress-box {
    background: var(--card-bg);
    border: 1px solid rgba(59, 130, 246, 0.4);
    box-shadow: 0 4px 20px rgba(59, 130, 246, 0.2);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
    animation: fadeIn 0.3s ease;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    font-weight: 700;
    gap: 12px;
    flex-wrap: wrap;
}

.progress-meta-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.cancel-gen-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 44px;
    min-width: 44px;
    padding: 3px 10px;
    font-size: 0.72rem;
    font-weight: 700;
    font-family: inherit;
    color: #f87171;
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.35);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.cancel-gen-btn:hover {
    background: rgba(239, 68, 68, 0.25);
    border-color: #ef4444;
    color: #fee2e2;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.25);
}

.cancel-gen-btn:active {
    transform: translateY(0);
}

.cancel-gen-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.status-msg {
    color: #60a5fa;
    display: flex;
    align-items: center;
    gap: 8px;
}

.spinner-dot {
    width: 8px;
    height: 8px;
    background: #38bdf8;
    border-radius: 50%;
    animation: pulseDot 1s infinite alternate;
}

@keyframes pulseDot {
    from { opacity: 0.3; transform: scale(0.8); }
    to { opacity: 1; transform: scale(1.2); }
}

.percent-msg {
    color: #fff;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
}

.progress-bar-track {
    width: 100%;
    height: 8px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #3b82f6, #06b6d4, #a855f7);
    border-radius: 4px;
    transition: width 0.4s ease;
}

.progress-bar-fill.is-queued {
    background: linear-gradient(90deg, 
        rgba(59, 130, 246, 0.25) 0%, 
        #38bdf8 35%, 
        #a855f7 65%, 
        rgba(59, 130, 246, 0.25) 100%
    );
    background-size: 200% 100%;
    animation: queueShimmer 1.8s infinite linear;
    box-shadow: 0 0 14px rgba(56, 189, 248, 0.5);
}

@keyframes queueShimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Viewport Canvas */
.viewport-canvas {
    background: rgba(13, 18, 31, 0.7);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    min-height: 520px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    position: relative;
    box-shadow: 0 12px 36px -8px rgba(0, 0, 0, 0.5);
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    overflow: hidden;
}

.placeholder-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    max-width: 440px;
    gap: 12px;
}

.placeholder-icon-wrap {
    position: relative;
    width: 72px;
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
}

.placeholder-icon {
    font-size: 36px;
    position: relative;
    z-index: 1;
}

.placeholder-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 1.5px dashed rgba(59, 130, 246, 0.35);
    animation: spinSlow 20s linear infinite;
}

@keyframes spinSlow {
    to { transform: rotate(360deg); }
}

.placeholder-box h3 {
    font-size: 18px;
    font-weight: 800;
    color: #fff;
}

.placeholder-box p {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.mobile-studio-preview-card {
    display: none;
}

.result-box {
    width: 100%;
    max-width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    box-sizing: border-box;
}

.result-image-frame {
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
    max-width: min(100%, 540px);
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
}

.result-box img {
    width: 100%;
    max-width: 100%;
    max-height: 70vh;
    height: auto;
    display: block;
    object-fit: contain;
}

.result-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px 10px;
    width: 100%;
    max-width: 100%;
    margin-top: 6px;
    box-sizing: border-box;
}

.action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-size: 12.5px;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    box-sizing: border-box;
    flex: 0 0 auto;
}

.download-btn {
    background: var(--accent);
    color: #fff;
    border: none;
}

.download-btn:hover {
    background: #2563eb;
    transform: translateY(-1px);
}

.copy-btn {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.copy-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}

.delete-btn {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.35);
    color: #fca5a5;
}

.delete-btn:hover {
    background: rgba(239, 68, 68, 0.35);
    border-color: #ef4444;
    color: #fff;
    transform: translateY(-1px);
}

/* History Tray */
.history-tray {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.history-tray h4 {
    font-size: 13px;
    font-weight: 800;
    color: #f1f5f9;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.history-count {
    font-size: 11px;
    color: #94a3b8;
    font-weight: 600;
}

.history-list {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 8px;
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
    scrollbar-width: thin;
    scrollbar-color: rgba(59, 130, 246, 0.4) rgba(0, 0, 0, 0.2);
    -webkit-overflow-scrolling: touch;
}

.history-list::-webkit-scrollbar {
    height: 6px;
}

.history-list::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

.history-list::-webkit-scrollbar-thumb {
    background: rgba(59, 130, 246, 0.35);
    border-radius: 3px;
}

.history-list::-webkit-scrollbar-thumb:hover {
    background: rgba(59, 130, 246, 0.6);
}

.history-item {
    position: relative;
    width: 68px;
    height: 68px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1.5px solid var(--border-color);
    flex-shrink: 0;
    cursor: pointer;
    transition: var(--transition);
}

.history-item:hover {
    border-color: var(--accent);
    transform: scale(1.05);
}

.history-item.active {
    border-color: #38bdf8;
    box-shadow: 0 0 12px rgba(56, 189, 248, 0.5);
}

.history-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.history-item-del-btn {
    position: absolute;
    top: 3px;
    right: 3px;
    /* HERMES-1 audyt tap-target: 20px -> 32px (minimum Apple HIG / WCAG 2.5.5).
       Sam przycisk rosniet do 32px, HIT-AREA zostaje 44x44 (nie wplywa na layout
       kafelka 68px, bo overlay wyplywa poza niego). */
    width: 32px;
    height: 32px;
    background: rgba(10, 14, 26, 0.85);
    border: 1px solid rgba(239, 68, 68, 0.6);
    color: #fca5a5;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    opacity: 0;
    transition: var(--transition);
    cursor: pointer;
    z-index: 5;
    backdrop-filter: blur(4px);
}

/* Rozszerzony obszar dotyku: 44x44 wycentrowany na przycisku. */
.history-item-del-btn::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 44px;
    height: 44px;
    transform: translate(-50%, -50%);
}

.history-item:hover .history-item-del-btn {
    opacity: 1;
}

.history-item-del-btn:hover {
    background: #dc2626;
    color: #fff;
    border-color: #ef4444;
    transform: scale(1.18);
}

/* History Tray Header */
.history-tray-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2px 0 10px 0;
    margin-bottom: 6px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    width: 100%;
    box-sizing: border-box;
}

.history-tray-title {
    font-size: 13px;
    font-weight: 800;
    color: #f1f5f9;
    letter-spacing: 0.4px;
    display: flex;
    align-items: center;
    gap: 8px;
    text-transform: uppercase;
}

.history-tray-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* History Batch Toolbar & Selection Mode */
.history-batch-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid rgba(56, 189, 248, 0.35);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    gap: 10px;
    margin-bottom: 4px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
    flex-wrap: wrap;
    width: 100%;
    box-sizing: border-box;
}

.history-batch-toolbar.hidden {
    display: none !important;
}

.batch-toolbar-left, .batch-toolbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.batch-count-badge {
    background: rgba(56, 189, 248, 0.15);
    color: #38bdf8;
    border: 1px solid rgba(56, 189, 248, 0.3);
    border-radius: 9999px;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

.batch-quick-filters {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.batch-pill-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #e2e8f0;
    border-radius: 9999px;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: all 0.15s ease;
}

.batch-pill-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.35);
}

.batch-action-btn {
    border-radius: var(--radius-sm);
    padding: 6px 14px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
    border: none;
    white-space: nowrap;
}

.batch-btn-primary {
    background: linear-gradient(135deg, #0ea5e9, #0284c7);
    color: #fff;
    border: 1px solid rgba(14, 165, 233, 0.4) !important;
}

.batch-btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #38bdf8, #0ea5e9);
    box-shadow: 0 0 14px rgba(14, 165, 233, 0.6);
    transform: translateY(-1px);
}

.batch-btn-primary:disabled {
    background: rgba(14, 165, 233, 0.25);
    color: rgba(255, 255, 255, 0.4);
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
    border-color: rgba(255, 255, 255, 0.08) !important;
}

.batch-btn-danger {
    background: #ef4444;
    color: #fff;
}

.batch-btn-danger:hover:not(:disabled) {
    background: #dc2626;
    box-shadow: 0 0 12px rgba(239, 68, 68, 0.6);
    transform: translateY(-1px);
}

.batch-btn-danger:disabled {
    background: rgba(239, 68, 68, 0.3);
    color: rgba(255, 255, 255, 0.4);
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.batch-btn-done {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    color: #f1f5f9;
}

.batch-btn-done:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

/* History Selection Mode Grid & Checkbox */
.history-tray.selection-mode .history-list {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)) !important;
    gap: 12px !important;
    max-height: 440px !important;
    overflow-y: auto !important;
    padding: 8px 4px !important;
}

.history-tray.selection-mode .history-item {
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 1 / 1 !important;
}

.history-tray.selection-mode .history-item-del-btn {
    display: none !important;
}

.history-item-check {
    display: none;
    position: absolute;
    top: 5px;
    left: 5px;
    width: 22px;
    height: 22px;
    border-radius: 6px;
    background: rgba(15, 23, 42, 0.85);
    border: 1.5px solid rgba(255, 255, 255, 0.5);
    align-items: center;
    justify-content: center;
    color: transparent;
    font-size: 11px;
    z-index: 5;
    transition: all 0.15s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
}

.history-tray.selection-mode .history-item-check {
    display: flex;
}

.history-item.selected {
    border-color: #ef4444 !important;
    box-shadow: 0 0 14px rgba(239, 68, 68, 0.6) !important;
    transform: scale(0.96);
}

.history-item.selected .history-item-check {
    background: #ef4444 !important;
    border-color: #ef4444 !important;
    color: #fff !important;
}

.history-item.anim-deleting {
    transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1) !important;
    opacity: 0 !important;
    transform: scale(0.5) !important;
    pointer-events: none !important;
}

.history-load-more-wrap {
    display: flex;
    justify-content: center;
    padding: 8px 0;
    width: 100%;
}

.history-load-more-btn {
    background: rgba(30, 41, 59, 0.85);
    border: 1px solid rgba(56, 189, 248, 0.35);
    color: #38bdf8;
    border-radius: 9999px;
    padding: 7px 18px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.history-load-more-btn:hover {
    background: rgba(56, 189, 248, 0.18);
    border-color: #38bdf8;
    transform: translateY(-1px);
}

.no-history-text {
    font-size: 12px;
    color: var(--text-muted);
}

/* ==================================================================== */
/* LUXURY CHARACTER ROSTER MODAL (HIGH-END REDESIGN)                     */
/* ==================================================================== */

.roster-modal {
    background: rgba(10, 14, 26, 0.92);
    backdrop-filter: blur(28px);
    -webkit-backdrop-filter: blur(28px);
    border: 1px solid rgba(59, 130, 246, 0.35);
    border-radius: var(--radius-xl);
    box-shadow: 0 30px 80px -15px rgba(0, 0, 0, 0.85), 0 0 50px rgba(59, 130, 246, 0.2);
    width: 95%;
    max-width: 1140px;
    height: 86vh;
    max-height: 86vh;
    padding: 0;
    margin: auto;
    color: #fff;
    outline: none;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.roster-modal:not([open]) {
    display: none !important;
}

.roster-modal::backdrop {
    background: rgba(4, 6, 12, 0.8);
    backdrop-filter: blur(12px);
}

.dialog-mount {
    height: 100% !important;
    max-height: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    min-height: 0 !important;
    flex: 1 1 auto !important;
}

.modal-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-height: 100%;
    overflow: hidden;
    min-height: 0;
    flex: 1 1 auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 28px 18px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.modal-title-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.modal-title-group h2 {
    font-size: 22px;
    font-weight: 800;
    color: #fff;
    letter-spacing: -0.4px;
}

.roster-count-badge {
    font-size: 10px;
    font-weight: 800;
    color: #38bdf8;
    background: rgba(56, 189, 248, 0.15);
    border: 1px solid rgba(56, 189, 248, 0.35);
    padding: 2px 8px;
    border-radius: 6px;
    letter-spacing: 0.5px;
}

.modal-title-group p {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.modal-close-btn {
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: var(--transition);
    position: relative;
}

/* powiekszony obszar kliku do 44px (HIG) -- brak wplywu na layout */
.modal-close-btn::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 44px;
    height: 44px;
    transform: translate(-50%, -50%);
}

.modal-close-btn:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.4);
    color: #fca5a5;
    transform: rotate(90deg);
}

/* Modal Filter Bar */
.modal-filter-bar {
    padding: 14px 28px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(13, 18, 31, 0.9);
    border: 1.5px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-md);
    padding: 0 16px;
    transition: var(--transition);
}

.search-box:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 16px rgba(59, 130, 246, 0.35);
}

.search-icon-svg {
    color: var(--text-muted);
}

.search-box input {
    flex: 1;
    background: transparent;
    border: none;
    color: #fff;
    padding: 12px 0;
    font-size: 14px;
    outline: none;
}

.search-esc-hint {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
}

.category-filters {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 2px;
}

.filter-tab {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: var(--transition);
}

.filter-tab:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.filter-tab.active {
    background: var(--accent);
    border-color: #60a5fa;
    color: #fff;
    box-shadow: 0 0 14px rgba(59, 130, 246, 0.4);
}

/* Roster Grid */
.roster-grid {
    padding: 20px 28px 48px;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    flex: 1 1 auto !important;
    min-height: 0 !important;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
    gap: 14px;
    align-content: start;
}

/* Custom Scrollbar */
.roster-grid::-webkit-scrollbar {
    width: 6px;
}

.roster-grid::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
}

.roster-grid::-webkit-scrollbar-thumb {
    background: rgba(59, 130, 246, 0.35);
    border-radius: 3px;
}

.roster-grid::-webkit-scrollbar-thumb:hover {
    background: rgba(59, 130, 246, 0.6);
}

/* Luxury Roster Card */
.roster-card {
    background: rgba(15, 21, 38, 0.75);
    backdrop-filter: blur(16px);
    border: 1.5px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    display: flex;
    align-items: center;
    gap: 14px;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    min-height: 86px;
    box-sizing: border-box;
    flex-shrink: 0;
}

.roster-card:hover {
    background: rgba(24, 34, 61, 0.9);
    border-color: rgba(59, 130, 246, 0.6);
    transform: translateY(-2px);
    box-shadow: 0 10px 25px -4px rgba(0, 0, 0, 0.6), 0 0 18px rgba(59, 130, 246, 0.25);
}

.roster-card.active {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.25), rgba(124, 58, 237, 0.15));
    border-color: #3b82f6;
    box-shadow: 0 0 24px rgba(59, 130, 246, 0.4), inset 0 0 16px rgba(59, 130, 246, 0.1);
}

/* Avatar Frame */
.roster-avatar-wrap {
    position: relative;
    width: 60px;
    height: 60px;
    flex-shrink: 0;
}

.roster-avatar {
    width: 100%;
    height: 100%;
    border-radius: var(--radius-sm);
    object-fit: cover;
    border: 1.5px solid rgba(255, 255, 255, 0.15);
    background: #000;
}

.roster-card.active .roster-avatar {
    border-color: #60a5fa;
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.5);
}

.roster-cat-tag {
    position: absolute;
    bottom: -4px;
    right: -4px;
    font-size: 8px;
    font-weight: 800;
    text-transform: uppercase;
    padding: 1px 5px;
    border-radius: 4px;
    letter-spacing: 0.3px;
    border: 1px solid rgba(0, 0, 0, 0.4);
}

.roster-cat-tag.canine { background: #1d4ed8; color: #bfdbfe; }
.roster-cat-tag.feline { background: #b45309; color: #fde68a; }
.roster-cat-tag.small { background: #047857; color: #a7f3d0; }
.roster-cat-tag.avian { background: #6d28d9; color: #ddd6fe; }
.roster-cat-tag.scalie { background: #be185d; color: #fbcfe8; }
.roster-cat-tag.custom { background: #475569; color: #cbd5e1; }

/* Details */
.roster-details {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 3px;
    flex: 1;
    min-width: 0;
}

.roster-name-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.roster-name {
    font-size: 15px;
    font-weight: 800;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.25;
}

.roster-role-badge {
    font-size: 9px;
    font-weight: 700;
    color: #c084fc;
    background: rgba(192, 132, 252, 0.15);
    border: 1px solid rgba(192, 132, 252, 0.3);
    padding: 1px 6px;
    border-radius: 4px;
    white-space: nowrap;
}

.roster-species {
    font-size: 12px;
    font-weight: 600;
    color: #38bdf8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.25;
}

/* Individual Pill Badges */
.roster-traits-list {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
    margin-top: 3px;
}

.roster-pill {
    font-size: 10px;
    font-weight: 600;
    color: #94a3b8;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 2px 7px;
    border-radius: 4px;
    font-family: 'JetBrains Mono', monospace;
    line-height: 1.25;
    white-space: nowrap;
    letter-spacing: -0.2px;
}

.roster-card.active .roster-pill {
    color: #bfdbfe;
    background: rgba(59, 130, 246, 0.15);
    border-color: rgba(59, 130, 246, 0.3);
}

/* Checkmark Indicator */
.roster-check {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 1.5px solid rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    color: transparent;
    transition: var(--transition);
    flex-shrink: 0;
}

.roster-check.visible {
    background: #10b981;
    border-color: #10b981;
    color: #fff;
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.5);
}

/* Admin Modal — FULL DARK REDESIGN */
.admin-modal {
    background: rgba(8, 12, 22, 0.97) !important;
    border: 1px solid rgba(56, 189, 248, 0.2) !important;
    border-radius: 18px !important;
    box-shadow: 0 32px 80px rgba(0,0,0,0.85), 0 0 0 1px rgba(56,189,248,0.08) !important;
    padding: 0 !important;
    max-width: min(960px, 96vw) !important;
    max-height: 90dvh !important;
    width: min(960px, 96vw) !important;
    overflow: hidden !important;
}

.admin-modal:not([open]) {
    display: none !important;
}

.admin-modal::backdrop {
    background: rgba(0,0,0,0.78);
    backdrop-filter: blur(10px);
}

.admin-modal-content {
    display: flex;
    flex-direction: column;
    height: min(88dvh, 800px);
    overflow: hidden;
    background: transparent;
}

.admin-shield-badge {
    font-size: 9px;
    font-weight: 900;
    color: #f59e0b;
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid rgba(245, 158, 11, 0.4);
    padding: 3px 9px;
    border-radius: 4px;
    letter-spacing: 0.8px;
    text-transform: uppercase;
}

.admin-user-table-wrap {
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background: rgba(0,0,0,0.25);
}


.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.admin-table th, .admin-table td {
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.admin-table th {
    background: rgba(0, 0, 0, 0.3);
    color: var(--text-secondary);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 11px;
}

.grant-btns {
    display: flex;
    align-items: center;
    gap: 6px;
}

.grant-btn {
    background: rgba(37, 99, 235, 0.2);
    border: 1px solid rgba(59, 130, 246, 0.4);
    color: #93c5fd;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
}

.grant-btn:hover {
    background: var(--accent);
    color: #fff;
}

.hidden {
    display: none !important;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}


/* ==================================================================== */
/* FEEDBACK PANEL                                                         */
/* ==================================================================== */

.feedback-panel {
    margin-top: 14px;
    background: rgba(15, 20, 35, 0.85);
    border: 1px solid rgba(56, 189, 248, 0.2);
    border-radius: var(--radius-md);
    padding: 16px 18px;
    backdrop-filter: blur(12px);
    animation: fadeIn 0.3s ease;
}

.feedback-header {
    display: flex;
    flex-direction: column;
    margin-bottom: 14px;
    gap: 3px;
}

.feedback-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: 0.02em;
}

.feedback-subtitle {
    font-size: 11px;
    color: var(--text-muted);
}

.feedback-rating-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.feedback-btn {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 9px 16px;
    border-radius: var(--radius-sm);
    border: 1.5px solid rgba(255,255,255,0.12);
    background: rgba(255,255,255,0.05);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    /* FIX HERMES-1 2026-10-14: hit-area 36-37px -> 44px (HIG). */
    min-height: 44px;
    box-sizing: border-box;
    transition: var(--transition);
    font-family: inherit;
}

.feedback-btn:hover {
    background: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.25);
    color: var(--text-primary);
    transform: translateY(-1px);
}

.feedback-btn.thumbs-up.selected {
    background: rgba(34, 197, 94, 0.2);
    border-color: rgba(34, 197, 94, 0.6);
    color: #4ade80;
}

.feedback-btn.thumbs-down.selected {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.6);
    color: #f87171;
}

.feedback-btn.starred.selected {
    background: rgba(251, 191, 36, 0.2);
    border-color: rgba(251, 191, 36, 0.6);
    color: #fbbf24;
}

.fb-icon {
    font-size: 16px;
    line-height: 1;
}

.fb-label {
    font-size: 12px;
    font-weight: 600;
}

.feedback-form {
    margin-top: 14px;
    animation: fadeIn 0.25s ease;
}

.feedback-fields {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 12px;
}

.feedback-field-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.fb-field-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.fb-input {
    background: rgba(0,0,0,0.3);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    color: var(--text-primary);
    font-size: 13px;
    font-family: inherit;
    transition: var(--transition);
    width: 100%;
    box-sizing: border-box;
}

.fb-input:focus {
    outline: none;
    border-color: var(--accent);
    background: rgba(56, 189, 248, 0.06);
}

.fb-textarea {
    background: rgba(0,0,0,0.3);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    color: var(--text-primary);
    font-size: 13px;
    font-family: inherit;
    resize: vertical;
    transition: var(--transition);
    width: 100%;
    box-sizing: border-box;
    min-height: 60px;
}

.fb-textarea:focus {
    outline: none;
    border-color: var(--accent);
    background: rgba(56, 189, 248, 0.06);
}

.fb-submit-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    background: linear-gradient(135deg, #0369a1, #075985) !important;
    color: #ffffff !important; /* kontrast AA (by 2.14 na #38bdf8) */
    border: none !important;
    border-radius: var(--radius-sm) !important;
    padding: 12px 26px !important;
    /* FIX HERMES-1 2026-10-14: hit-area 40px -> 44px (HIG). */
    min-height: 44px !important;
    box-sizing: border-box !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    cursor: pointer !important;
    font-family: inherit !important;
    box-shadow: 0 4px 16px rgba(56, 189, 248, 0.4) !important;
    transition: var(--transition) !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3) !important;
}

.fb-submit-btn:hover {
    opacity: 0.95 !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 6px 20px rgba(56, 189, 248, 0.55) !important;
}

.fb-submit-btn:disabled {
    opacity: 0.5 !important;
    cursor: not-allowed !important;
    transform: none !important;
    box-shadow: none !important;
}

.feedback-sent {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: rgba(34, 197, 94, 0.12);
    border: 1px solid rgba(34, 197, 94, 0.35);
    border-radius: var(--radius-sm);
    margin-top: 14px;
    animation: fadeIn 0.3s ease;
}

.feedback-sent-icon {
    font-size: 18px;
    color: #4ade80;
    font-weight: 800;
}

.feedback-sent-msg {
    font-size: 13px;
    color: #86efac;
    font-weight: 500;
}


/* ==================================================================== */
/* ADMIN PANEL REDESIGN                                                   */
/* ==================================================================== */



.admin-tabs {
    display: flex;
    gap: 4px;
    padding: 12px 24px 0;
    border-bottom: 1px solid var(--border-color);
    background: rgba(0,0,0,0.2);
    flex-shrink: 0;
}

.admin-tab {
    padding: 8px 18px 10px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: var(--transition);
    border-radius: 4px 4px 0 0;
    margin-bottom: -1px;
}

.admin-tab:hover {
    color: var(--text-secondary);
    background: rgba(255,255,255,0.04);
}

.admin-tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
    background: rgba(56, 189, 248, 0.06);
}

.admin-tab-panel {
    display: none;
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px;
    flex-direction: column;
    gap: 20px;
}

.admin-tab-panel.active {
    display: flex;
}

/* KPI Cards */
.admin-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
    flex-shrink: 0;
}

.admin-kpi-card {
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: var(--transition);
}

.admin-kpi-card:hover {
    border-color: rgba(56,189,248,0.3);
    background: rgba(56,189,248,0.06);
}

.admin-kpi-card.positive { border-color: rgba(34,197,94,0.2); }
.admin-kpi-card.negative { border-color: rgba(239,68,68,0.2); }
.admin-kpi-card.starred { border-color: rgba(251,191,36,0.2); }
.admin-kpi-card.dataset { border-color: rgba(167,139,250,0.2); }

.kpi-icon {
    font-size: 22px;
    line-height: 1;
    flex-shrink: 0;
}

.kpi-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.kpi-value {
    font-size: 22px;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.kpi-label {
    font-size: 10px;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    white-space: nowrap;
}

/* Chart Cards */
.admin-charts-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

@media (max-width: 600px) {
    .admin-charts-row { grid-template-columns: 1fr; }
}

.admin-chart-card {
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
}

.chart-title {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 12px;
}

.admin-bar-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.admin-bar-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
}

.bar-item-label {
    width: 90px;
    color: var(--text-secondary);
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex-shrink: 0;
}

.bar-track {
    flex: 1;
    height: 8px;
    background: rgba(255,255,255,0.06);
    border-radius: 4px;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--accent-hover));
    border-radius: 4px;
    transition: width 0.4s ease;
    min-width: 4px;
}

.bar-item-val {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    min-width: 20px;
    text-align: right;
}

.admin-loading {
    color: var(--text-muted);
    font-size: 12px;
}

.admin-empty {
    color: var(--text-muted);
    font-size: 12px;
    font-style: italic;
}

/* Admin Users Table */
.admin-user-name {
    font-weight: 700;
    color: var(--text-primary);
    font-size: 13px;
}

.admin-user-handle {
    font-size: 11px;
    color: var(--text-muted);
}

.admin-badge-mini {
    background: rgba(245, 158, 11, 0.2);
    border: 1px solid rgba(245, 158, 11, 0.4);
    color: #fbbf24;
    font-size: 9px;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 3px;
    margin-left: 4px;
    vertical-align: middle;
}

.admin-balance {
    color: #60a5fa;
    font-size: 13px;
}

.admin-mono-cell {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-muted);
    word-break: break-all;
}

.admin-date-cell {
    font-size: 11px;
    color: var(--text-muted);
}

.grant-btn-lg {
    background: rgba(56,189,248,0.15) !important;
    border-color: rgba(56,189,248,0.4) !important;
    color: var(--accent) !important;
}

/* Feedback Tab */
.admin-feedback-wrap {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.admin-loading-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
    font-size: 13px;
}

.admin-feedback-item {
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    animation: fadeIn 0.2s ease;
}

.admin-feedback-item.fb-pos { border-color: rgba(34,197,94,0.2); }
.admin-feedback-item.fb-neg { border-color: rgba(239,68,68,0.2); }
.admin-feedback-item.fb-star {
    border-color: rgba(251,191,36,0.3);
    background: rgba(251,191,36,0.04);
}

.afb-top {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.afb-rating {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
}

.afb-char {
    font-size: 11px;
    font-weight: 600;
    background: rgba(56,189,248,0.12);
    border: 1px solid rgba(56,189,248,0.25);
    color: var(--accent);
    padding: 2px 8px;
    border-radius: 3px;
}

.afb-user {
    font-size: 11px;
    color: var(--text-muted);
}

.afb-dataset-badge {
    font-size: 10px;
    font-weight: 700;
    background: rgba(167,139,250,0.15);
    border: 1px solid rgba(167,139,250,0.35);
    color: #c4b5fd;
    padding: 2px 6px;
    border-radius: 3px;
}

.afb-date {
    font-size: 10px;
    color: var(--text-muted);
    margin-left: auto;
}

.afb-thumb-wrap {
    width: 80px;
    height: 80px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    flex-shrink: 0;
}

.afb-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.afb-field {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.afb-field-icon {
    flex-shrink: 0;
    font-size: 14px;
}

/* ==================================================================== */
/* MOBILE-FIRST & TABLET RESPONSIVE EXCELLENCE                          */
/* ==================================================================== */

@media (max-width: 768px) {
    /* Full Mobile Sheet for Character Roster */
    .roster-modal {
        width: 100vw !important;
        max-width: 100vw !important;
        height: 100dvh !important;
        max-height: 100dvh !important;
        border-radius: 0 !important;
        border: none !important;
        margin: 0 !important;
        inset: 0 !important;
    }

    .modal-content {
        height: 100dvh !important;
        max-height: 100dvh !important;
    }

    .modal-header {
        padding: 16px 18px 14px;
        position: sticky;
        top: 0;
        z-index: 10;
        background: rgba(10, 14, 26, 0.98);
    }

    .modal-title-group h2 {
        font-size: 18px;
    }

    .modal-title-group p {
        font-size: 11.5px;
    }

    .modal-close-btn {
        width: 42px;
        height: 42px;
        font-size: 18px;
        flex-shrink: 0;
    }

    .modal-filter-bar {
        padding: 12px 18px;
        position: sticky;
        top: 68px;
        z-index: 9;
        background: rgba(8, 12, 22, 0.98);
        gap: 10px;
    }

    .search-box {
        padding: 0 14px;
    }

    .search-box input {
        padding: 10px 0;
        font-size: 16px; /* Prevents auto-zoom on iOS Safari */
    }

    .search-esc-hint {
        display: none;
    }

    .category-filters {
        gap: 6px;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding-bottom: 4px;
    }

    .category-filters::-webkit-scrollbar {
        display: none;
    }

    .filter-tab {
        padding: 6px 12px;
        font-size: 11px;
    }

    .roster-grid {
        grid-template-columns: 1fr;
        gap: 10px;
        padding: 14px 18px calc(44px + env(safe-area-inset-bottom, 20px));
    }

    .roster-card {
        min-height: 80px;
        padding: 12px;
        border-radius: var(--radius-md);
    }

    .roster-avatar-wrap {
        width: 56px;
        height: 56px;
    }

    .roster-name {
        font-size: 15px;
    }

    .roster-species {
        font-size: 12px;
    }

    .roster-pill {
        font-size: 9.5px;
        padding: 2px 6px;
    }

    /* Overall Studio Mobile Optimization */
    .app-container {
        padding: 10px 12px 30px;
        gap: 14px;
    }

    .studio-header {
        padding: 12px 14px;
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .header-right {
        width: 100%;
        justify-content: space-between;
    }

    .controls-panel {
        padding: 14px;
        gap: 14px;
    }

    #prompt-input {
        font-size: 16px; /* Prevents iOS auto-zoom */
    }

    .prompt-chips-bar {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .prompt-chips-bar::-webkit-scrollbar {
        display: none;
    }

    .prompt-chips {
        flex-wrap: nowrap;
        padding-bottom: 4px;
    }

    .aspect-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 6px;
    }

    .aspect-card {
        padding: 8px 4px;
    }

    .aspect-shape-box {
        transform: scale(0.85);
    }

    .aspect-title {
        font-size: 11px;
    }

    .aspect-res {
        display: none; /* Hide pixel dimensions on mobile to save vertical space */
    }

    .enhancers-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .enhancer-card {
        padding: 12px 14px;
    }

    .cost-summary-bar {
        padding: 12px 14px;
        font-size: 12px;
    }

    .generate-btn {
        padding: 16px;
        min-height: 54px;
    }

    .viewport-canvas {
        padding: 12px;
        min-height: 320px;
    }

    .result-actions {
        flex-direction: column;
        width: 100%;
        gap: 8px;
    }

    .action-btn {
        width: 100%;
        justify-content: center;
        padding: 12px;
    }
}

@media (max-width: 480px) {
    .brand-title-row h1 {
        font-size: 16px;
    }

    .brand-version-badge {
        font-size: 9px;
        padding: 1px 5px;
    }

    .tagline {
        font-size: 11px;
    }

    .system-status {
        padding: 4px 8px;
    }

    .status-label {
        font-size: 10px;
    }

    .active-char-card {
        padding: 10px 12px;
        gap: 10px;
    }

    .active-char-avatar-frame {
        width: 52px;
        height: 52px;
    }

    .change-char-btn {
        padding: 6px 10px;
        font-size: 11px;
    }
}

/* ==================================================================== */
/* PROMPT ASSIST BUTTON & SEED CONTROLS                                 */
/* ==================================================================== */

.prompt-header-wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.prompt-assist-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: var(--radius-sm);
    background: rgba(14, 165, 233, 0.12);
    border: 1px solid rgba(14, 165, 233, 0.35);
    color: #38bdf8;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    min-height: 44px;
    box-sizing: border-box;
    transition: var(--transition);
    font-family: inherit;
}

.prompt-assist-btn:hover {
    background: rgba(14, 165, 233, 0.22);
    border-color: rgba(14, 165, 233, 0.6);
    color: #f0f9ff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.2);
}

.prompt-expand-view-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.16);
    color: #cbd5e1;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    min-height: 44px;
    box-sizing: border-box;
    transition: var(--transition);
    font-family: inherit;
}

.prompt-expand-view-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.32);
    color: #ffffff;
    transform: translateY(-1px);
}

.prompt-expand-view-btn.active {
    background: rgba(99, 102, 241, 0.2);
    border-color: #6366f1;
    color: #c7d2fe;
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.3);
}

#prompt-input.editor-tall {
    min-height: 260px !important;
    height: 280px !important;
    max-height: 600px !important;
}

.seed-input-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
}

.seed-input-wrap input {
    flex: 1;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    padding: 8px 12px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    transition: var(--transition);
}

.seed-input-wrap input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.15);
}

.seed-ctrl-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    cursor: pointer;
    /* FIX HERMES-1 2026-10-14: hit-area 33px -> 44px (HIG mobile). */
    min-height: 44px;
    min-width: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    transition: var(--transition);
}

.seed-ctrl-btn:hover {
    background: rgba(56, 189, 248, 0.15);
    border-color: var(--accent);
    color: var(--accent);
}

.meta-tag.seed {
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #34d399;
}

.meta-tag.seed:hover {
    background: rgba(16, 185, 129, 0.22);
}

.seed-action-btn {
    background: rgba(16, 185, 129, 0.12) !important;
    border-color: rgba(16, 185, 129, 0.35) !important;
    color: #34d399 !important;
}

.seed-action-btn:hover {
    background: rgba(16, 185, 129, 0.25) !important;
    border-color: rgba(16, 185, 129, 0.6) !important;
    color: #6ee7b7 !important;
}

.history-item {
    position: relative;
}

.history-item-badge {
    position: absolute;
    bottom: 6px;
    right: 6px;
    background: rgba(0, 0, 0, 0.75);
    border-radius: 4px;
    padding: 1px 4px;
    font-size: 10px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(4px);
    pointer-events: none;
}

/* ==================================================================== */
/* MODEL & TRAINING MONITOR TAB                                         */
/* ==================================================================== */

.admin-training-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 10px;
}

.training-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.training-status-badge.active {
    background: rgba(34, 197, 94, 0.15);
    border: 1px solid rgba(34, 197, 94, 0.4);
    color: #4ade80;
}

.training-status-badge.idle {
    background: rgba(148, 163, 184, 0.15);
    border: 1px solid rgba(148, 163, 184, 0.4);
    color: #94a3b8;
}

.pulse-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 8px #22c55e;
    animation: pulseGlow 1.8s infinite;
}

@keyframes pulseGlow {
    0% { transform: scale(0.95); opacity: 0.7; }
    50% { transform: scale(1.2); opacity: 1; box-shadow: 0 0 12px #22c55e; }
    100% { transform: scale(0.95); opacity: 0.7; }
}

.training-hero-card {
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.95), rgba(30, 27, 75, 0.85));
    border: 1px solid rgba(168, 85, 247, 0.3);
    border-radius: var(--radius-md);
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
}

.training-hero-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 18px;
    gap: 16px;
}

.arch-tag {
    display: inline-block;
    font-size: 9px;
    font-weight: 900;
    color: #c084fc;
    background: rgba(168, 85, 247, 0.18);
    border: 1px solid rgba(168, 85, 247, 0.4);
    padding: 2px 8px;
    border-radius: 4px;
    letter-spacing: 0.6px;
    margin-bottom: 6px;
}

.arch-title {
    font-size: 17px;
    font-weight: 800;
    color: #f8fafc;
    margin-bottom: 4px;
}

.arch-sub {
    font-size: 12px;
    color: #94a3b8;
    line-height: 1.5;
    max-width: 650px;
}

.vram-gauge {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    background: rgba(0, 0, 0, 0.4);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.gauge-label {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.gauge-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 20px;
    font-weight: 800;
    color: #38bdf8;
}

.gauge-max {
    font-size: 10px;
    color: #64748b;
}

.training-progress-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.progress-info-row, .progress-footer-row {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
}

.progress-step-text {
    font-weight: 700;
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
}

.progress-pct-text {
    font-weight: 800;
    color: #38bdf8;
    font-family: 'JetBrains Mono', monospace;
}

.training-progress-track {
    width: 100%;
    height: 10px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.training-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #38bdf8, #818cf8, #c084fc);
    border-radius: 6px;
    transition: width 0.4s ease;
    box-shadow: 0 0 14px rgba(56, 189, 248, 0.6);
}

.progress-footer-row {
    color: #94a3b8;
    font-size: 11px;
}

.training-buffer-card, .training-history-card {
    background: rgba(15, 20, 35, 0.85);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px 18px;
    margin-bottom: 16px;
}

.buffer-pills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
    margin-top: 10px;
}

.buffer-pill {
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.07);
    padding: 10px 12px;
    border-radius: var(--radius-sm);
}

.buf-name {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-primary);
}

.buf-pct {
    font-size: 11px;
    color: #38bdf8;
    font-family: 'JetBrains Mono', monospace;
}

/* ==================================================================== */
/* Admin Maintenance & Gaming Mode Controls                             */
/* ==================================================================== */
.admin-maintenance-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

@media (max-width: 900px) {
    .admin-maintenance-grid {
        grid-template-columns: 1fr;
    }
}

.admin-maint-card {
    background: rgba(15, 23, 42, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.admin-maint-card.gaming-mode-card {
    border-color: rgba(168, 85, 247, 0.3);
    background: linear-gradient(180deg, rgba(30, 20, 50, 0.7) 0%, rgba(15, 23, 42, 0.9) 100%);
}

.maint-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 10px;
}

.maint-card-title {
    font-size: 13.5px;
    font-weight: 800;
    color: #38bdf8;
    display: flex;
    align-items: center;
    gap: 8px;
    letter-spacing: 0.5px;
}

.gaming-mode-card .maint-card-title {
    color: #c084fc;
}

.maint-card-desc {
    font-size: 12px;
    color: #94a3b8;
    line-height: 1.5;
    margin: 0;
}

.maint-status-pill, .gaming-lock-pill {
    padding: 3px 10px;
    border-radius: 9999px;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.5px;
    background: rgba(255, 255, 255, 0.06);
    color: #94a3b8;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.maint-status-pill.is-active {
    background: rgba(245, 158, 11, 0.2);
    color: #fbbf24;
    border-color: rgba(245, 158, 11, 0.4);
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.3);
}

.gaming-lock-pill.is-active {
    background: rgba(168, 85, 247, 0.25);
    color: #d8b4fe;
    border-color: rgba(168, 85, 247, 0.5);
    box-shadow: 0 0 10px rgba(168, 85, 247, 0.4);
}

.maint-form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.maint-label {
    font-size: 11.5px;
    font-weight: 700;
    color: #cbd5e1;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.maint-preset-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.btn-maint-preset {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #94a3b8;
    border-radius: 6px;
    padding: 5px 10px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}

.btn-maint-preset:hover {
    background: rgba(56, 189, 248, 0.15);
    border-color: #38bdf8;
    color: #ffffff;
}

.maint-toggles-row {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    background: rgba(0, 0, 0, 0.25);
    padding: 10px 14px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.switch-toggle-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 12px;
}

.switch-toggle-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #38bdf8;
    cursor: pointer;
}

.maint-actions-row, .gaming-actions-row {
    display: flex;
    gap: 10px;
    margin-top: 6px;
    flex-wrap: wrap;
}

.admin-action-btn.primary {
    background: linear-gradient(135deg, #0284c7, #2563eb);
    color: #ffffff;
    border: 1px solid rgba(56, 189, 248, 0.4);
    font-weight: 700;
    border-radius: 8px;
    padding: 10px 18px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    transition: all 0.2s;
}

.admin-action-btn.primary:hover {
    box-shadow: 0 0 16px rgba(56, 189, 248, 0.5);
    transform: translateY(-1px);
}

.admin-action-btn.secondary {
    background: rgba(255, 255, 255, 0.06);
    color: #cbd5e1;
    border: 1px solid rgba(255, 255, 255, 0.14);
    font-weight: 600;
    border-radius: 8px;
    padding: 10px 18px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    transition: all 0.2s;
}

.admin-action-btn.secondary:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
}

.gaming-stats-strip {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
    background: rgba(0, 0, 0, 0.35);
    padding: 10px 14px;
    border-radius: 8px;
    border: 1px solid rgba(168, 85, 247, 0.15);
}

.gaming-stat-item {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.gaming-stat-item .stat-k {
    font-size: 10px;
    color: #94a3b8;
    text-transform: uppercase;
}

.gaming-stat-item .stat-v {
    font-size: 12.5px;
    font-weight: 700;
    color: #f1f5f9;
    font-family: 'JetBrains Mono', monospace;
}

.btn-gaming-toggle {
    flex: 1;
    padding: 12px 16px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 12px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-gaming-toggle.activate {
    background: linear-gradient(135deg, rgba(147, 51, 234, 0.8), rgba(126, 34, 206, 0.9));
    color: #ffffff;
    border: 1px solid rgba(192, 132, 252, 0.5);
    box-shadow: 0 4px 14px rgba(147, 51, 234, 0.3);
}

.btn-gaming-toggle.activate:hover {
    box-shadow: 0 0 20px rgba(192, 132, 252, 0.6);
    transform: translateY(-1px);
}

.btn-gaming-toggle.deactivate {
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
    border: 1px solid rgba(34, 197, 94, 0.4);
}

.btn-gaming-toggle.deactivate:hover {
    background: rgba(34, 197, 94, 0.25);
    box-shadow: 0 0 16px rgba(34, 197, 94, 0.4);
}

/* ==================================================================== */
/* MOBILE RESPONSIVENESS & TOUCH OPTIMIZATIONS                          */
/* ==================================================================== */

/* Base touch improvements */
html, body {
    -webkit-tap-highlight-color: transparent;
}

.history-list, .roster-grid, .modal-content, .viewport-canvas {
    -webkit-overflow-scrolling: touch;
}

button, a, .quick-pill, .aspect-card, .enhancer-card, .chip-btn {
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@media (hover: none) {
    button:active, a:active, .quick-pill:active, .chip-btn:active {
        transform: scale(0.96);
        opacity: 0.8;
    }
}

/* Touch targets min 44px height */
.chip-btn, .change-char-btn, .popout-trigger-btn, .admin-tab, .filter-tab, .discord-login-btn, .action-btn, .advanced-summary {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

textarea, select, input {
    min-height: 44px;
    line-height: 1.6;
}

/* Breakpoint 768px */
@media (max-width: 768px) {
    .app-container {
        padding: calc(env(safe-area-inset-top, 10px) + 10px) 14px calc(env(safe-area-inset-bottom, 20px) + 20px);
        gap: 16px;
    }

    .studio-header {
        padding: 12px 14px;
        flex-direction: column;
        align-items: stretch;
    }

    .header-right {
        justify-content: space-between;
        width: 100%;
        margin-top: 10px;
    }

    .brand-title-row h1 {
        font-size: 18px;
    }

    .tagline {
        font-size: 11px;
    }

    .controls-panel {
        padding: 16px;
    }

    .prompt-chips-bar {
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 8px;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none; /* Firefox */
    }
    
    .prompt-chips-bar::-webkit-scrollbar {
        display: none; /* Chrome/Safari */
    }

    .prompt-chips {
        flex-wrap: nowrap;
    }

    .aspect-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .style-filter-row {
        flex-direction: column;
    }
    
    .seed-input-wrap {
        width: 100%;
    }

    .seed-input-wrap input {
        flex: 1;
        min-width: 0;
    }

    .enhancers-grid {
        grid-template-columns: 1fr;
    }

    .generate-btn {
        width: 100%;
        min-height: 54px;
    }

    .result-actions {
        flex-direction: column;
        width: 100%;
    }
    
    .action-btn {
        width: 100%;
    }

    .history-tray .history-list {
        grid-template-columns: repeat(3, 1fr);
    }

    /* Modals to Bottom Sheets */
    .roster-modal, .admin-modal {
        align-items: flex-end;
    }

    .modal-content {
        width: 100%;
        max-height: 90vh;
        border-radius: var(--radius-xl) var(--radius-xl) 0 0;
        padding: 20px 16px env(safe-area-inset-bottom, 20px);
    }
}

/* Breakpoint 480px */
@media (max-width: 480px) {
    .aspect-grid {
        grid-template-columns: 1fr 1fr;
    }

    .history-tray .history-list {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .group-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .popout-trigger-btn {
        width: 100%;
    }
    .prompt-assist-btn {
        width: auto;
    }
    
    .feedback-rating-row {
        flex-direction: column;
    }
    
    .feedback-btn {
        width: 100%;
        min-height: 44px;
    }
    
    .active-char-card {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .change-char-btn {
        width: 100%;
        margin-top: 10px;
    }
}

/* Breakpoint 360px */
@media (max-width: 360px) {
    .aspect-grid {
        grid-template-columns: 1fr;
    }
    
    .history-tray .history-list {
        grid-template-columns: 1fr;
    }
}


/* ===== FontAwesome Icon Polish ===================================== */
.fa-solid, .fa-regular, .fa-brands {
    display: inline-block;
    font-style: normal;
    line-height: 1;
}
.drops-badge .fa-droplet,
.cost-val .fa-droplet,
.summary-base .fa-droplet,
.summary-addons .fa-droplet {
    color: #38bdf8;
    font-size: 0.9em;
}
.admin-trigger-btn .fa-crown {
    color: #f59e0b;
    margin-right: 4px;
}
.roster-check .fa-check {
    color: #4ade80;
    font-weight: 900;
}
.discord-login-btn .fa-brands {
    font-size: 1.1em;
}
.logo-symbol .fa-dna {
    font-size: 1.4em;
    color: #a78bfa;
}
.btn-icon i, .action-btn i {
    pointer-events: none;
}

/* ===== Prompt Mode & Helper Buttons ===== */
.prompt-mode-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

.prompt-mode-toggle {
    display: inline-flex;
    background: rgba(15, 23, 42, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 9999px;
    padding: 3px;
    gap: 4px;
}

.mode-pill {
    background: transparent;
    border: none;
    color: #94a3b8;
    padding: 5px 12px;
    border-radius: 9999px;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    /* FIX HERMES-1 2026-10-14: hit-area pionowa 22-24px -> 44px (HIG mobile).
       Szerokosc nietknieta, wyglad pilulki bez zmian (centrowanie flexa). */
    min-height: 44px;
    box-sizing: border-box;
    transition: all 0.2s ease;
}

.mode-pill:hover {
    color: #f1f5f9;
}

.mode-pill.active {
    background: #0369a1;
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(2, 132, 199, 0.35);
}

.prompt-helper-btns {
    display: flex;
    align-items: center;
    gap: 6px;
}

.helper-pill-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #cbd5e1;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: all 0.15s ease;
}

.helper-pill-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.25);
    color: #ffffff;
    transform: translateY(-1px);
}

.active-char-btn-group {
    display: flex;
    gap: 6px;
}

.change-char-btn.secondary {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.15);
    color: #cbd5e1;
}

.change-char-btn.secondary:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
}

/* ===== Bio-Inspired PRM Guidance Banner ===== */
.critic-control-banner {
    background: linear-gradient(135deg, rgba(24, 24, 43, 0.95), rgba(15, 23, 42, 0.95));
    border: 1px solid rgba(139, 92, 246, 0.35);
    border-radius: 12px;
    padding: 14px 16px;
    margin-top: 14px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
    flex-shrink: 0 !important;
}

.critic-control-banner::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, #6366f1, #a855f7, #ec4899);
}

.critic-banner-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.critic-header-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.critic-icon-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: linear-gradient(135deg, #6366f1, #a855f7);
    color: #ffffff;
    font-size: 0.95rem;
    box-shadow: 0 2px 8px rgba(168, 85, 247, 0.35);
}

.critic-title-text {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 700;
    color: #f8fafc;
    letter-spacing: -0.01em;
}

.critic-subtitle {
    display: block;
    font-size: 0.72rem;
    color: #a78bfa;
    font-weight: 500;
}

.critic-description {
    font-size: 0.77rem;
    line-height: 1.45;
    color: #94a3b8;
    margin: 0 0 10px 0;
}

.critic-description .code-math {
    font-family: 'JetBrains Mono', monospace;
    color: #38bdf8;
    background: rgba(56, 189, 248, 0.1);
    padding: 1px 4px;
    border-radius: 4px;
}

.critic-heads-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.critic-head-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 6px;
    /* FIX HERMES-1 2026-10-14: hit-area chatu = caly label (>=44px w pionie),
       sam input[type=checkbox] 13px nie jest celem dotyku (HIG mobile 44px). */
    min-height: 44px;
    padding: 5px 12px;
    font-size: 0.75rem;
    color: #cbd5e1;
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
    box-sizing: border-box;
}

.critic-head-chip input[type="checkbox"] {
    accent-color: #8b5cf6;
    width: 13px;
    height: 13px;
    margin: 0;
}

.critic-head-chip:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.critic-head-chip.active {
    border-color: rgba(139, 92, 246, 0.45);
    background: rgba(139, 92, 246, 0.15);
    color: #f1f5f9;
}

/* ===== Watermark Positioning Controls ===== */
.watermark-control-group {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.watermark-pills-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.watermark-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    min-height: 40px;
    padding: 6px 12px;
    font-size: 0.8rem;
    font-weight: 500;
    color: #cbd5e1;
    cursor: pointer;
    transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
    user-select: none;
    box-sizing: border-box;
    font-family: inherit;
}

.watermark-pill:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.25);
    transform: translateY(-1px);
}

.watermark-pill.active {
    border-color: rgba(14, 165, 233, 0.65);
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.22), rgba(99, 102, 241, 0.16));
    color: #38bdf8;
    box-shadow: 0 0 12px rgba(14, 165, 233, 0.25);
    font-weight: 600;
}

.watermark-cost-tag {
    font-size: 0.72rem;
    padding: 1px 6px;
    border-radius: 4px;
    background: rgba(245, 158, 11, 0.2);
    border: 1px solid rgba(245, 158, 11, 0.45);
    color: #fbbf24;
    font-weight: 700;
    margin-left: 4px;
}

/* Post-Generation Viewport Watermark Controller */
.viewport-watermark-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
    padding: 8px 12px;
    background: rgba(15, 23, 42, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    backdrop-filter: blur(8px);
}

.v-wm-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.76rem;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.v-wm-pills {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}

.v-wm-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    min-height: 32px;
    font-size: 0.76rem;
    font-weight: 500;
    color: #cbd5e1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.16s ease;
    user-select: none;
    font-family: inherit;
}

.v-wm-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.25);
}

.v-wm-btn.active {
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.25), rgba(99, 102, 241, 0.2));
    border-color: rgba(14, 165, 233, 0.65);
    color: #38bdf8;
    font-weight: 600;
    box-shadow: 0 0 8px rgba(14, 165, 233, 0.25);
}

.v-wm-btn-clean {
    border-color: rgba(245, 158, 11, 0.35);
    color: #fcd34d;
    background: rgba(245, 158, 11, 0.08);
}

.v-wm-btn-clean:hover {
    background: rgba(245, 158, 11, 0.18);
    border-color: rgba(245, 158, 11, 0.55);
    color: #fbbf24;
}

.v-wm-btn-clean.is-unlocked {
    border-color: rgba(34, 197, 94, 0.5);
    background: rgba(34, 197, 94, 0.12);
    color: #4ade80;
}

.v-wm-spinner {
    color: #38bdf8;
    font-size: 0.85rem;
    margin-left: 4px;
}

/* ===== Result PRM Telemetry HUD ===== */
.result-meta-bar .meta-tag.critic {
    background: rgba(168, 85, 247, 0.2);
    border-color: rgba(168, 85, 247, 0.4);
    color: #c084fc;
}

.prm-telemetry-hud {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-top: 10px;
    background: rgba(15, 23, 42, 0.75);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 8px 12px;
}

.prm-stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.prm-stat-label {
    font-size: 0.68rem;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    display: flex;
    align-items: center;
    gap: 4px;
}

.prm-stat-val {
    font-size: 0.85rem;
    font-weight: 700;
    color: #4ade80;
    font-family: 'JetBrains Mono', monospace;
}

.prm-stat-val.highlight {
    color: #38bdf8;
}

@media (max-width: 600px) {
    .prm-telemetry-hud {
        grid-template-columns: repeat(2, 1fr);
        gap: 6px;
    }
}

/* ===== Smart Framing Advisor (Proactive Full-Body Guidance) ===== */
.smart-framing-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 10px;
    padding: 10px 14px;
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.12) 0%, rgba(139, 92, 246, 0.08) 100%);
    border: 1px solid rgba(6, 182, 212, 0.35);
    border-radius: var(--radius-md);
    box-shadow: 0 4px 20px rgba(6, 182, 212, 0.1);
    animation: fadeInSlide 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.smart-framing-banner.hidden {
    display: none !important;
}

@keyframes fadeInSlide {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

.framing-banner-content {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.framing-sparkle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: rgba(6, 182, 212, 0.2);
    color: #22d3ee;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.framing-text-group {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.framing-title {
    font-size: 0.82rem;
    font-weight: 700;
    color: #f1f5f9;
    letter-spacing: 0.02em;
}

.framing-desc {
    font-size: 0.76rem;
    color: #94a3b8;
    line-height: 1.3;
}

.framing-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.framing-btn-apply {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: #0891b2;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-sm);
    color: #ffffff;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.framing-btn-apply:hover {
    background: #06b6d4;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(6, 182, 212, 0.4);
}

.framing-btn-dismiss {
    background: transparent;
    border: none;
    color: #64748b;
    padding: 6px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.15s ease;
}

.framing-btn-dismiss:hover {
    color: #cbd5e1;
    background: rgba(255, 255, 255, 0.08);
}

@media (max-width: 600px) {
    .smart-framing-banner {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    .framing-actions {
        width: 100%;
        justify-content: space-between;
    }
    .framing-btn-apply {
        flex: 1;
        justify-content: center;
    }
}

/* ===== Compact PRM Title Row & Status Pill ===== */
.critic-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.critic-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 2px 7px;
    border-radius: 9999px;
    background: rgba(74, 222, 128, 0.15);
    border: 1px solid rgba(74, 222, 128, 0.35);
    color: #4ade80;
}

.critic-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #4ade80;
    box-shadow: 0 0 8px #4ade80;
    animation: criticPulse 2s infinite ease-in-out;
}

@keyframes criticPulse {
    0%, 100% { opacity: 0.6; transform: scale(0.9); }
    50% { opacity: 1; transform: scale(1.2); }
}

/* ===== Admin Feedback Status Badges & Quarantine Display ===== */
.afb-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 9999px;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.afb-status-badge.rejected {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #f87171;
}

.afb-status-badge.approved {
    background: rgba(74, 222, 128, 0.15);
    border: 1px solid rgba(74, 222, 128, 0.4);
    color: #4ade80;
}

.afb-status-badge.review {
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid rgba(245, 158, 11, 0.4);
    color: #fbbf24;
}

.afb-reason {
    margin-top: 6px;
    padding: 6px 10px;
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 6px;
    font-size: 0.76rem;
    color: #94a3b8;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.afb-reason-text {
    line-height: 1.35;
}

/* ===== Training Complete Status Badge ===== */
.training-status-badge.completed {
    background: rgba(74, 222, 128, 0.15);
    border-color: rgba(74, 222, 128, 0.4);
    color: #4ade80;
}

.training-status-badge.completed .pulse-dot {
    background: #4ade80;
    box-shadow: 0 0 10px #4ade80;
    animation: none;
}

/* ===== Streamlined Studio Layout (Decluttered, Modern, Professional) ===== */
.studio-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.studio-section:last-of-type {
    border-bottom: none;
    padding-bottom: 0;
}

.section-label-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.section-label {
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #94a3b8;
    display: flex;
    align-items: center;
    gap: 7px;
}

.section-label i {
    color: #38bdf8;
    font-size: 0.85em;
}

.char-action-pills {
    display: flex;
    align-items: center;
    gap: 6px;
}

.compact-pill-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 9999px;
    font-size: 0.74rem;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #cbd5e1;
    cursor: pointer;
    transition: all 0.2s ease;
}

.compact-pill-btn:hover {
    background: rgba(56, 189, 248, 0.15);
    border-color: rgba(56, 189, 248, 0.4);
    color: #38bdf8;
}

.compact-pill-btn.secondary:hover {
    background: rgba(168, 85, 247, 0.15);
    border-color: rgba(168, 85, 247, 0.4);
    color: #c084fc;
}

/* Active Character Compact Bar */
.active-char-compact {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: rgba(15, 23, 42, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
}

.active-char-compact:hover {
    background: rgba(24, 34, 61, 0.7);
    border-color: rgba(56, 189, 248, 0.35);
}

.active-char-compact .active-char-avatar-frame {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    overflow: hidden;
    position: relative;
    border: 1.5px solid rgba(56, 189, 248, 0.4);
    flex-shrink: 0;
}

.active-char-compact .active-char-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.active-char-compact .active-char-mini-icon {
    position: absolute;
    bottom: 2px;
    right: 2px;
    font-size: 0.65rem;
    background: rgba(0, 0, 0, 0.75);
    padding: 2px;
    border-radius: 4px;
}

.active-char-compact .active-char-details {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.active-char-compact .active-char-name-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.active-char-compact .active-char-name {
    font-size: 0.95rem;
    font-weight: 700;
    color: #f8fafc;
}

.active-char-species-pill {
    font-size: 0.72rem;
    color: #38bdf8;
    background: rgba(56, 189, 248, 0.12);
    padding: 1px 7px;
    border-radius: 9999px;
    border: 1px solid rgba(56, 189, 248, 0.25);
}

.active-char-traits-compact {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

.active-char-traits-compact .trait-pill {
    font-size: 0.68rem;
    padding: 1px 6px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #94a3b8;
    border-radius: 4px;
}

.char-roster-arrow {
    background: transparent;
    border: none;
    color: #64748b;
    font-size: 0.85rem;
    cursor: pointer;
    padding: 4px;
    transition: color 0.15s ease;
}

.active-char-compact:hover .char-roster-arrow {
    color: #38bdf8;
}

/* Prompt Quick Actions & Chips */
.prompt-quick-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.prompt-chips-compact {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    width: 100%;
    max-width: 100%;
    padding: 4px 0 2px;
    box-sizing: border-box;
    overflow-x: visible;
}

.prompt-chips-compact::-webkit-scrollbar {
    display: none;
}

.prompt-chips-compact .chips-divider {
    width: 1px;
    height: 18px;
    background: rgba(255, 255, 255, 0.15);
    margin: 0 2px;
    display: inline-block;
    flex-shrink: 0;
}

.prompt-chips-compact .chip-btn {
    font-size: 0.74rem;
    padding: 3px 9px;
    min-height: 28px !important;
    max-height: 32px !important;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #cbd5e1;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.15s ease;
    flex-shrink: 0;
    box-sizing: border-box;
}

.prompt-chips-compact .chip-btn:hover {
    background: rgba(56, 189, 248, 0.15);
    border-color: rgba(56, 189, 248, 0.35);
    color: #ffffff;
}

.prompt-chips-compact .chip-btn.helper {
    background: rgba(14, 165, 233, 0.12) !important;
    border-color: rgba(14, 165, 233, 0.35) !important;
    color: #38bdf8 !important;
    font-weight: 600 !important;
}

.prompt-chips-compact .chip-btn.helper:hover {
    background: rgba(14, 165, 233, 0.28) !important;
    border-color: #38bdf8 !important;
    color: #ffffff !important;
}

.prompt-chips-compact .chip-btn.duo-helper {
    background: rgba(168, 85, 247, 0.14) !important;
    border-color: rgba(168, 85, 247, 0.4) !important;
    color: #c084fc !important;
    font-weight: 600 !important;
}

.prompt-chips-compact .chip-btn.duo-helper:hover {
    background: rgba(168, 85, 247, 0.3) !important;
    border-color: #c084fc !important;
    color: #ffffff !important;
}

.prompt-mood-chips .chip-btn:hover {
    background: rgba(245, 158, 11, 0.18) !important;
    border-color: rgba(245, 158, 11, 0.45) !important;
    color: #fef3c7 !important;
}

/* Compact Aspect Ratio Grid */
.aspect-grid-compact {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.aspect-grid-compact .aspect-card {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: rgba(15, 23, 42, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
}

.aspect-grid-compact .aspect-card:hover {
    background: rgba(24, 34, 61, 0.7);
    border-color: rgba(56, 189, 248, 0.3);
}

.aspect-grid-compact .aspect-card.active {
    background: rgba(30, 64, 175, 0.85);
    border-color: rgba(56, 189, 248, 0.6);
    box-shadow: 0 0 16px rgba(56, 189, 248, 0.15);
}

/* FIX HERMES-1 2026-10-15 (kontrast AA): karta aktywna pod mobile overrides
   miala jasne amber tlo z bialym tekstem (ratio 1.2-1.9) -- kontrast AA
   wymaga >=4.5. Ciemniejszy granat + bialy tekst = 6.4. */
.aspect-grid-compact .aspect-card.active .aspect-title,
.aspect-grid-compact .aspect-card.active .aspect-res-sub,
.aspect-grid-compact .aspect-card.active .aspect-cost-pill {
    color: #ffffff !important;
}

.aspect-mini-shape {
    border: 1.5px solid rgba(255, 255, 255, 0.3);
    border-radius: 2px;
}

.aspect-card.active .aspect-mini-shape {
    border-color: #38bdf8;
    background: rgba(56, 189, 248, 0.25);
}

.aspect-mini-shape.sq { width: 14px; height: 14px; }
.aspect-mini-shape.port { width: 11px; height: 18px; }
.aspect-mini-shape.land { width: 18px; height: 11px; }
.aspect-mini-shape.sq-sm { width: 10px; height: 10px; border-style: dashed; }
.aspect-mini-shape.port-sm { width: 9px; height: 14px; border-style: dashed; }
.aspect-mini-shape.sq-md { width: 12px; height: 12px; }

.aspect-text-wrap {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.aspect-text-wrap .aspect-title {
    font-size: 0.78rem;
    font-weight: 700;
    color: #f1f5f9;
}

.aspect-text-wrap .aspect-res-sub {
    font-size: 0.66rem;
    color: #ffffff; /* kontrast WCAG AA >= 4.5 (audit_a11y: 3.2 -> 7.1 na bg #12273b) */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.aspect-cost-pill {
    font-size: 0.68rem;
    font-weight: 700;
    color: #ffffff;
}

/* Compact Enhancers 2x2 Grid */
.enhancers-grid-compact {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.enhancers-grid-compact .enhancer-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: rgba(15, 23, 42, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
}

.enhancers-grid-compact .enhancer-card:hover {
    background: rgba(24, 34, 61, 0.7);
    border-color: rgba(255, 255, 255, 0.15);
}

.enhancers-grid-compact .enhancer-card.active {
    background: rgba(56, 189, 248, 0.08);
    border-color: rgba(56, 189, 248, 0.45);
}

.enhancer-content {
    display: flex;
    align-items: center;
    gap: 8px;
}

.enhancer-content .enhancer-icon {
    font-size: 0.85rem;
    color: #38bdf8;
}

.enhancer-meta {
    display: flex;
    flex-direction: column;
}

.enhancer-meta .enhancer-name {
    font-size: 0.78rem;
    font-weight: 700;
    color: #f1f5f9;
}

.enhancer-meta .enhancer-sub {
    font-size: 0.66rem;
    color: #94a3b8;
}

/* Collapsible Advanced Settings (Negative Prompt) */
.advanced-settings-accordion {
    margin-top: 8px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-sm);
    background: rgba(15, 23, 42, 0.35);
    overflow: hidden;
}

.advanced-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 7px 12px;
    font-size: 0.76rem;
    font-weight: 600;
    color: #94a3b8;
    cursor: pointer;
    list-style: none;
    user-select: none;
    transition: color 0.15s ease;
}

.advanced-summary::-webkit-details-marker {
    display: none;
}

.advanced-summary:hover {
    color: #cbd5e1;
}

.advanced-summary .chevron-icon {
    font-size: 0.7rem;
    transition: transform 0.2s ease;
}

.advanced-settings-accordion[open] .chevron-icon {
    transform: rotate(180deg);
}

.advanced-settings-accordion .negative-box {
    padding: 8px 12px 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.advanced-settings-accordion .negative-box textarea {
    width: 100%;
    font-size: 0.78rem;
    font-family: inherit;
    color: #cbd5e1;
    background: rgba(10, 15, 26, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 6px;
    padding: 8px 10px;
    resize: vertical;
    min-height: 48px;
    box-sizing: border-box;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.advanced-settings-accordion .negative-box textarea:focus {
    outline: none;
    border-color: rgba(248, 113, 113, 0.5);
    box-shadow: 0 0 0 2px rgba(248, 113, 113, 0.15);
}

/* Prompt Input Container & Textarea (Full Width & Polish) */
.prompt-input-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    position: relative;
}

#prompt-input {
    width: 100% !important;
    min-width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    min-height: 96px;
    background: rgba(10, 15, 28, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    color: #f1f5f9;
    padding: 12px 14px;
    font-family: inherit;
    font-size: 0.92rem;
    line-height: 1.55;
    resize: vertical !important;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

#prompt-input:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
    background: rgba(10, 15, 28, 0.98);
}

#prompt-input::placeholder {
    color: #64748b;
    font-size: 0.88rem;
}

/* ==================================================================== */
/* ===== v6.0.0 DUAL EXPERIENCE: DESKTOP PRO STUDIO & MOBILE APP ===== */
/* ==================================================================== */

/* --- Visual Reference Studio (Multimodal Conditioning) --- */
.ref-count-badge {
    font-size: 0.72rem;
    font-weight: 700;
    color: #38bdf8;
    background: rgba(56, 189, 248, 0.12);
    border: 1px solid rgba(56, 189, 248, 0.3);
    padding: 2px 8px;
    border-radius: 9999px;
}

.ref-dropzone {
    border: 1.5px dashed rgba(56, 189, 248, 0.35);
    background: rgba(15, 23, 42, 0.45);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    text-align: center;
    cursor: pointer;
    transition: all 0.25s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ref-dropzone:hover, .ref-dropzone.dragover {
    border-color: #38bdf8;
    background: rgba(56, 189, 248, 0.1);
    box-shadow: 0 0 16px rgba(56, 189, 248, 0.2);
}

.ref-dropzone-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ref-dropzone-icon {
    font-size: 1.5rem;
    color: #38bdf8;
    flex-shrink: 0;
}

.ref-dropzone-text {
    display: flex;
    flex-direction: column;
    text-align: left;
}

.ref-dropzone-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: #f1f5f9;
}

.ref-dropzone-sub {
    font-size: 0.72rem;
    color: #94a3b8;
}

.ref-previews-container {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding: 6px 2px;
}

.ref-card {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1.5px solid rgba(56, 189, 248, 0.4);
    background: #000;
    flex-shrink: 0;
}

.ref-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ref-card-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    /* HERMES-1 audyt tap-target: 20px -> 32px (WCAG 2.5.5).
       Hit-area 44x44 via ::after ponizej (nie rysuje ramki). */
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(239, 68, 68, 0.85);
    color: #fff;
    border: none;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.15s ease;
}

.ref-card-remove::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 44px;
    height: 44px;
    transform: translate(-50%, -50%);
}

.ref-card-remove:hover {
    background: #ef4444;
    transform: scale(1.15);
}

.ref-identity-container {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 10px 12px;
    background: rgba(15, 23, 42, 0.65);
    border: 1px solid rgba(56, 189, 248, 0.25);
    border-radius: var(--radius-sm);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}

.ref-identity-card {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.ref-identity-icon {
    color: #38bdf8;
    font-size: 1.15rem;
    padding-top: 1px;
}

.ref-identity-body {
    flex: 1;
}

.ref-identity-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.78rem;
    font-weight: 700;
    color: #e2e8f0;
    margin-bottom: 3px;
}

.ref-identity-tag {
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    background: rgba(56, 189, 248, 0.15);
    color: #38bdf8;
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid rgba(56, 189, 248, 0.3);
}

.ref-identity-desc {
    font-size: 0.72rem;
    color: #94a3b8;
    line-height: 1.4;
}

.ref-slider-container {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 10px 12px;
    background: rgba(15, 23, 42, 0.45);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-sm);
}

.ref-slider-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.76rem;
}

.ref-slider-label {
    font-weight: 700;
    color: #cbd5e1;
    display: flex;
    align-items: center;
    gap: 6px;
}

.ref-slider-label i {
    color: #38bdf8;
}

.ref-strength-val {
    font-weight: 700;
    color: #38bdf8;
}

.ref-slider-range {
    -webkit-appearance: none !important;
    appearance: none !important;
    width: 100% !important;
    height: 44px !important;          /* FIX HERMES-1 2026-10-14: hit-area 8px -> 44px (HIG mobile).
                                         Wizualnie track NIE rosnie -- runnable-track ma 8px i centruje
                                         sie pionowo w inpucie, wiec wyglad bez zmian. */
    min-height: 44px !important;
    max-height: 44px !important;
    border-radius: 4px !important;
    background: transparent !important;
    outline: none !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    cursor: pointer !important;
    box-sizing: border-box !important;
}

.ref-slider-range::-webkit-slider-runnable-track {
    width: 100% !important;
    height: 8px !important;
    min-height: 8px !important;
    border-radius: 4px !important;
    background: linear-gradient(90deg, #0284c7 0%, #38bdf8 100%) !important;
    border: none !important;
}

.ref-slider-range::-webkit-slider-thumb {
    -webkit-appearance: none !important;
    appearance: none !important;
    width: 22px !important;
    height: 22px !important;
    min-height: 22px !important;
    border-radius: 50% !important;
    background: #ffffff !important;
    border: 3.5px solid #0284c7 !important;
    box-shadow: 0 0 12px rgba(56, 189, 248, 0.9) !important;
    cursor: pointer !important;
    margin-top: -7px !important;
    transition: transform 0.15s ease, box-shadow 0.15s ease !important;
}

.ref-slider-range::-webkit-slider-thumb:hover {
    transform: scale(1.2) !important;
    box-shadow: 0 0 18px rgba(56, 189, 248, 1) !important;
}

.ref-slider-range::-moz-range-track {
    width: 100% !important;
    height: 8px !important;
    border-radius: 4px !important;
    background: linear-gradient(90deg, #0284c7 0%, #38bdf8 100%) !important;
    border: none !important;
}

.ref-slider-range::-moz-range-thumb {
    width: 22px !important;
    height: 22px !important;
    border-radius: 50% !important;
    background: #ffffff !important;
    border: 3.5px solid #0284c7 !important;
    box-shadow: 0 0 12px rgba(56, 189, 248, 0.9) !important;
    cursor: pointer !important;
    transition: transform 0.15s ease, box-shadow 0.15s ease !important;
}

.ref-slider-marks {
    display: flex;
    justify-content: space-between;
    font-size: 0.65rem;
    color: #64748b;
}

.meta-tag.ref-tag {
    background: rgba(56, 189, 248, 0.18) !important;
    color: #38bdf8 !important;
    border: 1px solid rgba(56, 189, 248, 0.4) !important;
}

.ref-framing-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px 12px;
    background: rgba(15, 23, 42, 0.45);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-sm);
    margin-top: 8px;
}

.ref-framing-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.76rem;
}

.ref-framing-label {
    font-weight: 700;
    color: #cbd5e1;
    display: flex;
    align-items: center;
    gap: 6px;
}

.ref-framing-label i {
    color: #38bdf8;
}

.ref-framing-hint {
    font-size: 0.68rem;
    color: #94a3b8;
}

.ref-framing-selector {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.ref-framing-selector:has(#ref-duo-pill.hidden) .ref-framing-pill[data-fit="crop_center"] {
    grid-column: span 2;
}

.ref-framing-pill {
    flex: 1 1 auto;
    min-width: 90px;
    min-height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 6px 10px;
    font-size: 0.74rem;
    font-weight: 600;
    color: #94a3b8;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
}

.ref-framing-pill i {
    font-size: 0.75rem;
}

.ref-framing-pill:hover {
    color: #f1f5f9;
    border-color: rgba(56, 189, 248, 0.4);
    background: rgba(56, 189, 248, 0.1);
}

.ref-framing-pill.active {
    color: #38bdf8;
    background: rgba(56, 189, 248, 0.18);
    border-color: #38bdf8;
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.3);
}

@media (max-width: 480px) {
    .ref-framing-selector {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }
    .ref-framing-pill {
        min-height: 38px;
    }
}

.ref-aspect-notice {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(14, 165, 233, 0.12);
    border: 1px solid rgba(14, 165, 233, 0.35);
    border-radius: var(--radius-sm);
    margin-top: 8px;
    animation: fadeIn 0.2s ease;
}

.ref-aspect-notice-icon i {
    color: #38bdf8;
    font-size: 0.85rem;
}

.ref-aspect-notice-text {
    flex: 1;
    font-size: 0.72rem;
    color: #e2e8f0;
    line-height: 1.25;
}

.ref-aspect-action-btn {
    background: #0284c7;
    color: #ffffff;
    border: none;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 0.72rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: background 0.15s ease, transform 0.1s ease;
    white-space: nowrap;
}

.ref-aspect-action-btn:hover {
    background: #38bdf8;
    color: #0f172a;
    transform: scale(1.04);
}

/* --- Desktop Pro Studio Layout (>= 901px) --- */
@media (min-width: 901px) {
    /* Responsive Fluid Desktop Container - 100% Viewport Height Safe */
    body.view-studio {
        overflow: hidden !important;
        height: 100vh !important;
        max-height: 100vh !important;
    }

    body.view-studio .app-container {
        max-width: 1920px;
        width: 100%;
        height: 100vh !important;
        max-height: 100vh !important;
        margin: 0 auto;
        padding: 6px 18px 8px !important;
        display: flex !important;
        flex-direction: column !important;
        gap: 8px !important;
        box-sizing: border-box !important;
        overflow: hidden !important;
    }

    body.view-studio .studio-header {
        min-height: 44px !important;
        padding: 6px 16px !important;
        flex-shrink: 0 !important;
    }

    /* 2-Column Responsive Studio Workspace - Fits exactly 100% remaining viewport */
    body.view-studio .studio-workspace {
        display: grid !important;
        grid-template-columns: 390px minmax(0, 1fr) !important;
        gap: 16px !important;
        align-items: stretch !important;
        width: 100% !important;
        flex: 1 1 auto !important;
        height: 100% !important;
        max-height: 100% !important;
        min-height: 0 !important;
        box-sizing: border-box !important;
        overflow: hidden !important;
    }

    @media (min-width: 1600px) {
        body.view-studio .studio-workspace {
            grid-template-columns: 410px minmax(0, 1fr) !important;
            gap: 20px !important;
        }
    }

    /* Left Column: Generator Controls Panel */
    body.view-studio .controls-panel {
        display: flex !important;
        flex-direction: column !important;
        background: var(--card-bg) !important;
        border: 1px solid var(--border-color) !important;
        border-radius: var(--radius-lg) !important;
        box-shadow: 0 16px 40px -10px rgba(0, 0, 0, 0.5) !important;
        backdrop-filter: blur(24px) !important;
        height: 100% !important;
        max-height: 100% !important;
        overflow: hidden !important;
        box-sizing: border-box !important;
    }

    body.view-studio .controls-scroll-area {
        flex: 1 1 auto !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        padding: 12px 14px 8px 14px !important;
        display: flex !important;
        flex-direction: column !important;
        gap: 8px !important;
        min-height: 0 !important;
    }

    body.view-studio .prompt-input-container textarea {
        min-height: 72px !important;
        resize: vertical !important;
        padding: 8px 10px !important;
        font-size: 13px !important;
    }

    body.view-studio .ref-dropzone {
        padding: 8px 12px !important;
        min-height: 54px !important;
    }

    body.view-studio .aspect-grid-primary .aspect-card {
        padding: 6px 4px !important;
    }

    body.view-studio .aspect-name {
        font-size: 11px !important;
    }

    body.view-studio .aspect-res {
        font-size: 9.5px !important;
    }

    body.view-studio .enhancer-toggle-card {
        padding: 6px 10px !important;
        min-height: 38px !important;
    }

    body.view-studio .controls-action-dock {
        flex-shrink: 0 !important;
        padding: 8px 14px 10px 14px !important;
        background: rgba(11, 15, 25, 0.98) !important;
        backdrop-filter: blur(20px) !important;
        border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
        box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.5) !important;
        display: flex !important;
        flex-direction: column !important;
        gap: 6px !important;
        z-index: 10 !important;
    }

    body.view-studio .cost-summary-bar {
        font-size: 11px !important;
        padding: 0 !important;
    }

    body.view-studio .generate-btn {
        min-height: 44px !important;
        height: auto !important;
        padding: 10px 14px !important;
        font-size: 13.5px !important;
    }

    /* Right Column: Viewport & Canvas */
    body.view-studio .viewport-panel {
        display: flex !important;
        flex-direction: column !important;
        gap: 10px !important;
        min-width: 0 !important;
        width: 100% !important;
        height: 100% !important;
        max-height: 100% !important;
        overflow: hidden !important;
        box-sizing: border-box !important;
    }

    body.view-studio .viewport-canvas-wrapper {
        display: flex !important;
        flex-direction: column !important;
        gap: 10px !important;
        width: 100% !important;
        flex: 1 1 auto !important;
        min-height: 0 !important;
        overflow: hidden !important;
    }

    body.view-studio .viewport-canvas {
        background: rgba(13, 18, 31, 0.7) !important;
        border: 1px solid var(--border-color) !important;
        border-radius: var(--radius-lg) !important;
        padding: 10px 16px !important;
        box-shadow: 0 16px 40px -10px rgba(0, 0, 0, 0.5) !important;
        backdrop-filter: blur(24px) !important;
        display: flex !important;
        flex-direction: column !important;
        gap: 8px !important;
        box-sizing: border-box !important;
        flex: 1 1 auto !important;
        min-height: 0 !important;
        overflow: hidden !important;
    }

    body.view-studio .viewport-monitor-header {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        padding: 2px 4px 6px 4px !important;
        border-bottom: 1px solid rgba(56, 189, 248, 0.2) !important;
        margin-bottom: 8px !important;
        font-family: 'JetBrains Mono', monospace !important;
        font-size: 10.5px !important;
        color: #94a3b8 !important;
        flex-shrink: 0 !important;
        position: relative !important;
        top: auto !important;
        left: auto !important;
        right: auto !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    body.view-studio .result-box:not(.hidden) {
        display: flex !important;
        flex-direction: column !important;
        width: 100% !important;
        height: 100% !important;
        min-height: 0 !important;
        flex: 1 1 auto !important;
        overflow: hidden !important;
    }

    body.view-studio .result-box.hidden {
        display: none !important;
    }

    body.view-studio .placeholder-box:not(.hidden) {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 12px !important;
        padding: 30px 20px !important;
        text-align: center !important;
        flex: 1 1 auto !important;
        margin: auto !important;
    }

    body.view-studio .placeholder-box.hidden {
        display: none !important;
    }
}

/* ==========================================================================
   CYBERDECK CANVAS STAGE - Base Component Styles (Universal Desktop & Mobile)
   ========================================================================== */
.result-stage-layout {
    display: flex !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

/* Visual Column: Image Presentation & Primary Toolbar */
.stage-visual-col {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    position: relative !important;
    box-sizing: border-box !important;
    width: 100% !important;
}

body.view-studio .result-image-frame {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    position: relative !important;
    padding: 0 !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
}

body.view-studio #result-image {
    width: auto !important;
    height: auto !important;
    object-fit: contain !important;
    border-radius: 8px !important;
    border: 1px solid rgba(56, 189, 248, 0.4) !important;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.85), 0 0 24px rgba(56, 189, 248, 0.15) !important;
    cursor: zoom-in !important;
    transition: border-color 0.25s ease, box-shadow 0.25s ease !important;
}

body.view-studio #result-image:hover {
    border-color: rgba(56, 189, 248, 0.8) !important;
    box-shadow: 0 16px 44px rgba(0, 0, 0, 0.95), 0 0 32px rgba(56, 189, 248, 0.35) !important;
}

/* Primary Actions directly below image */
.stage-visual-col .actions-primary-row {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    width: 100% !important;
    flex-shrink: 0 !important;
    box-sizing: border-box !important;
}

.stage-visual-col .actions-secondary-row {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 12px !important;
    margin-top: 6px !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

.stage-visual-col .actions-secondary-row .action-btn-checkbox-label {
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    padding: 4px 10px !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    color: #94a3b8 !important;
    background: rgba(15, 23, 42, 0.7) !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    border-radius: 6px !important;
    cursor: pointer !important;
}

.stage-visual-col .action-btn.delete-btn {
    color: #f87171 !important;
    border-color: rgba(239, 68, 68, 0.3) !important;
}

.stage-visual-col .action-btn.delete-btn:hover {
    background: rgba(239, 68, 68, 0.2) !important;
    border-color: #ef4444 !important;
    color: #fca5a5 !important;
}

.stage-visual-col .action-btn {
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    font-family: 'Plus Jakarta Sans', sans-serif !important;
    font-weight: 600 !important;
    color: #e2e8f0 !important;
    background: rgba(15, 23, 42, 0.8) !important;
    border: 1px solid rgba(56, 189, 248, 0.25) !important;
    border-radius: 6px !important;
    cursor: pointer !important;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
    text-decoration: none !important;
    user-select: none !important;
    box-sizing: border-box !important;
}

.stage-visual-col .action-btn:hover {
    background: rgba(56, 189, 248, 0.2) !important;
    border-color: #38bdf8 !important;
    color: #fff !important;
    box-shadow: 0 0 16px rgba(56, 189, 248, 0.35) !important;
    transform: translateY(-1px) !important;
}

/* Right Inspector Column: Cyberdeck Pro Architecture */
.stage-inspector-col {
    display: flex !important;
    flex-direction: column !important;
    justify-content: flex-start !important;
    box-sizing: border-box !important;
    width: 100% !important;
}

    /* Unified Cyberdeck Cards */
    .inspector-deck-card {
        background: linear-gradient(135deg, rgba(14, 20, 36, 0.8) 0%, rgba(8, 12, 22, 0.9) 100%) !important;
        border: 1px solid rgba(56, 189, 248, 0.2) !important;
        border-radius: 7px !important;
        padding: 6px 10px !important;
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.05) !important;
        width: 100% !important;
        box-sizing: border-box !important;
        flex-shrink: 0 !important;
        display: flex !important;
        flex-direction: column !important;
        gap: 5px !important;
    }

    .inspector-card-header {
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        width: 100% !important;
        padding-bottom: 1px !important;
    }

    .inspector-header-label {
        font-family: 'Plus Jakarta Sans', sans-serif !important;
        font-size: 11px !important;
        font-weight: 700 !important;
        color: #e2e8f0 !important;
        display: inline-flex !important;
        align-items: center !important;
        gap: 5px !important;
        letter-spacing: 0.3px !important;
    }

    .inspector-header-label i {
        color: #38bdf8 !important;
    }

    .prm-live-badge {
        font-family: 'JetBrains Mono', monospace !important;
        font-size: 9px !important;
        font-weight: 700 !important;
        color: #34d399 !important;
        background: rgba(16, 185, 129, 0.15) !important;
        border: 1px solid rgba(16, 185, 129, 0.4) !important;
        padding: 1px 5px !important;
        border-radius: 4px !important;
        display: inline-flex !important;
        align-items: center !important;
        gap: 3px !important;
        text-transform: uppercase !important;
    }

    .prm-live-dot {
        width: 4px !important;
        height: 4px !important;
        border-radius: 50% !important;
        background: #10b981 !important;
        box-shadow: 0 0 6px #10b981 !important;
    }

    /* Card 1: PRM Telemetry HUD (2x2 Grid) */
    .stage-inspector-col .prm-telemetry-hud {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 4px !important;
        width: 100% !important;
        box-sizing: border-box !important;
        background: transparent !important;
        border: none !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    .stage-inspector-col .prm-stat-item {
        background: rgba(255, 255, 255, 0.03) !important;
        border: 1px solid rgba(255, 255, 255, 0.07) !important;
        border-radius: 5px !important;
        padding: 3px 6px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        transition: all 0.2s ease !important;
    }

    .stage-inspector-col .prm-stat-item:hover {
        background: rgba(56, 189, 248, 0.06) !important;
        border-color: rgba(56, 189, 248, 0.3) !important;
    }

    .stage-inspector-col .prm-stat-label {
        font-family: 'JetBrains Mono', monospace !important;
        font-size: 10px !important;
        color: #94a3b8 !important;
        display: inline-flex !important;
        align-items: center !important;
        gap: 4px !important;
    }

    .stage-inspector-col .prm-stat-val {
        font-family: 'JetBrains Mono', monospace !important;
        font-size: 12px !important;
        font-weight: 700 !important;
        color: #38bdf8 !important;
        letter-spacing: 0.3px !important;
    }

    .stage-inspector-col .prm-stat-val.highlight {
        color: #c084fc !important;
        text-shadow: 0 0 8px rgba(192, 132, 252, 0.4) !important;
    }

    /* Card 2: Metadata & Management */
    .stage-inspector-col .result-meta-bar {
        display: flex !important;
        flex-wrap: wrap !important;
        align-items: center !important;
        gap: 4px !important;
        width: 100% !important;
        background: transparent !important;
        border: none !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    .stage-inspector-col .meta-tag {
        font-family: 'JetBrains Mono', monospace !important;
        font-size: 10px !important;
        font-weight: 600 !important;
        padding: 2px 6px !important;
        border-radius: 4px !important;
        border: 1px solid rgba(255, 255, 255, 0.1) !important;
        background: rgba(255, 255, 255, 0.04) !important;
        color: #cbd5e1 !important;
        display: inline-flex !important;
        align-items: center !important;
        gap: 4px !important;
    }

    .stage-inspector-col .meta-tag.char {
        background: rgba(168, 85, 247, 0.14) !important;
        border-color: rgba(168, 85, 247, 0.35) !important;
        color: #c084fc !important;
    }

    .stage-inspector-col .meta-tag.aspect {
        background: rgba(56, 189, 248, 0.12) !important;
        border-color: rgba(56, 189, 248, 0.3) !important;
        color: #7dd3fc !important;
    }

    .stage-inspector-col .meta-tag.critic {
        background: rgba(14, 165, 233, 0.14) !important;
        border-color: rgba(14, 165, 233, 0.35) !important;
        color: #38bdf8 !important;
    }

    .stage-inspector-col .meta-tag.cost {
        background: rgba(56, 189, 248, 0.12) !important;
        border: 1px solid rgba(56, 189, 248, 0.3) !important;
        color: #7dd3fc !important;
        font-family: 'Plus Jakarta Sans', sans-serif !important;
        font-size: 10px !important;
        font-weight: 600 !important;
        padding: 2px 7px !important;
        border-radius: 4px !important;
        margin-left: 0 !important;
        box-shadow: none !important;
        display: inline-flex !important;
        align-items: center !important;
        gap: 4px !important;
    }

    .stage-inspector-col .meta-tag.cost i {
        color: #38bdf8 !important;
    }

    .stage-inspector-col .actions-secondary-row {
        display: flex !important;
        flex-wrap: nowrap !important;
        align-items: center !important;
        gap: 6px !important;
        width: 100% !important;
        padding-top: 5px !important;
        border-top: 1px solid rgba(255, 255, 255, 0.06) !important;
        box-sizing: border-box !important;
    }

    .stage-inspector-col .action-btn-checkbox-label {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 6px !important;
        height: 28px !important;
        min-height: 28px !important;
        max-height: 28px !important;
        padding: 0 10px !important;
        font-size: 11px !important;
        font-weight: 600 !important;
        font-family: 'Plus Jakarta Sans', sans-serif !important;
        color: #cbd5e1 !important;
        background: rgba(15, 23, 42, 0.75) !important;
        border: 1px solid rgba(255, 255, 255, 0.12) !important;
        border-radius: 6px !important;
        cursor: pointer !important;
        user-select: none !important;
        white-space: nowrap !important;
        flex-shrink: 0 !important;
        box-sizing: border-box !important;
        transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
    }

    .stage-inspector-col .action-btn-checkbox-label:hover {
        background: rgba(30, 41, 59, 0.9) !important;
        border-color: rgba(56, 189, 248, 0.4) !important;
        color: #ffffff !important;
    }

    /* Custom Checkbox Design (No raw OS square) */
    .stage-inspector-col .action-btn-checkbox-label input[type="checkbox"] {
        appearance: none !important;
        -webkit-appearance: none !important;
        width: 13px !important;
        height: 13px !important;
        min-width: 13px !important;
        min-height: 13px !important;
        border-radius: 3px !important;
        border: 1.5px solid rgba(255, 255, 255, 0.3) !important;
        background: rgba(15, 23, 42, 0.9) !important;
        cursor: pointer !important;
        display: inline-grid !important;
        place-content: center !important;
        margin: 0 !important;
        padding: 0 !important;
        transition: all 0.15s ease !important;
        position: relative !important;
        box-sizing: border-box !important;
    }

    .stage-inspector-col .action-btn-checkbox-label input[type="checkbox"]::before {
        content: "" !important;
        width: 6px !important;
        height: 3px !important;
        border-left: 2px solid #ffffff !important;
        border-bottom: 2px solid #ffffff !important;
        transform: rotate(-45deg) translate(0.5px, -0.5px) scale(0) !important;
        transition: transform 0.15s cubic-bezier(0.4, 0, 0.2, 1) !important;
        transform-origin: center center !important;
    }

    .stage-inspector-col .action-btn-checkbox-label input[type="checkbox"]:checked {
        background: #0284c7 !important;
        border-color: #38bdf8 !important;
        box-shadow: 0 0 8px rgba(56, 189, 248, 0.45) !important;
    }

    .stage-inspector-col .action-btn-checkbox-label input[type="checkbox"]:checked::before {
        transform: rotate(-45deg) translate(0.5px, -0.5px) scale(1) !important;
    }

    .stage-inspector-col .action-btn-checkbox-label input[type="checkbox"]:checked + span {
        color: #38bdf8 !important;
        font-weight: 700 !important;
    }

    /* Dedicated 18+ NSFW styling */
    .stage-inspector-col .action-btn-checkbox-label#label-publish-nsfw {
        background: rgba(239, 68, 68, 0.08) !important;
        border: 1px solid rgba(239, 68, 68, 0.25) !important;
        color: #fca5a5 !important;
        transition: all 0.2s ease !important;
    }

    .stage-inspector-col .action-btn-checkbox-label#label-publish-nsfw:hover {
        background: rgba(239, 68, 68, 0.16) !important;
        border-color: rgba(239, 68, 68, 0.45) !important;
        color: #ffffff !important;
    }

    .stage-inspector-col .action-btn-checkbox-label#label-publish-nsfw input[type="checkbox"] {
        border-color: rgba(239, 68, 68, 0.4) !important;
    }

    .stage-inspector-col .action-btn-checkbox-label#label-publish-nsfw input[type="checkbox"]:checked {
        background: #dc2626 !important;
        border-color: #f87171 !important;
        box-shadow: 0 0 8px rgba(239, 68, 68, 0.55) !important;
    }

    .stage-inspector-col .action-btn-checkbox-label#label-publish-nsfw:has(input[type="checkbox"]:checked) {
        border-color: #ef4444 !important;
        background: rgba(239, 68, 68, 0.22) !important;
        box-shadow: 0 0 10px rgba(239, 68, 68, 0.25) !important;
    }

    .stage-inspector-col .action-btn-checkbox-label#label-publish-nsfw input[type="checkbox"]:checked + span {
        color: #fecaca !important;
        font-weight: 700 !important;
    }

    /* All Action Buttons in Secondary Row: Exact 28px height, flawless alignment */
    .stage-inspector-col .action-btn {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 5px !important;
        height: 28px !important;
        min-height: 28px !important;
        max-height: 28px !important;
        padding: 0 10px !important;
        font-size: 11px !important;
        font-weight: 600 !important;
        font-family: 'Plus Jakarta Sans', sans-serif !important;
        color: #cbd5e1 !important;
        background: rgba(15, 23, 42, 0.75) !important;
        border: 1px solid rgba(255, 255, 255, 0.12) !important;
        border-radius: 6px !important;
        cursor: pointer !important;
        white-space: nowrap !important;
        flex-shrink: 0 !important;
        box-sizing: border-box !important;
        transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
    }

    .stage-inspector-col .action-btn:hover {
        background: rgba(56, 189, 248, 0.15) !important;
        border-color: #38bdf8 !important;
        color: #ffffff !important;
        transform: translateY(-1px) !important;
    }

    .stage-inspector-col .action-btn:active {
        transform: translateY(0) !important;
    }

    /* Use Seed Button specific styling */
    .stage-inspector-col .action-btn.seed-action-btn:hover {
        background: rgba(16, 185, 129, 0.15) !important;
        border-color: #10b981 !important;
        color: #6ee7b7 !important;
    }

    /* Delete Button: Refined crimson styling, perfectly matching row rhythm */
    .stage-inspector-col .action-btn.delete-btn {
        margin-left: 0 !important;
        color: #fca5a5 !important;
        border-color: rgba(239, 68, 68, 0.28) !important;
        background: rgba(239, 68, 68, 0.08) !important;
    }

    .stage-inspector-col .action-btn.delete-btn:hover {
        background: rgba(239, 68, 68, 0.22) !important;
        border-color: #ef4444 !important;
        color: #ffffff !important;
        box-shadow: 0 0 10px rgba(239, 68, 68, 0.35) !important;
    }

    /* Card 3: Feedback & Drops Cash Back */
    .stage-inspector-col .feedback-panel {
        display: flex !important;
        flex-direction: column !important;
        gap: 4px !important;
        background: linear-gradient(135deg, rgba(16, 24, 40, 0.9) 0%, rgba(8, 12, 22, 0.96) 100%) !important;
        border: 1px solid rgba(56, 189, 248, 0.3) !important;
        border-radius: 7px !important;
        padding: 6px 10px !important;
        box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.08) !important;
        box-sizing: border-box !important;
        width: 100% !important;
        flex-shrink: 0 !important;
    }

    .stage-inspector-col .feedback-header {
        display: flex !important;
        flex-direction: column !important;
        gap: 1px !important;
    }

    .stage-inspector-col .feedback-title-row {
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        width: 100% !important;
    }

    .stage-inspector-col .feedback-title {
        font-family: 'Plus Jakarta Sans', sans-serif !important;
        font-size: 11px !important;
        font-weight: 700 !important;
        color: #f1f5f9 !important;
        display: inline-flex !important;
        align-items: center !important;
        gap: 5px !important;
    }

    .stage-inspector-col .feedback-title i {
        color: #38bdf8 !important;
    }

    .stage-inspector-col .feedback-reward-badge {
        font-family: 'JetBrains Mono', monospace !important;
        font-size: 9.5px !important;
        font-weight: 700 !important;
        padding: 1px 6px !important;
        border-radius: 9999px !important;
        background: linear-gradient(135deg, rgba(234, 179, 8, 0.2) 0%, rgba(245, 158, 11, 0.3) 100%) !important;
        border: 1px solid rgba(245, 158, 11, 0.5) !important;
        color: #fde047 !important;
        box-shadow: 0 0 10px rgba(245, 158, 11, 0.25) !important;
        display: inline-flex !important;
        align-items: center !important;
        gap: 4px !important;
        white-space: nowrap !important;
    }

    .stage-inspector-col .feedback-subtitle {
        display: none !important;
    }

    .stage-inspector-col .feedback-rating-row {
        display: grid !important;
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 6px !important;
        width: 100% !important;
        margin-top: 2px !important;
    }

    .stage-inspector-col .feedback-btn {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 2px !important;
        padding: 4px 3px !important;
        border-radius: 5px !important;
        cursor: pointer !important;
        transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
        background: rgba(255, 255, 255, 0.04) !important;
        border: 1px solid rgba(255, 255, 255, 0.1) !important;
        box-sizing: border-box !important;
    }

    .stage-inspector-col .feedback-btn .fb-icon {
        font-size: 13px !important;
    }

    .stage-inspector-col .feedback-btn .fb-label {
        font-size: 10px !important;
        font-weight: 700 !important;
        letter-spacing: 0.3px !important;
    }

    .stage-inspector-col .feedback-btn .fb-sub-hint {
        font-size: 8.5px !important;
        font-weight: 600 !important;
        opacity: 0.8 !important;
        font-family: 'JetBrains Mono', monospace !important;
    }

    .stage-inspector-col .feedback-btn.thumbs-up {
        color: #34d399 !important;
        border-color: rgba(16, 185, 129, 0.35) !important;
        background: rgba(16, 185, 129, 0.08) !important;
    }

    .stage-inspector-col .feedback-btn.thumbs-up:hover {
        background: rgba(16, 185, 129, 0.22) !important;
        border-color: #10b981 !important;
        box-shadow: 0 0 14px rgba(16, 185, 129, 0.35) !important;
        transform: translateY(-1px) !important;
    }

    .stage-inspector-col .feedback-btn.thumbs-down {
        color: #f87171 !important;
        border-color: rgba(239, 68, 68, 0.35) !important;
        background: rgba(239, 68, 68, 0.08) !important;
    }

    .stage-inspector-col .feedback-btn.thumbs-down:hover {
        background: rgba(239, 68, 68, 0.22) !important;
        border-color: #ef4444 !important;
        box-shadow: 0 0 14px rgba(239, 68, 68, 0.35) !important;
        transform: translateY(-1px) !important;
    }

    .stage-inspector-col .feedback-btn.starred {
        color: #facc15 !important;
        border-color: rgba(234, 179, 8, 0.4) !important;
        background: rgba(234, 179, 8, 0.1) !important;
    }

    .stage-inspector-col .feedback-btn.starred:hover {
        background: rgba(234, 179, 8, 0.25) !important;
        border-color: #facc15 !important;
        box-shadow: 0 0 16px rgba(234, 179, 8, 0.4) !important;
        transform: translateY(-1px) !important;
    }

    /* Card 4: Neural Engine Telemetry Deck */
    .engine-specs-deck-card {
        border-color: rgba(14, 165, 233, 0.2) !important;
    }

    .engine-live-tag {
        font-family: 'JetBrains Mono', monospace !important;
        font-size: 8.5px !important;
        color: #38bdf8 !important;
        background: rgba(56, 189, 248, 0.1) !important;
        border: 1px solid rgba(56, 189, 248, 0.25) !important;
        padding: 1px 4px !important;
        border-radius: 3px !important;
        display: inline-flex !important;
        align-items: center !important;
        gap: 3px !important;
    }

    .engine-specs-grid {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 4px !important;
        width: 100% !important;
    }

    .engine-spec-cell {
        background: rgba(255, 255, 255, 0.02) !important;
        border: 1px solid rgba(255, 255, 255, 0.05) !important;
        border-radius: 5px !important;
        padding: 3px 6px !important;
        display: flex !important;
        flex-direction: column !important;
        gap: 1px !important;
    }

    .engine-spec-cell .spec-k {
        font-family: 'JetBrains Mono', monospace !important;
        font-size: 8px !important;
        color: #64748b !important;
        letter-spacing: 0.5px !important;
        text-transform: uppercase !important;
    }

    .engine-spec-cell .spec-v {
        font-family: 'JetBrains Mono', monospace !important;
        font-size: 10px !important;
        font-weight: 600 !important;
        color: #cbd5e1 !important;
    }

    .engine-spec-cell .spec-v.active-neon {
        color: #38bdf8 !important;
        text-shadow: 0 0 6px rgba(56, 189, 248, 0.4) !important;
    }

    /* Studio Recent Creations Filmstrip - Anchored & Compact Single-Row Bar */
    .studio-recent-strip {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        gap: 12px !important;
        background: rgba(13, 18, 31, 0.75) !important;
        border: 1px solid var(--border-color) !important;
        border-radius: var(--radius-lg) !important;
        padding: 6px 14px !important;
        box-shadow: 0 8px 24px -4px rgba(0, 0, 0, 0.4) !important;
        backdrop-filter: blur(20px) !important;
        width: 100% !important;
        box-sizing: border-box !important;
        flex-shrink: 0 !important;
        min-height: 64px !important;
    }

    .recent-strip-header {
        display: contents !important;
    }

    .recent-strip-title {
        order: 1 !important;
        font-size: 12px !important;
        font-weight: 600 !important;
        color: #e2e8f0 !important;
        display: inline-flex !important;
        align-items: center !important;
        gap: 6px !important;
        flex-shrink: 0 !important;
        white-space: nowrap !important;
    }

    .recent-count-tag {
        font-size: 10px !important;
        padding: 1px 6px !important;
        background: rgba(56, 189, 248, 0.12) !important;
        border: 1px solid rgba(56, 189, 248, 0.3) !important;
        border-radius: 4px !important;
        color: #38bdf8 !important;
    }

    .recent-carousel-container {
        order: 2 !important;
        display: flex !important;
        align-items: center !important;
        gap: 6px !important;
        flex: 1 1 auto !important;
        min-width: 0 !important;
        overflow: hidden !important;
        position: relative !important;
    }

    .recent-filmstrip-scroll {
        display: flex !important;
        align-items: center !important;
        gap: 10px !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        flex: 1 1 auto !important;
        min-width: 0 !important;
        padding: 4px 6px !important;
        scrollbar-width: none !important;
        -ms-overflow-style: none !important;
        scroll-behavior: smooth !important;
        -webkit-mask-image: linear-gradient(to right, transparent, black 16px, black calc(100% - 16px), transparent) !important;
        mask-image: linear-gradient(to right, transparent, black 16px, black calc(100% - 16px), transparent) !important;
    }

    .recent-filmstrip-scroll::-webkit-scrollbar {
        display: none !important;
        width: 0 !important;
        height: 0 !important;
    }

    .filmstrip-arrow-btn {
        width: 24px !important;
        height: 24px !important;
        min-width: 24px !important;
        min-height: 24px !important;
        border-radius: 50% !important;
        background: rgba(15, 23, 42, 0.85) !important;
        border: 1px solid rgba(255, 255, 255, 0.16) !important;
        color: #94a3b8 !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        font-size: 11px !important;
        cursor: pointer !important;
        flex-shrink: 0 !important;
        transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
        padding: 0 !important;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4) !important;
    }

    .filmstrip-arrow-btn:hover {
        background: rgba(56, 189, 248, 0.25) !important;
        border-color: #38bdf8 !important;
        color: #ffffff !important;
        box-shadow: 0 0 12px rgba(56, 189, 248, 0.5) !important;
        transform: scale(1.1) !important;
    }

    .filmstrip-arrow-btn:active {
        transform: scale(0.95) !important;
    }

    .filmstrip-arrow-btn:disabled,
    .filmstrip-arrow-btn.is-disabled {
        opacity: 0.2 !important;
        cursor: default !important;
        pointer-events: none !important;
        border-color: rgba(255, 255, 255, 0.05) !important;
        box-shadow: none !important;
    }

    .btn-jump-library {
        order: 3 !important;
        padding: 5px 12px !important;
        font-size: 11px !important;
        font-weight: 600 !important;
        flex-shrink: 0 !important;
        white-space: nowrap !important;
        background: rgba(255, 255, 255, 0.05) !important;
        border: 1px solid rgba(255, 255, 255, 0.14) !important;
        border-radius: 6px !important;
        color: #cbd5e1 !important;
        cursor: pointer !important;
        transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
        display: inline-flex !important;
        align-items: center !important;
        gap: 6px !important;
    }

    .btn-jump-library:hover {
        background: rgba(56, 189, 248, 0.16) !important;
        border-color: #38bdf8 !important;
        color: #ffffff !important;
        box-shadow: 0 0 10px rgba(56, 189, 248, 0.35) !important;
        transform: translateY(-1px) !important;
    }

    .recent-filmstrip-item {
        width: 52px !important;
        height: 52px !important;
        min-width: 52px !important;
        min-height: 52px !important;
        border-radius: 8px !important;
        overflow: hidden !important;
        cursor: pointer !important;
        border: 1.5px solid rgba(255, 255, 255, 0.14) !important;
        background: #090d16 !important;
        flex-shrink: 0 !important;
        position: relative !important;
        box-sizing: border-box !important;
        transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.2s ease, box-shadow 0.2s ease !important;
    }

    .recent-filmstrip-item:hover {
        transform: translateY(-2px) scale(1.08) !important;
        border-color: #38bdf8 !important;
        box-shadow: 0 6px 18px rgba(0, 0, 0, 0.75), 0 0 12px rgba(56, 189, 248, 0.5) !important;
        z-index: 5 !important;
    }

    .recent-filmstrip-item.active {
        border-color: #38bdf8 !important;
        box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.8), 0 4px 16px rgba(0, 0, 0, 0.7) !important;
    }

    .recent-filmstrip-item.active::after {
        content: "" !important;
        position: absolute !important;
        bottom: 3px !important;
        right: 3px !important;
        width: 7px !important;
        height: 7px !important;
        border-radius: 50% !important;
        background: #38bdf8 !important;
        box-shadow: 0 0 6px #38bdf8 !important;
        z-index: 2 !important;
    }

    .recent-filmstrip-item img {
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important;
        display: block !important;
        pointer-events: none !important;
    }

    .recent-empty-hint {
        font-size: 11.5px !important;
        color: #64748b !important;
        padding: 6px 14px !important;
        font-style: italic !important;
        white-space: nowrap !important;
        display: inline-flex !important;
        align-items: center !important;
        gap: 6px !important;
    }

    /* Streamlined Aspect Ratio Grids */
    .aspect-grid-primary {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
        width: 100%;
    }

    .more-aspects-accordion {
        margin-top: 6px;
        background: rgba(255, 255, 255, 0.02);
        border: 1px dashed rgba(255, 255, 255, 0.1);
        border-radius: var(--radius-sm);
        padding: 6px 10px;
        transition: background 0.2s ease;
    }

    .more-aspects-accordion[open] {
        background: rgba(255, 255, 255, 0.04);
        border-style: solid;
        border-color: rgba(255, 255, 255, 0.15);
    }

    .more-aspects-accordion summary {
        font-size: 11.5px;
        font-weight: 500;
        color: #94a3b8;
        cursor: pointer;
        user-select: none;
        display: flex;
        align-items: center;
        gap: 6px;
        padding: 2px 0;
    }

    .more-aspects-accordion summary:hover {
        color: #38bdf8;
    }

    .aspect-grid-secondary {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
        margin-top: 8px;
        padding-top: 6px;
        border-top: 1px solid rgba(255, 255, 255, 0.06);
    }

/* --- Desktop Pro Studio Layout Overrides (>= 901px) --- */
@media (min-width: 901px) {
    /* Hide Mobile Navigation on Desktop */
    .mobile-bottom-nav,
    .mobile-sticky-generate-bar {
        display: none !important;
    }

    /* Panes Visibility in Studio */
    #pane-studio, #pane-canvas {
        display: flex !important;
    }

    body.view-studio #pane-history,
    body.view-studio #pane-gallery {
        display: none !important;
    }

    /* Stage Desktop 2-Column Side-by-Side Flex Layout */
    .result-stage-layout {
        flex-direction: row !important;
        height: 100% !important;
        min-height: 0 !important;
        overflow: hidden !important;
        gap: 16px !important;
        flex: 1 1 auto !important;
        align-items: stretch !important;
    }

    .stage-visual-col {
        flex: 1.25 !important;
        min-width: 0 !important;
        height: 100% !important;
        min-height: 0 !important;
        justify-content: space-between !important;
        gap: 8px !important;
    }

    body.view-studio .result-image-frame {
        flex: 1 1 auto !important;
        height: 100% !important;
        min-height: 0 !important;
        max-height: none !important;
    }

    body.view-studio #result-image {
        max-height: 100% !important;
        max-width: 100% !important;
    }

    .stage-visual-col .actions-primary-row {
        flex-wrap: wrap !important;
        gap: 7px !important;
        padding-top: 4px !important;
    }

    .stage-visual-col .action-btn {
        padding: 6px 12px !important;
        font-size: 11.5px !important;
    }

    .stage-inspector-col {
        flex: 1.05 !important;
        min-width: 360px !important;
        max-width: 520px !important;
        height: 100% !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        padding-right: 4px !important;
        gap: 6px !important;
    }

    .stage-inspector-col .actions-secondary-row {
        flex-wrap: nowrap !important;
    }

    .studio-recent-strip {
        flex-direction: row !important;
        min-height: 56px !important;
    }

    .recent-strip-header {
        display: contents !important;
    }

    /* Deck Panes: Personal Library vs Community Showcase */
    .deck-pane:not(.active) {
        display: none !important;
    }

    .deck-pane.active {
        display: flex !important;
        flex-direction: column !important;
        width: 100% !important;
    }
}

/* --- Mobile Native App Experience (<= 900px) --- */
@media (max-width: 900px) {
    body {
        padding-bottom: 120px !important; /* Space for fixed bottom dock and generate bar */
    }

    .app-container {
        padding: 12px 14px 20px !important;
        gap: 16px !important;
    }

    .studio-header {
        padding: 10px 14px !important;
        border-radius: var(--radius-md) !important;
    }

    .brand-title-row h1 {
        font-size: 16px !important;
    }

    .system-status,
    .deck-tabs-header {
        display: none !important;
    }

    .viewport-panel {
        display: contents !important;
    }

    .studio-workspace {
        display: flex !important;
        flex-direction: column !important;
        gap: 0 !important;
        width: 100% !important;
    }

    /* Mobile Pane Switching */
    .mobile-tab-pane {
        display: none !important;
        width: 100% !important;
    }

    .mobile-tab-pane.active {
        display: flex !important;
        flex-direction: column !important;
        width: 100% !important;
        animation: mobilePaneFadeIn 0.25s cubic-bezier(0.16, 1, 0.3, 1) !important;
    }

    @keyframes mobilePaneFadeIn {
        from { opacity: 0; transform: translateY(6px); }
        to { opacity: 1; transform: translateY(0); }
    }

    /* Mobile Studio Inline Artwork Preview Card */
    .mobile-studio-preview-card:not(.hidden) {
        display: flex !important;
        align-items: center !important;
        gap: 12px !important;
        background: linear-gradient(135deg, rgba(15, 23, 42, 0.95), rgba(6, 12, 24, 0.98)) !important;
        border: 1px solid rgba(0, 242, 254, 0.35) !important;
        border-radius: 12px !important;
        padding: 10px 14px !important;
        margin-bottom: 14px !important;
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6), 0 0 12px rgba(0, 242, 254, 0.15) !important;
    }
    .mobile-preview-thumb-wrap {
        width: 56px !important;
        height: 56px !important;
        border-radius: 8px !important;
        overflow: hidden !important;
        border: 1px solid rgba(0, 242, 254, 0.4) !important;
        flex-shrink: 0 !important;
        background: #020617 !important;
    }
    .mobile-preview-thumb-wrap img {
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important;
        display: block !important;
    }
    .mobile-preview-info {
        flex: 1 !important;
        min-width: 0 !important;
        display: flex !important;
        flex-direction: column !important;
        gap: 4px !important;
    }
    .mobile-preview-title-row {
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        gap: 6px !important;
    }
    .mobile-preview-badge {
        font-size: 0.68rem !important;
        font-family: 'JetBrains Mono', monospace !important;
        color: #00f2fe !important;
        text-transform: uppercase !important;
        letter-spacing: 0.05em !important;
    }
    .mobile-preview-char {
        font-size: 0.8rem !important;
        font-weight: 700 !important;
        color: #f8fafc !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }
    .btn-mobile-jump-canvas {
        display: inline-flex !important;
        align-items: center !important;
        gap: 6px !important;
        font-size: 0.75rem !important;
        font-weight: 600 !important;
        color: #020617 !important;
        background: linear-gradient(135deg, #00f2fe, #38bdf8) !important;
        border: none !important;
        border-radius: 6px !important;
        padding: 5px 10px !important;
        cursor: pointer !important;
        align-self: flex-start !important;
        margin-top: 2px !important;
    }

    .controls-panel {
        height: auto !important;
        max-height: none !important;
        overflow: visible !important;
        padding: 0 !important;
        border-radius: var(--radius-md) !important;
        gap: 0 !important;
    }

    .controls-scroll-area {
        overflow: visible !important;
        padding: 16px !important;
        gap: 16px !important;
    }

    .controls-action-dock {
        padding: 14px 16px 20px !important;
        background: rgba(11, 15, 25, 0.98) !important;
        border-radius: 0 0 var(--radius-md) var(--radius-md) !important;
        gap: 10px !important;
    }

    /* On mobile, use ONLY the dedicated sticky bottom bar to eliminate dual generate buttons */
    .controls-action-dock .generate-action-row,
    .controls-action-dock .generate-btn {
        display: none !important;
    }

    /* Sticky Mobile Generate Bar (Above Bottom Dock) */
    .mobile-sticky-generate-bar {
        position: fixed;
        bottom: 64px;
        left: 0;
        right: 0;
        padding: 8px 12px;
        background: linear-gradient(to top, rgba(7, 10, 18, 0.98) 80%, rgba(7, 10, 18, 0.85) 90%, transparent);
        backdrop-filter: blur(16px);
        z-index: 998;
        display: none;
        align-items: center;
        justify-content: center;
        gap: 8px;
        box-sizing: border-box;
    }

    .mobile-sticky-generate-bar.visible {
        display: flex;
    }

    .mobile-drops-pill {
        display: flex;
        align-items: center;
        gap: 8px;
        padding: 0 12px;
        min-height: 48px;
        background: rgba(15, 23, 42, 0.94);
        border: 1.5px solid rgba(56, 189, 248, 0.4);
        border-radius: var(--radius-md);
        box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45), inset 0 0 10px rgba(56, 189, 248, 0.12);
        flex-shrink: 0;
        user-select: none;
        box-sizing: border-box;
    }

    .mobile-drops-icon {
        font-size: 15px;
        color: #38bdf8;
        filter: drop-shadow(0 0 6px rgba(56, 189, 248, 0.6));
        display: flex;
        align-items: center;
    }

    .mobile-drops-text {
        display: flex;
        flex-direction: column;
        justify-content: center;
    }

    .mobile-drops-lbl {
        font-size: 9px;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.4px;
        color: #94a3b8;
        line-height: 1;
    }

    .mobile-drops-num {
        font-size: 14px;
        font-weight: 800;
        color: #38bdf8;
        line-height: 1.2;
    }

    .mobile-generate-btn {
        flex: 1;
        min-width: 0;
        max-width: 480px;
        /* FIX HERMES-1 2026-10-14 (hud_contract_test #69): #fff na starym
           gradiencie #3b82f6->#8b5cf6 mialo kontrast 3.68 < 4.5 (falszywe OK
           w poprzednich audytach -- liczyly tlo body, nie gradient).
           Ciemniejszy gradient: 5.17 / 5.31 -- AA PASS. */
        background: linear-gradient(135deg, #0369a1, #075985);
        color: #fff;
        border: none;
        padding: 12px 14px;
        min-height: 48px;
        border-radius: var(--radius-md);
        font-size: 14px;
        font-weight: 800;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        box-shadow: 0 4px 20px rgba(59, 130, 246, 0.5);
        cursor: pointer;
        transition: transform 0.15s ease, box-shadow 0.15s ease;
        box-sizing: border-box;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .mobile-generate-btn:active {
        transform: scale(0.98);
        box-shadow: 0 2px 10px rgba(59, 130, 246, 0.4);
    }

    /* Mobile Bottom Navigation Dock */
    .mobile-bottom-nav {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 64px;
        background: rgba(13, 18, 31, 0.95);
        backdrop-filter: blur(24px);
        border-top: 1px solid rgba(255, 255, 255, 0.08);
        display: flex;
        align-items: center;
        justify-content: space-around;
        padding: 0 10px;
        z-index: 999;
        box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.6);
    }

    .mobile-nav-btn {
        flex: 1;
        height: 100%;
        background: transparent;
        border: none;
        color: #7e8ba3; /* WCAG AA: 5.76:1 na tle #070a12 */
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 4px;
        cursor: pointer;
        position: relative;
        transition: color 0.2s ease, transform 0.15s ease;
    }

    .mobile-nav-btn i {
        font-size: 1.25rem;
    }

    .mobile-nav-btn span {
        font-size: 0.72rem;
        font-weight: 700;
        letter-spacing: 0.02em;
    }

    .mobile-nav-btn.active {
        color: #38bdf8;
    }

    .mobile-nav-btn.active i {
        filter: drop-shadow(0 0 8px rgba(56, 189, 248, 0.6));
    }

    .mobile-nav-btn:active {
        transform: scale(0.92);
    }

    .mobile-history-badge {
        position: absolute;
        top: 8px;
        right: 25%;
        /* FIX HERMES-1 (2026-10-14): bialy tekst na #3b82f6 = kontrast 3.68
           (WCAG AA malego tekstu wymaga 4.5). Ciemniejszy niebieski
           #1d4ed8 daje kontrast ~5.9. */
        background: #1d4ed8;
        color: #fff;
        font-size: 0.62rem;
        font-weight: 800;
        padding: 1px 5px;
        border-radius: 9999px;
        border: 1px solid rgba(255, 255, 255, 0.2);
    }

    .mobile-tab-badge {
        position: absolute;
        top: 10px;
        right: 28%;
        width: 8px;
        height: 8px;
        background: #10b981;
        border-radius: 50%;
        box-shadow: 0 0 8px #10b981;
    }

    /* History Grid on Mobile */
    .history-tray {
        background: var(--card-bg) !important;
        border-radius: var(--radius-md) !important;
        padding: 16px !important;
    }

    body.view-library .history-tray-header {
        flex-wrap: wrap !important;
        gap: 10px !important;
    }

    body.view-library .history-tray-title {
        font-size: 15px !important;
        white-space: nowrap !important;
    }

    .history-list {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
        max-height: none !important;
        overflow-y: visible !important;
    }

    .history-item {
        width: 100% !important;
        aspect-ratio: 1 / 1 !important;
        border-radius: var(--radius-sm) !important;
    }

    /* Gallery Grid on Mobile */
    .gallery-container {
        padding: 14px !important;
        background: transparent !important;
    }

    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)) !important;
        gap: 12px !important;
    }

    /* Mobile Polish & Zero-Overflow Safeguards */
    .section-label-row {
        flex-wrap: wrap !important;
        gap: 8px !important;
    }

    .section-label-row .section-label {
        font-size: 0.78rem !important;
    }

    .prompt-quick-actions {
        width: 100% !important;
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        gap: 6px !important;
    }

    .prompt-mode-toggle {
        display: inline-flex !important;
        flex: 1 !important;
        max-width: 220px !important;
    }

    .prompt-mode-toggle .mode-pill {
        flex: 1 !important;
        text-align: center !important;
        padding: 5px 8px !important;
        font-size: 0.72rem !important;
    }

    #btn-expand-prompt {
        flex-shrink: 0 !important;
        padding: 5px 10px !important;
        font-size: 0.72rem !important;
    }

    .prompt-chips-compact {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        overflow-x: auto !important;
        white-space: nowrap !important;
        -webkit-overflow-scrolling: touch !important;
        scrollbar-width: none !important;
        padding: 4px 0 !important;
        box-sizing: border-box !important;
    }

    .prompt-chips-compact::-webkit-scrollbar {
        display: none !important;
    }

    .aspect-grid-compact {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 6px !important;
    }

    @media (max-width: 420px) {
        .aspect-grid-compact {
            grid-template-columns: repeat(2, 1fr) !important;
        }
    }

    .aspect-grid-compact .aspect-card {
        padding: 6px 8px !important;
        min-width: 0 !important;
    }

    .aspect-grid-compact .aspect-card span {
        font-size: 0.72rem !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }

    .char-action-pills {
        gap: 4px !important;
    }

    /* ==========================================================================
       HERMES-1 / PAWEL: Mobile Canvas & Stage Architecture (<= 900px)
       ========================================================================== */
    .result-stage-layout {
        display: flex !important;
        flex-direction: column !important;
        width: 100% !important;
        height: auto !important;
        min-height: auto !important;
        overflow: visible !important;
        gap: 14px !important;
    }

    .stage-visual-col {
        width: 100% !important;
        height: auto !important;
        min-height: auto !important;
        flex: none !important;
        gap: 10px !important;
    }

    body.view-studio .result-image-frame {
        width: 100% !important;
        height: auto !important;
        min-height: 240px !important;
        max-height: 50vh !important;
        overflow: hidden !important;
    }

    body.view-studio #result-image {
        max-height: 50vh !important;
        max-width: 100% !important;
        width: auto !important;
        height: auto !important;
    }

    .stage-visual-col .actions-primary-row {
        display: flex !important;
        flex-wrap: wrap !important;
        justify-content: center !important;
        gap: 8px !important;
        width: 100% !important;
        padding-top: 6px !important;
    }

    .stage-visual-col .action-btn {
        min-height: 44px !important;
        padding: 8px 14px !important;
        font-size: 12px !important;
        flex: 1 1 calc(50% - 10px) !important;
        max-width: 100% !important;
        justify-content: center !important;
    }

    .stage-visual-col .action-btn.download-btn {
        flex: 1 1 100% !important; /* Download is primary action, full width on mobile */
    }

    .stage-inspector-col {
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        height: auto !important;
        overflow: visible !important;
        padding-right: 0 !important;
        flex: none !important;
        gap: 12px !important;
    }

    .stage-inspector-col .inspector-deck-card {
        width: 100% !important;
        padding: 10px 12px !important;
        gap: 8px !important;
    }

    .stage-inspector-col .actions-secondary-row {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: 8px !important;
        width: 100% !important;
        padding-top: 6px !important;
    }

    .stage-inspector-col #label-publish-prompt {
        grid-column: 1 / 2 !important;
        min-height: 38px !important;
        height: 38px !important;
        max-height: 38px !important;
        padding: 0 10px !important;
        font-size: 11px !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .stage-inspector-col #label-publish-nsfw {
        grid-column: 2 / 3 !important;
        min-height: 38px !important;
        height: 38px !important;
        max-height: 38px !important;
        padding: 0 10px !important;
        font-size: 11px !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .stage-inspector-col #btn-copy-prompt {
        grid-column: 1 / -1 !important;
        min-height: 38px !important;
        height: 38px !important;
        max-height: 38px !important;
        padding: 0 12px !important;
        font-size: 11.5px !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .stage-inspector-col #btn-use-seed {
        grid-column: 1 / 2 !important;
        min-height: 38px !important;
        height: 38px !important;
        max-height: 38px !important;
        padding: 0 10px !important;
        font-size: 11px !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .stage-inspector-col #btn-delete-artwork {
        grid-column: 2 / 3 !important;
        min-height: 38px !important;
        height: 38px !important;
        max-height: 38px !important;
        padding: 0 10px !important;
        font-size: 11px !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .stage-inspector-col .feedback-panel {
        padding: 10px 12px !important;
        width: 100% !important;
        gap: 8px !important;
    }

    .stage-inspector-col .feedback-btn {
        min-height: 44px !important;
        padding: 6px 4px !important;
    }

    .studio-recent-strip {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 10px !important;
        padding: 10px 12px !important;
        width: 100% !important;
        min-height: auto !important;
    }

    .recent-strip-header {
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        width: 100% !important;
    }

    .recent-strip-title {
        order: 1 !important;
    }

    .btn-jump-library {
        order: 2 !important;
        margin-left: auto !important;
        min-height: 36px !important;
        display: inline-flex !important;
        align-items: center !important;
    }

    .recent-carousel-container {
        order: 3 !important;
        width: 100% !important;
    }

    .recent-filmstrip-item {
        width: 50px !important;
        height: 50px !important;
        min-width: 50px !important;
        min-height: 50px !important;
    }

}

/* ==========================================================================
   REUSE PARAMETERS & PUBLIC GALLERY SUITE
   ========================================================================== */
.btn-reuse-params {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(56, 189, 248, 0.14);
    color: #38bdf8;
    border: 1px solid rgba(56, 189, 248, 0.35);
    border-radius: var(--radius-sm);
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
}

.btn-reuse-params:hover {
    background: rgba(56, 189, 248, 0.28);
    border-color: #38bdf8;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(56, 189, 248, 0.25);
}

.btn-publish-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(139, 92, 246, 0.14);
    color: #a78bfa;
    border: 1px solid rgba(139, 92, 246, 0.35);
    border-radius: var(--radius-sm);
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
}

.btn-publish-toggle:hover {
    background: rgba(139, 92, 246, 0.28);
    border-color: #a78bfa;
    transform: translateY(-1px);
}

.btn-publish-toggle.is-published {
    background: rgba(34, 197, 94, 0.18);
    color: #4ade80;
    border-color: rgba(34, 197, 94, 0.45);
}

/* ==================================================================== */
/* DECK TABS (DESKTOP LOWER TRAY SWITCHER: LIBRARY VS COMMUNITY)        */
/* ==================================================================== */

.deck-tabs-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 24px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border-color);
}

.deck-tabs-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(10, 15, 29, 0.7);
    padding: 4px;
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.deck-tab {
    background: transparent;
    border: none;
    color: #94a3b8;
    padding: 8px 18px;
    font-size: 13px;
    font-weight: 700;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    /* FIX HERMES-1 2026-10-14: hit-area 31-33px -> 44px (HIG). */
    min-height: 44px;
    box-sizing: border-box;
    transition: all 0.2s ease;
}

.deck-tab:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
}

.deck-tab.active {
    color: #fff;
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.22), rgba(37, 99, 235, 0.32));
    border: 1px solid rgba(56, 189, 248, 0.45);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.deck-tab .fa-globe {
    color: #38bdf8;
}

.deck-tab.active .fa-globe {
    color: #38bdf8;
    filter: drop-shadow(0 0 6px rgba(56, 189, 248, 0.6));
}

.deck-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Public Gallery Layout */
.gallery-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding-top: 14px;
}

.gallery-empty-state {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    background: rgba(12, 18, 34, 0.6);
    border: 1px dashed rgba(56, 189, 248, 0.3);
    border-radius: var(--radius-lg);
    text-align: center;
    gap: 12px;
}

.gallery-empty-icon {
    font-size: 34px;
    color: #38bdf8;
    background: rgba(56, 189, 248, 0.12);
    width: 68px;
    height: 68px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 24px rgba(56, 189, 248, 0.2);
    margin-bottom: 4px;
}

/* HERMES-1 progressive gallery render (budget DOM < 1500) */
.gallery-load-more-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 20px 16px 132px;
}

.gallery-load-more-wrap.hidden {
    display: none;
}

.gallery-load-more-btn {
    min-height: 48px;
    min-width: 220px;
    padding: 12px 28px;
    border: 1px solid rgba(56, 189, 248, 0.45);
    border-radius: 999px;
    background: rgba(56, 189, 248, 0.1);
    color: #e0f2fe;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: background 160ms ease, transform 160ms ease;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.gallery-load-more-btn:hover,
.gallery-load-more-btn:focus-visible {
    background: rgba(56, 189, 248, 0.22);
    transform: translateY(-1px);
}

.gallery-load-more-btn:disabled {
    opacity: 0.55;
    cursor: progress;
}

.gallery-count-hint {
    font-size: 12px;
    color: #94a3b8;
}

.gallery-empty-title {
    font-size: 16px;
    font-weight: 800;
    color: #f8fafc;
    letter-spacing: -0.2px;
}

.gallery-empty-desc {
    font-size: 13px;
    color: #94a3b8;
    max-width: 480px;
    line-height: 1.5;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
    width: 100%;
}

.gallery-card {
    position: relative !important;
    background: rgba(15, 23, 42, 0.75);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-md);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: var(--transition);
}

.gallery-card:hover {
    border-color: rgba(56, 189, 248, 0.5);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    transform: translateY(-2px);
}

.gallery-thumb-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    overflow: hidden;
    background: #090d16;
}

.gallery-thumb-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.gallery-thumb-wrap:hover img {
    transform: scale(1.03);
}

/* Gallery Zoom overlay on hover */
.gallery-zoom-overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(2px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: #e2e8f0;
    font-size: 13px;
    font-weight: 600;
    opacity: 0;
    transition: opacity 0.2s ease;
    cursor: pointer;
    z-index: 2;
    pointer-events: none;
}

.gallery-thumb-wrap:hover .gallery-zoom-overlay {
    opacity: 1;
    pointer-events: auto;
}

.gallery-thumb-wrap.nsfw-blurred-wrap:not(.revealed) .gallery-zoom-overlay {
    display: none !important;
}

.gallery-inspect-btn {
    background: rgba(56, 189, 248, 0.12);
    border: 1px solid rgba(56, 189, 248, 0.35);
    color: #38bdf8;
    font-size: 11px;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s ease;
}

.gallery-inspect-btn:hover {
    background: rgba(56, 189, 248, 0.25);
    border-color: #38bdf8;
    color: #ffffff;
    transform: translateY(-1px);
}

.history-item-zoom-btn {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 28px;
    height: 28px;
    background: rgba(10, 14, 26, 0.85);
    border: 1px solid rgba(56, 189, 248, 0.6);
    color: #38bdf8;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    opacity: 0;
    transition: var(--transition);
    cursor: pointer;
    z-index: 5;
    backdrop-filter: blur(4px);
}

.history-item:hover .history-item-zoom-btn {
    opacity: 1;
}

@media (hover: none), (max-width: 900px) {
    .history-item-zoom-btn,
    .history-item-del-btn {
        opacity: 0.85 !important;
        pointer-events: auto !important;
    }
}

.history-item-zoom-btn:hover {
    background: #0284c7;
    color: #ffffff;
    border-color: #38bdf8;
    transform: scale(1.1);
}

.history-item-fav-btn {
    position: absolute;
    bottom: 3px;
    left: 3px;
    width: 26px;
    height: 26px;
    background: rgba(10, 14, 26, 0.85);
    border: 1px solid rgba(244, 63, 94, 0.45);
    color: #fda4af;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    opacity: 0;
    transition: var(--transition);
    cursor: pointer;
    z-index: 5;
    backdrop-filter: blur(4px);
}

.history-item:hover .history-item-fav-btn,
.history-item-fav-btn.is-favorited {
    opacity: 1;
}

.history-item-fav-btn.is-favorited {
    background: rgba(225, 29, 72, 0.9);
    border-color: #fb7185;
    color: #ffffff;
    box-shadow: 0 0 10px rgba(244, 63, 94, 0.55);
}

.history-item-fav-btn:hover {
    background: #e11d48;
    color: #ffffff;
    border-color: #fb7185;
    transform: scale(1.12);
}

@media (hover: none), (max-width: 900px) {
    .history-item-fav-btn {
        opacity: 0.9 !important;
        pointer-events: auto !important;
    }
}

.history-sort-select {
    background: rgba(15, 23, 42, 0.85);
    border: 1px solid rgba(148, 163, 184, 0.3);
    color: #e2e8f0;
    font-size: 11px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 9999px;
    cursor: pointer;
    outline: none;
    transition: all 0.2s ease;
}

.history-sort-select:hover,
.history-sort-select:focus {
    border-color: #38bdf8;
    color: #ffffff;
}

.compact-pill-btn.fav-active {
    background: rgba(225, 29, 72, 0.22);
    border-color: rgba(251, 113, 133, 0.7);
    color: #fda4af;
}

.fav-action-btn.is-favorited {
    background: rgba(225, 29, 72, 0.22);
    border-color: rgba(251, 113, 133, 0.75);
    color: #fda4af;
}

.gallery-card-body {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.gallery-author-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
}

.gallery-author {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 700;
    color: #e2e8f0;
}

.gallery-author img {
    width: 22px;
    height: 22px;
    border-radius: 50%;
}

.gallery-prompt-preview {
    font-size: 11px;
    color: #94a3b8;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.gallery-card-actions {
    margin-top: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.gallery-card-left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.gallery-card-right {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Unpublish button on gallery card */
.gallery-unpublish-btn {
    background: rgba(239, 68, 68, 0.14);
    border: 1px solid rgba(239, 68, 68, 0.35);
    color: #f87171;
    font-size: 11px;
    font-weight: 700;
    padding: 5px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: all 0.2s ease;
}

.gallery-unpublish-btn:hover {
    background: rgba(239, 68, 68, 0.3);
    color: #fecaca;
    border-color: #ef4444;
    transform: translateY(-1px);
}

/* Gallery Card Like Button & Counter */
.gallery-like-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #94a3b8;
    font-size: 11px;
    font-weight: 700;
    padding: 4px 9px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.gallery-like-btn:hover {
    background: rgba(244, 63, 94, 0.15);
    border-color: rgba(244, 63, 94, 0.4);
    color: #f43f5e;
    transform: translateY(-1px);
}

.gallery-like-btn.liked {
    background: rgba(244, 63, 94, 0.2);
    border-color: #f43f5e;
    color: #f43f5e;
}

.gallery-like-btn.liked i {
    animation: heartPop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes heartPop {
    0% { transform: scale(1); }
    50% { transform: scale(1.35); }
    100% { transform: scale(1); }
}

/* Gallery Toolbar & Sort Group */
.gallery-toolbar-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px;
    background: rgba(15, 23, 42, 0.7);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    flex-wrap: wrap;
}

.gallery-sort-group {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(10, 14, 22, 0.8);
    padding: 3px 4px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.gallery-sort-btn {
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 11px;
    font-weight: 700;
    padding: 5px 12px;
    border-radius: 4px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
    font-family: inherit;
}

.gallery-sort-btn:hover {
    color: #e2e8f0;
    background: rgba(255, 255, 255, 0.05);
}

.gallery-sort-btn.active {
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.25), rgba(56, 189, 248, 0.15));
    color: #38bdf8;
    border: 1px solid rgba(56, 189, 248, 0.4);
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.2);
}

.gallery-toolbar-meta {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-refresh-gallery {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #cbd5e1;
    font-size: 11px;
    font-weight: 700;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.btn-refresh-gallery:hover {
    background: rgba(56, 189, 248, 0.15);
    color: #38bdf8;
    border-color: rgba(56, 189, 248, 0.35);
}

/* Card Action Bar Like Button */
.gallery-like-btn {
    position: relative;
    background: rgba(10, 14, 22, 0.75);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #94a3b8;
    padding: 4px 9px;
    border-radius: 9999px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 800;
    transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.gallery-like-btn:hover {
    color: #f43f5e;
    background: rgba(15, 23, 42, 0.95);
    border-color: rgba(244, 63, 94, 0.4);
    transform: scale(1.08);
}

.gallery-like-btn.liked {
    background: rgba(244, 63, 94, 0.2);
    border-color: #f43f5e;
    color: #f43f5e;
    box-shadow: 0 0 12px rgba(244, 63, 94, 0.35);
}

.gallery-like-btn.liked i {
    animation: heartPulse 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes heartPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.4); }
    100% { transform: scale(1); }
}

/* Author Controls on Gallery Card */
.gallery-author-controls {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
}

.gallery-prompt-toggle-btn {
    background: rgba(56, 189, 248, 0.1);
    border: 1px solid rgba(56, 189, 248, 0.3);
    color: #38bdf8;
    font-size: 11px;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s ease;
}

.gallery-prompt-toggle-btn:hover {
    background: rgba(56, 189, 248, 0.25);
    color: #ffffff;
    border-color: #38bdf8;
}

.gallery-delete-btn {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #f87171;
    font-size: 11px;
    padding: 5px 8px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
}

.gallery-delete-btn:hover {
    background: rgba(239, 68, 68, 0.3);
    color: #ffffff;
    border-color: #ef4444;
}

.gallery-copy-prompt-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #cbd5e1;
    font-size: 11px;
    padding: 4px 7px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
}

.gallery-copy-prompt-btn:hover {
    background: rgba(56, 189, 248, 0.2);
    color: #38bdf8;
    border-color: #38bdf8;
}

.owner-private-hint {
    display: block;
    margin-top: 4px;
    font-size: 10px;
    font-style: italic;
    color: #fbbf24;
}

/* NSFW Indicator Badge */
.badge-nsfw-indicator {
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #f87171;
    font-size: 10px;
    font-weight: 900;
    padding: 2px 7px;
    border-radius: 9999px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    letter-spacing: 0.3px;
}

/* NSFW Image Blur & Interactive Reveal Overlay */
.gallery-thumb-wrap img.nsfw-blurred {
    filter: blur(34px) brightness(0.65) saturate(1.2) !important;
    transform: scale(1.12);
    transition: filter 0.35s ease, transform 0.35s ease;
}

.nsfw-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: rgba(8, 12, 22, 0.7);
    cursor: pointer;
    z-index: 10;
    transition: all 0.2s ease;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    padding: 16px;
    text-align: center;
}

.nsfw-overlay:hover {
    background: rgba(8, 12, 22, 0.5);
}

.nsfw-badge {
    background: linear-gradient(135deg, #ef4444, #b91c1c);
    color: #fff;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 0.6px;
    padding: 6px 14px;
    border-radius: 9999px;
    box-shadow: 0 4px 18px rgba(239, 68, 68, 0.55);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-transform: uppercase;
}

.nsfw-hint {
    font-size: 11px;
    color: #cbd5e1;
    font-weight: 600;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.9);
}

.gallery-thumb-wrap.revealed img.nsfw-blurred {
    filter: none !important;
    transform: scale(1) !important;
}

.gallery-thumb-wrap.revealed .nsfw-overlay {
    display: none !important;
}

/* Deck Panes base rules */
.deck-pane:not(.active) {
    display: none !important;
}

.deck-pane.active {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
}

/* Admin User Generations Audit Dialog Modal */
dialog.admin-user-gens-modal {
    border: none;
    padding: 0;
    background: transparent;
}

dialog.admin-user-gens-modal:not([open]) {
    display: none !important;
}

dialog.admin-user-gens-modal[open] {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    max-width: 100vw;
    max-height: 100vh;
    margin: 0;
    border: none;
    background: rgba(4, 6, 12, 0.88);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    z-index: 2500;
    display: flex !important;
    align-items: center;
    justify-content: center;
    padding: 24px;
    box-sizing: border-box;
}

dialog.admin-user-gens-modal::backdrop {
    background: rgba(0, 0, 0, 0.82);
    backdrop-filter: blur(12px);
}

.admin-user-gens-box {
    background: #0d1322;
    border: 1px solid rgba(56, 189, 248, 0.3);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 960px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.7);
}

.admin-user-gens-header {
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(15, 23, 42, 0.9);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.admin-user-gens-content {
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.audit-card {
    background: rgba(15, 23, 42, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-md);
    padding: 14px;
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 16px;
}

.audit-thumb img {
    width: 140px;
    height: 140px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.audit-details {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 12px;
}

.audit-prompt-box {
    background: rgba(0, 0, 0, 0.35);
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    font-family: monospace;
    font-size: 11px;
    color: #e2e8f0;
    max-height: 80px;
    overflow-y: auto;
}

/* Action Bar 18+ NSFW Checkbox Label */
.action-btn-checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.32);
    color: #fca5a5;
    transition: var(--transition);
    user-select: none;
}

.action-btn-checkbox-label:hover {
    background: rgba(239, 68, 68, 0.22);
    border-color: #ef4444;
    color: #ffffff;
}

.action-btn-checkbox-label input[type="checkbox"] {
    accent-color: #ef4444;
    cursor: pointer;
    width: 15px;
    height: 15px;
    margin: 0;
}

/* ===== Generate Button Cancel Mode (When Queued/Generating) ===== */
.generate-btn.btn-cancel-mode {
    background: linear-gradient(135deg, #dc2626, #991b1b) !important;
    box-shadow: 0 8px 24px -4px rgba(220, 38, 38, 0.6) !important;
    border: 1px solid rgba(254, 202, 202, 0.3) !important;
    cursor: pointer !important;
    opacity: 1 !important;
    animation: cancelPulse 2s infinite ease-in-out;
    padding: 6px 12px !important;
    min-height: 46px !important;
    height: auto !important;
}

.generate-btn.btn-cancel-mode .btn-content {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 2px !important;
    width: 100% !important;
}

.generate-btn.btn-cancel-mode .btn-text {
    font-size: 13px !important;
    font-weight: 800 !important;
    line-height: 1.15 !important;
    white-space: nowrap !important;
}

.generate-btn.btn-cancel-mode .btn-subtext {
    font-size: 9.5px !important;
    font-weight: 600 !important;
    line-height: 1.15 !important;
    letter-spacing: 0.3px !important;
    color: #ffffff !important;
    opacity: 0.95 !important;
    white-space: nowrap !important;
    text-transform: uppercase !important;
}

.generate-btn.btn-cancel-mode:hover {
    background: linear-gradient(135deg, #ef4444, #b91c1c) !important;
    box-shadow: 0 12px 32px -4px rgba(239, 68, 68, 0.8) !important;
    transform: translateY(-2px);
    filter: brightness(1.15);
}

.generate-btn.btn-cancel-mode:active {
    transform: translateY(0);
}

.mobile-generate-btn.btn-cancel-mode {
    background: linear-gradient(135deg, #dc2626, #991b1b) !important;
    box-shadow: 0 4px 20px rgba(220, 38, 38, 0.6) !important;
    border: 1px solid rgba(254, 202, 202, 0.3) !important;
    cursor: pointer !important;
    opacity: 1 !important;
    animation: cancelPulse 2s infinite ease-in-out;
}

.mobile-generate-btn.btn-cancel-mode:active {
    transform: scale(0.98);
}

@keyframes cancelPulse {
    0%, 100% {
        box-shadow: 0 8px 24px -4px rgba(220, 38, 38, 0.5);
    }
    50% {
        box-shadow: 0 8px 30px 2px rgba(239, 68, 68, 0.8);
    }
}

/* ===== Desktop Action Dock: Generate Row & Balance Pill ===== */
.generate-action-row {
    display: flex;
    align-items: stretch;
    gap: 8px;
    width: 100%;
}

.generate-action-row .generate-btn {
    flex: 1;
    min-width: 0;
    min-height: 44px;
    height: auto;
    padding: 10px 14px;
}

.generate-action-row .generate-btn .btn-text {
    font-size: 14px;
    white-space: nowrap;
}

.dock-balance-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 12px;
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.95), rgba(30, 41, 59, 0.9));
    border: 1.5px solid rgba(56, 189, 248, 0.35);
    border-radius: var(--radius-md);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35), inset 0 0 12px rgba(56, 189, 248, 0.08);
    flex-shrink: 0;
    user-select: none;
    cursor: default;
    transition: var(--transition);
}

.dock-balance-pill:hover {
    border-color: rgba(56, 189, 248, 0.6);
    box-shadow: 0 4px 18px rgba(56, 189, 248, 0.2), inset 0 0 16px rgba(56, 189, 248, 0.15);
}

.dock-balance-icon {
    font-size: 16px;
    color: #38bdf8;
    filter: drop-shadow(0 0 6px rgba(56, 189, 248, 0.6));
    display: flex;
    align-items: center;
    justify-content: center;
}

.dock-balance-text {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.dock-balance-lbl {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #94a3b8;
    line-height: 1.1;
}

.dock-balance-num {
    font-size: 14.5px;
    font-weight: 800;
    color: #f0f9ff;
    line-height: 1.2;
    text-shadow: 0 0 8px rgba(56, 189, 248, 0.35);
}

/* =====================================================================
   SMART INPAINT (PRECISION BRUSH) MODAL & CANVAS STYLES
   ===================================================================== */
.inpaint-action-btn {
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.15), rgba(147, 51, 234, 0.15));
    border: 1px solid rgba(56, 189, 248, 0.4);
    color: #38bdf8;
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.15);
    transition: all 0.2s ease;
}

.inpaint-action-btn:hover {
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.3), rgba(147, 51, 234, 0.3));
    border-color: rgba(56, 189, 248, 0.8);
    box-shadow: 0 0 16px rgba(56, 189, 248, 0.35);
    transform: translateY(-1px);
    color: #fff;
}

dialog.inpaint-modal {
    border: none;
    padding: 0;
    background: transparent;
}

dialog.inpaint-modal:not([open]) {
    display: none !important;
}

dialog.inpaint-modal[open] {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    max-width: 100vw;
    max-height: 100vh;
    margin: 0 !important;
    border: none;
    background: transparent;
    z-index: 2200;
    display: flex !important;
    align-items: center;
    justify-content: center;
    padding: 24px;
    box-sizing: border-box;
}

dialog.inpaint-modal::backdrop {
    background: rgba(5, 10, 20, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.inpaint-modal-box {
    background: #0f172a;
    border: 1.5px solid rgba(56, 189, 248, 0.35);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 1000px;
    max-height: 92vh;
    overflow: hidden;
    box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.85), 0 0 35px rgba(56, 189, 248, 0.25);
    animation: inpaintModalPop 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes inpaintModalPop {
    from {
        opacity: 0;
        transform: scale(0.96) translateY(8px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.inpaint-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    background: rgba(30, 41, 59, 0.6);
    border-bottom: 1px solid var(--border-color);
}

.inpaint-title-group {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.inpaint-modal-content {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

/* Stage container holding the base image and canvas overlay */
.inpaint-stage {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 280px;
    max-height: 56vh;
    background: radial-gradient(circle at center, #1e293b 0%, #090d16 100%);
    padding: 12px;
    overflow: hidden;
    user-select: none;
    touch-action: none;
}

.inpaint-stage-wrapper {
    position: relative;
    display: inline-block;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.6);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.inpaint-base-image {
    display: block;
    max-width: 100%;
    max-height: 52vh;
    object-fit: contain;
    pointer-events: none;
    user-select: none;
}

.inpaint-draw-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    cursor: crosshair;
    touch-action: none;
}

/* Toolbar & controls */
.inpaint-toolbar {
    background: rgba(15, 23, 42, 0.95);
    border-top: 1px solid var(--border-color);
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.inpaint-tools-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.inpaint-brush-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 600;
}

.inpaint-brush-controls input[type="range"] {
    width: 130px;
    accent-color: #38bdf8;
    cursor: pointer;
}

.inpaint-btn-cluster {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.inpaint-tool-btn {
    padding: 7px 14px;
    font-size: 12.5px;
    font-weight: 600;
    border-radius: var(--radius-sm);
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: var(--transition);
}

.inpaint-tool-btn:hover {
    color: var(--text-primary);
    border-color: rgba(56, 189, 248, 0.4);
    background: rgba(56, 189, 248, 0.1);
}

.inpaint-tool-btn.active {
    background: rgba(56, 189, 248, 0.2);
    border-color: #38bdf8;
    color: #38bdf8;
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.3);
}

.inpaint-tool-btn.danger:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.5);
    color: #f87171;
}

.inpaint-inputs-row {
    display: grid;
    grid-template-columns: 2fr 1.2fr;
    gap: 16px;
}

@media (max-width: 720px) {
    .inpaint-inputs-row {
        grid-template-columns: 1fr;
        gap: 10px;
    }
}

.inpaint-prompt-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.inpaint-prompt-field label,
.inpaint-denoise-field label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.inpaint-prompt-field input {
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    color: #fff;
    font-size: 13px;
    outline: none;
    transition: var(--transition);
}

.inpaint-prompt-field input:focus {
    border-color: #38bdf8;
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.25);
}

.inpaint-denoise-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.inpaint-denoise-field input[type="range"] {
    width: 100%;
    margin-top: 6px;
    accent-color: #38bdf8;
    cursor: pointer;
}

.inpaint-action-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding-top: 6px;
}

.inpaint-cost-hint {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.inpaint-cost-hint .drops-badge {
    background: rgba(56, 189, 248, 0.15);
    border: 1px solid rgba(56, 189, 248, 0.3);
    color: #38bdf8;
    font-weight: 700;
    font-size: 13px;
    padding: 4px 10px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    width: fit-content;
}

.inpaint-cost-hint .cost-sub {
    font-size: 11px;
    color: #94a3b8;
}

.inpaint-execute-btn {
    padding: 10px 22px;
    font-size: 14px;
    font-weight: 700;
    background: linear-gradient(135deg, #0284c7 0%, #7c3aed 100%);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-sm);
    box-shadow: 0 4px 15px rgba(2, 132, 199, 0.4);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.inpaint-execute-btn:hover {
    box-shadow: 0 6px 20px rgba(2, 132, 199, 0.6);
    transform: translateY(-1px);
    filter: brightness(1.1);
}

.inpaint-execute-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Upload & Custom Inpaint Additions */
.inpaint-upload-btn {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.15) 0%, rgba(56, 189, 248, 0.15) 100%);
    border: 1px solid rgba(16, 185, 129, 0.4);
    color: #34d399;
}
.inpaint-upload-btn:hover {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.25) 0%, rgba(56, 189, 248, 0.25) 100%);
    border-color: #34d399;
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.25);
}

.inpaint-header-upload-btn {
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 600;
    background: rgba(56, 189, 248, 0.12);
    border: 1px solid rgba(56, 189, 248, 0.35);
    color: #38bdf8;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}
.inpaint-header-upload-btn:hover {
    background: rgba(56, 189, 248, 0.25);
    border-color: #38bdf8;
    color: #fff;
    transform: translateY(-1px);
}

.inpaint-res-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: rgba(15, 23, 42, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 9999px;
    font-size: 11px;
    font-family: 'JetBrains Mono', monospace;
    color: #94a3b8;
    letter-spacing: 0.3px;
}
.inpaint-res-pill i {
    color: #38bdf8;
    font-size: 11px;
}

.inpaint-dropzone-hint {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 18px 24px;
    background: rgba(15, 23, 42, 0.88);
    border: 2px dashed rgba(56, 189, 248, 0.6);
    border-radius: 12px;
    color: #cbd5e1;
    font-size: 13px;
    font-weight: 500;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    z-index: 20;
    backdrop-filter: blur(6px);
}
.inpaint-dropzone-hint i {
    font-size: 26px;
    color: #38bdf8;
}
.inpaint-stage.drag-active {
    border-color: #38bdf8 !important;
    background: rgba(56, 189, 248, 0.05) !important;
    box-shadow: 0 0 25px rgba(56, 189, 248, 0.3) inset !important;
}
.inpaint-stage.drag-active .inpaint-dropzone-hint,
.inpaint-stage.has-no-image .inpaint-dropzone-hint {
    display: flex;
}

/* Inpaint Viewport Zoom & Pan System */
.inpaint-viewport-controls {
    position: absolute;
    top: 14px;
    left: 14px;
    z-index: 25;
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(15, 23, 42, 0.88);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 9999px;
    padding: 3px 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    user-select: none;
}

.inpaint-vp-btn {
    /* HERMES-1 audyt tap-target: 26px -> 32px (WCAG 2.5.5 / Apple HIG min).
       +/- / 1:1 / Fit sa sterowaniem precyzyjnym canvasu -- dotyk 26px
       powodowal chybione klikniecia na telefonie. */
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    border-radius: 16px;
    background: transparent;
    border: none;
    color: #94a3b8;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 700;
    transition: all 0.15s ease;
    position: relative;
}

/* HERMES-1 cykl #68: powiekszony obszar kliku do 44px (HIG) --
   wzor jak .modal-close-btn; brak wplywu na layout (absolute). */
.inpaint-vp-btn::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 44px;
    height: 44px;
    transform: translate(-50%, -50%);
    border-radius: 50%;
}

.inpaint-vp-btn:hover {
    background: rgba(56, 189, 248, 0.2);
    color: #38bdf8;
}

.inpaint-vp-btn span {
    font-size: 11px;
    font-family: 'JetBrains Mono', monospace;
}

.inpaint-zoom-label {
    font-size: 11px;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    color: #38bdf8;
    padding: 0 4px;
    min-width: 44px;
    text-align: center;
    cursor: pointer;
    transition: color 0.15s ease;
}

.inpaint-zoom-label:hover {
    color: #fff;
    text-decoration: underline;
}

/* Dynamic brush preview cursor ring */
.inpaint-brush-cursor {
    position: absolute;
    top: 0;
    left: 0;
    border: 1.5px solid rgba(56, 189, 248, 0.9);
    background: rgba(56, 189, 248, 0.15);
    border-radius: 50%;
    pointer-events: none;
    transform: translate(-50%, -50%);
    display: none;
    z-index: 30;
    box-shadow: 0 0 8px rgba(56, 189, 248, 0.4);
    box-sizing: border-box;
    transition: width 0.04s ease, height 0.04s ease;
}

/* Mode-based cursor styling */
.inpaint-stage {
    cursor: crosshair;
}

.inpaint-stage.tool-pan,
.inpaint-stage.is-space-panning {
    cursor: grab !important;
}

.inpaint-stage.tool-pan.is-dragging,
.inpaint-stage.is-space-panning.is-dragging {
    cursor: grabbing !important;
}

.inpaint-stage-wrapper {
    transform-origin: center center;
    will-change: transform;
}

/* Mask Peek Mode */
.inpaint-draw-canvas.mask-hidden {
    opacity: 0 !important;
    transition: opacity 0.15s ease;
}

/* Quick Brush Size Presets */
.inpaint-brush-presets {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: 6px;
}

.brush-preset-btn {
    padding: 3px 8px;
    font-size: 11px;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
    border-radius: var(--radius-sm);
    background: rgba(30, 41, 59, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #94a3b8;
    cursor: pointer;
    transition: all 0.15s ease;
}

.brush-preset-btn:hover {
    border-color: #38bdf8;
    color: #fff;
    background: rgba(56, 189, 248, 0.15);
}

.brush-preset-btn.active {
    background: rgba(56, 189, 248, 0.25);
    border-color: #38bdf8;
    color: #38bdf8;
    box-shadow: 0 0 8px rgba(56, 189, 248, 0.3);
}

.inpaint-tool-sep {
    width: 1px;
    height: 22px;
    background: rgba(255, 255, 255, 0.12);
    margin: 0 3px;
}

/* Mobile & Touch Overhaul for Inpaint */
@media (max-width: 768px) {
    dialog.inpaint-modal[open] {
        padding: 0 !important;
    }
    .inpaint-modal-box {
        width: 100vw !important;
        max-width: 100vw !important;
        height: 100dvh !important;
        max-height: 100dvh !important;
        border-radius: 0 !important;
        border: none !important;
    }
    .inpaint-modal-header {
        padding: 10px 14px !important;
    }
    .inpaint-title-group h3 {
        font-size: 14px !important;
    }
    .inpaint-title-group span {
        display: none !important;
    }
    .inpaint-header-upload-btn {
        padding: 5px 9px !important;
        font-size: 11px !important;
    }
    .inpaint-stage {
        flex: 1 1 auto !important;
        min-height: 0 !important;
        max-height: none !important;
        padding: 4px !important;
    }
    .inpaint-base-image {
        max-height: none !important;
    }
    .inpaint-toolbar {
        padding: 10px 12px !important;
        gap: 10px !important;
        max-height: 48vh;
        overflow-y: auto;
        padding-bottom: max(12px, env(safe-area-inset-bottom)) !important;
    }
    .inpaint-tools-row {
        gap: 8px !important;
    }
    .inpaint-tool-btn {
        padding: 8px 10px !important;
        min-height: 38px !important;
        font-size: 12px !important;
    }
    .inpaint-tool-btn span {
        display: inline !important;
    }
    .inpaint-brush-controls {
        width: 100%;
        justify-content: space-between;
        flex-wrap: wrap;
    }
    .inpaint-brush-controls input[type="range"] {
        flex: 1;
        max-width: 130px;
    }
    .inpaint-res-pill {
        display: none;
    }
    .inpaint-viewport-controls {
        top: 8px;
        left: 8px;
        transform: scale(0.92);
        transform-origin: top left;
    }
    .inpaint-action-row {
        flex-direction: column !important;
        gap: 8px !important;
        align-items: stretch !important;
    }
    .inpaint-cost-hint {
        justify-content: space-between !important;
        width: 100% !important;
    }
    .inpaint-execute-btn {
        width: 100% !important;
        justify-content: center !important;
        padding: 12px 16px !important;
        font-size: 15px !important;
    }
}

/* ===== Gallery Character Filter Bar ===== */
.gallery-filter-bar {
    margin-bottom: 16px;
    padding: 4px 0 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.gallery-filter-scroll {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 6px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
    -webkit-overflow-scrolling: touch;
}

.gallery-filter-scroll::-webkit-scrollbar {
    height: 4px;
}

.gallery-filter-scroll::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

.gallery-filter-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 9999px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-secondary, #94a3b8);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    font-family: inherit;
}

.gallery-filter-pill:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.2);
}

.gallery-filter-pill.active {
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.25), rgba(14, 165, 233, 0.35));
    border-color: #38bdf8;
    color: #ffffff;
    box-shadow: 0 0 12px rgba(56, 189, 248, 0.3);
}

.gallery-filter-pill .pill-count {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    padding: 1px 6px;
    font-size: 10px;
    font-weight: 700;
    margin-left: 2px;
}

/* ===== Feedback Reward Incentive Badge ===== */
.feedback-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 4px;
}

.feedback-reward-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(135deg, rgba(234, 179, 8, 0.2), rgba(245, 158, 11, 0.3));
    border: 1px solid rgba(234, 179, 8, 0.4);
    color: #fef08a;
    font-size: 11px;
    padding: 4px 10px;
    border-radius: 9999px;
    box-shadow: 0 0 10px rgba(234, 179, 8, 0.2);
    animation: rewardPulse 2.5s infinite;
}

@keyframes rewardPulse {
    0%, 100% {
        box-shadow: 0 0 10px rgba(234, 179, 8, 0.2);
    }
    50% {
        box-shadow: 0 0 16px rgba(234, 179, 8, 0.45);
        border-color: rgba(234, 179, 8, 0.7);
    }
}





/* ===== FUTURISTIC LIVE SYNTHESIS CINEMA HUD & REAL-TIME PREVIEW ===== */
.result-image-frame {
    position: relative;
    overflow: hidden;
    background: #090d16;
}

.live-synthesis-hud {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 25;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 14px 16px;
    background: radial-gradient(circle at center, transparent 45%, rgba(6, 11, 25, 0.45) 100%);
    overflow: hidden;
}

.live-hud-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.live-hud-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.live-status-pill, .live-sampler-pill, .live-step-badge, .live-eta-badge {
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(56, 189, 248, 0.4);
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.55), 0 0 12px rgba(56, 189, 248, 0.2);
    color: #e0f2fe;
    font-family: 'JetBrains Mono', monospace, sans-serif;
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    padding: 6px 14px;
    border-radius: 9999px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    user-select: none;
}

.live-status-pill {
    border-color: rgba(56, 189, 248, 0.75);
    color: #38bdf8;
    box-shadow: 0 0 16px rgba(56, 189, 248, 0.35);
}

.live-sampler-pill {
    border-color: rgba(168, 85, 247, 0.6);
    color: #e9d5ff;
}

.live-step-badge {
    border-color: rgba(56, 189, 248, 0.7);
    color: #f0f9ff;
    box-shadow: 0 0 14px rgba(56, 189, 248, 0.3);
}

.live-eta-badge {
    border-color: rgba(234, 179, 8, 0.6);
    color: #fef08a;
    box-shadow: 0 0 12px rgba(234, 179, 8, 0.25);
}

.live-pulse-dot {
    width: 8px;
    height: 8px;
    background-color: #38bdf8;
    border-radius: 50%;
    box-shadow: 0 0 10px #38bdf8;
    animation: pulseLiveDot 1.2s ease-in-out infinite;
}

@keyframes pulseLiveDot {
    0% { transform: scale(0.85); opacity: 0.7; box-shadow: 0 0 4px #38bdf8; }
    50% { transform: scale(1.35); opacity: 1; box-shadow: 0 0 14px #38bdf8; }
    100% { transform: scale(0.85); opacity: 0.7; box-shadow: 0 0 4px #38bdf8; }
}

/* Futuristic Corner HUD Brackets */
.live-corner-bracket {
    position: absolute;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(56, 189, 248, 0.8);
    pointer-events: none;
    box-shadow: 0 0 8px rgba(56, 189, 248, 0.4);
}
.live-corner-bracket.top-left {
    top: 8px;
    left: 8px;
    border-right: none;
    border-bottom: none;
}
.live-corner-bracket.top-right {
    top: 8px;
    right: 8px;
    border-left: none;
    border-bottom: none;
}
.live-corner-bracket.bottom-left {
    bottom: 8px;
    left: 8px;
    border-right: none;
    border-top: none;
}
.live-corner-bracket.bottom-right {
    bottom: 8px;
    right: 8px;
    border-left: none;
    border-top: none;
}

/* Sci-Fi Laser Scanline Beam */
.live-scanline-beam {
    position: absolute;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, transparent, rgba(56, 189, 248, 0.8), rgba(168, 85, 247, 0.8), transparent);
    box-shadow: 0 0 14px rgba(56, 189, 248, 0.7), 0 0 28px rgba(168, 85, 247, 0.5);
    animation: scanlineSweep 2.8s ease-in-out infinite alternate;
    pointer-events: none;
    z-index: 15;
}

@keyframes scanlineSweep {
    0% { top: 4%; opacity: 0.25; }
    50% { opacity: 0.95; }
    100% { top: 96%; opacity: 0.25; }
}

.result-image-frame img.is-live-preview {
    transition: filter 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateZ(0);
}

/* Render Completion Shimmer Flash */
.render-complete-flash {
    animation: flashShimmer 0.9s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes flashShimmer {
    0% {
        filter: brightness(1.4) contrast(1.15);
        box-shadow: 0 0 35px rgba(56, 189, 248, 0.8), 0 0 60px rgba(168, 85, 247, 0.4);
    }
    100% {
        filter: brightness(1) contrast(1);
        box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
    }
}

.dev-admin-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(69, 26, 3, 0.95);
    border: 1px solid rgba(251, 191, 36, 0.7);
    color: #ffffff;
    padding: 8px 14px;
    min-height: 44px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    transition: var(--transition);
    box-shadow: 0 4px 14px rgba(245, 158, 11, 0.2);
}
.dev-admin-btn:hover {
    background: rgba(245, 158, 11, 0.28);
    border-color: rgba(245, 158, 11, 0.8);
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(245, 158, 11, 0.35);
}

.guest-login-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(56, 189, 248, 0.12);
    border: 1px solid rgba(56, 189, 248, 0.4);
    color: #bae6fd;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    transition: var(--transition);
}
.guest-login-btn:hover {
    background: rgba(56, 189, 248, 0.22);
    border-color: rgba(56, 189, 248, 0.7);
    transform: translateY(-1px);
}

/* ==========================================================================
   RESULT ACTIONS POLISH & BUTTON HIERARCHY (HERO TIER VS UTILITY TIER)
   ========================================================================== */
.result-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 10px 12px;
    width: 100%;
    margin-top: 14px;
}

/* Base button styling */
.result-actions .action-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    font-size: 13.5px;
    font-weight: 700;
    border-radius: 10px;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
    letter-spacing: 0.02em;
    user-select: none;
    box-sizing: border-box;
}

/* HERO TIER: Download (Primary Vibrant Emerald / Cyan) */
.result-actions .action-btn.download-btn {
    background: linear-gradient(135deg, #065f46 0%, #0e7490 50%, #0369a1 100%) !important;
    color: #ffffff !important; /* ciemniejszy gradient = kontrast AA (by 3.77 na #059669) */
    border: 1px solid rgba(52, 211, 153, 0.5) !important;
    box-shadow: 0 4px 16px rgba(13, 148, 136, 0.4), 0 0 10px rgba(52, 211, 153, 0.2) !important;
    font-size: 14px;
    font-weight: 800;
}
.result-actions .action-btn.download-btn:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 8px 24px rgba(13, 148, 136, 0.6), 0 0 18px rgba(52, 211, 153, 0.4) !important;
    filter: brightness(1.1);
}

/* HERO TIER: Download Clean Original (Diamond/Gold Aura) */
.result-actions .action-btn.download-clean-btn {
    background: linear-gradient(135deg, #1e1b4b 0%, #4338ca 50%, #b45309 100%) !important;
    color: #ffffff !important;
    border: 1px solid rgba(251, 191, 36, 0.6) !important;
    box-shadow: 0 4px 16px rgba(217, 119, 6, 0.35), 0 0 12px rgba(251, 191, 36, 0.25) !important;
    font-size: 14px;
    font-weight: 800;
}
.result-actions .action-btn.download-clean-btn:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 8px 24px rgba(217, 119, 6, 0.55), 0 0 18px rgba(251, 191, 36, 0.45) !important;
    filter: brightness(1.12);
}
/* cleaned legacy gradient */

/* HERO TIER: Smart Inpaint (Magical Neon Violet / Cyan Sparkle) */
.result-actions .action-btn.inpaint-action-btn {
    background: linear-gradient(135deg, #7c3aed 0%, #9333ea 50%, #2563eb 100%) !important;
    color: #ffffff !important;
    border: 1px solid rgba(192, 132, 252, 0.6) !important;
    box-shadow: 0 4px 18px rgba(147, 51, 234, 0.45), 0 0 12px rgba(192, 132, 252, 0.25) !important;
    font-size: 14px;
    font-weight: 800;
}
.result-actions .action-btn.inpaint-action-btn:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 8px 28px rgba(147, 51, 234, 0.7), 0 0 22px rgba(192, 132, 252, 0.5) !important;
    filter: brightness(1.12);
}

/* HERO TIER: Upload & Inpaint */
.result-actions .action-btn.inpaint-upload-btn {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.9), rgba(51, 65, 85, 0.9)) !important;
    color: #38bdf8 !important;
    border: 1px solid rgba(56, 189, 248, 0.45) !important;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3) !important;
}
.result-actions .action-btn.inpaint-upload-btn:hover {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.98), rgba(71, 85, 105, 0.98)) !important;
    border-color: rgba(56, 189, 248, 0.75) !important;
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(56, 189, 248, 0.25) !important;
}

/* HERO TIER: Cinema View */
.result-actions .action-btn.lightbox-action-btn {
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 60%, #1e293b 100%) !important;
    color: #c7d2fe !important;
    border: 1px solid rgba(129, 140, 248, 0.45) !important;
    box-shadow: 0 4px 14px rgba(49, 46, 129, 0.3) !important;
}
.result-actions .action-btn.lightbox-action-btn:hover {
    background: linear-gradient(135deg, #312e81 0%, #4338ca 60%, #1e293b 100%) !important;
    border-color: rgba(129, 140, 248, 0.75) !important;
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.35) !important;
}

/* UTILITY GHOST TIER: Reuse, Publish, Seed, Copy, Delete */
.result-actions .action-btn.btn-reuse-params,
.result-actions .action-btn.btn-publish-toggle,
.result-actions .action-btn.seed-action-btn,
.result-actions .action-btn.copy-btn {
    background: rgba(15, 23, 42, 0.7) !important;
    color: #cbd5e1 !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    backdrop-filter: blur(8px);
}
.result-actions .action-btn.btn-reuse-params:hover,
.result-actions .action-btn.btn-publish-toggle:hover,
.result-actions .action-btn.seed-action-btn:hover,
.result-actions .action-btn.copy-btn:hover {
    background: rgba(30, 41, 59, 0.85) !important;
    border-color: rgba(255, 255, 255, 0.25) !important;
    color: #f1f5f9 !important;
    transform: translateY(-1px);
}

.result-actions .action-btn.delete-btn {
    background: rgba(239, 68, 68, 0.08) !important;
    color: #fca5a5 !important;
    border: 1px solid rgba(239, 68, 68, 0.22) !important;
}
.result-actions .action-btn.delete-btn:hover {
    background: rgba(239, 68, 68, 0.2) !important;
    border-color: rgba(239, 68, 68, 0.45) !important;
    color: #fecaca !important;
    transform: translateY(-1px);
}

/* Interactive click-to-cinema hover on result image */
.result-image-frame {
    position: relative;
    cursor: zoom-in !important;
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s ease;
}
.result-image-frame:hover {
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.8), 0 0 30px rgba(56, 189, 248, 0.25);
}
.result-image-frame::after {
    content: "🔍 Cinema View";
    position: absolute;
    bottom: 12px;
    right: 12px;
    background: rgba(15, 23, 42, 0.75);
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: #e2e8f0;
    font-size: 11px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 20px;
    backdrop-filter: blur(8px);
    opacity: 0;
    transform: translateY(4px);
    transition: all 0.2s ease;
    pointer-events: none;
    z-index: 5;
}
.result-image-frame:hover::after {
    opacity: 1;
    transform: translateY(0);
}

/* ==========================================================================
   FULLSCREEN CINEMA LIGHTBOX MODAL
   ========================================================================== */
dialog.lightbox-modal {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    max-width: 100vw;
    max-height: 100vh;
    margin: 0;
    padding: 0;
    background: rgba(5, 7, 15, 0.94);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: none;
    z-index: 99999;
    display: none;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

dialog.lightbox-modal[open] {
    display: flex !important;
    animation: cinemaFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes cinemaFadeIn {
    from { opacity: 0; transform: scale(0.98); }
    to { opacity: 1; transform: scale(1); }
}

.lightbox-modal-box {
    width: 95vw;
    max-width: 1400px;
    height: 94vh;
    display: flex;
    flex-direction: column;
    background: rgba(15, 23, 42, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 16px;
    box-shadow: 0 25px 70px rgba(0, 0, 0, 0.85), 0 0 40px rgba(56, 189, 248, 0.12);
    overflow: hidden;
    position: relative;
}

.lightbox-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(10, 15, 30, 0.7);
    flex-shrink: 0;
}

.lightbox-title-group h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 800;
    color: #f8fafc;
    display: flex;
    align-items: center;
    gap: 8px;
}

.lightbox-meta-info {
    font-size: 11px;
    color: #94a3b8;
    margin-top: 2px;
}

.lightbox-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.lightbox-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.16);
    color: #f1f5f9;
    padding: 7px 14px;
    border-radius: 8px;
    font-size: 12.5px;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.18s ease;
}
.lightbox-action-btn:hover {
    background: rgba(255, 255, 255, 0.16);
    transform: translateY(-1px);
}

.lightbox-action-btn.inpaint-highlight {
    background: linear-gradient(135deg, #7c3aed, #2563eb);
    border-color: rgba(192, 132, 252, 0.5);
    color: #fff;
    box-shadow: 0 4px 14px rgba(124, 58, 237, 0.35);
}
.lightbox-action-btn.inpaint-highlight:hover {
    filter: brightness(1.15);
}

.lightbox-stage {
    position: relative;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    overflow: auto;
    background: radial-gradient(circle at center, rgba(15, 23, 42, 0.4) 0%, rgba(5, 7, 15, 0.9) 100%);
}

.lightbox-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(56, 189, 248, 0.35);
    color: #f1f5f9;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.lightbox-nav-btn:hover {
    background: rgba(56, 189, 248, 0.25);
    border-color: #38bdf8;
    color: #38bdf8;
    box-shadow: 0 0 25px rgba(56, 189, 248, 0.45);
    transform: translateY(-50%) scale(1.08);
}

.lightbox-nav-btn:active {
    transform: translateY(-50%) scale(0.95);
}

.lightbox-nav-btn.prev {
    left: 20px;
}

.lightbox-nav-btn.next {
    right: 20px;
}

.lightbox-nav-btn.disabled,
.lightbox-nav-btn:disabled {
    opacity: 0.2;
    cursor: not-allowed;
    pointer-events: none;
}

.lightbox-nav-counter {
    font-size: 11px;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
    color: #38bdf8;
    background: rgba(56, 189, 248, 0.12);
    padding: 2px 8px;
    border-radius: 12px;
    border: 1px solid rgba(56, 189, 248, 0.25);
}

.lightbox-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 16px 50px rgba(0, 0, 0, 0.85), 0 0 30px rgba(56, 189, 248, 0.1);
    transition: transform 0.22s cubic-bezier(0.2, 0, 0, 1);
    cursor: zoom-in;
    user-select: none;
}

.lightbox-image.zoomed {
    transform: scale(2.2);
    cursor: zoom-out;
}

.lightbox-footer {
    padding: 10px 20px;
    background: rgba(10, 15, 30, 0.7);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
}

.lightbox-prompt-text {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    color: #cbd5e1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

/* ==========================================================================
   ADMIN CURATOR DESK & DATASET QUALITY GATE
   ========================================================================== */
.afb-curator-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    flex-wrap: wrap;
}

.afb-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 700;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.18s ease;
    border: none;
    user-select: none;
}

.afb-approve-btn {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.35);
}
.afb-approve-btn:hover {
    background: rgba(16, 185, 129, 0.3);
    border-color: rgba(16, 185, 129, 0.65);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
}

.afb-reject-btn {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.35);
}
.afb-reject-btn:hover {
    background: rgba(239, 68, 68, 0.3);
    border-color: rgba(239, 68, 68, 0.65);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.25);
}

.afb-inpaint-btn {
    background: rgba(139, 92, 246, 0.15);
    color: #c084fc;
    border: 1px solid rgba(139, 92, 246, 0.35);
}
.afb-inpaint-btn:hover {
    background: rgba(139, 92, 246, 0.3);
    border-color: rgba(139, 92, 246, 0.65);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.25);
}

.afb-status-badge.curator-approved {
    background: rgba(16, 185, 129, 0.25);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.5);
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
}

.afb-status-badge.curator-rejected {
    background: rgba(239, 68, 68, 0.25);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.5);
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
}

/* ======================================================================
   FURSONA CONVERSATIONAL DIRECTOR AGI STYLES (RAIN CITY CORTEX)
   ====================================================================== */
.director-mode-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.25), rgba(6, 182, 212, 0.25));
    border: 1px solid rgba(139, 92, 246, 0.45);
    color: #ffffff;
    font-size: 13px;
    font-weight: 700;
    padding: 7px 16px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.25s ease;
    position: relative;
    box-shadow: 0 4px 14px rgba(139, 92, 246, 0.2);
}
.director-mode-toggle-btn:hover {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.45), rgba(6, 182, 212, 0.45));
    border-color: rgba(6, 182, 212, 0.7);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(6, 182, 212, 0.35);
}
.director-mode-toggle-btn.active {
    background: linear-gradient(135deg, #8b5cf6, #06b6d4);
    border-color: #38bdf8;
    color: #ffffff;
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.6);
}
.director-pulse-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #00ffcc;
    box-shadow: 0 0 8px #00ffcc;
    animation: pulseDirector 1.6s infinite ease-in-out;
}
@keyframes pulseDirector {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.4); opacity: 0.6; }
}

/* Director Chat Workspace Layout */
.director-chat-workspace {
    width: 100%;
    max-width: 1360px;
    margin: 0 auto;
    display: flex;
    flex-direction: row;
    gap: 16px;
    height: calc(100vh - 105px);
    min-height: 460px;
}

/* Chat Threads Sidebar - Sleek Off-Canvas Drawer (Desktop & Global) */
.director-sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: 320px;
    max-width: 90vw;
    height: 100vh;
    background: rgba(10, 14, 24, 0.98);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-right: 1px solid rgba(56, 189, 248, 0.35);
    border-radius: 0 16px 16px 0;
    box-shadow: 20px 0 60px rgba(0, 0, 0, 0.9);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 99999;
    transform: translateX(0);
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease;
    opacity: 1;
    pointer-events: auto;
    box-sizing: border-box;
}
.director-sidebar.collapsed {
    transform: translateX(-105%);
    opacity: 0;
    pointer-events: none;
}
.sidebar-header {
    padding: 16px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    gap: 10px;
}
.btn-new-chat {
    position: relative;
    flex: 1;
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.2), rgba(139, 92, 246, 0.2));
    border: 1px solid rgba(56, 189, 248, 0.4);
    color: #ffffff;
    font-size: 13px;
    font-weight: 600;
    padding: 12px 14px;
    min-height: 44px; /* UX: tap target (audyt a11y 14:10: 37px -> HERMES-1: 44) */
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
}
.btn-new-chat:hover {
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.35), rgba(139, 92, 246, 0.35));
    border-color: rgba(56, 189, 248, 0.7);
    box-shadow: 0 0 16px rgba(56, 189, 248, 0.3);
    transform: translateY(-1px);
}
.btn-sidebar-close {
    position: relative;
    display: flex;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #94a3b8;
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    border-radius: 8px;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 15px;
    flex-shrink: 0;
    transition: all 0.2s ease;
}
.btn-sidebar-close:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
    border-color: rgba(239, 68, 68, 0.4);
}
.director-sidebar-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 99998;
    opacity: 0;
    transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: none;
}
.director-sidebar-backdrop.active {
    display: block;
    opacity: 1;
    pointer-events: auto;
}
.sidebar-threads-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.thread-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-radius: 8px;
    color: #94a3b8;
    font-size: 13px;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid transparent;
    transition: all 0.2s ease;
}
.thread-item:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #ffffff;
}
.thread-item.active {
    background: rgba(56, 189, 248, 0.12);
    border-color: rgba(56, 189, 248, 0.4);
    color: #38bdf8;
    font-weight: 600;
}
.thread-item-title {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-right: 8px;
}
.thread-delete-btn {
    background: transparent;
    border: none;
    color: #64748b;
    font-size: 11px;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    opacity: 0;
    transition: opacity 0.2s ease, color 0.2s ease;
}
.thread-item:hover .thread-delete-btn {
    opacity: 1;
}
.thread-delete-btn:hover {
    color: #ef4444;
}

.btn-sidebar-toggle {
    position: relative;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #94a3b8;
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}
.btn-sidebar-toggle:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
}
.director-token-rate-pill {
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid rgba(245, 158, 11, 0.35);
    color: #fbbf24;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.director-chat-container {
    flex: 1;
    background: rgba(13, 18, 31, 0.75);
    backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-xl);
    display: flex;
    flex-direction: column;
    height: 100%;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
    overflow: hidden;
}

/* Director Header */
.director-header-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(15, 23, 42, 0.4);
}
.director-avatar-box {
    position: relative;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1e1b4b, #0f172a);
    border: 2px solid #8b5cf6;
}
.director-brain-icon {
    font-size: 22px;
    color: #a78bfa;
}
.director-avatar-ring {
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 1px solid rgba(139, 92, 246, 0.4);
    animation: rotateRing 8s linear infinite;
}
@keyframes rotateRing {
    100% { transform: rotate(360deg); }
}
.director-info-box {
    flex: 1;
}
.director-title-row {
    display: flex;
    align-items: center;
    gap: 12px;
}
.director-title-row h2 {
    font-size: 18px;
    font-weight: 800;
    color: #ffffff;
    letter-spacing: 0.5px;
}
.director-title-row h2 span {
    color: #38bdf8;
}
.director-badge {
    background: rgba(56, 189, 248, 0.15);
    color: #38bdf8;
    border: 1px solid rgba(56, 189, 248, 0.3);
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 6px;
}
.director-subtext {
    font-size: 12px;
    color: #94a3b8;
    margin-top: 4px;
    line-height: 1.4;
}
.director-stats-pill {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: #10b981;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.25);
    padding: 4px 10px;
    border-radius: 12px;
}
.director-status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #10b981;
}

/* Chat Feed */
.director-messages-feed {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    width: 100%;
    box-sizing: border-box;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    scroll-behavior: smooth;
}
.chat-msg {
    display: flex;
    gap: 14px;
    max-width: 88%;
    min-width: 0;
    box-sizing: border-box;
}
.chat-msg.ai-msg {
    align-self: flex-start;
    max-width: min(850px, 100%);
    width: 100%;
}
.chat-msg.user-msg {
    align-self: flex-end;
    flex-direction: row-reverse;
}
.chat-msg .msg-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(30, 41, 59, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: #38bdf8;
    border: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}
.chat-msg.user-msg .msg-avatar {
    background: rgba(59, 130, 246, 0.3);
    color: #ffffff;
    border-color: rgba(59, 130, 246, 0.5);
}
.msg-body {
    flex: 1 1 0%;
    min-width: 0;
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
    word-break: break-word;
    overflow-wrap: anywhere;
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 14px 18px;
    line-height: 1.5;
    position: relative;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}
.chat-msg.ai-msg .msg-body {
    border-top-left-radius: 4px;
    background: rgba(15, 23, 42, 0.85);
    border-color: rgba(139, 92, 246, 0.2);
}
.chat-msg.user-msg .msg-body {
    border-top-right-radius: 4px;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.35), rgba(15, 23, 42, 0.9));
    border-color: rgba(59, 130, 246, 0.4);
}
.msg-sender {
    font-size: 11px;
    font-weight: 700;
    color: #a78bfa;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.chat-msg.user-msg .msg-sender {
    color: #60a5fa;
    text-align: right;
}
.msg-text {
    font-size: 14px;
    color: #e2e8f0;
    word-break: break-word;
    white-space: pre-wrap;
}

/* Quick suggestions in chat */
.msg-quick-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}
.quick-prompt-pill {
    position: relative;
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #94a3b8;
    font-size: 12px;
    padding: 8px 13px;
    min-height: 44px; /* UX: tap target (audyt a11y 14:10: 30px -> HERMES-1: 44) */
    display: inline-flex;
    align-items: center;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
}
.quick-prompt-pill:hover {
    background: rgba(59, 130, 246, 0.25);
    border-color: rgba(59, 130, 246, 0.5);
    color: #ffffff;
    transform: translateY(-1px);
}

/* Inline Canvas Render in Chat */
.inline-canvas-card {
    margin-top: 14px;
    background: rgba(7, 10, 18, 0.9);
    border: 1px solid rgba(56, 189, 248, 0.35);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}
.inline-canvas-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 14px;
    background: rgba(15, 23, 42, 0.7);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    font-size: 12px;
    font-weight: 600;
}
.inline-canvas-title {
    color: #38bdf8;
    display: flex;
    align-items: center;
    gap: 6px;
}
.inline-canvas-meta {
    color: #94a3b8;
    font-size: 11px;
}
.inline-canvas-image-wrap {
    position: relative;
    width: 100%;
    background: radial-gradient(circle at center, rgba(14, 165, 233, 0.14) 0%, rgba(2, 6, 23, 0.95) 70%);
    border-top: 1px solid rgba(56, 189, 248, 0.2);
    border-bottom: 1px solid rgba(56, 189, 248, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 260px;
    overflow: hidden;
}
.inline-canvas-image-wrap::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(rgba(14, 165, 233, 0.05) 50%, rgba(0, 0, 0, 0.25) 50%),
                linear-gradient(90deg, rgba(255, 0, 128, 0.03), rgba(0, 255, 255, 0.03));
    background-size: 100% 4px, 6px 100%;
    pointer-events: none;
    z-index: 1;
    opacity: 0.6;
}
.inline-canvas-image-wrap.has-image::before {
    display: none !important;
}
.inline-canvas-image-wrap.has-image {
    background: #020617 !important;
}
.inline-canvas-img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: contain;
    max-height: 520px;
    position: relative;
    z-index: 2;
    transition: filter 0.3s ease;
}
.inline-canvas-loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    padding: 30px;
    color: #38bdf8;
    position: relative;
    z-index: 3;
}
.inline-step-progress-bar {
    width: 220px;
    height: 4px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 999px;
    overflow: hidden;
    position: relative;
    margin-top: 4px;
}
.inline-step-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #38bdf8, #818cf8, #c084fc);
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.8);
    transition: width 0.3s ease;
}
.live-stream-badge {
    position: absolute;
    top: 10px;
    right: 12px;
    z-index: 4;
    background: rgba(15, 23, 42, 0.85);
    border: 1px solid rgba(56, 189, 248, 0.4);
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 700;
    color: #38bdf8;
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    gap: 5px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.live-stream-badge .badge-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 8px #22c55e;
    animation: livePulse 1.5s infinite;
}
@keyframes livePulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.85); }
}
.inline-canvas-actions {
    display: flex;
    gap: 8px;
    padding: 10px 14px;
    background: rgba(15, 23, 42, 0.7);
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.inline-act-btn {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #cbd5e1;
    font-size: 11px;
    padding: 5px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.inline-act-btn:hover {
    background: rgba(59, 130, 246, 0.3);
    border-color: rgba(59, 130, 246, 0.6);
    color: #ffffff;
}
.btn-inline-reroll:hover {
    background: rgba(168, 85, 247, 0.25) !important;
    border-color: rgba(168, 85, 247, 0.5) !important;
    color: #e9d5ff !important;
}

/* Chat Input Dock */
.director-input-dock {
    padding: 10px 16px;
    background: rgba(15, 23, 42, 0.6);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.director-aspect-selector {
    display: flex;
    align-items: center;
    gap: 12px;
}
.director-aspect-selector .aspect-label {
    font-size: 12px;
    font-weight: 600;
    color: #94a3b8;
    display: flex;
    align-items: center;
    gap: 6px;
}
.aspect-pills-row {
    display: flex;
    gap: 8px;
}
.director-aspect-pill {
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #94a3b8;
    font-size: 11px;
    font-weight: 600;
    padding: 5px 12px;
    min-height: 44px; /* UX: tap target (audyt a11y ~now: 25px) */
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 5px;
}
.director-aspect-pill:hover {
    background: rgba(59, 130, 246, 0.2);
    border-color: rgba(59, 130, 246, 0.4);
    color: #ffffff;
}
.director-aspect-pill.active {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.3), rgba(6, 182, 212, 0.3));
    border-color: #38bdf8;
    color: #38bdf8;
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.25);
}

.director-input-row {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(7, 10, 18, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-md);
    padding: 8px 12px;
    transition: all 0.2s ease;
}
.director-input-row:focus-within {
    border-color: #8b5cf6;
    box-shadow: 0 0 16px rgba(139, 92, 246, 0.25);
}
#director-chat-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: #ffffff;
    font-size: 14px;
    font-family: inherit;
    resize: none;
    max-height: 120px;
    line-height: 1.4;
}
.director-send-btn {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    border-radius: 10px;
    background: linear-gradient(135deg, #8b5cf6, #3b82f6);
    border: none;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
}
.director-send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 14px rgba(139, 92, 246, 0.4);
}
.director-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Enhanced Aesthetics for FURSONA AGI Viewport */
.director-chat-workspace {
    padding: 0;
}
.director-chat-container {
    border: 1px solid rgba(56, 189, 248, 0.18) !important;
    background: radial-gradient(circle at 50% 0%, rgba(15, 23, 42, 0.95), rgba(7, 10, 18, 0.98)) !important;
    box-shadow: 0 16px 50px rgba(0, 0, 0, 0.7), 0 0 40px rgba(56, 189, 248, 0.06) !important;
}
.director-header-card {
    background: linear-gradient(90deg, rgba(15, 23, 42, 0.8), rgba(30, 41, 59, 0.4)) !important;
    border-bottom: 1px solid rgba(56, 189, 248, 0.15) !important;
}
.director-messages-feed {
    background: transparent;
}
.chat-msg.ai-msg .msg-body {
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.9), rgba(13, 18, 31, 0.95)) !important;
    border: 1px solid rgba(56, 189, 248, 0.2) !important;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35) !important;
}
.chat-msg.user-msg .msg-body {
    background: linear-gradient(135deg, #1e3a8a, #0f172a) !important;
    border: 1px solid rgba(59, 130, 246, 0.5) !important;
    box-shadow: 0 8px 30px rgba(30, 58, 138, 0.25) !important;
}
.director-input-dock {
    background: rgba(13, 18, 31, 0.85) !important;
    border-top: 1px solid rgba(56, 189, 248, 0.15) !important;
}

/* Explicit Workspaces Visibility Overrides (Fixes media query !important collision) */
.studio-workspace.hidden,
#pane-studio.hidden,
.director-chat-workspace.hidden,
#director-chat-workspace.hidden {
    display: none !important;
}

/* Core Desktop & Mobile Workspace View Modes */
body.view-director .studio-workspace,
body.view-director #studio-workspace {
    display: none !important;
}
body.view-director .director-chat-workspace,
body.view-director #director-chat-workspace {
    display: flex !important;
}

body.view-studio .director-chat-workspace,
body.view-studio #director-chat-workspace,
body.view-gallery .director-chat-workspace,
body.view-gallery #director-chat-workspace {
    display: none !important;
}

body.view-studio .studio-workspace,
body.view-studio #studio-workspace {
    display: grid !important;
}
@media (max-width: 900px) {
    body.view-studio .studio-workspace,
    body.view-studio #studio-workspace {
        display: flex !important;
    }
}

body.view-gallery .studio-workspace,
body.view-gallery #studio-workspace {
    display: block !important;
    width: 100% !important;
    max-width: 1920px !important;
    margin: 0 auto !important;
}
body.view-gallery #pane-studio {
    display: none !important;
}
body.view-gallery #pane-viewport {
    width: 100% !important;
    max-width: 100% !important;
}
body.view-gallery #pane-canvas {
    display: none !important;
}
body.view-gallery #pane-history {
    display: none !important;
}
body.view-gallery #pane-gallery {
    display: flex !important;
    width: 100% !important;
}
body.view-gallery .deck-tabs-header {
    display: none !important;
}

/* My Library Dedicated View */
body.view-library .director-chat-workspace,
body.view-library #director-chat-workspace {
    display: none !important;
}

body.view-library .studio-workspace,
body.view-library #studio-workspace {
    display: block !important;
    width: 100% !important;
    max-width: 1920px !important;
    margin: 0 auto !important;
}
body.view-library #pane-studio {
    display: none !important;
}
body.view-library #pane-viewport {
    width: 100% !important;
    max-width: 100% !important;
}
body.view-library #pane-canvas {
    display: none !important;
}
body.view-library #pane-gallery {
    display: none !important;
}
body.view-library #pane-history {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    background: rgba(13, 18, 31, 0.7) !important;
    backdrop-filter: blur(20px) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: var(--radius-lg) !important;
    padding: 22px 28px !important;
    box-shadow: 0 16px 48px -10px rgba(0, 0, 0, 0.5) !important;
    min-height: 650px !important;
    height: auto !important;
    max-height: none !important;
}
body.view-library .history-tray-header {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding-bottom: 16px !important;
    margin-bottom: 18px !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
}
body.view-library .history-tray-title {
    font-size: 18px !important;
    font-weight: 700 !important;
    color: #f8fafc !important;
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
}
body.view-library .history-list {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)) !important;
    gap: 16px !important;
    overflow: visible !important;
    width: 100% !important;
    height: auto !important;
    max-height: none !important;
    padding: 0 !important;
}
body.view-library .history-item {
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 1 / 1 !important;
    min-width: 0 !important;
    min-height: 0 !important;
    border-radius: var(--radius-md) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    overflow: hidden !important;
    position: relative !important;
    background: #0b0f19 !important;
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
}
body.view-library .history-item:hover {
    transform: translateY(-3px) scale(1.02) !important;
    border-color: rgba(56, 189, 248, 0.5) !important;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.6), 0 0 16px rgba(56, 189, 248, 0.2) !important;
}
body.view-library .history-item img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    display: block !important;
}
body.view-library .deck-tabs-header {
    display: none !important;
}

/* ======================================================================
   MOBILE APP-GRADE RESPONSIVE SUITE FOR FURSONA DIRECTOR AGI & STUDIO
   ====================================================================== */
@media (max-width: 900px) {
    /* Mobile Viewport Constraints */
    html {
        width: 100%;
        height: 100%;
    }

    body {
        width: 100% !important;
        min-height: 100dvh !important;
        /* MIEJSCE POD STALE NAKLADKI (kaskada pózniejsza niz linia 4729 -- bez
           tego ostatni element kontentu byl zaslaniany przez mobile-bottom-nav
           56px + mobile-sticky-generate-bar ~122px od dolu). Audit:
           audit_mobile_overlays.py */
        padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 132px) !important;
        position: static !important;
        overflow-x: hidden !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
        background: #070a12 !important;
    }

    /* In Director Mode, lock scroll to viewport so chat behaves like a native app */
    body.director-mode {
        height: 100dvh !important;
        max-height: 100dvh !important;
        overflow: hidden !important;
        padding-bottom: 0 !important;
        position: fixed !important;
        width: 100% !important;
    }

    .ambient-glow-top, .ambient-glow-bottom {
        display: none !important;
    }

    /* Edge-to-Edge Container in Director Mode; Natural container in Studio */
    .app-container {
        width: 100% !important;
        max-width: 100% !important;
        padding: calc(env(safe-area-inset-top, 6px) + 4px) 12px calc(env(safe-area-inset-bottom, 8px) + 70px) 12px !important;
        gap: 8px !important;
        box-sizing: border-box !important;
        display: flex !important;
        flex-direction: column !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
    }

    body.director-mode .app-container {
        height: 100dvh !important;
        max-height: 100dvh !important;
        overflow: hidden !important;
        padding: 0 !important;
        margin: 0 !important;
        gap: 0 !important;
        border: none !important;
    }

    /* Unified Native Single App Bar */
    .studio-header {
        flex-shrink: 0 !important;
        padding: calc(env(safe-area-inset-top, 4px) + 6px) 12px 6px 12px !important;
        gap: 8px !important;
        border-radius: 0 !important;
        background: rgba(10, 14, 24, 0.96) !important;
        backdrop-filter: blur(24px) !important;
        -webkit-backdrop-filter: blur(24px) !important;
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: space-between !important;
        width: 100% !important;
        box-sizing: border-box !important;
        min-height: 48px !important;
        border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
        z-index: 1000 !important;
    }

    .brand {
        display: flex !important;
        align-items: center !important;
        gap: 8px !important;
    }

    /* Mobile Drawer Toggle in Single Top Header */
    .btn-sidebar-toggle-mobile {
        position: relative;
        width: 44px !important;
        height: 44px !important;
        min-width: 44px !important;
        min-height: 44px !important;
        border-radius: 11px !important;
        background: rgba(255, 255, 255, 0.08) !important;
        border: 1px solid rgba(255, 255, 255, 0.16) !important;
        color: #e2e8f0 !important;
        font-size: 17px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        cursor: pointer !important;
        touch-action: manipulation !important;
        transition: background 0.15s ease, transform 0.15s ease, border-color 0.15s ease !important;
    }

    .btn-sidebar-toggle-mobile:active {
        background: rgba(56, 189, 248, 0.3) !important;
        border-color: #38bdf8 !important;
        transform: scale(0.92) !important;
    }

    .brand-logo {
        width: 28px !important;
        height: 28px !important;
        border-radius: 7px !important;
        flex-shrink: 0 !important;
    }

    .brand-logo .logo-symbol {
        font-size: 13px !important;
    }

    .brand-title-row {
        gap: 4px !important;
        align-items: center !important;
    }

    .brand-title-row h1 {
        font-size: 14px !important;
        font-weight: 800 !important;
        letter-spacing: 0.3px !important;
        margin: 0 !important;
    }

    .brand-title-row h1 span {
        color: #38bdf8 !important;
    }

    .brand-version-badge,
    .tagline,
    .system-status,
    .director-mode-toggle-btn {
        display: none !important; /* Managed by bottom navigation dock on mobile */
    }

    /* HERMES-1 (2026-10-12): mobile nie mialo wchodza w Cluster HUD --
       desktop nav (jedyne wejscie do telemetrii) jest display:none <=900px,
       a dolny dock ma tylko 5 zakladek bez telemetrii.
       Minimalny wchod w naglowku: sama plytka ze stepem (brak dodatkowego pill'a). */
    .mobile-hud-entry {
        display: inline-flex !important;
        align-items: center !important;
        gap: 4px !important;
        min-height: 30px !important;
        padding: 4px 8px !important;
        border: 1px solid rgba(56, 189, 248, 0.28) !important;
        border-radius: 9px !important;
        background: rgba(56, 189, 248, 0.10) !important;
        cursor: pointer !important;
        -webkit-tap-highlight-color: transparent !important;
    }

    .mobile-hud-entry:active {
        background: rgba(56, 189, 248, 0.20) !important;
    }

    .mobile-hud-entry i {
        font-size: 11px !important;
        color: #38bdf8 !important;
    }

    .mobile-hud-entry .mobile-hud-step {
        font-family: 'JetBrains Mono', monospace !important;
        font-size: 11px !important;
        font-weight: 700 !important;
        color: #38bdf8 !important;
        line-height: 1 !important;
    }

    .header-right {
        width: auto !important;
        margin-top: 0 !important;
        gap: 6px !important;
        align-items: center !important;
        min-width: 0 !important;
        max-width: 100% !important;
        flex: 0 1 auto !important;
    }

    /* FIX HERMES-1 (2026-10-14): header-right mierzyl 409px przy viewporcie
       375px -- pilulka dzwieku (ikona + tekst 'Rain Sound: OFF') wypychala
       auth-bar za ekran, imie i drops byly uciete. Na mobile pilulka
       ikonowa: tekst ukryty, rozmiar zachowany (tap target OK). */
    .rc-audio-pill {
        padding: 6px 10px !important;
        min-width: 44px !important;
        min-height: 44px !important;
        justify-content: center !important;
    }

    .rc-audio-pill #rcAmbState {
        display: none !important;
    }

    .auth-bar {
        display: flex !important;
        align-items: center !important;
        gap: 6px !important;
        min-width: 0 !important;
        max-width: 100% !important;
        /* FIX HERMES-1 (cykl 05:2x): .auth-bar (#auth-container) nie mial
           flex-wrap -- na 320px po zminiaturyzowaniu guest bar (2x44px +
           gap 6px = 94px) w containterze 5px NIE miescil sie nawet 1
           przycisk: oba buttony renderowaly sie na left=284 (obok siebie,
           zero wysokosci) i wystawaly 8px za viewport. Wrap pozwala
           przyciskowi spaść do nowej linii zamiast poza ekran.
           Verify: _hermes1_mobile_audit2.py offenderCount=0 na 320px. */
        flex-wrap: wrap !important;
        justify-content: flex-end !important;
    }

    .auth-bar .auth-buttons-wrap {
        min-width: 0 !important;
        max-width: 100% !important;
        flex: 0 1 auto !important;
        gap: 6px !important;
        flex-wrap: wrap !important;
        justify-content: flex-end !important;
    }

    .auth-bar .discord-login-btn,
    .auth-buttons-wrap .discord-login-btn {
        min-width: 44px !important;
        min-height: 44px !important;
        padding: 6px 10px !important;
        justify-content: center !important;
    }

    .auth-bar .discord-login-btn > span,
    .auth-buttons-wrap .discord-login-btn > span {
        display: none !important;
    }

    .auth-bar .dev-admin-btn,
    .auth-buttons-wrap .dev-admin-btn {
        min-width: 44px !important;
        min-height: 44px !important;
        padding: 6px 10px !important;
        justify-content: center !important;
    }

    .auth-bar .dev-admin-btn > span,
    .auth-buttons-wrap .dev-admin-btn > span {
        display: none !important;
    }

    /* FIX HERMES-1 (2026-10-14): na 375px badge (avatar+imie+drops)
       mierzyl 305px i startowal na left=321 -> 24px ucinane za ekranem
       (imie i drops niewidoczne). Badge moze sie kurczyc, a nazwa
       uzytkownika przycinac sie wielokropkiem zamiast wypychac layout. */
    .auth-bar .user-profile-badge,
    .auth-bar .auth-user-chip {
        min-width: 0 !important;
        max-width: 100% !important;
        flex: 0 1 auto !important;
        padding-left: 4px !important;
        padding-right: 8px !important;
        gap: 8px !important;
    }

    .auth-bar .user-meta {
        min-width: 0 !important;
    }

    .auth-bar .user-name,
    .auth-bar .auth-user-name {
        min-width: 0 !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
        /* FIX HERMES-1 (cykl 19:05 faza 3): 90px -> 64px. Na 375px badge
           wypychal logout-link na left=378 (3px za ekranem). Scisniety
           imie i drops zwalniaja ~40px, ellipsis zachowany. */
        max-width: 64px !important;
    }

    .auth-bar .drops-badge,
    .auth-bar .auth-user-drops-badge {
        flex-shrink: 0 !important;
        font-size: 10.5px !important;
        padding: 1px 5px !important;
    }

    /* FIX HERMES-1 (2026-10-14 cykl 19:05): na 375px header-right mierzyl
       449px (admin-trigger-btn 61px + logout-link 72px + badge wypychaly
       layout) -> body scrollWidth 449 > 375 = poziomy scroll na calym
       porciele. Admin pill staje sie ikonowy jak rc-audio-pill (tekst
       ukryty, tap 44px zachowany), logout-link ciasniejszy padding.
       Verify: mobile_ux_check.py -> bodyScrollW <= 375, scrollW == clientW. */
    .auth-bar .admin-trigger-btn {
        min-width: 44px !important;
        padding: 5px 8px !important;
        font-size: 0 !important;
        display: inline-flex !important;
        justify-content: center !important;
    }

    .auth-bar .admin-trigger-btn .fa-crown {
        font-size: 14px !important;
    }

    .auth-bar .logout-link {
        padding: 0 8px !important;
        margin-left: 0 !important;
    }

    /* FIX HERMES-1 (cykl 19:05 faza 2): logout-link mierzyl wciaz 44px na
       left=378 przy viewporcie 375 -- jak rc-audio-pill staje sie ikonowy
       (tekst ukryty w .logout-text, tap 44px zachowany). */
    .auth-bar .logout-link .logout-text {
        display: none !important;
    }

    .auth-bar .logout-link i.fa-right-from-bracket {
        font-size: 14px !important;
    }

    /* FIX HERMES-1 (cykl 19:05 faza 4): user-meta ma width 0 (imie+drops
       ukryte) a admin-icon + logout (2x44px) nie mieszcza sie w badge
       67px -- logout wychodzil na left=378 (3px za 375). Badge wrap'uje:
       logout spada do nowej linii zamiast poza ekran, avatar 28px,
       gap 2px. Verify: mobile_ux_check.py overflowCount=0 na 375. */
    .auth-bar .user-profile-badge {
        flex-wrap: wrap !important;
        gap: 2px !important;
        justify-content: flex-end !important;
    }

    .auth-bar .user-avatar {
        width: 28px !important;
        height: 28px !important;
    }

    .auth-user-chip {
        padding: 3px 8px !important;
        gap: 6px !important;
        border-radius: 9999px !important;
        background: rgba(15, 23, 42, 0.9) !important;
        border: 1px solid rgba(255, 255, 255, 0.1) !important;
    }

    .auth-user-avatar {
        width: 24px !important;
        height: 24px !important;
        border-radius: 50% !important;
    }

    .auth-user-name {
        display: none !important;
    }

    .auth-user-drops-badge {
        font-size: 10.5px !important;
        font-weight: 700 !important;
        padding: 2px 6px !important;
        background: rgba(56, 189, 248, 0.18) !important;
        color: #38bdf8 !important;
        border-radius: 9999px !important;
    }

    .auth-admin-badge {
        font-size: 9px !important;
        padding: 1px 4px !important;
    }

    .btn-logout {
        padding: 4px 6px !important;
        font-size: 11px !important;
    }

    /* Eliminate Duplicate Header Card in Director Chat */
    .director-header-card {
        display: none !important;
    }

    /* Director Chat Workspace takes exact edge-to-edge remaining height */
    .director-chat-workspace {
        flex: 1 1 0% !important;
        min-height: 0 !important;
        height: calc(100dvh - 48px) !important;
        max-height: calc(100dvh - 48px) !important;
        gap: 0 !important;
        padding: 0 !important;
        position: relative !important;
        display: flex;
        overflow: hidden !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    /* Fullscreen Backdrop for mobile conversations drawer */
    .director-sidebar-backdrop {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100% !important;
        height: 100dvh !important;
        background: rgba(0, 0, 0, 0.78) !important;
        backdrop-filter: blur(8px) !important;
        -webkit-backdrop-filter: blur(8px) !important;
        z-index: 99998 !important;
        display: none !important;
        opacity: 0 !important;
        pointer-events: none !important;
        transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1) !important;
    }

    .director-sidebar-backdrop.active {
        display: block !important;
        opacity: 1 !important;
        pointer-events: auto !important;
    }

    /* Off-canvas slide-out sidebar for mobile conversations */
    .director-sidebar {
        position: fixed !important;
        top: 0 !important;
        bottom: 0 !important;
        left: 0 !important;
        width: 84% !important;
        max-width: 320px !important;
        height: 100dvh !important;
        z-index: 99999 !important;
        box-shadow: 16px 0 50px rgba(0, 0, 0, 0.95) !important;
        background: rgba(10, 14, 24, 0.98) !important;
        border-right: 1px solid rgba(56, 189, 248, 0.35) !important;
        border-radius: 0 16px 16px 0 !important;
        transform: translateX(0) !important;
        transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease !important;
        opacity: 1 !important;
        pointer-events: auto !important;
        box-sizing: border-box !important;
    }

    .director-sidebar.collapsed {
        transform: translateX(-105%) !important;
        opacity: 0 !important;
        pointer-events: none !important;
    }

    .sidebar-header {
        display: flex !important;
        align-items: center !important;
        gap: 8px !important;
        padding: calc(env(safe-area-inset-top, 6px) + 12px) 14px 12px !important;
        border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
    }

    .btn-new-chat {
        flex: 1 !important;
        padding: 9px 12px !important;
        font-size: 13px !important;
        font-weight: 700 !important;
        border-radius: 10px !important;
    }

    .btn-sidebar-close {
        display: flex !important;
        width: 36px !important;
        height: 36px !important;
        align-items: center !important;
        justify-content: center !important;
        border-radius: 8px !important;
        background: rgba(255, 255, 255, 0.08) !important;
        color: #94a3b8 !important;
        font-size: 16px !important;
        cursor: pointer !important;
    }

    .sidebar-threads-list {
        padding: 10px 8px !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }

    /* Edge-to-Edge Chat Container */
    .director-chat-container {
        display: flex !important;
        flex-direction: column !important;
        width: 100% !important;
        height: 100% !important;
        min-height: 0 !important;
        border-radius: 0 !important;
        border: none !important;
        background: #080d1a !important;
        box-shadow: none !important;
        overflow: hidden !important;
        box-sizing: border-box !important;
    }

    /* Messages feed fills middle screen with absolute horizontal constraint */
    .director-messages-feed {
        flex: 1 1 0% !important;
        min-height: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        overflow-x: hidden !important;
        overflow-y: auto !important;
        overscroll-behavior: contain !important;
        -webkit-overflow-scrolling: touch !important;
        padding: 12px 10px 8px 10px !important;
        gap: 12px !important;
        box-sizing: border-box !important;
    }

    .chat-msg {
        display: flex !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        gap: 8px !important;
        box-sizing: border-box !important;
    }

    .chat-msg.ai-msg {
        align-self: flex-start !important;
        width: 100% !important;
        max-width: 100% !important;
    }

    .chat-msg.user-msg {
        align-self: flex-end !important;
        width: auto !important;
        max-width: 88% !important;
    }

    .msg-avatar {
        width: 28px !important;
        height: 28px !important;
        min-width: 28px !important;
        min-height: 28px !important;
        font-size: 12px !important;
        flex-shrink: 0 !important;
    }

    .msg-body {
        flex: 1 1 0% !important;
        min-width: 0 !important;
        width: auto !important;
        max-width: 100% !important;
        padding: 10px 12px !important;
        border-radius: 14px !important;
        box-sizing: border-box !important;
        overflow: hidden !important;
        word-break: break-word !important;
        overflow-wrap: anywhere !important;
    }

    .chat-msg.user-msg .msg-body {
        width: auto !important;
        max-width: 100% !important;
    }

    .chat-msg.ai-msg .msg-body {
        background: rgba(15, 23, 42, 0.92) !important;
        border: 1px solid rgba(139, 92, 246, 0.3) !important;
        border-top-left-radius: 4px !important;
    }

    .chat-msg.user-msg .msg-body {
        background: linear-gradient(135deg, rgba(37, 99, 235, 0.45), rgba(30, 41, 59, 0.85)) !important;
        border: 1px solid rgba(59, 130, 246, 0.35) !important;
        border-top-right-radius: 4px !important;
    }

    .msg-text {
        font-size: 13.5px !important;
        line-height: 1.45 !important;
        word-break: break-word !important;
        overflow-wrap: anywhere !important;
        max-width: 100% !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    /* Mobile Clean Action Cards (Zero horizontal clipping, full visibility) */
    .msg-quick-suggestions {
        display: flex !important;
        flex-direction: column !important;
        gap: 7px !important;
        margin-top: 12px !important;
        padding: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        overflow: visible !important;
    }

    .msg-quick-suggestions::-webkit-scrollbar {
        display: none !important;
    }

    .quick-prompt-pill {
        display: flex !important;
        align-items: center !important;
        justify-content: flex-start !important;
        width: 100% !important;
        max-width: 100% !important;
        white-space: normal !important;
        word-break: break-word !important;
        text-align: left !important;
        padding: 8px 12px !important;
        font-size: 12.5px !important;
        line-height: 1.35 !important;
        font-weight: 500 !important;
        border-radius: 10px !important;
        background: rgba(30, 41, 59, 0.75) !important;
        border: 1px solid rgba(56, 189, 248, 0.28) !important;
        color: #e2e8f0 !important;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25) !important;
        transition: background 0.15s ease, border-color 0.15s ease !important;
    }

    .quick-prompt-pill:active {
        background: rgba(56, 189, 248, 0.25) !important;
        border-color: #38bdf8 !important;
        color: #ffffff !important;
        transform: scale(0.98) !important;
    }

    /* Sticky Input Dock Above Bottom Nav */
    .director-input-dock {
        flex-shrink: 0 !important;
        padding: 6px 10px calc(env(safe-area-inset-bottom, 4px) + 60px) 10px !important;
        gap: 6px !important;
        background: rgba(7, 10, 18, 0.96) !important;
        backdrop-filter: blur(24px) !important;
        -webkit-backdrop-filter: blur(24px) !important;
        border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
        box-sizing: border-box !important;
    }

    /* Segmented Aspect Ratio Control */
    .director-aspect-selector {
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
        gap: 0 !important;
    }

    .director-aspect-selector .aspect-label {
        display: none !important; /* Hide verbose label on mobile */
    }

    .aspect-pills-row {
        display: inline-flex !important;
        background: rgba(15, 23, 42, 0.85) !important;
        border: 1px solid rgba(255, 255, 255, 0.1) !important;
        border-radius: 12px !important;
        padding: 2px !important;
        gap: 3px !important;
        overflow: visible !important;
    }

    .director-aspect-pill {
        padding: 4px 10px !important;
        font-size: 11px !important;
        font-weight: 700 !important;
        white-space: nowrap !important;
        border-radius: 9px !important;
        border: none !important;
        background: transparent !important;
        color: #94a3b8 !important;
        transition: all 0.15s ease !important;
        cursor: pointer !important;
    }

    .director-aspect-pill.active {
        background: linear-gradient(135deg, rgba(56, 189, 248, 0.28), rgba(129, 140, 248, 0.32)) !important;
        color: #38bdf8 !important;
        box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4) !important;
    }

    /* Floating Pill Chat Input */
    .director-input-row {
        padding: 4px 5px 4px 14px !important;
        border-radius: 26px !important;
        gap: 6px !important;
        align-items: flex-end !important;
        background: rgba(15, 23, 42, 0.95) !important;
        border: 1.5px solid rgba(56, 189, 248, 0.32) !important;
        box-shadow: 0 4px 18px rgba(0, 0, 0, 0.5) !important;
    }

    .director-input-row:focus-within {
        border-color: #38bdf8 !important;
        box-shadow: 0 0 14px rgba(56, 189, 248, 0.35) !important;
    }

    #director-chat-input {
        font-size: 15px !important; /* Prevents iOS auto-zoom */
        min-height: 36px !important;
        max-height: 90px !important;
        padding: 7px 2px !important;
        line-height: 1.35 !important;
        resize: none !important;
        scrollbar-width: none !important;
        border: none !important;
        background: transparent !important;
        color: #ffffff !important;
    }

    #director-chat-input::-webkit-scrollbar {
        display: none !important;
    }

    .director-send-btn {
        width: 44px !important;
        height: 44px !important;
        min-width: 44px !important;
        min-height: 44px !important;
        border-radius: 50% !important;
        background: linear-gradient(135deg, #38bdf8, #818cf8) !important;
        color: #020617 !important;
        font-size: 16px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        flex-shrink: 0 !important;
        touch-action: manipulation !important;
        border: none !important;
        cursor: pointer !important;
        margin-bottom: 2px !important;
        transition: transform 0.15s ease, box-shadow 0.15s ease !important;
        box-shadow: 0 2px 10px rgba(56, 189, 248, 0.4) !important;
    }

    .director-send-btn:active {
        transform: scale(0.90) !important;
    }

    /* High-contrast Frosted Glass Bottom Navigation Dock */
    .mobile-bottom-nav {
        height: 56px !important;
        min-height: 56px !important;
        padding: 0 4px calc(env(safe-area-inset-bottom, 2px)) !important;
        background: rgba(7, 10, 18, 0.98) !important;
        backdrop-filter: blur(24px) !important;
        -webkit-backdrop-filter: blur(24px) !important;
        border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
        z-index: 9999 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: space-around !important;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.7) !important;
    }

    .mobile-nav-btn {
        padding: 4px 0 !important;
        gap: 3px !important;
        touch-action: manipulation !important;
        flex: 1 !important;
        border: none !important;
        background: transparent !important;
        color: #7e8ba3 !important; /* WCAG AA: 5.76:1 na tle #070a12 */
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        transition: color 0.15s ease, transform 0.15s ease !important;
    }

    .mobile-nav-btn i {
        font-size: 16px !important;
        transition: transform 0.15s ease !important;
    }

    .mobile-nav-btn span {
        font-size: 10px !important;
        font-weight: 700 !important;
        letter-spacing: 0.3px !important;
    }

    .mobile-nav-btn.active {
        color: #38bdf8 !important;
    }

    .mobile-nav-btn.active i {
        transform: scale(1.15) !important;
        filter: drop-shadow(0 0 6px rgba(56, 189, 248, 0.6)) !important;
    }

    /* Inline canvas card in mobile chat */
    .inline-canvas-card {
        margin-top: 8px !important;
        border-radius: 12px !important;
        overflow: hidden !important;
    }

    .inline-canvas-header {
        padding: 6px 10px !important;
        font-size: 11.5px !important;
    }

    .inline-canvas-image-wrap {
        min-height: 200px !important;
        max-width: 100% !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    .inline-canvas-image-wrap img {
        max-width: 100% !important;
        height: auto !important;
        object-fit: contain !important;
        border-radius: 8px !important;
    }

    .inline-canvas-actions {
        padding: 6px 10px !important;
        flex-wrap: wrap !important;
        gap: 6px !important;
    }

    .inline-act-btn {
        flex: 1 1 auto !important;
        justify-content: center !important;
        padding: 6px 10px !important;
        font-size: 11px !important;
    }

    /* Studio Controls Pane Polish */
    .controls-panel {
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
    }

    .studio-section {
        background: rgba(13, 18, 31, 0.85) !important;
        border: 1px solid rgba(255, 255, 255, 0.08) !important;
        border-radius: 12px !important;
        padding: 12px !important;
        margin-bottom: 10px !important;
    }

    /* Sticky Mobile Generate Bar */
        .mobile-sticky-generate-bar {
            bottom: 58px !important;
            z-index: 9998 !important;
            background: rgba(7, 10, 18, 0.96) !important;
            backdrop-filter: blur(20px) !important;
            border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
        }

        /* FIX HERMES-1 (cykl 05:2x): GUEST bar (niezalogowany user) nie byl
           objety zadnym z poprzednich fixow (te naprawialy TYLKO badge
           zalogowanego usera). .auth-buttons-wrap z "Login with Discord"
           (114px) + "Dev Admin" (113px) + gap 8px = 235px startowal na
           left=284 -> right=397 = 37px POZA ekranem na 360px (przycisk
           uciety, nieklikalny). Audyt CDP (_hermes1_mobile_audit2.py):
           offenderCount=8 na 360px i 320px. Fix: wrap kurczy sie do 100%,
           oba przyciski staja sie ikonowe (tekst ukryty, tap 44px
           zachowany), identyczny wzorzec co .admin-trigger-btn wyzej.
           Verify: _hermes1_mobile_audit2.py offenderCount=0 na 360/320. */
        .auth-buttons-wrap {
            min-width: 0 !important;
            max-width: 100% !important;
            flex: 0 1 auto !important;
            gap: 6px !important;
        }

        .auth-buttons-wrap .discord-login-btn {
            min-width: 44px !important;
            min-height: 44px !important;
            padding: 6px 10px !important;
            justify-content: center !important;
        }

        .auth-buttons-wrap .discord-login-btn > span {
            display: none !important;
        }

        .auth-buttons-wrap .dev-admin-btn {
            min-width: 44px !important;
            min-height: 44px !important;
            padding: 6px 10px !important;
            justify-content: center !important;
        }

        .auth-buttons-wrap .dev-admin-btn > span {
            display: none !important;
        }
}


/* ==========================================================================
   RAINCITY CINEMATIC NEO-NOIR UPGRADE (Transplanted from Desktop RAINCITY)
   ========================================================================== */
@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,600;0,700;1,600&family=Cinzel:wght@600;700;800;900&family=JetBrains+Mono:wght@400;500;700&display=swap');

:root {
    --rc-bg-deep: #030710;
    --rc-bg-surface: #070d1a;
    --rc-card-glass: rgba(11, 20, 38, 0.82);
    --rc-card-border: rgba(91, 168, 255, 0.16);
    --rc-card-border-glow: rgba(91, 168, 255, 0.45);
    --rc-blue: #5ba8ff;
    --rc-cyan: #06b6d4;
    --rc-amber: #dfb050;
    --rc-purple: #a855f7;
    --rc-crimson: #f43f5e;
    --rc-font-serif: 'Cormorant Garamond', Georgia, serif;
    --rc-font-cinzel: 'Cinzel', serif;
}

body {
    background: radial-gradient(ellipse 90% 70% at 50% 0%, #09152b 0%, #030710 75%, #010408 100%) !important;
    background-attachment: fixed !important;
}

/* 60FPS Rain Canvas Overlays */
#rcRainCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 1;
    display: block;
    opacity: 0.65;
}

/* Header Re-styling in Cinematic Rain City Aesthetic */
.studio-header {
    background: linear-gradient(135deg, rgba(11, 20, 38, 0.88), rgba(7, 13, 26, 0.94)) !important;
    border: 1px solid var(--rc-card-border) !important;
    box-shadow: 0 16px 40px -10px rgba(0, 0, 0, 0.8), 0 0 30px rgba(91, 168, 255, 0.12) !important;
}

#app-brand-title {
    font-family: var(--rc-font-cinzel) !important;
    letter-spacing: 2px !important;
    text-transform: uppercase !important;
    background: linear-gradient(135deg, #ffffff 30%, #5ba8ff 80%, #a855f7 100%) !important;
    -webkit-background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
}

.brand-version-badge {
    background: rgba(91, 168, 255, 0.12) !important;
    border: 1px solid rgba(91, 168, 255, 0.35) !important;
    color: #93c5fd !important;
    font-family: 'JetBrains Mono', monospace !important;
    text-shadow: 0 0 8px rgba(91, 168, 255, 0.5) !important;
}

/* Director Mode & Studio Chat Containers */
.director-chat-container {
    background: radial-gradient(circle at 50% 0%, rgba(13, 24, 46, 0.88), rgba(5, 9, 18, 0.96)) !important;
    border: 1px solid var(--rc-card-border) !important;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8), 0 0 35px rgba(91, 168, 255, 0.14) !important;
}

.chat-msg.ai-msg .msg-body {
    background: linear-gradient(145deg, rgba(13, 24, 46, 0.92), rgba(8, 14, 28, 0.96)) !important;
    border: 1px solid rgba(91, 168, 255, 0.25) !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45), 0 0 15px rgba(91, 168, 255, 0.08) !important;
    border-radius: 16px !important;
}

.chat-msg.user-msg .msg-body {
    background: linear-gradient(145deg, rgba(37, 99, 235, 0.85), rgba(29, 78, 216, 0.92)) !important;
    border: 1px solid rgba(147, 197, 253, 0.35) !important;
    box-shadow: 0 8px 24px rgba(37, 99, 235, 0.3) !important;
}

/* Inline Synthesized Canvas Art Cards */
.inline-canvas-card {
    background: linear-gradient(180deg, rgba(15, 26, 50, 0.95), rgba(6, 11, 22, 0.98)) !important;
    border: 1px solid rgba(91, 168, 255, 0.35) !important;
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.75), 0 0 30px rgba(91, 168, 255, 0.18) !important;
    border-radius: 16px !important;
}

.inline-canvas-header {
    border-bottom: 1px solid rgba(91, 168, 255, 0.2) !important;
    background: rgba(9, 16, 32, 0.7) !important;
}

.inline-act-btn {
    background: rgba(14, 26, 52, 0.85) !important;
    border: 1px solid rgba(91, 168, 255, 0.25) !important;
    color: #e2e8f0 !important;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.inline-act-btn:hover {
    background: rgba(37, 99, 235, 0.45) !important;
    border-color: #60a5fa !important;
    color: #ffffff !important;
    box-shadow: 0 0 16px rgba(91, 168, 255, 0.4) !important;
    transform: translateY(-1px) !important;
}

/* Sound Ambient Controller Pill in Header */
.rc-audio-pill {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(11, 20, 38, 0.85);
    border: 1px solid var(--rc-card-border);
    border-radius: 20px;
    padding: 6px 14px;
    min-height: 44px;
    color: #94a3b8;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.25s ease;
}
.rc-audio-pill:hover {
    border-color: var(--rc-blue);
    color: #f8fafc;
    box-shadow: 0 0 14px rgba(91, 168, 255, 0.25);
}
.rc-audio-pill.active {
    border-color: #38bdf8;
    color: #38bdf8;
    background: rgba(56, 189, 248, 0.12);
}



/* ==========================================================================
   DESKTOP SEGMENTED NAVIGATION & SOVEREIGN CLUSTER HUD (V14.0 REFACTOR)
   ========================================================================== */

.desktop-nav-segmented {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(9, 14, 26, 0.75);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 30px;
    padding: 4px;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.4), 0 4px 20px rgba(0, 0, 0, 0.3);
}

.nav-segment-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 18px;
    min-height: 44px; /* UX: dotykowy target -- audyt a11y 14:10 zgłaszal 28px, HERMES-1: 44 */
    border-radius: 24px;
    font-size: 13px;
    font-weight: 600;
    color: #94a3b8;
    background: transparent;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
    white-space: nowrap;
}

.nav-segment-btn:hover {
    color: #f8fafc;
    background: rgba(255, 255, 255, 0.05);
}

.nav-segment-btn.active {
    color: #ffffff;
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.22), rgba(139, 92, 246, 0.22));
    border-color: rgba(56, 189, 248, 0.4);
    box-shadow: 0 0 16px rgba(56, 189, 248, 0.25);
}

.nav-segment-btn i {
    font-size: 14px;
}

.nav-segment-btn.active i {
    color: #38bdf8;
}

/* === HIT-AREA EXPANSION (a11y: tap targets >= 44x44 na desktop) ===
   Pseudo-elementy rozszerzaja obszar kliknięcia bez zmiany wizualnego layoutu.
   Dodane przez HERMES-1 po audycie a11y (19 tap_issues < 44px na 1440x900). */
.nav-segment-btn::after,
.quick-prompt-pill::after,
.dev-admin-btn::after,
.btn-new-chat::after,
.rc-audio-pill::after {
    content: "";
    position: absolute;
    top: -8px;
    right: -8px;
    bottom: -8px;
    left: -8px;
    min-width: 44px;
    min-height: 44px;
    z-index: 0;
}
/* Ikony 36x36 i toggle mobilny: rozszerzenie do 44x44 z zachowaniem centrum */
/* HERMES-1 (audyt a11y ~now): bazowa regula 44px — na desktopie
   przycisk byl widoczny 16x19, bo wszystkie reguly byly w media <=900px */
.btn-sidebar-toggle-mobile {
    position: relative;
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    border-radius: 11px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.16);
    color: #e2e8f0;
    font-size: 17px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    touch-action: manipulation;
    transition: background 0.15s ease, transform 0.15s ease, border-color 0.15s ease;
}

.btn-sidebar-toggle::after,
.btn-sidebar-close::after,
.btn-sidebar-toggle-mobile::after {
    content: "";
    position: absolute;
    top: -4px;
    right: -4px;
    bottom: -4px;
    left: -4px;
    min-width: 44px;
    min-height: 44px;
    z-index: 0;
}

.telemetry-pill-btn {
    background: rgba(6, 78, 59, 0.92);
    border: 1px solid rgba(16, 185, 129, 0.55);
    color: #ffffff;
}

.telemetry-pill-btn:hover {
    background: rgba(16, 185, 129, 0.16);
    border-color: rgba(16, 185, 129, 0.5);
    box-shadow: 0 0 14px rgba(16, 185, 129, 0.3);
    color: #ffffff;
}

.live-dot-pulse {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #10b981;
    box-shadow: 0 0 8px #10b981;
    animation: pulseDot 2s infinite;
}

@keyframes pulseDot {
    0% { transform: scale(0.9); opacity: 0.7; }
    50% { transform: scale(1.3); opacity: 1; }
    100% { transform: scale(0.9); opacity: 0.7; }
}

.hud-step-badge {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    font-weight: 700;
    color: #38bdf8;
    background: rgba(56, 189, 248, 0.15);
    padding: 2px 6px;
    border-radius: 6px;
    margin-left: 2px;
}

.system-status.clickable {
    cursor: pointer;
    transition: all 0.2s ease;
}

.system-status.clickable:hover {
    border-color: rgba(56, 189, 248, 0.5);
    background: rgba(56, 189, 248, 0.12);
    box-shadow: 0 0 16px rgba(56, 189, 248, 0.25);
}

.aspect-res-tag {
    font-size: 10px;
    opacity: 0.7;
    margin-left: 4px;
    font-family: 'JetBrains Mono', monospace;
}

/* Cluster Telemetry HUD Modal */
.cluster-hud-modal {
    position: fixed !important;
    inset: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    max-width: 100vw !important;
    max-height: 100vh !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    background: rgba(4, 7, 15, 0.78) !important;
    backdrop-filter: blur(24px) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 99999 !important;
}

.cluster-hud-modal:not([open]) {
    display: none !important;
}

.cluster-hud-modal .dialog-mount {
    height: 100% !important;
    width: 100% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 24px !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
}

.cluster-hud-box {
    width: 90%;
    max-width: 900px;
    max-height: 90vh;
    margin: auto !important;
    background: linear-gradient(135deg, rgba(13, 20, 36, 0.95), rgba(9, 14, 25, 0.98));
    border: 1px solid rgba(56, 189, 248, 0.3);
    box-shadow: 0 24px 64px -12px rgba(0, 0, 0, 0.8), 0 0 32px rgba(56, 189, 248, 0.2);
    border-radius: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.cluster-hud-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(15, 23, 42, 0.5);
}

.hud-title-group {
    display: flex;
    align-items: center;
    gap: 14px;
}

.pulse-cyan {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #00f2fe;
    box-shadow: 0 0 14px #00f2fe;
    animation: pulseDot 2s infinite;
}

.hud-title-wrap h3 {
    font-size: 17px;
    font-weight: 800;
    letter-spacing: 0.5px;
    color: #f8fafc;
    display: flex;
    align-items: center;
    gap: 8px;
}

.hud-title-wrap h3 i {
    color: #38bdf8;
}

.hud-subtitle {
    font-size: 12px;
    color: #94a3b8;
}

.hud-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.hud-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    background: rgba(56, 189, 248, 0.12);
    border: 1px solid rgba(56, 189, 248, 0.3);
    color: #38bdf8;
    cursor: pointer;
    transition: all 0.2s ease;
}

.hud-action-btn:hover {
    background: rgba(56, 189, 248, 0.25);
    color: #ffffff;
    box-shadow: 0 0 12px rgba(56, 189, 248, 0.3);
}

.cluster-hud-body {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* === HERMES-1 (2026-10-14): mobile HUD adaptation (kod, nie deklaracja) ===
   Audyt portal_ux_validate.py wykryl: caly blok .cluster-hud-* nie mial ZADNEGO
   @media w style.css ani w mind_widget.css. Na mobile (<=640px):
   - box: 90% szerokosci / max-height 90vh na pelny ekran z odstepami safe-area,
   - padding body 24px -> 16px (gladszy ekran telefonu),
   - padding header 20/24 -> 16 (oszczednosc pionu),
   - KPI grid: minmax 180px -> 140px (2 karty zamiast 1 na wąskim ekranie).
   NIC nie dodaje sie na ekran glowny -- HUD zyje tylko w modalu otwieranym
   recznie (mobile-hud-entry), zasada Operatora zachowana. */
@media (max-width: 640px) {
    .cluster-hud-box {
        width: 100%;
        max-width: 100%;
        max-height: 100dvh;
        border-radius: 0;
        border-left: none;
        border-right: none;
        border-top: none;
        border-bottom: none;
    }

    .cluster-hud-header {
        padding: 14px 16px;
        flex-wrap: wrap;
        gap: 10px;
    }

    .cluster-hud-body {
        padding: 16px;
        gap: 14px;
    }

    .hud-kpi-grid {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
        gap: 10px;
    }

    .hud-kpi-card {
        padding: 12px;
    }

    .hud-section-title {
        margin: 16px 0 8px;
        font-size: 12px;
    }
}

.hud-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
}

.hud-kpi-card {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.hud-kpi-card.highlight-cyan {
    border-color: rgba(56, 189, 248, 0.3);
    box-shadow: inset 0 0 20px rgba(56, 189, 248, 0.05);
}

.hud-kpi-card.highlight-purple {
    border-color: rgba(192, 132, 252, 0.3);
    box-shadow: inset 0 0 20px rgba(192, 132, 252, 0.05);
}

.hud-kpi-card.highlight-emerald {
    border-color: rgba(52, 211, 153, 0.3);
    box-shadow: inset 0 0 20px rgba(52, 211, 153, 0.05);
}

.hud-kpi-card.highlight-amber {
    border-color: rgba(251, 191, 36, 0.3);
    box-shadow: inset 0 0 20px rgba(251, 191, 36, 0.05);
}

.hud-kpi-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.kpi-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #94a3b8;
}

.kpi-icon-mini {
    font-size: 14px;
    opacity: 0.8;
}

.hud-kpi-val {
    font-family: 'JetBrains Mono', monospace;
    font-size: 24px;
    font-weight: 800;
    color: #ffffff;
    letter-spacing: -0.5px;
    /* HERMES-1 cykl 02:35: dlugie wartosci (np. decision string z
       /api/fursona/mind/state) nie moga rozjechac karty HUD -- zawijanie
       + obciecie do 2 linii. Audit UX: brak overflow na mobile 375px. */
    overflow-wrap: anywhere;
    word-break: break-word;
    line-height: 1.15;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.hud-kpi-sub {
    font-size: 11px;
    color: #64748b;
}

.hud-hardware-section {
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 16px;
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.hud-section-title {
    font-size: 13px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: #cbd5e1;
    display: flex;
    align-items: center;
    gap: 8px;
}

.hud-gpu-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
}

.hud-gpu-card {
    background: rgba(9, 14, 26, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.gpu-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.gpu-badge-title {
    display: flex;
    align-items: center;
    gap: 8px;
}

.gpu-id-tag {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    font-weight: 800;
    background: rgba(56, 189, 248, 0.2);
    color: #38bdf8;
    padding: 2px 7px;
    border-radius: 6px;
}

.gpu-name {
    font-size: 12px;
    font-weight: 700;
    color: #e2e8f0;
}

.gpu-temp-badge {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    font-weight: 700;
    color: #34d399;
    background: rgba(52, 211, 153, 0.12);
    padding: 3px 8px;
    border-radius: 6px;
    border: 1px solid rgba(52, 211, 153, 0.25);
}

.gpu-role-desc {
    font-size: 11px;
    color: #94a3b8;
}

.gpu-vram-bar-wrap {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.gpu-vram-meta {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: #cbd5e1;
    font-family: 'JetBrains Mono', monospace;
}

.gpu-bar-track {
    height: 8px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 6px;
    overflow: hidden;
}

.gpu-bar-fill {
    height: 100%;
    border-radius: 6px;
    transition: width 0.4s ease;
}

.gpu-bar-fill.bar-cyan {
    background: linear-gradient(90deg, #06b6d4, #38bdf8);
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.5);
}

.gpu-bar-fill.bar-purple {
    background: linear-gradient(90deg, #8b5cf6, #c084fc);
    box-shadow: 0 0 10px rgba(192, 132, 252, 0.5);
}

.hud-architecture-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    padding: 14px 18px;
    background: rgba(13, 20, 36, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
}

.arch-item {
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.arch-k {
    color: #94a3b8;
    font-weight: 600;
}

.arch-v {
    color: #f1f5f9;
    font-weight: 700;
}

.arch-v.font-green {
    color: #34d399;
}

@media (max-width: 900px) {
    .desktop-nav-segmented {
        display: none !important;
    }
}

/* System Maintenance Banner */
.system-maintenance-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(90deg, rgba(245, 158, 11, 0.18) 0%, rgba(15, 23, 42, 0.92) 100%);
    border-bottom: 1px solid rgba(245, 158, 11, 0.4);
    padding: 10px 24px;
    font-size: 0.85rem;
    color: #fde68a;
    z-index: 999;
    backdrop-filter: blur(12px);
    transition: all 0.3s ease;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}
.system-maintenance-banner.hidden {
    display: none !important;
}
.maintenance-banner-content {
    display: flex;
    align-items: center;
    gap: 14px;
}
.maintenance-icon {
    font-size: 1.15rem;
    color: #fbbf24;
    animation: pulseRing 2s infinite ease-in-out;
}
.maintenance-text-group {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}
.maintenance-title {
    font-weight: 800;
    color: #fff;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    font-size: 0.72rem;
    background: rgba(245, 158, 11, 0.28);
    padding: 3px 8px;
    border-radius: 4px;
    border: 1px solid rgba(245, 158, 11, 0.5);
}
.maintenance-desc {
    color: #f1f5f9;
    font-size: 0.82rem;
    font-weight: 500;
}
.maintenance-btn-dismiss {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    font-size: 1rem;
    padding: 4px 10px;
    border-radius: 4px;
    transition: color 0.2s, background 0.2s;
}
.maintenance-btn-dismiss:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

/* ==========================================================================
   MODERN MINIMALIST CYBER-DARK REFINEMENT (UI Polish)
   ========================================================================== */

/* 1. Header Streamlining & Visual Hierarchy */
.studio-header {
    background: rgba(8, 14, 28, 0.82) !important;
    backdrop-filter: blur(28px) saturate(180%) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    box-shadow: 0 10px 30px -8px rgba(0, 0, 0, 0.7), 0 0 1px 1px rgba(255, 255, 255, 0.05) inset !important;
    padding: 8px 18px !important;
}

.brand-title-row h1 {
    font-size: 18px !important;
    letter-spacing: -0.3px !important;
    font-weight: 700 !important;
}

.brand-version-badge {
    font-size: 9px !important;
    padding: 2px 6px !important;
    border-radius: 4px !important;
    background: rgba(56, 189, 248, 0.1) !important;
    border: 1px solid rgba(56, 189, 248, 0.22) !important;
    color: #bae6fd !important;
}

.tagline {
    font-size: 11px !important;
    color: #cbd5e1 !important;
}

.desktop-nav-segmented {
    background: rgba(13, 20, 36, 0.6) !important;
    border: 1px solid rgba(255, 255, 255, 0.06) !important;
    padding: 3px !important;
    gap: 4px !important;
}

.nav-segment-btn {
    font-size: 12px !important;
    font-weight: 600 !important;
    padding: 6px 14px !important;
}

.user-profile-badge {
    background: rgba(255, 255, 255, 0.03) !important;
    border: 1px solid rgba(255, 255, 255, 0.07) !important;
    padding: 3px 12px 3px 6px !important;
}

/* 2. Director Chat Workspace Modernization */
.director-chat-container {
    background: rgba(8, 13, 25, 0.88) !important;
    backdrop-filter: blur(30px) !important;
    border: 1px solid rgba(255, 255, 255, 0.07) !important;
    border-radius: 18px !important;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.65) !important;
}

.director-header-card {
    background: rgba(11, 18, 33, 0.75) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06) !important;
    padding: 10px 18px !important;
}

.director-avatar-box {
    width: 40px !important;
    height: 40px !important;
    background: linear-gradient(135deg, #1e1b4b, #0f172a) !important;
    border: 1.5px solid rgba(139, 92, 246, 0.6) !important;
}

.director-brain-icon {
    font-size: 18px !important;
}

.director-title-row h2 {
    font-size: 16px !important;
    font-weight: 700 !important;
}

.director-badge {
    font-size: 10px !important;
    padding: 2px 7px !important;
    background: rgba(139, 92, 246, 0.12) !important;
    border: 1px solid rgba(139, 92, 246, 0.3) !important;
    color: #c4b5fd !important;
}

.director-token-rate-pill {
    font-size: 10px !important;
    padding: 2px 7px !important;
    background: rgba(245, 158, 11, 0.1) !important;
    border: 1px solid rgba(245, 158, 11, 0.25) !important;
    color: #fbbf24 !important;
}

.director-subtext {
    font-size: 11px !important;
    color: #94a3b8 !important;
    margin-top: 2px !important;
}

/* 3. Chat Messages: Clean, Uncluttered Modern Styling */
.chat-msg {
    margin-bottom: 6px !important;
}

.chat-msg.ai-msg .msg-body {
    background: rgba(13, 21, 38, 0.85) !important;
    border: 1px solid rgba(255, 255, 255, 0.07) !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25) !important;
    border-radius: 14px !important;
    border-top-left-radius: 4px !important;
    padding: 14px 18px !important;
}

.chat-msg.user-msg .msg-body {
    background: linear-gradient(135deg, rgba(29, 78, 216, 0.75), rgba(30, 58, 138, 0.85)) !important;
    border: 1px solid rgba(96, 165, 250, 0.35) !important;
    box-shadow: 0 4px 18px rgba(29, 78, 216, 0.2) !important;
    border-radius: 14px !important;
    border-top-right-radius: 4px !important;
    padding: 12px 16px !important;
}

.msg-sender {
    font-size: 10.5px !important;
    font-weight: 700 !important;
    letter-spacing: 0.6px !important;
    color: #93c5fd !important;
    margin-bottom: 6px !important;
}

.chat-msg.user-msg .msg-sender {
    color: #bfdbfe !important;
}

.msg-text {
    font-size: 13.5px !important;
    line-height: 1.6 !important;
    color: #e2e8f0 !important;
}

/* 4. Synthesized Canvas Card: Sleek, Bordered, Non-intrusive */
.inline-canvas-card {
    margin-top: 14px !important;
    background: rgba(9, 14, 26, 0.95) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    border-radius: 12px !important;
    overflow: hidden !important;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.5) !important;
}

.inline-canvas-header {
    background: rgba(13, 20, 36, 0.7) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06) !important;
    padding: 8px 14px !important;
    font-size: 12px !important;
}

.inline-canvas-actions {
    background: rgba(9, 14, 26, 0.8) !important;
    border-top: 1px solid rgba(255, 255, 255, 0.05) !important;
    padding: 8px 12px !important;
    gap: 8px !important;
}

.inline-act-btn {
    font-size: 11px !important;
    padding: 5px 12px !important;
    border-radius: 6px !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    background: rgba(255, 255, 255, 0.04) !important;
}

.inline-act-btn:hover {
    background: rgba(56, 189, 248, 0.15) !important;
    border-color: rgba(56, 189, 248, 0.4) !important;
    color: #38bdf8 !important;
}

/* 5. Input Dock */
.director-input-dock {
    background: rgba(11, 18, 33, 0.85) !important;
    border-top: 1px solid rgba(255, 255, 255, 0.06) !important;
    padding: 12px 18px !important;
}

#director-chat-input {
    background: rgba(5, 9, 18, 0.7) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    border-radius: 12px !important;
    color: #f1f5f9 !important;
    font-size: 13.5px !important;
    padding: 10px 14px !important;
    transition: border-color 0.2s, box-shadow 0.2s;
}

#director-chat-input:focus {
    border-color: rgba(56, 189, 248, 0.45) !important;
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.1) !important;
    outline: none !important;
}



/* === HERMES-1 a11y fix (2026-10-11): mobile tap targets >= 44px (WCAG AAA) === */
@media (max-width: 768px) {
    .quick-prompt-pill {
        min-height: 44px !important;
        display: flex !important;
        align-items: center !important;
    }
    .btn-new-chat {
        min-height: 44px !important;
        display: inline-flex !important;
        align-items: center !important;
    }
    .btn-sidebar-toggle-mobile {
        width: 44px !important;
        height: 44px !important;
        min-width: 44px !important;
        min-height: 44px !important;
    }
    .btn-sidebar-close {
        width: 44px !important;
        height: 44px !important;
        min-width: 44px !important;
        min-height: 44px !important;
    }
    .director-aspect-pill {
        min-height: 44px !important;
        display: inline-flex !important;
        align-items: center !important;
    }
    .rc-audio-pill {
        min-height: 44px !important;
        display: inline-flex !important;
        align-items: center !important;
    }
    .dev-admin-btn {
        min-height: 44px !important;
        display: inline-flex !important;
        align-items: center !important;
    }
    #director-chat-input,
    .director-input-row textarea {
        min-height: 44px !important;
    }
}

/* === HERMES-1 (2026-10-12): mobile Cluster HUD entry -- widoczny TYLKO na mobile === */
/* Desktop ma pelny wejscie w .desktop-nav-segmented (nav-seg-telemetry), wiec na
   desktopie plytka mobile bylaby duplikatem -> ukryta domyslnie, odslaniana w
   bloku @media (max-width: 900px) wyzej. */
.mobile-hud-entry {
    display: none !important;
}


/* FIX HERMES-1 (2026-10-15 11:45): VP 320px (najmniejsze realne telefony).
   audit_a11y na 320/360/375: #user-drops-val (drops-badge w .user-meta)
   rect right=325 > 320 -> 5px poza viewportem (overflow_issues=1, tap 0,
   kontrast 0). Przyczyna: .user-name max-width 64px + drops-badge 28px +
   admin-icon 44 + logout 44 nie mieszcza sie w 320 przy gapach. Fix:
   imie 64->44px, drops mniejszy padding/font, header gap 4. Nic nie znika
   (drops pelny tekst, imie ellipsis), zero nowych nakladek. */
@media (max-width: 360px) {
    .header-right { gap: 4px !important; }

    .auth-bar .user-name,
    .auth-bar .auth-user-name {
        max-width: 44px !important;
    }

    .auth-bar .drops-badge,
    .auth-bar .auth-user-drops-badge {
        font-size: 10px !important;
        padding: 1px 4px !important;
    }

    .auth-bar .user-profile-badge {
        padding-left: 2px !important;
        padding-right: 4px !important;
    }
}

/* ==========================================================================
   RAIN CITY CYBER-NOIR WORKSTATION (NEON RAIN EDITION // RC-PRO)
   Signature Rain City cyber-noir aesthetic with neon rain reflections & glassmorphism.
   Zero JS lag, crisp hardware bezels, electric cyan raindrops, deep midnight slate, and crisp typography.
   ========================================================================== */

/* 1. Global CRT Background & Scanline Ambience */
body {
    background-color: #060913 !important;
    background-image: 
        radial-gradient(ellipse at 50% 0%, rgba(14, 165, 233, 0.08) 0%, transparent 65%),
        radial-gradient(ellipse at 85% 100%, rgba(139, 92, 246, 0.05) 0%, transparent 55%) !important;
    color: #f8fafc !important;
}

/* 2. Header & Brand */
.studio-header {
    background: rgba(10, 13, 19, 0.94) !important;
    border: 1px solid rgba(14, 165, 233, 0.28) !important;
    border-radius: var(--radius-sm) !important;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.75), inset 0 1px 0 rgba(14, 165, 233, 0.15) !important;
}

.brand-logo {
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.2), rgba(2, 132, 199, 0.25)) !important;
    border: 1.5px solid rgba(14, 165, 233, 0.55) !important;
    border-radius: var(--radius-sm) !important;
    color: #38bdf8 !important;
}

.logo-pulse {
    border-color: #0ea5e9 !important;
}

.brand h1 {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif !important;
    letter-spacing: 0.5px !important;
    color: #f8fafc !important;
}

.brand h1 span {
    background: linear-gradient(135deg, #38bdf8, #818cf8) !important;
    -webkit-background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
}

.brand-version-badge {
    font-family: 'JetBrains Mono', monospace !important;
    color: #ffffff !important;
    background: rgba(3, 105, 161, 0.9) !important;
    border: 1px solid rgba(56, 189, 248, 0.7) !important;
    border-radius: 3px !important;
}

.tagline {
    color: #cbd5e1 !important;
}

.tagline strong {
    color: #0ea5e9 !important;
}

/* Desktop Segmented Navigation */
.desktop-nav-segmented {
    background: rgba(12, 16, 24, 0.9) !important;
    border: 1px solid rgba(14, 165, 233, 0.25) !important;
    border-radius: var(--radius-sm) !important;
    padding: 3px !important;
}

.nav-segment-btn {
    border-radius: var(--radius-sm) !important;
    font-family: 'JetBrains Mono', monospace !important;
    font-size: 11px !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    color: #9ca3af !important;
}

/* FIX HERMES-1 (2026-10-15 22:5x): kontrast WCAG AA na Cluster HUD.
   Globalny override .nav-segment-btn color:#9ca3af !important wyzej bil
   kolor #ffffff z .telemetry-pill-btn (specificity+important) -> tekst
   "Cluster HUD" mial fg #9ca3af na bg #064938 = 4.1:1 (audit_a11y 22:45,
   viewport 1440x900, contrast_issues=1). Pill na zielonym tle potrzebuje
   bialego tekstu w kazdym stanie. Dowod: audit_a11y po zmianie 0 issues. */
.nav-segment-btn.telemetry-pill-btn,
.nav-segment-btn.telemetry-pill-btn:hover,
.nav-segment-btn.telemetry-pill-btn.active,
.nav-segment-btn.telemetry-pill-btn:focus-visible {
    color: #ffffff !important;
}

/* Podswietlony badge kroku (#45.8k) — NIE ruszac: regula 10166 w tym
   bloku nadaje mu juz #ffffff na #0ea5e9 (kontrast ~10:1). HERMES-1 22:5x:
   moj wczesniejszy dodatek .nav-segment-btn.telemetry-pill-btn
   .hud-step-badge { color:#ffffff } mial wyzsza specificity niz regula
   #ffffff -> bialy tekst na pomaranczowym = 2.15:1, zepsutem to, co dzialalo.
   LEKCJA: przed dodaniem !important sprawdz inkrementalny audyt — poprawka
   moze odslonic lub STWORZYC defekt kontrastu w sasiednim elemencie. */

.nav-segment-btn:hover {
    color: #ffffff !important;
    background: rgba(14, 165, 233, 0.14) !important;
}

.nav-segment-btn.active {
    color: #ffffff !important;
    background: #075985 !important;
    border: 1px solid rgba(56, 189, 248, 0.7) !important;
    box-shadow: 0 0 14px rgba(14, 165, 233, 0.22) !important;
}

.nav-segment-btn.active i {
    color: #0ea5e9 !important;
}

.hud-step-badge {
    background: #0ea5e9 !important;
    color: #ffffff !important;
    font-weight: 800 !important;
    font-family: 'JetBrains Mono', monospace !important;
    border-radius: 2px !important;
}

/* Auth / Discord / Dev Admin buttons */
.discord-login-btn {
    border-radius: var(--radius-sm) !important;
    background: #141f36 !important;
    border: 1px solid rgba(14, 165, 233, 0.25) !important;
    color: #d1d5db !important;
    font-family: 'JetBrains Mono', monospace !important;
    font-size: 11px !important;
    text-transform: uppercase !important;
    box-shadow: none !important;
}

.discord-login-btn:hover {
    background: #5865F2 !important;
    border-color: #5865F2 !important;
    color: #fff !important;
}

.admin-trigger-btn {
    border-radius: var(--radius-sm) !important;
    font-family: 'JetBrains Mono', monospace !important;
    background: linear-gradient(135deg, #0ea5e9, #0284c7) !important;
    color: #ffffff !important;
    border: 1px solid #38bdf8 !important;
}

/* 3. Left Controls Panel (Cyberdeck Rack) */
.controls-panel {
    background: rgba(12, 16, 24, 0.9) !important;
    border: 1px solid rgba(14, 165, 233, 0.28) !important;
    border-radius: var(--radius-sm) !important;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.65) !important;
}

.section-label {
    font-family: 'JetBrains Mono', monospace !important;
    font-size: 11px !important;
    text-transform: uppercase !important;
    letter-spacing: 0.6px !important;
    color: #0ea5e9 !important;
}

.section-label i {
    color: #38bdf8 !important;
}

/* Mode Switcher (Freeform / Assisted / Polish) */
.prompt-mode-toggle {
    background: rgba(8, 11, 16, 0.95) !important;
    border: 1px solid rgba(14, 165, 233, 0.25) !important;
    border-radius: var(--radius-sm) !important;
    padding: 3px !important;
}

.mode-pill {
    border-radius: 3px !important;
    font-family: 'JetBrains Mono', monospace !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.4px !important;
    color: #9ca3af !important;
    transition: all 0.15s ease !important;
}

.mode-pill:hover {
    color: #f8fafc !important;
}

.mode-pill.active {
    background: linear-gradient(135deg, #0369a1, #0c4a6e) !important;
    color: #ffffff !important;
    border: 1px solid #0ea5e9 !important;
    box-shadow: 0 0 10px rgba(14, 165, 233, 0.35) !important;
}

.prompt-assist-btn {
    border-radius: var(--radius-sm) !important;
    background: rgba(12, 74, 110, 0.95) !important;
    border: 1px solid rgba(56, 189, 248, 0.6) !important;
    color: #bae6fd !important;
    font-family: 'JetBrains Mono', monospace !important;
    font-size: 11px !important;
    text-transform: uppercase !important;
}

.prompt-assist-btn:hover {
    background: rgba(14, 165, 233, 0.25) !important;
    border-color: #0ea5e9 !important;
    color: #ffffff !important;
    box-shadow: 0 0 12px rgba(14, 165, 233, 0.3) !important;
}

/* Character Card in Assisted Mode */
.active-char-compact {
    background: rgba(14, 18, 28, 0.95) !important;
    border: 1.5px solid rgba(14, 165, 233, 0.45) !important;
    border-radius: var(--radius-sm) !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5), inset 0 0 12px rgba(14, 165, 233, 0.08) !important;
}

.active-char-avatar-frame .active-char-img {
    border: 1.5px solid rgba(14, 165, 233, 0.6) !important;
    border-radius: var(--radius-sm) !important;
}

.active-char-name {
    font-family: 'JetBrains Mono', monospace !important;
    color: #f8fafc !important;
}

.active-char-badge {
    background: #0ea5e9 !important;
    color: #ffffff !important;
    font-family: 'JetBrains Mono', monospace !important;
    font-weight: 800 !important;
    border-radius: 2px !important;
}

.active-char-species {
    color: #38bdf8 !important;
    font-family: 'JetBrains Mono', monospace !important;
}

.trait-pill {
    background: rgba(14, 165, 233, 0.08) !important;
    border: 1px solid rgba(14, 165, 233, 0.25) !important;
    color: #bae6fd !important;
    border-radius: 3px !important;
    font-family: 'JetBrains Mono', monospace !important;
}

.trait-pill:hover {
    border-color: #0ea5e9 !important;
    color: #ffffff !important;
}

/* Action Pills & Compact Chips */
.compact-pill-btn {
    border-radius: 3px !important;
    font-family: 'JetBrains Mono', monospace !important;
    font-size: 11px !important;
    background: rgba(14, 165, 233, 0.12) !important;
    border: 1px solid rgba(14, 165, 233, 0.3) !important;
    color: #bae6fd !important;
}

.compact-pill-btn:hover {
    background: rgba(14, 165, 233, 0.25) !important;
    border-color: #0ea5e9 !important;
    color: #ffffff !important;
}

.prompt-chips-compact .chip-btn {
    border-radius: 3px !important;
    font-family: 'JetBrains Mono', monospace !important;
    font-size: 11px !important;
    background: rgba(14, 18, 26, 0.8) !important;
    border: 1px solid rgba(14, 165, 233, 0.2) !important;
    color: #cbd5e1 !important;
}

.prompt-chips-compact .chip-btn:hover {
    background: rgba(14, 165, 233, 0.18) !important;
    border-color: rgba(14, 165, 233, 0.5) !important;
    color: #38bdf8 !important;
}

/* Prompt Textarea */
.prompt-input,
#prompt-input {
    background: rgba(8, 11, 16, 0.95) !important;
    border: 1px solid rgba(14, 165, 233, 0.25) !important;
    border-radius: var(--radius-sm) !important;
    color: #f8fafc !important;
    font-family: 'JetBrains Mono', monospace !important;
    font-size: 13px !important;
}

.prompt-input:focus,
#prompt-input:focus {
    border-color: #0ea5e9 !important;
    box-shadow: 0 0 12px rgba(14, 165, 233, 0.25) !important;
}

/* Aspect Ratio Cards */
.aspect-grid-compact .aspect-card {
    border-radius: var(--radius-sm) !important;
    background: rgba(12, 16, 24, 0.75) !important;
    border: 1px solid rgba(14, 165, 233, 0.2) !important;
}

.aspect-grid-compact .aspect-card:hover {
    background: rgba(20, 26, 38, 0.85) !important;
    border-color: rgba(14, 165, 233, 0.5) !important;
}

.aspect-grid-compact .aspect-card.active {
    background: rgba(12, 74, 110, 0.95) !important;
    border-color: #38bdf8 !important;
    box-shadow: 0 0 14px rgba(56, 189, 248, 0.35) !important;
}

.aspect-card.active .aspect-mini-shape {
    border-color: #38bdf8 !important;
    background: rgba(14, 165, 233, 0.3) !important;
}

.aspect-text-wrap .aspect-title {
    font-family: 'JetBrains Mono', monospace !important;
    color: #f1f5f9 !important;
}

.aspect-text-wrap .aspect-res-sub {
    font-family: 'JetBrains Mono', monospace !important;
    color: #e2e8f0 !important;
}

.aspect-cost-pill {
    font-family: 'JetBrains Mono', monospace !important;
    color: #38bdf8 !important;
}

/* Reference Images Box */
.ref-upload-dropzone,
.ref-images-container {
    border-radius: var(--radius-sm) !important;
    border-color: rgba(14, 165, 233, 0.25) !important;
    background: rgba(10, 13, 20, 0.6) !important;
}

/* Action Dock & Generate Button */
.controls-action-dock {
    background: rgba(10, 13, 19, 0.98) !important;
    border-top: 1px solid rgba(14, 165, 233, 0.25) !important;
}

.canvas-cost-breakdown {
    font-family: 'JetBrains Mono', monospace !important;
    color: #d1d5db !important;
}

.canvas-cost-breakdown strong,
.canvas-cost-breakdown .total-val {
    color: #38bdf8 !important;
}

.drops-left-pill {
    border-radius: var(--radius-sm) !important;
    border: 1px solid rgba(14, 165, 233, 0.35) !important;
    background: rgba(12, 16, 24, 0.9) !important;
    color: #38bdf8 !important;
    font-family: 'JetBrains Mono', monospace !important;
}

.generate-btn {
    border-radius: var(--radius-sm) !important;
    background: linear-gradient(135deg, #0369a1, #0c4a6e) !important;
    border: 1px solid #0ea5e9 !important;
    color: #ffffff !important;
    font-family: 'JetBrains Mono', monospace !important;
    font-weight: 800 !important;
    font-size: 13px !important;
    letter-spacing: 0.6px !important;
    text-transform: uppercase !important;
    box-shadow: 0 4px 18px rgba(14, 165, 233, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.25) !important;
}

.generate-btn:hover {
    background: linear-gradient(135deg, #0ea5e9, #0284c7) !important;
    box-shadow: 0 6px 22px rgba(14, 165, 233, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.35) !important;
    filter: none !important;
    transform: translateY(-1px) !important;
}

.generate-btn:active {
    transform: translateY(1px) !important;
    box-shadow: 0 2px 10px rgba(14, 165, 233, 0.4) !important;
}

/* 4. Viewport Studio CRT Monitor (Right Column) */
.viewport-panel {
    min-width: 0 !important;
}

.viewport-canvas {
    border-radius: var(--radius-sm) !important;
    border: 1px solid rgba(14, 165, 233, 0.3) !important;
    background: 
        radial-gradient(circle at 50% 35%, rgba(18, 24, 34, 0.94) 0%, rgba(8, 11, 16, 0.98) 100%),
        repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.25) 0px, rgba(0, 0, 0, 0.25) 1px, transparent 1px, transparent 2px) !important;
    box-shadow: inset 0 0 60px rgba(0, 0, 0, 0.85), 0 12px 36px -8px rgba(0, 0, 0, 0.7) !important;
    position: relative !important;
}

/* CRT Corner Alignment Brackets */
.crt-bracket {
    position: absolute !important;
    width: 16px !important;
    height: 16px !important;
    pointer-events: none !important;
    z-index: 4 !important;
}

.crt-bracket.top-left {
    top: 10px !important;
    left: 10px !important;
    border-top: 2px solid #0ea5e9 !important;
    border-left: 2px solid #0ea5e9 !important;
}

.crt-bracket.top-right {
    top: 10px !important;
    right: 10px !important;
    border-top: 2px solid #0ea5e9 !important;
    border-right: 2px solid #0ea5e9 !important;
}

.crt-bracket.bottom-left {
    bottom: 10px !important;
    left: 10px !important;
    border-bottom: 2px solid #0ea5e9 !important;
    border-left: 2px solid #0ea5e9 !important;
}

.crt-bracket.bottom-right {
    bottom: 10px !important;
    right: 10px !important;
    border-bottom: 2px solid #0ea5e9 !important;
    border-right: 2px solid #0ea5e9 !important;
}

.viewport-monitor-header {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    width: 100% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    font-family: 'JetBrains Mono', monospace !important;
    font-size: 10px !important;
    color: #94a3b8 !important;
    letter-spacing: 0.5px !important;
    pointer-events: none !important;
    border-bottom: 1px dashed rgba(14, 165, 233, 0.25) !important;
    padding-bottom: 6px !important;
    margin-bottom: 8px !important;
    flex-shrink: 0 !important;
    z-index: 3 !important;
    box-sizing: border-box !important;
}

.vmon-tag {
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
}

.vmon-dot {
    width: 6px !important;
    height: 6px !important;
    border-radius: 50% !important;
    background: #10b981 !important;
    box-shadow: 0 0 8px #10b981 !important;
}

.vmon-tag.status-ready {
    color: #38bdf8 !important;
    font-weight: 700 !important;
}

.placeholder-ring {
    border-color: rgba(14, 165, 233, 0.45) !important;
    box-shadow: 0 0 16px rgba(14, 165, 233, 0.2) !important;
}

.placeholder-icon {
    color: #38bdf8 !important;
}

.placeholder-box h3 {
    font-family: 'JetBrains Mono', monospace !important;
    font-size: 17px !important;
    text-transform: uppercase !important;
    letter-spacing: 0.8px !important;
    color: #f8fafc !important;
}

.placeholder-box p {
    color: #cbd5e1 !important;
}

.placeholder-box strong {
    color: #38bdf8 !important;
}

.inpaint-upload-btn {
    border-radius: var(--radius-sm) !important;
    background: rgba(14, 165, 233, 0.12) !important;
    border: 1px solid rgba(14, 165, 233, 0.4) !important;
    color: #38bdf8 !important;
    font-family: 'JetBrains Mono', monospace !important;
    font-size: 11px !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
}

.inpaint-upload-btn:hover {
    background: rgba(14, 165, 233, 0.25) !important;
    border-color: #0ea5e9 !important;
    color: #ffffff !important;
    box-shadow: 0 0 14px rgba(14, 165, 233, 0.3) !important;
}

/* 5. Lower Deck (Library / Gallery) */
.deck-tabs-header {
    border-bottom: 1px solid rgba(14, 165, 233, 0.2) !important;
}

.deck-tabs-bar {
    background: rgba(10, 14, 22, 0.8) !important;
    border: 1px solid rgba(14, 165, 233, 0.2) !important;
    border-radius: var(--radius-sm) !important;
    padding: 3px !important;
}

.deck-tab {
    border-radius: 3px !important;
    font-family: 'JetBrains Mono', monospace !important;
    font-size: 11px !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    color: #9ca3af !important;
}

.deck-tab.active {
    background: rgba(14, 165, 233, 0.18) !important;
    border: 1px solid rgba(14, 165, 233, 0.5) !important;
    color: #f8fafc !important;
}

.deck-tab.active i {
    color: #0ea5e9 !important;
}

/* 6. Mobile Dedicated Styling */
.mobile-sticky-generate-bar {
    background: linear-gradient(to top, rgba(6, 8, 13, 0.98) 80%, rgba(6, 8, 13, 0.85) 90%, transparent) !important;
    border-top: 1px solid rgba(14, 165, 233, 0.15) !important;
}

.mobile-drops-pill {
    border-radius: var(--radius-sm) !important;
    border: 1.5px solid rgba(14, 165, 233, 0.4) !important;
    background: rgba(12, 16, 24, 0.95) !important;
    box-shadow: inset 0 0 10px rgba(14, 165, 233, 0.1) !important;
}

.mobile-drops-icon,
.mobile-drops-num {
    color: #38bdf8 !important;
    font-family: 'JetBrains Mono', monospace !important;
}

.mobile-generate-btn {
    border-radius: var(--radius-sm) !important;
    background: linear-gradient(135deg, #0369a1, #0c4a6e) !important;
    border: 1px solid #38bdf8 !important;
    color: #ffffff !important;
    font-family: 'JetBrains Mono', monospace !important;
    font-size: 13px !important;
    font-weight: 800 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    box-shadow: 0 4px 18px rgba(14, 165, 233, 0.45) !important;
}

.mobile-generate-btn:active {
    transform: scale(0.98) !important;
    box-shadow: 0 2px 10px rgba(14, 165, 233, 0.4) !important;
}

.mobile-bottom-nav {
    background: rgba(9, 12, 17, 0.98) !important;
    border-top: 1px solid rgba(14, 165, 233, 0.25) !important;
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.8) !important;
}

.mobile-nav-btn {
    color: #9ca3af !important;
    font-family: 'JetBrains Mono', monospace !important;
}

.mobile-nav-btn.active {
    color: #38bdf8 !important;
    text-shadow: 0 0 10px rgba(14, 165, 233, 0.45) !important;
}

.mobile-nav-btn.active::after {
    content: "" !important;
    position: absolute !important;
    top: 0 !important;
    left: 20% !important;
    right: 20% !important;
    height: 2px !important;
    background: #0ea5e9 !important;
    box-shadow: 0 0 8px #0ea5e9 !important;
}

/* 7. Comprehensive Amber Overrides for Secondary Pills & Dropzones */
.logo-symbol .fa-dna {
    color: #38bdf8 !important;
}

.active-char-species-pill {
    color: #38bdf8 !important;
    background: rgba(14, 165, 233, 0.15) !important;
    border: 1px solid rgba(14, 165, 233, 0.35) !important;
    font-family: 'JetBrains Mono', monospace !important;
    border-radius: 3px !important;
}

.ref-count-badge {
    color: #bae6fd !important;
    background: rgba(12, 74, 110, 0.95) !important;
    border: 1px solid rgba(56, 189, 248, 0.6) !important;
    font-family: 'JetBrains Mono', monospace !important;
    border-radius: 3px !important;
}

.ref-dropzone {
    border: 1.5px dashed rgba(14, 165, 233, 0.35) !important;
    background: rgba(14, 18, 26, 0.6) !important;
    border-radius: var(--radius-sm) !important;
}

.ref-dropzone:hover,
.ref-dropzone.dragover {
    border-color: #0ea5e9 !important;
    background: rgba(14, 165, 233, 0.1) !important;
    box-shadow: 0 0 16px rgba(14, 165, 233, 0.2) !important;
}

.ref-dropzone-icon {
    color: #0ea5e9 !important;
}

.cost-summary-bar {
    background: rgba(10, 14, 22, 0.95) !important;
    border: 1.5px solid rgba(14, 165, 233, 0.3) !important;
    border-radius: var(--radius-sm) !important;
}

.total-val,
#summary-total-cost {
    color: #38bdf8 !important;
    text-shadow: 0 0 10px rgba(14, 165, 233, 0.4) !important;
    font-family: 'JetBrains Mono', monospace !important;
}

.dock-balance-pill {
    border-radius: var(--radius-sm) !important;
    background: rgba(12, 16, 24, 0.95) !important;
    border: 1.5px solid rgba(14, 165, 233, 0.35) !important;
    box-shadow: inset 0 0 10px rgba(14, 165, 233, 0.1) !important;
}

.dock-balance-icon,
.dock-balance-num {
    color: #38bdf8 !important;
    font-family: 'JetBrains Mono', monospace !important;
}

.dock-balance-icon i,
.mobile-drops-icon i,
.aspect-cost-pill i,
.canvas-cost-breakdown i {
    color: #38bdf8 !important;
}

.aspect-cost-pill {
    color: #ffffff !important;
    font-family: 'JetBrains Mono', monospace !important;
}

@media (max-width: 900px) {
    .controls-scroll-area,
    .controls-panel {
        padding-bottom: 150px !important;
    }
}

/* ==========================================================================
   FULL-SERVICE RAIN CITY CYBER-NOIR EXPANSION: ALL MODALS, DIALOGS & PANES
   Zero incomplete corners: Roster, Cluster HUD, Dev Admin, Inpaint,
   Gallery Cards & Filters, Personal History, Synthesis Progress & Telemetry.
   ========================================================================== */

/* 1. Global Dialog Backdrop & Centering Treatment */
dialog {
    margin: auto !important;
}

dialog[open] {
    position: fixed !important;
    inset: 0 !important;
    margin: auto !important;
}

dialog.admin-modal,
dialog.leaderboard-modal,
dialog.roster-modal,
dialog.cluster-hud-modal,
dialog.telemetry-hud-modal,
dialog.admin-user-gens-modal,
dialog.inpaint-modal,
dialog.lightbox-modal {
    position: fixed !important;
    inset: 0 !important;
    margin: auto !important;
}

dialog::backdrop {
    background: rgba(4, 6, 10, 0.82) !important;
    backdrop-filter: blur(14px) !important;
}

::-webkit-scrollbar {
    width: 6px !important;
    height: 6px !important;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.4) !important;
}

::-webkit-scrollbar-thumb {
    background: rgba(14, 165, 233, 0.35) !important;
    border-radius: 2px !important;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(14, 165, 233, 0.65) !important;
}

/* Modal Close Button */
.modal-close-btn {
    border-radius: var(--radius-sm) !important;
    background: rgba(14, 18, 26, 0.9) !important;
    border: 1px solid rgba(14, 165, 233, 0.35) !important;
    color: #38bdf8 !important;
    transition: all 0.15s ease !important;
}

.modal-close-btn:hover {
    background: rgba(14, 165, 233, 0.25) !important;
    border-color: #0ea5e9 !important;
    color: #ffffff !important;
    box-shadow: 0 0 12px rgba(14, 165, 233, 0.3) !important;
}

/* 2. Roster Modal (Character Selection) */
.roster-modal {
    position: fixed !important;
    inset: 0 !important;
    margin: auto !important;
    display: flex !important;
    flex-direction: column !important;
    max-height: 86vh !important;
    overflow: hidden !important;
    background: rgba(10, 13, 20, 0.96) !important;
    border: 1.5px solid rgba(14, 165, 233, 0.4) !important;
    border-radius: var(--radius-sm) !important;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.9), 0 0 40px rgba(14, 165, 233, 0.18) !important;
}

.roster-modal .modal-header {
    border-bottom: 1px solid rgba(14, 165, 233, 0.25) !important;
    background: rgba(12, 16, 25, 0.7) !important;
}

.roster-modal .modal-title-row h2 {
    font-family: 'Cinzel', 'JetBrains Mono', serif !important;
    letter-spacing: 0.5px !important;
    color: #f8fafc !important;
}

.roster-count-badge {
    background: rgba(14, 165, 233, 0.15) !important;
    border: 1px solid rgba(14, 165, 233, 0.4) !important;
    color: #38bdf8 !important;
    font-family: 'JetBrains Mono', monospace !important;
    border-radius: 3px !important;
}

.modal-filter-bar {
    border-bottom: 1px solid rgba(14, 165, 233, 0.2) !important;
    background: rgba(8, 11, 17, 0.95) !important;
}

.roster-search-input,
.modal-filter-bar input {
    background: rgba(6, 8, 13, 0.95) !important;
    border: 1px solid rgba(14, 165, 233, 0.3) !important;
    color: #f8fafc !important;
    font-family: 'JetBrains Mono', monospace !important;
    border-radius: var(--radius-sm) !important;
}

.roster-search-input:focus,
.modal-filter-bar input:focus {
    border-color: #0ea5e9 !important;
    box-shadow: 0 0 12px rgba(14, 165, 233, 0.25) !important;
}

.category-filter-btn,
.roster-filter-btn {
    border-radius: var(--radius-sm) !important;
    font-family: 'JetBrains Mono', monospace !important;
    font-size: 11px !important;
    text-transform: uppercase !important;
    letter-spacing: 0.4px !important;
    background: rgba(14, 18, 26, 0.85) !important;
    border: 1px solid rgba(14, 165, 233, 0.25) !important;
    color: #cbd5e1 !important;
}

.category-filter-btn:hover,
.roster-filter-btn:hover {
    background: rgba(14, 165, 233, 0.15) !important;
    border-color: rgba(14, 165, 233, 0.5) !important;
    color: #38bdf8 !important;
}

.category-filter-btn.active,
.roster-filter-btn.active {
    background: linear-gradient(135deg, #0284c7, #b45309) !important;
    border: 1px solid #0ea5e9 !important;
    color: #ffffff !important;
    box-shadow: 0 0 12px rgba(14, 165, 233, 0.35) !important;
}

.roster-grid {
    background: rgba(8, 11, 16, 0.95) !important;
}

.roster-card {
    background: rgba(14, 18, 26, 0.9) !important;
    border: 1px solid rgba(14, 165, 233, 0.22) !important;
    border-radius: var(--radius-sm) !important;
}

.roster-card:hover {
    background: rgba(22, 28, 40, 0.98) !important;
    border-color: #0ea5e9 !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6), 0 0 16px rgba(14, 165, 233, 0.25) !important;
}

.roster-card.active {
    background: rgba(14, 165, 233, 0.14) !important;
    border: 1.5px solid #0ea5e9 !important;
    box-shadow: 0 0 20px rgba(14, 165, 233, 0.3) !important;
}

.roster-card.active .roster-avatar {
    border-color: #0ea5e9 !important;
    box-shadow: 0 0 12px rgba(14, 165, 233, 0.5) !important;
}

.roster-avatar {
    border-radius: var(--radius-sm) !important;
    border: 1.5px solid rgba(14, 165, 233, 0.4) !important;
}

.roster-cat-tag {
    background: #38bdf8 !important;
    color: #ffffff !important;
    font-weight: 800 !important;
    font-family: 'JetBrains Mono', monospace !important;
    border-radius: 2px !important;
}

.roster-name {
    font-family: 'JetBrains Mono', monospace !important;
    color: #f8fafc !important;
}

.roster-species,
.roster-species-pill {
    color: #38bdf8 !important;
    font-family: 'JetBrains Mono', monospace !important;
}

.roster-pill {
    background: rgba(14, 165, 233, 0.08) !important;
    border: 1px solid rgba(14, 165, 233, 0.2) !important;
    color: #bae6fd !important;
    font-family: 'JetBrains Mono', monospace !important;
    border-radius: 3px !important;
}

.roster-radio-circle,
.roster-check-circle {
    border: 1.5px solid rgba(14, 165, 233, 0.45) !important;
}

.roster-card.active .roster-radio-circle,
.roster-card.active .roster-check-circle {
    background: #0ea5e9 !important;
    border-color: #38bdf8 !important;
    box-shadow: 0 0 10px #0ea5e9 !important;
}

/* 3. Cluster HUD Modal */
.cluster-hud-box {
    background: rgba(9, 12, 18, 0.98) !important;
    border: 1.5px solid rgba(14, 165, 233, 0.45) !important;
    border-radius: var(--radius-sm) !important;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.9), 0 0 40px rgba(14, 165, 233, 0.2) !important;
}

.cluster-hud-header {
    border-bottom: 1px solid rgba(14, 165, 233, 0.25) !important;
    background: rgba(12, 16, 25, 0.7) !important;
}

.hud-title-wrap h3 {
    font-family: 'JetBrains Mono', monospace !important;
    letter-spacing: 0.5px !important;
    color: #f8fafc !important;
}

.hud-status-indicator.pulse-cyan,
.hud-status-indicator {
    background: #0ea5e9 !important;
    box-shadow: 0 0 12px #0ea5e9 !important;
}

.hud-action-btn,
#btn-refresh-telemetry-hud {
    border-radius: var(--radius-sm) !important;
    background: rgba(14, 165, 233, 0.15) !important;
    border: 1px solid rgba(14, 165, 233, 0.4) !important;
    color: #38bdf8 !important;
    font-family: 'JetBrains Mono', monospace !important;
    font-size: 11px !important;
    text-transform: uppercase !important;
}

.hud-action-btn:hover,
#btn-refresh-telemetry-hud:hover {
    background: rgba(14, 165, 233, 0.28) !important;
    border-color: #0ea5e9 !important;
    color: #ffffff !important;
    box-shadow: 0 0 12px rgba(14, 165, 233, 0.3) !important;
}

.hud-kpi-card,
.hud-kpi-card.highlight-cyan,
.hud-kpi-card.highlight-purple,
.hud-kpi-card.highlight-emerald,
.hud-kpi-card.highlight-amber {
    background: rgba(14, 18, 28, 0.9) !important;
    border: 1px solid rgba(14, 165, 233, 0.3) !important;
    border-radius: var(--radius-sm) !important;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.6) !important;
}

.kpi-label {
    color: #0ea5e9 !important;
    font-family: 'JetBrains Mono', monospace !important;
    font-size: 11px !important;
    letter-spacing: 0.5px !important;
    text-transform: uppercase !important;
}

.kpi-icon-mini {
    color: #38bdf8 !important;
}

.hud-kpi-val {
    color: #f8fafc !important;
    font-family: 'JetBrains Mono', monospace !important;
    font-weight: 800 !important;
}

.hud-kpi-sub {
    color: #9ca3af !important;
    font-family: 'JetBrains Mono', monospace !important;
}

.hud-section-title {
    color: #38bdf8 !important;
    font-family: 'JetBrains Mono', monospace !important;
}

.hud-section-title i {
    color: #0ea5e9 !important;
}

.gpu-badge {
    background: rgba(14, 165, 233, 0.15) !important;
    border: 1px solid rgba(14, 165, 233, 0.35) !important;
    color: #38bdf8 !important;
    font-family: 'JetBrains Mono', monospace !important;
}

/* 4. Dev Admin Modal */
.admin-modal {
    position: fixed !important;
    inset: 0 !important;
    margin: auto !important;
    background: rgba(9, 12, 18, 0.98) !important;
    border: 1.5px solid rgba(14, 165, 233, 0.45) !important;
    border-radius: var(--radius-sm) !important;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.9), 0 0 40px rgba(14, 165, 233, 0.2) !important;
}

.admin-modal-content {
    background: transparent !important;
}

.admin-header {
    border-bottom: 1px solid rgba(14, 165, 233, 0.25) !important;
    background: rgba(12, 16, 25, 0.7) !important;
}

.admin-shield-badge {
    background: #0ea5e9 !important;
    color: #ffffff !important;
    font-family: 'JetBrains Mono', monospace !important;
    font-weight: 800 !important;
    border-radius: 2px !important;
}

.admin-tabs {
    border-bottom: 1px solid rgba(14, 165, 233, 0.25) !important;
    background: rgba(7, 9, 14, 0.95) !important;
}

.admin-tab {
    font-family: 'JetBrains Mono', monospace !important;
    font-size: 11px !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    color: #9ca3af !important;
    border-bottom: 2px solid transparent !important;
}

.admin-tab:hover {
    color: #f8fafc !important;
    background: rgba(14, 165, 233, 0.08) !important;
}

.admin-tab.active {
    color: #f8fafc !important;
    border-bottom-color: #0ea5e9 !important;
    background: rgba(14, 165, 233, 0.16) !important;
}

.admin-table th {
    background: rgba(12, 16, 25, 0.95) !important;
    color: #38bdf8 !important;
    font-family: 'JetBrains Mono', monospace !important;
    font-size: 11px !important;
    border-bottom: 1px solid rgba(14, 165, 233, 0.3) !important;
}

.admin-table td {
    border-bottom: 1px solid rgba(14, 165, 233, 0.15) !important;
    font-family: 'JetBrains Mono', monospace !important;
}

.grant-btn {
    border-radius: var(--radius-sm) !important;
    font-family: 'JetBrains Mono', monospace !important;
    font-size: 11px !important;
}

/* 5. Smart Inpaint Modal */
.inpaint-modal-box {
    background: rgba(9, 12, 18, 0.98) !important;
    border: 1.5px solid rgba(14, 165, 233, 0.45) !important;
    border-radius: var(--radius-sm) !important;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.9), 0 0 40px rgba(14, 165, 233, 0.2) !important;
}

.inpaint-modal-header {
    border-bottom: 1px solid rgba(14, 165, 233, 0.25) !important;
    background: rgba(12, 16, 25, 0.7) !important;
}

.inpaint-tool-btn {
    border-radius: var(--radius-sm) !important;
    background: rgba(14, 18, 26, 0.85) !important;
    border: 1px solid rgba(14, 165, 233, 0.25) !important;
    color: #cbd5e1 !important;
    font-family: 'JetBrains Mono', monospace !important;
    font-size: 11px !important;
}

.inpaint-tool-btn:hover {
    background: rgba(14, 165, 233, 0.2) !important;
    border-color: #0ea5e9 !important;
    color: #ffffff !important;
}

.inpaint-tool-btn.active {
    background: linear-gradient(135deg, #0284c7, #b45309) !important;
    border: 1px solid #0ea5e9 !important;
    color: #ffffff !important;
    box-shadow: 0 0 12px rgba(14, 165, 233, 0.35) !important;
}

.inpaint-brush-slider {
    accent-color: #0ea5e9 !important;
}

.inpaint-action-btn-commit {
    background: linear-gradient(135deg, #0284c7, #b45309) !important;
    border: 1px solid #0ea5e9 !important;
    color: #ffffff !important;
    font-family: 'JetBrains Mono', monospace !important;
    font-weight: 800 !important;
    box-shadow: 0 4px 18px rgba(14, 165, 233, 0.45) !important;
}

/* 6. Public Gallery Cards & Filters */
.gallery-filter-pill {
    border-radius: var(--radius-sm) !important;
    font-family: 'JetBrains Mono', monospace !important;
    font-size: 11px !important;
    text-transform: uppercase !important;
    background: rgba(12, 16, 24, 0.85) !important;
    border: 1px solid rgba(14, 165, 233, 0.25) !important;
    color: #cbd5e1 !important;
}

.gallery-filter-pill:hover {
    background: rgba(14, 165, 233, 0.15) !important;
    border-color: rgba(14, 165, 233, 0.5) !important;
    color: #38bdf8 !important;
}

.gallery-filter-pill.active {
    background: linear-gradient(135deg, #0284c7, #b45309) !important;
    border: 1px solid #0ea5e9 !important;
    color: #ffffff !important;
    box-shadow: 0 0 14px rgba(14, 165, 233, 0.35) !important;
}

.gallery-filter-pill .pill-count {
    background: rgba(0, 0, 0, 0.4) !important;
    color: #38bdf8 !important;
    border-radius: 2px !important;
}

.gallery-card {
    background: rgba(12, 16, 24, 0.9) !important;
    border: 1px solid rgba(14, 165, 233, 0.25) !important;
    border-radius: var(--radius-sm) !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6) !important;
}

.gallery-card:hover {
    border-color: #0ea5e9 !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.75), 0 0 16px rgba(14, 165, 233, 0.22) !important;
}

.gallery-reuse-btn,
.btn-reuse-params {
    border-radius: var(--radius-sm) !important;
    background: rgba(14, 165, 233, 0.15) !important;
    border: 1px solid rgba(14, 165, 233, 0.45) !important;
    color: #38bdf8 !important;
    font-family: 'JetBrains Mono', monospace !important;
    font-size: 11px !important;
    text-transform: uppercase !important;
}

.gallery-reuse-btn:hover,
.btn-reuse-params:hover {
    background: linear-gradient(135deg, #0284c7, #b45309) !important;
    border-color: #0ea5e9 !important;
    color: #ffffff !important;
    box-shadow: 0 0 12px rgba(14, 165, 233, 0.35) !important;
}

.gallery-load-more-btn {
    border-radius: var(--radius-sm) !important;
    background: linear-gradient(135deg, #0284c7, #b45309) !important;
    border: 1px solid #0ea5e9 !important;
    color: #ffffff !important;
    font-family: 'JetBrains Mono', monospace !important;
    font-size: 13px !important;
    font-weight: 800 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    box-shadow: 0 4px 18px rgba(14, 165, 233, 0.45) !important;
}

/* 7. Synthesis Progress Bar & Live PRM Telemetry */
.progress-box {
    background: rgba(10, 13, 20, 0.95) !important;
    border: 1px solid rgba(14, 165, 233, 0.3) !important;
    border-radius: var(--radius-sm) !important;
}

.status-msg {
    font-family: 'JetBrains Mono', monospace !important;
    color: #38bdf8 !important;
}

.spinner-dot {
    background: #0ea5e9 !important;
    box-shadow: 0 0 8px #0ea5e9 !important;
}

.percent-msg {
    color: #f8fafc !important;
    font-family: 'JetBrains Mono', monospace !important;
    font-weight: 800 !important;
}

.progress-bar-fill {
    background: linear-gradient(90deg, #0284c7, #0ea5e9, #38bdf8) !important;
    box-shadow: 0 0 14px rgba(14, 165, 233, 0.6) !important;
}

.prm-telemetry-hud {
    background: rgba(10, 13, 20, 0.92) !important;
    border: 1px solid rgba(14, 165, 233, 0.25) !important;
    border-radius: var(--radius-sm) !important;
}

.prm-stat-label {
    font-family: 'JetBrains Mono', monospace !important;
    color: #0ea5e9 !important;
    font-size: 11px !important;
}

.prm-stat-label i {
    color: #38bdf8 !important;
}

.prm-stat-val {
    font-family: 'JetBrains Mono', monospace !important;
    color: #f8fafc !important;
    font-weight: 800 !important;
}

.prm-stat-val.highlight {
    color: #38bdf8 !important;
    text-shadow: 0 0 10px rgba(14, 165, 233, 0.5) !important;
}

/* 8. Result Actions & Feedback Panel */
.meta-tag {
    font-family: 'JetBrains Mono', monospace !important;
    font-size: 11px !important;
    border-radius: 3px !important;
    border: 1px solid rgba(14, 165, 233, 0.3) !important;
    background: rgba(14, 165, 233, 0.12) !important;
    color: #bae6fd !important;
}

.download-btn {
    border-radius: var(--radius-sm) !important;
    background: linear-gradient(135deg, #0284c7, #b45309) !important;
    border: 1px solid #0ea5e9 !important;
    color: #ffffff !important;
    font-family: 'JetBrains Mono', monospace !important;
    font-weight: 800 !important;
    font-size: 12px !important;
    text-transform: uppercase !important;
    box-shadow: 0 4px 18px rgba(14, 165, 233, 0.45) !important;
}

.action-btn {
    border-radius: var(--radius-sm) !important;
    background: rgba(14, 18, 26, 0.85) !important;
    border: 1px solid rgba(14, 165, 233, 0.25) !important;
    color: #cbd5e1 !important;
    font-family: 'JetBrains Mono', monospace !important;
    font-size: 11px !important;
}

.action-btn:hover {
    background: rgba(14, 165, 233, 0.18) !important;
    border-color: #0ea5e9 !important;
    color: #38bdf8 !important;
}

.feedback-panel {
    background: rgba(10, 13, 20, 0.95) !important;
    border: 1px solid rgba(14, 165, 233, 0.3) !important;
    border-radius: var(--radius-sm) !important;
}

.feedback-title {
    color: #f8fafc !important;
    font-family: 'JetBrains Mono', monospace !important;
}

.feedback-reward-badge {
    background: rgba(14, 165, 233, 0.18) !important;
    border: 1px solid rgba(14, 165, 233, 0.4) !important;
    color: #38bdf8 !important;
    font-family: 'JetBrains Mono', monospace !important;
}

.feedback-btn {
    border-radius: var(--radius-sm) !important;
    border: 1px solid rgba(255, 255, 255, 0.14) !important;
    background: rgba(13, 19, 33, 0.85) !important;
    color: #94a3b8 !important;
    font-family: 'Plus Jakarta Sans', sans-serif !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 8px !important;
    padding: 8px 16px !important;
    cursor: pointer !important;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
    min-height: 44px !important;
    box-sizing: border-box !important;
}

.feedback-btn:hover {
    border-color: rgba(255, 255, 255, 0.35) !important;
    color: #f8fafc !important;
    background: rgba(20, 30, 52, 0.95) !important;
    transform: translateY(-1px) !important;
}

/* Idle icon colors */
.feedback-btn.thumbs-up i { color: #34d399; }
.feedback-btn.thumbs-down i { color: #f87171; }
.feedback-btn.starred i { color: #fbbf24; }

/* Clear, distinct SELECTED states */
.feedback-btn.thumbs-up.selected {
    background: rgba(16, 185, 129, 0.22) !important;
    border: 1.5px solid #10b981 !important;
    color: #ffffff !important;
    box-shadow: 0 0 16px rgba(16, 185, 129, 0.35) !important;
}
.feedback-btn.thumbs-up.selected i { color: #34d399 !important; }

.feedback-btn.thumbs-down.selected {
    background: rgba(244, 63, 94, 0.22) !important;
    border: 1.5px solid #f43f5e !important;
    color: #ffffff !important;
    box-shadow: 0 0 16px rgba(244, 63, 94, 0.35) !important;
}
.feedback-btn.thumbs-down.selected i { color: #fb7185 !important; }

.feedback-btn.starred.selected {
    background: rgba(245, 158, 11, 0.25) !important;
    border: 1.5px solid #fbbf24 !important;
    color: #ffffff !important;
    box-shadow: 0 0 16px rgba(245, 158, 11, 0.4) !important;
}
.feedback-btn.starred.selected i { color: #fde047 !important; }

.fb-submit-btn {
    border-radius: var(--radius-sm) !important;
    background: linear-gradient(135deg, #0284c7, #2563eb) !important;
    border: 1px solid #38bdf8 !important;
    color: #ffffff !important;
    font-family: 'Plus Jakarta Sans', sans-serif !important;
    font-weight: 700 !important;
    font-size: 12px !important;
    text-transform: uppercase !important;
    box-shadow: 0 4px 14px rgba(14, 165, 233, 0.35) !important;
}
.fb-submit-btn:hover {
    background: linear-gradient(135deg, #0ea5e9, #1d4ed8) !important;
    box-shadow: 0 6px 18px rgba(14, 165, 233, 0.5) !important;
}

/* 9. Lightbox Cinema Modal (Rain City Cyber-Noir) */
dialog.lightbox-modal {
    background: rgba(0, 0, 0, 0.88) !important;
    backdrop-filter: blur(12px) !important;
}

.lightbox-modal-box {
    background: rgba(9, 12, 18, 0.98) !important;
    border: 1.5px solid rgba(14, 165, 233, 0.45) !important;
    border-radius: var(--radius-sm) !important;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.9), 0 0 40px rgba(14, 165, 233, 0.2) !important;
}

.lightbox-header {
    background: rgba(12, 16, 25, 0.9) !important;
    border-bottom: 1px solid rgba(14, 165, 233, 0.25) !important;
}

.lightbox-title-group h3 {
    font-family: 'Cinzel', serif !important;
    color: #f8fafc !important;
}

.lightbox-meta-info {
    font-family: 'JetBrains Mono', monospace !important;
    color: #38bdf8 !important;
}

.lightbox-action-btn {
    font-family: 'JetBrains Mono', monospace !important;
    background: rgba(14, 165, 233, 0.15) !important;
    border: 1px solid rgba(14, 165, 233, 0.4) !important;
    color: #38bdf8 !important;
    border-radius: var(--radius-sm) !important;
}

.lightbox-action-btn:hover {
    background: linear-gradient(135deg, #0284c7, #b45309) !important;
    border-color: #0ea5e9 !important;
    color: #ffffff !important;
    box-shadow: 0 0 12px rgba(14, 165, 233, 0.35) !important;
}

.lightbox-action-btn.inpaint-highlight {
    background: linear-gradient(135deg, #0284c7, #b45309) !important;
    border-color: #0ea5e9 !important;
    color: #ffffff !important;
    box-shadow: 0 0 14px rgba(14, 165, 233, 0.4) !important;
}

.result-actions .action-btn.lightbox-action-btn {
    background: rgba(14, 165, 233, 0.15) !important;
    color: #38bdf8 !important;
    border: 1px solid rgba(14, 165, 233, 0.4) !important;
}

.result-actions .action-btn.lightbox-action-btn:hover {
    background: linear-gradient(135deg, #0284c7, #b45309) !important;
    border-color: #0ea5e9 !important;
    color: #ffffff !important;
    box-shadow: 0 0 12px rgba(14, 165, 233, 0.35) !important;
}

.lightbox-prompt-text {
    font-family: 'JetBrains Mono', monospace !important;
    color: #bae6fd !important;
    background: rgba(7, 9, 14, 0.95) !important;
    border-top: 1px solid rgba(14, 165, 233, 0.25) !important;
}

/* 10. Admin User Gens Audit Modal */
dialog.admin-user-gens-modal {
    background: rgba(0, 0, 0, 0.88) !important;
    backdrop-filter: blur(12px) !important;
}

.admin-user-gens-box {
    background: rgba(9, 12, 18, 0.98) !important;
    border: 1.5px solid rgba(14, 165, 233, 0.45) !important;
    border-radius: var(--radius-sm) !important;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.9), 0 0 40px rgba(14, 165, 233, 0.2) !important;
}

.admin-user-gens-header {
    background: rgba(12, 16, 25, 0.9) !important;
    border-bottom: 1px solid rgba(14, 165, 233, 0.25) !important;
    color: #38bdf8 !important;
    font-family: 'JetBrains Mono', monospace !important;
}

.audit-card {
    background: rgba(14, 18, 28, 0.85) !important;
    border: 1px solid rgba(14, 165, 233, 0.22) !important;
    border-radius: var(--radius-sm) !important;
}

.audit-thumb img {
    border: 1px solid rgba(14, 165, 233, 0.3) !important;
    border-radius: var(--radius-sm) !important;
}

.audit-prompt-box {
    background: rgba(7, 9, 14, 0.9) !important;
    border: 1px solid rgba(14, 165, 233, 0.2) !important;
    border-radius: var(--radius-sm) !important;
    color: #f8fafc !important;
    font-family: 'JetBrains Mono', monospace !important;
}

.admin-loading-state {
    color: #38bdf8 !important;
    font-family: 'JetBrains Mono', monospace !important;
}

/* 11. Toggle Switches & Enhancers (Rain City Cyber-Noir) */
input:checked + .slider::after {
    background-color: rgba(14, 165, 233, 0.4) !important;
    border-color: #0ea5e9 !important;
    box-shadow: 0 0 10px rgba(14, 165, 233, 0.35) !important;
}

input:checked + .slider:before {
    transform: translateX(18px) !important;
    background-color: #0ea5e9 !important;
    box-shadow: 0 0 8px #0ea5e9 !important;
}

.enhancer-card.active {
    border-color: #0ea5e9 !important;
    background: rgba(14, 165, 233, 0.08) !important;
}

/* 12. Cluster HUD Hardware Telemetry Cards */
.hud-gpu-card {
    background: rgba(14, 18, 28, 0.85) !important;
    border: 1px solid rgba(14, 165, 233, 0.22) !important;
    border-radius: var(--radius-sm) !important;
}

.gpu-id-tag {
    font-family: 'JetBrains Mono', monospace !important;
    background: rgba(14, 165, 233, 0.15) !important;
    color: #38bdf8 !important;
    border: 1px solid rgba(14, 165, 233, 0.35) !important;
    border-radius: 3px !important;
}

.gpu-temp-badge {
    font-family: 'JetBrains Mono', monospace !important;
    color: #f8fafc !important;
    background: rgba(14, 165, 233, 0.12) !important;
    border: 1px solid rgba(14, 165, 233, 0.25) !important;
    border-radius: 3px !important;
}

.gpu-bar-track {
    background: rgba(7, 9, 14, 0.9) !important;
    border: 1px solid rgba(14, 165, 233, 0.15) !important;
    border-radius: 3px !important;
}

.gpu-bar-fill.bar-cyan,
.gpu-bar-fill.bar-purple {
    background: linear-gradient(90deg, #b45309, #0284c7, #0ea5e9) !important;
    box-shadow: 0 0 10px rgba(14, 165, 233, 0.4) !important;
    border-radius: 3px !important;
}

.hud-architecture-strip {
    background: rgba(14, 18, 28, 0.85) !important;
    border: 1px solid rgba(14, 165, 233, 0.22) !important;
    border-radius: var(--radius-sm) !important;
}

.arch-k {
    font-family: 'JetBrains Mono', monospace !important;
    color: #0ea5e9 !important;
}

.arch-v {
    font-family: 'JetBrains Mono', monospace !important;
    color: #f8fafc !important;
}

/* 13. Mobile Bottom Nav & Sticky Bar Glows */
.mobile-nav-btn.active i {
    filter: drop-shadow(0 0 8px rgba(14, 165, 233, 0.6)) !important;
}

/* 14. Inpaint Canvas Stage & Additional Tools */
.inpaint-stage-wrapper {
    background: #05070a !important;
    border: 1px solid rgba(14, 165, 233, 0.2) !important;
    border-radius: var(--radius-sm) !important;
}

.inpaint-res-pill,
.inpaint-zoom-label {
    font-family: 'JetBrains Mono', monospace !important;
    background: rgba(7, 9, 14, 0.9) !important;
    color: #38bdf8 !important;
    border: 1px solid rgba(14, 165, 233, 0.3) !important;
    border-radius: 3px !important;
}

.brush-preset-btn {
    font-family: 'JetBrains Mono', monospace !important;
    border-radius: 3px !important;
    background: rgba(14, 18, 26, 0.85) !important;
    border: 1px solid rgba(14, 165, 233, 0.25) !important;
    color: #cbd5e1 !important;
}

.brush-preset-btn:hover {
    background: rgba(14, 165, 233, 0.2) !important;
    border-color: #0ea5e9 !important;
    color: #ffffff !important;
}

.brush-preset-btn.active {
    background: linear-gradient(135deg, #0284c7, #b45309) !important;
    border-color: #0ea5e9 !important;
    color: #ffffff !important;
}

/* 15. Smart Inpaint Definitive Rain City Cyber-Noir */
.inpaint-title-group h3,
.inpaint-modal-header h3 {
    color: #f8fafc !important;
    font-family: 'Cinzel', serif !important;
}

.inpaint-title-group h3 i,
.inpaint-modal-header h3 i {
    color: #0ea5e9 !important;
}

.inpaint-modal-header p,
.inpaint-title-group span {
    font-family: 'JetBrains Mono', monospace !important;
    color: #38bdf8 !important;
}

.inpaint-upload-btn {
    font-family: 'JetBrains Mono', monospace !important;
    background: rgba(14, 165, 233, 0.15) !important;
    border: 1px solid rgba(14, 165, 233, 0.4) !important;
    color: #38bdf8 !important;
    border-radius: var(--radius-sm) !important;
}

.inpaint-upload-btn:hover {
    background: linear-gradient(135deg, #0284c7, #b45309) !important;
    border-color: #0ea5e9 !important;
    color: #ffffff !important;
}

.inpaint-brush-controls input[type="range"],
.inpaint-denoise-field input[type="range"],
#inpaint-brush-slider,
#inpaint-denoise-slider {
    accent-color: #0ea5e9 !important;
}

.inpaint-prompt-field input,
#inpaint-prompt-text {
    background: rgba(7, 9, 14, 0.95) !important;
    border: 1px solid rgba(14, 165, 233, 0.3) !important;
    border-radius: var(--radius-sm) !important;
    color: #f8fafc !important;
    font-family: 'JetBrains Mono', monospace !important;
}

.inpaint-prompt-field input:focus,
#inpaint-prompt-text:focus {
    border-color: #0ea5e9 !important;
    box-shadow: 0 0 12px rgba(14, 165, 233, 0.3) !important;
}

.inpaint-cost-hint .drops-badge {
    background: rgba(14, 165, 233, 0.15) !important;
    border: 1px solid rgba(14, 165, 233, 0.4) !important;
    color: #38bdf8 !important;
    font-family: 'JetBrains Mono', monospace !important;
}

.inpaint-execute-btn,
.inpaint-action-btn-commit,
#btn-execute-inpaint {
    background: linear-gradient(135deg, #0284c7, #b45309) !important;
    border: 1px solid #0ea5e9 !important;
    color: #ffffff !important;
    font-family: 'JetBrains Mono', monospace !important;
    font-weight: 800 !important;
    box-shadow: 0 4px 18px rgba(14, 165, 233, 0.45) !important;
    border-radius: var(--radius-sm) !important;
}

.inpaint-execute-btn:hover,
.inpaint-action-btn-commit:hover,
#btn-execute-inpaint:hover {
    filter: brightness(1.15) !important;
    box-shadow: 0 6px 24px rgba(14, 165, 233, 0.5) !important;
}

.inpaint-brush-cursor {
    border-color: rgba(14, 165, 233, 0.9) !important;
    background-color: rgba(14, 165, 233, 0.2) !important;
}

/* 16. Admin Modal KPI & Table Rain City Cyber-Noir */
.admin-shield-badge {
    background: #0ea5e9 !important;
    color: #000000 !important;
}

.kpi-card-admin,
.admin-card {
    background: rgba(14, 18, 28, 0.85) !important;
    border: 1px solid rgba(14, 165, 233, 0.22) !important;
    border-radius: var(--radius-sm) !important;
}

.admin-drops-badge {
    font-family: 'JetBrains Mono', monospace !important;
    color: #38bdf8 !important;
    background: rgba(14, 165, 233, 0.15) !important;
    border: 1px solid rgba(14, 165, 233, 0.35) !important;
    border-radius: 3px !important;
    padding: 2px 6px !important;
}

.role-badge.role-admin {
    background: rgba(14, 165, 233, 0.2) !important;
    color: #38bdf8 !important;
    border: 1px solid rgba(14, 165, 233, 0.4) !important;
}

.grant-btn {
    background: linear-gradient(135deg, #0284c7, #b45309) !important;
    border: 1px solid #0ea5e9 !important;
    color: #ffffff !important;
    font-family: 'JetBrains Mono', monospace !important;
    font-weight: 700 !important;
}

/* 17. Apex Admin Command Console Styling */
.admin-node-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 10px 16px;
    background: rgba(10, 13, 20, 0.95);
    border-bottom: 1px solid rgba(14, 165, 233, 0.2);
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
}

.admin-node-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #cbd5e1;
    background: rgba(14, 18, 28, 0.85);
    border: 1px solid rgba(14, 165, 233, 0.25);
    border-radius: 3px;
    padding: 4px 10px;
}

.admin-chip-clickable {
    cursor: pointer !important;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
}
.admin-chip-clickable:hover {
    background: rgba(245, 158, 11, 0.18) !important;
    border-color: rgba(245, 158, 11, 0.6) !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 14px rgba(245, 158, 11, 0.25) !important;
}

.admin-node-chip i {
    color: #0ea5e9;
}

.admin-user-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    background: rgba(10, 14, 22, 0.85);
    border-bottom: 1px solid rgba(14, 165, 233, 0.2);
}

.admin-search-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(6, 8, 13, 0.9);
    border: 1px solid rgba(14, 165, 233, 0.3);
    border-radius: var(--radius-sm);
    padding: 6px 12px;
    flex: 1;
    max-width: 480px;
}

.admin-search-wrap i {
    color: #0ea5e9;
}

.admin-search-input {
    background: transparent;
    border: none;
    outline: none;
    color: #f8fafc;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    width: 100%;
}

.admin-user-count {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    color: #38bdf8;
    background: rgba(14, 165, 233, 0.12);
    border: 1px solid rgba(14, 165, 233, 0.3);
    padding: 4px 10px;
    border-radius: 3px;
}

.admin-kpi-card {
    background: rgba(14, 18, 28, 0.9) !important;
    border: 1px solid rgba(14, 165, 233, 0.25) !important;
    border-radius: var(--radius-sm) !important;
}

.admin-kpi-card:hover {
    border-color: #0ea5e9 !important;
    box-shadow: 0 0 16px rgba(14, 165, 233, 0.2) !important;
}

.admin-kpi-card .kpi-icon {
    color: #0ea5e9 !important;
    font-size: 18px !important;
}

.admin-kpi-card .kpi-value {
    font-family: 'JetBrains Mono', monospace !important;
    color: #f8fafc !important;
    font-size: 20px !important;
    font-weight: 800 !important;
}

.admin-kpi-card .kpi-label {
    font-family: 'JetBrains Mono', monospace !important;
    color: #9ca3af !important;
    font-size: 10px !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
}

.admin-chart-card {
    background: rgba(14, 18, 28, 0.9) !important;
    border: 1px solid rgba(14, 165, 233, 0.25) !important;
    border-radius: var(--radius-sm) !important;
}

.admin-chart-card .chart-title {
    color: #38bdf8 !important;
    font-family: 'JetBrains Mono', monospace !important;
    font-size: 12px !important;
    text-transform: uppercase !important;
}

.admin-bar-item .bar-track {
    background: rgba(6, 8, 13, 0.9) !important;
    border: 1px solid rgba(14, 165, 233, 0.15) !important;
    border-radius: 3px !important;
}

.admin-bar-item .bar-fill {
    background: linear-gradient(90deg, #b45309, #0284c7, #0ea5e9) !important;
    box-shadow: 0 0 10px rgba(14, 165, 233, 0.4) !important;
    border-radius: 3px !important;
}

/* ==========================================================================
   COMMUNITY LEADERBOARD & MOBILE RESPONSIVE POLISH (CYBERPUNK AMBER CRT)
   ========================================================================== */

/* 1. Header Trigger & Navigation */
.leaderboard-trigger-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(14, 18, 28, 0.9);
    border: 1px solid rgba(14, 165, 233, 0.4);
    border-radius: var(--radius-sm);
    color: #38bdf8;
    padding: 6px 12px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
}

.leaderboard-trigger-btn:hover {
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.2), rgba(14, 165, 233, 0.3));
    border-color: #38bdf8;
    color: #ffffff;
    box-shadow: 0 0 14px rgba(14, 165, 233, 0.4);
}

.leaderboard-pill-btn i {
    color: #38bdf8;
}

/* 2. Leaderboard Modal Dialog */
.leaderboard-modal {
    position: fixed !important;
    inset: 0 !important;
    margin: auto !important;
    width: 95vw;
    max-width: 960px;
    max-height: 90vh;
    background: #080e1a;
    border: 1.5px solid rgba(14, 165, 233, 0.45);
    border-radius: var(--radius-md);
    box-shadow: 0 16px 50px rgba(0, 0, 0, 0.85), 0 0 30px rgba(14, 165, 233, 0.15);
    padding: 0;
    color: #f8fafc;
    overflow: hidden;
}

.leaderboard-modal::backdrop {
    background: rgba(4, 6, 10, 0.82);
    backdrop-filter: blur(8px);
}

.leaderboard-modal-content {
    display: flex;
    flex-direction: column;
    max-height: 90vh;
    overflow-y: auto;
    padding: 20px 24px;
    gap: 16px;
}

.leaderboard-live-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    background: rgba(34, 197, 94, 0.15);
    border: 1px solid rgba(34, 197, 94, 0.4);
    color: #4ade80;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.5px;
}

.leaderboard-subtitle {
    color: #9ca3af;
    font-size: 12px;
    margin-top: 4px;
}

/* 3. Summary Strip */
.leaderboard-summary-strip {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    background: rgba(12, 16, 26, 0.95);
    border: 1px solid rgba(14, 165, 233, 0.25);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    flex-shrink: 0 !important;
}

.lb-summary-item {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.lb-sum-icon {
    font-size: 20px;
    color: #0ea5e9;
    flex-shrink: 0;
}

.lb-sum-body {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.lb-summary-num {
    font-family: 'JetBrains Mono', monospace;
    font-size: 17px;
    font-weight: 800;
    color: #38bdf8;
    line-height: 1.1;
}

.lb-summary-lbl {
    font-size: 10px;
    color: #9ca3af;
    text-transform: uppercase;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 4. Category Tabs */
.leaderboard-tabs {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    border-bottom: 1.5px solid rgba(14, 165, 233, 0.3) !important;
    padding: 4px 2px 10px !important;
    overflow-x: auto !important;
    white-space: nowrap !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: thin !important;
    flex-shrink: 0 !important;
    min-height: 48px !important;
}

.lb-tab {
    display: inline-flex !important;
    align-items: center !important;
    gap: 7px !important;
    background: rgba(14, 18, 28, 0.8) !important;
    border: 1px solid rgba(14, 165, 233, 0.25) !important;
    border-radius: var(--radius-sm) !important;
    color: #9ca3af !important;
    padding: 8px 16px !important;
    font-family: 'JetBrains Mono', monospace !important;
    font-size: 11.5px !important;
    font-weight: 700 !important;
    cursor: pointer !important;
    transition: all 0.15s ease !important;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
    height: 36px !important;
}

.lb-tab:hover {
    color: #f8fafc !important;
    background: rgba(14, 165, 233, 0.15) !important;
    border-color: rgba(14, 165, 233, 0.5) !important;
}

.lb-tab.active {
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.3), rgba(2, 132, 199, 0.45)) !important;
    border-color: #38bdf8 !important;
    color: #ffffff !important;
    box-shadow: 0 0 14px rgba(14, 165, 233, 0.35) !important;
}

/* 5. Top 3 Podium */
.lb-podium-grid {
    display: grid;
    grid-template-columns: 1fr 1.15fr 1fr;
    gap: 14px;
    align-items: flex-end;
    margin: 16px 0 16px;
    flex-shrink: 0;
}

.lb-podium-card {
    background: rgba(13, 17, 26, 0.95);
    border: 1.5px solid rgba(14, 165, 233, 0.3);
    border-radius: var(--radius-sm);
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    position: relative;
    transition: all 0.2s ease;
}

.lb-podium-card.rank-gold {
    background: linear-gradient(180deg, rgba(14, 165, 233, 0.14) 0%, rgba(13, 17, 26, 0.98) 100%);
    border-color: #0ea5e9;
    box-shadow: 0 0 25px rgba(14, 165, 233, 0.25);
    transform: translateY(-4px);
}

.lb-podium-card.rank-silver {
    background: linear-gradient(180deg, rgba(148, 163, 184, 0.12) 0%, rgba(13, 17, 26, 0.98) 100%);
    border-color: #94a3b8;
    box-shadow: 0 0 16px rgba(148, 163, 184, 0.2);
}

.lb-podium-card.rank-bronze {
    background: linear-gradient(180deg, rgba(14, 165, 233, 0.12) 0%, rgba(13, 17, 26, 0.98) 100%);
    border-color: #0284c7;
    box-shadow: 0 0 16px rgba(14, 165, 233, 0.2);
}

.lb-podium-medal {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.rank-gold .lb-podium-medal { color: #38bdf8; }
.rank-silver .lb-podium-medal { color: #cbd5e1; }
.rank-bronze .lb-podium-medal { color: #f97316; }

.lb-avatar-frame {
    position: relative;
    width: 64px;
    height: 64px;
    margin-bottom: 8px;
}

.rank-gold .lb-avatar-frame {
    width: 76px;
    height: 76px;
}

.lb-avatar {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(14, 165, 233, 0.4);
}

.rank-gold .lb-avatar {
    border-color: #38bdf8;
    box-shadow: 0 0 14px rgba(56, 189, 248, 0.5);
}

.rank-silver .lb-avatar { border-color: #cbd5e1; }
.rank-bronze .lb-avatar { border-color: #ea580c; }

.lb-rank-badge {
    position: absolute;
    bottom: -4px;
    right: -4px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    font-weight: 800;
    padding: 1px 6px;
    border-radius: 10px;
    color: #000;
}

.lb-rank-badge.rank-gold { background: #38bdf8; box-shadow: 0 0 8px #38bdf8; }
.lb-rank-badge.rank-silver { background: #e2e8f0; }
.lb-rank-badge.rank-bronze { background: #f97316; color: #fff; }

.lb-user-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
    max-width: 100%;
    margin-bottom: 6px;
}

.lb-name {
    font-weight: 700;
    font-size: 13px;
    color: #f8fafc;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lb-handle {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10.5px;
    color: #9ca3af;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lb-kpi-pill {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(14, 165, 233, 0.3);
    border-radius: var(--radius-sm);
    padding: 4px 8px;
    font-size: 11px;
    color: #bae6fd;
    font-family: 'JetBrains Mono', monospace;
    margin-bottom: 6px;
}

.lb-kpi-pill strong {
    color: #38bdf8;
    font-size: 12px;
}

.lb-stats-mini {
    display: flex;
    gap: 8px;
    font-size: 10.5px;
    color: #94a3b8;
    font-family: 'JetBrains Mono', monospace;
}

/* 6. Rankings Table */
.lb-table-wrap {
    background: rgba(11, 15, 23, 0.95);
    border: 1px solid rgba(14, 165, 233, 0.25);
    border-radius: var(--radius-sm);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.lb-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.lb-table th {
    background: rgba(14, 18, 28, 0.95);
    color: #38bdf8;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1.5px solid rgba(14, 165, 233, 0.3);
    white-space: nowrap;
}

.lb-table td {
    padding: 10px 14px;
    border-bottom: 1px solid rgba(14, 165, 233, 0.12);
    vertical-align: middle;
    white-space: nowrap;
}

.lb-table tr:hover td {
    background: rgba(14, 165, 233, 0.06);
}

.lb-row-top3 td {
    background: rgba(14, 165, 233, 0.03);
}

.lb-table-rank {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 800;
}

.lb-table-rank.gold-badge { background: #fbbf24; color: #1a1001; box-shadow: 0 0 8px rgba(251, 191, 36, 0.7); }
.lb-table-rank.silver-badge { background: #cbd5e1; color: #0f172a; box-shadow: 0 0 6px rgba(203, 213, 225, 0.5); }
.lb-table-rank.bronze-badge { background: #ea580c; color: #fff; box-shadow: 0 0 6px rgba(234, 88, 12, 0.5); }
.lb-table-rank.normal-badge { background: rgba(255, 255, 255, 0.07); color: #94a3b8; }

.lb-table-user {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 140px;
}

.lb-table-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid rgba(14, 165, 233, 0.3);
    flex-shrink: 0;
}

.lb-table-user-meta {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.lb-table-display-name {
    font-weight: 700;
    color: #f8fafc;
    font-size: 12.5px;
}

.lb-table-username {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    color: #9ca3af;
}

/* ==========================================================================
   MOBILE VIEWPORT AUDIT FIXES (OVERLAPPING TEXT & CRAMPED CONTROLS)
   ========================================================================= */

/* 1. Header & User Auth Bar Fix on Mobile */
@media (max-width: 768px) {
    .header-right {
        display: flex;
        align-items: center;
        gap: 6px !important;
        flex-shrink: 0;
    }

    .leaderboard-trigger-btn {
        padding: 5px 9px !important;
        font-size: 10px !important;
        min-height: 34px;
    }

    .leaderboard-trigger-btn .lb-trigger-text {
        display: none;
    }

    @media (max-width: 640px) {
        .header-right #btn-open-leaderboard {
            display: none !important;
        }
    }

    .auth-bar .user-profile-badge {
        display: inline-flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        align-items: center !important;
        gap: 6px !important;
        padding: 3px 6px !important;
        background: rgba(12, 16, 26, 0.95) !important;
        border: 1px solid rgba(14, 165, 233, 0.3) !important;
        border-radius: var(--radius-sm) !important;
        max-width: 100% !important;
        overflow: hidden !important;
    }

    .auth-bar .user-avatar {
        width: 28px !important;
        height: 28px !important;
        border-radius: 50% !important;
        flex-shrink: 0 !important;
    }

    .auth-bar .user-meta {
        display: flex !important;
        flex-direction: column !important;
        justify-content: center !important;
        min-width: 0 !important;
        max-width: 75px !important;
        gap: 1px !important;
    }

    .auth-bar .user-name {
        font-size: 11px !important;
        font-weight: 700 !important;
        color: #f8fafc !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        max-width: 70px !important;
        line-height: 1.2 !important;
    }

    .auth-bar .drops-badge {
        font-size: 9.5px !important;
        padding: 1px 4px !important;
        color: #38bdf8 !important;
        background: rgba(14, 165, 233, 0.12) !important;
        border: 1px solid rgba(14, 165, 233, 0.25) !important;
        border-radius: 3px !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        max-width: 70px !important;
        line-height: 1.1 !important;
    }

    .auth-bar .drops-badge .drops-text {
        display: none !important;
    }

    .user-actions {
        display: inline-flex !important;
        align-items: center !important;
        gap: 4px !important;
        flex-shrink: 0 !important;
    }

    .auth-bar .admin-trigger-btn {
        min-width: 30px !important;
        min-height: 30px !important;
        width: 30px !important;
        height: 30px !important;
        padding: 0 !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        border-radius: var(--radius-sm) !important;
        background: linear-gradient(135deg, #0ea5e9, #0284c7) !important;
        color: #ffffff !important;
        border: 1px solid #38bdf8 !important;
    }

    .auth-bar .admin-trigger-btn .admin-btn-text {
        display: none !important;
    }

    .auth-bar .admin-trigger-btn i {
        font-size: 12px !important;
    }

    .auth-bar .logout-link {
        min-width: 28px !important;
        min-height: 28px !important;
        width: 28px !important;
        height: 28px !important;
        padding: 0 !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        border-radius: var(--radius-sm) !important;
        background: rgba(255, 255, 255, 0.06) !important;
        border: 1px solid rgba(255, 255, 255, 0.1) !important;
        color: #9ca3af !important;
        font-size: 12px !important;
    }

    .auth-bar .logout-link:hover {
        color: #f87171 !important;
        border-color: #f87171 !important;
    }

    .auth-bar .logout-link .logout-text {
        display: none !important;
    }

    @media (max-width: 480px) {
        .studio-header {
            padding: 6px 8px !important;
            gap: 6px !important;
        }

        .brand {
            gap: 6px !important;
            min-width: 0 !important;
        }

        .brand-title-row h1 {
            font-size: 13.5px !important;
        }

        .brand-title-row h1 span {
            font-size: 13.5px !important;
        }

        .header-right {
            flex-shrink: 0 !important;
            min-width: auto !important;
            gap: 4px !important;
        }

        .auth-bar .user-profile-badge {
            display: inline-flex !important;
            flex-direction: row !important;
            flex-wrap: nowrap !important;
            align-items: center !important;
            justify-content: flex-start !important;
            gap: 5px !important;
            padding: 3px 5px !important;
            overflow: visible !important;
            flex-shrink: 0 !important;
        }

        .auth-bar .user-meta {
            display: none !important;
        }
    }
}

/* KPI Value overflow protection */
.admin-kpi-card .kpi-value {
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    max-width: 100% !important;
}

#admin-tab-training .admin-kpi-grid {
    grid-template-columns: repeat(4, 1fr) !important;
    width: 100% !important;
}

@media (max-width: 600px) {
    #admin-tab-training .admin-kpi-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* 2. Admin Modal Tabs & KPI Grid Fix on Mobile */
@media (max-width: 600px) {
    .admin-modal-content {
        padding: 14px 12px !important;
    }

    .admin-node-strip {
        display: flex !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        gap: 6px !important;
        padding-bottom: 4px !important;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .admin-node-chip {
        white-space: nowrap !important;
        flex-shrink: 0 !important;
        padding: 4px 8px !important;
        font-size: 10px !important;
    }

    .admin-tabs {
        display: flex !important;
        gap: 6px !important;
        padding: 8px 4px 0 !important;
        overflow-x: auto !important;
        white-space: nowrap !important;
        -webkit-overflow-scrolling: touch !important;
        scrollbar-width: thin;
        flex-shrink: 0 !important;
    }

    .admin-tab {
        white-space: nowrap !important;
        flex-shrink: 0 !important;
        display: inline-flex !important;
        align-items: center !important;
        gap: 6px !important;
        padding: 8px 12px 9px !important;
        font-size: 11px !important;
    }

    .admin-tab-panel {
        padding: 12px 4px !important;
    }

    /* KPI Grid on Mobile: 2 clean columns, text never overflows */
    .admin-kpi-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px !important;
    }

    .admin-kpi-card {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 4px !important;
        padding: 10px 10px !important;
    }

    .admin-kpi-card .kpi-icon {
        font-size: 16px !important;
        margin-bottom: 2px;
    }

    .admin-kpi-card .kpi-value {
        font-size: 18px !important;
    }

    .admin-kpi-card .kpi-label {
        white-space: normal !important;
        line-height: 1.25 !important;
        font-size: 9.5px !important;
        overflow-wrap: break-word !important;
    }

    /* Podium on Mobile */
    .lb-podium-grid {
        grid-template-columns: 1fr !important;
        gap: 10px !important;
    }

    .lb-podium-card.rank-gold {
        order: -1 !important;
        transform: none !important;
    }

    .leaderboard-summary-strip {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px !important;
    }
}

/* 3. Mobile Sticky Bottom Generate Bar Solid Opaque Background */
.mobile-sticky-generate-bar {
    background: #080e1a !important;
    border-top: 1.5px solid rgba(14, 165, 233, 0.3) !important;
    box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.9) !important;
}

.mobile-bottom-nav {
    background: #060913 !important;
    border-top: 1px solid rgba(14, 165, 233, 0.25) !important;
}

/* 4. Character Roster Categories & Mobile Responsiveness */
.roster-filter-pills {
    overflow-x: auto !important;
    white-space: nowrap !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: none;
    display: flex !important;
    gap: 6px !important;
    padding-bottom: 4px !important;
}

.filter-tab {
    flex-shrink: 0 !important;
    white-space: nowrap !important;
}

/* Prevent horizontal overflow on mobile body */
html, body {
    max-width: 100vw;
    overflow-x: hidden;
}

/* ==========================================================================
   RAIN CITY MODERN TOAST NOTIFICATIONS & SOUND TOGGLE
   ========================================================================== */
.toast-container {
    position: fixed;
    top: 72px;
    right: 24px;
    z-index: 999999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
    max-width: 360px;
    width: calc(100vw - 48px);
}

@media (max-width: 640px) {
    .toast-container {
        top: 14px;
        right: 14px;
        left: 14px;
        width: auto;
        max-width: 100%;
        align-items: stretch;
    }
}

.toast {
    pointer-events: auto;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 14px 18px;
    border-radius: 14px;
    background: rgba(13, 20, 36, 0.94);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    box-shadow: 0 14px 40px -8px rgba(0, 0, 0, 0.75), 0 0 25px rgba(56, 189, 248, 0.15);
    border: 1px solid rgba(56, 189, 248, 0.3);
    color: #f1f5f9;
    animation: toastSlideIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    transition: transform 0.25s ease, opacity 0.25s ease;
    cursor: pointer;
    user-select: none;
}

.toast.toast-exit {
    opacity: 0;
    transform: translateY(-12px) scale(0.96);
}

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.93);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.toast-reward, .toast-cashback {
    border-color: rgba(251, 191, 36, 0.55) !important;
    background: linear-gradient(135deg, rgba(20, 30, 48, 0.96), rgba(26, 46, 30, 0.96)) !important;
    box-shadow: 0 14px 40px -8px rgba(0, 0, 0, 0.75), 0 0 30px rgba(245, 158, 11, 0.3) !important;
}

.toast-success {
    border-color: rgba(52, 211, 153, 0.55) !important;
    background: linear-gradient(135deg, rgba(13, 22, 38, 0.96), rgba(12, 42, 32, 0.96)) !important;
    box-shadow: 0 14px 40px -8px rgba(0, 0, 0, 0.75), 0 0 25px rgba(16, 185, 129, 0.25) !important;
}

.toast-error {
    border-color: rgba(239, 68, 68, 0.55) !important;
    background: linear-gradient(135deg, rgba(24, 18, 28, 0.96), rgba(48, 18, 22, 0.96)) !important;
    box-shadow: 0 14px 40px -8px rgba(0, 0, 0, 0.75), 0 0 25px rgba(239, 68, 68, 0.25) !important;
}

.toast-icon-wrap {
    font-size: 20px;
    line-height: 1;
    margin-top: 1px;
    flex-shrink: 0;
}

.toast-body {
    flex: 1;
    min-width: 0;
}

.toast-title {
    font-size: 11.5px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #94a3b8;
    margin-bottom: 3px;
}

.toast-reward .toast-title, .toast-cashback .toast-title {
    color: #fbbf24;
}

.toast-success .toast-title {
    color: #34d399;
}

.toast-error .toast-title {
    color: #f87171;
}

.toast-msg {
    font-size: 13.5px;
    font-weight: 500;
    line-height: 1.45;
    color: #e2e8f0;
    word-break: break-word;
}

.toast-close {
    background: none;
    border: none;
    color: #64748b;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
    transition: color 0.15s ease;
    align-self: flex-start;
}

.toast-close:hover {
    color: #f1f5f9;
}

.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    width: 100%;
    background: rgba(56, 189, 248, 0.7);
    animation: toastProgress linear forwards;
}

.toast-reward .toast-progress, .toast-cashback .toast-progress {
    background: linear-gradient(90deg, #f59e0b, #fbbf24);
}

.toast-success .toast-progress {
    background: linear-gradient(90deg, #059669, #34d399);
}

.toast-error .toast-progress {
    background: linear-gradient(90deg, #dc2626, #f87171);
}

@keyframes toastProgress {
    from { width: 100%; }
    to { width: 0%; }
}

/* Header Sound Pill Button */
.header-sound-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm, 8px);
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid rgba(56, 189, 248, 0.25);
    color: #38bdf8;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.header-sound-pill:hover {
    background: rgba(56, 189, 248, 0.15);
    border-color: rgba(56, 189, 248, 0.55);
    transform: translateY(-1px);
    color: #7dd3fc;
    box-shadow: 0 0 12px rgba(56, 189, 248, 0.35);
}

.header-sound-pill.sound-muted {
    color: #64748b;
    border-color: rgba(100, 116, 139, 0.3);
    background: rgba(15, 23, 42, 0.4);
    box-shadow: none;
}

.header-sound-pill.sound-muted:hover {
    color: #94a3b8;
    border-color: rgba(148, 163, 184, 0.4);
}

/* Pre-generation Privacy Toggle & Lightbox Author Action Styling */
.generator-privacy-bar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    margin-bottom: 6px;
    padding: 0 4px;
}

.generator-privacy-bar .action-btn-checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 11.5px;
    font-family: 'JetBrains Mono', monospace;
    color: #94a3b8;
    cursor: pointer;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(56, 189, 248, 0.2);
    border-radius: var(--radius-sm);
    padding: 4px 10px;
    transition: all 0.2s ease;
}

.generator-privacy-bar .action-btn-checkbox-label:hover {
    border-color: rgba(56, 189, 248, 0.45);
    color: #f8fafc;
    background: rgba(15, 23, 42, 0.85);
}

.generator-privacy-bar .action-btn-checkbox-label input:checked + span {
    color: #fbbf24;
}

.lightbox-action-btn.lightbox-like-btn {
    color: #f43f5e;
    border-color: rgba(244, 63, 94, 0.3);
}

.lightbox-action-btn.lightbox-like-btn:hover {
    background: rgba(244, 63, 94, 0.15);
    border-color: #f43f5e;
}

.lightbox-action-btn.lightbox-like-btn.liked {
    background: rgba(244, 63, 94, 0.25);
    border-color: #f43f5e;
    color: #ff4d6d;
}

.lightbox-action-btn.lightbox-privacy-btn {
    color: #f59e0b;
    border-color: rgba(245, 158, 11, 0.35);
}

.lightbox-action-btn.lightbox-privacy-btn:hover {
    background: rgba(245, 158, 11, 0.15);
    border-color: #f59e0b;
}

.lightbox-action-btn.lightbox-share-btn {
    color: #38bdf8;
    border-color: rgba(56, 189, 248, 0.35);
}

.lightbox-action-btn.lightbox-share-btn.is-published {
    color: #34d399;
    border-color: rgba(52, 211, 153, 0.4);
    background: rgba(52, 211, 153, 0.12);
}

/* Gallery Zoom Button (Hover / Touch on thumbnail) */
.gallery-zoom-btn {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(10, 15, 30, 0.78);
    border: 1px solid rgba(255, 255, 255, 0.22);
    color: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    cursor: pointer;
    backdrop-filter: blur(8px);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 5;
    opacity: 0.85;
}

.gallery-card:hover .gallery-zoom-btn {
    opacity: 1;
    transform: scale(1.05);
}

.gallery-zoom-btn:hover {
    background: rgba(56, 189, 248, 0.95);
    color: #030712;
    transform: scale(1.15) !important;
    box-shadow: 0 0 16px rgba(56, 189, 248, 0.65);
    border-color: #38bdf8;
}

/* History Item Pub Pill & Zoom Icon */
.history-item-pub-pill {
    position: absolute;
    bottom: 4px;
    left: 4px;
    font-size: 8.5px;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
    padding: 1.5px 5px;
    border-radius: 4px;
    letter-spacing: 0.3px;
    pointer-events: none;
    z-index: 3;
    backdrop-filter: blur(4px);
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.history-item-pub-pill.public {
    background: rgba(16, 185, 129, 0.85);
    color: #ffffff;
    border: 1px solid rgba(52, 211, 153, 0.5);
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.35);
}

.history-item-pub-pill.private {
    background: rgba(30, 41, 59, 0.85);
    color: #94a3b8;
    border: 1px solid rgba(148, 163, 184, 0.3);
}

.history-item-zoom-icon {
    position: absolute;
    top: 4px;
    left: 4px;
    font-size: 10px;
    color: #ffffff;
    background: rgba(10, 15, 30, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    padding: 2px 4px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s ease, transform 0.15s ease;
    z-index: 3;
}

.history-item:hover .history-item-zoom-icon {
    opacity: 1;
    transform: scale(1.05);
}

/* Lightbox Footer Prompt & Actions */
.lightbox-footer-prompt-wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    width: 100%;
}

.lightbox-footer-prompt-wrap .lightbox-prompt-text {
    flex: 1;
    min-width: 0;
    margin: 0;
}

.lightbox-footer-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.lightbox-action-btns-group {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

@media (max-width: 1200px) and (min-width: 769px) {
    .lightbox-footer-prompt-wrap {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 8px !important;
    }
    .lightbox-footer-actions {
        width: 100% !important;
        justify-content: space-between !important;
    }
}

.lightbox-footer-actions .compact-pill-btn {
    padding: 5px 12px;
    font-size: 11.5px;
    font-family: 'JetBrains Mono', monospace;
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #cbd5e1;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.lightbox-footer-actions .compact-pill-btn:hover {
    background: rgba(56, 189, 248, 0.2);
    border-color: #38bdf8;
    color: #f8fafc;
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.3);
}

/* Generator Privacy Bar Styling */
.generator-privacy-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.generator-privacy-bar .gen-privacy-lbl {
    font-size: 11px;
    color: #64748b;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 600;
}

.generator-privacy-bar .action-btn-checkbox-label.is-private {
    border-color: rgba(251, 191, 36, 0.5) !important;
    background: rgba(251, 191, 36, 0.1) !important;
}

/* Floating Heart Micro-Interaction */
.floating-heart {
    position: fixed;
    pointer-events: none;
    z-index: 10000;
    color: #f43f5e;
    font-size: 20px;
    filter: drop-shadow(0 0 8px rgba(244, 63, 94, 0.7));
    transform: translate(-50%, -50%);
    animation: floatUpAndFade 0.75s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes floatUpAndFade {
    0% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(0.6) rotate(0deg);
    }
    40% {
        transform: translate(-50%, -100%) scale(1.3) rotate(-8deg);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -160%) scale(1) rotate(12deg);
    }
}

/* Prompt Highlight Pulse */
.prompt-pulse-highlight {
    animation: promptPulseGlow 1.8s ease-out forwards;
}

@keyframes promptPulseGlow {
    0% {
        box-shadow: 0 0 0 2px #38bdf8, 0 0 28px rgba(56, 189, 248, 0.7);
        border-color: #38bdf8 !important;
    }
    50% {
        box-shadow: 0 0 0 2px #818cf8, 0 0 20px rgba(129, 140, 248, 0.5);
        border-color: #818cf8 !important;
    }
    100% {
        box-shadow: none;
    }
}

/* Header Shortcuts Pill */
.header-shortcuts-pill {
    background: rgba(15, 23, 42, 0.75);
    border: 1px solid rgba(56, 189, 248, 0.2);
    border-radius: 9999px;
    color: #94a3b8;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    font-size: 14px;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.header-shortcuts-pill:hover {
    color: #38bdf8;
    border-color: #38bdf8;
    background: rgba(56, 189, 248, 0.12);
    box-shadow: 0 0 12px rgba(56, 189, 248, 0.25);
    transform: translateY(-1px);
}

/* Lightbox Remix & Polish Button */
.lightbox-footer-actions .remix-btn {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.22), rgba(56, 189, 248, 0.22)) !important;
    border-color: rgba(139, 92, 246, 0.5) !important;
    color: #e2e8f0 !important;
}

.lightbox-footer-actions .remix-btn:hover {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.4), rgba(56, 189, 248, 0.4)) !important;
    border-color: #a855f7 !important;
    color: #ffffff !important;
    box-shadow: 0 0 16px rgba(168, 85, 247, 0.45) !important;
}

/* Keyboard Shortcuts Modal Styling */
.shortcuts-modal {
    border: none;
    background: transparent;
    padding: 0;
    max-width: 600px;
    width: 90vw;
    margin: auto;
}

.shortcuts-modal::backdrop {
    background: rgba(3, 7, 18, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.shortcuts-modal-box {
    background: #0d1527;
    border: 1px solid rgba(56, 189, 248, 0.28);
    border-radius: 18px;
    padding: 24px;
    box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.85), 0 0 35px rgba(56, 189, 248, 0.12);
    color: #f8fafc;
}

.shortcuts-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    margin-bottom: 20px;
}

.shortcuts-title-group {
    display: flex;
    align-items: center;
    gap: 14px;
}

.shortcuts-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: rgba(56, 189, 248, 0.14);
    border: 1px solid rgba(56, 189, 248, 0.3);
    color: #38bdf8;
    font-size: 18px;
}

.shortcuts-title-group h3 {
    font-size: 18px;
    font-weight: 700;
    color: #f8fafc;
    margin: 0;
}

.shortcuts-subtitle {
    font-size: 12px;
    color: #94a3b8;
    margin-top: 3px;
}

.shortcuts-body {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.shortcuts-section {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    padding: 12px 16px;
}

.shortcuts-section-title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #38bdf8;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.shortcut-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.shortcut-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.shortcut-desc {
    font-size: 13px;
    color: #cbd5e1;
    font-weight: 500;
}

.shortcut-keys {
    display: flex;
    align-items: center;
    gap: 4px;
}

.shortcut-keys kbd {
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.4);
    border-radius: 6px;
    padding: 3px 8px;
    font-size: 11px;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 600;
    color: #e2e8f0;
}

/* Buy Me a Coffee (BMC) Official Support Button & Widget Styles */
.header-support-pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: linear-gradient(135deg, rgba(95, 127, 255, 0.22) 0%, rgba(59, 130, 246, 0.15) 100%);
    border: 1px solid rgba(95, 127, 255, 0.45);
    border-radius: 9999px;
    color: #e0e7ff;
    text-decoration: none;
    font-size: 0.82rem;
    font-weight: 700;
    padding: 0 14px;
    height: 36px;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 0 12px rgba(95, 127, 255, 0.22);
}

.header-support-pill i {
    color: #ffd159; /* Warm Coffee Gold */
    font-size: 0.95rem;
    filter: drop-shadow(0 0 4px rgba(255, 209, 89, 0.5));
}

.header-support-pill:hover {
    color: #ffffff;
    border-color: #5F7FFF;
    background: linear-gradient(135deg, rgba(95, 127, 255, 0.4) 0%, rgba(59, 130, 246, 0.3) 100%);
    box-shadow: 0 0 16px rgba(95, 127, 255, 0.5);
    transform: translateY(-1px);
}

@media (max-width: 640px) {
    .header-support-pill span {
        display: none;
    }
    .header-support-pill {
        padding: 0 10px;
        width: 36px;
        justify-content: center;
    }
}

.header-vibe-pill {
    --vibe-color: #34d399;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(15, 23, 42, 0.72);
    border: 1px solid rgba(148, 163, 184, 0.24);
    border-radius: 9999px;
    color: #e2e8f0;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 0 12px;
    height: 36px;
    white-space: nowrap;
    user-select: none;
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
    box-shadow: 0 0 10px rgba(52, 211, 153, 0.12);
}

.header-vibe-pill .vibe-pulse-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--vibe-color);
    box-shadow: 0 0 8px var(--vibe-color);
    flex-shrink: 0;
}

.header-vibe-pill .vibe-emoji {
    font-size: 0.9rem;
    line-height: 1;
}

@media (max-width: 960px) {
    .header-vibe-pill .vibe-label {
        display: none;
    }
    .header-vibe-pill {
        padding: 0 9px;
    }
}

/* Duo Staging Director Drawer (Left/Right Role Lock & Anti-Bleed) */
.duo-staging-drawer {
    margin-top: 8px;
    padding: 10px 12px;
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.92), rgba(30, 41, 59, 0.78));
    border: 1px solid rgba(56, 189, 248, 0.35);
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.duo-staging-drawer.hidden {
    display: none !important;
}

.duo-staging-hdr {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.78rem;
    font-weight: 700;
    color: #38bdf8;
}

.duo-mini-btn {
    background: rgba(56, 189, 248, 0.14);
    border: 1px solid rgba(56, 189, 248, 0.35);
    color: #bae6fd;
    border-radius: 6px;
    padding: 3px 8px;
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
}

.duo-mini-btn:hover {
    background: rgba(56, 189, 248, 0.28);
    color: #ffffff;
}

.duo-staging-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.duo-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.72rem;
    color: #94a3b8;
    font-weight: 600;
}

.duo-field-wide {
    grid-column: 1 / -1;
}

.duo-select {
    background: rgba(2, 6, 23, 0.8);
    border: 1px solid rgba(148, 163, 184, 0.28);
    color: #f1f5f9;
    border-radius: 7px;
    padding: 6px 8px;
    font-size: 0.78rem;
    outline: none;
}

.duo-select:focus {
    border-color: #38bdf8;
}

.duo-staging-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
}

.duo-lock-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.72rem;
    color: #cbd5e1;
    cursor: pointer;
}

.duo-apply-btn {
    background: linear-gradient(135deg, #0284c7, #38bdf8);
    border: none;
    color: #020617;
    font-weight: 800;
    font-size: 0.76rem;
    padding: 6px 12px;
    border-radius: 8px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.duo-apply-btn:hover {
    filter: brightness(1.1);
}

.oc-locker-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 150px;
    overflow-y: auto;
}

.oc-card-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 6px 9px;
    background: rgba(2, 6, 23, 0.7);
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 8px;
    font-size: 0.75rem;
}

.oc-card-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.oc-card-info strong {
    color: #f8fafc;
}

.oc-card-info small {
    color: #94a3b8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.oc-card-actions {
    display: inline-flex;
    gap: 5px;
    flex-shrink: 0;
}

/* Sidebar Support & Buy Me a Coffee Card */
.studio-support-section {
    margin-top: 10px;
    padding-bottom: 8px;
}

.support-sidebar-card {
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.85) 0%, rgba(95, 127, 255, 0.08) 100%);
    border: 1px solid rgba(95, 127, 255, 0.28);
    border-radius: 12px;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.support-sidebar-card:hover {
    border-color: rgba(95, 127, 255, 0.55);
    box-shadow: 0 4px 22px rgba(95, 127, 255, 0.2);
    transform: translateY(-1px);
}

.support-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.support-sidebar-title {
    font-size: 0.82rem;
    font-weight: 700;
    color: #e2e8f0;
    display: flex;
    align-items: center;
    gap: 7px;
}

.support-sidebar-badge {
    font-size: 0.68rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: rgba(95, 127, 255, 0.2);
    color: #a5b4fc;
    border: 1px solid rgba(95, 127, 255, 0.35);
    padding: 2px 7px;
    border-radius: 9999px;
}

.support-sidebar-desc {
    font-size: 0.76rem;
    color: #94a3b8;
    line-height: 1.35;
    margin: 0;
}

.bmc-sidebar-btn {
    display: inline-flex;
    margin-top: 4px;
    align-self: flex-start;
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), filter 0.2s ease;
}

.bmc-sidebar-btn:hover {
    transform: translateY(-2px);
    filter: drop-shadow(0 4px 14px rgba(95, 127, 255, 0.45));
}

.bmc-sidebar-img {
    height: 38px;
    max-width: 100%;
    width: auto;
    object-fit: contain;
    border-radius: 8px;
    display: block;
}

/* Mobile Optimizations for Support Card & Header */
@media (max-width: 640px) {
    .header-shortcuts-pill {
        display: none !important; /* No physical keyboard shortcuts on mobile touchscreens */
    }

    .support-sidebar-card {
        padding: 12px 14px;
        align-items: center;
        text-align: center;
    }

    .support-sidebar-header {
        width: 100%;
        justify-content: space-between;
    }

    .bmc-sidebar-btn {
        align-self: center;
        margin-top: 6px;
    }

    .bmc-sidebar-img {
        height: 36px;
    }
}

/* ==================================================================== */
/* MOBILE PERFECTION & ZERO-OVERFLOW SAFEGUARDS (PHONES 320px - 768px)  */
/* ==================================================================== */

@media (max-width: 768px) {
    /* 1. Closed Dialog Safeguard */
    dialog.roster-modal:not([open]),
    dialog.lightbox-modal:not([open]),
    dialog.leaderboard-modal:not([open]),
    dialog.cluster-hud-modal:not([open]),
    dialog.admin-modal:not([open]),
    dialog.inpaint-modal:not([open]),
    dialog.shortcuts-modal:not([open]) {
        display: none !important;
    }

    /* 1. Roster Modal Fullscreen Native Sheet */
    dialog.roster-modal[open],
    .roster-modal[open] {
        position: fixed !important;
        inset: 0 !important;
        margin: 0 !important;
        width: 100vw !important;
        max-width: 100vw !important;
        height: 100dvh !important;
        max-height: 100dvh !important;
        border-radius: 0 !important;
        border: none !important;
        background: #070a13 !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important; /* CRITICAL: Prevents horizontal shift */
        justify-content: flex-start !important;
        padding: 0 !important;
        overflow: hidden !important;
        box-sizing: border-box !important;
        z-index: 99999 !important;
    }

    .roster-modal .dialog-mount,
    .roster-modal .modal-content {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        height: 100% !important;
        max-height: 100% !important;
        min-height: 0 !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
        padding: 0 !important;
        margin: 0 !important;
        overflow: hidden !important;
        box-sizing: border-box !important;
        flex: 1 1 auto !important;
    }

    .roster-modal .modal-header {
        position: static !important;
        top: auto !important;
        flex-shrink: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        padding: 12px 14px 10px !important;
        background: rgba(10, 14, 25, 0.98) !important;
        border-bottom: 1px solid rgba(14, 165, 233, 0.25) !important;
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        gap: 8px !important;
    }

    .roster-modal .modal-title-group {
        flex: 1 1 auto !important;
        min-width: 0 !important;
        overflow: hidden !important;
    }

    .roster-modal .modal-title-group p {
        display: none !important; /* Maximizes vertical space for character list */
    }

    .roster-modal .modal-title-row {
        display: flex !important;
        align-items: center !important;
        gap: 8px !important;
        flex-wrap: nowrap !important;
        min-width: 0 !important;
    }

    .roster-modal .modal-title-row h2 {
        font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Inter, sans-serif !important;
        font-size: 15px !important;
        font-weight: 800 !important;
        color: #f8fafc !important;
        letter-spacing: -0.2px !important;
        margin: 0 !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }

    .roster-modal .roster-count-badge {
        font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
        font-size: 9px !important;
        font-weight: 700 !important;
        padding: 2px 6px !important;
        background: rgba(14, 165, 233, 0.15) !important;
        border: 1px solid rgba(14, 165, 233, 0.4) !important;
        color: #38bdf8 !important;
        border-radius: 4px !important;
        flex-shrink: 0 !important;
        white-space: nowrap !important;
    }

    .roster-modal .modal-close-btn {
        width: 36px !important;
        height: 36px !important;
        min-width: 36px !important;
        flex-shrink: 0 !important;
        background: rgba(255, 255, 255, 0.08) !important;
        border: 1px solid rgba(14, 165, 233, 0.35) !important;
        color: #bae6fd !important;
        border-radius: 8px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    .roster-modal .modal-filter-bar {
        position: static !important;
        top: auto !important;
        flex-shrink: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        padding: 8px 14px 10px !important;
        background: rgba(8, 11, 18, 0.98) !important;
        border-bottom: 1px solid rgba(14, 165, 233, 0.2) !important;
        display: flex !important;
        flex-direction: column !important;
        gap: 8px !important;
    }

    .roster-modal .search-box {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        height: 38px !important;
        min-height: 38px !important;
        padding: 0 10px !important;
        border-radius: 8px !important;
        background: rgba(12, 17, 28, 0.95) !important;
        border: 1px solid rgba(14, 165, 233, 0.3) !important;
        display: flex !important;
        align-items: center !important;
        gap: 8px !important;
    }

    .roster-modal .search-box input {
        width: 100% !important;
        font-size: 14px !important;
        padding: 8px 0 !important;
        color: #f8fafc !important;
        background: transparent !important;
        border: none !important;
        font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Inter, sans-serif !important;
    }

    .roster-modal .search-esc-hint {
        display: none !important;
    }

    /* Category filter horizontal swipe carousel */
    .roster-modal .category-filters {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        -webkit-overflow-scrolling: touch !important;
        gap: 6px !important;
        padding: 2px 0 4px 0 !important;
        scrollbar-width: none !important;
        box-sizing: border-box !important;
    }

    .roster-modal .category-filters::-webkit-scrollbar {
        display: none !important;
    }

    .roster-modal .filter-tab {
        flex: 0 0 auto !important;
        flex-shrink: 0 !important;
        white-space: nowrap !important;
        height: 30px !important;
        min-height: 30px !important;
        max-height: 30px !important;
        padding: 0 12px !important;
        font-size: 11px !important;
        font-weight: 700 !important;
        text-transform: uppercase !important;
        letter-spacing: 0.3px !important;
        border-radius: 15px !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Inter, sans-serif !important;
        background: rgba(14, 18, 28, 0.85) !important;
        border: 1px solid rgba(14, 165, 233, 0.25) !important;
        color: #cbd5e1 !important;
        cursor: pointer !important;
    }

    .roster-modal .filter-tab.active {
        background: linear-gradient(135deg, #0284c7, #b45309) !important;
        border-color: #0ea5e9 !important;
        color: #ffffff !important;
        box-shadow: 0 0 10px rgba(14, 165, 233, 0.35) !important;
    }

    /* Character List Grid */
    .roster-modal .roster-grid {
        flex: 1 1 auto !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        -webkit-overflow-scrolling: touch !important;
        min-height: 0 !important;
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 8px !important;
        padding: 10px 14px calc(24px + env(safe-area-inset-bottom, 16px)) !important;
        background: #070a12 !important;
    }

    /* Roster Cards */
    .roster-modal .roster-card {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        min-height: 64px !important;
        padding: 10px 12px !important;
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        gap: 10px !important;
        border-radius: 10px !important;
        background: rgba(14, 19, 32, 0.9) !important;
        border: 1px solid rgba(14, 165, 233, 0.22) !important;
        cursor: pointer !important;
        transition: transform 0.15s ease, background 0.15s ease !important;
    }

    .roster-modal .roster-card:active {
        transform: scale(0.985) !important;
        background: rgba(20, 28, 48, 0.98) !important;
    }

    .roster-modal .roster-card.active {
        background: rgba(14, 165, 233, 0.14) !important;
        border-color: #0ea5e9 !important;
        box-shadow: 0 0 14px rgba(14, 165, 233, 0.3) !important;
    }

    .roster-modal .roster-avatar-wrap {
        width: 50px !important;
        height: 50px !important;
        min-width: 50px !important;
        flex-shrink: 0 !important;
        position: relative !important;
        border-radius: 8px !important;
    }

    .roster-modal .roster-avatar {
        width: 50px !important;
        height: 50px !important;
        border-radius: 8px !important;
        object-fit: cover !important;
        border: 1.5px solid rgba(14, 165, 233, 0.4) !important;
        background: #000 !important;
    }

    .roster-modal .roster-cat-tag {
        font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
        font-size: 8px !important;
        font-weight: 800 !important;
        padding: 1px 4px !important;
        border-radius: 3px !important;
        bottom: -2px !important;
        right: -2px !important;
    }

    .roster-modal .roster-details {
        flex: 1 1 auto !important;
        min-width: 0 !important;
        overflow: hidden !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: center !important;
        gap: 2px !important;
    }

    .roster-modal .roster-name-row {
        display: flex !important;
        align-items: center !important;
        gap: 6px !important;
        min-width: 0 !important;
    }

    .roster-modal .roster-name {
        font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Inter, sans-serif !important;
        font-size: 14.5px !important;
        font-weight: 800 !important;
        color: #f8fafc !important;
        line-height: 1.25 !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }

    .roster-modal .roster-species {
        font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Inter, sans-serif !important;
        font-size: 11.5px !important;
        font-weight: 600 !important;
        color: #38bdf8 !important;
        line-height: 1.25 !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }

    .roster-modal .roster-traits-list {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 3px !important;
        margin-top: 2px !important;
        overflow: hidden !important;
    }

    .roster-modal .roster-pill {
        font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
        font-size: 9.5px !important;
        font-weight: 600 !important;
        padding: 1px 6px !important;
        border-radius: 3px !important;
        background: rgba(14, 165, 233, 0.12) !important;
        border: 1px solid rgba(14, 165, 233, 0.25) !important;
        color: #bae6fd !important;
        max-width: 130px !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }

    .roster-modal .roster-check {
        width: 22px !important;
        height: 22px !important;
        min-width: 22px !important;
        flex-shrink: 0 !important;
        border-radius: 50% !important;
        border: 1.5px solid rgba(14, 165, 233, 0.4) !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        margin-left: 2px !important;
    }

    .roster-modal .roster-card.active .roster-check {
        background: #0ea5e9 !important;
        border-color: #38bdf8 !important;
        box-shadow: 0 0 8px #0ea5e9 !important;
    }
}

/* 2. Controls & Prompt Quick Actions Overflow Fix (<640px) */
@media (max-width: 640px) {
    .section-label-row {
        width: 100% !important;
        max-width: 100% !important;
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        flex-wrap: wrap !important;
        gap: 6px !important;
        box-sizing: border-box !important;
    }

    .section-label-row .section-label {
        font-size: 0.78rem !important;
        flex-shrink: 0 !important;
    }

    .prompt-quick-actions {
        display: flex !important;
        align-items: center !important;
        justify-content: flex-end !important;
        gap: 5px !important;
        min-width: 0 !important;
        flex: 1 1 auto !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    .prompt-mode-toggle {
        display: inline-flex !important;
        flex: 1 1 auto !important;
        min-width: 0 !important;
        max-width: none !important;
        height: 32px !important;
    }

    .prompt-mode-toggle .mode-pill {
        flex: 1 1 auto !important;
        text-align: center !important;
        padding: 4px 8px !important;
        font-size: 0.7rem !important;
        min-width: 0 !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 4px !important;
    }

    /* Icon-only utility buttons to eliminate horizontal overflow */
    #btn-expand-prompt,
    #btn-toggle-editor-size {
        width: 32px !important;
        height: 32px !important;
        min-width: 32px !important;
        max-width: 32px !important;
        padding: 0 !important;
        flex-shrink: 0 !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        border-radius: var(--radius-sm) !important;
        font-size: 0.75rem !important;
    }

    #prompt-assist-text,
    #editor-expand-text {
        display: none !important; /* Pure icon on mobile screens */
    }

    /* Scenery chips container: clean swipeable carousel without screen overflow */
    .prompt-chips-compact {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        -webkit-overflow-scrolling: touch !important;
        scrollbar-width: none !important;
        padding: 4px 0 !important;
        gap: 6px !important;
        box-sizing: border-box !important;
    }

    .prompt-chips-compact::-webkit-scrollbar {
        display: none !important;
    }

    .prompt-chips-compact .chips-hint {
        flex-shrink: 0 !important;
    }

    .prompt-chips-compact .chip-btn {
        flex-shrink: 0 !important;
        white-space: nowrap !important;
        padding: 4px 10px !important;
        font-size: 0.72rem !important;
    }

    /* Character action pills */
    .char-action-pills {
        display: inline-flex !important;
        align-items: center !important;
        gap: 5px !important;
        flex-shrink: 0 !important;
    }

    .char-action-pills .compact-pill-btn {
        padding: 4px 8px !important;
        font-size: 11px !important;
        white-space: nowrap !important;
    }
}

/* ==================================================================== */
/* CINEMA VIEW (LIGHTBOX) MOBILE PERFECTION                             */
/* ==================================================================== */
@media (max-width: 768px) {
    dialog.lightbox-modal[open] {
        position: fixed !important;
        inset: 0 !important;
        margin: 0 !important;
        width: 100vw !important;
        max-width: 100vw !important;
        height: 100dvh !important;
        max-height: 100dvh !important;
        border-radius: 0 !important;
        border: none !important;
        padding: 0 !important;
        background: #000000 !important;
        display: flex !important;
        flex-direction: column !important;
        overflow: hidden !important;
        z-index: 999999 !important;
    }

    .lightbox-modal-box {
        width: 100% !important;
        max-width: 100% !important;
        height: 100% !important;
        max-height: 100% !important;
        border-radius: 0 !important;
        border: none !important;
        margin: 0 !important;
        padding: 0 !important;
        background: #060911 !important;
        display: flex !important;
        flex-direction: column !important;
        overflow: hidden !important;
        flex: 1 1 auto !important;
    }

    .lightbox-header {
        padding: 8px 12px !important;
        background: rgba(10, 14, 24, 0.98) !important;
        border-bottom: 1px solid rgba(14, 165, 233, 0.25) !important;
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        gap: 8px !important;
        flex-shrink: 0 !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .lightbox-title-group {
        flex: 1 1 auto !important;
        min-width: 0 !important;
        overflow: hidden !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: center !important;
        gap: 2px !important;
    }

    .lightbox-title-group h3 {
        font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Inter, sans-serif !important;
        font-size: 13.5px !important;
        font-weight: 700 !important;
        color: #f8fafc !important;
        margin: 0 !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        display: flex !important;
        align-items: center !important;
        gap: 6px !important;
    }

    .lightbox-meta-info {
        display: none !important; /* Hide 7-line inspection hint on phones */
    }

    .lightbox-nav-counter {
        font-size: 10px !important;
        font-weight: 700 !important;
        padding: 1px 6px !important;
        border-radius: 4px !important;
    }

    .lightbox-header-actions {
        display: flex !important;
        align-items: center !important;
        gap: 6px !important;
        flex-shrink: 0 !important;
    }

    /* Icon-only action buttons in Lightbox header */
    .lightbox-header .lightbox-action-btn {
        width: 34px !important;
        height: 34px !important;
        min-width: 34px !important;
        max-width: 34px !important;
        padding: 0 !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        border-radius: 6px !important;
        font-size: 13px !important;
        flex-shrink: 0 !important;
        box-sizing: border-box !important;
    }

    .lightbox-header .lightbox-action-btn span {
        display: none !important; /* Hide labels like 'Download' & 'Smart Inpaint' to prevent header overflow */
    }

    .lightbox-action-btn.lightbox-like-btn {
        width: auto !important;
        min-width: 44px !important;
        max-width: none !important;
        padding: 0 8px !important;
        gap: 4px !important;
    }

    .lightbox-action-btn.lightbox-like-btn span {
        display: inline !important; /* Keep like counter visible */
        font-size: 11px !important;
    }

    .lightbox-header .modal-close-btn {
        width: 34px !important;
        height: 34px !important;
        min-width: 34px !important;
        flex-shrink: 0 !important;
        border-radius: 6px !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        font-size: 15px !important;
    }

    .lightbox-stage {
        flex: 1 1 auto !important;
        overflow: hidden !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        padding: 6px !important;
        position: relative !important;
        background: #000 !important;
    }

    .lightbox-image {
        max-width: 100% !important;
        max-height: 100% !important;
        object-fit: contain !important;
    }

    .lightbox-nav-btn {
        width: 38px !important;
        height: 38px !important;
        font-size: 15px !important;
    }

    .lightbox-nav-btn.prev { left: 10px !important; }
    .lightbox-nav-btn.next { right: 10px !important; }

    .lightbox-footer {
        padding: 8px 12px calc(8px + env(safe-area-inset-bottom, 12px)) !important;
        background: rgba(8, 12, 20, 0.98) !important;
        border-top: 1px solid rgba(14, 165, 233, 0.25) !important;
        flex-shrink: 0 !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .lightbox-footer-prompt-wrap {
        display: flex !important;
        flex-direction: column !important;
        gap: 6px !important;
        width: 100% !important;
    }

    .lightbox-prompt-text {
        font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
        font-size: 11px !important;
        color: #94a3b8 !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }

    .lightbox-footer-actions {
        display: flex !important;
        flex-direction: column !important;
        gap: 8px !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .lightbox-rating-pills {
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        gap: 6px !important;
        width: 100% !important;
        box-sizing: border-box !important;
        padding: 4px 6px !important;
        border-radius: 10px !important;
        background: rgba(13, 19, 36, 0.95) !important;
    }

    .lightbox-rating-pills.hidden {
        display: none !important;
    }

    .lightbox-rate-label {
        display: none !important;
    }

    .lightbox-rate-btn {
        flex: 1 1 0 !important;
        min-width: 0 !important;
        height: 38px !important;
        padding: 4px 4px !important;
        font-size: 11px !important;
        font-weight: 600 !important;
        justify-content: center !important;
        align-items: center !important;
        display: inline-flex !important;
        text-align: center !important;
        border-radius: 6px !important;
        gap: 4px !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }

    .lightbox-rate-btn .cashback-badge {
        display: none !important;
    }

    .lightbox-action-btns-group {
        display: flex !important;
        flex-direction: row !important;
        gap: 6px !important;
        width: 100% !important;
        box-sizing: border-box !important;
        justify-content: space-between !important;
    }

    .lightbox-action-btns-group .compact-pill-btn {
        flex: 1 1 0 !important;
        min-width: 0 !important;
        height: 38px !important;
        padding: 6px 4px !important;
        font-size: 11px !important;
        font-weight: 600 !important;
        justify-content: center !important;
        align-items: center !important;
        display: inline-flex !important;
        text-align: center !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
        border-radius: 6px !important;
    }
}

/* ==================================================================== */
/* LEADERBOARD (RANKS) MODAL MOBILE PERFECTION                          */
/* ==================================================================== */
@media (max-width: 768px) {
    dialog.leaderboard-modal[open] {
        position: fixed !important;
        inset: 0 !important;
        margin: 0 !important;
        width: 100vw !important;
        max-width: 100vw !important;
        height: 100dvh !important;
        max-height: 100dvh !important;
        border-radius: 0 !important;
        border: none !important;
        background: #070a13 !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
        overflow: hidden !important;
        z-index: 99999 !important;
        padding: 0 !important;
    }

    .leaderboard-modal .leaderboard-modal-content {
        width: 100% !important;
        max-width: 100% !important;
        height: 100% !important;
        max-height: 100% !important;
        display: flex !important;
        flex-direction: column !important;
        overflow: hidden !important;
        flex: 1 1 auto !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    .leaderboard-modal .modal-header {
        position: static !important;
        top: auto !important;
        flex-shrink: 0 !important;
        padding: 10px 14px !important;
        background: rgba(10, 14, 24, 0.98) !important;
        border-bottom: 1px solid rgba(14, 165, 233, 0.25) !important;
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        gap: 8px !important;
    }

    .leaderboard-modal .modal-title-row h2 {
        font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
        font-size: 14px !important;
        font-weight: 800 !important;
        letter-spacing: -0.2px !important;
    }

    .leaderboard-subtitle {
        display: none !important;
    }

    .leaderboard-summary-strip {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 6px !important;
        padding: 8px 14px !important;
        background: rgba(12, 17, 28, 0.8) !important;
        border-bottom: 1px solid rgba(14, 165, 233, 0.15) !important;
        flex-shrink: 0 !important;
    }

    .leaderboard-summary-strip .lb-summary-item {
        padding: 6px 8px !important;
        gap: 6px !important;
    }

    .leaderboard-summary-strip .lb-summary-num {
        font-size: 13px !important;
    }

    .leaderboard-summary-strip .lb-summary-lbl {
        font-size: 9.5px !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }

    .leaderboard-tabs {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        gap: 6px !important;
        padding: 6px 14px !important;
        scrollbar-width: none !important;
        width: 100% !important;
        box-sizing: border-box !important;
        background: rgba(8, 11, 18, 0.95) !important;
        border-bottom: 1px solid rgba(14, 165, 233, 0.2) !important;
        flex-shrink: 0 !important;
    }

    .leaderboard-tabs::-webkit-scrollbar {
        display: none !important;
    }

    .leaderboard-tabs .lb-tab {
        flex: 0 0 auto !important;
        flex-shrink: 0 !important;
        white-space: nowrap !important;
        height: 30px !important;
        padding: 0 12px !important;
        font-size: 11px !important;
        font-weight: 700 !important;
        border-radius: 15px !important;
        font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
    }

    .leaderboard-tab-content {
        flex: 1 1 auto !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
        padding: 10px 14px calc(24px + env(safe-area-inset-bottom, 16px)) !important;
    }
}

/* ==================================================================== */
/* COMPREHENSIVE MOBILE PERFECTION & ERGONOMICS (320px - 900px)         */
/* ==================================================================== */
@media (max-width: 900px) {
    /* 1. Global Safe-Area Bottom Dock Clearance across ALL panes */
    #pane-studio,
    .controls-panel,
    .controls-scroll-area {
        padding-bottom: calc(env(safe-area-inset-bottom, 20px) + 140px) !important;
    }

    #pane-canvas,
    .viewport-canvas-wrapper,
    body.view-studio .viewport-canvas-wrapper,
    body.view-studio .viewport-canvas,
    #pane-history,
    #pane-gallery {
        padding-bottom: calc(env(safe-area-inset-bottom, 20px) + 90px) !important;
    }

    /* 2. Enable Natural Smooth Vertical Scrolling on Canvas on Mobile */
    body.view-studio .viewport-canvas-wrapper,
    body.view-studio .viewport-canvas {
        overflow-y: auto !important;
        overflow-x: hidden !important;
        -webkit-overflow-scrolling: touch !important;
        height: auto !important;
        max-height: none !important;
        min-height: 0 !important;
        flex: 1 1 auto !important;
    }

    /* 3. Canvas Action Buttons - Logical 2-Column Responsive Grid */
    .stage-visual-col .actions-primary-row {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: 8px !important;
        width: 100% !important;
        padding-top: 10px !important;
        box-sizing: border-box !important;
    }

    /* Primary Action: Download Full-Res spans full width */
    .stage-visual-col .action-btn.download-btn {
        grid-column: 1 / -1 !important;
        min-height: 46px !important;
        font-size: 13px !important;
        font-weight: 700 !important;
        justify-content: center !important;
        letter-spacing: 0.3px !important;
    }

    /* Danger Action: Delete spans full width with caution tint */
    .stage-visual-col .action-btn.delete-btn {
        grid-column: 1 / -1 !important;
        min-height: 40px !important;
        color: #f87171 !important;
        background: rgba(239, 68, 68, 0.08) !important;
        border: 1px solid rgba(239, 68, 68, 0.3) !important;
    }
    .stage-visual-col .action-btn.delete-btn:hover {
        background: rgba(239, 68, 68, 0.18) !important;
        border-color: #ef4444 !important;
    }

    .stage-visual-col .action-btn {
        min-height: 42px !important;
        padding: 8px 10px !important;
        font-size: 12px !important;
        font-weight: 600 !important;
        justify-content: center !important;
        width: 100% !important;
        box-sizing: border-box !important;
        border-radius: 8px !important;
    }

    .stage-visual-col .action-btn span {
        display: inline !important;
    }

    /* Secondary Sharing Row directly below canvas actions */
    .stage-visual-col .actions-secondary-row {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: 8px !important;
        width: 100% !important;
        margin-top: 8px !important;
        box-sizing: border-box !important;
    }

    .stage-visual-col .actions-secondary-row .action-btn-checkbox-label {
        min-height: 40px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        padding: 0 10px !important;
        font-size: 11.5px !important;
        font-weight: 600 !important;
        background: rgba(15, 23, 42, 0.7) !important;
        border: 1px solid rgba(255, 255, 255, 0.12) !important;
        border-radius: 8px !important;
        width: 100% !important;
        box-sizing: border-box !important;
        cursor: pointer !important;
    }

    /* 4. Watermark Controller on Mobile: Symmetrical 3x2 Grid */
    .viewport-watermark-row {
        width: 100% !important;
        box-sizing: border-box !important;
        margin-top: 10px !important;
        padding: 10px 12px !important;
        background: rgba(10, 15, 26, 0.92) !important;
        border: 1px solid rgba(56, 189, 248, 0.25) !important;
        border-radius: var(--radius-md) !important;
    }

    .viewport-watermark-row .v-wm-pills,
    .watermark-pills-row {
        display: grid !important;
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 6px !important;
        width: 100% !important;
    }

    .viewport-watermark-row .v-wm-btn,
    .watermark-pills-row .watermark-pill {
        min-height: 38px !important;
        font-size: 11px !important;
        font-weight: 600 !important;
        padding: 4px 6px !important;
        white-space: nowrap !important;
        justify-content: center !important;
        text-align: center !important;
        border-radius: 6px !important;
        box-sizing: border-box !important;
    }

    /* 5. Prompt Chips: Clean Compact Wrap — Zero Clipped Buttons */
    .prompt-chips-compact {
        display: flex !important;
        flex-wrap: wrap !important;
        overflow-x: visible !important;
        gap: 6px !important;
        width: 100% !important;
        box-sizing: border-box !important;
        padding: 4px 0 !important;
    }

    .prompt-chips-compact .chips-hint {
        flex-shrink: 0 !important;
        font-size: 11px !important;
        font-weight: 700 !important;
        color: #94a3b8 !important;
        align-self: center !important;
        margin-right: 2px !important;
    }

    .prompt-chips-compact .chip-btn {
        flex: 0 0 auto !important;
        min-height: 30px !important;
        padding: 4px 10px !important;
        font-size: 11.5px !important;
        border-radius: 6px !important;
        box-sizing: border-box !important;
    }

    /* 6. Prompt Mode Toggle & Action Buttons Responsive Layout */
    .section-label-row {
        display: flex !important;
        flex-wrap: wrap !important;
        align-items: center !important;
        justify-content: space-between !important;
        width: 100% !important;
        gap: 6px !important;
    }

    .prompt-quick-actions {
        display: flex !important;
        align-items: center !important;
        gap: 6px !important;
    }

    /* On mobile, mode toggle becomes a full-width segmented control */
    .studio-section .prompt-mode-toggle {
        display: flex !important;
        width: 100% !important;
        order: 10 !important;
        margin-top: 4px !important;
        height: 38px !important;
        padding: 3px !important;
        background: rgba(15, 23, 42, 0.95) !important;
        border: 1px solid rgba(56, 189, 248, 0.25) !important;
        border-radius: 8px !important;
        box-sizing: border-box !important;
    }

    .studio-section .prompt-mode-toggle .mode-pill {
        flex: 1 1 50% !important;
        height: 100% !important;
        min-height: 0 !important;
        padding: 0 10px !important;
        font-size: 12px !important;
        font-weight: 700 !important;
        letter-spacing: 0.2px !important;
        border-radius: 6px !important;
        border: none !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 6px !important;
        box-sizing: border-box !important;
        line-height: 1 !important;
    }

    #btn-expand-prompt,
    #btn-toggle-editor-size {
        width: 36px !important;
        height: 36px !important;
        min-width: 36px !important;
        max-width: 36px !important;
        padding: 0 !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        border-radius: 8px !important;
        font-size: 13px !important;
        box-sizing: border-box !important;
    }

    /* 7. Character Selector Card Hero Styling */
    .character-selector-card {
        padding: 10px 12px !important;
        min-height: 56px !important;
        border-radius: 10px !important;
        display: flex !important;
        align-items: center !important;
        gap: 10px !important;
        cursor: pointer !important;
        touch-action: manipulation !important;
        -webkit-tap-highlight-color: transparent !important;
    }

    .char-avatar-compact-wrap {
        width: 44px !important;
        height: 44px !important;
        min-width: 44px !important;
        border-radius: 8px !important;
    }

    .char-roster-arrow {
        width: 34px !important;
        height: 34px !important;
        min-width: 34px !important;
        border-radius: 50% !important;
        background: rgba(56, 189, 248, 0.12) !important;
        border: 1px solid rgba(56, 189, 248, 0.3) !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        font-size: 12px !important;
        color: #38bdf8 !important;
        flex-shrink: 0 !important;
    }

    .char-action-pills .compact-pill-btn {
        min-height: 30px !important;
        padding: 4px 10px !important;
        font-size: 11px !important;
        border-radius: 6px !important;
    }

    /* 8. Aspect Ratio Cards Font Tuning */
    .aspect-grid-primary .aspect-card {
        padding: 8px 6px !important;
        border-radius: 8px !important;
    }

    .aspect-grid-primary .aspect-title {
        font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
        font-size: 11.5px !important;
        font-weight: 700 !important;
        white-space: nowrap !important;
    }

    .aspect-grid-primary .aspect-res-sub {
        font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
        font-size: 9px !important;
    }

    /* 9. Gallery & History Cards Actions — Clean, Zero-Clipped Buttons */
    .gallery-card-actions {
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        padding: 6px 8px !important;
        gap: 4px !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .gallery-card-left {
        display: flex !important;
        align-items: center !important;
        gap: 4px !important;
        flex: 1 1 auto !important;
        min-width: 0 !important;
    }

    .gallery-reuse-btn {
        padding: 4px 8px !important;
        font-size: 11px !important;
        white-space: nowrap !important;
        height: 28px !important;
        border-radius: 6px !important;
        display: inline-flex !important;
        align-items: center !important;
        gap: 4px !important;
    }

    .gallery-copy-prompt-btn {
        width: 28px !important;
        height: 28px !important;
        min-width: 28px !important;
        padding: 0 !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        border-radius: 6px !important;
        flex-shrink: 0 !important;
    }

    .gallery-author-controls {
        display: flex !important;
        align-items: center !important;
        gap: 4px !important;
        flex-shrink: 0 !important;
    }

    /* Icon-only author action buttons on mobile cards — eliminates 'Hide Promp' and 'Unpub' text clipping */
    .gallery-prompt-toggle-btn,
    .gallery-unpublish-btn,
    .gallery-delete-btn {
        width: 28px !important;
        height: 28px !important;
        min-width: 28px !important;
        padding: 0 !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        border-radius: 6px !important;
        flex-shrink: 0 !important;
        font-size: 0 !important; /* Hides text, keeps icon */
    }

    .gallery-prompt-toggle-btn i,
    .gallery-unpublish-btn i,
    .gallery-delete-btn i {
        font-size: 12px !important;
    }

    /* Category filter carousel in Gallery */
    .gallery-category-filter {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        scrollbar-width: none !important;
        gap: 6px !important;
        padding: 6px 12px 6px 0 !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .gallery-category-filter::-webkit-scrollbar {
        display: none !important;
    }

    .gallery-cat-pill {
        flex: 0 0 auto !important;
        flex-shrink: 0 !important;
        white-space: nowrap !important;
        height: 32px !important;
        padding: 0 12px !important;
        font-size: 11px !important;
        border-radius: 16px !important;
    }

    /* 10. Header Action Pills on Small Mobile (<= 600px) */
    #btn-open-shortcuts {
        display: none !important; /* Keyboard shortcuts modal is desktop-only */
    }

    .header-support-pill span {
        display: none !important;
    }

    .header-support-pill,
    .header-sound-pill,
    .discord-login-btn {
        width: 38px !important;
        height: 38px !important;
        min-width: 38px !important;
        padding: 0 !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        border-radius: 8px !important;
    }

    /* 11. History Library Title Clean Formatting */
    .history-header h2 {
        font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
        font-size: 15px !important;
        letter-spacing: -0.2px !important;
    }

    /* 12. Admin User Generation Audit Modal Mobile Layout */
    dialog.admin-user-gens-modal[open] {
        padding: 12px 8px !important;
    }
    .admin-user-gens-box {
        max-height: 94vh !important;
        border-radius: 12px !important;
    }
    .admin-user-gens-header {
        padding: 12px 14px !important;
    }
    .admin-user-gens-content {
        padding: 12px !important;
        gap: 12px !important;
    }
    .audit-card {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
        padding: 12px !important;
    }
    .audit-thumb img {
        width: 100% !important;
        height: 200px !important;
        object-fit: cover !important;
    }
}


/* ==========================================================================
   Universal Prompt Chips Zero-Clipping & Accessibility Guarantee
   Ensures Duo and Bio buttons are 100% visible across ALL desktop and mobile viewports
   ========================================================================== */
.prompt-chips-compact {
    display: flex !important;
    flex-wrap: wrap !important;
    overflow-x: visible !important;
    overflow-y: visible !important;
    gap: 6px !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    padding: 4px 0 !important;
    white-space: normal !important;
}

.prompt-chips-compact .chip-btn {
    flex: 0 0 auto !important;
    min-height: 28px !important;
    max-height: 32px !important;
    line-height: 20px !important;
    padding: 3px 9px !important;
    font-size: 11.5px !important;
    border-radius: 6px !important;
    white-space: nowrap !important;
    box-sizing: border-box !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.prompt-chips-compact #btn-insert-duo-template,
.prompt-chips-compact #btn-insert-char-bio {
    display: inline-flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    flex-shrink: 0 !important;
}


/* ======================================================================
   MAY SILVER QoL: STUDIO VIEWPORT NAVIGATION & DIRECT LIBRARY RATING SUITE
   ====================================================================== */

/* 1. Studio Viewport History Navigation Arrows */
.result-image-frame {
    position: relative !important;
}

.studio-viewport-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(10, 15, 30, 0.82);
    border: 1px solid rgba(255, 255, 255, 0.22);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: #e2e8f0;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.55);
    opacity: 0.8;
}

.result-image-frame:hover .studio-viewport-arrow {
    opacity: 1;
}

.studio-viewport-arrow:hover {
    opacity: 1 !important;
    transform: translateY(-50%) scale(1.14);
    background: rgba(14, 23, 48, 0.96);
    border-color: #38bdf8;
    color: #38bdf8;
    box-shadow: 0 0 25px rgba(56, 189, 248, 0.5), 0 10px 28px rgba(0, 0, 0, 0.7);
}

.studio-viewport-arrow:active {
    transform: translateY(-50%) scale(0.94);
}

.studio-viewport-arrow.prev {
    left: 14px;
}

.studio-viewport-arrow.next {
    right: 14px;
}

.studio-viewport-arrow.disabled,
.studio-viewport-arrow:disabled {
    opacity: 0.15 !important;
    cursor: not-allowed !important;
    pointer-events: none !important;
    border-color: rgba(255, 255, 255, 0.06) !important;
}

.studio-nav-pill {
    position: absolute;
    bottom: 14px;
    left: 14px;
    background: rgba(10, 15, 30, 0.88);
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 5px 12px;
    border-radius: 20px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11.5px;
    font-weight: 700;
    color: #cbd5e1;
    z-index: 10;
    pointer-events: none;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.6);
    transition: opacity 0.2s ease;
}

.studio-nav-pill i {
    color: #38bdf8;
}

.studio-nav-btn-action {
    background: rgba(30, 41, 59, 0.8) !important;
    border: 1px solid rgba(148, 163, 184, 0.35) !important;
    color: #cbd5e1 !important;
    font-weight: 600 !important;
}

.studio-nav-btn-action:hover:not(:disabled) {
    background: rgba(56, 189, 248, 0.18) !important;
    border-color: #38bdf8 !important;
    color: #38bdf8 !important;
    box-shadow: 0 0 12px rgba(56, 189, 248, 0.3) !important;
}

.studio-nav-btn-action.disabled,
.studio-nav-btn-action:disabled {
    opacity: 0.35 !important;
    cursor: not-allowed !important;
}

/* 2. Private Gallery Art Tiles & Direct Rating Suite */
.history-item {
    position: relative !important;
    overflow: hidden !important;
    border-radius: 12px !important;
    background: #070a14 !important;
    transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.22s ease, border-color 0.22s ease !important;
}

body.view-library .history-item {
    border: 1.5px solid rgba(255, 255, 255, 0.12) !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5) !important;
}

body.view-library .history-item:hover {
    transform: translateY(-4px) scale(1.02) !important;
    border-color: rgba(56, 189, 248, 0.6) !important;
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.75), 0 0 20px rgba(56, 189, 248, 0.25) !important;
}

/* Card Subtle Gradient Overlay */
.history-item-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(6, 9, 18, 0.45) 0%, transparent 35%, rgba(6, 9, 18, 0.5) 65%, rgba(6, 9, 18, 0.96) 100%);
    pointer-events: none;
    z-index: 2;
    transition: opacity 0.2s ease;
}

.history-item:hover .history-item-overlay {
    background: linear-gradient(180deg, rgba(6, 9, 18, 0.55) 0%, transparent 30%, rgba(6, 9, 18, 0.65) 60%, rgba(6, 9, 18, 0.98) 100%);
}

/* Character Tag Pill in Top-Left */
.history-item-char-pill {
    position: absolute;
    top: 8px;
    left: 8px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.4px;
    padding: 3px 8px;
    border-radius: 6px;
    background: rgba(10, 15, 30, 0.85);
    border: 1px solid rgba(56, 189, 248, 0.45);
    color: #38bdf8;
    z-index: 4;
    pointer-events: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

/* Quality Rating Badge in Top-Right */
.history-item-badge-wrap {
    position: absolute;
    top: 8px;
    right: 44px; /* Next to delete button */
    z-index: 4;
    pointer-events: none;
}

.history-item-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 6px;
    font-family: 'Outfit', sans-serif;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.3px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.5);
}

.history-item-badge.star {
    background: linear-gradient(135deg, rgba(234, 179, 8, 0.95), rgba(202, 138, 4, 0.95));
    color: #0b0f19;
    border: 1px solid rgba(254, 240, 138, 0.85);
    box-shadow: 0 0 14px rgba(234, 179, 8, 0.55);
}

.history-item-badge.like {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.95), rgba(22, 163, 74, 0.95));
    color: #ffffff;
    border: 1px solid rgba(134, 239, 172, 0.75);
    box-shadow: 0 0 12px rgba(34, 197, 94, 0.5);
}

.history-item-badge.dislike {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.95), rgba(220, 38, 38, 0.95));
    color: #ffffff;
    border: 1px solid rgba(252, 165, 165, 0.75);
    box-shadow: 0 0 12px rgba(239, 68, 68, 0.5);
}

/* Card Bottom Rating Bar */
.history-item .history-item-bottom-bar {
    display: none;
}

body.view-library .history-item .history-item-bottom-bar {
    display: flex !important;
    position: absolute;
    bottom: 8px;
    right: 8px;
    z-index: 5;
    align-items: center;
}

.history-item-rating-pills {
    background: rgba(10, 15, 30, 0.92);
    border: 1.5px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 24px;
    padding: 3px 6px;
    display: flex;
    gap: 6px;
    align-items: center;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.65);
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.history-item:hover .history-item-rating-pills {
    border-color: rgba(56, 189, 248, 0.5);
    box-shadow: 0 6px 22px rgba(0, 0, 0, 0.8), 0 0 14px rgba(56, 189, 248, 0.3);
    transform: translateY(-1px);
}

.lib-rate-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.05);
    color: #94a3b8;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13.5px;
    cursor: pointer;
    transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
    padding: 0;
}

.lib-rate-btn:hover {
    color: #ffffff;
    transform: scale(1.18);
}

.lib-rate-btn.dislike:hover {
    color: #f87171;
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.5);
}

.lib-rate-btn.dislike.active {
    color: #ffffff !important;
    background: linear-gradient(135deg, #ef4444, #dc2626) !important;
    border-color: #f87171 !important;
    box-shadow: 0 0 14px rgba(239, 68, 68, 0.6) !important;
}

.lib-rate-btn.like:hover {
    color: #4ade80;
    background: rgba(34, 197, 94, 0.2);
    border-color: rgba(34, 197, 94, 0.5);
}

.lib-rate-btn.like.active {
    color: #ffffff !important;
    background: linear-gradient(135deg, #22c55e, #16a34a) !important;
    border-color: #4ade80 !important;
    box-shadow: 0 0 14px rgba(34, 197, 94, 0.6) !important;
}

.lib-rate-btn.star:hover {
    color: #facc15;
    background: rgba(234, 179, 8, 0.25);
    border-color: rgba(234, 179, 8, 0.6);
}

.lib-rate-btn.star.active {
    color: #0b0f19 !important;
    background: linear-gradient(135deg, #facc15, #eab308) !important;
    border-color: #fef08a !important;
    box-shadow: 0 0 18px rgba(250, 204, 21, 0.7) !important;
}

/* 3. Cinema Lightbox Rating Pills */
.lightbox-rating-pills {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(13, 19, 36, 0.88);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 24px;
    padding: 4px 10px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.5);
}

.lightbox-rate-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    font-weight: 700;
    color: #94a3b8;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding-right: 6px;
    border-right: 1px solid rgba(255, 255, 255, 0.12);
}

.lightbox-rate-label i {
    color: #facc15;
}

.lightbox-rate-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #cbd5e1;
    padding: 6px 14px;
    border-radius: 16px;
    font-family: 'Outfit', sans-serif;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.lightbox-rate-btn:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.12);
    transform: translateY(-1px);
}

.lightbox-rate-btn.dislike.active,
.lightbox-rate-btn.dislike.selected {
    color: #ffffff !important;
    background: linear-gradient(135deg, #ef4444, #dc2626) !important;
    border-color: #f87171 !important;
    box-shadow: 0 0 14px rgba(239, 68, 68, 0.6) !important;
}

.lightbox-rate-btn.like.active,
.lightbox-rate-btn.like.selected {
    color: #ffffff !important;
    background: linear-gradient(135deg, #22c55e, #16a34a) !important;
    border-color: #4ade80 !important;
    box-shadow: 0 0 14px rgba(34, 197, 94, 0.6) !important;
}

.lightbox-rate-btn.star.active,
.lightbox-rate-btn.star.selected {
    color: #0b0f19 !important;
    background: linear-gradient(135deg, #facc15, #eab308) !important;
    border-color: #fef08a !important;
    box-shadow: 0 0 18px rgba(250, 204, 21, 0.7) !important;
}

@media (max-width: 900px) {
    .studio-viewport-arrow {
        width: 40px;
        height: 40px;
        font-size: 16px;
        opacity: 0.9;
    }
    .studio-viewport-arrow.prev {
        left: 8px;
    }
    .studio-viewport-arrow.next {
        right: 8px;
    }
    body.view-library .history-item .history-item-bottom-bar {
        bottom: 6px;
        right: 6px;
    }
    .lib-rate-btn {
        width: 34px;
        height: 34px;
        font-size: 14.5px;
    }
}


/* Coffee for Ash Custom Support Button (Replaces BuyMeACoffee) */
.coffee-ash-btn {
    display: inline-flex;
    text-decoration: none;
    margin-top: 6px;
    align-self: flex-start;
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), filter 0.2s ease;
}

.coffee-ash-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #FFDD00 0%, #FBBF24 100%);
    color: #0F172A;
    font-weight: 700;
    font-size: 0.85rem;
    padding: 9px 18px;
    border-radius: 9px;
    border: 1px solid rgba(251, 191, 36, 0.6);
    box-shadow: 0 4px 14px rgba(251, 191, 36, 0.35);
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    cursor: pointer;
}

.coffee-ash-pill i.fa-mug-hot {
    color: #0F172A;
    font-size: 0.95rem;
    filter: drop-shadow(0 0 2px rgba(15, 23, 42, 0.3));
}

.coffee-ash-btn:hover {
    transform: translateY(-2px);
    filter: drop-shadow(0 4px 16px rgba(251, 191, 36, 0.5));
}

.coffee-ash-btn:hover .coffee-ash-pill {
    background: linear-gradient(135deg, #FFE234 0%, #F59E0B 100%);
    box-shadow: 0 6px 20px rgba(251, 191, 36, 0.6);
}

@media (max-width: 640px) {
    .coffee-ash-btn {
        align-self: center;
        width: 100%;
        margin-top: 6px;
    }
    .coffee-ash-pill {
        width: 100%;
        justify-content: center;
    }
}

/* --- Studio Recent Artwork Filmstrip (Desktop & Mobile) --- */
.studio-filmstrip-tray {
    width: 100% !important;
    background: rgba(10, 16, 29, 0.7) !important;
    border: 1px solid rgba(56, 189, 248, 0.2) !important;
    border-radius: 10px !important;
    padding: 8px 12px !important;
    margin-top: 10px !important;
    box-sizing: border-box !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 6px !important;
}
.filmstrip-header {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    color: var(--text-muted, #94a3b8) !important;
    letter-spacing: -0.01em !important;
    text-transform: none !important;
}
.filmstrip-title i {
    color: #38bdf8 !important;
    margin-right: 4px !important;
}
.filmstrip-actions {
    display: flex !important;
    gap: 4px !important;
}
.filmstrip-scroll-btn {
    background: rgba(255, 255, 255, 0.06) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    color: #e2e8f0 !important;
    border-radius: 4px !important;
    width: 24px !important;
    height: 24px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    font-size: 10px !important;
    transition: all 0.15s ease !important;
}
.filmstrip-scroll-btn:hover {
    background: rgba(56, 189, 248, 0.2) !important;
    border-color: #38bdf8 !important;
    color: #38bdf8 !important;
}
.studio-filmstrip-track {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    overflow-x: auto !important;
    padding: 4px 2px 6px !important;
    scroll-behavior: smooth !important;
    scrollbar-width: thin !important;
    scrollbar-color: rgba(56, 189, 248, 0.3) transparent !important;
}
.studio-filmstrip-track::-webkit-scrollbar {
    height: 4px !important;
}
.studio-filmstrip-track::-webkit-scrollbar-thumb {
    background: rgba(56, 189, 248, 0.4) !important;
    border-radius: 2px !important;
}
.filmstrip-thumb {
    width: 58px !important;
    height: 58px !important;
    flex-shrink: 0 !important;
    border-radius: 6px !important;
    overflow: hidden !important;
    border: 1.5px solid rgba(255, 255, 255, 0.15) !important;
    cursor: pointer !important;
    position: relative !important;
    background: #020617 !important;
    transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease !important;
}
.filmstrip-thumb:hover {
    transform: translateY(-2px) !important;
    border-color: #38bdf8 !important;
    box-shadow: 0 4px 12px rgba(56, 189, 248, 0.3) !important;
}
.filmstrip-thumb.active {
    border-color: #00f2fe !important;
    box-shadow: 0 0 12px rgba(0, 242, 254, 0.6) !important;
}
.filmstrip-thumb img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    display: block !important;
}

/* Mobile Studio Ribbon: Completely hidden on desktop (>= 901px) */
.mobile-studio-ribbon {
    display: none !important;
}

@media (max-width: 900px) {
    .mobile-studio-ribbon:not(.hidden) {
        display: flex !important;
        flex-direction: column !important;
        gap: 6px !important;
        background: rgba(10, 16, 29, 0.8) !important;
        border: 1px solid rgba(0, 242, 254, 0.25) !important;
        border-radius: 10px !important;
        padding: 8px 12px !important;
        margin-bottom: 12px !important;
    }
    .mobile-studio-ribbon.hidden {
        display: none !important;
    }
}
.mobile-ribbon-title {
    font-size: 11px !important;
    font-weight: 700 !important;
    color: #94a3b8 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.05em !important;
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
}
.mobile-ribbon-title i {
    color: #00f2fe !important;
}
.mobile-ribbon-track {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    padding: 4px 2px 6px !important;
}

/* --- Admin Global Seasonal Event Protocol --- */
.global-event-selection-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)) !important;
    gap: 12px !important;
    margin-top: 14px !important;
}
.event-mode-card {
    position: relative !important;
    display: block !important;
    cursor: pointer !important;
    border-radius: 12px !important;
    background: rgba(15, 23, 42, 0.75) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    padding: 14px 16px !important;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1) !important;
    overflow: hidden !important;
}
.event-mode-card:hover {
    border-color: rgba(56, 189, 248, 0.5) !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45) !important;
}
.event-mode-card input[type="radio"] {
    position: absolute !important;
    top: 14px !important;
    right: 14px !important;
    accent-color: #38bdf8 !important;
    width: 18px !important;
    height: 18px !important;
    cursor: pointer !important;
    margin: 0 !important;
    z-index: 2 !important;
}
.event-mode-card:has(input:checked) {
    border-color: #38bdf8 !important;
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.15), rgba(15, 23, 42, 0.95)) !important;
    box-shadow: 0 0 20px rgba(56, 189, 248, 0.25) !important;
}
.event-mode-card[data-event="halloween"]:has(input:checked) {
    border-color: #ff1c40 !important;
    background: linear-gradient(135deg, rgba(255, 28, 64, 0.18), rgba(15, 23, 42, 0.95)) !important;
    box-shadow: 0 0 20px rgba(255, 28, 64, 0.3) !important;
}
.event-mode-card[data-event="halloween"] input[type="radio"] {
    accent-color: #ff1c40 !important;
}
.event-mode-card[data-event="winter"]:has(input:checked) {
    border-color: #67e8f9 !important;
    background: linear-gradient(135deg, rgba(103, 232, 249, 0.18), rgba(15, 23, 42, 0.95)) !important;
    box-shadow: 0 0 20px rgba(103, 232, 249, 0.3) !important;
}
.event-mode-card[data-event="winter"] input[type="radio"] {
    accent-color: #67e8f9 !important;
}
.event-card-inner {
    display: flex !important;
    gap: 12px !important;
    align-items: flex-start !important;
    padding-right: 28px !important;
}
.event-card-icon {
    font-size: 26px !important;
    line-height: 1 !important;
    flex-shrink: 0 !important;
    filter: drop-shadow(0 2px 8px rgba(0,0,0,0.5)) !important;
}
.event-card-info {
    display: flex !important;
    flex-direction: column !important;
    gap: 3px !important;
    min-width: 0 !important;
}
.event-card-title {
    font-size: 13px !important;
    font-weight: 800 !important;
    color: #f8fafc !important;
    letter-spacing: 0.02em !important;
}
.event-card-subtitle {
    font-size: 11px !important;
    color: #94a3b8 !important;
    line-height: 1.4 !important;
}

/* --- Winter Holidays & Festive Atmosphere --- */
body.winter-holiday-active {
    --accent: #38bdf8 !important;
    --accent-glow: rgba(56, 189, 248, 0.5) !important;
    --bg-surface: rgba(10, 20, 36, 0.94) !important;
}
body.winter-holiday-active::before {
    content: '' !important;
    position: fixed !important;
    top: 0 !important; left: 0 !important; right: 0 !important; bottom: 0 !important;
    pointer-events: none !important;
    z-index: 9990 !important;
    background: radial-gradient(circle at 50% 5%, rgba(56, 189, 248, 0.18), transparent 60%),
                radial-gradient(circle at 80% 90%, rgba(245, 158, 11, 0.1), transparent 50%) !important;
    box-shadow: inset 0 0 100px rgba(56, 189, 248, 0.15) !important;
}
.winter-snow-layer {
    position: fixed !important;
    top: 0 !important; left: 0 !important; right: 0 !important; bottom: 0 !important;
    pointer-events: none !important;
    z-index: 9991 !important;
    background-image: 
        radial-gradient(2px 2px at 20px 30px, #ffffff, rgba(0,0,0,0)),
        radial-gradient(2px 2px at 40px 70px, #e0f2fe, rgba(0,0,0,0)),
        radial-gradient(3px 3px at 80px 120px, #ffffff, rgba(0,0,0,0)),
        radial-gradient(2px 2px at 150px 180px, #bae6fd, rgba(0,0,0,0)),
        radial-gradient(3px 3px at 220px 240px, #ffffff, rgba(0,0,0,0)) !important;
    background-repeat: repeat !important;
    background-size: 260px 260px !important;
    animation: winterSnowDrift 14s linear infinite !important;
    opacity: 0.75 !important;
}
@keyframes winterSnowDrift {
    from { background-position: 0 0; }
    to { background-position: 50px 600px; }
}

/* --- Winter Holiday Easter Eggs & Festive Effects --- */
.holiday-spirit-banner {
    position: relative !important;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.25), rgba(56, 189, 248, 0.2)) !important;
    border: 1px solid rgba(16, 185, 129, 0.5) !important;
    border-radius: 10px !important;
    padding: 10px 14px !important;
    margin: 8px 0 !important;
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    box-shadow: 0 4px 20px rgba(16, 185, 129, 0.2), 0 0 15px rgba(56, 189, 248, 0.2) !important;
    animation: holidayGlowPulse 2.5s ease-in-out infinite alternate !important;
    z-index: 100 !important;
}
@keyframes holidayGlowPulse {
    from { box-shadow: 0 4px 20px rgba(16, 185, 129, 0.2), 0 0 10px rgba(56, 189, 248, 0.2); }
    to { box-shadow: 0 4px 25px rgba(16, 185, 129, 0.4), 0 0 20px rgba(56, 189, 248, 0.4); }
}
.winter-click-sparkle {
    position: fixed !important;
    pointer-events: none !important;
    font-size: 16px !important;
    user-select: none !important;
    z-index: 99999 !important;
    animation: winterSparkleFade 0.8s ease-out forwards !important;
}
@keyframes winterSparkleFade {
    0% { opacity: 1; transform: translate(0, 0) scale(1.2) rotate(0deg); }
    100% { opacity: 0; transform: translate(var(--dx, 0px), var(--dy, -40px)) scale(0.4) rotate(45deg); }
}

/* Foundation Diffusion Engine Selector Deck */
.engine-selector-deck {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-top: 8px;
}
@media (max-width: 640px) {
    .engine-selector-deck {
        grid-template-columns: 1fr;
        gap: 6px;
    }
}
.engine-pill {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    color: #94a3b8;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.engine-pill:hover {
    background: rgba(30, 41, 59, 0.7);
    border-color: rgba(56, 189, 248, 0.3);
    color: #e2e8f0;
}
.engine-pill.active {
    background: rgba(14, 165, 233, 0.12);
    border-color: #38bdf8;
    color: #f8fafc;
    box-shadow: 0 0 15px rgba(56, 189, 248, 0.15);
}
.engine-pill-icon {
    font-size: 14px;
    color: #38bdf8;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: rgba(56, 189, 248, 0.1);
    flex-shrink: 0;
}
.engine-pill.active .engine-pill-icon {
    background: rgba(56, 189, 248, 0.25);
    color: #38bdf8;
}
.engine-pill-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.engine-pill-name {
    font-family: 'Cinzel', serif;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
}
.engine-pill-tag {
    font-family: 'JetBrains Mono', monospace;
    font-size: 9px;
    color: #64748b;
}
.engine-pill.active .engine-pill-tag {
    color: #38bdf8;
}

/* LOCKED CLEAN WATERMARK BUTTON (ECONOMY GATE: 100 RAIN DROPS) */
.action-btn.download-clean-btn.is-locked,
.lightbox-action-btn.is-locked {
    background: linear-gradient(135deg, rgba(30, 27, 75, 0.95) 0%, rgba(79, 70, 229, 0.85) 50%, rgba(217, 119, 6, 0.85) 100%) !important;
    border: 1px dashed rgba(251, 191, 36, 0.85) !important;
    color: #fef08a !important;
    box-shadow: 0 4px 14px rgba(217, 119, 6, 0.25) !important;
    cursor: pointer !important;
    transition: all 0.2s ease-in-out !important;
}
.action-btn.download-clean-btn.is-locked:hover,
.lightbox-action-btn.is-locked:hover {
    background: linear-gradient(135deg, #312e81 0%, #4338ca 50%, #b45309 100%) !important;
    border: 1px solid #fbbf24 !important;
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.5), 0 0 16px rgba(251, 191, 36, 0.4) !important;
    transform: translateY(-2px) scale(1.02) !important;
    filter: brightness(1.15) !important;
}


/* =========================================================================
   RESPONSIVE HEADER AND DROPS PILL FIX (PREVENT DROPS OVERFLOW)
   ========================================================================= */
.user-profile-badge {
    flex-shrink: 0;
    max-width: 100%;
}

.drops-badge {
    white-space: nowrap;
}

@media (max-width: 1550px) {
    .studio-header {
        padding: 8px 14px !important;
        gap: 10px !important;
    }
    .desktop-nav-segmented {
        gap: 4px !important;
        padding: 3px !important;
    }
    .nav-segment-btn {
        padding: 7px 12px !important;
        font-size: 12px !important;
        gap: 6px !important;
    }
    .header-right {
        gap: 8px !important;
    }
    .header-support-pill span {
        display: none !important; /* Keep coffee mug icon only */
    }
    .header-support-pill {
        padding: 8px 10px !important;
    }
}

@media (max-width: 1380px) {
    .brand-text .tagline {
        display: none !important; /* Saves ~160px of header width */
    }
    .user-meta .drops-text {
        display: none !important; /* Shows icon + 3.28M without redundant 'Drops' */
    }
    .desktop-nav-segmented .nav-segment-btn span {
        font-size: 11px !important;
    }
    .user-profile-badge {
        padding: 4px 10px 4px 6px !important;
        gap: 8px !important;
    }
}


/* =========================================================================
   PROMPT TOOLS ROW & ZERO-OVERFLOW POLISH
   ========================================================================= */
.prompt-tools-group {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: nowrap;
    flex-shrink: 0;
}

.mode-segmented {
    display: inline-flex;
    align-items: center;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-sm);
    padding: 2px;
    gap: 2px;
}

.mode-segment-btn {
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 4px;
    border: none;
    background: transparent;
    color: #94a3b8;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.mode-segment-btn.active {
    background: rgba(56, 189, 248, 0.2);
    color: #38bdf8;
    box-shadow: 0 0 8px rgba(56, 189, 248, 0.2);
}

.prompt-assist-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.15), rgba(139, 92, 246, 0.15));
    border: 1px solid rgba(56, 189, 248, 0.35);
    color: #38bdf8;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
}

.prompt-assist-btn:hover {
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.25), rgba(139, 92, 246, 0.25));
    border-color: #38bdf8;
    color: #ffffff;
    box-shadow: 0 0 12px rgba(56, 189, 248, 0.3);
}

/* Ensure controls panel and scroll area never leak elements outside bounds */
.controls-panel {
    overflow-x: hidden !important;
}

.controls-scroll-area {
    overflow-x: hidden !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
}


/* =========================================================================
   SOVEREIGN RESPONSIVE & ADAPTIVE LAYOUT SUITE
   Comprehensive Multi-Resolution Matrix (4K, 1440p, 1080p, Laptops, Tablets, Phones)
   ========================================================================= */

html, body {
    overflow-x: hidden !important;
    max-width: 100vw !important;
    width: 100% !important;
}

*, *::before, *::after {
    box-sizing: border-box;
}

.app-container {
    max-width: 1920px;
    margin: 0 auto;
    overflow-x: hidden !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

/* User Profile Badge Robust Truncation */
.user-profile-badge {
    min-width: 0 !important;
    flex-shrink: 1 !important;
}

.user-profile-badge .user-name {
    display: inline-block;
    max-width: 120px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: middle;
}

.compact-pill-btn .label-short,
.archetypes-btn .label-short {
    display: none;
}
.compact-pill-btn .label-full,
.archetypes-btn .label-full {
    display: inline;
}

/* =========================================================================
   BREAKPOINT: LAPTOP & MEDIUM DESKTOP (1200px - 1440px)
   ========================================================================= */
@media (max-width: 1440px) {
    .studio-header {
        padding: 8px 12px !important;
        gap: 8px !important;
    }
    .brand-text .tagline {
        display: none !important;
    }
    .desktop-nav-segmented {
        gap: 2px !important;
        padding: 2px !important;
    }
    .desktop-nav-segmented .nav-segment-btn {
        padding: 6px 10px !important;
        font-size: 11.5px !important;
        gap: 5px !important;
    }
    .user-profile-badge .user-name {
        max-width: 90px !important;
    }
    .header-support-pill span {
        display: none !important;
    }
}

@media (max-width: 1280px) {
    .studio-header {
        padding: 6px 10px !important;
        gap: 6px !important;
    }
    .desktop-nav-segmented .nav-segment-btn span {
        font-size: 11px !important;
    }
    #nav-seg-rainscript span.rainscript-badge {
        display: none !important;
    }
    #nav-seg-telemetry span.hud-step-badge {
        display: none !important;
    }
    .user-profile-badge {
        padding: 4px 6px !important;
        gap: 5px !important;
    }
    .user-profile-badge .user-name {
        max-width: 65px !important;
    }
    .user-meta .drops-text {
        display: none !important;
    }
}

@media (max-width: 1120px) {
    .desktop-nav-segmented .nav-segment-btn:not(.active) span {
        display: none !important;
    }
    .desktop-nav-segmented .nav-segment-btn {
        padding: 6px 8px !important;
    }
    .header-shortcuts-pill {
        display: none !important;
    }
    .user-profile-badge .user-name {
        display: none !important;
    }
}

/* =========================================================================
   BREAKPOINT: DESKTOP WORKSPACE RESULT STAGE (901px - 1349px)
   Prevents Image Squeeze & Gives CRT Viewport Breathing Room
   ========================================================================= */
@media (min-width: 901px) and (max-width: 1349px) {
    body.view-studio .studio-workspace {
        grid-template-columns: 350px minmax(0, 1fr) !important;
        gap: 14px !important;
    }

    body.view-studio .result-stage-layout {
        flex-direction: column !important;
        height: auto !important;
        max-height: 100% !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        gap: 16px !important;
        align-items: stretch !important;
    }

    body.view-studio .stage-visual-col {
        width: 100% !important;
        flex: none !important;
        height: auto !important;
    }

    body.view-studio .result-image-frame {
        max-height: 480px !important;
    }

    body.view-studio .stage-inspector-col {
        width: 100% !important;
        flex: none !important;
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px !important;
        height: auto !important;
        overflow: visible !important;
    }

    body.view-studio .stage-inspector-col > * {
        min-width: 0 !important;
    }
}

/* =========================================================================
   BREAKPOINT: TABLET PORTRAIT & MOBILE (<= 900px)
   ========================================================================= */
@media (max-width: 900px) {
    .studio-header {
        padding: 8px 12px !important;
        gap: 8px !important;
    }
    .header-support-pill {
        display: none !important;
    }
    .header-shortcuts-pill {
        display: none !important;
    }
    .user-profile-badge .user-name {
        display: none !important;
    }
    .user-profile-badge {
        padding: 3px 6px !important;
        gap: 5px !important;
    }
    .user-profile-badge .user-avatar {
        width: 28px !important;
        height: 28px !important;
    }
    .header-sound-pill {
        width: 32px !important;
        height: 32px !important;
        padding: 0 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    /* Fix mobile bottom navigation PRO badge */
    .mobile-tab-badge.pro-badge {
        position: absolute !important;
        top: 4px !important;
        right: 14% !important;
        width: auto !important;
        height: auto !important;
        min-width: 0 !important;
        padding: 1px 4px !important;
        border-radius: 4px !important;
        background: rgba(14, 165, 233, 0.25) !important;
        border: 1px solid rgba(14, 165, 233, 0.5) !important;
        color: #38bdf8 !important;
        font-size: 8px !important;
        font-weight: 800 !important;
        line-height: 1.1 !important;
        letter-spacing: 0.5px !important;
        box-shadow: 0 0 6px rgba(14, 165, 233, 0.3) !important;
    }

    .mobile-bottom-nav {
        display: flex !important;
        justify-content: space-around !important;
        align-items: center !important;
        padding: 0 4px !important;
        padding-bottom: env(safe-area-inset-bottom, 0px) !important;
    }

    .mobile-nav-btn {
        flex: 1 1 0 !important;
        min-width: 0 !important;
        padding: 6px 2px !important;
        font-size: 10px !important;
        position: relative !important;
    }
}

/* =========================================================================
   BREAKPOINT: STANDARD SMARTPHONE (<= 640px & <= 480px)
   ========================================================================= */
@media (max-width: 640px) {
    .section-label-row {
        width: 100% !important;
        flex-wrap: wrap !important;
        gap: 8px !important;
        justify-content: space-between !important;
        align-items: center !important;
    }

    .compact-pill-btn .label-full,
    .archetypes-btn .label-full {
        display: none !important;
    }
    .compact-pill-btn .label-short,
    .archetypes-btn .label-short {
        display: inline !important;
    }

    /* Scene & Action Prompt Tools Polish */
    .studio-section:has(#prompt-input) .section-label-row {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 8px !important;
    }

    .prompt-quick-actions {
        width: 100% !important;
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        gap: 8px !important;
    }

    .prompt-mode-toggle {
        display: flex !important;
        flex: 1 1 auto !important;
        max-width: none !important;
        margin: 0 !important;
        padding: 2px !important;
        background: rgba(15, 23, 42, 0.85) !important;
        border: 1px solid rgba(56, 189, 248, 0.25) !important;
        border-radius: 6px !important;
    }

    .prompt-mode-toggle .mode-pill {
        flex: 1 1 50% !important;
        padding: 4px 8px !important;
        font-size: 11px !important;
        text-align: center !important;
        justify-content: center !important;
        white-space: nowrap !important;
    }

    .prompt-assist-btn {
        flex: 0 0 auto !important;
        padding: 5px 10px !important;
        font-size: 11px !important;
        white-space: nowrap !important;
    }

    .engine-live-tag .engine-subtext {
        display: none !important;
    }
}

@media (max-width: 480px) {
    .studio-header {
        padding: 6px 8px !important;
    }
    .brand-title-row h1 {
        font-size: 15px !important;
    }
    .brand-version-badge {
        display: none !important;
    }
    .brand-logo {
        width: 32px !important;
        height: 32px !important;
    }
    .mobile-sticky-generate-bar {
        padding: 6px 10px !important;
        gap: 6px !important;
    }
    .mobile-generate-btn {
        font-size: 12.5px !important;
        padding: 10px 10px !important;
        letter-spacing: 0.3px !important;
    }
    .mobile-drops-pill {
        padding: 0 8px !important;
        min-height: 44px !important;
    }
    .mobile-drops-num {
        font-size: 13px !important;
    }
}

@media (max-width: 360px) {
    .studio-header {
        padding: 4px 6px !important;
        gap: 4px !important;
        overflow: hidden !important;
    }
    .brand-title-row h1 {
        font-size: 12px !important;
        white-space: nowrap !important;
    }
    #app-brand-subtitle {
        display: none !important;
    }
    .brand-version-badge {
        display: none !important;
    }
    .brand-title-row {
        gap: 2px !important;
    }
    .auth-bar .user-name {
        max-width: 40px !important;
    }
    .mobile-drops-lbl {
        display: none !important;
    }
    .mobile-drops-pill {
        padding: 0 4px !important;
    }
    .user-profile-badge {
        padding: 2px 4px !important;
        gap: 3px !important;
    }
    .brand-logo-glow {
        width: 26px !important;
        height: 26px !important;
    }
    .mobile-generate-btn {
        font-size: 11px !important;
        padding: 6px 6px !important;
    }
}


/* =========================================================================
   PERFECT RESPONSIVE POLISH & ZERO-OVERFLOW MATRIX
   ========================================================================= */

/* 1. Scene & Action Prompt Mode Toggle & Enrich Button Flex Fix */
@media (max-width: 900px) {
    .studio-section .prompt-mode-toggle {
        display: flex !important;
        flex: 1 1 0 !important;
        width: auto !important;
        max-width: none !important;
        min-width: 0 !important;
        order: unset !important;
        margin: 0 !important;
        height: 36px !important;
        padding: 2px !important;
        background: rgba(15, 23, 42, 0.95) !important;
        border: 1px solid rgba(56, 189, 248, 0.25) !important;
        border-radius: 8px !important;
        box-sizing: border-box !important;
    }

    .studio-section .prompt-mode-toggle .mode-pill {
        flex: 1 1 50% !important;
        height: 100% !important;
        min-width: 0 !important;
        padding: 0 6px !important;
        font-size: 11px !important;
        font-weight: 700 !important;
        border-radius: 6px !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 4px !important;
        box-sizing: border-box !important;
    }

    .prompt-quick-actions {
        width: 100% !important;
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        gap: 8px !important;
        box-sizing: border-box !important;
    }

    #btn-expand-prompt {
        flex: 0 0 auto !important;
        width: 36px !important;
        height: 36px !important;
        min-width: 36px !important;
        padding: 0 !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        box-sizing: border-box !important;
    }

    #btn-expand-prompt #prompt-assist-text {
        display: none !important;
    }
}

/* 2. Mobile Header Right (<= 640px) */
@media (max-width: 640px) {
    .header-sound-pill {
        display: none !important; /* Frees up 40px on mobile headers */
    }
    .user-profile-badge {
        padding: 3px 6px !important;
        gap: 4px !important;
        max-width: 160px !important;
    }
    .user-profile-badge #btn-user-admin {
        display: none !important; /* Admin stays accessible via drawer / desktop */
    }
    .user-profile-badge #btn-user-logout {
        padding: 4px 6px !important;
        font-size: 12px !important;
    }
    .user-profile-badge .user-drops-pill {
        padding: 2px 6px !important;
        font-size: 11px !important;
    }
}

/* 3. Generator Action Row in Controls Panel (Desktop & Laptop 1024px - 1440px) */
@media (max-width: 1400px) {
    .generate-action-row {
        gap: 6px !important;
    }
    .dock-balance-pill {
        padding: 0 8px !important;
        gap: 5px !important;
    }
    .dock-balance-lbl {
        font-size: 8.5px !important;
    }
    .dock-balance-num {
        font-size: 12px !important;
    }
    .generate-action-row .generate-btn {
        padding: 8px 10px !important;
        min-height: 42px !important;
    }
    .generate-action-row .generate-btn .btn-text {
        font-size: 12px !important;
        letter-spacing: 0.2px !important;
    }
}


/* =========================================================================
   ANAVAR VERIFIED FIX: LOGOUT ESCAPE & ENRICH CLIPPING HOTFIX
   ========================================================================= */

/* 1. Header Right & Logout Button: Absolute Zero-Wrap & Zero-Escape */
.header-right {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    flex-shrink: 0 !important;
    min-width: 0 !important;
    margin-left: auto !important;
}

.user-profile-badge {
    display: inline-flex !important;
    align-items: center !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    gap: 8px !important;
    padding: 3px 8px 3px 6px !important;
    border-radius: 20px !important;
    background: rgba(15, 23, 42, 0.75) !important;
    border: 1px solid rgba(56, 189, 248, 0.25) !important;
    flex-shrink: 0 !important;
    box-sizing: border-box !important;
}

.user-profile-badge .user-meta {
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    min-width: 0 !important;
    flex-shrink: 1 !important;
}

.user-profile-badge .user-name {
    display: inline-block !important;
    max-width: 90px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    font-size: 12px !important;
    font-weight: 700 !important;
    color: #e2e8f0 !important;
}

.user-profile-badge .user-actions {
    display: inline-flex !important;
    align-items: center !important;
    gap: 4px !important;
    flex-shrink: 0 !important;
}

.logout-link {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    white-space: nowrap !important;
    width: 28px !important;
    height: 28px !important;
    min-width: 28px !important;
    min-height: 28px !important;
    padding: 0 !important;
    margin: 0 !important;
    border-radius: 6px !important;
    background: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    color: #94a3b8 !important;
    font-size: 12px !important;
    transition: all 0.2s ease !important;
    flex-shrink: 0 !important;
    box-sizing: border-box !important;
}

.logout-link:hover {
    color: #f87171 !important;
    background: rgba(239, 68, 68, 0.18) !important;
    border-color: rgba(239, 68, 68, 0.45) !important;
    transform: none !important;
}

.logout-link .logout-text {
    display: none !important; /* Pure icon button eliminates text wrapping into 2 lines */
}

/* Ensure desktop navigation compresses gracefully on desktop, and is NEVER visible on mobile */
@media (min-width: 901px) {
    .desktop-nav-segmented {
        display: inline-flex !important;
        align-items: center !important;
        flex-shrink: 0 !important;
        gap: 3px !important;
        padding: 3px 4px !important;
        background: rgba(9, 14, 26, 0.85) !important;
        border: 1px solid rgba(255, 255, 255, 0.08) !important;
        border-radius: 24px !important;
    }

    .desktop-nav-segmented .nav-segment-btn {
        flex-shrink: 0 !important;
        min-width: 0 !important;
        padding: 6px 9px !important;
        font-size: 11.5px !important;
        font-weight: 600 !important;
        gap: 5px !important;
        white-space: nowrap !important;
        min-height: 34px !important;
        border-radius: 18px !important;
    }

    .desktop-nav-segmented .nav-segment-btn i {
        font-size: 12px !important;
    }

    .desktop-nav-segmented .comic-pill-badge,
    .desktop-nav-segmented .rainscript-badge {
        padding: 1px 4px !important;
        font-size: 8.5px !important;
        margin-left: 2px !important;
    }
}

@media (max-width: 900px) {
    .desktop-nav-segmented {
        display: none !important;
    }
}

.header-support-pill {
    padding: 6px 10px !important;
    font-size: 12px !important;
    gap: 6px !important;
    white-space: nowrap !important;
}

/* 2. Controls Panel & Enrich Button Zero-Clipping (Desktop Only) */
@media (min-width: 901px) {
    body.view-studio .studio-workspace {
        grid-template-columns: 410px minmax(0, 1fr) !important;
        gap: 16px !important;
    }

    .controls-panel {
        padding: 0 !important;
        box-sizing: border-box !important;
        overflow: hidden !important;
    }
}

.section-label-row {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

.section-label {
    font-size: 11px !important;
    font-weight: 700 !important;
    letter-spacing: 0.05em !important;
    flex-shrink: 0 !important;
}

.prompt-quick-actions {
    display: inline-flex !important;
    align-items: center !important;
    gap: 5px !important;
    flex-shrink: 0 !important;
    box-sizing: border-box !important;
}

.prompt-mode-toggle {
    display: inline-flex !important;
    align-items: center !important;
    background: rgba(15, 23, 42, 0.75) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 6px !important;
    padding: 2px !important;
    gap: 2px !important;
    height: auto !important;
    box-sizing: border-box !important;
}

.prompt-mode-toggle .mode-pill {
    padding: 3px 7px !important;
    font-size: 10.5px !important;
    font-weight: 700 !important;
    letter-spacing: 0.2px !important;
    border-radius: 4px !important;
    gap: 4px !important;
    white-space: nowrap !important;
    box-sizing: border-box !important;
    height: 24px !important;
}

.prompt-assist-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 4px !important;
    padding: 3px 8px !important;
    font-size: 10.5px !important;
    font-weight: 700 !important;
    letter-spacing: 0.2px !important;
    border-radius: 4px !important;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
    box-sizing: border-box !important;
    height: 28px !important;
    margin: 0 !important;
}



/* ==========================================================================
   SOVEREIGN LIGHTBOX MASTERPIECE THEME & PIXEL-PERFECT ALIGNMENT
   ========================================================================== */
.lightbox-header {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 10px 18px !important;
    border-bottom: 1px solid rgba(56, 189, 248, 0.2) !important;
    background: rgba(10, 15, 28, 0.96) !important;
    backdrop-filter: blur(14px) !important;
    -webkit-backdrop-filter: blur(14px) !important;
    flex-shrink: 0 !important;
    gap: 16px !important;
    box-sizing: border-box !important;
    width: 100% !important;
}

.lightbox-title-group {
    display: flex !important;
    flex-direction: column !important;
    gap: 3px !important;
    min-width: 0 !important;
    flex-shrink: 1 !important;
}

.lightbox-title-row {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    min-width: 0 !important;
}

.lightbox-title-group h3,
.lightbox-char-title {
    margin: 0 !important;
    font-size: 0.95rem !important;
    font-weight: 800 !important;
    color: #f8fafc !important;
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    letter-spacing: 0.04em !important;
    text-transform: none !important;
    white-space: nowrap !important;
    font-family: 'Plus Jakarta Sans', sans-serif !important;
}

.lightbox-char-title i {
    color: #00f2fe !important;
    font-size: 0.9rem !important;
}

.lightbox-nav-counter {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 0.74rem !important;
    font-weight: 700 !important;
    font-family: 'JetBrains Mono', monospace !important;
    color: #00f2fe !important;
    background: rgba(0, 242, 254, 0.1) !important;
    border: 1px solid rgba(0, 242, 254, 0.3) !important;
    padding: 2px 8px !important;
    border-radius: 6px !important;
    white-space: nowrap !important;
    line-height: 1.2 !important;
}

.lightbox-meta-info {
    font-size: 0.72rem !important;
    color: #64748b !important;
    font-family: 'Plus Jakarta Sans', sans-serif !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}

.lightbox-header-actions {
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    flex-shrink: 0 !important;
    flex-wrap: nowrap !important;
}

/* Master Normalization for ALL Lightbox Action Buttons */
.lightbox-action-btn,
.lightbox-header-actions .modal-close-btn,
.lightbox-header-actions .lightbox-close-btn {
    height: 34px !important;
    min-height: 34px !important;
    max-height: 34px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 11px !important;
    border-radius: 8px !important;
    font-size: 0.78rem !important;
    font-weight: 600 !important;
    font-family: 'Plus Jakarta Sans', sans-serif !important;
    text-decoration: none !important;
    white-space: nowrap !important;
    box-sizing: border-box !important;
    vertical-align: middle !important;
    cursor: pointer !important;
    line-height: 1 !important;
    margin: 0 !important;
    transition: all 0.15s ease !important;
    background: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    color: #e2e8f0 !important;
}

.lightbox-action-btn:hover {
    background: rgba(255, 255, 255, 0.1) !important;
    border-color: rgba(255, 255, 255, 0.25) !important;
    color: #ffffff !important;
    transform: translateY(-1px) !important;
}

.lightbox-action-btn i {
    font-size: 0.82rem !important;
    margin-right: 6px !important;
    display: inline-block !important;
    vertical-align: middle !important;
}

/* Specific Accent Tones */
.lightbox-action-btn.lightbox-like-btn {
    padding: 0 10px !important;
    background: rgba(244, 63, 94, 0.08) !important;
    border-color: rgba(244, 63, 94, 0.3) !important;
    color: #f43f5e !important;
}
.lightbox-action-btn.lightbox-like-btn:hover {
    background: rgba(244, 63, 94, 0.18) !important;
    border-color: #f43f5e !important;
    color: #ff4d6d !important;
}
.lightbox-action-btn.lightbox-like-btn.liked {
    background: rgba(244, 63, 94, 0.25) !important;
    border-color: #f43f5e !important;
    color: #ff4d6d !important;
}

.lightbox-action-btn.lightbox-privacy-btn {
    background: rgba(56, 189, 248, 0.08) !important;
    border-color: rgba(56, 189, 248, 0.3) !important;
    color: #38bdf8 !important;
}
.lightbox-action-btn.lightbox-privacy-btn:hover {
    background: rgba(56, 189, 248, 0.18) !important;
    border-color: #00f2fe !important;
    color: #ffffff !important;
}

.lightbox-action-btn.lightbox-share-btn {
    background: rgba(255, 255, 255, 0.05) !important;
    border-color: rgba(255, 255, 255, 0.14) !important;
    color: #cbd5e1 !important;
}
.lightbox-action-btn.lightbox-share-btn.is-published {
    background: rgba(16, 185, 129, 0.12) !important;
    border-color: rgba(16, 185, 129, 0.4) !important;
    color: #34d399 !important;
}

.lightbox-action-btn.lightbox-clean-btn,
.lightbox-action-btn#btn-lightbox-download-clean {
    background: rgba(245, 158, 11, 0.1) !important;
    border-color: rgba(245, 158, 11, 0.35) !important;
    color: #fbbf24 !important;
}
.lightbox-action-btn.lightbox-clean-btn:hover,
.lightbox-action-btn#btn-lightbox-download-clean:hover {
    background: rgba(245, 158, 11, 0.22) !important;
    border-color: #fbbf24 !important;
    color: #ffffff !important;
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.3) !important;
}

.lightbox-action-btn.sticker-highlight {
    background: rgba(168, 85, 247, 0.1) !important;
    border-color: rgba(168, 85, 247, 0.35) !important;
    color: #c084fc !important;
}
.lightbox-action-btn.sticker-highlight:hover {
    background: rgba(168, 85, 247, 0.22) !important;
    border-color: #c084fc !important;
    color: #ffffff !important;
}

.lightbox-action-btn.inpaint-highlight {
    background: rgba(0, 242, 254, 0.12) !important;
    border-color: rgba(0, 242, 254, 0.4) !important;
    color: #00f2fe !important;
}
.lightbox-action-btn.inpaint-highlight:hover {
    background: rgba(0, 242, 254, 0.22) !important;
    border-color: #00f2fe !important;
    color: #ffffff !important;
    box-shadow: 0 0 12px rgba(0, 242, 254, 0.35) !important;
}

.lightbox-header-actions .lightbox-close-btn,
.lightbox-header-actions .modal-close-btn {
    width: 34px !important;
    min-width: 34px !important;
    max-width: 34px !important;
    padding: 0 !important;
    border-radius: 8px !important;
    background: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid rgba(255, 255, 255, 0.14) !important;
    color: #94a3b8 !important;
    font-size: 0.95rem !important;
}
.lightbox-header-actions .lightbox-close-btn:hover,
.lightbox-header-actions .modal-close-btn:hover {
    background: rgba(239, 68, 68, 0.2) !important;
    border-color: rgba(239, 68, 68, 0.5) !important;
    color: #f87171 !important;
}
.lightbox-header-actions .lightbox-close-btn i,
.lightbox-header-actions .modal-close-btn i {
    margin: 0 !important;
}

/* Lightbox Footer & Actions Harmonization */
.lightbox-footer {
    padding: 10px 18px !important;
    background: rgba(10, 15, 28, 0.96) !important;
    border-top: 1px solid rgba(56, 189, 248, 0.2) !important;
}

.lightbox-footer-prompt-wrap {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 16px !important;
    width: 100% !important;
}

.lightbox-prompt-text {
    font-family: 'JetBrains Mono', monospace !important;
    font-size: 0.78rem !important;
    color: #94a3b8 !important;
    padding: 6px 12px !important;
    background: rgba(4, 7, 15, 0.6) !important;
    border-radius: 6px !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    flex: 1 1 auto !important;
    min-width: 0 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}

.lightbox-footer-actions {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    flex-shrink: 0 !important;
}

.lightbox-rating-pills {
    display: inline-flex !important;
    align-items: center !important;
    gap: 4px !important;
    background: rgba(15, 23, 42, 0.8) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    padding: 2px 6px !important;
    border-radius: 8px !important;
}

.lightbox-rate-label {
    font-size: 0.72rem !important;
    font-weight: 700 !important;
    color: #94a3b8 !important;
    margin-right: 4px !important;
    font-family: 'Plus Jakarta Sans', sans-serif !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 4px !important;
}

.lightbox-rate-btn {
    height: 28px !important;
    min-height: 28px !important;
    max-height: 28px !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 4px !important;
    padding: 0 8px !important;
    font-size: 0.74rem !important;
    font-family: 'Plus Jakarta Sans', sans-serif !important;
    border-radius: 6px !important;
    white-space: nowrap !important;
    border: 1px solid transparent !important;
    background: transparent !important;
    color: #cbd5e1 !important;
    cursor: pointer !important;
    transition: all 0.15s ease !important;
    box-sizing: border-box !important;
}

.lightbox-rate-btn:hover {
    background: rgba(255, 255, 255, 0.1) !important;
    color: #fff !important;
}
.lightbox-rate-btn.dislike:hover {
    color: #f87171 !important;
    background: rgba(239, 68, 68, 0.15) !important;
    border-color: rgba(239, 68, 68, 0.3) !important;
}
.lightbox-rate-btn.like:hover {
    color: #34d399 !important;
    background: rgba(16, 185, 129, 0.15) !important;
    border-color: rgba(16, 185, 129, 0.3) !important;
}
.lightbox-rate-btn.star:hover {
    color: #fbbf24 !important;
    background: rgba(245, 158, 11, 0.15) !important;
    border-color: rgba(245, 158, 11, 0.3) !important;
}

.lightbox-action-btns-group {
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    flex-shrink: 0 !important;
}

.lightbox-footer-actions .compact-pill-btn {
    height: 30px !important;
    min-height: 30px !important;
    max-height: 30px !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 5px !important;
    padding: 0 10px !important;
    font-size: 0.74rem !important;
    font-family: 'Plus Jakarta Sans', sans-serif !important;
    font-weight: 600 !important;
    border-radius: 6px !important;
    white-space: nowrap !important;
    box-sizing: border-box !important;
    cursor: pointer !important;
    background: rgba(15, 23, 42, 0.8) !important;
    border: 1px solid rgba(255, 255, 255, 0.14) !important;
    color: #cbd5e1 !important;
    transition: all 0.15s ease !important;
}

.lightbox-footer-actions .compact-pill-btn:hover {
    background: rgba(56, 189, 248, 0.2) !important;
    border-color: #38bdf8 !important;
    color: #f8fafc !important;
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.25) !important;
}


/* =========================================================================
   LIGHTBOX CINEMA VIEW: SOVEREIGN RESPONSIVE MASTER ARCHITECTURE
   ========================================================================= */
@media (max-width: 768px) {
    .lightbox-modal-box {
        width: 100vw !important;
        height: 100vh !important;
        max-width: 100vw !important;
        max-height: 100vh !important;
        border-radius: 0 !important;
        border: none !important;
        padding: 0 !important;
        display: flex !important;
        flex-direction: column !important;
        overflow: hidden !important;
    }

    .lightbox-header {
        padding: 8px 12px !important;
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 8px !important;
        background: rgba(10, 15, 28, 0.98) !important;
        border-bottom: 1px solid rgba(56, 189, 248, 0.2) !important;
        box-sizing: border-box !important;
        width: 100% !important;
    }

    .lightbox-title-group {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        width: 100% !important;
    }

    .lightbox-meta-info {
        display: none !important;
    }

    .lightbox-header-actions {
        display: flex !important;
        align-items: center !important;
        gap: 6px !important;
        width: 100% !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        scrollbar-width: none !important;
        padding-bottom: 2px !important;
        box-sizing: border-box !important;
    }
    .lightbox-header-actions::-webkit-scrollbar {
        display: none !important;
    }

    .lightbox-action-btn {
        flex-shrink: 0 !important;
        height: 34px !important;
        padding: 0 10px !important;
        font-size: 0.74rem !important;
    }

    .lightbox-footer {
        padding: 8px 10px !important;
        max-width: 100vw !important;
        width: 100% !important;
        box-sizing: border-box !important;
        overflow: hidden !important;
        background: rgba(10, 15, 28, 0.98) !important;
        border-top: 1px solid rgba(56, 189, 248, 0.2) !important;
    }

    .lightbox-footer-prompt-wrap {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 6px !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .lightbox-prompt-text {
        white-space: normal !important;
        max-height: 44px !important;
        overflow-y: auto !important;
        font-size: 0.72rem !important;
        line-height: 1.3 !important;
        width: 100% !important;
        box-sizing: border-box !important;
        padding: 4px 8px !important;
    }

    .lightbox-footer-actions {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 6px !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .lightbox-rating-pills {
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        width: 100% !important;
        box-sizing: border-box !important;
        gap: 4px !important;
        padding: 2px 4px !important;
    }

    .lightbox-rate-label {
        font-size: 0.68rem !important;
        margin-right: 2px !important;
    }

    .rate-label-text,
    .cashback-badge {
        display: none !important;
    }

    .lightbox-rate-btn {
        flex: 1 1 auto !important;
        justify-content: center !important;
        height: 30px !important;
        min-height: 30px !important;
        padding: 0 4px !important;
        font-size: 0.72rem !important;
    }

    .lightbox-action-btns-group {
        display: grid !important;
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 5px !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .lightbox-footer-actions .compact-pill-btn {
        width: 100% !important;
        justify-content: center !important;
        height: 32px !important;
        min-height: 32px !important;
        padding: 0 2px !important;
        font-size: 0.70rem !important;
    }
}

/* ==========================================================================
   FURSONA CINEMA LIGHTBOX MASTER HARMONIZATION (HERMES-1 PIXEL-PERFECT AUDIT)
   Strict vertical alignment, rigid 34px buttons, zero text wrap, no collisions.
   ========================================================================== */

/* Universal Button Precision */
.lightbox-header-actions .lightbox-action-btn,
.lightbox-header-actions a.lightbox-action-btn,
.lightbox-header-actions button.lightbox-action-btn {
    height: 34px !important;
    min-height: 34px !important;
    max-height: 34px !important;
    line-height: 32px !important;
    box-sizing: border-box !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 11px !important;
    border-radius: 7px !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    font-family: 'Plus Jakarta Sans', sans-serif !important;
    text-decoration: none !important;
    white-space: nowrap !important;
    cursor: pointer !important;
    transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1) !important;
    background: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    color: #e2e8f0 !important;
    flex-shrink: 0 !important;
    margin: 0 !important;
}

.lightbox-header-actions .lightbox-action-btn:hover {
    background: rgba(255, 255, 255, 0.1) !important;
    border-color: rgba(255, 255, 255, 0.25) !important;
    color: #ffffff !important;
    transform: translateY(-1px) !important;
}

.lightbox-header-actions .lightbox-action-btn span {
    white-space: nowrap !important;
    display: inline-block !important;
    line-height: 1 !important;
}

.lightbox-header-actions .lightbox-action-btn i {
    font-size: 12px !important;
    margin-right: 5px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    line-height: 1 !important;
}

.lightbox-header-actions .lightbox-close-btn,
.lightbox-header-actions .modal-close-btn {
    width: 34px !important;
    min-width: 34px !important;
    max-width: 34px !important;
    height: 34px !important;
    min-height: 34px !important;
    max-height: 34px !important;
    padding: 0 !important;
    border-radius: 7px !important;
    background: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    color: #94a3b8 !important;
    font-size: 14px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    transition: all 0.15s ease !important;
    margin: 0 !important;
    flex-shrink: 0 !important;
}

.lightbox-header-actions .lightbox-close-btn i,
.lightbox-header-actions .modal-close-btn i {
    margin: 0 !important;
    font-size: 14px !important;
    line-height: 1 !important;
}

.lightbox-header-actions .lightbox-close-btn:hover,
.lightbox-header-actions .modal-close-btn:hover {
    background: rgba(239, 68, 68, 0.18) !important;
    border-color: rgba(239, 68, 68, 0.4) !important;
    color: #f87171 !important;
}

/* Harmonious Semantic Tones */
.lightbox-header-actions .lightbox-like-btn {
    background: rgba(244, 63, 94, 0.08) !important;
    border-color: rgba(244, 63, 94, 0.25) !important;
    color: #fb7185 !important;
    padding: 0 10px !important;
}
.lightbox-header-actions .lightbox-like-btn:hover,
.lightbox-header-actions .lightbox-like-btn.liked {
    background: rgba(244, 63, 94, 0.2) !important;
    border-color: #f43f5e !important;
    color: #ff4d6d !important;
}

.lightbox-header-actions .lightbox-privacy-btn {
    background: rgba(56, 189, 248, 0.08) !important;
    border-color: rgba(56, 189, 248, 0.25) !important;
    color: #38bdf8 !important;
}

.lightbox-header-actions .lightbox-share-btn.is-published {
    background: rgba(16, 185, 129, 0.12) !important;
    border-color: rgba(16, 185, 129, 0.4) !important;
    color: #34d399 !important;
}

.lightbox-header-actions .lightbox-clean-btn,
.lightbox-header-actions #btn-lightbox-download-clean {
    background: rgba(245, 158, 11, 0.1) !important;
    border-color: rgba(245, 158, 11, 0.3) !important;
    color: #fbbf24 !important;
}
.lightbox-header-actions .lightbox-clean-btn:hover,
.lightbox-header-actions #btn-lightbox-download-clean:hover {
    background: rgba(245, 158, 11, 0.2) !important;
    border-color: #fbbf24 !important;
    color: #ffffff !important;
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.35) !important;
}

.lightbox-header-actions .sticker-highlight {
    background: rgba(168, 85, 247, 0.1) !important;
    border-color: rgba(168, 85, 247, 0.3) !important;
    color: #c084fc !important;
}
.lightbox-header-actions .sticker-highlight:hover {
    background: rgba(168, 85, 247, 0.2) !important;
    border-color: #c084fc !important;
    color: #ffffff !important;
}

.lightbox-header-actions .inpaint-highlight {
    background: rgba(56, 189, 248, 0.12) !important;
    border-color: rgba(56, 189, 248, 0.35) !important;
    color: #38bdf8 !important;
}
.lightbox-header-actions .inpaint-highlight:hover {
    background: rgba(56, 189, 248, 0.24) !important;
    border-color: #38bdf8 !important;
    color: #ffffff !important;
    box-shadow: 0 0 12px rgba(56, 189, 248, 0.35) !important;
}

/* DESKTOP & TABLET LANDSCAPE (>= 769px) */
@media (min-width: 769px) {
    .lightbox-modal-box {
        background: rgba(10, 14, 26, 0.98) !important;
        border: 1px solid rgba(56, 189, 248, 0.28) !important;
        border-radius: 14px !important;
        box-shadow: 0 25px 80px rgba(0, 0, 0, 0.92), 0 0 40px rgba(14, 165, 233, 0.2) !important;
        overflow: hidden !important;
    }

    .lightbox-header {
        height: 60px !important;
        min-height: 60px !important;
        max-height: 60px !important;
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: space-between !important;
        padding: 0 20px !important;
        box-sizing: border-box !important;
        background: rgba(10, 15, 30, 0.95) !important;
        border-bottom: 1px solid rgba(56, 189, 248, 0.2) !important;
        backdrop-filter: blur(16px) !important;
        -webkit-backdrop-filter: blur(16px) !important;
        flex-shrink: 0 !important;
        gap: 16px !important;
    }

    .lightbox-title-group {
        display: flex !important;
        flex-direction: column !important;
        justify-content: center !important;
        gap: 2px !important;
        min-width: 0 !important;
        flex: 1 1 auto !important;
    }

    .lightbox-title-row {
        display: flex !important;
        align-items: center !important;
        gap: 10px !important;
        min-width: 0 !important;
    }

    .lightbox-char-title {
        font-family: 'Plus Jakarta Sans', sans-serif !important;
        font-size: 15px !important;
        font-weight: 700 !important;
        color: #f8fafc !important;
        text-transform: none !important;
        letter-spacing: -0.01em !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        margin: 0 !important;
        display: inline-flex !important;
        align-items: center !important;
        gap: 8px !important;
    }

    .lightbox-char-title i {
        color: #38bdf8 !important;
        font-size: 13px !important;
    }

    .lightbox-nav-counter {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        font-family: 'JetBrains Mono', monospace !important;
        font-size: 11px !important;
        font-weight: 600 !important;
        color: #38bdf8 !important;
        background: rgba(56, 189, 248, 0.12) !important;
        border: 1px solid rgba(56, 189, 248, 0.28) !important;
        padding: 2px 7px !important;
        border-radius: 6px !important;
        line-height: 1.2 !important;
        white-space: nowrap !important;
        flex-shrink: 0 !important;
    }

    .lightbox-meta-info {
        font-family: 'Plus Jakarta Sans', sans-serif !important;
        font-size: 11px !important;
        color: #64748b !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        margin: 0 !important;
    }

    .lightbox-header-actions {
        display: inline-flex !important;
        align-items: center !important;
        gap: 6px !important;
        flex-shrink: 0 !important;
        flex-wrap: nowrap !important;
        height: 34px !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    .lightbox-btn-group {
        display: inline-flex !important;
        align-items: center !important;
        gap: 5px !important;
        height: 34px !important;
        flex-shrink: 0 !important;
    }

    .lightbox-v-divider {
        width: 1px !important;
        height: 18px !important;
        background: rgba(255, 255, 255, 0.14) !important;
        margin: 0 4px !important;
        flex-shrink: 0 !important;
    }

    .lightbox-footer {
        height: 52px !important;
        min-height: 52px !important;
        max-height: 52px !important;
        padding: 0 18px !important;
        background: rgba(10, 15, 28, 0.98) !important;
        border-top: 1px solid rgba(56, 189, 248, 0.18) !important;
        display: flex !important;
        align-items: center !important;
        box-sizing: border-box !important;
    }

    .lightbox-footer-prompt-wrap {
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        gap: 16px !important;
        width: 100% !important;
        min-width: 0 !important;
    }

    .lightbox-prompt-text {
        font-family: 'JetBrains Mono', monospace !important;
        font-size: 11.5px !important;
        color: #94a3b8 !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        flex: 1 1 auto !important;
        min-width: 0 !important;
    }

    .lightbox-footer-actions {
        display: inline-flex !important;
        align-items: center !important;
        gap: 10px !important;
        flex-shrink: 0 !important;
        height: 32px !important;
    }
}

/* Intermediate Collapse (max-width: 1200px) */
@media (min-width: 769px) and (max-width: 1200px) {
    #btn-lightbox-prompt-privacy span,
    #btn-lightbox-publish span {
        display: none !important;
    }
    #btn-lightbox-prompt-privacy i,
    #btn-lightbox-publish i {
        margin-right: 0 !important;
    }
}

@media (min-width: 769px) and (max-width: 950px) {
    .lightbox-header-actions .lightbox-action-btn span:not(#lightbox-like-count) {
        display: none !important;
    }
    .lightbox-header-actions .lightbox-action-btn i {
        margin-right: 0 !important;
    }
    .lightbox-v-divider {
        display: none !important;
    }
    .lightbox-btn-group {
        gap: 4px !important;
    }
    .lightbox-header-actions {
        gap: 4px !important;
    }
}

/* MOBILE VIEW (< 769px) */
@media (max-width: 768px) {
    .lightbox-modal-box {
        width: 100vw !important;
        height: 100vh !important;
        max-width: 100vw !important;
        max-height: 100vh !important;
        border-radius: 0 !important;
        border: none !important;
        display: flex !important;
        flex-direction: column !important;
        overflow: hidden !important;
    }

    .lightbox-header {
        height: auto !important;
        min-height: auto !important;
        max-height: none !important;
        padding: 8px 12px !important;
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 8px !important;
        background: rgba(10, 15, 28, 0.98) !important;
        border-bottom: 1px solid rgba(56, 189, 248, 0.2) !important;
        box-sizing: border-box !important;
        width: 100% !important;
    }

    .lightbox-title-group {
        display: flex !important;
        flex-direction: row !important;
        justify-content: space-between !important;
        align-items: center !important;
        width: 100% !important;
    }

    .lightbox-header-actions {
        display: flex !important;
        align-items: center !important;
        gap: 6px !important;
        width: 100% !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        scrollbar-width: none !important;
        padding-bottom: 2px !important;
        box-sizing: border-box !important;
    }

    .lightbox-header-actions::-webkit-scrollbar {
        display: none !important;
    }

    .lightbox-v-divider {
        display: none !important;
    }

    .lightbox-btn-group {
        display: inline-flex !important;
        align-items: center !important;
        gap: 5px !important;
        flex-shrink: 0 !important;
    }

    .lightbox-footer {
        height: auto !important;
        min-height: auto !important;
        max-height: none !important;
        padding: 8px 10px !important;
        max-width: 100vw !important;
        width: 100% !important;
        box-sizing: border-box !important;
        overflow: hidden !important;
        background: rgba(10, 15, 28, 0.98) !important;
        border-top: 1px solid rgba(56, 189, 248, 0.2) !important;
    }

    .lightbox-footer-prompt-wrap {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 6px !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }
}

/* Robust button pointer events for sort & filter pills */
.gallery-sort-btn * {
    pointer-events: none;
}
.gallery-filter-pill * {
    pointer-events: none;
}


/* ==========================================================================
   LIGHTBOX PROMPT ROW & DETAILS DRAWER (PIXEL-PERFECT HARMONIZATION)
   ========================================================================== */
.lightbox-prompt-row {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    flex: 1 1 auto !important;
    min-width: 0 !important;
}

.lightbox-prompt-text {
    cursor: pointer !important;
    transition: all 0.2s ease !important;
}
.lightbox-prompt-text:hover {
    background: rgba(14, 165, 233, 0.12) !important;
    border-color: rgba(56, 189, 248, 0.35) !important;
    color: #f1f5f9 !important;
}

.lightbox-details-btn {
    height: 30px !important;
    min-height: 30px !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    padding: 0 10px !important;
    font-size: 11px !important;
    font-weight: 600 !important;
    font-family: 'Plus Jakarta Sans', sans-serif !important;
    color: #94a3b8 !important;
    background: rgba(15, 23, 42, 0.75) !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    border-radius: 6px !important;
    cursor: pointer !important;
    white-space: nowrap !important;
    transition: all 0.2s ease !important;
}
.lightbox-details-btn:hover {
    color: #38bdf8 !important;
    border-color: rgba(56, 189, 248, 0.45) !important;
    background: rgba(56, 189, 248, 0.12) !important;
}

.lightbox-details-drawer {
    position: absolute !important;
    bottom: 60px !important;
    left: 20px !important;
    right: 20px !important;
    background: rgba(10, 15, 30, 0.98) !important;
    border: 1px solid rgba(56, 189, 248, 0.35) !important;
    border-radius: 12px !important;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.85), 0 0 25px rgba(56, 189, 248, 0.15) !important;
    padding: 16px 20px !important;
    z-index: 100 !important;
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
    max-height: 380px !important;
    overflow-y: auto !important;
    animation: drawerSlideUp 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
}
@keyframes drawerSlideUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.details-drawer-header {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    margin-bottom: 12px !important;
    padding-bottom: 8px !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
}
.details-drawer-title {
    font-size: 13px !important;
    font-weight: 700 !important;
    color: #38bdf8 !important;
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
}
.details-drawer-close {
    background: transparent !important;
    border: none !important;
    color: #94a3b8 !important;
    cursor: pointer !important;
    font-size: 14px !important;
    padding: 4px !important;
}
.details-drawer-close:hover {
    color: #f8fafc !important;
}
.details-field {
    margin-bottom: 10px !important;
}
.details-field-label {
    font-size: 11px !important;
    font-weight: 700 !important;
    color: #64748b !important;
    text-transform: uppercase !important;
    letter-spacing: 0.05em !important;
    margin-bottom: 4px !important;
}
.details-field-val {
    font-family: 'JetBrains Mono', monospace !important;
    font-size: 12px !important;
    color: #cbd5e1 !important;
    background: rgba(4, 7, 15, 0.7) !important;
    padding: 8px 12px !important;
    border-radius: 6px !important;
    border: 1px solid rgba(255, 255, 255, 0.06) !important;
    word-break: break-word !important;
    max-height: 120px !important;
    overflow-y: auto !important;
}
.details-grid-meta {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)) !important;
    gap: 10px !important;
    margin-top: 10px !important;
}
.details-meta-card {
    background: rgba(15, 23, 42, 0.7) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    border-radius: 8px !important;
    padding: 8px 12px !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 2px !important;
}
.details-meta-card .meta-label {
    font-size: 10px !important;
    font-weight: 700 !important;
    color: #64748b !important;
    text-transform: uppercase !important;
    letter-spacing: 0.04em !important;
}
.details-meta-card .meta-val {
    font-family: 'JetBrains Mono', monospace !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    color: #f1f5f9 !important;
}

/* ==========================================================================
   COMPREHENSIVE MOBILE VIEWPORT OVERHAUL (ZERO-COLLISION, PROPORTIONAL PADDING)
   ========================================================================== */

@media (max-width: 768px) {
    /* 1. Universal Layout Flow & Safe-Area Clearance */
    body.view-studio .studio-workspace {
        display: flex !important;
        flex-direction: column !important;
        width: 100% !important;
        min-width: 0 !important;
    }

    .controls-panel {
        width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box !important;
        padding: 8px 6px 145px 6px !important;
    }

    .controls-scroll-area {
        width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box !important;
        padding: 8px 6px 145px 6px !important;
    }

    #pane-studio,
    #pane-canvas,
    #pane-history,
    #pane-gallery,
    #comic-workspace,
    #rainscript-workspace {
        padding-bottom: calc(env(safe-area-inset-bottom, 16px) + 140px) !important;
        box-sizing: border-box !important;
    }

    /* 2. Header Architecture (Zero Overlap on Mobile) */
    .studio-header {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        flex-wrap: nowrap !important;
        padding: 6px 10px !important;
        gap: 6px !important;
        width: 100% !important;
        box-sizing: border-box !important;
        overflow: hidden !important;
    }

    .brand {
        display: flex !important;
        align-items: center !important;
        gap: 6px !important;
        flex: 0 0 auto !important;
        min-width: 0 !important;
        max-width: 120px !important;
    }

    .brand-logo {
        width: 28px !important;
        height: 28px !important;
        flex-shrink: 0 !important;
    }

    .brand-text {
        display: flex !important;
        flex-direction: column !important;
        justify-content: center !important;
        min-width: 0 !important;
    }

    .brand-title-row {
        display: flex !important;
        align-items: center !important;
        gap: 4px !important;
        white-space: nowrap !important;
        min-width: 0 !important;
    }

    .brand-title-row h1 {
        font-size: 13.5px !important;
        white-space: nowrap !important;
        line-height: 1.1 !important;
        margin: 0 !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }

    #app-brand-subtitle {
        display: none !important;
    }

    .brand-version-badge {
        display: none !important;
    }

    .header-right {
        display: flex !important;
        align-items: center !important;
        gap: 5px !important;
        flex: 1 1 auto !important;
        justify-content: flex-end !important;
        min-width: 0 !important;
    }

    .auth-bar {
        display: flex !important;
        align-items: center !important;
        min-width: 0 !important;
        flex-shrink: 1 !important;
    }

    .user-profile-badge {
        display: inline-flex !important;
        align-items: center !important;
        gap: 5px !important;
        padding: 2px 6px !important;
        max-width: 175px !important;
        min-width: 0 !important;
        overflow: hidden !important;
    }

    .user-profile-badge .user-avatar {
        width: 24px !important;
        height: 24px !important;
        flex-shrink: 0 !important;
    }

    .user-profile-badge .user-meta {
        min-width: 0 !important;
        flex: 1 1 auto !important;
        max-width: 80px !important;
        overflow: hidden !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: center !important;
    }

    .user-profile-badge .user-name {
        font-size: 11px !important;
        max-width: 80px !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
        line-height: 1.15 !important;
    }

    .user-profile-badge .drops-badge {
        font-size: 9px !important;
        padding: 1px 3px !important;
        max-width: 80px !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
        line-height: 1.1 !important;
    }

    .user-actions {
        display: inline-flex !important;
        align-items: center !important;
        gap: 3px !important;
        flex-shrink: 0 !important;
    }

    .auth-bar .admin-trigger-btn {
        width: 28px !important;
        height: 28px !important;
        min-width: 28px !important;
        min-height: 28px !important;
        padding: 0 !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    .auth-bar .admin-trigger-btn span,
    .auth-bar .admin-trigger-btn .admin-btn-text {
        display: none !important;
    }

    .auth-bar .logout-link {
        width: 28px !important;
        height: 28px !important;
        min-width: 28px !important;
        min-height: 28px !important;
        padding: 0 !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    .auth-bar .logout-link span,
    .auth-bar .logout-link .logout-text {
        display: none !important;
    }

    /* Guest Buttons on Mobile */
    .auth-buttons-wrap {
        display: flex !important;
        align-items: center !important;
        gap: 4px !important;
        flex-wrap: nowrap !important;
    }

    .discord-login-btn {
        padding: 5px 8px !important;
        font-size: 11px !important;
        max-width: 135px !important;
        min-height: 32px !important;
    }

    .discord-login-btn span {
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }

    .dev-admin-btn {
        padding: 5px 8px !important;
        font-size: 11px !important;
        min-height: 32px !important;
    }

    .dev-admin-btn span {
        display: none !important;
    }

    /* 3. Studio Section Spacing & Character Card */
    .studio-section {
        padding: 10px 8px !important;
        margin-bottom: 8px !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .active-char-compact {
        padding: 8px 10px !important;
        gap: 8px !important;
        width: 100% !important;
        box-sizing: border-box !important;
        min-height: 52px !important;
    }

    .active-char-compact .active-char-avatar-frame {
        width: 40px !important;
        height: 40px !important;
        flex-shrink: 0 !important;
    }

    .active-char-compact .active-char-name-row {
        display: flex !important;
        align-items: center !important;
        flex-wrap: wrap !important;
        gap: 4px !important;
        width: 100% !important;
    }

    .active-char-compact .active-char-name {
        font-size: 0.92rem !important;
        max-width: none !important;
        overflow: visible !important;
        text-overflow: clip !important;
        white-space: nowrap !important;
        flex-shrink: 0 !important;
    }

    .active-char-compact .active-char-species-pill {
        font-size: 9.5px !important;
        padding: 2px 6px !important;
        flex-shrink: 0 !important;
    }

    .active-char-compact .active-char-traits-compact {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 3px !important;
        margin-top: 2px !important;
    }

    .active-char-compact .trait-pill {
        font-size: 9px !important;
        padding: 2px 5px !important;
    }

    /* 4. Aspect Ratio Grid Primary */
    .aspect-grid-primary {
        display: grid !important;
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 6px !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .aspect-card {
        padding: 8px 4px !important;
        min-width: 0 !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        text-align: center !important;
        box-sizing: border-box !important;
    }

    .aspect-card .aspect-title {
        font-size: 11px !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        width: 100% !important;
    }

    .aspect-card .aspect-res-sub {
        font-size: 9.5px !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        width: 100% !important;
    }

    .aspect-card .aspect-cost-pill {
        font-size: 9px !important;
        padding: 1px 4px !important;
        margin-top: 4px !important;
    }

    /* 5. Touch Scroll Tracks & Dialogs */
    .roster-categories,
    .category-filters,
    .leaderboard-tabs,
    .rainscript-mode-toggle,
    .comic-format-pills,
    .comic-layout-pills {
        overflow-x: auto !important;
        flex-wrap: nowrap !important;
        -webkit-overflow-scrolling: touch !important;
        scrollbar-width: none !important;
    }

    .roster-categories::-webkit-scrollbar,
    .category-filters::-webkit-scrollbar,
    .leaderboard-tabs::-webkit-scrollbar,
    .rainscript-mode-toggle::-webkit-scrollbar,
    .comic-format-pills::-webkit-scrollbar,
    .comic-layout-pills::-webkit-scrollbar {
        display: none !important;
    }

    .leaderboard-summary-strip {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 6px !important;
    }

    .lb-table-wrap {
        width: 100% !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }

    .lb-table {
        min-width: 480px !important;
    }
}

/* Extra Compact Pass for Very Small Screens (<= 375px down to 320px) */
@media (max-width: 375px) {
    .studio-header {
        padding: 4px 6px !important;
        gap: 4px !important;
    }

    .brand-title-row h1 {
        font-size: 12.5px !important;
    }

    .user-profile-badge {
        max-width: 155px !important;
    }

    .user-profile-badge .user-name {
        max-width: 68px !important;
    }

    .user-profile-badge .drops-badge {
        max-width: 68px !important;
    }
}

/* =========================================================================
   WORKSTREAM B — UNIFIED DESKTOP (1440px) & MOBILE (390px) UI POLISH
   ========================================================================= */

/* 1. Gallery Search Input & NSFW Overlay Pointer Safety */
.gallery-toolbar-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.gallery-toolbar-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1 1 260px;
    justify-content: flex-end;
}

.gallery-search-wrap {
    position: relative;
    flex: 1 1 220px;
    max-width: 340px;
    min-width: 160px;
}

.gallery-search-icon {
    position: absolute;
    left: 11px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 12px;
    color: #64748b;
    pointer-events: none;
}

.gallery-search-input {
    width: 100%;
    padding: 7px 12px 7px 32px;
    border-radius: 8px;
    background: rgba(10, 15, 28, 0.85);
    border: 1px solid rgba(56, 189, 248, 0.25);
    color: #f1f5f9;
    font-size: 12.5px;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
}

.gallery-search-input:focus {
    border-color: #38bdf8;
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.25);
}

.nsfw-overlay * {
    pointer-events: none !important;
}

/* 2. Desktop 1440px Header Fit (Zero #auth-container / Admin / Logout Overflow) */
@media (max-width: 1520px) and (min-width: 901px) {
    .studio-header {
        padding: 6px 12px !important;
        gap: 6px !important;
        overflow: hidden !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }
    .brand {
        flex-shrink: 1 !important;
        min-width: 0 !important;
    }
    .brand-text {
        min-width: 0 !important;
    }
    .logo-wrapper {
        width: 32px !important;
        height: 32px !important;
    }
    .brand-title-row h1 {
        font-size: 13px !important;
        white-space: nowrap !important;
        overflow: visible !important;
        max-width: none !important;
    }
    .brand-version-badge,
    .header-support-pill span,
    .brand-text .tagline,
    .citizen-lv-pill {
        display: none !important;
    }
    .desktop-nav-segmented {
        flex-shrink: 0 !important;
        width: max-content !important;
        min-width: max-content !important;
        gap: 2px !important;
        padding: 2px !important;
    }
    .desktop-nav-segmented .nav-segment-btn {
        flex-shrink: 0 !important;
        padding: 5px 7px !important;
        font-size: 10px !important;
        gap: 4px !important;
    }
    .header-right {
        flex-shrink: 1 !important;
        gap: 5px !important;
        min-width: 0 !important;
    }
    .user-profile-badge {
        flex-shrink: 1 !important;
        gap: 5px !important;
        padding: 3px 6px !important;
        min-width: 0 !important;
    }
    .user-profile-badge .user-name {
        max-width: 72px !important;
        font-size: 11px !important;
    }
    .user-profile-badge .drops-badge {
        font-size: 10.5px !important;
        padding: 2px 5px !important;
    }
    .admin-trigger-btn {
        padding: 4px 6px !important;
        font-size: 10.5px !important;
        flex-shrink: 0 !important;
    }
}

/* 3. Desktop Left Sidebar Clean Scroll + Non-Overlapping Dock */
@media (min-width: 901px) {
    body.view-studio .controls-scroll-area {
        padding: 12px 14px 22px 14px !important;
    }
    body.view-studio .controls-action-dock {
        background: #0a0e18 !important;
        border-top: 1px solid rgba(56, 189, 248, 0.25) !important;
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.35) !important;
    }
}

/* 4. Character Roster Cards Zero-Clipping & Modal Header Gap */
.roster-modal .modal-header {
    padding-right: 48px !important;
    gap: 14px !important;
}

.roster-modal .roster-card,
.roster-card {
    height: auto !important;
    max-height: none !important;
    min-height: 78px !important;
    overflow: visible !important;
    align-items: flex-start !important;
}

.roster-modal .roster-details,
.roster-modal .roster-traits-list,
.roster-details,
.roster-traits-list {
    overflow: visible !important;
}

.roster-modal .roster-name,
.roster-name {
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
}

.roster-modal .roster-pill,
.roster-pill {
    max-width: none !important;
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
}

/* 5. Admin KPI Cards Wrap Cleanly (Zero TODAY'S GENERATIONS / UPVOTES Clipping) */
.admin-kpi-grid {
    grid-template-columns: repeat(auto-fill, minmax(175px, 1fr)) !important;
}

.admin-kpi-card {
    min-width: 0 !important;
}

.admin-kpi-card .kpi-label {
    white-space: normal !important;
    line-height: 1.25 !important;
    font-size: 10px !important;
    overflow-wrap: break-word !important;
}

/* 6. Leaderboard Header Pill & Mobile Card / Lightbox Refinements */
.leaderboard-header-badge {
    white-space: nowrap !important;
    flex-shrink: 0 !important;
}

@media (max-width: 768px) {
    .lightbox-header-actions {
        display: flex !important;
        flex-wrap: wrap !important;
        overflow: visible !important;
        justify-content: flex-start !important;
        align-items: center !important;
        gap: 6px !important;
        height: auto !important;
        max-height: none !important;
        width: 100% !important;
    }
    .lightbox-btn-group {
        display: contents !important;
    }
    .lightbox-header-actions .lightbox-action-btn,
    .lightbox-header-actions a.lightbox-action-btn,
    .lightbox-header-actions button.lightbox-action-btn {
        flex: 0 0 auto !important;
        height: 30px !important;
        min-height: 30px !important;
        max-height: 30px !important;
        line-height: 28px !important;
        padding: 0 9px !important;
        font-size: 11px !important;
        margin: 0 !important;
    }
    .lightbox-header-actions .lightbox-close-btn {
        margin-left: auto !important;
        height: 30px !important;
        min-height: 30px !important;
        max-height: 30px !important;
        width: 30px !important;
    }
}

/* Unified Discord <-> Web Citizen Pass, Leaderboard Pulse & HUD Chameleon Mood */
.leaderboard-tabs {
    flex-wrap: wrap !important;
    overflow-x: visible !important;
    gap: 6px !important;
    min-height: 0 !important;
}
.lb-tab {
    padding: 6px 12px !important;
    font-size: 11px !important;
    height: 34px !important;
}
@media (min-width: 901px) and (max-width: 1520px) {
    .desktop-nav-segmented {
        gap: 2px !important;
        padding: 2px !important;
    }
    .nav-segment-btn {
        padding: 6px 10px !important;
        font-size: 10.5px !important;
        gap: 5px !important;
    }
    .user-profile-badge {
        gap: 6px !important;
        padding: 3px 8px 3px 5px !important;
    }
}
@media (max-width: 1024px) {
    .citizen-lv-pill {
        display: none !important;
    }
}
.user-citizen-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    background: transparent;
    border: none;
    padding: 0;
    margin: 0;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
}
.user-citizen-trigger:hover .user-name {
    color: #38bdf8;
}
.user-sub-pills {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 2px;
}
.user-sub-pills .drops-badge {
    margin-top: 0;
}
.citizen-lv-pill {
    display: inline-flex;
    align-items: center;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10.5px;
    font-weight: 800;
    color: #2dd4bf;
    background: rgba(45, 212, 191, 0.14);
    border: 1px solid rgba(45, 212, 191, 0.35);
    padding: 2px 7px;
    border-radius: 10px;
}
.lb-pulse-banner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 14px;
    padding: 8px 14px;
    margin-bottom: 10px;
    border-radius: var(--radius-sm, 8px);
    background: rgba(15, 23, 42, 0.75);
    border: 1px solid rgba(56, 189, 248, 0.25);
    font-size: 12px;
    color: #cbd5e1;
}
.lb-pulse-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.lb-pulse-item i {
    color: #38bdf8;
}
.lb-chameleon-dot {
    width: 9px;
    height: 9px;
    border-radius: 999px;
    display: inline-block;
    background: #2dd4bf;
    box-shadow: 0 0 8px #2dd4bf;
}
.hud-chameleon-badge {
    margin-left: auto;
    font-size: 11px;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    color: #2dd4bf;
    background: rgba(45, 212, 191, 0.12);
    border: 1px solid rgba(45, 212, 191, 0.35);
    padding: 2px 9px;
    border-radius: 999px;
    text-transform: none;
    letter-spacing: 0.2px;
}
.citizen-modal-content {
    max-width: 640px;
    width: 94vw;
}
.citizen-profile-body {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding-top: 6px;
}
.citizen-hero-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px;
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.85);
    border: 1px solid rgba(56, 189, 248, 0.3);
}
.citizen-hero-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 2px solid #38bdf8;
    object-fit: cover;
    flex-shrink: 0;
}
.citizen-hero-meta {
    flex: 1;
    min-width: 0;
}
.citizen-hero-name-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}
.citizen-hero-name {
    font-size: 17px;
    font-weight: 800;
    color: #f8fafc;
}
.citizen-rank-pill {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    font-weight: 700;
    color: #38bdf8;
    background: rgba(56, 189, 248, 0.15);
    border: 1px solid rgba(56, 189, 248, 0.35);
    padding: 2px 8px;
    border-radius: 999px;
}
.citizen-hero-handle {
    font-size: 12px;
    color: #94a3b8;
    margin: 4px 0 8px;
}
.citizen-xp-bar {
    height: 7px;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.2);
    overflow: hidden;
}
.citizen-xp-fill {
    height: 100%;
    background: linear-gradient(90deg, #38bdf8, #2dd4bf);
    border-radius: 999px;
}
.citizen-stats-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}
.citizen-stat-card {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 12px;
    border-radius: 10px;
    background: rgba(15, 23, 42, 0.72);
    border: 1px solid rgba(148, 163, 184, 0.18);
}
.citizen-stat-label {
    font-size: 11px;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}
.citizen-stat-label i {
    color: #38bdf8;
    margin-right: 4px;
}
.citizen-stat-val {
    font-size: 15px;
    color: #f8fafc;
}
.citizen-stat-sub {
    font-size: 11px;
    color: #64748b;
}
.citizen-inv-section {
    padding: 12px;
    border-radius: 10px;
    background: rgba(15, 23, 42, 0.72);
    border: 1px solid rgba(148, 163, 184, 0.18);
}
.citizen-section-hdr {
    font-size: 12px;
    font-weight: 700;
    color: #e2e8f0;
    margin-bottom: 8px;
}
.citizen-inv-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.citizen-inv-chip {
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(56, 189, 248, 0.12);
    border: 1px solid rgba(56, 189, 248, 0.3);
    color: #e2e8f0;
    text-transform: capitalize;
}
.citizen-inv-empty {
    font-size: 12px;
    color: #94a3b8;
}
.citizen-pulse-note {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #cbd5e1;
    padding: 8px 12px;
    border-radius: 8px;
    background: rgba(45, 212, 191, 0.08);
    border: 1px solid rgba(45, 212, 191, 0.25);
}
.citizen-actions-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
}

@media (min-width: 901px) {
    .user-citizen-trigger {
        flex: 0 0 auto !important;
        overflow: visible !important;
    }
    .user-profile-badge .user-meta {
        align-items: flex-start !important;
    }
}

@media (max-width: 640px) {
    .roster-categories,
    .category-filters,
    .leaderboard-tabs {
        flex-wrap: wrap !important;
        overflow-x: visible !important;
        gap: 6px !important;
    }
    .citizen-lv-pill {
        display: none !important;
    }
    .citizen-stats-grid {
        grid-template-columns: 1fr !important;
    }
    .user-profile-badge {
        max-width: 175px !important;
        padding: 2px 5px !important;
        gap: 4px !important;
    }
    .user-citizen-trigger {
        justify-content: flex-start !important;
        gap: 4px !important;
    }
    .user-profile-badge .user-meta {
        max-width: 100% !important;
        flex: 1 1 auto !important;
        align-items: flex-start !important;
    }
    .user-profile-badge .user-name,
    .user-profile-badge .drops-badge {
        max-width: 100% !important;
        text-align: left !important;
    }
}
@media (max-width: 460px) {
    .user-profile-badge .user-avatar {
        display: none !important;
    }
    .gallery-toolbar-meta {
        flex: 1 1 100% !important;
        justify-content: stretch !important;
    }
    .gallery-search-wrap {
        max-width: none !important;
    }
    .gallery-sort-group {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 6px !important;
        width: 100% !important;
    }
    .gallery-author-row {
        flex-wrap: wrap !important;
        row-gap: 4px !important;
    }
    .gallery-card-actions {
        flex-wrap: wrap !important;
        gap: 6px !important;
    }
    .gallery-card-left {
        flex-wrap: wrap !important;
        gap: 5px !important;
    }
    .gallery-card-right {
        flex-shrink: 0 !important;
        margin-left: auto !important;
    }
}
