/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

.carousel-container { display: none; }
.carousel-menu-btn { display: none; }

:root {
    /* Light Mode Colors */
    --bg-primary: #f8f9fa;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f1f3f4;
    --text-primary: #333333;
    --text-secondary: #7f8c8d;
    --text-muted: #95a5a6;
    --accent-primary: #3498db;
    --accent-secondary: #2980b9;
    --accent-success: #27ae60;
    --accent-danger: #e74c3c;
    --accent-warning: #f39c12;
    --border-color: #ecf0f1;
    --shadow-light: rgba(0, 0, 0, 0.1);
    --shadow-medium: rgba(0, 0, 0, 0.15);
    --shadow-heavy: rgba(0, 0, 0, 0.25);
    
    /* Dark Mode Colors */
    --dark-bg-primary: #0a0a0a;
    --dark-bg-secondary: #1a1a1a;
    --dark-bg-tertiary: #2a2a2a;
    --dark-text-primary: #ffffff;
    --dark-text-secondary: #b0b0b0;
    --dark-text-muted: #888888;
    --dark-accent-primary: #00d4ff;
    --dark-accent-secondary: #0099cc;
    --dark-accent-success: #00ff88;
    --dark-accent-danger: #ff4757;
    --dark-accent-warning: #ffa500;
    --dark-border-color: #333333;
    --dark-shadow-light: rgba(0, 255, 255, 0.1);
    --dark-shadow-medium: rgba(0, 255, 255, 0.2);
    --dark-shadow-heavy: rgba(0, 255, 255, 0.3);
    --dark-glow: 0 0 20px rgba(0, 212, 255, 0.3);
    --dark-glow-strong: 0 0 30px rgba(0, 212, 255, 0.5);
}

body {
    font-family: 'Space Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background:
        radial-gradient(circle at 20% 20%, rgba(99, 135, 255, 0.25), transparent 35%),
        radial-gradient(circle at 80% 0%, rgba(255, 99, 146, 0.22), transparent 35%),
        radial-gradient(circle at 50% 90%, rgba(77, 255, 181, 0.25), transparent 30%),
        linear-gradient(135deg, #0f172a 0%, #101727 28%, #0a2344 60%, #0b1629 100%);
    background-size: 240% 240%;
    animation: bgShift 26s ease-in-out infinite;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow-x: hidden;
}

/* ------------------------------------------------------------
   ECO MODE
   - Auto-enabled for low-end / laggy devices (via WebSocket)
   - Cuts expensive effects (animations, backdrop blur, Vanta, flying media, YT background)
   ------------------------------------------------------------ */
body.eco-mode {
    animation: none !important;
    background-size: auto !important;
}
body.eco-mode::after {
    display: none !important;
}
body.eco-mode .bg-parallax {
    display: none !important;
}
body.eco-mode .yt-background {
    display: none !important;
}
body.eco-mode .flying-media-item {
    display: none !important;
}
body.eco-mode * {
    transition: none !important;
    animation: none !important;
}
body.eco-mode .modal,
body.eco-mode .admin-presence-panel,
body.eco-mode .content-notification,
body.eco-mode .container,
body.eco-mode .header,
body.eco-mode .upload-section,
body.eco-mode .gallery-item,
body.eco-mode .media-modal-content {
    backdrop-filter: none !important;
    box-shadow: none !important;
}

html, body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

body::after {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    background: radial-gradient(circle at 15% 20%, rgba(255,255,255,0.08), transparent 30%),
                radial-gradient(circle at 80% 15%, rgba(255,255,255,0.06), transparent 30%),
                radial-gradient(circle at 60% 80%, rgba(255,255,255,0.07), transparent 28%);
    mix-blend-mode: screen;
    z-index: -1;
}

.bg-parallax {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    /* Keep parallax behind the YouTube background layer */
    z-index: -4;
}

/* YouTube background layer (admin broadcast) */
.yt-background {
    position: fixed;
    inset: 0;
    pointer-events: none;
    /* Above parallax, below flying media + gallery */
    z-index: -2;
    overflow: hidden;
    opacity: 0;
    transition: opacity 300ms ease;
}
.yt-background.is-on {
    opacity: 0.55;
}
.yt-background .yt-wrap {
    position: absolute;
    inset: 0;
    overflow: hidden;
}
/* Cover screen with a 16:9 iframe (simple oversized approach) */
.yt-background iframe {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border: 0;
    /* True "cover" sizing (avoid letterboxing on mobile + address bar issues) */
    width: max(100vw, calc(100vh * 16 / 9));
    height: max(100vh, calc(100vw * 9 / 16));
}
@supports (height: 100dvh) {
    .yt-background iframe {
        width: max(100dvw, calc(100dvh * 16 / 9));
        height: max(100dvh, calc(100dvw * 9 / 16));
    }
}

/* Video Takeover overlay (fullscreen for guests) */
.video-takeover-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: #000;
    display: none;
    opacity: 0;
    transition: opacity 400ms ease;
}
.video-takeover-overlay.is-active {
    display: flex;
    opacity: 1;
}
/* Chrome Android specific fixes */
.video-takeover-overlay {
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    touch-action: none;
}
/* Prevent scrolling and hide content when video takeover is active */
body.video-takeover-active {
    overflow: hidden !important;
    height: 100vh !important;
    height: 100dvh !important;
}
body.video-takeover-active > *:not(.video-takeover-overlay):not(.modal):not(#loginModal):not(script):not(style):not(link) {
    visibility: hidden !important;
    pointer-events: none !important;
}
/* Ensure login modal appears above video takeover when opened */
body.video-takeover-active #loginModal {
    z-index: 100000 !important;
}
.video-takeover-content {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}
.video-takeover-video {
    flex: 1;
    position: relative;
    overflow: hidden;
}
.video-takeover-video iframe {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border: 0;
    width: max(100vw, calc(100vh * 16 / 9));
    height: max(100vh, calc(100vw * 9 / 16));
}
@supports (height: 100dvh) {
    .video-takeover-video iframe {
        width: max(100dvw, calc(100dvh * 16 / 9));
        height: max(100dvh, calc(100dvw * 9 / 16));
    }
}
.video-takeover-admin-access {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    display: flex;
    justify-content: center;
    gap: 12px;
    padding: 12px 20px;
    background: linear-gradient(145deg, rgba(0,0,0,0.7), rgba(0,0,0,0.5));
    border-radius: 16px;
    border: 1px solid rgba(0, 212, 255, 0.25);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}
.video-takeover-admin-access .btn {
    font-size: 1rem;
    padding: 12px 24px;
    display: flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #00d4ff 0%, #0099cc 100%);
    color: #000;
    font-weight: 600;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 15px rgba(0, 212, 255, 0.35);
}
.video-takeover-admin-access .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 212, 255, 0.5);
    background: linear-gradient(135deg, #00e5ff 0%, #00aadd 100%);
}
.video-takeover-admin-access .btn.btn-secondary {
    background: linear-gradient(135deg, #9b59b6 0%, #8e44ad 100%);
    color: #fff;
    box-shadow: 0 4px 15px rgba(155, 89, 182, 0.35);
}
.video-takeover-admin-access .btn.btn-secondary:hover {
    box-shadow: 0 6px 20px rgba(155, 89, 182, 0.5);
    background: linear-gradient(135deg, #a66bbe 0%, #9b59b6 100%);
}
.video-takeover-admin-access .btn.btn-ai-chat {
    background: linear-gradient(135deg, #7c3aed 0%, #a855f7 100%);
    color: #fff;
    box-shadow: 0 4px 15px rgba(124, 58, 237, 0.4);
    text-decoration: none;
}
.video-takeover-admin-access .btn.btn-ai-chat:hover {
    box-shadow: 0 6px 20px rgba(124, 58, 237, 0.6);
    background: linear-gradient(135deg, #8b5cf6 0%, #c084fc 100%);
}
.video-takeover-admin-access .btn i {
    font-size: 1.1rem;
}

/* Click blocker - covers YouTube iframe, tap anywhere to unmute */
.video-takeover-click-blocker {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 5;
    cursor: default;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* When muted, show pointer cursor to indicate tappable */
.video-takeover-click-blocker.muted {
    cursor: pointer;
}

/* Tap hint shown when muted */
.video-takeover-tap-hint {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 24px 40px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 16px;
    border: 2px solid rgba(39, 174, 96, 0.5);
    color: #fff;
    font-size: 1.1rem;
    font-weight: 500;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    animation: pulse-hint 2s ease-in-out infinite;
    pointer-events: none;
}

.video-takeover-tap-hint i {
    font-size: 2.5rem;
    color: #27ae60;
}

@keyframes pulse-hint {
    0%, 100% { 
        transform: scale(1);
        box-shadow: 0 4px 20px rgba(39, 174, 96, 0.4);
    }
    50% { 
        transform: scale(1.02);
        box-shadow: 0 4px 30px rgba(39, 174, 96, 0.6);
    }
}

/* Playlist info bar on video takeover */
.video-takeover-playlist-info {
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    background: rgba(0, 0, 0, 0.75);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: 0.95rem;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    max-width: 90%;
}

.video-takeover-playlist-info .playlist-track {
    background: linear-gradient(135deg, #9b59b6, #8e44ad);
    padding: 4px 10px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.85rem;
}

.video-takeover-playlist-info .playlist-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 300px;
}

/* Admin panel tabs for video takeover */
.video-takeover-tabs {
    margin: 15px 0;
}

.video-takeover-tabs .tab-header {
    display: flex;
    gap: 5px;
    margin-bottom: 15px;
}

.video-takeover-tabs .tab-btn {
    flex: 1;
    padding: 10px 15px;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: inherit;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9rem;
}

.video-takeover-tabs .tab-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.video-takeover-tabs .tab-btn.active {
    background: linear-gradient(135deg, #9b59b6, #8e44ad);
    color: #fff;
}

.video-takeover-tabs .tab-content {
    display: none;
}

.video-takeover-tabs .tab-content.active {
    display: block;
}

/* Playlist controls in admin panel */
.playlist-controls {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 15px;
    padding: 12px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
}

.playlist-controls .btn {
    padding: 10px 20px;
}

/* Admin status styling */
#videoTakeoverStatus .status-on {
    color: #27ae60;
    font-weight: 600;
}

#videoTakeoverStatus .status-track {
    font-size: 0.9rem;
    opacity: 0.9;
}

#videoTakeoverStatus .status-info {
    font-size: 0.85rem;
    opacity: 0.7;
}

/* YouTube player container in takeover */
#videoTakeoverPlayerContainer {
    width: 100%;
    height: 100%;
}

#videoTakeoverPlayerContainer iframe,
#videoTakeoverYTPlayer {
    width: 100%;
    height: 100%;
    border: none;
}

/* Video takeover buttons - mobile responsive */
@media (max-width: 680px) {
    .video-takeover-admin-access {
        flex-wrap: wrap;
        max-width: 90vw;
        padding: 10px 14px;
        gap: 8px;
    }
    .video-takeover-admin-access .btn {
        font-size: 0.85rem;
        padding: 10px 16px;
    }
}

/* LiveKit modal */
.livekit-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}
.livekit-controls {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}
.livekit-controls .btn {
    white-space: nowrap;
}

