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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: #000;
    color: #fff;
    overflow-x: hidden;
    width: 100%;
}

body.no-scroll {
    overflow: hidden !important;
    height: 100vh;
}

html,
body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    position: relative;
    margin: 0;
    padding: 0;
}

#loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.8s ease;
}

#loading-screen.fade-out {
    opacity: 0;
    pointer-events: none;
}

.glitch-text {
    font-size: 80px;
    font-weight: 900;
    letter-spacing: 10px;
    position: relative;
    animation: glitch 2s infinite;
    cursor: default;
}

@keyframes glitch {

    0%,
    100% {
        opacity: 1;
        text-shadow: 0 0 20px #00ff88, 0 0 40px #00ff88;
    }

    25% {
        opacity: 0.8;
        text-shadow: -2px 0 #ff0088, 2px 0 #00ff88;
        transform: translate(-2px, 0);
    }

    50% {
        opacity: 1;
        text-shadow: 2px 0 #00ff88, -2px 0 #ff0088;
        transform: translate(2px, 0);
    }

    75% {
        opacity: 0.7;
        text-shadow: 0 0 30px #00ff88;
    }
}

.progress-container {
    width: 400px;
    height: 4px;
    background: #111;
    border-radius: 10px;
    overflow: hidden;
    margin-top: 40px;
}

.progress-bar {
    height: 100%;
    background: #00ff88;
    width: 0%;
    transition: width 0.3s ease;
}

#app {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.8s ease;
    min-height: 100vh;
    padding: 60px 20px;
}

#app.visible {
    opacity: 1;
    pointer-events: all;
}

.background-text {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 200px;
    font-weight: 900;
    color: rgba(var(--primary-rgb), 0.07);

    z-index: 0;
    user-select: none;
    pointer-events: none;
}

@media (max-width: 768px) {
    .background-text {
        visibility: hidden;
    }
}

.container {
    max-width: 700px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

.input-group {
    margin-bottom: 10px;
}

label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 13px;
    color: #888;
    font-weight: 500;
}

.api-link-btn {
    color: #00ff88;
    text-decoration: none;
    font-size: 11px;
    border: 1px solid rgba(0, 255, 136, 0.3);
    padding: 4px 10px;
    border-radius: 20px;
    transition: all 0.3s ease;
    background: rgba(0, 255, 136, 0.05);
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.api-link-btn:hover {
    background: rgba(0, 255, 136, 0.15);
    border-color: #00ff88;
    box-shadow: 0 0 10px rgba(0, 255, 136, 0.2);
    transform: translateY(-1px);
}

textarea {
    width: 100%;
    background: #0a0a0a;
    border: 1px solid #222;
    border-radius: 8px;
    padding: 14px;
    color: #fff;
    font-size: 15px;
    transition: all 0.2s ease;
    outline: none;
    min-height: 100px;
    resize: none;
    overflow-y: hidden;
    display: block;
}

textarea:focus {
    border-color: #00ff88;
}

#prompt {
    padding-bottom: 50px;
}

#magic-wand-btn {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(10, 10, 10, 0.8);
    border: 1px solid #333;
    color: #888;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

#magic-wand-btn.disabled {
    opacity: 0.3;
    pointer-events: none;
    filter: grayscale(100%);
    cursor: not-allowed;
    transform: scale(0.9);
    border-color: #222;
}

#magic-wand-btn:hover {
    border-color: #00ff88;
    color: #00ff88;
    background: rgba(0, 255, 136, 0.1);
    transform: translateY(-2px);
    box-shadow: 0 0 10px rgba(0, 255, 136, 0.2);
}

#magic-wand-btn svg {
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow: visible;
    transform: scale(1) rotate(0deg) translateY(0);
}

#magic-wand-btn:hover svg {
    transform: scale(1.15);
    animation: wand-float 2s ease-in-out infinite alternate;
}

#magic-wand-btn svg path:nth-child(1) {
    transform-origin: center;
    transform-box: fill-box;
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    transform: scale(1) rotate(0deg) translate(0, 0);
}

#magic-wand-btn svg path:nth-child(n+2) {
    transform-origin: center;
    transform-box: fill-box;
    opacity: 0.8;
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    transform: scale(1) rotate(0deg) translate(0, 0);
}

#magic-wand-btn:hover svg path:nth-child(2) {
    animation: sparkle-anim 1s ease-in-out infinite alternate;
}
#magic-wand-btn:hover svg path:nth-child(3) {
    animation: sparkle-anim 1.3s ease-in-out infinite alternate-reverse;
}
#magic-wand-btn:hover svg path:nth-child(4) {
    animation: sparkle-anim 1.6s ease-in-out infinite alternate;
}

@keyframes wand-float {
    0% { transform: scale(1.15) rotate(0deg) translateY(0); }
    100% { transform: scale(1.15) rotate(15deg) translateY(-2px); }
}

@keyframes sparkle-anim {
    0% { transform: scale(0.5) rotate(0deg) translate(0, 0); opacity: 0.3; }
    100% { transform: scale(1.5) rotate(90deg) translate(2px, -2px); opacity: 1; fill: rgb(var(--primary-rgb)); }
}

#magic-wand-btn.loading {
    animation: magic-pulse 1.5s infinite;
    pointer-events: none;
    color: #00ff88;
    border-color: #00ff88;
}

@keyframes magic-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(0, 255, 136, 0.4);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(0, 255, 136, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(0, 255, 136, 0);
    }
}

#random-prompt-btn {
    position: absolute;
    bottom: 10px;
    left: 10px;
    background: rgba(10, 10, 10, 0.8);
    border: 1px solid #333;
    color: #888;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

#random-prompt-btn:hover {
    border-color: #00ff88;
    color: #00ff88;
    background: rgba(0, 255, 136, 0.1);
    transform: translateY(-2px);
    box-shadow: 0 0 10px rgba(0, 255, 136, 0.2);
}

#random-prompt-btn svg {
    transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#random-prompt-btn:hover svg {
    transform: rotate(360deg) scale(1.15);
}

#random-prompt-btn.loading {
    animation: magic-pulse 1.5s infinite;
    pointer-events: none;
    color: #00ff88;
    border-color: #00ff88;
}


#moderation-btn,
#editor-moderation-btn {
    position: absolute;
    bottom: 10px;
    right: 50px;
    background: rgba(10, 10, 10, 0.8);
    border: 1px solid #333;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    backdrop-filter: blur(4px);
    z-index: 10;
}

#moderation-btn:hover,
#editor-moderation-btn:hover {
    transform: translateY(-2px);
}

.mod-icon {
    width: 18px;
    height: 18px;
    position: absolute;
    top: 50%;
    left: 50%;
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.5);
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}


#moderation-btn[data-level="high"],
#editor-moderation-btn[data-level="high"] {
    border-color: rgba(0, 255, 136, 0.3);
    color: #00ff88;
}

#moderation-btn[data-level="high"]:hover,
#editor-moderation-btn[data-level="high"]:hover {
    background: rgba(0, 255, 136, 0.1);
    box-shadow: 0 0 10px rgba(0, 255, 136, 0.2);
}

#moderation-btn[data-level="high"] .icon-high,
#editor-moderation-btn[data-level="high"] .icon-high {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

#moderation-btn[data-level="medium"],
#editor-moderation-btn[data-level="medium"] {
    border-color: rgba(255, 170, 0, 0.3);
    color: #ffaa00;
}

#moderation-btn[data-level="medium"]:hover,
#editor-moderation-btn[data-level="medium"]:hover {
    background: rgba(255, 170, 0, 0.1);
    box-shadow: 0 0 10px rgba(255, 170, 0, 0.2);
}

#moderation-btn[data-level="medium"] .icon-medium,
#editor-moderation-btn[data-level="medium"] .icon-medium {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

#moderation-btn[data-level="low"],
#editor-moderation-btn[data-level="low"] {
    border-color: rgba(255, 68, 68, 0.3);
    color: #ff4444;
}

#moderation-btn[data-level="low"]:hover,
#editor-moderation-btn[data-level="low"]:hover {
    background: rgba(255, 68, 68, 0.1);
    box-shadow: 0 0 10px rgba(255, 68, 68, 0.2);
}

#moderation-btn[data-level="low"] .icon-low,
#editor-moderation-btn[data-level="low"] .icon-low {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

#moderation-btn:hover .icon-high,
#editor-moderation-btn:hover .icon-high {
    transform: translate(-50%, -50%) scale(1.15);
    animation: mod-shield-pulse 1.5s ease-in-out infinite alternate;
}

#moderation-btn:hover .icon-medium,
#editor-moderation-btn:hover .icon-medium {
    transform: translate(-50%, -50%) scale(1.15);
    animation: mod-alert-wobble 0.5s cubic-bezier(0.36, 0.07, 0.19, 0.97) infinite both;
}

#moderation-btn:hover .icon-low,
#editor-moderation-btn:hover .icon-low {
    transform: translate(-50%, -50%) scale(1.15);
}

#moderation-btn .icon-low path,
#editor-moderation-btn .icon-low path {
    transform-origin: bottom center;
    transform-box: fill-box;
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    transform: scaleY(1) skewX(0deg);
}

#moderation-btn .icon-medium line,
#editor-moderation-btn .icon-medium line {
    transform-origin: top;
    transform-box: fill-box;
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    transform: translateY(0);
}

#moderation-btn:hover .icon-low path,
#editor-moderation-btn:hover .icon-low path {
    transform-origin: bottom center;
    transform-box: fill-box;
    animation: blazing-flame 0.6s cubic-bezier(0.36, 0.07, 0.19, 0.97) infinite alternate;
}

#moderation-btn:hover .icon-medium line,
#editor-moderation-btn:hover .icon-medium line {
    transform-origin: top;
    transform-box: fill-box;
    animation: mod-line-blink 1s steps(2, start) infinite;
}

@keyframes mod-shield-pulse {
    0% { filter: drop-shadow(0 0 2px rgba(0,255,136,0.3)); transform: translate(-50%, -50%) scale(1.15); }
    100% { filter: drop-shadow(0 0 8px rgba(0,255,136,0.8)); transform: translate(-50%, -50%) scale(1.25); }
}

@keyframes mod-alert-wobble {
    0%, 100% { transform: translate(-50%, -50%) scale(1.15) rotate(0); }
    25% { transform: translate(-50%, -50%) scale(1.15) rotate(-10deg); }
    75% { transform: translate(-50%, -50%) scale(1.15) rotate(10deg); }
}

@keyframes blazing-flame {
    0% { transform: scaleY(1) skewX(-2deg); stroke: #ff4444; fill: rgba(255,68,68,0.2); filter: drop-shadow(0 0 2px rgba(255,68,68,0.4)); }
    33% { transform: scaleY(1.15) skewX(3deg); stroke: #ffaa00; fill: rgba(255,170,0,0.4); filter: drop-shadow(0 -4px 10px rgba(255,170,0,0.8)); }
    66% { transform: scaleY(0.95) skewX(-3deg); stroke: #ff4444; fill: rgba(255,68,68,0.6); filter: drop-shadow(0 -2px 15px rgba(255,68,68,1)); }
    100% { transform: scaleY(1.25) skewX(2deg); stroke: #ffff00; fill: rgba(255,255,0,0.5); filter: drop-shadow(0 -8px 20px rgba(255,170,0,1)); }
}

#moderation-btn[data-level="low"]:hover::before,
#editor-moderation-btn[data-level="low"]:hover::before,
#moderation-btn[data-level="low"]:hover::after,
#editor-moderation-btn[data-level="low"]:hover::after {
    content: '';
    position: absolute;
    width: 3px;
    height: 3px;
    background: #ffaa00;
    border-radius: 50%;
    top: 50%;
    left: 50%;
    pointer-events: none;
    z-index: 20;
}

#moderation-btn[data-level="low"]:hover::before,
#editor-moderation-btn[data-level="low"]:hover::before {
    animation: spark-fly-1 0.7s ease-in infinite;
}

#moderation-btn[data-level="low"]:hover::after,
#editor-moderation-btn[data-level="low"]:hover::after {
    background: #ff4444;
    animation: spark-fly-2 0.9s ease-in infinite 0.3s;
}

@keyframes spark-fly-1 {
    0% { transform: translate(-50%, -10px) scale(1); opacity: 1; box-shadow: 0 0 4px #ffaa00; }
    100% { transform: translate(-15px, -35px) scale(0); opacity: 0; box-shadow: 0 0 10px #ffaa00; }
}

@keyframes spark-fly-2 {
    0% { transform: translate(-50%, -5px) scale(1); opacity: 1; box-shadow: 0 0 4px #ff4444; }
    100% { transform: translate(12px, -30px) scale(0); opacity: 0; box-shadow: 0 0 10px #ff4444; }
}

@keyframes mod-line-blink {
    50% { opacity: 0; transform: translateY(-1px); }
}

#api-key {
    transition: color 0.2s ease-in-out !important;
}

#api-key.text-hidden {
    color: transparent !important;
}

#api-key.decrypt-effect {
    filter: blur(4px);
    letter-spacing: 3px;
    color: #00ff88;
}

#toggle-api-key {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
}

#toggle-api-key:hover {
    color: rgb(var(--primary-rgb));
}

#eye-icon {
    transition: all 0.3s ease;
}

#eye-slash {
    transition: opacity 0.3s ease;
}

#api-key.hacker-active {
    color: var(--primary) !important;
    letter-spacing: 1px;
    text-shadow: 0 0 5px var(--primary);
    transition: none;
}

.model-selector-wrapper {
    max-height: 500px;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px 10px 20px 10px;
    margin: 0px -10px -10px -10px;
}

.model-selector-wrapper::-webkit-scrollbar {
    width: 6px;
}

.model-selector-wrapper::-webkit-scrollbar-track {
    background: transparent;
}

.model-selector-wrapper::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
}

.model-selector-wrapper::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

.model-selector {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 18px;
}

.model-info-icon-wrapper {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 24px;
    height: 24px;
    z-index: 20;
    color: rgba(255, 255, 255, 0.6);
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    cursor: pointer;
}

.model-info-icon-wrapper:hover {
    color: #00ff88;
    background: rgba(0, 255, 136, 0.15);
    border-color: #00ff88;
    transform: scale(1.1);
    box-shadow: 0 0 10px rgba(0, 255, 136, 0.2);
}

@media (max-width: 768px) {
    .model-info-icon-wrapper {
        width: 28px;
        height: 28px;
    }
}

.model-card {
    background: #0a0a0a;
    border: 1px solid #222;
    border-radius: 8px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.6s cubic-bezier(0.165, 0.84, 0.44, 1);
    filter: brightness(1) saturate(1);
    box-shadow: 0 0 0 transparent;
    position: relative;
    overflow: hidden;
    min-height: 140px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
    user-select: none !important;
}

.model-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-size: cover;
    background-position: center;
    background-image: var(--bg-image);
    opacity: 0.8;
    transition: opacity 0.4s cubic-bezier(0.165, 0.84, 0.44, 1), transform 0.6s cubic-bezier(0.165, 0.84, 0.44, 1);
    z-index: 0;
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
    user-select: none !important;
}

.model-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to bottom, rgba(10, 10, 10, 0.7), rgba(10, 10, 10, 0.95));
    z-index: 1;
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
    user-select: none !important;
}

.model-card:hover {
    border-color: var(--primary) !important;
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5), 0 0 15px rgba(var(--primary-rgb), 0.1);
    z-index: 10;
    filter: saturate(1.1) !important;
}

.model-card:hover .model-name {
    color: #fff;
    text-shadow: 0 0 12px rgba(var(--primary-rgb), 0.5);
}

.model-card:hover::before {
    opacity: 1;
    transform: scale(1.12);
}

.model-card.active {
    border-color: var(--primary);
    background: rgba(var(--primary-rgb), 0.05);
    transform: scale(1.06);
    filter: saturate(1.1) brightness(2) !important;
    box-shadow: 0 0 20px rgba(var(--primary-rgb), 0.4), inset 0 0 10px rgba(var(--primary-rgb), 0.1);
    animation: active-card-glow-pulse 2s ease-in-out infinite alternate;
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
    user-select: none !important;
    will-change: filter, transform, box-shadow, border-color;
}

.model-card.active .flag-item.bg-exclusive {
    filter: brightness(0.5) saturate(0.91) !important;
}

.model-card.active .flag-item.bg-exclusive::before,
.model-card.active .flag-item.bg-exclusive::after {
    filter: brightness(0.75) !important;
}

@keyframes active-card-glow-pulse {
    0% {
        box-shadow: 0 0 15px rgba(var(--primary-rgb), 0.3), inset 0 0 8px rgba(var(--primary-rgb), 0.1);
        border-color: var(--primary);
    }
    100% {
        box-shadow: 0 0 35px rgba(var(--primary-rgb), 0.6), inset 0 0 15px rgba(var(--primary-rgb), 0.2);
        border-color: #fff;
    }
}

.model-card.active::before {
    opacity: 1;
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
    user-select: none !important;
}

.model-name {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 4px;
    position: relative;
    z-index: 2;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    transition: all 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.model-card.active .model-name {
    color: var(--primary);
    text-shadow: 0 0 15px rgba(var(--primary-rgb), 0.8);
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
    user-select: none !important;
}

.flag-item {
    position: absolute;
    bottom: 15px;
    right: 10px;
    z-index: 15;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px 3px 6px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.4px;
    pointer-events: none;
    overflow: hidden;
}

.flag-item::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.18) 50%, transparent 100%);
    background-size: 200% 100%;
    animation: flag-shimmer 2.4s linear infinite;
    border-radius: inherit;
    pointer-events: none;
}

@keyframes flag-shimmer {
    0%   { background-position: -200% center; }
    100% { background-position:  200% center; }
}

.flag-item .flag-text {
    position: relative;
    z-index: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 80px;
}

.flag-item i {
    position: relative;
    z-index: 1;
    font-size: 11px;
}

.flag-icon {
    position: relative;
    z-index: 1;
    width: 10px;
    height: 10px;
    flex-shrink: 0;
    filter: drop-shadow(0 0 3px rgba(var(--primary-rgb), 0.4));
    transform: translateY(2px);
}

.bg-exclusive {
    background: linear-gradient(135deg, var(--primary) 0%, rgba(var(--primary-rgb), 0.8) 60%, rgba(var(--primary-rgb), 0.6) 100%);
    color: #fff;
    border: 1px solid rgba(var(--primary-rgb), 0.4);
    box-shadow: 0 2px 10px rgba(var(--primary-rgb), 0.45), inset 0 1px 0 rgba(255,255,255,0.15);
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

body.performance-mode .flag-item::before {
    animation: none;
}

.model-selector.compact-view .flag-item,
.model-selector.list-view .flag-item {
    display: flex;
}

body.performance-mode .whimsical-flame-effect {
    display: none !important;
}


.plasma-base-glow {
    stroke: var(--dot-filled-3);
    stroke-width: 20px;
    stroke-opacity: 0.07;
    animation: plasma-breathe 3s ease-in-out infinite alternate;
}

@keyframes plasma-breathe {
    0%   { stroke-opacity: 0.04; }
    100% { stroke-opacity: 0.2;  }
}

.plasma-edge {
    stroke-width: 2;
    stroke-linecap: round;
    stroke-dashoffset: 0;
    stroke: var(--primary);
}

.plasma-trail-1 {
    stroke-dasharray: 80 400;
    stroke-opacity: 0.9;
    animation: plasma-cw 2.4s linear infinite;
}

.plasma-trail-2 {
    stroke-dasharray: 40 440;
    stroke-opacity: 0.5;
    animation: plasma-cw 3.6s linear infinite 0.8s;
}

.plasma-trail-3 {
    stroke-dasharray: 20 460;
    stroke-opacity: 0.35;
    animation: plasma-ccw 2s linear infinite 0.4s;
}

.plasma-spark {
    stroke: #fff;
    stroke-width: 1.5;
    stroke-dasharray: 10 470;
    stroke-dashoffset: 0;
    stroke-opacity: 0.85;
    animation: plasma-cw 1.5s linear infinite;
}

@keyframes plasma-cw  { to { stroke-dashoffset: -480; } }
@keyframes plasma-ccw { to { stroke-dashoffset:  480; } }

.plasma-corner {
    fill: var(--primary);
    animation: plasma-corner-pulse 2s ease-in-out infinite alternate;
    filter: drop-shadow(0 0 4px var(--primary));
}

.c-tl { animation-delay: 0s;    }
.c-tr { animation-delay: 0.5s;  opacity: 0.7; }
.c-bl { animation-delay: 1s;    opacity: 0.7; }
.c-br { animation-delay: 1.5s;  }

@keyframes plasma-corner-pulse {
    0%   { r: 2.5; opacity: 0.5; }
    100% { r: 5.5; opacity: 1;   }
}

.model-card.active .plasma-trail-1 { animation-duration: 2.4s; stroke-width: 3; stroke-dasharray: 100 380; }
.model-card.active .plasma-trail-2 { animation-duration: 3s; stroke-dasharray: 55  425; }
.model-card.active .plasma-trail-3 { animation-duration: 1s;   stroke-dasharray: 30  450; }
.model-card.active .plasma-spark   { animation-duration: 0.75s; stroke-width: 2; stroke-dasharray: 16 464; }
.model-card.active .plasma-base-glow { animation-duration: 1.2s; }

.confetti {
    position: fixed;
    width: 8px;
    height: 8px;
    background: #00ff88;
    pointer-events: none;
    z-index: 99999;
    will-change: transform, opacity;
}

@keyframes confetti-burst {
    0% {
        opacity: 1;
        transform: translate(0, 0) rotate(0deg) scale(1);
    }

    100% {
        opacity: 0;
        transform: translate(var(--tx), var(--ty)) rotate(720deg) scale(0);
    }
}

.aspect-ratio-selector {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    padding: 10px;
    margin: -10px;
    width: calc(100% + 20px);
}

@media (max-width: 768px) {

    .aspect-btn:hover,
    .aspect-btn.active {
        transform: scale(1.05);
    }
}

.extras-selector {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 5px;
}

.extra-btn {
    flex: 1;
    min-width: 100px;
    padding: 12px;
    background: #0a0a0a;
    border: 1px solid #222;
    border-radius: 6px;
    color: #888;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.extra-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(var(--primary-rgb), 0.08);
    opacity: 0;
    transition: opacity 0.4s ease;
    z-index: 0;
}

.extra-btn:hover:not(:disabled) {
    border-color: #444;
    color: #fff;
}

.extra-btn:hover:not(:disabled)::before {
    opacity: 1;
}

.extra-btn.active {
    background: rgba(0, 255, 136, 0.05);
    border-color: #00ff88;
    color: #00ff88;
    transform: scale(1.05);
    box-shadow: 0 0 10px rgba(0, 255, 136, 0.1);
}

.extra-btn.active::before {
    opacity: 0.5;
}

.extra-btn.active:hover {
    background: rgba(0, 255, 136, 0.1);
    border-color: #00ff88;
    color: #00ff88;
}

.extra-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    filter: grayscale(100%);
    border-color: #222;
    transform: none !important;
}

.info-icon-wrapper {
    position: absolute;
    top: 4px;
    left: 4px;
    width: 16px;
    height: 16px;
    z-index: 10;
    color: #444;
    transition: color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.info-icon-wrapper:hover {
    color: rgba(var(--primary-rgb), 1);
    background: rgba(255, 255, 255, 0.1);
}

.feature-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    z-index: 30000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    will-change: opacity, backdrop-filter;
}

.feature-modal.active {
    opacity: 1;
    visibility: visible;
}

.feature-info-card {
    background: #111;
    border: 1px solid rgba(var(--primary-rgb), 0.5);
    border-radius: 16px;
    padding: 0;
    width: auto;
    max-width: 90vw;
    display: flex;
    flex-direction: row;
    overflow: hidden;
    align-items: stretch;
    transform: scale(0.95);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
    position: relative;
    will-change: transform;
}

#feat-slider-container {
    display: none;
    width: 350px;
    position: relative;
    border-right: 1px solid #333;
    overflow: hidden;
    flex-shrink: 0;
    user-select: none;
    container-type: inline-size;
}

#feat-slider-img-after {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
    position: relative;
    pointer-events: none;
    transition: transform 0.6s cubic-bezier(0.25, 1, 0.5, 1);
}

#feat-slider-overlay {
    width: 50%;
    height: 100%;
    position: absolute;
    left: 0;
    top: 0;
    overflow: hidden;
    border-right: 2px solid #00ff88;
    z-index: 2;
}

#feat-slider-img-before {
    height: 100%;
    width: 100cqw;
    max-width: none;
    object-fit: cover;
    position: absolute;
    left: 0;
    top: 0;
    pointer-events: none;
    transition: transform 0.6s cubic-bezier(0.25, 1, 0.5, 1);
}

.slider-zoomed #feat-slider-img-after,
.slider-zoomed #feat-slider-img-before {
    transform: scale(1.5) translate(var(--pan-x, 0px), var(--pan-y, 0px));
}

.slider-zoomed-100 #feat-slider-img-after,
.slider-zoomed-100 #feat-slider-img-before {
    transform: scale(2) translate(var(--pan-x, 0px), var(--pan-y, 0px));
}

.slider-zoomed, .slider-zoomed-100 {
    cursor: grab;
}

.slider-zoomed:active, .slider-zoomed-100:active {
    cursor: grabbing;
}

#feat-slider-zoom {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 20;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    width: auto;
    min-width: 32px;
    padding: 0 7px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    backdrop-filter: blur(4px);
}

#feat-slider-zoom:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: var(--primary);
    transform: scale(1.05);
    box-shadow: 0 0 15px rgba(var(--primary-rgb), 0.4);
    color: var(--primary);
}

@keyframes whimsical-infinity-pulse {
    0% { transform: scale(1) rotate(0deg); opacity: 0.8; filter: drop-shadow(0 0 2px var(--primary)); }
    33% { transform: scale(1.15) rotate(5deg); opacity: 1; filter: drop-shadow(0 0 8px var(--primary)); }
    66% { transform: scale(1.1) rotate(-5deg); opacity: 0.9; filter: drop-shadow(0 0 5px var(--primary)); }
    100% { transform: scale(1) rotate(0deg); opacity: 0.8; filter: drop-shadow(0 0 2px var(--primary)); }
}

#feat-slider-zoom:hover .whimsical-zoom-icon {
    animation: whimsical-infinity-pulse 1.2s infinite alternate ease-in-out;
}

#feat-slider-zoom.active {
    background: rgba(var(--primary-rgb), 0.2);
    border-color: var(--primary);
    box-shadow: 0 0 20px rgba(var(--primary-rgb), 0.6) inset;
}
#feat-slider-zoom.active .zoom-plus-h,
#feat-slider-zoom.active .zoom-plus-v {
    opacity: 0;
    transform: scale(0);
    transition: all 0.2s ease;
}

#feat-slider-handle {
    position: absolute;
    right: -15px;
    top: 50%;
    transform: translateY(-50%);
    width: 30px;
    height: 30px;
    background: #00ff88;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    cursor: ew-resize;
    box-shadow: 0 0 10px rgba(0,0,0,0.5);
}

#feat-content-wrapper {
    padding: 24px;
    width: 320px;
    position: relative;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
}

#close-feat-modal {
    position: absolute;
    right: 15px;
    top: 15px;
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    font-size: 24px;
    z-index: 10;
}

#btn-copy-model-id:hover {
    color: var(--primary) !important;
    background: rgba(var(--primary-rgb), 0.1) !important;
}


.feat-goto-model-btn {
    width: 100%;
    padding: 12px;
    background: rgba(var(--primary-rgb), 0.1);
    border: 1px solid rgba(var(--primary-rgb), 0.3);
    color: var(--primary);
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 14px;
}

.feat-goto-model-btn:hover {
    background: var(--primary);
    color: #111;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(var(--primary-rgb), 0.4);
}

@media (max-width: 768px) {
    .feature-info-card {
        flex-direction: column;
        max-width: 95vw;
        max-height: 90vh;
        overflow-y: auto;
    }
    #feat-slider-container {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #333;
        flex-shrink: 0;
    }
    #feat-slider-img-after {
        max-height: 50vh;
    }
    #feat-content-wrapper {
        width: 100%;
        flex-shrink: 0;
    }
}

.feature-modal.active .feature-info-card {
    transform: scale(1);
}

.feat-title {
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    filter: saturate(4.5);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.feat-desc {
    font-size: 13px;
    color: #888;
    filter: drop-shadow(0px 0px 10px);
    line-height: 1.5;
    margin-bottom: 20px;
    border-bottom: 1px solid #222;
    padding-bottom: 15px;
}

.metric-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-size: 13px;
    color: #ccc;
}

.metric-dots {
    display: flex;
    gap: 4px;
}

.rating-icon {
    width: 14px;
    height: 14px;
    fill: #333;
    transition: all 0.3s ease;
}

.rating-icon.filled:nth-child(1) {
    fill: var(--dot-filled-1);
    filter: drop-shadow(0 0 2px var(--dot-filled-1));
}

.rating-icon.filled:nth-child(2) {
    fill: var(--dot-filled-2);
    filter: drop-shadow(0 0 4px var(--dot-filled-2));
}

.rating-icon.filled:nth-child(3) {
    fill: var(--dot-filled-3);
    filter: drop-shadow(0 0 6px var(--dot-filled-3));
}

.rating-icon.filled:nth-child(4) {
    fill: var(--dot-filled-4);
    filter: drop-shadow(0 0 8px var(--dot-filled-4));
}

.rating-icon.filled:nth-child(5) {
    fill: var(--dot-filled-5);
    filter: drop-shadow(0 0 10px var(--dot-filled-5));
}

.aspect-btn {
    flex: 1;
    min-width: 70px;
    padding: 10px;
    background: #0a0a0a;
    border: 1px solid #222;
    border-radius: 6px;
    color: #888;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 13px;
    font-weight: 500;
    position: relative;
    overflow: hidden;
}

.aspect-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(var(--primary-rgb), 0.08);
    opacity: 0;
    transition: opacity 0.4s ease;
    z-index: 0;
}

.aspect-btn:hover {
    border-color: #444;
    color: #fff;
}

.aspect-btn:hover::before {
    opacity: 1;
}

.aspect-btn.active {
    background: rgba(0, 255, 136, 0.05);
    border-color: #00ff88;
    color: #00ff88;
    transform: scale(1.1);
}

.aspect-btn.active::before {
    opacity: 0.5;
}

.generate-btn {
    width: 100%;
    padding: 16px;
    font-size: 15px;
    font-weight: 600;
    background: #0a0a0a;
    border: 1px solid #222;
    border-radius: 8px;
    color: #444;
    cursor: not-allowed;
    transition: all 0.5s ease;
    margin-top: 24px;
    position: relative;
    overflow: hidden;
}

.generate-btn.ready {
    background: rgba(var(--primary-rgb), 0.05) !important;
    border-color: var(--primary) !important;
    color: var(--primary) !important;
    box-shadow: 0 0 10px rgba(var(--primary-rgb), 0.1);
}

.glitch-text.gradient-active {
    background: var(--theme-bg);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: none !important;
    filter: drop-shadow(0 0 10px rgba(var(--primary-rgb), 0.5));
}

.model-card.active,
.aspect-btn.active,
.extra-btn.active {
    border-color: var(--primary) !important;
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
    user-select: none !important;
}

.generate-btn.generating {
    animation: pulse 2s ease-in-out infinite;
    cursor: wait;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 10px var(--pulse0) !important;
    }

    50% {
        box-shadow: 0 0 50px var(--pulse50) !important;
    }

    100% {
        box-shadow: 0 0 10px var(--pulse100) !important;
    }
}

.generate-btn.ready::before {
    content: '';
    position: absolute;
    top: -1px;
    left: -100%;
    width: 100%;
    height: calc(100% + 2px);
    background: linear-gradient(90deg, transparent, rgba(var(--primary-rgb), 0.1), transparent);
}

.generate-btn.ready:hover {
    scale: 1.03;
    box-shadow: 0 0 20px rgba(var(--primary-rgb), 0.5);
}


@keyframes outline-move {
    to {
        left: 100%;
    }
}

.generate-btn.ready:active {
    transform: scale(0.98);
}

.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #0a0a0a;
    border: 1px solid #00ff88;
    border-radius: 8px;
    padding: 12px 18px;
    color: #fff;
    z-index: 50000 !important;
    animation: slideIn 0.4s ease;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 0px 30px rgba(var(--primary-rgb), 0.5);
    max-width: 350px;
    backdrop-filter: blur(10px);
}

.notification-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(0, 255, 136, 0.2);
    border-top-color: rgba(var(--primary-rgb), 1);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    flex-shrink: 0;
}

.notification-thumb {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    object-fit: cover;
    border: 1px solid rgba(0, 255, 136, 0.5);
    background: #222;
    cursor: pointer;
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.notification-thumb:hover {
    transform: scale(1.1);
    border-color: #fff;
}

.notification.clickable {
    cursor: pointer;
}

.notification.clickable:hover {
    background: #111;
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.gallery-btn {
    position: fixed;
    bottom: 1%;
    left: 50%;
    backdrop-filter: blur(2px);
    transform: translateX(-50%);
    padding: 12px 32px;
    background: #0a0a0a;
    border: 1px solid #222;
    border-radius: 30px;
    color: rgba(var(--primary-rgb), 1);
    font-size: 14px;
    font-weight: 600;
    width: 80%;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 100;
}

.gallery-btn:hover {
    border-color: #00ff88;
    color: #00ff88;
}

.gallery-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0);
    z-index: 10000;
    visibility: hidden;
    opacity: 0;
    transition: all 0.4s ease;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.gallery-modal.active {
    visibility: visible;
    opacity: 1;
    background: rgba(0, 0, 0, 0.7);
}

.gallery-content {
    width: 100%;
    max-width: 1000px;
    height: 85vh;
    background: rgba(20, 20, 20, 0.95);
    border-radius: 40px 40px 0 0;
    padding: 20px 30px;
    transform: translateY(100%);
    transition: transform 0.5s cubic-bezier(0.19, 1, 0.22, 1);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    will-change: transform;
}

.gallery-modal.active .gallery-content {
    transform: translateY(0);
}

.modal-handle {
    width: 100%;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    cursor: grab;
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
    position: relative;
    background: transparent;
}

.modal-handle::before {
    content: '';
    width: 80px;
    height: 9px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
}

.modal-handle:active {
    cursor: grabbing;
}

.gallery-content.dragging {
    transition: none !important;
}

.gallery-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-shrink: 0;
}

.gallery-title {
    font-size: 28px;
    font-weight: 700;
    color: #00ff88;
    cursor: default;
}

.close-btn {
    font-size: 32px;
    color: #888;
    cursor: pointer;
    border: none;
    background: none;
    transition: all 0.2s ease;
}

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

.gallery-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-shrink: 0;
    flex-wrap: wrap;
}

.search-container {
    flex: 1;
    min-width: 200px;
    position: relative;
}

.search-input {
    width: 100%;
    background: #111;
    border: 1px solid #333;
    padding: 10px 15px 10px 40px;
    border-radius: 12px;
    color: #fff;
    font-size: 14px;
    outline: none;
    transition: all 0.2s ease;
}

.search-input:focus {
    border-color: #00ff88;
    box-shadow: 0 0 10px rgba(0, 255, 136, 0.1);
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #666;
    pointer-events: none;
}

.control-btn {
    background: #111;
    border: 1px solid #333;
    color: #ccc;
    padding: 10px 15px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.control-btn:hover,
.control-btn.active {
    border-color: #00ff88;
    color: #00ff88;
    background: rgba(0, 255, 136, 0.05);
}

.filter-panel {
    background: #0f0f0f;
    border: 1px solid #222;
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 20px;
    display: none;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
    animation: slideDown 0.3s ease;
}

.filter-panel.active {
    display: grid;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.filter-label {
    font-size: 12px;
    color: #888;
    font-weight: 600;
    text-transform: uppercase;
}

.filter-select,
.filter-date {
    background: #1a1a1a;
    border: 1px solid #333;
    color: #fff;
    padding: 10px;
    border-radius: 8px;
    font-size: 13px;
    outline: none;
    width: 100%;
}

.filter-select:focus,
.filter-date:focus {
    border-color: rgb(var(--primary-rgb));
}

::-webkit-calendar-picker-indicator {
    filter: invert(1);
    opacity: 0.5;
    cursor: pointer;
}

.reset-filters-btn {
    grid-column: 1 / -1;
    background: #1a1a1a;
    border: 1px dashed #444;
    color: #666;
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s ease;
    text-align: center;
}

.reset-filters-btn:hover {
    color: #ff4444;
    border-color: #ff4444;
    background: rgba(255, 68, 68, 0.05);
}

.gf-custom-select {
    position: relative;
    user-select: none;
    width: 100%;
}

.gf-select-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 9px 13px;
    background: rgba(18, 18, 18, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.gf-select-trigger:hover {
    background: rgba(28, 28, 28, 0.98);
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}

.gf-custom-select.open .gf-select-trigger {
    background: rgba(var(--primary-rgb), 0.07);
    border-color: rgb(var(--primary-rgb));
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.15);
}

.gf-select-value {
    font-size: 13px;
    color: #ddd;
    font-weight: 500;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gf-select-icon {
    color: #666;
    flex-shrink: 0;
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1), color 0.2s;
}

.gf-custom-select.open .gf-select-icon {
    transform: rotate(180deg);
    color: rgb(var(--primary-rgb));
}

.gf-select-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: rgba(14, 14, 14, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 5px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-6px) scale(0.98);
    transform-origin: top center;
    transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow:
        0 16px 40px rgba(0, 0, 0, 0.7),
        0 0 0 1px rgba(255, 255, 255, 0.04) inset;
    z-index: 200;
    max-height: 220px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.12) transparent;
}

.gf-select-dropdown::-webkit-scrollbar {
    width: 4px;
}
.gf-select-dropdown::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.15);
    border-radius: 4px;
}

.gf-custom-select.open .gf-select-dropdown {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0) scale(1);
}

.gf-select-option {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 9px 12px;
    font-size: 13px;
    color: #bbb;
    font-weight: 500;
    cursor: pointer;
    border-radius: 8px;
    transition: background 0.14s, color 0.14s;
    white-space: nowrap;
}

.gf-select-option:hover {
    background: rgba(255, 255, 255, 0.07);
    color: #fff;
}

.gf-select-option.active {
    background: rgba(var(--primary-rgb), 0.12);
    color: rgb(var(--primary-rgb));
    font-weight: 600;
}

.gf-ratio-icon {
    display: inline-block;
    border: 1.5px solid currentColor;
    border-radius: 2px;
    opacity: 0.65;
    flex-shrink: 0;
}
.gf-ratio-square    { width: 11px; height: 11px; }
.gf-ratio-portrait  { width: 9px;  height: 12px; }
.gf-ratio-landscape { width: 14px; height: 11px; }
.gf-ratio-mobile    { width: 7px;  height: 13px; border-radius: 2px; }
.gf-ratio-cinematic { width: 16px; height: 9px; }

.gf-select-option:hover .gf-ratio-icon,
.gf-select-option.active .gf-ratio-icon { opacity: 1; }

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    grid-auto-flow: dense;
    gap: 12px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
    padding-bottom: 40px;
    scrollbar-width: thin;
    scrollbar-color: #333 transparent;
    transition: grid-template-columns 0.3s ease;
}

.gallery-grid.layout-1 {
    grid-template-columns: 1fr;
}

.gallery-grid.layout-1 .gallery-item.wide,
.gallery-grid.layout-1 .gallery-item.tall,
.gallery-grid.layout-1 .gallery-item.big {
    grid-column: span 1;
    grid-row: span 1;
}

.gallery-grid.layout-2 {
    grid-template-columns: repeat(2, 1fr);
}

.gallery-grid.layout-2 .gallery-item.wide,
.gallery-grid.layout-2 .gallery-item.big {
    grid-column: span 1;
}

.gallery-grid.layout-2 .gallery-item.tall,
.gallery-grid.layout-2 .gallery-item.big {
    grid-row: span 1;
}

.gallery-grid.layout-4 {
    grid-template-columns: repeat(4, 1fr);
}

.gallery-grid::-webkit-scrollbar {
    width: 6px;
}

.gallery-grid::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

@keyframes galleryPopIn {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }

    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.gallery-item {
    opacity: 0;
    position: relative;
    border-radius: 20px;
    overflow: hidden;
    background: #0a0a0a;
    transition: transform 0.3s ease, border-color 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.05);
    cursor: pointer;
    min-height: 200px;
    contain: layout style paint;
    content-visibility: auto;
    contain-intrinsic-size: auto 200px;
}

.gallery-item.show {
    animation: galleryPopIn 0.35s ease forwards;
}

.gallery-item:hover {
    border-color: rgba(var(--primary-rgb), 0.8);
    z-index: 2;
}

.gallery-item.wide {
    grid-column: span 2;
}

.gallery-item.tall {
    grid-row: span 2;
}

.gallery-item.big {
    grid-column: span 2;
    grid-row: span 2;
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.5s ease;
}

.gallery-item:hover img {
    transform: scale(1.1);
}

.gallery-item-info {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 20px 15px 15px 15px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.95) 0%, rgba(0, 0, 0, 0.6) 60%, transparent 100%);
    color: #fff;
    opacity: 1;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.info-prompt {
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
}

.info-meta {
    font-size: 11px;
    color: #00ff88;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.empty-gallery {
    text-align: center;
    color: #444;
    font-size: 15px;
    padding: 60px;
    grid-column: 1 / -1;
}

#lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10001;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
}

#lightbox.active {
    opacity: 1;
    visibility: visible;
}

.lightbox-delete-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 50, 50, 0.3);
    color: #ff4444;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 10;
}

.lightbox-delete-btn:hover {
    background: rgba(255, 50, 50, 0.2);
    border-color: #ff4444;
    transform: scale(1.05);
    box-shadow: 0 0 15px rgba(255, 0, 0, 0.3);
}

.lightbox-close-btn {
    position: absolute;
    top: 15px;
    left: 15px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    width: 36px;
    height: 36px;
    border-radius: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 20;
}

.lightbox-close-btn:hover {
    background: rgb(0 0 0 / 0.8);
    transform: scale(1.1);
    color: #ffffff;
}

@media (max-width: 768px) {
    .lightbox-close-btn {
        top: 10px !important;
        left: 10px !important;
    }

    .lightbox-fav-btn {
        top: 50px !important;
        left: 10px !important;
    }

    .info-meta {
        font-size: 0.7rem !important;
    }
}

.lightbox-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    transform: scale(0.9);
    background: rgb(30 30 30 / 0.5);
    border-radius: 35px;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    max-height: 90vh;
    overflow-y: auto;
    width: auto;
    min-width: min(360px, 92vw);
    max-width: 95vw;
    scrollbar-width: thin;
}

#lightbox.active .lightbox-content {
    transform: scale(1);
}

.lightbox-image-wrapper {
    position: relative;
    max-height: 75vh;
    width: fit-content;
    margin: 0 auto;
    display: flex;
    justify-content: center;
}

.lightbox-image {
    max-width: 100%;
    max-height: 75vh;
    display: block;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

.lightbox-download-btn {
    position: absolute;
    bottom: 15px;
    right: 15px;
    left: auto;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
    text-decoration: none;
}

.lightbox-share-btn {
    position: absolute !important;
    bottom: 10px !important;
    left: 60px !important;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 30;
    transition: all 0.2s ease;
    margin: 0 !important;
}

.lightbox-share-btn:hover {
    background: #00ff88;
    color: #000;
    border-color: #00ff88;
    transform: scale(1.1);
}

@media (max-width: 768px) {
    .lightbox-share-btn {
        left: auto !important;
        right: 10px !important;
        bottom: 10px !important;
    }
}

#share-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    z-index: 25000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

#share-modal.active {
    opacity: 1;
    visibility: visible;
}

.share-content {
    background: #111;
    border: 1px solid #333;
    border-radius: 20px;
    padding: 30px;
    width: 90%;
    max-width: 400px;
    text-align: center;
    transform: scale(0.9);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
    position: relative;
}

#share-modal.active .share-content {
    transform: scale(1);
}

.share-icon-large {
    width: 60px;
    height: 60px;
    background: rgba(0, 255, 136, 0.1);
    border-radius: 50%;
    color: #00ff88;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px auto;
    border: 1px solid rgba(0, 255, 136, 0.3);
}

.share-input-group {
    display: flex;
    gap: 8px;
    margin-top: 20px;
    background: #0a0a0a;
    padding: 4px;
    border: 1px solid #333;
    border-radius: 10px;
}

.share-url-input {
    background: transparent;
    border: none;
    color: #888;
    padding: 10px;
    width: 100%;
    font-size: 13px;
    outline: none;
    font-family: monospace;
}

.share-copy-btn-inner {
    background: #222;
    color: #fff;
    border: 1px solid #333;
    padding: 8px 15px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.share-copy-btn-inner:hover {
    background: #00ff88;
    color: #000;
    border-color: #00ff88;
}

.share-close-modal {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    font-size: 20px;
}

.share-close-modal:hover {
    color: #fff;
}



.share-view-wrapper {
    height: 0;
    overflow: hidden;
    transition: height 0.3s ease;
}

.share-view-wrapper.open {
    height: 40px;
    margin-top: 15px;
}

.share-view-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: #00ff88;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    cursor: pointer;
    width: fit-content;
    margin: 0 auto;
    padding: 8px 16px;
    border-radius: 20px;
    background: rgba(0, 255, 136, 0.05);
    border: 1px solid transparent;
}

.share-view-btn.visible {
    opacity: 1;
    transform: translateY(0);
}

.share-view-btn:hover {
    background: rgba(0, 255, 136, 0.15);
    border-color: rgba(0, 255, 136, 0.3);
    transform: scale(1.05);
}

.lightbox-copy-btn {
    position: absolute !important;
    bottom: 10px !important;
    left: 10px !important;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 30;
    transition: all 0.2s ease;
    margin: 0 !important;
}

.lightbox-copy-btn:hover {
    background: #00ff88;
    color: #000;
    border-color: #00ff88;
    transform: scale(1.1);
}

@media (max-width: 768px) {
    .lightbox-download-btn {
        position: static !important;
        width: 100% !important;
        margin-top: 15px !important;
        text-align: center;
    }

    .lightbox-visual-area {
        width: 100%;
        text-align: center;
    }

    .lightbox-image {
        max-width: 100%;
        height: auto;
    }
}

.lightbox-download-btn:hover {
    background: #00ff88;
    color: #000;
    border-color: #00ff88;
}