/* LiveKit "user joined" toast stack (inside modal) */
.livekit-join-toasts {
    position: absolute;
    top: 140px;
    right: 22px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 1100;
    pointer-events: none;
}
.livekit-join-toast {
    width: min(360px, 86vw);
    border-radius: 16px;
    padding: 12px 14px;
    background: linear-gradient(145deg, rgba(0,0,0,0.55), rgba(0,0,0,0.35));
    border: 1px solid rgba(0, 212, 255, 0.30);
    box-shadow: 0 14px 35px rgba(0,0,0,0.35), 0 0 26px rgba(0,212,255,0.18);
    backdrop-filter: blur(10px);
    color: inherit;
    overflow: hidden;
    transform: translateY(-6px);
    opacity: 0;
    animation: lkJoinToastIn 280ms cubic-bezier(0.2, 0.9, 0.2, 1) forwards;
}
.livekit-join-toast .title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 13px;
    letter-spacing: 0.2px;
    opacity: 0.95;
    margin-bottom: 6px;
}
.livekit-join-toast .title i {
    color: var(--dark-accent-primary);
    filter: drop-shadow(0 0 10px rgba(0, 212, 255, 0.45));
}
.livekit-join-toast .msg {
    font-size: 13px;
    line-height: 1.25;
    opacity: 0.95;
}
.livekit-join-toast .msg strong {
    color: #fff;
    text-shadow: 0 0 10px rgba(0, 212, 255, 0.25);
}
.livekit-join-toast::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    height: 3px;
    width: 100%;
    background: linear-gradient(90deg, rgba(0,212,255,0.0), rgba(0,212,255,0.85), rgba(0,255,136,0.65));
    transform-origin: left center;
    animation: lkJoinToastBar 5s linear forwards;
    opacity: 0.9;
}
.livekit-join-toast.is-out {
    animation: lkJoinToastOut 220ms ease forwards;
}
@keyframes lkJoinToastIn {
    from { opacity: 0; transform: translateY(-10px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes lkJoinToastOut {
    from { opacity: 1; transform: translateY(0) scale(1); }
    to   { opacity: 0; transform: translateY(-8px) scale(0.985); }
}
@keyframes lkJoinToastBar {
    from { transform: scaleX(1); }
    to   { transform: scaleX(0); }
}
@media (max-width: 980px) {
    .livekit-join-toasts {
        right: 14px;
        top: 150px;
    }
}
.livekit-quality-select {
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.15);
    background: rgba(0,0,0,0.25);
    color: inherit;
    outline: none;
}
.livekit-quality-select:disabled {
    opacity: 0.55;
}
.livekit-controls .btn.is-on {
    background: rgba(46, 204, 113, 0.18);
    border-color: rgba(46, 204, 113, 0.45);
}
.livekit-controls .btn.is-off {
    background: rgba(231, 76, 60, 0.16);
    border-color: rgba(231, 76, 60, 0.45);
}
.livekit-controls input {
    min-width: 220px;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.15);
    background: rgba(0,0,0,0.25);
    color: inherit;
}
.livekit-audio-unlock {
    margin-top: 10px;
    padding: 10px 12px;
    border-radius: 14px;
    border: 1px solid rgba(255,255,255,0.10);
    background: rgba(0,0,0,0.22);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}
.livekit-audio-unlock .hint {
    font-size: 13px;
    opacity: 0.92;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.livekit-share {
    margin-top: 10px;
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}
.livekit-share input {
    flex: 1;
    min-width: 260px;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.15);
    background: rgba(0,0,0,0.25);
    color: inherit;
}
.livekit-body {
    margin-top: 12px;
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 12px;
    min-height: 62vh;
}
.livekit-body-v2 .livekit-chat-main {
    border-radius: 14px;
    background: rgba(0,0,0,0.28);
    border: 1px solid rgba(255,255,255,0.10);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.livekit-chat-headerbar {
    padding: 10px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    background: rgba(0,0,0,0.20);
}
.livekit-chat-title {
    font-weight: 800;
    font-size: 13px;
    display: flex;
    gap: 8px;
    align-items: center;
    opacity: 0.96;
}
.livekit-chat-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.livekit-side {
    border-radius: 14px;
    background: rgba(0,0,0,0.25);
    border: 1px solid rgba(255,255,255,0.08);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.livekit-game {
    padding: 10px 12px;
    border-top: 1px solid rgba(255,255,255,0.08);
    background: rgba(0,0,0,0.14);
}
.livekit-game-title {
    font-weight: 800;
    font-size: 13px;
    opacity: 0.95;
    display: flex;
    gap: 8px;
    align-items: center;
}
.livekit-game-actions {
    margin-top: 10px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* Chińczyk modal */
.chinczyk-layout {
    margin-top: 12px;
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 12px;
    min-height: 65vh;
}

/* Classic mode = the iframe is the whole game UI.
   Hide the server-authoritative controls to avoid "two games mixed up". */
#chinczykGameModal.is-classic-ui .chinczyk-side {
    display: none;
}
#chinczykGameModal.is-classic-ui #chinczykRollBtn,
#chinczykGameModal.is-classic-ui #chinczykJoinSpectatorBtn,
#chinczykGameModal.is-classic-ui #chinczykAdminOpenBtn,
#chinczykGameModal.is-classic-ui #chinczykAdminBeginBtn,
#chinczykGameModal.is-classic-ui #chinczykAdminStopBtn,
#chinczykGameModal.is-classic-ui #chinczykViewToggleBtn,
#chinczykGameModal.is-classic-ui #chinczykGameInfo {
    display: none !important;
}
.chinczyk-board-wrap {
    border-radius: 16px;
    background: rgba(0,0,0,0.25);
    border: 1px solid rgba(255,255,255,0.10);
    overflow: hidden;
    padding: 10px;
    display: grid;
    place-items: center;
}
.chinczyk-board-view {
    width: min(720px, 90vw);
    aspect-ratio: 1 / 1;
    position: relative;
    border-radius: 14px;
    overflow: hidden;
    background: rgba(0,0,0,0.25);
}
.chinczyk-classic-frame {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
    display: none; /* toggled by .chinczyk-board-wrap.is-classic */
    background: rgba(0,0,0,0.0);
}
#chinczyk3dMount {
    position: absolute;
    inset: 0;
    display: none; /* toggled by .chinczyk-board-wrap.is-3d */
}
#chinczyk3dMount canvas {
    width: 100% !important;
    height: 100% !important;
    display: block;
}
#chinczykCanvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border-radius: 14px;
    background: rgba(0,0,0,0.25);
}
.chinczyk-board-wrap.is-3d #chinczykCanvas {
    display: none;
}
.chinczyk-board-wrap.is-3d #chinczyk3dMount {
    display: block;
}
.chinczyk-board-wrap.is-classic #chinczykClassicFrame {
    display: block;
}
.chinczyk-board-wrap.is-classic #chinczyk3dMount,
.chinczyk-board-wrap.is-classic #chinczykCanvas {
    display: none !important;
}
.chinczyk-side {
    border-radius: 16px;
    background: rgba(0,0,0,0.22);
    border: 1px solid rgba(255,255,255,0.10);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.chinczyk-seats, .chinczyk-actions, .chinczyk-spectators {
    padding: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.chinczyk-seats-title, .chinczyk-actions-title {
    font-weight: 800;
    opacity: 0.95;
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 10px;
}
.chinczyk-seat-row {
    display: grid;
    grid-template-columns: 110px 1fr 74px;
    gap: 10px;
    align-items: center;
    margin-bottom: 10px;
}
.chinczyk-seat-row .seat-name {
    opacity: 0.9;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.pill.red { border:1px solid rgba(255,71,87,0.6); background: rgba(255,71,87,0.16); padding:4px 8px; border-radius:999px; font-size:12px; }
.pill.blue { border:1px solid rgba(0,212,255,0.6); background: rgba(0,212,255,0.14); padding:4px 8px; border-radius:999px; font-size:12px; }
.pill.yellow { border:1px solid rgba(255,165,0,0.6); background: rgba(255,165,0,0.14); padding:4px 8px; border-radius:999px; font-size:12px; }
.pill.green { border:1px solid rgba(0,255,136,0.55); background: rgba(0,255,136,0.12); padding:4px 8px; border-radius:999px; font-size:12px; }
.chinczyk-turn-box {
    padding: 10px 12px;
    border-radius: 14px;
    border: 1px solid rgba(255,255,255,0.10);
    background: rgba(0,0,0,0.22);
    margin-bottom: 10px;
    opacity: 0.95;
}
.chinczyk-moves {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
.chinczyk-spectators-list {
    opacity: 0.85;
    font-size: 13px;
    line-height: 1.35;
}
@media (max-width: 980px) {
    .chinczyk-layout {
        grid-template-columns: 1fr;
    }
}
.livekit-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 10px;
}
.livekit-grid-strip {
    grid-template-columns: 1fr;
}
.livekit-tile {
    position: relative;
    border-radius: 14px;
    overflow: hidden;
    background: rgba(0,0,0,0.45);
    border: 1px solid rgba(255,255,255,0.08);
    aspect-ratio: 16 / 9;
    cursor: pointer;
    transition: transform 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}
.livekit-tile:hover {
    transform: translateY(-1px);
    border-color: rgba(0, 212, 255, 0.35);
    box-shadow: 0 0 22px rgba(0, 212, 255, 0.12);
}
.livekit-tile video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.livekit-tile .label {
    position: absolute;
    left: 10px;
    bottom: 10px;
    font-size: 12px;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(0,0,0,0.55);
    border: 1px solid rgba(255,255,255,0.12);
}
.livekit-roster {
    padding: 10px 12px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    background: rgba(0,0,0,0.18);
}
.livekit-radio {
    padding: 10px 12px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    background: rgba(0,0,0,0.14);
}
.livekit-radio-title {
    font-weight: 700;
    font-size: 13px;
    opacity: 0.95;
    display: flex;
    gap: 8px;
    align-items: center;
}
.livekit-roster-title {
    font-weight: 700;
    font-size: 13px;
    opacity: 0.95;
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
}
.livekit-roster-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.livekit-roster-pill {
    font-size: 12px;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(0,0,0,0.45);
    border: 1px solid rgba(255,255,255,0.12);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: box-shadow 160ms ease, border-color 160ms ease, transform 160ms ease, opacity 160ms ease;
}
.livekit-roster-pill.me {
    border-color: rgba(46, 204, 113, 0.55);
    background: rgba(46, 204, 113, 0.12);
}
.livekit-roster-pill.is-muted {
    opacity: 0.72;
}
.livekit-roster-pill .livekit-mic {
    opacity: 0.85;
    font-size: 12px;
}
@keyframes livekitPulse {
    0% { box-shadow: 0 0 0 rgba(0, 212, 255, 0.0); transform: translateY(0); }
    50% { box-shadow: 0 0 22px rgba(0, 212, 255, 0.35); transform: translateY(-1px); }
    100% { box-shadow: 0 0 0 rgba(0, 212, 255, 0.0); transform: translateY(0); }
}
.livekit-roster-pill.is-speaking {
    border-color: rgba(0, 212, 255, 0.65);
    box-shadow: 0 0 18px rgba(0, 212, 255, 0.28);
    animation: livekitPulse 850ms ease-in-out infinite;
}
@keyframes livekitFlash {
    0% { box-shadow: 0 0 0 rgba(255,255,255,0.0); }
    30% { box-shadow: 0 0 18px rgba(255,255,255,0.22); }
    100% { box-shadow: 0 0 0 rgba(255,255,255,0.0); }
}
.livekit-roster-pill.flash {
    animation: livekitFlash 650ms ease-out 1;
}

.livekit-tile.is-speaking {
    border-color: rgba(0, 212, 255, 0.55);
    box-shadow: 0 0 22px rgba(0, 212, 255, 0.22);
}
.livekit-roster-row {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
}
.livekit-roster-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}
.livekit-chat-log {
    flex: 1;
    overflow: auto;
    padding: 12px;
    font-size: 13px;
    min-height: 40vh;
}
.livekit-chat-log .msg {
    margin-bottom: 10px;
    line-height: 1.35;
}
.livekit-chat-log .msg .who {
    opacity: 0.9;
    font-weight: 600;
    margin-right: 6px;
}
.livekit-chat-input {
    display: flex;
    gap: 8px;
    padding: 10px;
    border-top: 1px solid rgba(255,255,255,0.08);
}
.livekit-chat-input #livekitChatTalkBtn {
    min-width: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.livekit-chat-input input {
    flex: 1;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.15);
    background: rgba(0,0,0,0.25);
    color: inherit;
}

.livekit-video-strip {
    padding: 10px 12px;
    border-top: 1px solid rgba(255,255,255,0.08);
    background: rgba(0,0,0,0.12);
    max-height: 42vh;
    overflow: auto;
}
.livekit-video-strip-title {
    font-weight: 700;
    font-size: 13px;
    opacity: 0.95;
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
}
.livekit-no-video-hint {
    opacity: 0.75;
    font-size: 12px;
    margin-bottom: 8px;
}

.livekit-zoom {
    position: fixed;
    inset: 0;
    z-index: 6000;
    background: rgba(0,0,0,0.78);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
}
.livekit-zoom-inner {
    width: min(1100px, 96vw);
    height: min(760px, 90vh);
    border-radius: 18px;
    background: rgba(0,0,0,0.35);
    border: 1px solid rgba(255,255,255,0.10);
    box-shadow: 0 22px 80px rgba(0,0,0,0.55);
    overflow: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
}
.livekit-zoom-close {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 2;
}
.livekit-zoom-label {
    padding: 12px 14px;
    font-weight: 800;
    display: flex;
    gap: 8px;
    align-items: center;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    background: rgba(0,0,0,0.22);
}
.livekit-zoom-stage {
    flex: 1;
    display: grid;
    place-items: center;
    padding: 12px;
}
.livekit-zoom-stage video {
    width: 100%;
    height: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 14px;
    background: rgba(0,0,0,0.35);
}

/* Radio modal */
.radio-controls {
    margin-top: 14px;
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}
.radio-vol {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 14px;
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(0,0,0,0.22);
}
.radio-vol input[type="range"] {
    width: 180px;
}
.radio-hint {
    margin-top: 10px;
    padding: 10px 12px;
    border-radius: 14px;
    background: rgba(0, 212, 255, 0.10);
    border: 1px solid rgba(0, 212, 255, 0.25);
    opacity: 0.95;
}
@media (max-width: 980px) {
    .livekit-body {
        grid-template-columns: 1fr;
    }
}

/* Flying media background effect */
.flying-media-item {
    position: fixed;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: -1;
    opacity: 0;
    mix-blend-mode: normal;
    transition: opacity 1s ease-in-out;
    will-change: transform, opacity;
}

/* Ambient media background (server-driven, event-based) */
.ambient-stage {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: -1;
    overflow: hidden;
}

.ambient-media-item {
    position: absolute;
    transform: translate(-50%, -50%);
    opacity: 0;
    will-change: transform, opacity;
    mix-blend-mode: normal;
    filter: none;
}

.ambient-media-frame {
    width: 100%;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0,0,0,0.22);
    transform-style: preserve-3d;
}

.ambient-media-frame img,
.ambient-media-frame video {
    display: block;
    width: 100%;
    height: auto;
    object-fit: cover;
    border-radius: 14px;
    filter: none;
}

body.eco-mode .ambient-stage {
    display: none !important;
}

/* Effect presets (choose via server payload `effect`) */
.ambient-media-item {
    /* Entry happens once; idle motion loops forever. */
    animation: ambEnter 900ms ease-out both;
}

.ambient-media-item.is-exit {
    animation: ambExit 900ms ease-in both !important;
}

.ambient-media-item.effect-fade {
    animation: ambEnter 900ms ease-out both, ambIdleFade var(--dur, 14000ms) ease-in-out infinite alternate;
}
.ambient-media-item.effect-drift {
    animation: ambEnter 900ms ease-out both, ambIdleDrift var(--dur, 14000ms) ease-in-out infinite alternate;
}
.ambient-media-item.effect-slide {
    animation: ambEnter 900ms ease-out both, ambIdleSlide var(--dur, 14000ms) cubic-bezier(0.2, 0.9, 0.2, 1) infinite alternate;
}
.ambient-media-item.effect-floatup {
    animation: ambEnter 900ms ease-out both, ambIdleFloatUp var(--dur, 14000ms) ease-in-out infinite alternate;
}