.lightbox-details {
    margin-top: 20px;
    text-align: center;
    color: #ccc;
    width: 100%;
    max-width: 600px;
    padding: 0 16px 20px;
    box-sizing: border-box;
}

.lightbox-prompt {
    font-size: 15px;
    line-height: 1.5;
    margin-bottom: 8px;
    margin-inline: 1%;
    color: #fff;
    font-weight: 500;
    text-align: center;
}

.lightbox-meta {
    font-size: 12px;
    color: #00ff88;
    text-transform: uppercase;
    letter-spacing: 1px;
    line-height: 1.6;
}

.meta-date {
    opacity: 0.7;
    font-size: 0.9em;
    display: block;
    margin-top: 4px;
    color: #fff;
    text-transform: none;
}

.features-container {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 10px;
    margin-bottom: 7px;
}

.feat-badge {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 11px;
    color: #ccc;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s ease;
}

.feat-badge:hover {
    border-color: rgb(var(--primary-rgb));
    color: rgb(var(--primary-rgb));
    background: rgba(var(--primary-rgb), 0.1);
    cursor: default;
}

.lightbox-elements-section {
    display: none;
    margin-top: 12px;
    padding: 10px 14px 12px;
    background: rgba(var(--primary-rgb), 0.05);
    border: 1px solid rgba(var(--primary-rgb), 0.15);
    border-radius: 12px;
    width: 100%;
    box-sizing: border-box;
    text-align: left;
}

.lightbox-elements-section.has-elements {
    display: block;
}

.lightbox-elements-label {
    font-size: 10px;
    font-weight: 700;
    color: rgba(var(--primary-rgb), 0.6);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 8px;
    display: block;
}

.lightbox-elements-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.feat-badge--element {
    background: rgba(var(--primary-rgb), 0.12);
    border-color: rgba(var(--primary-rgb), 0.35);
    color: rgb(var(--primary-rgb));
    font-size: 12px;
    padding: 5px 10px;
    border-radius: 8px;
}

::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: #0a0a0a;
}

::-webkit-scrollbar-thumb {
    background: #222;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #333;
}

.loading-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-top-color: rgba(var(--primary-rgb), 1);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 8px;
    vertical-align: middle;
}

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

.model-skeleton {
    height: 80px;
    background: #0a0a0a;
    border: 1px solid #222;
    border-radius: 8px;
    animation: skeleton-pulse 1.5s ease-in-out infinite;
}

@keyframes skeleton-pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.confirm-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 20000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.confirm-modal.active {
    opacity: 1;
    visibility: visible;
}

.confirm-content {
    background: #111;
    border: 1px solid rgba(var(--primary-rgb), 0.5);
    border-radius: 24px;
    padding: 30px;
    width: 90%;
    max-width: 340px;
    text-align: center;
    transform: scale(0.9) translateY(20px);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6), 0 0 30px rgba(var(--primary-rgb), 0.1);
}

.confirm-modal.active .confirm-content {
    transform: scale(1) translateY(0);
}

.settings-content {
    max-height: 85vh;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.1) transparent;

}

.settings-content::-webkit-scrollbar {
    width: 6px;
}

.settings-content::-webkit-scrollbar-track {
    background: transparent;
    margin-block: 5px;
}

.settings-content::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.15);
    border-radius: 20px;
    transition: background-color 0.3s ease;
}

.settings-content::-webkit-scrollbar-thumb:hover {
    background-color: rgba(0, 0, 0, 0.055);
}

.settings-content .confirm-icon {
    flex-shrink: 0 !important;
    min-height: 60px !important;
    width: 60px !important;
}

@media (max-width: 768px) {
    .settings-content {
        padding: 20px !important;
        width: 90% !important;
        max-height: 80vh;
    }

    .settings-content .setting-group {
        margin-bottom: 15px !important;
    }

    .settings-content h3 {
        margin-bottom: 15px !important;
    }
}

.confirm-icon {
    width: 60px;
    height: 60px;
    background: rgba(255, 68, 68, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px auto;
    color: #ff4444;
}

.confirm-content h3 {
    color: #fff;
    font-size: 20px;
    margin-bottom: 10px;
    font-weight: 700;
}

.confirm-content p {
    color: #888;
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 25px;
}

.confirm-actions {
    display: flex;
    gap: 12px;
}

.confirm-actions button {
    flex: 1;
    padding: 12px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

#btn-cancel {
    background: #1a1a1a;
    color: #fff;
    border-color: #333;
}

#btn-cancel:hover {
    background: #252525;
    border-color: #555;
}

#btn-confirm {
    background: rgba(255, 68, 68, 0.1);
    color: #ff4444;
    border-color: rgba(255, 68, 68, 0.3);
}

#btn-confirm:hover {
    background: #ff4444;
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 68, 68, 0.3);
}

.notification.busy-alert {
    top: 90px;
    border-color: #ffaa00;
    animation: slideIn 0.4s ease;
    z-index: 50001 !important;
}

.notification.busy-alert .notification-spinner {
    border-top-color: #ffaa00;
}

.top-nav {
    position: absolute;
    top: 15px;
    right: auto;
    left: 50%;
    display: flex;
    transform: translateX(-50%);
    gap: 10px;
    width: max-content;
    z-index: 100;
}


.nav-btn {
    background: rgba(10, 10, 10, 0.8);
    border: 1px solid rgba(var(--primary-rgb), 0.5);
    color: #888;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

@keyframes pulse-ready {
    0% {
        box-shadow: 0 0 20px rgba(var(--primary-rgb), 0.4);
    }
    50% {
        box-shadow: 0 0 30px rgba(var(--primary-rgb), 0.6);
    }
    100% {
        box-shadow: 0 0 20px rgba(var(--primary-rgb), 0.4);
    }
}

#generate-btn.ready,
#editor-generate-btn.ready {
    background: rgba(var(--primary-rgb), 0.05) !important;
    border-color: var(--primary) !important;
    color: var(--primary) !important;
    box-shadow: 0 0 10px rgba(var(--primary-rgb), 0.1);
    animation: pulse-ready 2s infinite;
    cursor: pointer;
}
.nav-btn:hover {
    border-color: #00ff88;
    color: #00ff88;
    transform: translateY(-2px);
    box-shadow: 0 0 15px rgba(0, 255, 136, 0.2);
}

.nav-btn svg {
    width: 20px;
    height: 20px;
}

#redirect-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    z-index: 20000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

#redirect-modal.active {
    opacity: 1;
    visibility: visible;
}

.redirect-content {
    background: #111;
    border: 1px solid rgba(var(--primary-rgb), 0.5);
    border-radius: 20px;
    padding: 30px;
    width: 90%;
    max-width: 350px;
    text-align: center;
    transform: scale(0.9);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
}

#btn-close-settings:hover {
    transform: scale(1.05) !important;
    background: #333 !important;
}

#redirect-modal.active .redirect-content {
    transform: scale(1);
}

.redirect-icon {
    width: 60px;
    height: 60px;
    background: rgba(var(--primary-rgb), 0.1);
    border-radius: 50%;
    color: rgba(var(--primary-rgb), 1);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px auto;
    border: 1px solid rgba(var(--primary-rgb), 0.3);
}

.redirect-actions {
    display: flex;
    gap: 10px;
    margin-top: 25px;
}

.redirect-btn {
    flex: 1;
    padding: 12px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
}

.btn-go {
    background: rgba(var(--primary-rgb), 1);
    color: #000;
}

.btn-go:hover {
    box-shadow: 0 0 15px rgba(var(--primary-rgb), 0.3);
    transform: scale(1.05);
}

.btn-stay {
    background: #222;
    color: #fff;
    border: 1px solid #333;
}

.btn-stay:hover {
    background: #333;
}

#gallery-loader {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #0a0a0a;
    z-index: 50;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

#gallery-loader.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loader-text {
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 15px;
    letter-spacing: 1px;
}

.loader-track {
    width: 250px;
    height: 4px;
    background: #222;
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

#gallery-progress-bar {
    height: 100%;
    width: 0%;
    background: rgb(var(--primary-rgb));
    border-radius: 10px;
    transition: width 0.1s linear;
    box-shadow: 0 0 10px rgba(var(--primary-rgb), 0.5);
}

#loader-status {
    color: #666;
    font-size: 12px;
    margin-top: 10px;
    font-family: monospace;
}

.gallery-grid.visible {
    opacity: 1;
}

.gallery-item.placeholder {
    border: 1px solid rgba(var(--primary-rgb), 0.3);
    background: linear-gradient(135deg, #0a0a0a 0%, #111 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    cursor: default;
    box-shadow: 0 0 20px rgba(0, 255, 136, 0.05) inset;
    animation: placeholderPulse 2s infinite ease-in-out;
    opacity: 1 !important;
    transform: scale(1) !important;
}

@keyframes placeholderPulse {
    0% {
        border-color: var(--placeholderPulse-0-border);
        box-shadow: 0 0 10px var(--placeholderPulse-0-box-shadow) inset;
    }

    50% {
        border-color: var(--placeholderPulse-50-border);
        box-shadow: 0 0 30px var(--placeholderPulse-50-box-shadow) inset;
    }

    100% {
        border-color: var(--placeholderPulse-100-border);
        box-shadow: 0 0 10px var(--placeholderPulse-100-box-shadow) inset;
    }
}

.placeholder-loader {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(var(--primary-rgb), 0.1);
    border-top-color: rgba(var(--primary-rgb), 1);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 5;
}

.magic-star {
    position: absolute;
    width: 0;
    height: 0;
    fill: rgb(var(--primary-rgb));
    opacity: 0;
    animation: twinkle 3s infinite ease-in-out;
}

.magic-star:nth-child(1) {
    top: 20%;
    left: 20%;
    animation-delay: 0s;
    width: 10px;
    height: 10px;
}

.magic-star:nth-child(2) {
    top: 70%;
    left: 80%;
    animation-delay: 0.5s;
    width: 8px;
    height: 8px;
}

.magic-star:nth-child(3) {
    top: 40%;
    left: 60%;
    animation-delay: 1.0s;
    width: 6px;
    height: 6px;
}

.magic-star:nth-child(4) {
    top: 80%;
    left: 15%;
    animation-delay: 1.5s;
    width: 12px;
    height: 12px;
}

.magic-star:nth-child(5) {
    top: 10%;
    left: 90%;
    animation-delay: 2.0s;
    width: 7px;
    height: 7px;
}

@keyframes twinkle {
    0% {
        transform: scale(0) rotate(0deg);
        opacity: 0;
    }

    50% {
        transform: scale(1) rotate(180deg);
        opacity: 1;
        text-shadow: 0 0 10px rgb(var(--primary-rgb));
    }

    100% {
        transform: scale(0) rotate(360deg);
        opacity: 0;
    }
}

.placeholder-text {
    position: absolute;
    bottom: 20px;
    font-size: 12px;
    color: rgba(var(--primary-rgb), 1);
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    animation: pulseText 2s infinite;
}

@keyframes pulseText {

    0%,
    100% {
        opacity: 0.5;
    }

    50% {
        opacity: 1;
    }
}


.gallery-item.sensitive img {
    filter: blur(20px) brightness(0.8);
    transform: scale(1.2);
    transition: filter 0.3s ease, transform 0.5s ease;
}

.gallery-item.sensitive-medium img {
    filter: blur(1px) brightness(0.5);
    transform: scale(1.05);
    transition: filter 0.3s ease, transform 0.5s ease;
}

.gallery-item.sensitive::after,
.gallery-item.sensitive-medium::after {
    content: '⚠️';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 32px;
    z-index: 5;
    opacity: 0.7;
    pointer-events: none;
    text-shadow: 0 0 20px rgba(0, 0, 0, 0.8);
}

.feat-badge.mod-high {
    border-color: rgba(0, 255, 136, 0.3);
    color: #00ff88;
    background: rgba(0, 255, 136, 0.05);
}

.feat-badge.mod-medium {
    border-color: rgba(255, 170, 0, 0.3);
    color: #ffaa00;
    background: rgba(255, 170, 0, 0.05);
}

.feat-badge.mod-low {
    border-color: rgba(255, 68, 68, 0.3);
    color: #ff4444;
    background: rgba(255, 68, 68, 0.05);
}


@media (max-width: 768px) {
    .lightbox-image-wrapper {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: flex-start !important;
        height: auto !important;
        max-height: none !important;
        width: 100% !important;
        margin-bottom: 10px;
    }

    .lightbox-image {
        max-height: 55vh !important;
        width: auto !important;
        max-width: 100% !important;
        object-fit: contain;
        border-radius: 12px;
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        user-select: none;
        pointer-events: auto;
    }

    .lightbox-download-btn {
        position: static !important;
        margin-top: 15px !important;
        width: 100% !important;
        text-align: center;
        justify-content: center;
        background: rgb(var(--primary-rgb)) !important;
        color: #000 !important;
        padding: 12px !important;
    }

    .lightbox-delete-btn {
        position: absolute !important;
        top: 10px !important;
        right: 10px !important;
        z-index: 20;
        background: rgba(0, 0, 0, 0.6) !important;
        border-radius: 50%;
        width: 36px !important;
        height: 36px !important;
    }

    .lightbox-content {
        width: 90% !important;
        max-height: 90vh !important;
        padding: 20px !important;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }

    .lightbox-details {
        width: 100%;
        overflow-y: auto;
        max-height: 25vh;
        margin-top: 10px;
        padding-right: 5px;
    }

    .lightbox-prompt {
        font-size: 14px !important;
        line-height: 1.4;
        text-align: center !important;
    }
}

.lightbox-visual-area {
    position: relative;
    display: inline-block;
    width: fit-content;
    height: fit-content;
    line-height: 0;
}

@media (max-width: 768px) {
    .top-nav {
        right: auto;
        left: 50%;
        transform: translateX(-50%);
        top: 15px;
        width: max-content;
    }
}

@media (hover: hover) {
    .model-card:hover {
        transform: scale(1.06);
    }

    .model-card:hover::before {
        opacity: 1;
    }

    .aspect-btn:hover {
        transform: scale(1.1);
    }

    .aspect-btn:hover::before {
        opacity: 1;
    }

    .extra-btn:hover:not(:disabled) {
        transform: scale(1.05);
    }

    .extra-btn:hover:not(:disabled)::before {
        opacity: 1;
    }
}

:root {
    --primary: #00ff88;
    --primary-rgb: 0, 255, 136;
    --theme-bg: #00ff88;
    --dot-filled-1: rgba(224, 224, 224, 0.2);
    --dot-filled-2: rgba(162, 210, 255, 0.4);
    --dot-filled-3: rgba(96, 165, 250, 0.6);
    --dot-filled-4: rgba(59, 130, 246, 0.8);
    --dot-filled-5: rgba(29, 78, 216, 1);
    --placeholderPulse-0-border: #00ff881a;
    --placeholderPulse-0-box-shadow: #00ff880d;
    --placeholderPulse-50-border: #00ff8899;
    --placeholderPulse-50-box-shadow: #00ff8833;
    --placeholderPulse-100-border: #00ff881a;
    --placeholderPulse-100-box-shadow: #00ff880d;
    --pulse0: #00ff8856;
    --pulse50: #00ff8888;
    --pulse100: #00ff8833;
}


.glitch-text {
    text-shadow: 0 0 20px var(--primary), 0 0 40px var(--primary) !important;
}

.progress-bar {
    background: var(--theme-bg) !important;
}

.api-link-btn {
    color: var(--primary) !important;
    border-color: rgba(var(--primary-rgb), 0.3) !important;
    background: rgba(var(--primary-rgb), 0.05) !important;
}

.api-link-btn:hover {
    background: rgba(var(--primary-rgb), 0.15) !important;
    border-color: var(--primary) !important;
    box-shadow: 0 0 10px rgba(var(--primary-rgb), 0.2) !important;
}

textarea:focus,
.search-input:focus,
#api-key:focus {
    border-color: var(--primary) !important;
}

#api-key.decrypt-effect {
    color: var(--primary) !important;
}

.model-info-icon-wrapper:hover {
    color: var(--primary) !important;
    background: rgba(var(--primary-rgb), 0.15) !important;
    border-color: var(--primary) !important;
}

.model-card.active {
    border-color: var(--primary) !important;
    background: 
        linear-gradient(135deg, rgba(255,255,255,0.12) 0%, rgba(255,255,255,0) 50%, rgba(255,255,255,0) 100%),
        linear-gradient(to bottom, rgba(10, 10, 10, 0.4), rgba(10, 10, 10, 0.85));
    animation: active-card-brightness-pulse 1s ease-in-out infinite alternate !important;
    box-shadow: 0 0 25px rgba(var(--primary-rgb), 0.45), inset 0 0 10px rgba(var(--primary-rgb), 0.2) !important;
}

@keyframes active-card-brightness-pulse {
    0% {
        filter: brightness(1.5) saturate(1.1);
    }
    100% {
        filter: brightness(2.6) saturate(1.2);
    }
}

.model-card.active .model-name {
    color: var(--primary) !important;
    text-shadow: 0 0 15px rgba(var(--primary-rgb), 0.8) !important;
}

.aspect-btn.active,
.extra-btn.active {
    background: rgba(var(--primary-rgb), 0.05) !important;
    border-color: var(--primary) !important;
    color: var(--primary) !important;
}

.generate-btn.ready {
    background: rgba(var(--primary-rgb), 0.05) !important;
    border-color: var(--primary) !important;
    color: var(--primary) !important;
    box-shadow: 0 0 10px rgba(var(--primary-rgb), 0.1);
}

.gallery-btn:hover,
.nav-btn:hover {
    border-color: var(--primary) !important;
    color: var(--primary) !important;
}

.gallery-title,
.info-meta,
.lightbox-meta {
    color: var(--primary) !important;
}

#gallery-progress-bar {
    background: var(--primary) !important;
    box-shadow: 0 0 10px rgba(var(--primary-rgb), 0.5) !important;
}

.control-btn:hover,
.control-btn.active {
    border-color: var(--primary) !important;
    color: var(--primary) !important;
    background: rgba(var(--primary-rgb), 0.05) !important;
}

.lightbox-share-btn:hover,
.lightbox-copy-btn:hover {
    background: var(--primary) !important;
    color: #000 !important;
    border-color: var(--primary) !important;
}

.lightbox-download-btn:hover {
    background: var(--primary) !important;
    color: #000 !important;
    border-color: var(--primary) !important;
    scale: 1.05 !important;
}

.share-icon-large {
    color: var(--primary) !important;
    background: rgba(var(--primary-rgb), 0.1) !important;
    border-color: rgba(var(--primary-rgb), 0.3) !important;
}

.share-copy-btn-inner:hover {
    background: var(--primary) !important;
    color: #000 !important;
    border-color: var(--primary) !important;
}

.share-view-btn {
    color: var(--primary) !important;
    background: rgba(var(--primary-rgb), 0.05) !important;
}

.share-view-btn:hover {
    background: rgba(var(--primary-rgb), 0.15) !important;
    border-color: rgba(var(--primary-rgb), 0.3) !important;
}

.theme-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid #333;
    cursor: pointer;
    transition: transform 0.2s, border-color 0.2s;
    background-size: cover;
    flex-shrink: 0;
    aspect-ratio: 1;
}

.theme-btn:hover {
    transform: scale(1.1);
}

.theme-btn.active {
    border-color: #fff;
    box-shadow: 0 0 15px currentColor;
    transform: scale(1.1);
}

#btn-hard-reset:hover {
    background: #ff4444 !important;
    color: #fff !important;
}



.switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #333;
    -webkit-transition: .4s;
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    -webkit-transition: .4s;
    transition: .4s;
    border-radius: 50%;
}

input:checked+.slider {
    background-color: var(--primary);
}

input:focus+.slider {
    box-shadow: 0 0 1px var(--primary);
}

input:checked+.slider:before {
    -webkit-transform: translateX(18px);
    -ms-transform: translateX(18px);
    transform: translateX(18px);
}

body.performance-mode * {
    transition: none !important;
    animation: none !important;
    box-shadow: none !important;
    text-shadow: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

body.performance-mode .notification-spinner,
body.performance-mode .loading-spinner,
body.performance-mode .spinner,
body.performance-mode .img-gen-spinner {
    animation: spin 1s linear infinite !important;
}

body.performance-mode .glitch-text {
    animation: none !important;
    text-shadow: 0 0 5px var(--primary) !important;
}

body.performance-mode .modal-card,
body.performance-mode .confirm-content,
body.performance-mode .gallery-content,
body.performance-mode .lightbox-content {
    background: #111 !important;
    border: 1px solid #333 !important;
}

body.performance-mode .gallery-item {
    opacity: 1 !important;
    transform: none !important;
    filter: none !important;
    animation: none !important;
}

body.performance-mode .placeholder {
    opacity: 1 !important;
}

body.performance-mode .feat-desc {
    filter: none !important;
}

body.performance-mode .confetti {
    display: none !important;
}

body.performance-mode .magic-star {
    display: none !important;
}

body.performance-mode-half * {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    box-shadow: none !important;
}

body.performance-mode-half .glitch-text {
    animation: none !important;
    text-shadow: 0 0 5px var(--primary) !important;
}

body.performance-mode-half .confetti {
    display: none !important;
}

body.performance-mode-half .magic-star {
    display: none !important;
}

input+.slider[data-state="1"] {
    background-color: #ffaa00 !important;
}

input+.slider[data-state="1"]:before {
    -webkit-transform: translateX(9px) !important;
    -ms-transform: translateX(9px) !important;
    transform: translateX(9px) !important;
}

input+.slider[data-state="2"] {
    background-color: var(--primary) !important;
}

input+.slider[data-state="2"]:before {
    -webkit-transform: translateX(18px) !important;
    -ms-transform: translateX(18px) !important;
    transform: translateX(18px) !important;
}

input+.slider[data-state="0"] {
    background-color: #333 !important;
}

input+.slider[data-state="0"]:before {
    -webkit-transform: translateX(0px) !important;
    -ms-transform: translateX(0px) !important;
    transform: translateX(0px) !important;
}

.showcase-mode {
    align-items: center !important;
}

.showcase-content-wrapper {
    width: 80% !important;
    max-width: 1600px !important;
    height: 85vh !important;
    border-radius: 24px !important;
    transform: scale(0.95);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
    background: rgba(15, 15, 15, 0.8) !important;
    border: 1px solid rgba(var(--primary-rgb), 0.3) !important;
}

.showcase-mode.active .showcase-content-wrapper {
    transform: scale(1);
    opacity: 1;
}

#showcase-loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

#showcase-loader.hidden {
    display: none;
}

.gallery-item {
    pointer-events: auto;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

@media (max-width: 768px) {
    .showcase-content-wrapper {
        width: 95% !important;
        height: 90vh !important;
    }

    .search-container[style*="flex: 0 0 200px"] {
        flex: 1 !important;
        min-width: 150px;
    }
}


#img2prompt-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(10, 10, 10, 0.8);
    border: 1px solid #333;
    color: #888;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10;
}

#img2prompt-btn:hover {
    border-color: rgba(var(--primary-rgb), 0.5);
    color: rgb(var(--primary-rgb));
    background: rgba(var(--primary-rgb), 0.1);
    transform: translateY(-2px);
}

#img2prompt-btn svg {
    transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow: visible;
}

#img2prompt-btn:hover svg {
    transform: scale(1.15);
}

#img2prompt-btn svg rect {
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    stroke-dashoffset: 0;
}

#img2prompt-btn svg circle {
    transform-origin: center;
    transform-box: fill-box;
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    transform: scale(1) translateY(0);
}

#img2prompt-btn svg polyline {
    transform-origin: bottom center;
    transform-box: fill-box;
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    transform: scaleY(1) scaleX(1);
}

#img2prompt-btn:hover svg circle {
    animation: sun-rise-bounce 1.5s cubic-bezier(0.68, -0.6, 0.32, 1.6) infinite alternate;
}

#img2prompt-btn:hover svg polyline {
    animation: mountain-breathing 2s ease-in-out infinite alternate;
}

#img2prompt-btn:hover svg rect {
    animation: scan-frame 2s linear infinite;
}

@keyframes sun-rise-bounce {
    0% { transform: scale(1) translateY(0); }
    100% { transform: scale(1.4) translateY(-3px); fill: rgb(var(--primary-rgb)); }
}

@keyframes mountain-breathing {
    0% { transform: scaleY(1); }
    100% { transform: scaleY(1.1) scaleX(1.05); }
}

@keyframes scan-frame {
    0% { stroke-dasharray: 4 12; stroke-dashoffset: 0; }
    100% { stroke-dasharray: 4 12; stroke-dashoffset: -16; }
}

.upload-area {
    border: 2px dashed rgb(var(--primary-rgb));
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #0f0f0f;
    position: relative;
    min-height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.upload-area:hover,
.upload-area.dragover {
    border-color: rgba(var(--primary-rgb), 0.5);
    background: rgba(var(--primary-rgb), 0.05);
}

.upload-area span {
    color: #666;
    font-size: 14px;
    font-weight: 500;
}

#preview-img {
    max-width: 100%;
    max-height: 200px;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
    object-fit: contain;
}

#preview-img.hidden,
#clear-img-btn.hidden {
    display: none;
}

#upload-placeholder.hidden {
    display: none;
}

#clear-img-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 24px;
    height: 24px;
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    border: 1px solid #444;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all 0.2s;
}

#clear-img-btn:hover {
    background: #ff4444;
    border-color: #ff4444;
}

.generate-btn-small {
    background: rgba(var(--primary-rgb), 0.1);
    color: rgb(var(--primary-rgb));
    border: 1px solid rgba(var(--primary-rgb), 0.3);
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.generate-btn-small:hover:not(:disabled) {
    background: rgb(var(--primary-rgb));
    color: #000;
    box-shadow: 0 0 15px rgba(var(--primary-rgb), 0.4);
}

#btn-img2prompt-cancel {
    background: #1a1a1a !important;
    color: #fff !important;
    border: 1px solid #333 !important;
}

#btn-img2prompt-cancel:hover {
    background: #333 !important;
    transform: scale(1.05) !important;
}

.generate-btn-small:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    filter: grayscale(1);
    background: #1a1a1a;
    border-color: #333;
    color: #666;
}

.sparkle-icon {
    transition: transform 0.3s ease;
}

.generate-btn-small:hover .sparkle-icon {
    transform: rotate(15deg) scale(1.2);
}

.generate-btn-small.loading svg {
    animation: spin 1s linear infinite;
}


@media (max-width: 767px) {
    #notification-container {
        top: 20px !important;
        right: auto !important;
        left: 55% !important;
        transform: translateX(-50%) !important;
        width: 90% !important;
        max-width: 400px !important;
        align-items: center !important;
    }

    .notification {
        width: 100% !important;
        max-width: 100% !important;
        justify-content: flex-start !important;
        backdrop-filter: blur(16px) !important;
        -webkit-backdrop-filter: blur(16px) !important;
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8) !important;
    }

    .notification.busy-alert {
        top: 0 !important;
    }

    .progress-container {
        width: 80% !important;
    }

    .glitch-text {
        width: 80% !important;
        font-size: 50px !important;
        text-align: center !important;
    }
}



#prompt-history-btn {
    position: absolute;
    top: 10px;
    right: 50px;
    background: rgba(10, 10, 10, 0.8);
    border: 1px solid #333;
    color: #888;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 15;
}

#prompt-history-btn:hover,
#prompt-history-btn.active {
    border-color: rgba(var(--primary-rgb), 0.5);
    color: rgb(var(--primary-rgb));
    background: rgba(var(--primary-rgb), 0.1);
    transform: translateY(-2px);
}

#prompt-history-btn svg {
    transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#prompt-history-btn:hover svg,
#prompt-history-btn.active svg {
    transform: scale(1.15);
    animation: history-wobble 2s cubic-bezier(0.34, 1.56, 0.64, 1) infinite alternate;
}

#prompt-history-btn svg polyline {
    transform-origin: 12px 12px;
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    transform: rotate(0deg);
}

#prompt-history-btn:hover svg polyline,
#prompt-history-btn.active svg polyline {
    animation: time-travel 1.5s linear infinite;
}

@keyframes time-travel {
    to { transform: rotate(-360deg); }
}

@keyframes history-wobble {
    0% { transform: scale(1.15) rotate(-5deg); }
    100% { transform: scale(1.15) rotate(5deg); }
}

.history-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    max-height: 0;
    background: rgba(12, 12, 12, 0.3);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(var(--primary-rgb), 0.15);
    border-top: none;
    border-radius: 0 0 12px 12px;
    overflow: hidden;
    transition: max-height 0.3s cubic-bezier(0.19, 1, 0.22, 1), opacity 0.3s ease, visibility 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.history-dropdown.open {
    max-height: 170px;
    opacity: 1;
    visibility: visible;
    border-color: rgba(var(--primary-rgb), 0.35);
    overflow-y: auto;
    box-shadow:
        3px 0 15px -3px rgba(var(--primary-rgb), 0.2),
        -3px 0 15px -3px rgba(var(--primary-rgb), 0.2),
        0 8px 20px -3px rgba(var(--primary-rgb), 0.15),
        0 10px 30px rgba(0, 0, 0, 0.5);
}

.history-dropdown::-webkit-scrollbar {
    width: 5px;
}

.history-dropdown::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 3px;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: rgba(15, 15, 15, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-bottom: 1px solid rgba(var(--primary-rgb), 0.1);
    font-size: 11px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 1px;
    position: sticky;
    top: 0;
    z-index: 5;
}

body.performance-mode .history-dropdown {
    background: #0f0f0f;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border-color: #222;
}

body.performance-mode .history-dropdown.open {
    border-color: #333;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

body.performance-mode .history-header {
    background: #111;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border-bottom-color: #222;
}

.clear-history-btn {
    background: none;
    border: none;
    color: #ff4444;
    cursor: pointer;
    font-size: 10px;
    font-weight: 600;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.clear-history-btn:hover {
    opacity: 1;
    text-decoration: underline;
}

.history-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-bottom: 1px solid #1a1a1a;
    transition: background 0.2s;
    gap: 10px;
}

.history-item:hover {
    background: rgba(var(--primary-rgb), 0.05);
}

.history-text {
    font-size: 13px;
    color: #ccc;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
    flex: 1;
}

.history-text:hover {
    color: rgb(var(--primary-rgb));
}

.history-actions {
    display: flex;
    gap: 5px;
}

.history-action-btn {
    background: #222;
    border: 1px solid #333;
    color: #888;
    width: 24px;
    height: 24px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.history-action-btn:hover {
    border-color: rgba(var(--primary-rgb), 0.5);
    color: rgb(var(--primary-rgb));
    background: rgba(var(--primary-rgb), 0.1);
}


.diff-container {
    display: flex;
    align-items: center;
    gap: 15px;
    margin: 20px 0;
    text-align: left;
}

.diff-box {
    flex: 1;
    background: #0a0a0a;
    border: 1px solid #333;
    border-radius: 12px;
    padding: 15px;
    height: 200px;
    display: flex;
    flex-direction: column;
}

#btn-wand-confirm:hover {
    scale: 1.05 !important;
    background: rgba(var(--primary-rgb), 0.1) !important;
    border-color: rgba(var(--primary-rgb), 0.5) !important;
}

#btn-wand-cancel:hover {
    scale: 1.05 !important;
    background: #1a1a1a !important;
}

.diff-box.enhanced {
    border-color: rgba(var(--primary-rgb), 0.5);
    background: rgba(var(--primary-rgb), 0.02);
    box-shadow: 0 0 20px rgba(var(--primary-rgb), 0.4) inset;
}

.diff-box h6 {
    color: #666;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
    font-weight: 700;
}

.diff-box.enhanced h6 {
    color: rgb(var(--primary-rgb));
}

.diff-text {
    font-size: 13px;
    line-height: 1.5;
    color: #ccc;
    overflow-y: auto;
    flex: 1;
    white-space: pre-wrap;
    word-break: break-word;
    scrollbar-width: thin;
}

.diff-arrow {
    color: #444;
    flex-shrink: 0;
}

@media (max-width: 768px) {
    .diff-container {
        flex-direction: column;
    }

    .diff-arrow {
        transform: rotate(90deg);
        margin: 10px 0;
    }

    .diff-box {
        width: 100%;
        height: 150px;
        min-height: 150px;
        flex-shrink: 0;
    }
}

#advanced-panel {
    transition: all 1s cubic-bezier(0.19, 1, 0.22, 1);
    max-height: 500px;
    opacity: 1;
    transform: translateY(0) scale(1);
    overflow: hidden;
    visibility: visible;
    margin-top: 10px;
    margin-bottom: 10px;
    border: 1px solid rgba(var(--primary-rgb), 0.2);
    padding: 15px;
    border-radius: 12px;
    background: rgba(var(--primary-rgb), 0.02);
}

#advanced-panel.hidden {
    display: block !important;
    max-height: 0;
    opacity: 0;
    padding-top: 0;
    padding-bottom: 0;
    margin-top: 0;
    margin-bottom: 0;
    border-width: 0;
    transform: translateY(-20px) scale(0.95);
    visibility: hidden;
    pointer-events: none;
}

.advanced-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.adv-input-wrapper {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.adv-label {
    font-size: 11px;
    color: #888;
}

.adv-input {
    background: #0a0a0a;
    border: 1px solid #333;
    color: #fff;
    padding: 10px;
    border-radius: 8px;
    font-size: 13px;
    outline: none;
    width: 100%;
    transition: border-color 0.2s;
}

.adv-input:focus {
    border-color: rgb(var(--primary-rgb));
}

.extras-selector.disabled-area {
    opacity: 0.3;
    pointer-events: none;
    filter: grayscale(1);
    position: relative;
}

@media (max-width: 600px) {
    .advanced-grid {
        grid-template-columns: 1fr;
    }
}

.section-title-glow {
    color: var(--primary) !important;
    text-shadow: 0 0 15px rgba(var(--primary-rgb), 0.4);
    display: block;
    transition: all 0.3s ease;
}

.adv-info-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #888;
    background: rgba(255, 255, 255, 0.05);
    cursor: pointer;
    transition: all 0.2s ease;
}

.adv-info-icon:hover {
    color: var(--primary);
    border-color: var(--primary);
    background: rgba(var(--primary-rgb), 0.15);
    transform: scale(1.1);
    box-shadow: 0 0 5px rgba(var(--primary-rgb), 0.2);
}

.adv-info-icon svg {
    width: 10px;
    height: 10px;
}

@keyframes busyGlow {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 170, 0, 0.4);
        border-color: #ffaa00;
        background: rgba(255, 170, 0, 0.05);
    }

    50% {
        box-shadow: 0 0 15px 0 rgba(255, 170, 0, 0.6);
        border-color: #ffcc00;
        background: rgba(255, 170, 0, 0.15);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(255, 170, 0, 0);
        border-color: #ffaa00;
        background: rgba(255, 170, 0, 0.05);
    }
}

.notification.busy-state {
    opacity: 1 !important;
    transform: translateX(0) !important;
    animation: busyGlow 2s infinite ease-in-out !important;
    align-items: flex-start !important;
    padding-top: 14px !important;
    padding-bottom: 14px !important;
}

.notification.busy-state .notification-spinner {
    border-top-color: #ffaa00 !important;
    border-color: rgba(255, 170, 0, 0.2);
    margin-top: 2px;
}

.gallery-grid,
.lightbox-content,
.lightbox-details {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
    padding-right: 4px;
}

.gallery-grid::-webkit-scrollbar,
.lightbox-content::-webkit-scrollbar,
.lightbox-details::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.gallery-grid::-webkit-scrollbar-track,
.lightbox-content::-webkit-scrollbar-track,
.lightbox-details::-webkit-scrollbar-track {
    background: transparent;
    margin-block: 4px;
}

.gallery-grid::-webkit-scrollbar-thumb,
.lightbox-content::-webkit-scrollbar-thumb,
.lightbox-details::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    transition: background-color 0.3s ease;
}

.gallery-grid::-webkit-scrollbar-thumb:hover,
.lightbox-content::-webkit-scrollbar-thumb:hover,
.lightbox-details::-webkit-scrollbar-thumb:hover {
    background-color: rgba(255, 255, 255, 0.4);
}

.autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: #0a0a0a;
    border: 1px solid #333;
    border-top: none;
    border-radius: 0 0 8px 8px;
    z-index: 1000;
    max-height: 250px;
    overflow-y: auto;
    display: none;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8);
}

.autocomplete-dropdown.active {
    display: block;
    border-color: rgb(var(--primary-rgb));
}

.suggestion-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    cursor: pointer;
    border-bottom: 1px solid #1a1a1a;
    font-size: 14px;
    font-weight: 600;
    color: #ccc;
    transition: all 0.2s ease;
}

.suggestion-item:hover,
.suggestion-item.selected {
    background: rgba(var(--primary-rgb), 0.05);
    color: rgb(var(--primary-rgb));
    border-left: 3px solid rgb(var(--primary-rgb));
    padding-left: 12px;
}

.suggestion-item .tag-badge {
    font-size: 9px;
    background: #222;
    color: #666;
    padding: 3px 6px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 700;
    margin-left: 10px;
    flex-shrink: 0;
    min-width: 50px;
    text-align: center;
    border: 1px solid #333;
}

.suggestion-item:hover .tag-badge,
.suggestion-item.selected .tag-badge {
    color: rgb(var(--primary-rgb));
    background: rgba(var(--primary-rgb), 0.2);
    border-color: rgb(var(--primary-rgb));
}

.compact-settings-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    width: 100%;
    margin: 0 auto;
    box-sizing: border-box;
}

.compact-setting-item {
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 12px;
    padding: 15px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    transition: all 0.2s ease;
    width: 100%;
}

.compact-setting-item:hover {
    border-color: #555;
    background: #222;
}

.compact-setting-item>label:first-child {
    font-size: 13px;
    font-weight: 600;
    color: #eee;
    margin-bottom: 8px;
    cursor: pointer;
    width: 100%;
    text-align: center;
    display: block;
}

.switch.small {
    transform: scale(0.9);
}

@media (max-width: 400px) {
    .compact-settings-grid {
        grid-template-columns: 1fr;
    }

    .compact-setting-item {
        flex-direction: row;
        justify-content: space-between;
        padding: 15px;
    }
}

#prompt::placeholder {
    color: rgba(var(--primary-rgb), 0.6);
    opacity: 1;
    transition: color 0.3s ease;
}

#api-key::placeholder {
    color: rgba(var(--primary-rgb), 0.6);
    opacity: 1;
    transition: color 0.3s ease;
}

#lang-text {
    pointer-events: none;
    letter-spacing: 1px;
}

.char-counter {
    position: absolute;
    bottom: 12px;
    backdrop-filter: blur(9px);
    box-shadow: 0px 0px 10px var(--dot-filled-3);
    right: 95px;
    font-size: 11px;
    color: rgb(255 255 255 / 99%);
    pointer-events: none;
    font-family: monospace;
    z-index: 10;
    background: rgb(0 0 0 / 65%);
    padding: 2px 6px;
    border-radius: 20px;
    transition: color 0.3s ease;
}

#editor-char-count {
    right: 15px;
    bottom: 12px;
}

#editor-prompt {
    padding-right: 80px;
}

.char-counter.limit-near {
    color: #ffaa00;
    opacity: 0.9;
}

.char-counter.limit-reached {
    color: #ff4444;
    opacity: 1;
    font-weight: bold;
}

.tiny-action-btn {
    background: rgba(var(--primary-rgb), 0.1);
    border: 1px solid rgba(var(--primary-rgb), 0.3);
    color: var(--primary);
    padding: 2px 8px;
    font-size: 10px;
    font-weight: 700;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 4px;
    height: 20px;
    white-space: nowrap;
    flex-shrink: 0;
}

.tiny-action-btn:hover {
    background: var(--primary);
    color: #000;
    box-shadow: 0 0 10px rgba(var(--primary-rgb), 0.4);
    transform: translateY(-1px);
}

.tiny-action-btn.loading svg {
    animation: spin 1s linear infinite;
}

@keyframes fadeInUpModel {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.model-card.animate-in {
    animation: fadeInUpModel 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
}

.model-header-wrapper {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    width: 100%;
}

.model-header-wrapper label {
    font-size: 13px;
    color: #888;
    font-weight: 500;
    cursor: default;
    margin-bottom: 0 !important;
}

@keyframes activeGlow {
    0% {
        box-shadow: 0 0 5px rgba(var(--primary-rgb), 0.5);
    }

    50% {
        box-shadow: 0 0 15px rgba(var(--primary-rgb), 0.8), 0 0 5px var(--primary);
    }

    100% {
        box-shadow: 0 0 5px rgba(var(--primary-rgb), 0.5);
    }
}

.tiny-action-btn.active {
    background: var(--primary);
    color: #000;
    border-color: var(--primary);
    animation: activeGlow 1.5s ease-in-out infinite;
}

.model-filter-container {
    display: flex;
    gap: 6px;
    margin-left: 12px;
    opacity: 0;
    visibility: hidden;
    transform: translateX(-10px);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    content-visibility: hidden;
}

.model-filter-container.visible {
    opacity: 1;
    visibility: visible;
    content-visibility: visible;
    transform: translateX(0);
}

.filter-chip {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #888;
    padding: 2px 10px;
    font-size: 10px;
    font-weight: 600;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-chip:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.3);
}

.filter-chip.active {
    background: rgba(var(--primary-rgb), 0.15);
    color: var(--primary);
    border-color: var(--primary);
    box-shadow: 0 0 8px rgba(var(--primary-rgb), 0.2);
}

.model-layout-toggle-btn {
    margin-left: auto;
    flex-shrink: 0;
}

.model-layout-toggle-btn svg {
    transition: transform 0.3s ease;
}

.model-layout-toggle-btn:hover svg {
    transform: rotate(90deg);
}

.model-selector.compact-view {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
}

.model-selector.compact-view .model-card {
    min-height: unset;
    aspect-ratio: 1;
    padding: 10px;
    border-radius: 10px;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.model-selector.compact-view .model-card::after {
    background: linear-gradient(to bottom, rgba(10, 10, 10, 0.5), rgba(10, 10, 10, 0.9));
}

.model-selector.compact-view .model-card .model-name {
    font-size: 11px;
    margin-bottom: 0;
    line-height: 1.3;
    word-break: break-word;
    text-align: center;
}

.model-selector.compact-view .model-card .model-info-icon-wrapper {
    top: 4px;
    right: 4px;
    width: 20px;
    height: 20px;
}

.model-selector.compact-view .model-card .flag-item {
    position: absolute;
    bottom: 6px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 5;
    padding: 2px 5px;
    font-size: 8px;
    white-space: nowrap;
    border-radius: 4px;
    gap: 2px;
    overflow: visible !important;
    width: max-content !important;
}

.model-selector.compact-view .model-card .flag-item .flag-text {
    max-width: none !important;
    flex-shrink: 0 !important;
}

.model-selector.compact-view .model-card.active {
    transform: scale(1.08);
}

.model-selector.compact-view .model-card:hover {
    transform: scale(1.05);
}

.model-selector.compact-view .model-card.active:hover {
    transform: scale(1.08);
}

.model-selector.list-view {
    grid-template-columns: 1fr;
    gap: 8px;
}

.model-selector.list-view .model-card {
    min-height: 56px;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    padding: 10px 16px;
    border-radius: 10px;
}

.model-selector.list-view .model-card::after {
    background: linear-gradient(to right, rgba(10, 10, 10, 0.6), rgba(10, 10, 10, 0.95) 40%);
}

.model-selector.list-view .model-card .model-name {
    font-size: 13px;
    margin-bottom: 0;
    margin-left: auto;
}

.model-selector.list-view .model-card .model-info-icon-wrapper {
    position: relative;
    top: auto;
    right: auto;
    left: auto;
    margin-left: 0;
    margin-right: 0;
    flex-shrink: 0;
    order: -1;
}

.model-selector.list-view .model-card .flag-item {
    position: relative;
    top: auto;
    right: auto;
    left: auto;
    transform: none;
    margin-left: 8px;
    margin-right: 8px;
    flex-shrink: 0;
    z-index: 5;
    padding: 2px 8px;
    font-size: 10px;
    border-radius: 4px;
    transform: translateY(15px);
}

.model-selector.list-view .model-card.active {
    transform: scale(1.02);
}

.model-selector.list-view .model-card:hover {
    transform: translateX(4px);
}

.model-selector.list-view .model-card.active:hover {
    transform: scale(1.02) translateX(4px);
}

@media (max-width: 600px) {
    .model-header-wrapper {
        flex-wrap: wrap;
    }

    .model-header-wrapper label {
        order: 1;
    }

    .model-header-wrapper .tiny-action-btn {
        order: 2;
    }

    .model-layout-toggle-btn {
        margin-left: auto;
        order: 2;
    }

    .model-filter-container {
        width: 100%;
        margin-left: 0;
        margin-top: 8px;
        overflow-x: auto;
        padding-bottom: 4px;
        content-visibility: hidden;
        order: 10;
    }

    .model-selector-wrapper {
        padding: 0px 10px 20px 10px;
        max-height: 350px;
    }

    .model-selector.compact-view {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
        gap: 8px;
    }
}

.model-card.animate-filter-in {
    animation: filterIn 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
}

@keyframes filterIn {
    0% {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }

    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

body.performance-mode .model-card,
body.performance-mode .model-card.animate-in,
body.performance-mode .model-card.animate-filter-in {
    opacity: 1 !important;
    transform: none !important;
    animation: none !important;
    transition: none !important;
}

body.performance-mode .model-filter-container {
    transition: none !important;
    transform: none !important;
}

.lightbox-fav-btn {
    position: absolute;
    top: 60px;
    left: 15px;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 10;
}

.lightbox-fav-btn:hover {
    background: rgb(var(--primary-rgb));
    border-color: var(--primary);
    transform: scale(1.1);
    box-shadow: 0px 0px 30px var(--dot-filled-4);
}

.lightbox-fav-btn.active svg {
    fill: #ff4444;
    stroke: #ff4444;
}

.gallery-item.is-favorite::before {
    content: '♥';
    position: absolute;
    top: 10px;
    left: 10px;
    color: #ff4444;
    font-size: 18px;
    text-shadow: 0 0px 20px rgb(255 0 0);
    z-index: 2;
}

.gallery-item .multi-select-check {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.5);
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    z-index: 5;
    display: none;
    align-items: center;
    justify-content: center;
    transition: all 0.25s cubic-bezier(0.19, 1, 0.22, 1);
    pointer-events: none;
}

.gallery-item .multi-select-check svg {
    width: 14px;
    height: 14px;
    opacity: 0;
    transform: scale(0.5);
    transition: all 0.25s cubic-bezier(0.19, 1, 0.22, 1);
}

.multi-select-active .gallery-item .multi-select-check {
    display: flex;
}

.multi-select-active .gallery-item.ms-selected .multi-select-check {
    border-color: rgba(var(--primary-rgb), 1);
    background: rgba(var(--primary-rgb), 0.9);
    box-shadow: 0 0 12px rgba(var(--primary-rgb), 0.5);
}

.multi-select-active .gallery-item.ms-selected .multi-select-check svg {
    opacity: 1;
    transform: scale(1);
}

.multi-select-active .gallery-item {
    transition: transform 0.2s ease, border-color 0.2s ease, opacity 0.2s ease;
}

.multi-select-active .gallery-item.ms-selected {
    border-color: rgba(var(--primary-rgb), 0.7);
    box-shadow: 0 0 15px rgba(var(--primary-rgb), 0.2);
}

.multi-select-active .gallery-item:not(.ms-selected) {
    opacity: 0.6;
}

.multi-select-active .gallery-item:not(.ms-selected):hover {
    opacity: 0.85;
}

.multi-select-active .gallery-item .gallery-copy-btn {
    display: none !important;
}

.multi-select-active .gallery-item .gallery-item-info {
    display: none;
}

.gallery-controls.ms-hidden {
    display: none !important;
}

.multi-select-bar {
    display: none;
    gap: 10px;
    margin-bottom: 20px;
    flex-shrink: 0;
    align-items: center;
    animation: slideDown 0.3s ease;
}

.multi-select-bar.active {
    display: flex;
}

.ms-count {
    font-size: 14px;
    font-weight: 600;
    color: rgba(var(--primary-rgb), 1);
    margin-right: auto;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 6px;
}

.ms-count svg {
    width: 18px;
    height: 18px;
    opacity: 0.8;
}

.ms-btn {
    padding: 10px 20px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
    border: 1px solid;
    white-space: nowrap;
}

.ms-btn-delete {
    background: rgba(255, 68, 68, 0.1);
    color: #ff4444;
    border-color: rgba(255, 68, 68, 0.3);
}

.ms-btn-delete:hover {
    background: rgba(255, 68, 68, 0.2);
    border-color: #ff4444;
    box-shadow: 0 0 15px rgba(255, 68, 68, 0.2);
}

.ms-btn-delete:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.ms-btn-cancel {
    background: #111;
    color: #ccc;
    border-color: #333;
}

.ms-btn-cancel:hover {
    border-color: #555;
    color: #fff;
    background: #1a1a1a;
}

@keyframes msWiggle {
    0%, 100% { transform: rotate(0deg); }
    20% { transform: rotate(-1.5deg); }
    40% { transform: rotate(1.5deg); }
    60% { transform: rotate(-1deg); }
    80% { transform: rotate(1deg); }
}

.gallery-item.ms-wiggle {
    animation: msWiggle 0.4s ease;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    z-index: 99999;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: all;
    visibility: visible;
    z-index: 20001;
}

.modal-box {
    background: #1a1a1a;
    border: 1px solid #333;
    padding: 25px;
    border-radius: 12px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.modal-overlay.active .modal-box {
    transform: translateY(0);
}

.modal-box h3 {
    margin-bottom: 10px;
    font-size: 1.2rem;
    color: #fff;
}

.checkbox-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 20px 0;
    background: #252525;
    padding: 15px;
    border-radius: 8px;
}

.custom-checkbox {
    display: flex;
    align-items: center;
    position: relative;
    padding-left: 35px;
    cursor: pointer;
    user-select: none;
    color: #ddd;
}

.custom-checkbox input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
    appearance: none;
    -webkit-appearance: none;

}