.ambient-media-item.effect-kenburns .ambient-media-frame img {
    transform-origin: 50% 50%;
    animation: ambIdleKenBurns var(--dur, 18000ms) ease-in-out infinite alternate;
}
.ambient-media-item.effect-flip .ambient-media-frame {
    animation: ambIdleFlip var(--dur, 16000ms) ease-in-out infinite alternate;
}
.ambient-media-item.effect-tilt .ambient-media-frame {
    animation: ambIdleTilt var(--dur, 16000ms) ease-in-out infinite alternate;
}
.ambient-media-item.effect-glow .ambient-media-frame {
    animation: ambIdleGlow var(--dur, 14000ms) ease-in-out infinite alternate;
}
.ambient-media-item.effect-prism {
    /* Keep "prism" as a motion-only preset (no hue shift). */
    animation: ambEnter 900ms ease-out both, ambIdleOrbit var(--dur, 16000ms) ease-in-out infinite alternate;
}
.ambient-media-item.effect-blurpop {
    /* Keep "blurpop" name, but make it a motion-only zoom preset (no blur/brightness). */
    animation: ambEnter 900ms ease-out both, ambIdleZoom var(--dur, 14000ms) ease-in-out infinite alternate;
}

/* New motion-only effects (no color changes) */
.ambient-media-item.effect-bob {
    animation: ambEnter 900ms ease-out both, ambIdleBob var(--dur, 12000ms) ease-in-out infinite alternate;
}
.ambient-media-item.effect-sway {
    animation: ambEnter 900ms ease-out both, ambIdleSway var(--dur, 15000ms) ease-in-out infinite alternate;
}
.ambient-media-item.effect-orbit {
    animation: ambEnter 900ms ease-out both, ambIdleOrbit var(--dur, 17000ms) ease-in-out infinite alternate;
}
.ambient-media-item.effect-swirl {
    animation: ambEnter 900ms ease-out both, ambIdleSwirl var(--dur, 18000ms) linear infinite;
}
.ambient-media-item.effect-parallax {
    animation: ambEnter 900ms ease-out both, ambIdleParallax var(--dur, 16000ms) ease-in-out infinite alternate;
}

/* New motion-only effects (no color changes) */
.ambient-media-item.effect-breath {
    animation: ambEnter 900ms ease-out both, ambIdleBreath var(--dur, 14000ms) ease-in-out infinite alternate;
}

.ambient-media-item.effect-pendulum {
    /* Rotate around a pivot on the frame */
    animation: ambEnter 900ms ease-out both, ambIdlePendulum var(--dur, 16000ms) ease-in-out infinite alternate;
}
.ambient-media-item.effect-pendulum .ambient-media-frame {
    transform-origin: var(--pivX, 50%) var(--pivY, 10%);
}

.ambient-media-item.effect-spiral {
    animation: ambEnter 900ms ease-out both, ambIdleSpiral var(--dur, 18000ms) ease-in-out infinite;
}

.ambient-media-item.effect-orbitwide {
    animation: ambEnter 900ms ease-out both, ambIdleOrbitWide var(--dur, 20000ms) ease-in-out infinite alternate;
}

.ambient-media-item.effect-hover3d .ambient-media-frame {
    transform-style: preserve-3d;
    animation: ambIdleHover3D var(--dur, 17000ms) ease-in-out infinite alternate;
}

.ambient-media-item.effect-parallaxdrift .ambient-media-frame img {
    animation: ambIdleParallaxImg var(--dur, 16000ms) ease-in-out infinite alternate;
}

/* Entry variants for extra dynamism (still color-safe) */
.ambient-media-item.effect-dropin {
    animation: ambEnterDrop 900ms cubic-bezier(0.2, 0.9, 0.2, 1) both, ambIdleBob var(--dur, 12000ms) ease-in-out infinite alternate;
}
.ambient-media-item.effect-scalein {
    animation: ambEnterScale 800ms ease-out both, ambIdleBreath var(--dur, 14000ms) ease-in-out infinite alternate;
}

/* Additional motion-only effects (no color manipulation) */
.ambient-media-item.effect-wobble {
    animation: ambEnter 900ms ease-out both, ambIdleWobble var(--dur, 15000ms) ease-in-out infinite alternate;
}
.ambient-media-item.effect-gentlepulse {
    animation: ambEnter 900ms ease-out both, ambIdleGentlePulse var(--dur, 16000ms) ease-in-out infinite alternate;
}
.ambient-media-item.effect-figureeight {
    animation: ambEnter 900ms ease-out both, ambIdleFigureEight var(--dur, 18000ms) ease-in-out infinite;
}
.ambient-media-item.effect-tumble {
    animation: ambEnter 900ms ease-out both, ambIdleTumble var(--dur, 22000ms) linear infinite;
}
.ambient-media-item.effect-drift {
    animation: ambEnter 900ms ease-out both, ambIdleDriftLong var(--dur, 26000ms) ease-in-out infinite alternate;
}
.ambient-media-item.effect-bounce {
    animation: ambEnterBounce 900ms cubic-bezier(0.2, 0.9, 0.2, 1) both, ambIdleBob var(--dur, 12000ms) ease-in-out infinite alternate;
}
.ambient-media-item.effect-rock .ambient-media-frame {
    transform-origin: 50% 100%;
    animation: ambIdleRock var(--dur, 20000ms) ease-in-out infinite alternate;
}
.ambient-media-item.effect-levitate {
    animation: ambEnter 900ms ease-out both, ambIdleLevitate var(--dur, 17000ms) ease-in-out infinite alternate;
}

@keyframes ambEnter {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(0.92) rotate(var(--rot, 0deg)); }
    100% { opacity: 0.86; transform: translate(-50%, -50%) scale(1.0) rotate(calc(var(--rot, 0deg) * 0.15)); }
}

@keyframes ambEnterDrop {
    0% { opacity: 0; transform: translate(-50%, -50%) translateY(-60px) scale(0.96) rotate(var(--rot, 0deg)); }
    70% { opacity: 0.88; transform: translate(-50%, -50%) translateY(6px) scale(1.02) rotate(calc(var(--rot, 0deg) * 0.20)); }
    100% { opacity: 0.86; transform: translate(-50%, -50%) translateY(0px) scale(1.00) rotate(calc(var(--rot, 0deg) * 0.15)); }
}

@keyframes ambEnterScale {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(0.78) rotate(calc(var(--rot, 0deg) * 0.10)); }
    100% { opacity: 0.86; transform: translate(-50%, -50%) scale(1.00) rotate(calc(var(--rot, 0deg) * 0.15)); }
}

@keyframes ambEnterBounce {
    0% { opacity: 0; transform: translate(-50%, -50%) translateY(-70px) scale(0.96) rotate(calc(var(--rot, 0deg) * 0.10)); }
    60% { opacity: 0.90; transform: translate(-50%, -50%) translateY(12px) scale(1.03) rotate(calc(var(--rot, 0deg) * 0.18)); }
    82% { transform: translate(-50%, -50%) translateY(-6px) scale(0.995) rotate(calc(var(--rot, 0deg) * 0.14)); }
    100% { opacity: 0.86; transform: translate(-50%, -50%) translateY(0px) scale(1.00) rotate(calc(var(--rot, 0deg) * 0.15)); }
}

@keyframes ambExit {
    0% { opacity: 0.86; transform: translate(-50%, -50%) scale(1.0) rotate(calc(var(--rot, 0deg) * 0.15)); }
    100% { opacity: 0; transform: translate(-50%, -50%) scale(0.92) rotate(calc(var(--rot, 0deg) * -0.35)); }
}

@keyframes ambIdleFade {
    0% { opacity: 0.78; transform: translate(-50%, -50%) scale(0.99) rotate(calc(var(--rot, 0deg) * 0.20)); }
    100% { opacity: 0.90; transform: translate(-50%, -50%) scale(1.03) rotate(calc(var(--rot, 0deg) * -0.10)); }
}

@keyframes ambIdleDrift {
    0% { transform: translate(-50%, -50%) translate(calc(var(--driftX, 0px) * -0.25), calc(var(--driftY, 0px) * -0.25)) scale(0.99) rotate(calc(var(--rot, 0deg) * 0.20)); }
    100% { transform: translate(-50%, -50%) translate(calc(var(--driftX, 0px) * 0.65), calc(var(--driftY, 0px) * 0.65)) scale(1.04) rotate(calc(var(--rot, 0deg) * -0.20)); }
}

@keyframes ambIdleSlide {
    0% { transform: translate(-50%, -50%) translateX(-55px) scale(0.99) rotate(calc(var(--rot, 0deg) * 0.15)); }
    100% { transform: translate(-50%, -50%) translateX(55px) scale(1.03) rotate(calc(var(--rot, 0deg) * -0.15)); }
}

@keyframes ambIdleFloatUp {
    0% { transform: translate(-50%, -50%) translateY(18px) scale(0.99) rotate(calc(var(--rot, 0deg) * 0.12)); }
    100% { transform: translate(-50%, -50%) translateY(-26px) scale(1.03) rotate(calc(var(--rot, 0deg) * -0.12)); }
}

@keyframes ambIdleKenBurns {
    0% { transform: scale(1.02) translate(0, 0); }
    100% { transform: scale(1.20) translate(calc(var(--driftX, 0px) * 0.18), calc(var(--driftY, 0px) * 0.18)); }
}

@keyframes ambIdleFlip {
    0% { transform: rotateY(-10deg) rotateZ(calc(var(--rot, 0deg) * 0.18)) scale(1.00); }
    100% { transform: rotateY(10deg) rotateZ(calc(var(--rot, 0deg) * -0.18)) scale(1.02); }
}

@keyframes ambIdleTilt {
    0% { transform: rotateZ(calc(var(--rot, 0deg) * 0.25)) rotateX(-5deg) scale(1.00); }
    100% { transform: rotateZ(calc(var(--rot, 0deg) * -0.25)) rotateX(5deg) scale(1.03); }
}

@keyframes ambIdleGlow {
    0% { filter: drop-shadow(0 6px 14px rgba(0,0,0,0.18)); }
    100% { filter: drop-shadow(0 12px 26px rgba(0,0,0,0.28)); }
}

@keyframes ambIdleBob {
    0% { transform: translate(-50%, -50%) translateY(14px) scale(1.00) rotate(calc(var(--rot, 0deg) * 0.10)); }
    100% { transform: translate(-50%, -50%) translateY(-14px) scale(1.02) rotate(calc(var(--rot, 0deg) * -0.10)); }
}

@keyframes ambIdleSway {
    0% { transform: translate(-50%, -50%) translateX(-18px) scale(1.00) rotate(calc(var(--rot, 0deg) * 0.30)); }
    100% { transform: translate(-50%, -50%) translateX(18px) scale(1.03) rotate(calc(var(--rot, 0deg) * -0.30)); }
}

@keyframes ambIdleOrbit {
    0% { transform: translate(-50%, -50%) translate(12px, -10px) scale(1.00) rotate(calc(var(--rot, 0deg) * 0.12)); }
    100% { transform: translate(-50%, -50%) translate(-12px, 10px) scale(1.03) rotate(calc(var(--rot, 0deg) * -0.12)); }
}

@keyframes ambIdleSwirl {
    0% { transform: translate(-50%, -50%) scale(1.01) rotate(0deg); }
    100% { transform: translate(-50%, -50%) scale(1.01) rotate(360deg); }
}

@keyframes ambIdleParallax {
    0% { transform: translate(-50%, -50%) translate(calc(var(--driftX, 0px) * -0.18), calc(var(--driftY, 0px) * -0.18)) scale(1.00); }
    100% { transform: translate(-50%, -50%) translate(calc(var(--driftX, 0px) * 0.18), calc(var(--driftY, 0px) * 0.18)) scale(1.04); }
}

@keyframes ambIdleZoom {
    0% { transform: translate(-50%, -50%) scale(0.98) rotate(calc(var(--rot, 0deg) * 0.10)); }
    100% { transform: translate(-50%, -50%) scale(1.06) rotate(calc(var(--rot, 0deg) * -0.10)); }
}

@keyframes ambIdleBreath {
    0% { transform: translate(-50%, -50%) scale(0.99) rotate(calc(var(--rot, 0deg) * 0.10)); }
    100% { transform: translate(-50%, -50%) scale(1.04) rotate(calc(var(--rot, 0deg) * -0.10)); }
}

@keyframes ambIdleWobble {
    0% { transform: translate(-50%, -50%) rotate(calc(var(--ampRot, 10deg) * -0.28)) scale(1.00); }
    50% { transform: translate(-50%, -50%) rotate(calc(var(--ampRot, 10deg) * 0.12)) scale(1.012); }
    100% { transform: translate(-50%, -50%) rotate(calc(var(--ampRot, 10deg) * 0.28)) scale(1.00); }
}

@keyframes ambIdleGentlePulse {
    0% { transform: translate(-50%, -50%) skewX(calc(var(--skewAmp, 1.2deg) * -1)) skewY(calc(var(--skewAmp, 1.2deg) * 0.5)); }
    100% { transform: translate(-50%, -50%) skewX(var(--skewAmp, 1.2deg)) skewY(calc(var(--skewAmp, 1.2deg) * -0.5)); }
}

@keyframes ambIdleFigureEight {
    0% { transform: translate(-50%, -50%) translate(calc(var(--orbitX, 16px) * 0), calc(var(--orbitY, 12px) * -1)) rotate(calc(var(--rot, 0deg) * 0.10)); }
    25% { transform: translate(-50%, -50%) translate(calc(var(--orbitX, 16px) * 1), calc(var(--orbitY, 12px) * 0)) rotate(calc(var(--rot, 0deg) * 0.18)); }
    50% { transform: translate(-50%, -50%) translate(calc(var(--orbitX, 16px) * 0), calc(var(--orbitY, 12px) * 1)) rotate(calc(var(--rot, 0deg) * 0.10)); }
    75% { transform: translate(-50%, -50%) translate(calc(var(--orbitX, 16px) * -1), calc(var(--orbitY, 12px) * 0)) rotate(calc(var(--rot, 0deg) * -0.18)); }
    100% { transform: translate(-50%, -50%) translate(calc(var(--orbitX, 16px) * 0), calc(var(--orbitY, 12px) * -1)) rotate(calc(var(--rot, 0deg) * -0.10)); }
}

@keyframes ambIdleTumble {
    0% { transform: translate(-50%, -50%) perspective(900px) rotateX(0deg) rotateY(0deg) rotateZ(0deg); }
    100% { transform: translate(-50%, -50%) perspective(900px) rotateX(var(--tumbleX, 180deg)) rotateY(var(--tumbleY, 360deg)) rotateZ(360deg); }
}

@keyframes ambIdleDriftLong {
    0% { transform: translate(-50%, -50%) translate(calc(var(--driftLongX, 120px) * -1), calc(var(--driftLongY, 70px) * -0.5)) rotate(calc(var(--rot, 0deg) * 0.10)); }
    100% { transform: translate(-50%, -50%) translate(var(--driftLongX, 120px), var(--driftLongY, 70px)) rotate(calc(var(--rot, 0deg) * -0.10)); }
}

@keyframes ambIdleRock {
    0% { transform: rotate(calc(var(--ampRot, 10deg) * -0.16)); }
    100% { transform: rotate(calc(var(--ampRot, 10deg) * 0.16)); }
}

@keyframes ambIdleLevitate {
    0% { opacity: 0.84; transform: translate(-50%, -50%) translate(calc(var(--ampX, 18px) * -0.25), calc(var(--ampY, 18px) * 0.55)) rotate(calc(var(--rot, 0deg) * 0.10)); }
    100% { opacity: 0.90; transform: translate(-50%, -50%) translate(calc(var(--ampX, 18px) * 0.25), calc(var(--ampY, 18px) * -0.55)) rotate(calc(var(--rot, 0deg) * -0.10)); }
}

@keyframes ambIdlePendulum {
    0% { transform: translate(-50%, -50%) translateX(calc(var(--ampX, 18px) * -1)) rotate(calc(var(--ampRot, 10deg) * -1)); }
    100% { transform: translate(-50%, -50%) translateX(var(--ampX, 18px)) rotate(var(--ampRot, 10deg)); }
}

@keyframes ambIdleSpiral {
    0% { transform: translate(-50%, -50%) translate(0px, 0px) rotate(0deg) scale(1.00); }
    25% { transform: translate(-50%, -50%) translate(var(--orbitX, 16px), 0px) rotate(90deg) scale(1.02); }
    50% { transform: translate(-50%, -50%) translate(0px, var(--orbitY, 12px)) rotate(180deg) scale(1.00); }
    75% { transform: translate(-50%, -50%) translate(calc(var(--orbitX, 16px) * -1), 0px) rotate(270deg) scale(1.02); }
    100% { transform: translate(-50%, -50%) translate(0px, calc(var(--orbitY, 12px) * -1)) rotate(360deg) scale(1.00); }
}

@keyframes ambIdleOrbitWide {
    0% { transform: translate(-50%, -50%) translate(calc(var(--orbitX, 22px) * -1), calc(var(--orbitY, 14px) * 0.55)) scale(1.00); }
    50% { transform: translate(-50%, -50%) translate(0px, calc(var(--orbitY, 14px) * -1)) scale(1.03); }
    100% { transform: translate(-50%, -50%) translate(var(--orbitX, 22px), calc(var(--orbitY, 14px) * 0.55)) scale(1.00); }
}

@keyframes ambIdleHover3D {
    0% { transform: perspective(900px) rotateX(calc(var(--tiltX, 6deg) * -1)) rotateY(var(--tiltY, 6deg)) translateZ(0); }
    100% { transform: perspective(900px) rotateX(var(--tiltX, 6deg)) rotateY(calc(var(--tiltY, 6deg) * -1)) translateZ(0); }
}

@keyframes ambIdleParallaxImg {
    0% { transform: scale(1.08) translate(calc(var(--driftX, 0px) * 0.10), calc(var(--driftY, 0px) * 0.10)); }
    100% { transform: scale(1.14) translate(calc(var(--driftX, 0px) * -0.10), calc(var(--driftY, 0px) * -0.10)); }
}

.flying-media-item img,
.flying-media-item video {
    width: 220px;
    height: auto;
    object-fit: cover;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    filter: none;
}

body.dark-mode .flying-media-item {
    mix-blend-mode: screen;
    opacity: 0;
}

body.dark-mode .flying-media-item img,
body.dark-mode .flying-media-item video {
    filter: none;
}

/* Gallery disabled state */
body.gallery-disabled .gallery {
    display: none !important;
}

/* NOTE:
   We no longer apply CSS blur when the gallery is disabled.
   The server serves truly blurred media variants to non-admin users instead. */
body.gallery-disabled .flying-media-item,
body.gallery-disabled .content-notification,
body.gallery-disabled .notification-preview img,
body.gallery-disabled .notification-preview video,
body.gallery-disabled .notification-image,
body.gallery-disabled .notification-video,
body.gallery-disabled .modal-image .image-container img,
body.gallery-disabled .modal-image .image-container video {
    filter: none !important;
    opacity: 1 !important;
}