.checkmark {
    position: absolute;
    left: 0;
    height: 20px;
    width: 20px;
    background-color: #333;
    border-radius: 4px;
    transition: all 0.2s;
}

.custom-checkbox:hover input~.checkmark {
    background-color: #444;
    box-shadow: 0px 0px 20px var(--dot-filled-2);
}

.custom-checkbox input:checked~.checkmark {
    background-color: rgb(var(--primary-rgb));
    box-shadow: 0px 0px 30px var(--dot-filled-4);
}

.checkmark:after {
    content: "";
    position: absolute;
    display: none;
}

.custom-checkbox input:checked~.checkmark:after {
    display: block;
}

.custom-checkbox .checkmark:after {
    left: 7px;
    top: 3px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.modal-actions {
    display: flex;
    justify-content: space-evenly;
    gap: 10px;
    margin-top: 20px;
}

.modal-btn {
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    border: none;
    font-weight: 500;
    transition: all 0.2s;
}

.modal-btn.cancel {
    background: transparent;
    color: #aaa;
    border: 1px solid #444;
}

.modal-btn.cancel:hover {
    background: #333;
    color: #fff;
}

.modal-btn.confirm {
    background: rgba(var(--primary-rgb), 0.3);
    color: white;
}

.modal-btn.confirm:hover {
    background: rgba(var(--primary-rgb), 0.5);
    color: white;
    box-shadow: 0 0 15px rgba(var(--primary-rgb), 0.4);
    transform: scale(1.05);
    transition: all 0.2s;
}

.custom-checkbox span[id^="lbl-chk"] {
    margin-top: 2px;
    font-size: 0.95rem;
    line-height: 1.2;
    display: inline-block;
}

.checkbox-container {
    gap: 15px !important;
    padding: 15px 20px !important;
}

#btn-import-data,
#btn-export-data {
    transition: all 0.2s ease-in-out !important;
}

#btn-import-data:hover {
    transform: scale(1.05) !important;
    background: rgba(var(--primary-rgb), 0.1) !important;
    border-color: rgba(var(--primary-rgb), 0.5) !important;
    box-shadow: 0 0 15px rgba(var(--primary-rgb), 0.4) !important;
}

#btn-export-data:hover {
    transform: scale(1.05) !important;
    background: rgba(var(--primary-rgb), 0.1) !important;
    border-color: rgba(var(--primary-rgb), 0.5) !important;
    box-shadow: 0 0 15px rgba(var(--primary-rgb), 0.4) !important;
}

.slider:hover {
    box-shadow: 0 0 15px rgba(var(--primary-rgb), 0.6) !important;
}

.app-switch-content {
    max-width: 500px !important;
    width: 95% !important;
}

.app-grid-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 10px;
}

.app-card {
    background: #0a0a0a;
    border: 1px solid #333;
    border-radius: 16px;
    padding: 25px 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    border: 2px solid transparent;
}

.app-card-icon {
    width: 60px;
    height: 60px;
    background: #151515;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 15px;
    color: #666;
    border: 1px solid #222;
    transition: all 0.3s ease;
}

.app-card-title {
    font-size: 15px;
    font-weight: 600;
    color: #ccc;
    margin-bottom: 5px;
}

.app-status {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #444;
}

.app-card:hover {
    border-color: #555;
    background: #111;
    transform: translateY(-5px);
}

.app-card:hover .app-card-icon {
    color: #fff;
    border-color: #555;
}

.app-card.active {
    border-color: var(--primary);
    background: rgba(var(--primary-rgb), 0.1);
    box-shadow: 0 0 20px rgba(var(--primary-rgb), 0.15);
    cursor: default;
}

.app-card.active .app-card-icon {
    background: var(--primary);
    color: #000;
    border-color: var(--primary);
    box-shadow: 0 0 10px rgba(var(--primary-rgb), 0.5);
}

.app-card.active .app-card-title {
    color: var(--primary);
}

.app-card.active .app-status {
    color: var(--primary);
    font-weight: 700;
}

@keyframes appCardPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(var(--primary-rgb), 0.1);
        border-color: rgba(var(--primary-rgb), 0.4);
    }

    50% {
        box-shadow: 0 0 25px 5px rgba(var(--primary-rgb), 0.2);
        border-color: rgba(var(--primary-rgb), 1);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(var(--primary-rgb), 0.1);
        border-color: rgba(var(--primary-rgb), 0.4);
    }
}

@media (max-width: 500px) {
    .app-grid-container {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .app-switch-content {
        max-width: 92% !important;
        width: 92% !important;
        padding: 20px !important;
        max-height: 85vh;
        overflow-y: auto;
    }

    .app-switch-content .confirm-icon {
        width: 45px;
        height: 45px;
        margin-bottom: 12px;
    }

    .app-switch-content .confirm-icon svg {
        width: 24px;
        height: 24px;
    }

    .app-switch-content h3 {
        margin-bottom: 15px !important;
        font-size: 18px;
    }

    .app-card {
        padding: 18px 12px;
    }

    .app-card-icon {
        width: 48px;
        height: 48px;
        margin-bottom: 10px;
    }

    .app-card-icon svg {
        width: 24px;
        height: 24px;
    }

    .app-card-title {
        font-size: 14px;
    }

    #btn-close-app-switch {
        margin-top: 15px !important;
        padding: 10px !important;
    }
}

#btn-close-app-switch {
    transition: all 0.2s ease;
}

#btn-close-app-switch:hover {
    transform: scale(1.05);
    box-shadow: 0 0 15px rgba(66, 66, 66, 0.3);
}

.app-view {
    transition: opacity 0.3s ease, transform 0.3s ease;
    width: 100%;
}

.active-view {
    display: block !important;
    opacity: 1;
    transform: translateY(0);
}

#view-chatbot.active-view {
    display: flex !important;
}

.hidden-view {
    display: none !important;
    opacity: 0;
    transform: translateY(10px);
}

#view-chatbot {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 180px);
    padding-top: 10px;
}

.chat-search-bar {
    position: relative;
    margin-bottom: 20px;
}

.chat-search-bar input {
    width: 100%;
    padding: 14px 45px 14px 45px;
    background: #111;
    border: 1px solid #333;
    border-radius: 12px;
    color: #fff;
    font-size: 1rem;
    transition: 0.3s;
}

.chat-search-bar input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.15);
    outline: none;
}

.chat-search-bar .search-icon {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #666;
    pointer-events: none;
}

.chat-grid-wrapper {
    flex: 1;
    overflow-y: auto;
    background: #0a0a0a;
    border: 1px solid #222;
    border-radius: 16px;
    padding: 20px;
    position: relative;
}

.chat-grid-wrapper::-webkit-scrollbar {
    width: 8px;
}

.chat-grid-wrapper::-webkit-scrollbar-track {
    background: #0a0a0a;
    border-radius: 0 16px 16px 0;
}

.chat-grid-wrapper::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 4px;
}

.chat-grid-wrapper::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

.characters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 15px;
}

.characters-grid.compact-view {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
}

.characters-grid.compact-view .char-card {
    aspect-ratio: 1;
    border-radius: 10px;
}

.characters-grid.compact-view .char-card-overlay {
    height: 80%;
    padding: 8px;
}

.characters-grid.compact-view .char-name {
    font-size: 0.75rem;
    margin-bottom: 2px;
}

.characters-grid.compact-view .char-category,
.characters-grid.compact-view .char-label,
.characters-grid.compact-view .char-action {
    font-size: 0.6rem;
}

.characters-grid.compact-view .char-info-btn {
    width: 24px;
    height: 24px;
    top: 5px;
    right: 5px;
}

.characters-grid.list-view {
    grid-template-columns: 1fr;
    gap: 8px;
}

.characters-grid.list-view .char-card {
    aspect-ratio: unset;
    min-height: 64px;
    display: flex;
    flex-direction: row;
    align-items: center;
    border-radius: 10px;
    overflow: hidden;
}

.characters-grid.list-view .char-card-bg {
    width: 64px;
    height: 100%;
    min-height: 64px;
    position: relative;
    flex-shrink: 0;
    border-radius: 10px 0 0 10px;
}

.characters-grid.list-view .char-card-overlay {
    position: relative;
    height: auto;
    width: 100%;
    background: none;
    padding: 10px 14px;
    flex: 1;
}

.characters-grid.list-view .char-name {
    font-size: 0.9rem;
    margin-bottom: 2px;
}

.characters-grid.list-view .char-category {
    font-size: 0.7rem;
}

.characters-grid.list-view .char-action {
    display: none;
}

.characters-grid.list-view .char-label {
    font-size: 0.65rem;
}

.characters-grid.list-view .char-info-btn {
    position: relative;
    top: auto;
    right: auto;
    opacity: 1;
    transform: scale(1);
    flex-shrink: 0;
    margin-right: 10px;
    width: 28px;
    height: 28px;
}

.characters-grid.list-view .char-card:hover .char-card-bg {
    transform: none;
}

@media (max-width: 600px) {
    .characters-grid.compact-view {
        grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
        gap: 8px;
    }
}

.char-card {
    position: relative;
    aspect-ratio: 3/4;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    background: #151515;
    border: 1px solid transparent;
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.char-card:hover {
    border-color: var(--primary);
    box-shadow: 0 0px 20px rgba(var(--primary-rgb), 0.4);
}

.char-card-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    transition: transform 0.5s ease;
}

.char-card:hover .char-card-bg {
    transform: scale(1.05);
}

.char-card-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 70%;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.95) 0%, rgba(0, 0, 0, 0.6) 50%, transparent 100%);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 15px;
    pointer-events: none;
}

.char-name {
    font-size: 1.1rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 4px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
}

.char-category {
    font-size: 0.75rem;
    color: #888;
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
    margin-bottom: 4px;
}

.char-label {
    font-size: 0.7rem;
    color: #666;
    font-weight: 400;
    margin-bottom: 4px;
}

.char-action {
    font-size: 0.75rem;
    color: #999;
    font-weight: 400;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.char-info-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.3s ease;
    z-index: 10;
    backdrop-filter: blur(4px);
}

.char-card:hover .char-info-btn {
    opacity: 1;
    transform: scale(1);
}

.char-info-btn:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: #000;
    box-shadow: 0 0 15px rgba(var(--primary-rgb), 0.5);
    transform: scale(1.1);
}

.char-info-btn:active {
    transform: scale(0.95);
}

.char-info-btn svg {
    width: 16px;
    height: 16px;
}

@media (max-width: 768px) {
    .char-info-btn {
        opacity: 1;
        transform: scale(1);
    }
}

.chat-loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 200px;
    color: #666;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 10px;
}

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

#view-image-generator.hidden-view~#advanced-panel,
#view-image-generator.hidden-view~.input-group,
#view-image-generator.hidden-view~.generate-btn,
#view-image-generator.hidden-view~.gallery-btn {
    display: none !important;
}

.chat-screen-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.chat-screen-modal.active {
    opacity: 1;
    visibility: visible;
    overscroll-behavior: contain;
}

.chat-screen-container {
    width: 95%;
    max-width: 1100px;
    height: 90vh;
    max-height: 800px;
    background: #0a0a0a;
    border-radius: 20px;
    border: 1px solid #222;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.chat-screen-modal.active .chat-screen-container {
    transform: scale(1);
}

.chat-screen-header {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    background: #111;
    border-bottom: 1px solid #222;
    gap: 15px;
}

.chat-back-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #1a1a1a;
    border: 1px solid #333;
    color: #888;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.chat-back-btn:hover {
    background: #222;
    color: #fff;
    border-color: var(--primary);
}

.chat-char-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.chat-char-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--primary);
}

.chat-char-name {
    font-size: 18px;
    font-weight: 600;
    color: #fff;
}

.new-chat-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    background: var(--primary);
    color: #000;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.new-chat-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 15px rgba(var(--primary-rgb), 0.4);
}

.chat-screen-body {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.chat-sidebar {
    width: 280px;
    background: #0d0d0d;
    border-right: 1px solid #1a1a1a;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #1a1a1a;
}

.sidebar-header-title {
    font-size: 13px;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.user-profile-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid #333;
    color: #666;
    cursor: pointer;
    border-radius: 10px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.user-profile-btn:hover {
    background: rgba(var(--primary-rgb), 0.1);
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(var(--primary-rgb), 0.2);
}

.user-profile-info-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    text-align: left;
}

.user-profile-card {
    background: rgba(255, 255, 255, 0.03);
    padding: 14px;
    border-radius: 12px;
    border: 1px solid #222;
    transition: all 0.3s ease;
}

.user-profile-card:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(var(--primary-rgb), 0.5);
    transform: scale(1.02);
    cursor: default;
}

.profile-label {
    color: #666;
    font-size: 10px;
    display: block;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

.profile-value {
    color: #fff;
    font-weight: 600;
    font-size: 15px;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.1);
}

.user-profile-btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(var(--primary-rgb), 0.2) 0%, transparent 70%);
    transform: translate(-50%, -50%) scale(0);
    transition: transform 0.3s ease;
    border-radius: 50%;
}

.user-profile-btn:hover::after {
    transform: translate(-50%, -50%) scale(2);
}

.user-profile-btn:active {
    transform: scale(0.92);
}

.conversations-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
}

.conversation-item {
    padding: 14px 16px;
    background: #111;
    border-radius: 12px;
    margin-bottom: 8px;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.2s ease;
    position: relative;
}

.conversation-item:hover {
    background: #151515;
    border-color: #333;
}

.conversation-item.active {
    background: rgba(var(--primary-rgb), 0.1);
    border-color: var(--primary);
}

.conv-preview {
    font-size: 14px;
    color: #ccc;
    margin-bottom: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-right: 30px;
}

.conv-date {
    font-size: 11px;
    color: #555;
}

.conv-delete-btn {
    position: absolute;
    top: 50%;
    right: 12px;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: transparent;
    border: none;
    color: #555;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.2s ease;
}

.conversation-item:hover .conv-delete-btn {
    opacity: 1;
}

.conv-delete-btn:hover {
    background: #ff4444;
    color: #fff;
}

.conv-empty,
.conv-loading,
.conv-error {
    padding: 30px 20px;
    text-align: center;
    color: #555;
    font-size: 13px;
}

.chat-main-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #080808;
    overflow: hidden;
}

.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
}

.no-conv-selected,
.no-messages {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #444;
    font-size: 14px;
    text-align: center;
}

.message-bubble {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 16px;
    position: relative;
    word-wrap: break-word;
    border: 1px solid transparent;
    transition: border-color 0.3s ease;
}

.message-bubble[class*="emotion-"] {
    animation-play-state: paused !important;
    padding-bottom: 5px;
    padding-left: 25px;
}
.message-bubble[class*="emotion-"].emotion-in-view {
    animation-play-state: running !important;
    will-change: box-shadow;
}
.message-bubble.user {
    align-self: flex-end;
    background: var(--dot-filled-3);
    color: #000;
    border-bottom-right-radius: 4px;
}

.message-bubble.assistant {
    align-self: flex-start;
    background: #1a1a1a;
    color: #ddd;
    border: 1px solid #2a2a2a;
    border-bottom-left-radius: 4px;
}

.emotion-icon {
    position: absolute;
    bottom: 4px;
    right: 6px;
    opacity: 0.85;
    display: flex;
    align-items: center;
    justify-content: center;
    filter: drop-shadow(0 0 3px currentColor);
    animation: emotionIconPulse 3s ease-in-out infinite;
}

.message-bubble.user .emotion-icon {
    right: auto;
    left: 6px;
    filter: drop-shadow(0 0 6px rgba(0, 0, 0, 1))
}

.message-bubble.user .emotion-icon svg {
    stroke: rgba(0, 0, 0, 0.7);
}

.emotion-label {
    opacity: 0.88;
    font-style: italic;
    font-size: 11px;
}

.messages-container.hide-emotions .emotion-icon,
.messages-container.hide-emotions .emotion-label {
    display: none;
}
.messages-container.hide-emotions .message-bubble.assistant[class*="emotion-"],
.messages-container.hide-emotions .message-bubble.user[class*="emotion-"] {
    box-shadow: none !important;
    animation: none !important;
    border-color: #2a2a2a !important;
}

@keyframes emotionGlow {
    0% { box-shadow: 0 0 4px var(--emotion-color), 0 0 8px transparent; }
    25% { box-shadow: 0 0 6px var(--emotion-color), 0 0 12px var(--emotion-color); }
    50% { box-shadow: 0 0 10px var(--emotion-color), 0 0 20px var(--emotion-color), inset 0 0 3px var(--emotion-color); }
    75% { box-shadow: 0 0 6px var(--emotion-color), 0 0 12px var(--emotion-color); }
    100% { box-shadow: 0 0 4px var(--emotion-color), 0 0 8px transparent; }
}

@keyframes emotionIconPulse {
    0%, 100% { opacity: 0.7; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.1); }
}