/* Dark Mode Styles */
body.dark-mode {
    background: linear-gradient(135deg, #04060b 0%, #040915 30%, #041226 70%, #030914 100%);
    color: var(--dark-text-primary);
    min-height: 100vh;
    animation: bgShiftDark 28s ease-in-out infinite;
}

body.dark-mode::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 80%, rgba(0, 212, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255, 71, 87, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(0, 255, 136, 0.1) 0%, transparent 50%);
    pointer-events: none;
    z-index: -2;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.header {
    background: rgba(255, 255, 255, 0.06);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(18px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

body.dark-mode .header {
    background: rgba(12, 16, 32, 0.7);
    box-shadow: 0 18px 60px rgba(0, 0, 0, 0.7), var(--dark-glow);
    border-bottom: 1px solid rgba(0, 212, 255, 0.25);
}

.adminbar {
    position: sticky;
    top: 78px; /* below header */
    z-index: 90;
    background: rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(16px);
}
body.dark-mode .adminbar {
    background: rgba(10, 12, 22, 0.62);
    border-bottom-color: rgba(0, 212, 255, 0.18);
    box-shadow: 0 18px 55px rgba(0,0,0,0.45);
}
.adminbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 20px;
    flex-wrap: wrap;
}
.adminbar-left, .adminbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.adminbar-title {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 900;
    font-size: 12.5px;
    letter-spacing: 0.3px;
    padding: 8px 10px;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(0,0,0,0.16);
    color: rgba(255,255,255,0.9);
}
.adminbar-title i {
    color: var(--dark-accent-primary);
    filter: drop-shadow(0 0 12px rgba(0, 212, 255, 0.25));
}
.adminbar-pill {
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(0,0,0,0.14);
    color: rgba(255,255,255,0.88);
    padding: 8px 10px;
    border-radius: 999px;
    font-weight: 800;
    font-size: 12.5px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: transform 140ms ease, border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
}
.adminbar-pill-static { cursor: default; }
.adminbar-pill:hover {
    transform: translateY(-1px);
    border-color: rgba(0, 212, 255, 0.28);
    box-shadow: 0 0 22px rgba(0, 212, 255, 0.10);
}
.adminbar-pill:active { transform: translateY(0); }
.adminbar-pill i { opacity: 0.95; }
.adminbar-action {
    border: 1px solid rgba(255,255,255,0.14);
    background: rgba(0,0,0,0.14);
    color: rgba(255,255,255,0.88);
    padding: 9px 12px;
    border-radius: 12px;
    font-weight: 900;
    font-size: 12.5px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: transform 140ms ease, border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
}
.adminbar-action:hover {
    transform: translateY(-1px);
    border-color: rgba(0, 212, 255, 0.28);
    box-shadow: 0 0 22px rgba(0, 212, 255, 0.10);
}
.adminbar-action:active { transform: translateY(0); }
.adminbar-danger:hover {
    border-color: rgba(255, 71, 87, 0.35);
    box-shadow: 0 0 22px rgba(255, 71, 87, 0.10);
}

/* Live banners (admin-controlled via WebSocket) */
.live-banners {
    position: sticky;
    top: 126px; /* header + adminbar */
    z-index: 89;
    border-bottom: 1px solid rgba(255,255,255,0.10);
    backdrop-filter: blur(14px);
}
.live-banners[hidden] {
    display: none !important;
}
body.dark-mode .live-banners {
    border-bottom-color: rgba(0, 212, 255, 0.14);
}
.live-banner-row {
    background: linear-gradient(135deg, rgba(255,165,0,0.16), rgba(0,212,255,0.14));
}
body.dark-mode .live-banner-row {
    background: linear-gradient(135deg, rgba(255,165,0,0.14), rgba(0,212,255,0.12));
}
.live-banner-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 20px;
    border-top: 1px solid rgba(255,255,255,0.06);
}
.live-banner-row:first-child .live-banner-inner {
    border-top: none;
}
.live-banner-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}
.live-banner-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.14);
    background: rgba(0,0,0,0.18);
    font-weight: 900;
    font-size: 12px;
    color: rgba(255,255,255,0.92);
    flex: 0 0 auto;
}
.live-banner-badge i {
    color: rgba(255, 165, 0, 0.95);
    filter: drop-shadow(0 0 10px rgba(255, 165, 0, 0.22));
}
.live-banner-text {
    color: rgba(255,255,255,0.90);
    font-weight: 800;
    font-size: 13.5px;
    line-height: 1.25;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.live-banner-actions {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
}
.live-banner-btn {
    border: 1px solid rgba(255,255,255,0.14);
    background: rgba(0,0,0,0.18);
    color: rgba(255,255,255,0.92);
    width: 34px;
    height: 34px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.live-banner-btn:hover {
    border-color: rgba(255, 165, 0, 0.35);
    box-shadow: 0 0 22px rgba(255, 165, 0, 0.10);
}
.live-banner-btn.is-danger:hover {
    border-color: rgba(255, 71, 87, 0.40);
    box-shadow: 0 0 22px rgba(255, 71, 87, 0.10);
}

/* Maintenance overlay */
.maintenance {
    position: fixed;
    inset: 0;
    /* Keep BELOW .modal (z-index: 1000) so admin can still log in during maintenance */
    z-index: 950;
    display: grid;
    place-items: center;
    padding: 18px;
    background: rgba(0,0,0,0.72);
    backdrop-filter: blur(10px);
}
.maintenance[hidden] {
    display: none !important;
}
.maintenance-card {
    width: min(720px, 96vw);
    border-radius: 18px;
    border: 1px solid rgba(0, 212, 255, 0.22);
    background: linear-gradient(165deg, rgba(12, 16, 32, 0.92), rgba(7, 12, 24, 0.9));
    box-shadow: 0 24px 80px rgba(0,0,0,0.70), 0 0 30px rgba(0,212,255,0.12);
    padding: 18px 18px;
    color: rgba(255,255,255,0.94);
}
.maintenance-title {
    font-weight: 900;
    letter-spacing: 0.2px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
}
.maintenance-title i {
    color: rgba(255,165,0,0.95);
    filter: drop-shadow(0 0 10px rgba(255,165,0,0.22));
}
.maintenance-msg {
    margin-top: 10px;
    font-size: 14px;
    line-height: 1.35;
    opacity: 0.96;
}
.maintenance-sub {
    margin-top: 10px;
    font-size: 12.5px;
    opacity: 0.80;
}

@media (max-width: 768px) {
    .adminbar { top: 112px; } /* header stacks on mobile */
    .adminbar-inner { padding: 10px 10px; }
    .live-banners { top: 168px; }
    .live-banner-inner { padding: 10px 10px; }
    .live-banner-text { white-space: normal; }
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 20px;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
    text-decoration: none;
}

.logo i {
    color: var(--accent-danger);
}

.logo-image {
    height: 40px;
    width: auto;
    object-fit: contain;
    transition: all 0.3s ease;
    display: block;
    max-width: 200px;
}

.logo:hover .logo-image {
    transform: scale(1.05);
}

body.dark-mode .logo {
    color: var(--dark-text-primary);
    text-shadow: 0 0 10px rgba(0, 212, 255, 0.5);
}

body.dark-mode .logo i {
    color: var(--dark-accent-danger);
    filter: drop-shadow(0 0 5px rgba(255, 71, 87, 0.5));
}

.nav {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Live presence widget (top-right, inside header nav) */
.presence-widget {
    position: relative;
    display: inline-flex;
    align-items: center;
}
.presence-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 1px solid rgba(255,255,255,0.14);
    background: linear-gradient(145deg, rgba(0,0,0,0.25), rgba(0,0,0,0.15));
    color: inherit;
    padding: 8px 10px;
    border-radius: 999px;
    cursor: pointer;
    font-weight: 700;
    font-size: 13px;
    line-height: 1;
    backdrop-filter: blur(12px);
    box-shadow: 0 12px 30px rgba(0,0,0,0.25);
    transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}
.presence-pill i {
    color: var(--dark-accent-primary);
    filter: drop-shadow(0 0 10px rgba(0, 212, 255, 0.25));
}
.presence-pill:hover {
    transform: translateY(-1px);
    border-color: rgba(0, 212, 255, 0.35);
}
.presence-pill:active {
    transform: translateY(0);
}
.presence-panel {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: min(520px, 92vw);
    max-height: min(60vh, 520px);
    overflow: hidden;
    border-radius: 16px;
    border: 1px solid rgba(0, 212, 255, 0.25);
    background: linear-gradient(145deg, rgba(10,10,10,0.72), rgba(10,10,10,0.46));
    box-shadow: 0 22px 60px rgba(0,0,0,0.45), 0 0 30px rgba(0,212,255,0.12);
    backdrop-filter: blur(14px);
    z-index: 300;
}
.presence-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 12px;
    border-bottom: 1px solid rgba(255,255,255,0.10);
}
.presence-panel-head .title {
    font-weight: 800;
    font-size: 13px;
    letter-spacing: 0.2px;
    opacity: 0.95;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.presence-close {
    border: 1px solid rgba(255,255,255,0.15);
    background: rgba(255,255,255,0.06);
    color: inherit;
    width: 32px;
    height: 32px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
}
.presence-close:hover {
    border-color: rgba(0, 212, 255, 0.35);
}
.presence-list {
    padding: 10px 12px 12px;
    overflow: auto;
    max-height: min(56vh, 460px);
}
.presence-section {
    padding: 10px 10px;
    border-radius: 14px;
    border: 1px solid rgba(255,255,255,0.10);
    background: rgba(0,0,0,0.16);
    margin-bottom: 10px;
}
.presence-section-title {
    font-weight: 900;
    font-size: 12px;
    letter-spacing: 0.2px;
    opacity: 0.92;
    margin-bottom: 8px;
}
.presence-section-empty {
    font-size: 12px;
    opacity: 0.7;
}
.presence-top-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.presence-top-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 8px 10px;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.04);
}
.presence-top-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-width: 0;
}
.presence-top-meta {
    font-size: 12px;
    opacity: 0.82;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.presence-top-sub {
    font-size: 12px;
    opacity: 0.78;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.presence-top-ip {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 12px;
    opacity: 0.95;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}
.presence-top-visits {
    font-size: 12px;
    font-weight: 900;
    opacity: 0.95;
    border: 1px solid rgba(0, 212, 255, 0.25);
    background: rgba(0, 212, 255, 0.10);
    padding: 4px 8px;
    border-radius: 999px;
    flex: 0 0 auto;
}
.presence-top-remove {
    width: 28px;
    height: 28px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.14);
    background: rgba(255,255,255,0.06);
    color: inherit;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    flex: 0 0 auto;
}
.presence-top-remove:hover {
    border-color: rgba(255, 71, 87, 0.55);
    background: rgba(255, 71, 87, 0.12);
}
.presence-row {
    display: grid;
    grid-template-columns: 70px 1fr;
    gap: 10px;
    padding: 10px 10px;
    border-radius: 14px;
    border: 1px solid rgba(255,255,255,0.10);
    background: rgba(0,0,0,0.18);
    margin-bottom: 10px;
}
.presence-row.is-back {
    border-color: rgba(0, 255, 136, 0.70);
    box-shadow: 0 0 0 1px rgba(0, 255, 136, 0.12), 0 0 26px rgba(0, 255, 136, 0.16);
    animation: presenceBackPulse 900ms ease-in-out infinite;
}
@keyframes presenceBackPulse {
    0%   { box-shadow: 0 0 0 1px rgba(0, 255, 136, 0.10), 0 0 12px rgba(0, 255, 136, 0.10); }
    50%  { box-shadow: 0 0 0 2px rgba(0, 255, 136, 0.22), 0 0 34px rgba(0, 255, 136, 0.22); }
    100% { box-shadow: 0 0 0 1px rgba(0, 255, 136, 0.10), 0 0 12px rgba(0, 255, 136, 0.10); }
}
.presence-last-ts {
    opacity: 0.82;
}
.presence-row:last-child {
    margin-bottom: 0;
}
.presence-left {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.presence-tag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 6px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(255,255,255,0.06);
}
.presence-tag.is-admin {
    border-color: rgba(46, 204, 113, 0.35);
    background: rgba(46, 204, 113, 0.12);
}
.presence-meta {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}
.presence-meta .ip {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 12px;
    opacity: 0.95;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.presence-meta .ua {
    font-size: 12px;
    opacity: 0.78;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Admin-only presence actions (live controls) */
.presence-actions {
    margin-top: 10px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.presence-action-btn {
    border: 1px solid rgba(255,255,255,0.14);
    background: rgba(255,255,255,0.06);
    color: inherit;
    padding: 7px 10px;
    border-radius: 12px;
    font-weight: 900;
    font-size: 12px;
    cursor: pointer;
    transition: transform 140ms ease, border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
}
.presence-action-btn:hover {
    transform: translateY(-1px);
    border-color: rgba(0, 212, 255, 0.28);
    box-shadow: 0 0 18px rgba(0, 212, 255, 0.10);
}
.presence-action-btn:active { transform: translateY(0); }
.presence-action-btn.is-primary {
    border-color: rgba(0, 212, 255, 0.28);
    background: rgba(0, 212, 255, 0.10);
}
.presence-action-btn.is-danger {
    border-color: rgba(255, 71, 87, 0.28);
    background: rgba(255, 71, 87, 0.10);
}
.presence-action-btn.is-danger:hover {
    border-color: rgba(255, 71, 87, 0.45);
    box-shadow: 0 0 18px rgba(255, 71, 87, 0.10);
}

.presence-viewing {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}
.presence-viewing-text {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.presence-preview {
    width: 42px;
    height: 42px;
    flex: 0 0 auto;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(0,0,0,0.25);
    object-fit: cover;
    box-shadow: 0 10px 22px rgba(0,0,0,0.25);
}

@media (max-width: 768px) {
    .presence-panel {
        position: fixed;
        top: 70px;
        right: 10px;
        left: 10px;
        width: auto;
    }
}

@media (max-width: 540px) {
    .presence-row {
        grid-template-columns: 62px 1fr;
    }
    .presence-pill {
        padding: 8px 9px;
        font-size: 12.5px;
    }
}

.dark-mode-toggle {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: white;
    border: none;
    padding: 0.5rem;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1rem;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.dark-mode-toggle:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 5px 15px var(--shadow-medium);
}

body.dark-mode .dark-mode-toggle {
    background: linear-gradient(135deg, var(--dark-accent-primary), var(--dark-accent-secondary));
    box-shadow: var(--dark-glow);
}

body.dark-mode .dark-mode-toggle:hover {
    box-shadow: var(--dark-glow-strong);
    transform: translateY(-2px) scale(1.05);
}

.admin-btn {
    background: linear-gradient(135deg, var(--accent-success), #229954);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.upload-btn {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.upload-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(52, 152, 219, 0.4);
}

.admin-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(39, 174, 96, 0.4);
}

body.dark-mode .admin-btn {
    background: linear-gradient(135deg, var(--dark-accent-success), #00cc73);
    box-shadow: 0 0 15px rgba(0, 255, 136, 0.3);
}

body.dark-mode .admin-btn:hover {
    box-shadow: 0 0 25px rgba(0, 255, 136, 0.5);
    transform: translateY(-2px);
}

/* 3D Gallery button - special VR styling */
#gallery3dBtn {
    background: linear-gradient(135deg, #8b5cf6, #6366f1);
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

#gallery3dBtn::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255,255,255,0.1), transparent);
    transform: rotate(45deg);
    animation: gallery3d-shimmer 3s infinite;
}

@keyframes gallery3d-shimmer {
    0% { transform: translateX(-100%) rotate(45deg); }
    100% { transform: translateX(100%) rotate(45deg); }
}

#gallery3dBtn:hover {
    background: linear-gradient(135deg, #a78bfa, #818cf8);
    box-shadow: 0 10px 30px rgba(139, 92, 246, 0.5);
    transform: translateY(-2px);
}

body.dark-mode #gallery3dBtn {
    background: linear-gradient(135deg, #a78bfa, #818cf8);
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.4);
}

body.dark-mode #gallery3dBtn:hover {
    box-shadow: 0 0 35px rgba(139, 92, 246, 0.6);
}

@media (max-width: 600px) {
    #gallery3dBtn .btn-text-desktop {
        display: none;
    }
}

/* AI Chat button - Dolphin theme */
#aiChatBtn {
    background: linear-gradient(135deg, #7c3aed, #a855f7);
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

#aiChatBtn::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255,255,255,0.15), transparent);
    transform: rotate(45deg);
    animation: aichat-shimmer 2.5s infinite;
}

@keyframes aichat-shimmer {
    0% { transform: translateX(-100%) rotate(45deg); }
    100% { transform: translateX(100%) rotate(45deg); }
}

#aiChatBtn:hover {
    background: linear-gradient(135deg, #8b5cf6, #c084fc);
    box-shadow: 0 10px 30px rgba(124, 58, 237, 0.5);
    transform: translateY(-2px);
}

body.dark-mode #aiChatBtn {
    background: linear-gradient(135deg, #8b5cf6, #c084fc);
    box-shadow: 0 0 20px rgba(124, 58, 237, 0.4);
}

body.dark-mode #aiChatBtn:hover {
    box-shadow: 0 0 35px rgba(124, 58, 237, 0.6);
}

@media (max-width: 600px) {
    #aiChatBtn .btn-text-desktop {
        display: none;
    }
}

/* AI Chat status indicator */
.ai-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #888;
    display: inline-block;
    margin-left: 6px;
    vertical-align: middle;
    transition: all 0.3s ease;
}

.ai-status-dot.online {
    background: #10b981;
    box-shadow: 0 0 8px #10b981;
    animation: ai-pulse 2s infinite;
}

.ai-status-dot.offline {
    background: #ef4444;
    box-shadow: 0 0 6px #ef4444;
}

.ai-status-dot.checking {
    background: #f59e0b;
    box-shadow: 0 0 6px #f59e0b;
    animation: ai-pulse 1s infinite;
}

@keyframes ai-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Video takeover AI status dot */
.video-takeover-admin-access .ai-status-dot {
    width: 10px;
    height: 10px;
    margin-left: 8px;
}

/* Main content */
.main {
    padding: 2.5rem 0 3.5rem 0;
    min-height: calc(100vh - 80px);
}

/* Media Filter Button (single cycle button in header) */
.media-filter-btn {
    background: linear-gradient(135deg, #667eea, #764ba2) !important;
    color: white !important;
    border: none !important;
    padding: 0.5rem 1rem !important;
    border-radius: 25px !important;
    cursor: pointer;
    font-weight: 500;
    display: flex !important;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.media-filter-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.5);
}

body.dark-mode .media-filter-btn {
    background: linear-gradient(135deg, #a78bfa, #818cf8) !important;
    box-shadow: 0 0 18px rgba(167, 139, 250, 0.35);
}

body.dark-mode .media-filter-btn:hover {
    box-shadow: 0 0 28px rgba(167, 139, 250, 0.6);
}

/* Filter type color variations */
.media-filter-btn[data-filter="image"] {
    background: linear-gradient(135deg, #3498db, #2980b9) !important;
}
.media-filter-btn[data-filter="video"] {
    background: linear-gradient(135deg, #e74c3c, #c0392b) !important;
}
.media-filter-btn[data-filter="audio"] {
    background: linear-gradient(135deg, #1db954, #1ed760) !important;
}

body.dark-mode .media-filter-btn[data-filter="image"] {
    background: linear-gradient(135deg, #00d4ff, #0099cc) !important;
    box-shadow: 0 0 18px rgba(0, 212, 255, 0.4);
}
body.dark-mode .media-filter-btn[data-filter="video"] {
    background: linear-gradient(135deg, #ff4757, #ff3742) !important;
    box-shadow: 0 0 18px rgba(255, 71, 87, 0.4);
}
body.dark-mode .media-filter-btn[data-filter="audio"] {
    background: linear-gradient(135deg, #00ff88, #00cc73) !important;
    box-shadow: 0 0 18px rgba(0, 255, 136, 0.4);
}

body.dark-mode .media-filter-btn[data-filter="image"]:hover {
    box-shadow: 0 0 30px rgba(0, 212, 255, 0.6);
}
body.dark-mode .media-filter-btn[data-filter="video"]:hover {
    box-shadow: 0 0 30px rgba(255, 71, 87, 0.6);
}
body.dark-mode .media-filter-btn[data-filter="audio"]:hover {
    box-shadow: 0 0 30px rgba(0, 255, 136, 0.6);
}

@media (max-width: 600px) {
    .media-filter-btn span {
        display: none;
    }
}

/* Gallery */
.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 2rem;
    margin-bottom: 2.5rem;
    perspective: 1400px;
    position: relative;
}

.gallery-item {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 22px;
    overflow: hidden;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.25);
    transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.6s ease, border 0.6s ease;
    cursor: pointer;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.14);
    backdrop-filter: blur(6px);
    transform-style: preserve-3d;
}

.gallery-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        conic-gradient(from 140deg, rgba(99, 135, 255, 0.22), rgba(255, 99, 146, 0.2), rgba(77, 255, 181, 0.22), rgba(99, 135, 255, 0.22));
    opacity: 0.35;
    transition: opacity 0.45s ease;
    z-index: 1;
}

.gallery-item:hover {
    transform: translateY(-14px) scale(1.03) rotateX(2deg);
    box-shadow: 0 30px 70px rgba(99, 135, 255, 0.25);
    border-color: rgba(99, 135, 255, 0.3);
    filter: drop-shadow(0 24px 40px rgba(0,0,0,0.18));
}

.gallery-item:hover::before {
    opacity: 0.9;
}

body.dark-mode .gallery-item {
    background: linear-gradient(160deg, rgba(15, 20, 40, 0.9), rgba(10, 14, 32, 0.9));
    box-shadow: 0 22px 60px rgba(0, 0, 0, 0.65), 0 0 30px rgba(0, 212, 255, 0.2);
    border: 1px solid rgba(0, 212, 255, 0.25);
}

body.dark-mode .gallery-item::before {
    background:
        conic-gradient(from 120deg, rgba(0, 212, 255, 0.35), rgba(0, 255, 136, 0.25), rgba(0, 140, 255, 0.3), rgba(0, 212, 255, 0.35));
}

body.dark-mode .gallery-item:hover {
    box-shadow: var(--dark-glow-strong), 0 15px 40px rgba(0, 0, 0, 0.7);
    transform: translateY(-10px) scale(1.03);
    border-color: rgba(0, 212, 255, 0.5);
}

.gallery-item img {
    width: 100%;
    height: 260px;
    object-fit: cover;
    transition: transform 0.55s ease;
    position: relative;
    z-index: 0;
    filter: saturate(1.08) contrast(1.03);
}

.gallery-item:hover img {
    transform: scale(1.08);
    filter: saturate(1.15) contrast(1.05);
}

/* Video thumbnails */
.video-thumbnail {
    position: relative;
    width: 100%;
    height: 260px;
    overflow: hidden;
}

.video-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: saturate(1.08) contrast(1.03);
}

.hover-preview {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: inherit;
    pointer-events: none;
    z-index: 2;
}

.video-play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    transition: all 0.3s ease;
}

.gallery-item:hover .video-play-icon {
    background: rgba(0, 0, 0, 0.9);
    transform: translate(-50%, -50%) scale(1.1);
}

.video-duration-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 0.3rem 0.5rem;
    border-radius: 15px;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

/* Audio duration badge */
.audio-duration-badge {
    top: auto;
    bottom: 10px;
    right: 10px;
    opacity: 0.95;
    font-variant-numeric: tabular-nums;
}

.audio-duration-badge .audio-duration-text {
    letter-spacing: 0.3px;
}

/* Modal audio player */
.audio-player-wrap {
    width: min(720px, 100%);
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
}

.audio-wave {
    width: min(720px, 100%);
    height: 120px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 12px 30px rgba(0,0,0,0.25);
}

.gallery-item-info {
    padding: 1.35rem;
    position: relative;
    z-index: 2;
    background: linear-gradient(180deg, rgba(255,255,255,0.85) 0%, rgba(255,255,255,0.9) 100%);
    backdrop-filter: blur(6px);
}

.gallery-item h3 {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    font-weight: 600;
    transition: color 0.3s ease;
}

body.dark-mode .gallery-item h3 {
    color: var(--dark-text-primary);
    text-shadow: 0 0 8px rgba(0, 212, 255, 0.3);
}

body.dark-mode .gallery-item-info {
    background: linear-gradient(180deg, rgba(26,26,26,0.85) 0%, rgba(12,14,24,0.9) 100%);
}

.gallery-item p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color 0.3s ease;
}

body.dark-mode .gallery-item p {
    color: var(--dark-text-secondary);
}

.gallery-item-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.75rem;
    font-size: 0.8rem;
    color: #95a5a6;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.gallery-item-meta span {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.media-type {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: white;
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    transition: all 0.3s ease;
    box-shadow: 0 6px 15px rgba(52, 152, 219, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.25);
}

/* Admin-only indicator: media is hidden for non-logged-in users */
.hidden-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: rgba(255, 255, 255, 0.95);
    background: linear-gradient(135deg, rgba(255, 71, 87, 0.95), rgba(255, 165, 0, 0.85));
    border: 1px solid rgba(255, 255, 255, 0.25);
    box-shadow: 0 6px 15px rgba(255, 71, 87, 0.22);
}

body.dark-mode .hidden-badge {
    box-shadow: 0 0 12px rgba(255, 71, 87, 0.35);
}

body.dark-mode .media-type {
    background: linear-gradient(135deg, var(--dark-accent-primary), var(--dark-accent-secondary));
    box-shadow: 0 0 10px rgba(0, 212, 255, 0.4);
    border-color: rgba(0, 212, 255, 0.35);
}

.like-count {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    color: var(--accent-danger);
    transition: all 0.3s ease;
    font-weight: 500;
    padding: 0.25rem 0.6rem;
    border-radius: 999px;
    background: rgba(231, 76, 60, 0.1);
    border: 1px solid rgba(231, 76, 60, 0.18);
}

body.dark-mode .like-count {
    color: var(--dark-accent-danger);
    text-shadow: 0 0 5px rgba(255, 71, 87, 0.5);
    background: rgba(255, 71, 87, 0.12);
    border-color: rgba(255, 71, 87, 0.25);
}

.upload-date {
    font-size: 0.75rem;
}

/* Loading */
.loading {
    text-align: center;
    padding: 2rem;
    color: #7f8c8d;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes float {
    0% { transform: translateY(0px) scale(1); }
    50% { transform: translateY(-12px) scale(1.02); }
    100% { transform: translateY(0px) scale(1); }
}

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

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

.no-more-images {
    text-align: center;
    padding: 2rem;
    color: #95a5a6;
    font-style: italic;
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.8);
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

/* Unlock (site password) modal: keep the floating background visible (no dark overlay) */
#unlockModal.modal {
    background-color: transparent !important;
    backdrop-filter: none !important;
}

/* Make the unlock card a bit more readable since the overlay is transparent */
#unlockModal .modal-content {
    background: linear-gradient(160deg, rgba(255,255,255,0.96), rgba(245,248,255,0.94));
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}

body.dark-mode #unlockModal .modal-content {
    background: linear-gradient(165deg, rgba(10,14,28,0.92), rgba(8,12,22,0.9));
    border: 1px solid rgba(0, 212, 255, 0.22);
    box-shadow: var(--dark-glow), 0 24px 60px rgba(0, 0, 0, 0.8);
}

body.dark-mode .modal {
    background-color: rgba(0,0,0,0.9);
    backdrop-filter: blur(15px);
}

.modal-content {
    background: linear-gradient(160deg, rgba(255,255,255,0.92), rgba(245,248,255,0.9));
    margin: 2% auto;
    padding: 1.75rem;
    border-radius: 22px;
    width: 95%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    animation: modalSlideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(255, 255, 255, 0.65);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(14px);
}

body.dark-mode .modal-content {
    background: linear-gradient(165deg, rgba(12, 16, 32, 0.92), rgba(7, 12, 24, 0.9));
    border: 1px solid rgba(0, 212, 255, 0.22);
    box-shadow: var(--dark-glow), 0 24px 60px rgba(0, 0, 0, 0.8);
}

.modal-large {
    max-width: 95vw;
    width: 95%;
    max-height: 88vh;
    margin: 1% auto;
    background: linear-gradient(145deg, rgba(255,255,255,0.9), rgba(240,244,255,0.92));
    border: 1px solid rgba(255,255,255,0.7);
    box-shadow: 0 28px 70px rgba(0,0,0,0.25);
}

body.dark-mode .modal-large {
    background: linear-gradient(145deg, rgba(10,14,28,0.92), rgba(8,12,22,0.9));
    border: 1px solid rgba(0,212,255,0.25);
    box-shadow: var(--dark-glow-strong), 0 28px 70px rgba(0,0,0,0.75);
}

.modal-image {
    max-width: 98vw;
    width: 98%;
    max-height: 95vh;
    margin: 0.5% auto;
}

.modal-image {
    max-width: 95%;
    max-height: 90%;
    overflow-y: auto;
}


@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.close {
    position: absolute;
    right: 15px;
    top: 15px;
    color: #e74c3c;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    z-index: 1001;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.close:hover {
    color: var(--accent-danger);
    background: rgba(231, 76, 60, 0.2);
    transform: scale(1.1);
}

body.dark-mode .close {
    color: #e74c3c;
}

body.dark-mode .close:hover {
    color: #ff6b6b;
    background: rgba(255, 71, 87, 0.25);
    box-shadow: 0 0 15px rgba(255, 71, 87, 0.4);
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 0.85rem;
}

body.dark-mode .form-group label {
    color: var(--dark-text-primary);
    text-shadow: 0 0 5px rgba(0, 212, 255, 0.3);
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 15px;
    font-size: 0.9rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: var(--bg-secondary);
    color: var(--text-primary);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 20px rgba(52, 152, 219, 0.2);
    transform: scale(1.02);
}

body.dark-mode .form-group input,
body.dark-mode .form-group textarea,
body.dark-mode .form-group select {
    background: var(--dark-bg-tertiary);
    color: var(--dark-text-primary);
    border-color: var(--dark-border-color);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

body.dark-mode .form-group input:focus,
body.dark-mode .form-group textarea:focus,
body.dark-mode .form-group select:focus {
    border-color: var(--dark-accent-primary);
    box-shadow: var(--dark-glow);
}

.file-info {
    margin-top: 0.5rem;
}

.file-info small {
    color: #7f8c8d;
    font-size: 0.8rem;
}

/* Buttons */
.btn {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 25px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.btn:hover::before {
    left: 100%;
}

.btn:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 10px 25px rgba(52, 152, 219, 0.4);
}

body.dark-mode .btn {
    background: linear-gradient(135deg, var(--dark-accent-primary), var(--dark-accent-secondary));
    box-shadow: 0 0 15px rgba(0, 212, 255, 0.3);
}

body.dark-mode .btn:hover {
    box-shadow: var(--dark-glow-strong);
    transform: translateY(-3px) scale(1.05);
}

.btn-primary {
    background: #3498db;
}

.btn-primary:hover {
    background: #2980b9;
}

.btn-success {
    background: linear-gradient(135deg, var(--accent-success), #229954);
}

.btn-success:hover {
    box-shadow: 0 10px 25px rgba(39, 174, 96, 0.4);
}

body.dark-mode .btn-success {
    background: linear-gradient(135deg, var(--dark-accent-success), #00cc73);
    box-shadow: 0 0 15px rgba(0, 255, 136, 0.3);
}

body.dark-mode .btn-success:hover {
    box-shadow: 0 0 25px rgba(0, 255, 136, 0.5);
}

.btn-danger {
    background: linear-gradient(135deg, var(--accent-danger), #c0392b);
}

.btn-danger:hover {
    box-shadow: 0 10px 25px rgba(231, 76, 60, 0.4);
}

body.dark-mode .btn-danger {
    background: linear-gradient(135deg, var(--dark-accent-danger), #ff3742);
    box-shadow: 0 0 15px rgba(255, 71, 87, 0.3);
}

body.dark-mode .btn-danger:hover {
    box-shadow: 0 0 25px rgba(255, 71, 87, 0.5);
}

/* NOTE: Removed invalid orphan "Chat Button" declarations (they break CSS parsing). */


.btn-like {
    background: transparent;
    color: #e74c3c;
    border: 2px solid #e74c3c;
}

.btn-like:hover {
    background: #e74c3c;
    color: white;
}

.btn-like.liked {
    background: #e74c3c;
    color: white;
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
}

/* Admin Panel */
.admin-tabs {
    display: flex;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid rgba(255,255,255,0.4);
    flex-wrap: wrap;
    gap: 0.5rem;
}

body.dark-mode .admin-tabs {
    border-bottom-color: rgba(0, 212, 255, 0.25);
}

.tab-btn {
    background: rgba(255,255,255,0.6);
    border: 1px solid rgba(255,255,255,0.7);
    padding: 0.75rem 1rem;
    cursor: pointer;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all 0.3s ease;
    border-bottom: 3px solid transparent;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border-radius: 12px 12px 0 0;
    box-shadow: 0 6px 15px rgba(0,0,0,0.08);
}

.tab-btn:hover,
.tab-btn.active {
    color: #0f172a;
    border-bottom-color: var(--accent-primary);
    background: #ffffff;
}

body.dark-mode .tab-btn {
    color: var(--dark-text-secondary);
    background: rgba(12, 16, 32, 0.7);
    border-color: rgba(0, 212, 255, 0.18);
}

body.dark-mode .tab-btn:hover,
body.dark-mode .tab-btn.active {
    color: var(--dark-text-primary);
    border-bottom-color: var(--dark-accent-primary);
    background: rgba(12, 20, 40, 0.9);
    box-shadow: var(--dark-glow);
}

.tab-btn.logout {
    margin-left: auto;
    color: var(--accent-danger);
}

.tab-btn.logout:hover {
    background: var(--accent-danger);
    color: white;
    border-radius: 5px;
    border-bottom-color: transparent;
}

body.dark-mode .tab-btn.logout {
    color: var(--dark-accent-danger);
}

body.dark-mode .tab-btn.logout:hover {
    background: var(--dark-accent-danger);
}

.tab-content {
    display: none;
    background: rgba(255,255,255,0.75);
    border: 1px solid rgba(255,255,255,0.6);
    border-radius: 18px;
    padding: 1.25rem;
    box-shadow: 0 12px 35px rgba(0,0,0,0.08);
}

.tab-content.active {
    display: block;
}

body.dark-mode .tab-content {
    background: rgba(14, 18, 30, 0.9);
    border: 1px solid rgba(0, 212, 255, 0.18);
    box-shadow: 0 12px 35px rgba(0,0,0,0.55), var(--dark-glow);
}

/* Admin Images List */
.admin-images-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.2rem;
    max-height: 600px;
    overflow-y: auto;
    padding: 1.2rem;
    border: 1px solid rgba(255,255,255,0.35);
    border-radius: 14px;
    background: linear-gradient(145deg, rgba(255,255,255,0.85), rgba(244,248,255,0.85));
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.6), 0 12px 30px rgba(0,0,0,0.08);
}

.admin-image-item {
    background: rgba(255,255,255,0.9);
    padding: 1rem;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 12px 30px rgba(0,0,0,0.08);
    border: 1px solid rgba(255,255,255,0.6);
}

.admin-image-item img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    border-radius: 5px;
    margin-bottom: 0.5rem;
}

.admin-image-item h4 {
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.admin-image-item p {
    font-size: 0.8rem;
    color: #7f8c8d;
    margin-bottom: 1rem;
}

.admin-actions,
.admin-item-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
}

.admin-image-item p:last-of-type {
    margin-bottom: 0.5rem;
}

body.dark-mode .admin-images-list {
    background: linear-gradient(145deg, rgba(10,14,28,0.9), rgba(8,12,22,0.9));
    border-color: rgba(0, 212, 255, 0.2);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.04), 0 12px 30px rgba(0,0,0,0.5);
}

body.dark-mode .admin-image-item {
    background: rgba(18,20,32,0.9);
    border: 1px solid rgba(0, 212, 255, 0.15);
    box-shadow: 0 12px 30px rgba(0,0,0,0.6);
}

/* Manage Tab Header */
.manage-header {
    margin-bottom: 1.5rem;
}

.manage-header h3 {
    color: #2c3e50;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.manage-header p {
    color: #7f8c8d;
}

/* Reorder Tab Styles */
.reorder-instructions {
    background: linear-gradient(135deg, rgba(255,255,255,0.9), rgba(234,242,255,0.9));
    border: 1px solid rgba(255,255,255,0.7);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 10px 28px rgba(0,0,0,0.08);
}

.reorder-instructions h3 {
    color: #2c3e50;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.reorder-instructions p {
    color: #555;
    margin-bottom: 1rem;
}

.reorder-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.btn-secondary {
    background: #95a5a6;
    color: white;
}

.btn-secondary:hover {
    background: #7f8c8d;
    box-shadow: 0 5px 15px rgba(149, 165, 166, 0.4);
}

/* New Grid-based Sortable System */
.sortable-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    padding: 1rem;
    max-height: 600px;
    overflow-y: auto;
    background: linear-gradient(145deg, rgba(255,255,255,0.9), rgba(242,246,255,0.9));
    border-radius: 12px;
    border: 2px dashed rgba(52, 152, 219, 0.35);
    box-shadow: 0 12px 30px rgba(0,0,0,0.08);
}