.message-bubble.emotion-happy { --emotion-color: rgba(255, 215, 0, 0.35); border-color: rgba(255, 215, 0, 0.3); animation: emotionGlow 5s cubic-bezier(0.4, 0, 0.6, 1) infinite; }
.message-bubble.emotion-sad { --emotion-color: rgba(74, 144, 217, 0.35); border-color: rgba(74, 144, 217, 0.3); animation: emotionGlow 5s cubic-bezier(0.4, 0, 0.6, 1) infinite; }
.message-bubble.emotion-angry { --emotion-color: rgba(255, 68, 68, 0.35); border-color: rgba(255, 68, 68, 0.3); animation: emotionGlow 5s cubic-bezier(0.4, 0, 0.6, 1) infinite; }
.message-bubble.emotion-scared { --emotion-color: rgba(155, 89, 182, 0.35); border-color: rgba(155, 89, 182, 0.3); animation: emotionGlow 5s cubic-bezier(0.4, 0, 0.6, 1) infinite; }
.message-bubble.emotion-surprised { --emotion-color: rgba(255, 107, 53, 0.35); border-color: rgba(255, 107, 53, 0.3); animation: emotionGlow 5s cubic-bezier(0.4, 0, 0.6, 1) infinite; }
.message-bubble.emotion-disgusted { --emotion-color: rgba(46, 204, 64, 0.35); border-color: rgba(46, 204, 64, 0.3); animation: emotionGlow 5s cubic-bezier(0.4, 0, 0.6, 1) infinite; }
.message-bubble.emotion-excited { --emotion-color: rgba(255, 20, 147, 0.35); border-color: rgba(255, 20, 147, 0.3); animation: emotionGlow 5s cubic-bezier(0.4, 0, 0.6, 1) infinite; }
.message-bubble.emotion-bored { --emotion-color: rgba(149, 165, 166, 0.35); border-color: rgba(149, 165, 166, 0.3); animation: emotionGlow 5s cubic-bezier(0.4, 0, 0.6, 1) infinite; }
.message-bubble.emotion-confused { --emotion-color: rgba(230, 126, 34, 0.35); border-color: rgba(230, 126, 34, 0.3); animation: emotionGlow 5s cubic-bezier(0.4, 0, 0.6, 1) infinite; }
.message-bubble.emotion-neutral { --emotion-color: rgba(189, 195, 199, 0.25); border-color: rgba(189, 195, 199, 0.2); animation: emotionGlow 6s cubic-bezier(0.4, 0, 0.6, 1) infinite; }
.message-bubble.emotion-flirtatious { --emotion-color: rgba(255, 105, 180, 0.35); border-color: rgba(255, 105, 180, 0.3); animation: emotionGlow 5s cubic-bezier(0.4, 0, 0.6, 1) infinite; }
.message-bubble.emotion-sarcastic { --emotion-color: rgba(243, 156, 18, 0.35); border-color: rgba(243, 156, 18, 0.3); animation: emotionGlow 5s cubic-bezier(0.4, 0, 0.6, 1) infinite; }
.message-bubble.emotion-shy { --emotion-color: rgba(253, 207, 232, 0.35); border-color: rgba(253, 207, 232, 0.3); animation: emotionGlow 5s cubic-bezier(0.4, 0, 0.6, 1) infinite; }
.message-bubble.emotion-confident { --emotion-color: rgba(52, 152, 219, 0.35); border-color: rgba(52, 152, 219, 0.3); animation: emotionGlow 5s cubic-bezier(0.4, 0, 0.6, 1) infinite; }
.message-bubble.emotion-amused { --emotion-color: rgba(241, 196, 15, 0.35); border-color: rgba(241, 196, 15, 0.3); animation: emotionGlow 5s cubic-bezier(0.4, 0, 0.6, 1) infinite; }
.message-bubble.emotion-jealous { --emotion-color: rgba(39, 174, 96, 0.35); border-color: rgba(39, 174, 96, 0.3); animation: emotionGlow 5s cubic-bezier(0.4, 0, 0.6, 1) infinite; }
.message-bubble.emotion-guilty { --emotion-color: rgba(142, 68, 173, 0.35); border-color: rgba(142, 68, 173, 0.3); animation: emotionGlow 5s cubic-bezier(0.4, 0, 0.6, 1) infinite; }
.message-bubble.emotion-curious { --emotion-color: rgba(26, 188, 156, 0.35); border-color: rgba(26, 188, 156, 0.3); animation: emotionGlow 5s cubic-bezier(0.4, 0, 0.6, 1) infinite; }
.message-bubble.emotion-hopeful { --emotion-color: rgba(0, 206, 209, 0.35); border-color: rgba(0, 206, 209, 0.3); animation: emotionGlow 5s cubic-bezier(0.4, 0, 0.6, 1) infinite; }
.message-bubble.emotion-anxious { --emotion-color: rgba(231, 76, 60, 0.35); border-color: rgba(231, 76, 60, 0.3); animation: emotionGlow 5s cubic-bezier(0.4, 0, 0.6, 1) infinite; }
.message-bubble.emotion-frustrated { --emotion-color: rgba(192, 57, 43, 0.35); border-color: rgba(192, 57, 43, 0.3); animation: emotionGlow 5s cubic-bezier(0.4, 0, 0.6, 1) infinite; }
.message-bubble.emotion-affectionate { --emotion-color: rgba(255, 118, 117, 0.35); border-color: rgba(255, 118, 117, 0.3); animation: emotionGlow 5s cubic-bezier(0.4, 0, 0.6, 1) infinite; }
.message-bubble.emotion-romantic { --emotion-color: rgba(232, 67, 147, 0.35); border-color: rgba(232, 67, 147, 0.3); animation: emotionGlow 5s cubic-bezier(0.4, 0, 0.6, 1) infinite; }
.message-bubble.emotion-loving { --emotion-color: rgba(253, 121, 168, 0.35); border-color: rgba(253, 121, 168, 0.3); animation: emotionGlow 5s cubic-bezier(0.4, 0, 0.6, 1) infinite; }
.message-bubble.emotion-passionate { --emotion-color: rgba(214, 48, 49, 0.35); border-color: rgba(214, 48, 49, 0.3); animation: emotionGlow 5s cubic-bezier(0.4, 0, 0.6, 1) infinite; }
.message-bubble.emotion-infatuated { --emotion-color: rgba(162, 155, 254, 0.35); border-color: rgba(162, 155, 254, 0.3); animation: emotionGlow 5s cubic-bezier(0.4, 0, 0.6, 1) infinite; }
.message-bubble.emotion-seductive { --emotion-color: rgba(108, 92, 231, 0.35); border-color: rgba(108, 92, 231, 0.3); animation: emotionGlow 5s cubic-bezier(0.4, 0, 0.6, 1) infinite; }
.message-bubble.emotion-lustful { --emotion-color: rgba(255, 45, 85, 0.35); border-color: rgba(255, 45, 85, 0.3); animation: emotionGlow 5s cubic-bezier(0.4, 0, 0.6, 1) infinite; }
.message-bubble.emotion-aroused { --emotion-color: rgba(255, 59, 48, 0.35); border-color: rgba(255, 59, 48, 0.3); animation: emotionGlow 5s cubic-bezier(0.4, 0, 0.6, 1) infinite; }
.message-bubble.emotion-submissive { --emotion-color: rgba(201, 160, 220, 0.35); border-color: rgba(201, 160, 220, 0.3); animation: emotionGlow 5s cubic-bezier(0.4, 0, 0.6, 1) infinite; }
.message-bubble.emotion-dominant { --emotion-color: rgba(139, 0, 0, 0.35); border-color: rgba(139, 0, 0, 0.3); animation: emotionGlow 5s cubic-bezier(0.4, 0, 0.6, 1) infinite; }
.message-bubble.emotion-desiring { --emotion-color: rgba(255, 107, 107, 0.35); border-color: rgba(255, 107, 107, 0.3); animation: emotionGlow 5s cubic-bezier(0.4, 0, 0.6, 1) infinite; }
.message-bubble.emotion-melancholic { --emotion-color: rgba(91, 125, 177, 0.35); border-color: rgba(91, 125, 177, 0.3); animation: emotionGlow 6s cubic-bezier(0.4, 0, 0.6, 1) infinite; }
.message-bubble.emotion-hopeless { --emotion-color: rgba(74, 74, 106, 0.35); border-color: rgba(74, 74, 106, 0.3); animation: emotionGlow 6s cubic-bezier(0.4, 0, 0.6, 1) infinite; }
.message-bubble.emotion-lonely { --emotion-color: rgba(106, 123, 139, 0.35); border-color: rgba(106, 123, 139, 0.3); animation: emotionGlow 6s cubic-bezier(0.4, 0, 0.6, 1) infinite; }
.message-bubble.emotion-heartbroken { --emotion-color: rgba(178, 34, 34, 0.35); border-color: rgba(178, 34, 34, 0.3); animation: emotionGlow 6s cubic-bezier(0.4, 0, 0.6, 1) infinite; }
.message-bubble.emotion-nostalgic { --emotion-color: rgba(212, 165, 116, 0.35); border-color: rgba(212, 165, 116, 0.3); animation: emotionGlow 6s cubic-bezier(0.4, 0, 0.6, 1) infinite; }
.message-bubble.emotion-empty { --emotion-color: rgba(128, 128, 128, 0.25); border-color: rgba(128, 128, 128, 0.2); animation: emotionGlow 7s cubic-bezier(0.4, 0, 0.6, 1) infinite; }
.message-bubble.emotion-desperate { --emotion-color: rgba(92, 61, 110, 0.35); border-color: rgba(92, 61, 110, 0.3); animation: emotionGlow 5s cubic-bezier(0.4, 0, 0.6, 1) infinite; }
.message-bubble.emotion-thrilled { --emotion-color: rgba(255, 140, 0, 0.35); border-color: rgba(255, 140, 0, 0.3); animation: emotionGlow 4s cubic-bezier(0.4, 0, 0.6, 1) infinite; }
.message-bubble.emotion-euphoric { --emotion-color: rgba(255, 215, 0, 0.4); border-color: rgba(255, 215, 0, 0.35); animation: emotionGlow 4s cubic-bezier(0.4, 0, 0.6, 1) infinite; }
.message-bubble.emotion-adventurous { --emotion-color: rgba(46, 213, 115, 0.35); border-color: rgba(46, 213, 115, 0.3); animation: emotionGlow 4s cubic-bezier(0.4, 0, 0.6, 1) infinite; }

.message-content {
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
}

.message-content strong {
    font-weight: 700;
    color: #fff;
}

.message-content em {
    font-style: italic;
    color: inherit;
}

.message-bubble.assistant .message-content em {
    color: #666;
}

.messages-container.hide-thoughts .message-bubble.assistant:not(:first-child) .message-content em {
    display: none;
}

.messages-container.hide-thoughts .message-bubble.assistant:not(:first-child) .message-content em + br,
.messages-container.hide-thoughts .message-bubble.assistant:not(:first-child) .message-content em + br + br,
.messages-container.hide-thoughts .message-bubble.assistant:not(:first-child) .message-content br:has(+ em) {
    display: none;
}

.message-content del {
    text-decoration: line-through;
    opacity: 0.7;
}

.message-content .md-code-block {
    background: #0a0a0a;
    border: 1px solid #333;
    border-radius: 8px;
    padding: 12px 15px;
    margin: 10px 0;
    overflow-x: auto;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 13px;
    line-height: 1.4;
}

.message-content .md-code-block code {
    background: none;
    padding: 0;
    color: #00ff88;
}

.message-content .md-inline-code {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid #333;
    border-radius: 4px;
    padding: 2px 6px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 12px;
    color: var(--primary);
}

.message-content .md-h2,
.message-content .md-h3,
.message-content .md-h4 {
    margin: 12px 0 8px 0;
    font-weight: 700;
    color: #fff;
}

.message-content .md-h2 { font-size: 18px; }
.message-content .md-h3 { font-size: 16px; }
.message-content .md-h4 { font-size: 14px; }

.message-content .md-ul,
.message-content .md-ol {
    margin: 8px 0;
    padding-left: 20px;
}

.message-content .md-li,
.message-content .md-oli {
    margin: 4px 0;
    line-height: 1.5;
}

.message-content .md-link {
    color: var(--primary);
    text-decoration: none;
    border-bottom: 1px solid rgba(var(--primary-rgb), 0.3);
    transition: all 0.2s ease;
}

.message-content .md-link:hover {
    border-bottom-color: var(--primary);
}

.message-content .md-quote {
    border-left: 3px solid var(--primary);
    padding-left: 12px;
    margin: 10px 0;
    color: #999;
    font-style: italic;
}

.message-content .md-hr {
    border: none;
    height: 1px;
    background: linear-gradient(90deg, transparent, #444, transparent);
    margin: 15px 0;
}

.message-bubble.user .message-content .md-inline-code {
    background: rgba(0, 0, 0, 0.3);
    color: #000;
    border-color: rgba(0, 0, 0, 0.2);
}

.message-bubble.user .message-content .md-code-block {
    background: rgba(0, 0, 0, 0.2);
    border-color: rgba(0, 0, 0, 0.3);
}

.message-bubble.user .message-content .md-code-block code {
    color: #000;
}

.message-bubble.user .message-content .md-link {
    color: #000;
    border-bottom-color: rgba(0, 0, 0, 0.3);
}

.message-bubble.user .message-content .md-quote {
    border-left-color: rgba(0, 0, 0, 0.5);
    color: rgba(0, 0, 0, 0.8);
}

.message-time {
    font-size: 10px;
    margin-top: 6px;
    opacity: 0.6;
}

.message-bubble.user .message-time {
    text-align: right;
}

.chat-input-area {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px 20px;
    background: #0d0d0d;
    border-top: 1px solid #1a1a1a;
}

.chat-message-input {
    flex: 1;
    padding: 14px 18px;
    background: #111;
    border: 1px solid #2a2a2a;
    border-radius: 14px;
    color: #fff;
    font-size: 14px;
    resize: none;
    max-height: 120px;
    transition: border-color 0.2s ease;
}

.chat-message-input:focus {
    outline: none;
    border-color: var(--primary);
}

.chat-message-input::placeholder {
    color: #555;
}

.chat-send-btn {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: var(--primary);
    border: none;
    color: #000;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.chat-send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 15px rgba(var(--primary-rgb), 0.4);
}

.chat-action-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chat-img-gen-btn {
    width: 48px;
    height: 40px;
    border-radius: 12px;
    background: rgba(var(--primary-rgb), 0.05);
    border: 1px solid #333;
    color: #666;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.chat-img-gen-btn:not(:disabled):hover {
    background: linear-gradient(135deg, rgba(var(--primary-rgb), 0.15) 0%, rgba(var(--primary-rgb), 0.1) 100%);
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(var(--primary-rgb), 0.2);
}

.chat-img-gen-btn:not(:disabled):active {
    transform: scale(0.95);
}

.chat-img-gen-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: rgba(255, 255, 255, 0.02);
    border-color: #222;
    color: #444;
}

.chat-img-gen-btn:not(:disabled)::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(var(--primary-rgb), 0.3) 0%, transparent 70%);
    transform: translate(-50%, -50%) scale(0);
    transition: transform 0.4s ease;
    border-radius: 50%;
}

.chat-img-gen-btn:not(:disabled):hover::after {
    transform: translate(-50%, -50%) scale(2.5);
}

.conversations-list::-webkit-scrollbar,
.messages-container::-webkit-scrollbar {
    width: 6px;
}

.conversations-list::-webkit-scrollbar-track,
.messages-container::-webkit-scrollbar-track {
    background: transparent;
}

.conversations-list::-webkit-scrollbar-thumb,
.messages-container::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 3px;
}

.conversations-list::-webkit-scrollbar-thumb:hover,
.messages-container::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

.story-finished-banner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 20px 18px;
    margin: 20px 0 4px;
    animation: storyFinishFadeIn 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.story-finished-line {
    width: 100%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(var(--primary-rgb), 0.4), transparent);
    animation: storyLineFade 1.2s ease 0.3s both;
}

.story-finished-content {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 22px;
    background: linear-gradient(135deg, rgba(var(--primary-rgb), 0.08), rgba(var(--primary-rgb), 0.03));
    border: 1px solid rgba(var(--primary-rgb), 0.2);
    border-radius: 14px;
    animation: storyContentPop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 0.4s both;
    position: relative;
    overflow: hidden;
}

.story-finished-content::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 30% 50%, rgba(var(--primary-rgb), 0.06), transparent 70%);
    pointer-events: none;
}

.story-finished-content svg {
    flex-shrink: 0;
    stroke: var(--primary);
    filter: drop-shadow(0 0 6px rgba(var(--primary-rgb), 0.4));
    animation: storyIconGlow 2s ease-in-out infinite;
}

.story-finished-content span {
    flex: 1;
    color: rgba(var(--primary-rgb), 0.85);
    font-size: 13px;
    line-height: 1.5;
    font-weight: 500;
}

@keyframes storyFinishFadeIn {
    from {
        opacity: 0;
        transform: translateY(15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes storyLineFade {
    from {
        opacity: 0;
        transform: scaleX(0);
    }
    to {
        opacity: 1;
        transform: scaleX(1);
    }
}

@keyframes storyContentPop {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes storyIconGlow {
    0%, 100% {
        filter: drop-shadow(0 0 4px rgba(var(--primary-rgb), 0));
    }
    50% {
        filter: drop-shadow(0 0 10px rgba(var(--primary-rgb), 1));
    }
}

.chat-send-btn[data-continue-mode] {
    background: rgba(76, 175, 80, 0.15) !important;
    border-color: rgba(76, 175, 80, 0.4) !important;
    color: #4CAF50 !important;
    opacity: 1 !important;
    cursor: pointer !important;
    animation: continueBtnPulse 2s ease-in-out infinite;
}

.chat-send-btn[data-continue-mode]:hover {
    background: rgba(76, 175, 80, 0.25) !important;
    box-shadow: 0 0 12px rgba(76, 175, 80, 0.3);
    transform: scale(1.05);
}

.chat-send-btn[data-continue-mode] svg {
    stroke: #4CAF50;
}

@keyframes continueBtnPulse {
    0%, 100% {
        box-shadow: 0 0 4px rgba(76, 175, 80, 0.2);
    }
    50% {
        box-shadow: 0 0 12px rgba(76, 175, 80, 0.4);
    }
}

.story-continued-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    margin: 12px 0;
    width: 100%;
    box-sizing: border-box;
    animation: storyFinishFadeIn 0.6s ease-out both;
}

.story-continued-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: rgb(var(--primary-rgb));
    text-shadow: 0 0 20px var(--dot-filled-2);
    font-size: 13px;
    font-weight: 500;
    white-space: normal;
    text-align: left;
    line-height: 1.4;
    animation: storyContentPop 0.5s ease-out 0.3s both;
}

.story-continued-content svg {
    flex-shrink: 0;
    stroke: rgb(var(--primary-rgb));
    animation: storyIconGlow 2s ease-in-out infinite;
    filter: drop-shadow(0 0 4px rgba(76, 175, 80, 0.3));
}

.story-continued-content span {
    opacity: 0.9;
}

@media (max-width: 768px) {
    .chat-screen-container {
        width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
    }

    .chat-screen-body {
        flex-direction: column;
    }

    .message-bubble {
        max-width: 85%;
    }

    .new-chat-btn span {
        display: none;
    }

    .new-chat-btn {
        padding: 10px;
    }
}

.chat-search-bar {
    display: flex;
    gap: 10px;
    align-items: center;
}

.chat-search-bar .search-wrapper {
    position: relative;
    flex: 1;
}

.chat-filter-btn {
    height: 50px;
    width: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #111;
    border: 1px solid #333;
    border-radius: 12px;
    color: #666;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.chat-filter-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(var(--primary-rgb), 0.05);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

.chat-filter-btn.active {
    color: var(--primary);
    border-color: var(--primary);
    background: rgba(var(--primary-rgb), 0.1);
}

.chat-filter-panel {
    background: #0a0a0a;
    border: 1px solid transparent;
    border-radius: 16px;
    padding: 0 20px;
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    visibility: hidden;
    transform: scale(0.98);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 50;
}

.chat-filter-panel.active {
    padding: 20px;
    max-height: 800px;
    opacity: 1;
    visibility: visible;
    border-color: #222;
    transform: scale(1);
}

.chat-filter-panel-content {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.chat-filter-group {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chat-category-group {
    display: block; 
    margin-bottom: 10px; 
    color: #888;
}

#chat-category-filters {
    display: flex; 
    flex-wrap: wrap; 
    gap: 8px;
    max-height: 100px;
    overflow-y: auto;
    padding-right: 5px;
}

#chat-category-filters::-webkit-scrollbar {
    width: 4px;
}

#chat-category-filters::-webkit-scrollbar-track {
    background: transparent;
}

#chat-category-filters::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 4px;
}

#chat-category-filters::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

#chat-filter-reset-btn {
    width: 100%;
    padding: 12px;
    background: #151515;
    border: 1px solid #333;
    color: #888;
    border-radius: 8px;
    cursor: pointer;
    margin-top: 15px;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s ease;
}

#chat-filter-reset-btn:hover {
    background: #222;
    color: #fff;
    border-color: #555;
}

#character-details-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

#character-details-modal.active {
    opacity: 1;
    visibility: visible;
}

#character-details-modal .modal-box {
    max-width: 500px !important;
    background: #0a0a0a;
    border: 1px solid #333;
    border-radius: 20px;
    padding: 30px;
    transform: scale(0.9);
    transition: transform 0.3s ease;
    max-height: 90svh;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #333 transparent;
}

#character-details-modal .modal-box::-webkit-scrollbar {
    width: 4px;
}

#character-details-modal .modal-box::-webkit-scrollbar-track {
    background: transparent;
}

#character-details-modal .modal-box::-webkit-scrollbar-thumb {
    background: #444;
    border-radius: 4px;
}

#character-details-modal .modal-box::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

#character-details-modal.active .modal-box {
    transform: scale(1);
}

#character-details-modal .char-info-box {
    transition: all 0.2s ease;
}

#character-details-modal .char-info-box:hover {
    border-color: rgba(var(--primary-rgb), 0.3);
    background: rgba(255, 255, 255, 0.04);
}

#character-details-modal #detail-char-action {
    scrollbar-width: thin;
    scrollbar-color: #333 transparent;
}

#character-details-modal #detail-char-action::-webkit-scrollbar {
    width: 4px;
}

#character-details-modal #detail-char-action::-webkit-scrollbar-track {
    background: transparent;
}

#character-details-modal #detail-char-action::-webkit-scrollbar-thumb {
    background: #444;
    border-radius: 4px;
}

#character-details-modal #detail-char-action::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

#character-details-modal .char-avatar-wrapper {
    position: relative;
    display: inline-block;
}

#character-details-modal .img-gen-badge {
    animation: badgePulse 2s ease-in-out infinite;
}

@keyframes badgePulse {
    0%, 100% {
        box-shadow: 0 2px 10px rgba(0, 255, 136, 0.4);
    }
    50% {
        box-shadow: 0 2px 20px rgba(0, 255, 136, 0.7);
    }
}

.char-tab-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid #333;
    border-radius: 20px;
    color: #666;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.char-tab-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: #555;
    color: #aaa;
}

.char-tab-btn.active {
    background: rgba(var(--primary-rgb), 0.15);
    border-color: rgba(var(--primary-rgb), 0.5);
    color: var(--primary);
    box-shadow: 0 0 15px rgba(var(--primary-rgb), 0.2);
}

.char-tab-btn.active svg {
    stroke: var(--primary);
}

.char-tab-btn svg {
    flex-shrink: 0;
}

#detail-char-content {
    scrollbar-width: thin;
    scrollbar-color: #333 transparent;
}

#detail-char-content::-webkit-scrollbar {
    width: 4px;
}

#detail-char-content::-webkit-scrollbar-track {
    background: transparent;
}

#detail-char-content::-webkit-scrollbar-thumb {
    background: #444;
    border-radius: 4px;
}

#detail-char-content::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

.chat-input-wrapper {
    position: relative;
    flex: 1;
    display: flex;
    align-items: center;
}

.chat-input-wrapper .chat-message-input {
    width: 100%;
    padding-right: 70px;
}

.chat-char-counter {
    position: absolute;
    right: 10px;
    bottom: 8px;
    font-size: 10px;
    font-family: monospace;
    color: #555;
    background: rgba(0, 0, 0, 0.5);
    padding: 2px 6px;
    border-radius: 4px;
    pointer-events: none;
    transition: all 0.2s ease;
    z-index: 5;
}

.chat-char-counter.limit-near {
    color: #ffaa00;
    background: rgba(255, 170, 0, 0.15);
}

.chat-char-counter.limit-reached {
    color: #ff4444;
    background: rgba(255, 68, 68, 0.15);
    font-weight: 700;
}

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

.spinning {
    animation: spin 1s linear infinite;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.generated-image-wrapper {
    position: relative;
    display: inline-block;
    width: 100%;
}

.generated-image-wrapper img {
    display: block;
    width: 100%;
}

.img-download-btn {
    position: absolute;
    bottom: 12px;
    right: 12px;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(var(--primary-rgb), 0.2);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10;
    opacity: 0.85;
}

.img-download-btn:hover {
    background: rgba(var(--primary-rgb), 0.9);
    border-color: rgba(var(--primary-rgb), 0.5);
    color: #000;
    transform: scale(1.1);
    box-shadow: 0 4px 20px rgba(var(--primary-rgb), 0.4);
    opacity: 1;
}

.img-download-btn:active {
    transform: scale(0.95);
}

.img-download-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.img-download-btn svg {
    transition: transform 0.3s ease;
}

@media (max-width: 768px) {

    .theme-btn {
        width: 30px;
        height: 30px;
    }
    
    .img-download-btn {
        width: 36px;
        height: 36px;
        bottom: 8px;
        right: 8px;
        opacity: 1;
    }
    
    .img-download-btn svg {
        width: 16px;
        height: 16px;
    }
}

.char-detail-tabs {
    display: flex;
    gap: 8px;
    width: 100%;
    justify-content: center;
}

.char-tab-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid #333;
    border-radius: 10px;
    color: #666;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.char-tab-btn::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: var(--primary);
    transform: translateX(-50%);
    transition: width 0.3s ease;
}