.sortable-card {
    background: rgba(255,255,255,0.95);
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    cursor: grab;
    position: relative;
    overflow: hidden;
    border: 2px solid transparent;
}

.sortable-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    border-color: #3498db;
}

.sortable-card:hover .drag-overlay {
    opacity: 1;
}

.sortable-card.being-dragged {
    transform: rotate(5deg) scale(1.05);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    cursor: grabbing;
}

.sortable-card.drag-over {
    border-color: #27ae60;
    background: #e8f6f3;
    transform: scale(1.02);
    box-shadow: 0 0 20px rgba(39, 174, 96, 0.4);
}

.drag-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(52, 152, 219, 0.9);
    color: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    font-size: 0.9rem;
    font-weight: 600;
    text-align: center;
    pointer-events: none;
    z-index: 5;
}

.drag-overlay i {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.sortable-image-container {
    position: relative;
    height: 200px;
    overflow: hidden;
}

.sortable-image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 0.3rem 0.6rem;
    border-radius: 15px;
    font-size: 0.8rem;
}

.sortable-content {
    padding: 1rem;
}

.sortable-content h4 {
    margin: 0 0 0.75rem 0;
    font-size: 1.1rem;
    color: #2c3e50;
    font-weight: 600;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.sortable-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.media-type-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.25rem 0.6rem;
    border-radius: 15px;
    font-size: 0.75rem;
    font-weight: 600;
}

.media-type-badge.image {
    background: #3498db;
    color: white;
}

.media-type-badge.video {
    background: #e74c3c;
    color: white;
}

.upload-date {
    font-size: 0.8rem;
    color: #7f8c8d;
}

.position-number {
    position: absolute;
    top: -10px;
    left: -10px;
    background: #27ae60;
    color: white;
    border-radius: 50%;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.9rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    z-index: 10;
}

body.dark-mode .sortable-grid {
    background: linear-gradient(145deg, rgba(12,16,30,0.9), rgba(10,12,22,0.9));
    border-color: rgba(0, 212, 255, 0.2);
    box-shadow: 0 12px 30px rgba(0,0,0,0.6);
}

body.dark-mode .sortable-card {
    background: rgba(18,20,32,0.95);
    border-color: rgba(0, 212, 255, 0.15);
    box-shadow: 0 8px 22px rgba(0,0,0,0.55);
}

/* Settings Tab */
.settings-section {
    background: #f8f9fa;
    border: 1px solid #ecf0f1;
    border-radius: 8px;
    padding: 2rem;
    max-width: 500px;
}

.settings-section h3 {
    color: #2c3e50;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.settings-section p {
    color: #7f8c8d;
    margin-bottom: 1.5rem;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .sortable-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .sortable-card {
        max-width: none;
    }
    
    .settings-section {
        padding: 1.5rem;
    }
}

/* Image Detail */
.image-detail {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

.image-container {
    text-align: center;
}

.image-container img,
.image-container video {
    max-width: 100%;
    max-height: 60vh;
    object-fit: contain;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.image-container video {
    background: #000;
}

.image-container video::-webkit-media-controls-panel {
    background-color: rgba(0, 0, 0, 0.8);
}

.image-info h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: #2c3e50;
}

.image-stats {
    display: flex;
    gap: 1rem;
    margin: 1rem 0;
    font-size: 0.9rem;
    color: #7f8c8d;
}

.image-actions {
    margin: 1rem 0;
}

/* Comments */
.comments-section {
    margin-top: 2rem;
    border-top: 1px solid #ecf0f1;
    padding-top: 1rem;
}

.comments-section h4 {
    margin-bottom: 1rem;
    color: #2c3e50;
}

.comment-form {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.comments-list {
    max-height: 300px;
    overflow-y: auto;
}

.comment {
    background: white;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    border-left: 3px solid #3498db;
}

.comment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.comment-author {
    font-weight: 600;
    color: #2c3e50;
}

.comment-date {
    font-size: 0.8rem;
    color: #95a5a6;
}

.comment-text {
    color: #555;
    line-height: 1.5;
}

/* Toast notifications */
.toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: linear-gradient(135deg, #2c3e50, #34495e);
    color: white;
    padding: 1.25rem 1.75rem;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    transform: translateY(100px) scale(0.8);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0;
    pointer-events: none;
    z-index: 1001;
    max-width: 350px;
    font-weight: 500;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.toast.feature-toast {
    /* sit above normal toasts so it doesn't get overwritten visually */
    top: 92px;
    left: 50%;
    right: auto;
    bottom: auto;
    max-width: 420px;
    padding: 1.1rem 1.15rem;
    z-index: 5000;
    /* Center nicely on desktop without breaking the base toast enter animation */
    transform: translate(-50%, 100px) scale(0.8);
}
.toast.feature-toast * { pointer-events: auto; }
.toast.feature-toast { pointer-events: none; }
.toast.feature-toast.show { pointer-events: auto; }
.toast.feature-toast.show {
    transform: translate(-50%, 0) scale(1);
}
.toast.feature-toast .feature-toast-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
    margin-bottom: 6px;
    letter-spacing: 0.2px;
}
.toast.feature-toast .feature-toast-title i {
    color: rgba(0, 212, 255, 0.95);
    filter: drop-shadow(0 0 10px rgba(0, 212, 255, 0.35));
}
.toast.feature-toast .feature-toast-desc {
    opacity: 0.92;
    font-size: 0.95rem;
    margin-bottom: 10px;
}
.toast.feature-toast .feature-toast-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}
.toast.feature-toast .feature-toast-actions .btn {
    pointer-events: auto;
}

.toast.show {
    transform: translateY(0) scale(1);
    opacity: 1;
    pointer-events: auto;
}

.toast.success {
    background: linear-gradient(135deg, var(--accent-success), #229954);
    box-shadow: 0 10px 30px rgba(39, 174, 96, 0.4);
}

.toast.error {
    background: linear-gradient(135deg, var(--accent-danger), #c0392b);
    box-shadow: 0 10px 30px rgba(231, 76, 60, 0.4);
}

body.dark-mode .toast {
    background: linear-gradient(135deg, var(--dark-bg-secondary), #2a2a2a);
    border: 1px solid rgba(0, 212, 255, 0.3);
    box-shadow: var(--dark-glow);
}

body.dark-mode .toast.success {
    background: linear-gradient(135deg, var(--dark-accent-success), #00cc73);
    box-shadow: 0 0 20px rgba(0, 255, 136, 0.4);
}

body.dark-mode .toast.error {
    background: linear-gradient(135deg, var(--dark-accent-danger), #ff3742);
    box-shadow: 0 0 20px rgba(255, 71, 87, 0.4);
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 0 10px;
    }
    
    .header .container {
        padding: 0.6rem 10px;
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    
    .logo {
        font-size: 1.2rem;
    }

    .logo-image {
        height: 34px;
        max-width: 160px;
    }
    
    .nav {
        gap: 8px;
        flex-wrap: wrap;
        justify-content: center;
        width: 100%;
    }

    .nav .admin-btn,
    .nav .upload-btn,
    .nav .dark-mode-toggle {
        padding: 0.45rem 0.75rem;
        border-radius: 18px;
        font-size: 0.85rem;
        height: 38px;
    }

    /* Dark mode is a circle button on desktop; keep it compact in the wrap */
    .nav .dark-mode-toggle {
        width: 38px;
        min-width: 38px;
        padding: 0;
    }
    
    .gallery {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 1rem;
    }
    
    .modal-content {
        margin: 1% auto;
        padding: 1rem;
        width: 98%;
        max-height: 95vh;
    }
    
    .modal-large {
        width: 98%;
        max-width: none;
        margin: 1% auto;
        padding: 1rem;
    }
    
    .modal-image {
        width: 98%;
        max-width: none;
        margin: 1% auto;
        padding: 0.75rem;
    }
    
    .image-detail {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .image-container img,
    .image-container video {
        max-height: 40vh;
    }
    
    .image-stats {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .admin-tabs {
        flex-direction: column;
        gap: 0;
        margin-bottom: 1rem;
    }
    
    .tab-btn {
        padding: 0.75rem 0.5rem;
        text-align: left;
        border-bottom: 1px solid var(--border-color);
        border-radius: 0;
    }
    
    body.dark-mode .tab-btn {
        border-bottom-color: var(--dark-border-color);
    }
    
    .tab-btn.logout {
        margin-left: 0;
        margin-top: 0.5rem;
        border-top: 1px solid var(--border-color);
    }
    
    body.dark-mode .tab-btn.logout {
        border-top-color: var(--dark-border-color);
    }
    
    .sortable-grid {
        grid-template-columns: 1fr;
        max-height: 70vh;
        padding: 0.5rem;
    }
    
    .settings-section {
        padding: 1rem;
    }
    
    .toast {
        bottom: 15px;
        right: 15px;
        left: 15px;
        max-width: none;
    }

    /* On phones, keep the feature CTA pinned to the bottom so it doesn't cover
       the "Nowości" notifications (which are near the top). */
    .toast.feature-toast {
        top: auto;
        /* Extra offset so it's visible even when mobile browser bottom bars are expanded */
        bottom: calc(84px + env(safe-area-inset-bottom, 0px));
        left: 12px;
        right: 12px;
        width: auto;
        max-width: none;
        transform: translateY(100px) scale(0.95);
    }
    .toast.feature-toast.show {
        transform: translateY(0) scale(1);
    }
}

@media (max-width: 420px) {
    .nav {
        gap: 6px;
    }
    .nav .admin-btn,
    .nav .upload-btn {
        padding: 0.4rem 0.65rem;
        font-size: 0.82rem;
    }
}

@media (max-width: 480px) {
    .gallery {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .modal-content {
        margin: 5% auto;
        padding: 1rem;
    }

    .toast {
        right: 10px;
        left: 10px;
        max-width: none;
    }
}

/* NOTE: Removed invalid orphan "Chat Interface" declarations (they break CSS parsing). */





/* Content notification styles */
.content-notification {
    position: fixed !important;
    top: 20px !important;
    right: 20px !important;
    width: 350px;
    max-width: calc(100vw - 40px);
    background: var(--bg-primary);
    border: 2px solid var(--accent-primary);
    border-radius: 16px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4), 0 0 20px rgba(52, 152, 219, 0.2);
    z-index: 9999999 !important;
    transform: translateX(100%);
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    backdrop-filter: blur(20px);
    overflow: hidden;
    font-family: 'Space Grotesk', -apple-system, BlinkMacSystemFont, sans-serif;
}

.content-notification.visible {
    transform: translateX(0) !important;
}

/* Ensure notification is always on top and positioned correctly */
.content-notification {
    /* Force viewport positioning */
    position: fixed !important;
    top: 20px !important;
    right: 20px !important;
    z-index: 2147483647 !important; /* Maximum z-index */
}

/* Additional specificity to override any conflicting styles */
body .content-notification {
    position: fixed !important;
    top: 20px !important;
    right: 20px !important;
    z-index: 2147483647 !important;
}

html body .content-notification {
    position: fixed !important;
    top: 20px !important;
    right: 20px !important;
    z-index: 2147483647 !important;
}

/* Force correct positioning regardless of parent */
.content-notification,
.content-notification * {
    box-sizing: border-box;
}

/* Override any parent transforms that might affect positioning */
.content-notification {
    transform-origin: top right;
    will-change: transform;
}

.notification-header {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-weight: 700;
    font-size: 16px;
    gap: 10px;
    position: relative;
    overflow: hidden;
}

.notification-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent 30%, rgba(255, 255, 255, 0.1) 50%, transparent 70%);
    animation: shimmer 2s infinite;
    /* Don't block clicks on the close button / header */
    pointer-events: none;
    z-index: 0;
}

/* Ensure header content (including the X button) is above the animated overlay */
.notification-header > * {
    position: relative;
    z-index: 1;
}

.notification-header .fa-bell {
    color: #ffd700;
    font-size: 18px;
    filter: drop-shadow(0 0 4px rgba(255, 215, 0, 0.5));
    animation: bellRing 2s infinite;
}

@keyframes bellRing {
    0%, 100% { transform: rotate(0deg); }
    10%, 30%, 50%, 70%, 90% { transform: rotate(-10deg); }
    20%, 40%, 60%, 80% { transform: rotate(10deg); }
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.notification-close {
    margin-left: auto;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 6px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.notification-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.notification-content {
    padding: 20px;
}

.notification-text {
    margin-bottom: 16px;
    font-size: 15px;
    line-height: 1.5;
    color: var(--text-primary);
    font-weight: 500;
}

.notification-preview {
    margin-bottom: 16px;
    border-radius: 12px;
    overflow: hidden;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 180px;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.1);
    position: relative;
}

.notification-preview::before {
    /* Removed placeholder icon overlay (it was showing on top of real thumbnails) */
    content: none;
    display: none;
}

.notification-video,
.notification-image {
    width: 100%;
    height: 180px;
    object-fit: cover;
    border-radius: 8px;
    transition: transform 0.3s ease;
}

.notification-video:hover,
.notification-image:hover {
    transform: scale(1.02);
}

.notification-video {
    background: black;
}

.notification-description {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 16px;
    font-style: italic;
    padding: 12px 16px;
    background: linear-gradient(135deg, rgba(52, 152, 219, 0.1) 0%, rgba(155, 89, 182, 0.1) 100%);
    border-radius: 10px;
    border-left: 4px solid var(--accent-primary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.notification-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 16px;
}

.notification-actions .btn {
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 8px;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.notification-actions .btn-primary {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: white;
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
}

.notification-actions .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(52, 152, 219, 0.4);
}

.notification-actions .btn-secondary {
    background: rgba(149, 165, 166, 0.1);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.notification-actions .btn-secondary:hover {
    background: rgba(149, 165, 166, 0.2);
    transform: translateY(-1px);
}

/* Dark mode for notifications */
body.dark-mode .content-notification {
    background: var(--dark-bg-primary);
    border-color: var(--dark-border-color);
}

body.dark-mode .notification-text {
    color: var(--dark-text-primary);
}

body.dark-mode .notification-description {
    background: var(--dark-bg-secondary);
    color: var(--dark-text-secondary);
}

/* Mobile notification adjustments */
@media (max-width: 768px) {
    .content-notification {
        left: 8px;
        right: 8px;
        width: auto;
        max-width: none;
        top: 8px;
        border-radius: 12px;
        border-width: 1px;
    }

    .notification-header {
        padding: 10px 12px;
        font-size: 13px;
        gap: 8px;
    }

    .notification-header .fa-bell {
        font-size: 14px;
    }

    .notification-close {
        width: 28px;
        height: 28px;
        font-size: 16px;
        padding: 4px;
    }

    .notification-content {
        padding: 10px 12px;
    }

    .notification-text {
        font-size: 13px;
        margin-bottom: 10px;
        line-height: 1.4;
    }

    .notification-preview {
        min-height: 80px;
        margin-bottom: 10px;
        border-radius: 8px;
    }

    .notification-video,
    .notification-image {
        height: 80px;
        border-radius: 6px;
    }

    .notification-description {
        font-size: 12px;
        padding: 8px 10px;
        margin-bottom: 10px;
        border-radius: 6px;
    }

    .notification-actions {
        flex-direction: row;
        gap: 8px;
        margin-top: 10px;
    }

    .notification-actions .btn {
        flex: 1;
        justify-content: center;
        padding: 8px 12px;
        font-size: 12px;
        border-radius: 8px;
    }
}

/* Dark mode improvements */
body.dark-mode .content-notification {
    background: linear-gradient(135deg, rgba(26, 26, 26, 0.95) 0%, rgba(46, 46, 46, 0.95) 100%);
    border-color: rgba(52, 152, 219, 0.5);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6), 0 0 20px rgba(52, 152, 219, 0.3);
}

body.dark-mode .notification-preview {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
}

body.dark-mode .notification-description {
    background: linear-gradient(135deg, rgba(52, 152, 219, 0.15) 0%, rgba(155, 89, 182, 0.15) 100%);
    color: var(--dark-text-secondary);
}

/* Admin notification management styles */
.notifications-status {
    margin-bottom: 20px;
    padding: 15px;
    background: var(--bg-secondary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.status-info {
    display: flex;
    gap: 20px;
    margin-bottom: 15px;
}

.status-item {
    padding: 8px 12px;
    background: var(--accent-primary);
    color: white;
    border-radius: 6px;
    font-weight: 600;
}

.recent-notifications h4 {
    margin-bottom: 10px;
    color: var(--text-primary);
    font-size: 16px;
}

.notifications-list {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-primary);
}

.notification-item {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.notification-item:last-child {
    border-bottom: none;
}

.notification-item strong {
    color: var(--text-primary);
    font-size: 14px;
}

.notification-action {
    font-size: 12px;
    color: var(--accent-primary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.notification-time {
    font-size: 11px;
    color: var(--text-secondary);
}

.notification-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

body.dark-mode .notifications-status {
    background: var(--dark-bg-secondary);
    border-color: var(--dark-border-color);
}

body.dark-mode .notifications-list {
    background: var(--dark-bg-primary);
    border-color: var(--dark-border-color);
}

body.dark-mode .notification-item {
    border-color: var(--dark-border-color);
}

/* Content removal animation */
@keyframes contentRemoval {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    100% {
        opacity: 0;
        transform: scale(0.8);
    }
}

.gallery-item.removing {
    animation: contentRemoval 0.5s ease-out forwards;
}

/* New content highlight animation */
@keyframes newContentHighlight {
    0% {
        box-shadow: 0 0 0 0 rgba(52, 152, 219, 0.7);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 20px 5px rgba(52, 152, 219, 0.4);
        transform: scale(1.02);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(52, 152, 219, 0);
        transform: scale(1);
    }
}

.gallery-item {
    transition: all 0.3s ease;
}

.gallery-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

body.dark-mode .gallery-item:hover {
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
}

/* =========================================================
   AI Variation Generation Modal
   ========================================================= */

.variation-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.variation-modal-content {
    background: linear-gradient(145deg, #1e1e2e, #2a2a3e);
    border-radius: 20px;
    padding: 30px;
    max-width: 800px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.variation-close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #fff;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
}

.variation-close-btn:hover {
    background: rgba(255, 107, 107, 0.3);
    transform: scale(1.1);
}

.variation-title {
    text-align: center;
    color: #fff;
    margin-bottom: 24px;
    font-size: 22px;
    font-weight: 600;
}

.variation-title i {
    color: #a78bfa;
    margin-right: 10px;
}

.variation-stage {
    animation: variationFadeIn 0.3s ease;
}

@keyframes variationFadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Live Preview */
.variation-preview-container {
    width: 100%;
    aspect-ratio: 1;
    max-width: 400px;
    margin: 0 auto 20px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    overflow: hidden;
    position: relative;
}

.variation-live-preview {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: none;
}

.variation-preview-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.4);
    gap: 12px;
}

.variation-preview-placeholder i {
    font-size: 48px;
    animation: spinnerRotate 1s linear infinite;
}

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

/* Queue Banner */
.variation-queue-banner {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: #fff;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 16px;
    font-weight: 600;
    animation: queuePulse 2s ease-in-out infinite;
}

.variation-queue-banner i {
    font-size: 20px;
    animation: hourglassSpin 2s linear infinite;
}

@keyframes queuePulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.85; transform: scale(0.98); }
}

@keyframes hourglassSpin {
    0% { transform: rotate(0deg); }
    50% { transform: rotate(180deg); }
    100% { transform: rotate(180deg); }
}

/* Progress Bar */
.variation-progress {
    margin-bottom: 20px;
}

.variation-progress-bar {
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.variation-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #a78bfa, #7c3aed);
    border-radius: 4px;
    width: 0%;
    transition: width 0.3s ease;
}

.variation-progress-text {
    text-align: center;
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
}

/* Prompt Preview */
.variation-prompt-preview {
    background: rgba(0, 0, 0, 0.2);
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
    text-align: center;
}

.variation-prompt-preview strong {
    color: #a78bfa;
}

/* Comparison View */
.variation-comparison {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.variation-original,
.variation-generated {
    flex: 1;
    min-width: 200px;
    max-width: 320px;
    text-align: center;
}

.variation-label {
    color: rgba(255, 255, 255, 0.6);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

.variation-original img,
.variation-original video,
.variation-generated img,
.variation-generated video {
    width: 100%;
    max-height: 400px;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

.variation-arrow {
    color: rgba(255, 255, 255, 0.3);
    font-size: 24px;
}

/* Result Prompt */
.variation-result-prompt {
    background: rgba(167, 139, 250, 0.1);
    padding: 14px 18px;
    border-radius: 10px;
    margin-bottom: 24px;
    color: rgba(255, 255, 255, 0.85);
    font-size: 14px;
    text-align: center;
    border: 1px solid rgba(167, 139, 250, 0.2);
}

.variation-result-prompt strong {
    color: #a78bfa;
}

.variation-result-prompt label {
    display: block;
    margin-bottom: 8px;
    text-align: left;
}

.variation-prompt-edit {
    width: 100%;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(167, 139, 250, 0.3);
    border-radius: 8px;
    padding: 12px;
    color: rgba(255, 255, 255, 0.9);
    font-size: 13px;
    font-family: inherit;
    resize: vertical;
    min-height: 60px;
    max-height: 150px;
}

.variation-prompt-edit:focus {
    outline: none;
    border-color: rgba(167, 139, 250, 0.6);
    box-shadow: 0 0 10px rgba(167, 139, 250, 0.2);
}

.variation-prompt-edit::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

/* Actions */
.variation-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.variation-actions .btn {
    padding: 12px 24px;
    border-radius: 10px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.variation-actions .btn-primary {
    background: linear-gradient(135deg, #a78bfa, #7c3aed);
    color: #fff;
}

.variation-actions .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(167, 139, 250, 0.4);
}

.variation-actions .btn-success {
    background: linear-gradient(135deg, #34d399, #10b981);
    color: #fff;
}

.variation-actions .btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(52, 211, 153, 0.4);
}

.variation-actions .btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.variation-actions .btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

.variation-actions .btn-info {
    background: linear-gradient(135deg, #38bdf8, #0ea5e9);
    color: #fff;
}

.variation-actions .btn-info:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(56, 189, 248, 0.4);
}

/* Cancel button in generating state */
#variationCancelBtn {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 12px 24px;
    border-radius: 10px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

#variationCancelBtn:hover {
    background: rgba(255, 107, 107, 0.2);
    border-color: rgba(255, 107, 107, 0.4);
}

/* Error State */
.variation-error-icon {
    text-align: center;
    font-size: 64px;
    color: #ff6b6b;
    margin-bottom: 16px;
}

.variation-error-text {
    text-align: center;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 24px;
}

/* Gallery Item Variation Button */
.gallery-item .variation-btn {
    position: absolute;
    top: 10px;
    left: 10px;
    background: linear-gradient(135deg, #a78bfa, #7c3aed);
    color: #fff;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    opacity: 1;
    transform: scale(1);
    transition: all 0.2s ease;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    animation: variationPulse 2s ease-in-out infinite, variationBounce 1.5s ease-in-out infinite;
    box-shadow: 0 0 0 0 rgba(167, 139, 250, 0.7);
}

@keyframes variationPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(167, 139, 250, 0.7);
    }
    50% {
        box-shadow: 0 0 15px 5px rgba(167, 139, 250, 0.4);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(167, 139, 250, 0.7);
    }
}

@keyframes variationBounce {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.15);
    }
}

.gallery-item .variation-btn:hover {
    transform: scale(1.2);
    box-shadow: 0 4px 20px rgba(167, 139, 250, 0.6);
    animation: none;
}

/* Mobile: always show variation button, move to top right */
@media (max-width: 768px), (hover: none) {
    .gallery-item .variation-btn {
        opacity: 1;
        transform: scale(1);
        width: 36px;
        height: 36px;
        font-size: 14px;
        /* Move to top right on mobile */
        top: 10px;
        left: auto;
        right: 10px;
        animation: variationPulse 2s ease-in-out infinite, variationBounce 1.5s ease-in-out infinite;
    }
    
    .gallery-item .variation-btn:active {
        transform: scale(0.95);
        opacity: 1;
        animation: none;
    }
}

/* Modal Variation Button */
.modal-variation-btn {
    background: linear-gradient(135deg, #a78bfa, #7c3aed) !important;
    color: #fff !important;
    border: none !important;
    padding: 10px 20px !important;
    border-radius: 8px !important;
    cursor: pointer;
    font-weight: 500;
    /* display controlled by JS - no !important here */
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
    font-size: 14px;
    box-shadow: 0 2px 8px rgba(167, 139, 250, 0.3);
}

.modal-variation-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(167, 139, 250, 0.5);
    background: linear-gradient(135deg, #b69dfc, #8b4df5) !important;
}

.modal-variation-btn i {
    font-size: 14px;
}

/* Responsive */
@media (max-width: 600px) {
    .variation-modal-content {
        padding: 20px;
    }
    
    .variation-comparison {
        flex-direction: column;
    }
    
    .variation-arrow {
        transform: rotate(90deg);
    }
    
    .variation-original,
    .variation-generated {
        max-width: 100%;
    }
}