.char-tab-btn:hover {
    background: rgba(var(--primary-rgb), 0.05);
    border-color: rgba(var(--primary-rgb), 0.3);
    color: #999;
    transform: translateY(-2px);
}

.char-tab-btn.active {
    background: rgba(var(--primary-rgb), 0.1);
    border-color: var(--primary);
    color: var(--primary);
    box-shadow: 0 4px 15px rgba(var(--primary-rgb), 0.2);
}

.char-tab-btn.active::before {
    width: 60%;
}

.char-tab-btn svg {
    transition: transform 0.3s ease;
}

.char-tab-btn:hover svg {
    transform: scale(1.1);
}

.char-tab-btn.active svg {
    transform: scale(1.15);
}

.char-info-box {
    position: relative;
    overflow: hidden;
    transition: height 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.char-info-box #detail-char-content,
.char-info-box #detail-char-empty {
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.char-info-box.tab-switching #detail-char-content,
.char-info-box.tab-switching #detail-char-empty {
    animation: tabContentSwitch 0.35s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes tabContentSwitch {
    0% {
        opacity: 0;
        transform: translateX(12px);
    }
    100% {
        opacity: 1;
        transform: translateX(0);
    }
}
.chat-category-btn {
    padding: 6px 12px;
    border-radius: 20px;
    border: 1px solid #333;
    background: #151515;
    color: #888;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s ease;
}

.chat-category-btn:hover {
    border-color: rgba(var(--primary-rgb), 0.5);
    background: rgba(var(--primary-rgb), 0.05);
    color: var(--primary);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.chat-category-btn.active {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(var(--primary-rgb), 0.1);
    box-shadow: 0 0 10px rgba(var(--primary-rgb), 0.15);
}

.model-select-btn {
    flex: 1;
    padding: 15px;
    background: #222;
    border: 1px solid #444;
    border-radius: 8px;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.model-select-btn:hover {
    background: rgba(var(--primary-rgb), 0.1);
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.model-select-btn:hover div:first-child {
    color: var(--primary) !important;
}

.model-select-btn:active {
    transform: translateY(0);
}

#chat-data-modal {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: rgba(0, 0, 0, 0.85);
}

#chat-data-modal .confirm-content {
    will-change: transform, opacity;
}

.chat-data-btn:hover {
    background: rgba(var(--primary-rgb), 0.1) !important;
    border-color: var(--primary) !important;
    color: var(--primary) !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(var(--primary-rgb), 0.15);
}

.data-item {
    background: #0a0a0a;
    padding: 12px;
    border-radius: 6px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 12px;
    border: 1px solid #222;
    transition: all 0.2s ease;
    margin-bottom: 8px;
}

.data-item:hover {
    background: #111;
    border-color: #444;
}

.data-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    border-bottom: 1px solid #222;
    padding-bottom: 4px;
    font-weight: bold;
    color: #ddd;
}

.data-content-row {
    display: flex;
    gap: 10px;
    margin-bottom: 2px;
    line-height: 1.4;
}

.data-label {
    color: #666;
    min-width: 80px;
    flex-shrink: 0;
}

.data-value {
    color: #aaa;
    word-break: break-all;
}

.data-stat-card {
    background: #111;
    border: 1px solid #222;
    border-radius: 8px;
    padding: 15px;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.data-stat-value {
    font-size: 24px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 5px;
}

.data-stat-label {
    font-size: 11px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

.confirm-icon {
    width: 60px;
    height: 60px;
    min-width: 60px;
    min-height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px auto;
    flex-shrink: 0;
    line-height: 0;
}

.confirm-icon svg {
    width: 32px;
    height: 32px;
    display: block;
}

#btn-chat-data-download {
    background: rgba(var(--primary-rgb), 0.1);
    border-color: rgba(var(--primary-rgb), 0.4);
    color: rgba(var(--primary-rgb), 1);
    transition: all 0.2s ease;
}

#btn-chat-data-download:hover {
    background: rgba(var(--primary-rgb), 0.3);
    border-color: rgba(var(--primary-rgb), 0.5);
    color: rgba(var(--primary-rgb), 1);
    box-shadow: 0 0 10px rgba(var(--primary-rgb), 0.7);
    scale: 1.02;
}

#btn-chat-data-close {
    transition: all 0.2s ease;
}

#btn-chat-data-close:hover {
    scale: 1.02;
    box-shadow: 0 0 10px gray
}

.chat-empty-details {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 20px;
    color: #fff;
    animation: fadeIn 0.5s ease;
    overflow: hidden;
}

.chat-empty-avatar-container {
    position: relative;
    margin-bottom: 15px;
}

.chat-empty-avatar {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(var(--primary-rgb), 0.3);
    box-shadow: 0 0 30px rgba(var(--primary-rgb), 0.15);
    transition: transform 0.3s ease, border-color 0.3s ease;
}

.chat-empty-avatar:hover {
    transform: scale(1.05);
    border-color: var(--primary);
}

.chat-empty-name {
    font-size: 24px;
    font-weight: 800;
    margin: 0 0 20px 0;
    background: linear-gradient(135deg, #fff 0%, #aaa 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.5px;
    text-align: center;
}

.chat-empty-tabs {
    display: flex;
    gap: 30px;
    margin-bottom: 15px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    padding-bottom: 0;
    width: 100%;
    max-width: 500px;
    justify-content: center;
    position: relative;
}

.chat-empty-tab {
    background: none;
    border: none;
    color: #555;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    padding: 10px 5px;
    position: relative;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.chat-empty-tab:hover {
    color: #999;
}

.chat-empty-tab.active {
    color: var(--primary);
}

.chat-empty-tab.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--primary);
    box-shadow: 0 -4px 10px rgba(var(--primary-rgb), 0.5);
}

.chat-empty-content-box {
    width: 100%;
    max-width: 600px;
    max-height: 35vh; 
    overflow-y: auto;
    background: transparent;
    padding-right: 10px;
    margin-bottom: 25px;
    scrollbar-width: thin;
    scrollbar-color: #333 transparent;
}

.chat-empty-content-box::-webkit-scrollbar {
    width: 4px;
    height: 4px;
}

.chat-empty-content-box::-webkit-scrollbar-button {
    display: none;
}

.chat-empty-content-box::-webkit-scrollbar-track {
    background: transparent;
}

.chat-empty-content-box::-webkit-scrollbar-thumb {
    background: #222;
    border-radius: 4px;
}

.chat-empty-content-box::-webkit-scrollbar-thumb:hover {
    background: #444;
}

.chat-empty-content-box::-webkit-scrollbar-corner {
    background: transparent;
}

.chat-empty-text {
    color: #aaa;
    font-size: 14px;
    line-height: 1.7;
    margin: 0;
    white-space: pre-wrap;
    text-align: left;
    font-weight: 400;
}

.chat-empty-tags {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
    max-width: 550px;
}

.chat-empty-tag {
    font-size: 10px;
    color: #444;
    border: 1px solid #1a1a1a;
    background: #080808;
    padding: 5px 12px;
    border-radius: 20px;
    font-weight: 600;
    transition: all 0.2s ease;
}

.chat-empty-tag:hover {
    border-color: #333;
    color: #888;
    background: #111;
}

@keyframes slideUpFade {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.chat-empty-content-box, .chat-empty-tags {
    animation: slideUpFade 0.4s ease forwards;
}

.filter-label {
    font-size: 13px;
    font-weight: 600;
    color: #aaa;
    margin-bottom: 8px;
    display: block;
    margin-top: 15px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

#chat-main-category-filter.filter-select {
    width: 100%;
    margin-bottom: 20px;
    padding: 12px 16px;
    background: #151515;
    border: 1px solid #333;
    color: #ccc;
    border-radius: 12px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23666' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

#chat-main-category-filter.filter-select:hover {
    background-color: #1a1a1a;
    border-color: #555;
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0,0,0,0.3);
    color: #fff;
}

#chat-main-category-filter.filter-select:focus {
    border-color: var(--primary);
    background-color: rgba(var(--primary-rgb), 0.05);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.15);
    transform: translateY(-2px);
    color: var(--primary);
}

#chat-main-category-filter.filter-select option {
    background: #1a1a1a;
    color: #ddd;
    padding: 12px;
    border-bottom: 1px solid #222;
}

#custom-main-category-dropdown {
    position: relative;
    width: 100%;
    margin-bottom: 20px;
}

#custom-main-category-trigger {
    width: 100%;
    padding: 12px 16px;
    background: #151515;
    border: 1px solid #333;
    color: #ccc;
    border-radius: 12px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#custom-main-category-trigger::after {
    content: '';
    width: 10px;
    height: 10px;
    border-right: 2px solid #666;
    border-bottom: 2px solid #666;
    transform: rotate(45deg);
    transition: transform 0.3s ease;
    margin-right: 5px;
}

#custom-main-category-dropdown.active #custom-main-category-trigger::after {
    transform: rotate(-135deg);
}

#custom-main-category-trigger:hover {
    background: #1a1a1a;
    border-color: #555;
    color: #fff;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

#custom-main-category-dropdown.active #custom-main-category-trigger {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(var(--primary-rgb), 0.05);
}

#custom-main-category-menu {
    position: absolute;
    top: calc(100% + 5px);
    left: 0;
    width: 100%;
    background: #111;
    border: 1px solid #333;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    max-height: 250px;
    overflow-y: auto;
    padding: 5px;
}

#custom-main-category-dropdown.active #custom-main-category-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.custom-dropdown-option {
    padding: 10px 14px;
    color: #aaa;
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: 8px;
    font-size: 13px;
}

.custom-dropdown-option:hover {
    background: #1f1f1f;
    color: #fff;
    padding-left: 18px;
}

.custom-dropdown-option.active {
    background: rgba(var(--primary-rgb), 0.1);
    color: var(--primary);
    font-weight: 600;
}

#view-image-generator {
    position: relative;
    z-index: 10;
}

@keyframes msgDeleteAnim {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
        max-height: 500px;
        margin-bottom: 10px;
    }
    100% {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
        max-height: 0;
        margin-bottom: 0;
        padding-top: 0;
        padding-bottom: 0;
        border-width: 0;
        overflow: hidden;
    }
}

.msg-deleting {
    animation: msgDeleteAnim 0.5s cubic-bezier(0.19, 1, 0.22, 1) forwards !important;
    pointer-events: none;

}

.image-editor-upload-area {
    width: 100%;
    min-height: 300px;
    background: #0a0a0a;
    border: 2px dashed #333;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    cursor: pointer;
    transition: all 0.3s ease;
    overflow: hidden;
    position: relative;
}

.image-editor-upload-area:hover {
    border-color: #555;
    background: #0f0f0f;
}

.image-editor-upload-area.drag-over {
    border-color: var(--primary);
    background: rgba(var(--primary-rgb), 0.05);
}

#editor-upload-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: #666;
    gap: 10px;
    pointer-events: none;
}

#editor-upload-placeholder svg {
    width: 48px;
    height: 48px;
    opacity: 0.5;
}

#editor-preview-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

#editor-clear-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 30px;
    height: 30px;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    backdrop-filter: blur(4px);
    transition: all 0.2s ease;
}

#editor-clear-btn:hover {
    background: rgba(255, 68, 68, 0.8);
    border-color: #ff4444;
}

.presets-container {
    display: flex;
    gap: 15px;
    overflow-x: auto;
    padding: 10px 5px;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

.presets-container::-webkit-scrollbar {
    height: 6px;
}

.presets-container::-webkit-scrollbar-track {
    background: #0a0a0a;
}

.presets-container::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 3px;
}

.preset-card {
    flex: 0 0 140px;
    aspect-ratio: 1;
    border-radius: 10px;
    position: relative;
    cursor: pointer;
    overflow: hidden;
    border: 1px solid #222;
    transition: all 0.3s ease;
}

.preset-card:hover {
    scale: 1.05;
    border-color: var(--primary);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.preset-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.preset-card:hover img {
    transform: scale(1.05);
}

.preset-name {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 10px;
    background: linear-gradient(to top, rgba(0,0,0,0.9), transparent);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    text-align: center;
    text-shadow: 0 1px 2px rgba(0,0,0,0.8);
    transition: all 0.3s ease;
}

.preset-card:hover .preset-name {
    color: var(--primary);
    text-shadow: 0 0 8px rgba(var(--primary-rgb), 0.8), 0 0 15px rgba(var(--primary-rgb), 0.4);
}

.loading-presets {
    color: #666;
    font-style: italic;
    padding: 20px;
    width: 100%;
    text-align: center;
}

.hidden {
    display: none !important;
}

.generated-image-wrapper {
    position: relative;
    display: inline-block;
    max-width: 100%;
}

.gen-img-actions {
    position: absolute;
    bottom: 10px;
    right: 10px;
    display: flex;
    gap: 8px;
    z-index: 10;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.generated-image-wrapper:hover .gen-img-actions {
    opacity: 1;
}

.img-action-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.img-action-btn:hover {
    background: rgba(var(--primary-rgb), 0.2);
    border-color: rgb(var(--primary-rgb));
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    color: rgb(var(--primary-rgb));
}

.img-action-btn:active {
    transform: translateY(0);
}


.img-action-btn svg {
    width: 16px;
    height: 16px;
}

.chat-screen-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2000;
    background: #000;
    display: none;
    flex-direction: column;
}

.chat-screen-modal.active {
    display: flex;
}

.chat-screen-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
}

.chat-screen-header {
    height: 60px;
    display: flex;
    align-items: center;
    padding: 0 15px;
    border-bottom: 1px solid #222;
    background: #111;
    gap: 10px;
}

.chat-screen-body {
    flex: 1;
    display: flex;
    overflow: hidden;
    position: relative;
    background: #000;
}

.chat-sidebar {
    width: 300px;
    border-right: 1px solid #222;
    display: flex;
    flex-direction: column;
    background: #0a0a0a;
}

.chat-main-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    background: #000;
}

.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
    touch-action: pan-y;
}

.chat-input-area {
    padding: 15px;
    border-top: 1px solid #222;
    background: #111;
}

.chat-input-wrapper {
    position: relative;
    background: #222;
    border-radius: 12px;
    border: 1px solid #333;
    padding: 5px;
}

.chat-message-input {
    width: 100%;
    background: transparent;
    border: none;
    color: #fff;
    padding: 10px;
    padding-right: 60px;
    resize: none;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.5;
    outline: none;
    display: block;
}

.chat-char-counter {
    position: absolute;
    right: 10px;
    bottom: 10px;
    font-size: 10px;
    color: #666;
}

.chat-action-buttons {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 10px;
}

.chat-send-btn, .chat-img-gen-btn {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: var(--primary);
    color: #000;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.chat-send-btn:hover, .chat-img-gen-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(var(--primary-rgb), 0.3);
}

.chat-img-gen-btn {
    background: #222;
    color: #fff;
    border: 1px solid #333;
}

.chat-img-gen-btn:hover {
    border-color: #555;
    background: #333;
}

.chat-back-btn {
    background: transparent;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    transition: background 0.2s;
}

.chat-back-btn:hover {
    background: rgba(255,255,255,0.1);
}

.chat-char-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.chat-char-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.chat-char-name {
    font-weight: 600;
    font-size: 14px;
}

.new-chat-btn {
    background: rgba(var(--primary-rgb), 0.1);
    color: var(--primary);
    border: 1px solid rgba(var(--primary-rgb), 0.2);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all 0.2s ease;
}

.new-chat-btn:hover {
    background: var(--primary);
    color: #000;
}

.sidebar-header {
    padding: 15px;
    border-bottom: 1px solid #222;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    font-weight: 600;
    color: #888;
}

.conversations-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
    touch-action: pan-y;
}

.conversation-item {
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
    margin-bottom: 5px;
    position: relative;
}

.conversation-item:hover {
    background: #151515;
}

.conversation-item.active {
    background: rgba(var(--primary-rgb), 0.1);
    border: 1px solid rgba(var(--primary-rgb), 0.2);
}

.conv-preview {
    font-size: 13px;
    color: #ddd;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-right: 20px;
}

.conv-date {
    font-size: 11px;
    color: #666;
}

.conv-delete-btn {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: #444;
    cursor: pointer;
    padding: 5px;
    opacity: 0;
    transition: all 0.2s;
}

.conversation-item:hover .conv-delete-btn {
    opacity: 1;
}

.conv-delete-btn:hover {
    color: #ff4444;
}

.conv-empty, .conv-loading, .conv-error {
    text-align: center;
    padding: 20px;
    color: #666;
    font-size: 13px;
}

.no-conv-selected {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #444;
    font-size: 14px;
}

.chat-empty-avatar {
    margin-bottom: 15px;
    border: 2px solid #333;
}

.chat-empty-name {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 10px;
    color: #fff;
}

.chat-empty-content-box {
    background: #111;
    border: 1px solid #222;
    border-radius: 12px;
    padding: 15px;
    max-width: 80%;
    margin-bottom: 20px;
    max-height: 150px;
    overflow-y: auto;
    overflow-x: hidden;
    text-align: left;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
    touch-action: pan-y;
}

.chat-empty-text {
    font-size: 13px;
    line-height: 1.6;
    color: #aaa;
    margin: 0;
    white-space: pre-wrap;
}

.chat-empty-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

.chat-empty-tag {
    background: #1a1a1a;
    border: 1px solid #333;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    color: #888;
}

.user-profile-btn {
    background: transparent;
    border: none;
    color: #666;
    cursor: pointer;
    transition: color 0.2s;
}

.user-profile-btn:hover {
    color: #fff;
}

.chat-sidebar-overlay {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9;
    backdrop-filter: blur(2px);
}

.chat-sidebar-overlay.active {
    display: block;
}

@media (max-width: 768px) {
    .chat-sidebar {
        position: absolute;
        left: -100%;
        top: 0;
        height: 100%;
        z-index: 10;
        box-shadow: 5px 0 15px rgba(0,0,0,0.5);
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        display: flex !important;
    }
    
    .chat-sidebar.active {
        left: 0;
    }
    
    .chat-sidebar-mobile-btn {
        display: flex !important;
    }
}

.lightbox-original-preview {
    position: absolute;
    bottom: 20px;
    left: 20px;
    width: 60px;
    height: 60px;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
    z-index: 100;
    transition: transform 0.3s ease;
    cursor: pointer;
}

.lightbox-original-preview:hover {
    transform: scale(1.05);
    border-color: rgba(255, 255, 255, 0.8);
}

.lightbox-original-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

@media (max-width: 768px) {
    .gen-img-actions {
        opacity: 1 !important;
    }
}

#perf-monitor-box {
    position: fixed;
    top: 10px;
    right: 170px;
    background: rgba(0, 0, 0, 0.8);
    border: 1px solid #333;
    border-radius: 8px;
    padding: 10px;
    font-family: monospace;
    font-size: 11px;
    color: var(--primary);
    z-index: 2147483647 !important;
    pointer-events: auto !important;
    backdrop-filter: blur(4px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    min-width: 120px;
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    user-select: none;
    touch-action: none;
    cursor: move;
    overflow: hidden;
}

#perf-monitor-box.visible {
    opacity: 1;
    transform: translateY(0);
}

#perf-monitor-box .perf-content {
    pointer-events: none;
}

#perf-monitor-box .perf-content div {
    display: flex;
    justify-content: space-between;
    margin-bottom: 4px;
    pointer-events: none;
}

#perf-monitor-box .perf-content div:last-child {
    margin-bottom: 0;
}

#perf-monitor-box span.label {
    color: #888;
    margin-right: 10px;
}

#perf-monitor-box .perf-resize-handle {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 18px;
    height: 18px;
    cursor: nwse-resize;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
    touch-action: none;
    opacity: 0.3;
    transition: opacity 0.2s ease, color 0.2s ease;
    color: #888;
    z-index: 10;
}

#perf-monitor-box .perf-resize-handle:hover {
    opacity: 1;
    color: var(--primary);
}

#perf-monitor-box .perf-resize-handle svg {
    width: 10px;
    height: 10px;
    pointer-events: none;
}

#perf-monitor-box.resizing {
    transition: none;
}

#perf-monitor-box.resizing .perf-resize-handle {
    opacity: 1;
    color: var(--primary);
}

.presets-wrapper {
    position: relative;
    width: 100%;
}

.presets-container {
    display: flex;
    gap: 15px;
    overflow-x: auto;
    padding: 10px 5px;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.presets-container::-webkit-scrollbar {
    display: none;
}

.nav-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 100%;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 20;
    opacity: 0; 
    pointer-events: none;
}

.presets-wrapper:hover .nav-arrow {
    opacity: 1;
    pointer-events: auto;
}

.nav-arrow:hover {
    color: var(--primary);
}

.nav-arrow::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    border-radius: inherit;
    opacity: 0;
    transition: opacity 0.3s ease;
    background: rgba(0,0,0,0.3);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.nav-arrow:hover::before {
    opacity: 1;
}

.nav-arrow.left::before {
    -webkit-mask-image: linear-gradient(to right, black 0%, transparent 100%);
    mask-image: linear-gradient(to right, black 0%, transparent 100%);
}

.nav-arrow.right::before {
    -webkit-mask-image: linear-gradient(to left, black 0%, transparent 100%);
    mask-image: linear-gradient(to left, black 0%, transparent 100%);
}

.nav-arrow.left {
    left: 0;
    background: linear-gradient(to right, rgba(0,0,0,0.8) 0%, transparent 100%);
    justify-content: flex-start;
    padding-left: 10px;
    border-top-left-radius: 8px;
    border-bottom-left-radius: 8px;
}

.nav-arrow.right {
    right: 0;
    background: linear-gradient(to left, rgba(0,0,0,0.8) 0%, transparent 100%);
    justify-content: flex-end;
    padding-right: 10px;
    border-top-right-radius: 8px;
    border-bottom-right-radius: 8px;
}

@media (max-width: 768px) {
    .chat-empty-details {
        display: flex;
        flex-direction: column;
        align-items: center;
        width: 100%;
        padding: 0 10px;
        box-sizing: border-box;
    }
    .chat-empty-details > .chat-empty-avatar-container {
        order: 1;
        margin-bottom: 0px;
    }
    .chat-empty-details > .chat-empty-name {
        order: 2;
    }
    .chat-empty-details > .chat-empty-tags {
        order: 3;
        margin-bottom: 10px;
    }
    .chat-empty-details > .chat-empty-content-box {
        order: 4;
        max-height: 40vh;
        margin-bottom: 0px;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
}

#crop-modal .modal-box {
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

#crop-image-target {
    max-width: 100%;
    max-height: 60vh;
    display: block;
}

#crop-modal.active .generate-btn {
    pointer-events: all !important;
    opacity: 1 !important;
}

.cropper-container {
    max-height: 60vh;
}

@media (max-width: 768px) {
    #crop-modal .modal-box {
        padding: 15px;
        width: 95%;
    }
    
    #crop-image-target,
    .cropper-container {
        max-height: 50vh;
    }
}


.border-outer {
  border: 2px solid rgba(72, 87, 221, 0.5);
  border-radius: 24px;
  padding-right: 4px;
  padding-bottom: 4px;
}

.main-card {
  border-radius: 24px;
  border: 2px solid var(--electric-border-color);
  margin-top: -4px;
  margin-left: -4px;
  filter: url(#turbulent-displace);
}

.glow-layer-1 {
  border: 2px solid rgba(221, 132, 72, 0.6);
  border-radius: 24px;
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  filter: blur(1px);
}

.glow-layer-2 {
  border: 2px solid var(--electric-light-color);
  border-radius: 24px;
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  filter: blur(4px);
}

@keyframes suggest-pulse-glow {
    0% {
        box-shadow: 0 0 5px rgba(var(--primary-rgb), 0.2), inset 0 0 5px rgba(var(--primary-rgb), 0.2);
        transform: translateZ(0) scale(1);
        border-color: rgba(var(--primary-rgb), 0.4);
        filter: brightness(1.3);
    }

    50% {
        box-shadow: 0 0 15px rgba(var(--primary-rgb), 0.6), inset 0 0 15px var(--primary);
        transform: translateZ(0) scale(1.02);
        border-color: var(--primary);
        filter: brightness(2.2);
    }

    100% {
        box-shadow: 0 0 5px rgba(var(--primary-rgb), 0.2), inset 0 0 5px rgba(var(--primary-rgb), 0.2);
        transform: translateZ(0) scale(1);
        border-color: rgba(var(--primary-rgb), 0.4);
        filter: brightness(1.3);
    }
}

.model-suggest-blink {
    animation: suggest-pulse-glow 1.5s infinite ease-in-out !important;
    z-index: 10;
    border: 2px solid var(--primary) !important;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    transform-style: preserve-3d;
    will-change: transform, box-shadow, border-color;
    position: relative;
    opacity: 1 !important;
}

.crop-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(6px);
    align-items: center;
    justify-content: center;
}
.crop-modal-overlay.active {
    display: flex;
}
.crop-modal-container {
    background: #111;
    border: 1px solid #2a2a2a;
    border-radius: 16px;
    width: min(92vw, 760px);
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 24px 60px rgba(0,0,0,0.7);
}
.crop-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #1e1e1e;
}
.crop-modal-title {
    font-size: 15px;
    font-weight: 600;
    color: #fff;
    letter-spacing: 0.3px;
}
.crop-modal-close {
    background: transparent;
    border: none;
    color: #888;
    font-size: 22px;
    cursor: pointer;
    line-height: 1;
    padding: 0 4px;
    transition: color 0.2s;
}
.crop-modal-close:hover { color: #fff; }
.crop-modal-body {
    flex: 1;
    overflow: auto;
    padding: 16px;
    background: #0a0a0a;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
}
.crop-modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding: 14px 20px;
    border-top: 1px solid #1e1e1e;
}
.crop-btn {
    padding: 9px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid transparent;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
}
.crop-btn-cancel {
    background: #1a1a1a;
    color: #aaa;
    border-color: #2a2a2a;
}
.crop-btn-cancel:hover { background: #222; color: #fff; border-color: #444; }
.crop-btn-apply {
    background: var(--primary, #7c6aff);
    color: #fff;
    border-color: transparent;
}
.crop-btn-apply:hover { filter: brightness(1.15); }

.plasma-base-glow, .plasma-trail-1, .plasma-trail-2, .plasma-trail-3, .plasma-spark, .plasma-corner, 
.flag-item::before, .glitch-text, .confetti, .glow-layer-1, .glow-layer-2,
.model-suggest-blink::after, .img-gen-badge::after, .storyIconGlow, .emotion-icon,
#magic-wand-btn.loading::after, #random-prompt-btn.loading::after {
    will-change: transform, opacity;
    transform: translateZ(0); 
    backface-visibility: hidden;
}
.message-bubble[class*="emotion-"] {
    animation: none !important; 
    position: relative;
    z-index: 1;
}
.message-bubble[class*="emotion-"]:not(.emotion-in-view)::before {
    animation-play-state: paused !important;
}
.message-bubble[class*="emotion-"]::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    box-shadow: 0 0 15px var(--emotion-color), inset 0 0 5px var(--emotion-color);
    animation: gpu-opacity-pulse 5s cubic-bezier(0.4, 0, 0.6, 1) infinite;
    pointer-events: none;
    z-index: -1;
    will-change: opacity;
    transform: translateZ(0);
}
#magic-wand-btn.loading, #random-prompt-btn.loading {
    animation: none !important;
    box-shadow: none !important;
}
#magic-wand-btn.loading::after, #random-prompt-btn.loading::after {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    border: 2px solid rgba(0, 255, 136, 0.8);
    animation: gpu-scale-fade 1.5s infinite;
    will-change: transform, opacity;
    transform: translateZ(0);
    pointer-events: none;
}
.img-gen-badge {
    animation: none !important;
    position: relative;
    box-shadow: 0 2px 10px rgba(0, 255, 136, 0.4);
}
.img-gen-badge::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    box-shadow: 0 2px 15px rgba(0, 255, 136, 0.8);
    animation: gpu-opacity-pulse 2s ease-in-out infinite alternate;
    will-change: opacity;
    transform: translateZ(0);
    z-index: -1;
    pointer-events: none;
}
.model-suggest-blink {
    animation: none !important;
    box-shadow: 0 0 5px rgba(var(--primary-rgb), 0.2), inset 0 0 5px rgba(var(--primary-rgb), 0.2) !important;
    border-color: rgba(var(--primary-rgb), 0.4) !important;
}
.model-suggest-blink::after {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: inherit;
    box-shadow: 0 0 15px rgba(var(--primary-rgb), 0.6), inset 0 0 15px var(--primary);
    border: 2px solid var(--primary);
    animation: gpu-opacity-pulse 1.5s infinite ease-in-out alternate;
    will-change: opacity;
    transform: translateZ(0);
    z-index: -1;
    pointer-events: none;
}
#moderation-btn:hover .icon-high, #editor-moderation-btn:hover .icon-high {
    animation: gpu-scale-pulse 1.5s ease-in-out infinite alternate;
    filter: none !important;
}
#moderation-btn:hover .icon-high::after, #editor-moderation-btn:hover .icon-high::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    box-shadow: 0 0 8px rgba(0,255,136,0.8);
    animation: gpu-opacity-pulse 1.5s ease-in-out infinite alternate;
    opacity: 0.5;
}
@keyframes gpu-opacity-pulse {
    0%   { opacity: 0.4; transform: translateZ(0); }
    100% { opacity: 1; transform: translateZ(0); }
}
@keyframes gpu-scale-fade {
    0%   { transform: scale(1) translateZ(0); opacity: 0.8; }
    100% { transform: scale(1.4) translateZ(0); opacity: 0; }
}
@keyframes gpu-scale-pulse {
    0%   { transform: translate(-50%, -50%) scale(1.15) translateZ(0); }
    100% { transform: translate(-50%, -50%) scale(1.25) translateZ(0); }
}
.out-of-view,
.out-of-view::before,
.out-of-view::after,
.out-of-view .plasma-base-glow,
.out-of-view .plasma-trail-1,
.out-of-view .plasma-trail-2,
.out-of-view .plasma-trail-3,
.out-of-view .plasma-spark,
.out-of-view .plasma-corner,
.out-of-view .flag-item::before,
.out-of-view .glitch-text,
.out-of-view .confetti,
.out-of-view .glow-layer-1,
.out-of-view .glow-layer-2,
.out-of-view .bg-exclusive,
.out-of-view svg,
.out-of-view svg *,
.out-of-view .mod-icon .icon-high,
.out-of-view .mod-icon .icon-medium,
.out-of-view .mod-icon .icon-low,
.out-of-view .img-gen-badge,
.out-of-view .img-gen-badge::after,
.out-of-view .model-suggest-blink,
.out-of-view .model-suggest-blink::after,
.out-of-view .emotion-icon,
.out-of-view .storyIconGlow,
.out-of-view .story-finished-content,
.out-of-view .char-card-bg {
    animation-play-state: paused !important;
}

.elements-selected-container {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: stretch;
    padding: 4px 0;
    min-height: 90px;
}

.element-add-card {
    width: 80px;
    min-height: 80px;
    background: #0a0a0a;
    border: 1.5px dashed #2a2a2a;
    border-radius: 10px;
    color: #444;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
}

.element-add-card:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(var(--primary-rgb), 0.06);
    box-shadow: 0 0 16px rgba(var(--primary-rgb), 0.12);
    transform: scale(1.04);
}

.element-add-card svg {
    transition: transform 0.3s ease;
}

.element-add-card:hover svg {
    transform: rotate(90deg) scale(1.1);
}

.element-selected-chip {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    width: 80px;
    min-height: 80px;
    border-radius: 10px;
    overflow: hidden;
    border: 1.5px solid rgba(var(--primary-rgb), 0.5);
    background: #111;
    box-shadow: 0 4px 14px rgba(0,0,0,0.4);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    animation: element-chip-in 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    flex-shrink: 0;
}

@keyframes element-chip-in {
    from { opacity: 0; transform: scale(0.7); }
    to   { opacity: 1; transform: scale(1);   }
}

.element-selected-chip:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.5), 0 0 12px rgba(var(--primary-rgb), 0.2);
}

.element-chip-thumb-wrapper {
    width: 100%;
    height: 56px;
    overflow: hidden;
    flex-shrink: 0;
}

.element-chip-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.element-chip-name {
    font-size: 9px;
    font-weight: 600;
    color: #ccc;
    text-align: center;
    padding: 3px 4px;
    line-height: 1.2;
    word-break: break-word;
    overflow: hidden;
    max-height: 24px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    flex: 1;
}

.element-chip-remove {
    position: absolute;
    top: 3px;
    right: 3px;
    width: 18px;
    height: 18px;
    background: rgba(0,0,0,0.7);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 50%;
    color: #aaa;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    backdrop-filter: blur(4px);
    z-index: 5;
}

.element-chip-remove:hover {
    background: rgba(255, 60, 60, 0.7);
    border-color: rgba(255, 80, 80, 0.5);
    color: #fff;
    transform: scale(1.15);
}

.elements-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.75);
    backdrop-filter: blur(8px);
    z-index: 50000;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    overflow-y: auto;
    padding: 20px;
}

.elements-modal-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.elements-modal {
    background: #0d0d0d;
    border: 1px solid #1e1e1e;
    border-radius: 16px;
    width: 100%;
    max-width: 860px;
    min-height: 500px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 30px 80px rgba(0,0,0,0.9);
    transform: translateY(20px) scale(0.97);
    transition: transform 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    margin: auto;
}

.elements-modal-overlay.active .elements-modal {
    transform: translateY(0) scale(1);
}

.elements-modal-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 18px;
    border-bottom: 1px solid #1a1a1a;
    flex-shrink: 0;
    background: #0d0d0d;
    position: sticky;
    top: 0;
    z-index: 5;
}

.elements-search-bar {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    background: #141414;
    border: 1px solid #252525;
    border-radius: 10px;
    padding: 10px 14px;
    transition: border-color 0.2s ease;
}

.elements-search-bar:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(var(--primary-rgb), 0.1);
}

.elements-search-icon {
    flex-shrink: 0;
    color: #555;
}

.elements-search-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: #fff;
    font-size: 14px;
    font-family: inherit;
}

.elements-search-input::placeholder {
    color: #555;
}

.elements-nsfw-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 14px;
    background: #141414;
    border: 1px solid #252525;
    border-radius: 10px;
    color: #666;
    cursor: pointer;
    font-size: 12px;
    font-weight: 700;
    font-family: inherit;
    transition: all 0.25s ease;
    flex-shrink: 0;
    letter-spacing: 0.5px;
}

.elements-nsfw-toggle:hover {
    border-color: #444;
    color: #ccc;
}

.elements-nsfw-toggle.active {
    background: rgba(255, 80, 80, 0.1);
    border-color: rgba(255, 80, 80, 0.5);
    color: #ff5555;
    box-shadow: 0 0 12px rgba(255, 80, 80, 0.15);
}

.elements-close-btn {
    width: 38px;
    height: 38px;
    background: #141414;
    border: 1px solid #252525;
    border-radius: 10px;
    color: #555;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.elements-close-btn:hover {
    background: #222;
    border-color: #444;
    color: #fff;
}

.elements-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 18px;
}

.elements-modal-body::-webkit-scrollbar {
    width: 6px;
}

.elements-modal-body::-webkit-scrollbar-track {
    background: transparent;
}

.elements-modal-body::-webkit-scrollbar-thumb {
    background: #2a2a2a;
    border-radius: 6px;
}

.elements-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 14px;
}

.element-grid-card {
    background: #0f0f0f;
    border: 1px solid #1e1e1e;
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    display: flex;
    flex-direction: column;
    animation: element-card-in 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
}

@keyframes element-card-in {
    from { opacity: 0; transform: scale(0.92) translateY(6px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

.element-grid-card:hover {
    border-color: var(--primary);
    transform: translateY(-6px) scale(1.02);
    box-shadow: 0 16px 40px rgba(0,0,0,0.5), 0 0 16px rgba(var(--primary-rgb), 0.12);
}

.element-grid-card.selected {
    border-color: var(--primary);
    box-shadow: 0 0 20px rgba(var(--primary-rgb), 0.3), inset 0 0 10px rgba(var(--primary-rgb), 0.05);
}

.element-grid-card.dimmed {
    opacity: 0.45;
    cursor: not-allowed;
}

.element-grid-card.dimmed::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(1.5px);
    border-radius: inherit;
    z-index: 10;
    pointer-events: none;
    transition: background 0.25s ease;
}

.element-grid-card.dimmed:hover::after {
    background: rgba(0, 0, 0, 0.65);
}

@keyframes element-shake-anim {
    0%   { transform: translateX(0)    scale(1); }
    15%  { transform: translateX(-7px) scale(1.015); }
    30%  { transform: translateX(6px)  scale(0.99); }
    45%  { transform: translateX(-5px) scale(1.01); }
    60%  { transform: translateX(4px)  scale(1); }
    75%  { transform: translateX(-3px); }
    88%  { transform: translateX(2px); }
    100% { transform: translateX(0); }
}

.element-grid-card.element-shake {
    animation: element-shake-anim 0.42s cubic-bezier(0.36, 0.07, 0.19, 0.97) both !important;
}


.element-grid-thumb-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: #0a0a0a;
}

.element-grid-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.35s ease;
}

.element-grid-card:hover .element-grid-thumb {
    transform: scale(1.08);
}

.element-quick-add-btn {
    position: absolute;
    bottom: 7px;
    right: 7px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(6px);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    opacity: 0;
    transform: scale(0.7);
    transition: opacity 0.2s ease, transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275),
                background 0.2s ease, color 0.2s ease;
    z-index: 5;
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

.element-quick-add-btn svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.element-grid-card:hover .element-quick-add-btn {
    opacity: 1;
    transform: scale(1);
}

.element-quick-add-btn:hover {
    background: var(--primary);
    color: #000;
    transform: scale(1.15) !important;
    box-shadow: 0 4px 14px rgba(var(--primary-rgb), 0.45);
}

.element-quick-add-btn.selected {
    background: var(--primary);
    color: #000;
    opacity: 1;
    transform: scale(1);
}

.element-quick-add-btn.selected:hover {
    background: #ff4444;
    color: #fff;
    box-shadow: 0 4px 14px rgba(255, 68, 68, 0.4);
}

@media (max-width: 600px) {
    .element-quick-add-btn {
        opacity: 1 !important;
        transform: scale(1) !important;
    }
}

.element-grid-nsfw-tag {
    position: absolute;
    top: 6px;
    left: 6px;
    background: rgba(255, 60, 60, 0.85);
    color: #fff;
    font-size: 9px;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 4px;
    letter-spacing: 0.5px;
    backdrop-filter: blur(4px);
}

.element-grid-selected-overlay {
    position: absolute;
    inset: 0;
    background: rgba(var(--primary-rgb), 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
}

.element-grid-selected-overlay svg {
    width: 32px;
    height: 32px;
    color: var(--primary);
    filter: drop-shadow(0 0 8px rgba(var(--primary-rgb), 0.7));
}

.element-grid-info {
    padding: 10px 10px 10px;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.element-grid-name {
    font-size: 12px;
    font-weight: 700;
    color: #ddd;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
    text-align: right;
}

.element-grid-desc {
    font-size: 10px;
    color: #666;
    font-style: italic;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-align: right;
}

.elements-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 60px 0;
    color: #555;
    font-size: 14px;
}

.elements-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #222;
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: el-spin 0.8s linear infinite;
}

@keyframes el-spin {
    to { transform: rotate(360deg); }
}

.elements-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 60px 0;
    color: #555;
    font-size: 14px;
}

.element-detail-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.75);
    backdrop-filter: blur(6px);
    z-index: 51000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
    padding: 20px;
}

.element-detail-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.element-detail-card {
    background: #111;
    border: 1px solid #222;
    border-radius: 16px;
    max-width: 460px;
    width: 100%;
    display: flex;
    flex-direction: row;
    overflow: hidden;
    box-shadow: 0 25px 70px rgba(0,0,0,0.9);
    transform: scale(0.92) translateY(12px);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
}

.element-detail-overlay.active .element-detail-card {
    transform: scale(1) translateY(0);
}

.element-detail-close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(0,0,0,0.5);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 8px;
    color: #666;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 10;
    backdrop-filter: blur(4px);
}

.element-detail-close:hover {
    border-color: #555;
    color: #fff;
    background: rgba(255,255,255,0.1);
}

.element-detail-thumb-wrapper {
    width: 160px;
    min-height: 160px;
    height: auto;
    align-self: stretch;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
    background: #0a0a0a;
}

.element-detail-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.element-detail-nsfw-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background: rgba(255, 50, 50, 0.9);
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    padding: 3px 7px;
    border-radius: 5px;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
}

.element-detail-info {
    flex: 1;
    padding: 22px 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
}

.element-detail-name {
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    margin: 0;
    line-height: 1.2;
    word-break: break-word;
    padding-right: 24px;
}

.element-detail-desc {
    font-size: 13px;
    color: #888;
    margin: 0;
    line-height: 1.55;
    flex: 1;
}

.element-detail-id-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: #0a0a0a;
    border: 1px solid #1e1e1e;
    border-radius: 8px;
}

.element-detail-id-label {
    font-size: 10px;
    font-weight: 700;
    color: #555;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    white-space: nowrap;
}

.element-detail-id {
    font-size: 11px;
    color: var(--primary);
    font-family: monospace;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.element-use-btn {
    width: 100%;
    padding: 12px;
    background: rgba(var(--primary-rgb), 0.1);
    border: 1px solid rgba(var(--primary-rgb), 0.3);
    border-radius: 10px;
    color: var(--primary);
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    margin-top: auto;
}

.element-use-btn:hover:not(:disabled) {
    background: var(--primary);
    color: #000;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(var(--primary-rgb), 0.4);
}

.element-use-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.element-use-btn.selected {
    background: rgba(var(--primary-rgb), 0.2);
    border-color: var(--primary);
}

@media (max-width: 600px) {
    .elements-modal-overlay {
        padding: 0;
        align-items: flex-end;
    }

    .elements-modal {
        border-radius: 18px 18px 0 0;
        min-height: 75vh;
        max-height: 92vh;
        width: 100%;
        max-width: 100%;
        margin: 0;
        display: flex;
        flex-direction: column;
        transform: translateY(40px) scale(1);
    }

    .elements-modal-overlay.active .elements-modal {
        transform: translateY(0) scale(1);
    }

    .elements-modal-header {
        flex-wrap: wrap;
        padding: 12px 14px;
        gap: 8px;
    }

    .elements-search-bar {
        flex: 1 1 100%;
        order: 1;
        padding: 9px 12px;
    }

    .elements-nsfw-toggle {
        order: 2;
        flex: 1;
        justify-content: center;
        padding: 9px 10px;
        font-size: 11px;
    }

    .elements-close-btn {
        order: 3;
        flex-shrink: 0;
        width: 40px;
        height: 40px;
    }

    .elements-modal-body {
        flex: 1;
        overflow-y: auto;
        padding: 12px;
        -webkit-overflow-scrolling: touch;
    }

    .elements-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .element-detail-overlay {
        padding: 0;
        align-items: flex-end;
    }

    .element-detail-card {
        flex-direction: column;
        max-width: 100%;
        width: 100%;
        border-radius: 18px 18px 0 0;
        max-height: 90vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .element-detail-thumb-wrapper {
        width: 100%;
        height: auto;
        aspect-ratio: 1 / 1;
    }

    .element-detail-info {
        padding: 16px;
    }

    .element-detail-name {
        font-size: 16px;
    }

    .elements-selected-container {
        min-height: 70px;
    }

    .element-add-card,
    .element-selected-chip {
        width: 70px;
        min-height: 70px;
    }

    .element-chip-thumb-wrapper {
        height: 46px;
    }
}

@media (max-width: 380px) {
    .elements-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }


    .elements-modal-header {
        padding: 10px 10px;
    }

    .elements-search-input {
        font-size: 13px;
    }
}

.elements-info-card {
    background: #111;
    border: 1px solid rgba(var(--primary-rgb), 0.4);
    border-radius: 16px;
    padding: 28px 24px 24px;
    width: 360px;
    max-width: 92vw;
    position: relative;
    transform: scale(0.93) translateY(12px);
    transition: transform 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 24px 60px rgba(0,0,0,0.85), 0 0 0 1px rgba(var(--primary-rgb), 0.08);
}

.feature-modal.active .elements-info-card {
    transform: scale(1) translateY(0);
}

#close-elements-info-modal {
    position: absolute;
    right: 14px;
    top: 12px;
    background: none;
    border: none;
    color: #555;
    font-size: 22px;
    cursor: pointer;
    line-height: 1;
    padding: 2px 6px;
    border-radius: 6px;
    transition: color 0.2s, background 0.2s;
}

#close-elements-info-modal:hover {
    color: #fff;
    background: rgba(255,255,255,0.08);
}

.elements-info-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 16px;
}

.elements-info-icon-wrap {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: rgba(var(--primary-rgb), 0.12);
    border: 1px solid rgba(var(--primary-rgb), 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    flex-shrink: 0;
}

.elements-info-title {
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    margin: 0 0 3px;
}

.elements-info-subtitle {
    font-size: 11px;
    color: rgba(var(--primary-rgb), 0.8);
    margin: 0;
    font-weight: 500;
    letter-spacing: 0.3px;
}

.elements-info-desc {
    font-size: 13px;
    color: #888;
    line-height: 1.65;
    margin: 0 0 20px;
    padding-bottom: 18px;
    border-bottom: 1px solid #1e1e1e;
}

.elements-info-desc strong {
    color: var(--primary);
    font-weight: 600;
}

.elements-info-items {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.elements-info-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.elinfo-item-icon {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: rgba(255,255,255,0.04);
    border: 1px solid #222;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    flex-shrink: 0;
    margin-top: 1px;
}

.elinfo-item-title {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #ddd;
    margin-bottom: 3px;
}

.elinfo-item-desc {
    display: block;
    font-size: 12px;
    color: #666;
    line-height: 1.5;
}

#btn-elements-info {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #666;
    background: rgba(255, 255, 255, 0.05);
    cursor: pointer;
    padding: 0;
    flex-shrink: 0;
    transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease,
                transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275),
                box-shadow 0.2s ease;
}

#btn-elements-info:hover {
    color: var(--primary);
    border-color: var(--primary);
    background: rgba(var(--primary-rgb), 0.15);
    transform: scale(1.2) rotate(15deg);
    box-shadow: 0 0 8px rgba(var(--primary-rgb), 0.35);
}

#btn-elements-info:active {
    transform: scale(1.05) rotate(0deg);
}

#btn-elements-info svg {
    transition: transform 0.2s ease;
}
