/* ============================================================================
   PAGES: MAL-TOOL
   ============================================================================
   Styles für das Mal-Tool (Bilderbuch-Erstellung)
   ============================================================================ */

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

        /* Entferne Rahmen bei allen geöffneten Dropdown-Menüs */
        select:focus,
        .dropdown-select:focus,
        .books-dropdown:focus {
            outline: none !important;
        }
        /* WICHTIG: select:active entfernt den Border, was zu Flackern führt - daher entfernt */
        
        body {
            font-family: 'JetBrains Mono', monospace;
            /* Sanfter, kinderfreundlicher Hintergrund (wie Hauptseite) */
            background: linear-gradient(135deg, #ffe6f7 0%, #d4f1ff 50%, #dfffe2 100%);
            min-height: 100vh;
            min-height: -webkit-fill-available;
            overflow-x: hidden;
            overflow-y: auto !important; /* Erzwinge vertikales Scrollen */
            padding: 20px;
            padding-top: 60px;
            /* Erlaube Scrollen an die Seite weiterzugeben, wenn Container am Ende */
            overscroll-behavior-y: auto;
            /* Verhindere Textauswahl für App-ähnliches Verhalten (außer Input-Felder) */
            -webkit-user-select: none;
            user-select: none;
            /* Verhindere Touch-Callouts */
            -webkit-touch-callout: none;
            /* Verhindere Text-Größenänderung */
            -webkit-text-size-adjust: 100%;
            /* Verstecke Scrollbars */
            scrollbar-width: none; /* Firefox */
            -ms-overflow-style: none; /* IE und Edge */
        }
        
        /* KIKI-Animation: immer über allem sichtbar (Chat, Modals, Header) – gleicher Max-z-index wie kiki-styles.css */
        #kikiGlobalWrap,
        #kikiBubbleChat {
            z-index: 2147483647 !important;
        }
        
        /* Sprechblase mehr Abstand zu Kiki (wie Startseite), damit der Kopf nicht abgeschnitten wird */
        #kikiBubbleChat {
            transform: translate(-50%, -24px) scaleX(1) !important;
        }
        
        /* Mobile: Safe-Area + Platz für festen Header – Kiki-Container beginnt darunter, damit Kopf/Antennen nicht abgeschnitten werden */
        @media (max-width: 768px) {
            body {
                --kiki-viewport-top: calc(env(safe-area-inset-top, 0) + 60px);
            }
            #kikiGlobalWrap,
            #kikiBubbleChat {
                top: var(--kiki-viewport-top, env(safe-area-inset-top, 0));
            }
        }
        
        html {
            height: 100%;
            height: -webkit-fill-available;
            overflow-y: auto !important; /* Erzwinge vertikales Scrollen */
            /* Light Mode: heller Hintergrund */
            background: #d4f1ff !important;
            /* Verstecke Scrollbars */
            scrollbar-width: none; /* Firefox */
            -ms-overflow-style: none; /* IE und Edge */
        }
        
        /* Dark Mode: html/body dunkel */
        html.dark-mode {
            background: #000000 !important;
        }

        /* Verstecke Scrollbars für Webkit-Browser (Chrome, Safari, Edge) */
        html::-webkit-scrollbar,
        body::-webkit-scrollbar {
            display: none;
            width: 0;
            height: 0;
        }
        
        /* Zeige Scrollbars in größeren Ansichten (Desktop) */
        @media (min-width: 769px) {
            body {
                /* Zeige Scrollbars */
                scrollbar-width: thin; /* Firefox - dünne Scrollbar */
                -ms-overflow-style: scrollbar; /* IE und Edge */
            }
            
            html {
                /* Zeige Scrollbars */
                scrollbar-width: thin; /* Firefox - dünne Scrollbar */
                -ms-overflow-style: scrollbar; /* IE und Edge */
            }
            
            /* Zeige Scrollbars für Webkit-Browser (Chrome, Safari, Edge) */
            html::-webkit-scrollbar,
            body::-webkit-scrollbar {
                display: block;
                width: 12px;
                height: 12px;
            }
            
            /* Styling für Webkit-Scrollbar */
            html::-webkit-scrollbar-track,
            body::-webkit-scrollbar-track {
                background: rgba(0, 0, 0, 0.05);
                border-radius: 6px;
            }
            
            html::-webkit-scrollbar-thumb,
            body::-webkit-scrollbar-thumb {
                background: rgba(102, 126, 234, 0.5);
                border-radius: 6px;
            }
            
            html::-webkit-scrollbar-thumb:hover,
            body::-webkit-scrollbar-thumb:hover {
                background: rgba(102, 126, 234, 0.7);
            }
        }
        
        /* Für iOS Safari - verhindere Adressleiste */
        @supports (-webkit-touch-callout: none) {
            body {
                min-height: -webkit-fill-available;
            }
            html {
                height: -webkit-fill-available;
            }
        }

        .header {
            text-align: center;
            padding: 10px 20px;
            margin-top: 65px;
            margin-bottom: 20px;
            position: relative;
            background: transparent;
        }

        .header.header-with-info {
            display: flex;
            justify-content: flex-start;
            align-items: flex-start;
            text-align: left;
            padding: 10px 20px;
            margin-bottom: 8px;
        }

        /* Platzhalter: Gemini-Style Begrüßung + Info-Button, schiebt Gemini nahe ans untere Drittel */
        .mal-tool-placeholder {
            min-height: calc(65vh - 80px);
            flex-shrink: 0;
            pointer-events: none;
            display: flex;
            align-items: flex-end;
            justify-content: center;
            padding: 20px 20px 8px 20px;
            box-sizing: border-box;
        }
        .mal-tool-placeholder[hidden] {
            display: none !important;
        }
        .mal-tool-placeholder-inner {
            max-width: 900px;
            width: 100%;
            display: flex;
            flex-direction: column;
            gap: 12px;
        }
        .mal-tool-placeholder-greeting {
            display: flex;
            align-items: flex-start;
            gap: 12px;
        }
        .mal-tool-placeholder-icon {
            flex-shrink: 0;
            width: 32px;
            height: 32px;
        }
        .mal-tool-placeholder-icon svg {
            width: 100%;
            height: 100%;
            filter: drop-shadow(0 1px 2px rgba(0,0,0,0.2));
        }
        .mal-tool-placeholder-text {
            display: flex;
            flex-direction: column;
            gap: 4px;
        }
        .mal-tool-placeholder-line1 {
            font-family: 'JetBrains Mono', monospace;
            font-size: 14px;
            color: #2c3e50;
            line-height: 1.4;
        }
        .mal-tool-placeholder-line2 {
            font-family: 'JetBrains Mono', monospace;
            font-size: 22px;
            font-weight: 700;
            color: #2c3e50;
            line-height: 1.3;
        }
        .mal-tool-placeholder-info-btn {
            pointer-events: auto;
            align-self: flex-start;
        }
        /* Dark Mode: Platzhalter wie im Gemini-Bild */
        body.dark-mode .mal-tool-placeholder-line1,
        body.dark-mode .mal-tool-placeholder-line2,
        html.dark-mode .mal-tool-placeholder-line1,
        html.dark-mode .mal-tool-placeholder-line2 {
            color: #ffffff !important;
        }
        
        /* Theme-Toggle-Button (Hell/Dark Mode) */
        .theme-toggle-btn {
            position: absolute;
            top: 8px;
            right: 12px;
            width: 44px;
            height: 44px;
            border: none;
            border-radius: 12px;
            background: rgba(255, 255, 255, 0.2);
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 22px;
            transition: background 0.2s ease, transform 0.15s ease;
        }
        
        .theme-toggle-btn:hover {
            background: rgba(255, 255, 255, 0.35);
            transform: scale(1.05);
        }
        
        .theme-toggle-icon {
            position: absolute;
        }
        
        .theme-icon-sun {
            display: none;
        }
        
        .theme-icon-moon {
            display: block;
        }
        
        body.dark-mode .theme-icon-sun,
        html.dark-mode .theme-icon-sun {
            display: block;
        }
        
        body.dark-mode .theme-icon-moon,
        html.dark-mode .theme-icon-moon {
            display: none;
        }
        
        body.dark-mode .theme-toggle-btn,
        html.dark-mode .theme-toggle-btn {
            background: rgba(255, 255, 255, 0.15);
        }
        
        body.dark-mode .theme-toggle-btn:hover,
        html.dark-mode .theme-toggle-btn:hover {
            background: rgba(255, 255, 255, 0.28);
        }

        /* Dark Mode: Header – Mal-Tool transparent (nicht wie Profil) */
        body.dark-mode .header,
        html.dark-mode .header {
            background: transparent !important;
            color: #ffffff !important;
            box-shadow: none !important;
            border: none !important;
            backdrop-filter: none !important;
            -webkit-backdrop-filter: none !important;
        }

        body.dark-mode .header h1,
        body.dark-mode .header h2,
        body.dark-mode .header .main-title,
        body.dark-mode .header .subtitle,
        html.dark-mode .header h1,
        html.dark-mode .header h2,
        html.dark-mode .header .main-title,
        html.dark-mode .header .subtitle {
            color: #ffffff !important;
        }

        /* Dezentes "+" zum Nachladen der Galerie (Mal-Tool) */
        .gallery-load-more-btn {
            display: flex;
            align-items: center;
            justify-content: center;
            width: 46px;
            height: 46px;
            margin: 18px auto 0 auto;
            border-radius: 50%;
            border: 2px solid rgba(102, 126, 234, 0.35);
            background: rgba(255, 255, 255, 0.75);
            color: #667eea;
            font-family: 'JetBrains Mono', monospace;
            font-weight: 800;
            font-size: 28px;
            line-height: 1;
            cursor: pointer;
            user-select: none;
            box-shadow: 0 4px 14px rgba(0,0,0,0.12);
            transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease, border-color 0.15s ease;
        }

        .gallery-load-more-btn:hover {
            transform: translateY(-1px);
            box-shadow: 0 6px 18px rgba(0,0,0,0.16);
            border-color: rgba(102, 126, 234, 0.55);
        }

        .gallery-load-more-btn:active {
            transform: translateY(0);
        }

        .gallery-load-more-btn:disabled {
            opacity: 0.55;
            cursor: not-allowed;
            transform: none;
        }

        /* Wrapper im Grid, damit "+" direkt nach letztem Bild sitzt */
        .gallery-load-more-wrap {
            grid-column: 1 / -1;
            display: flex;
            justify-content: center;
            align-items: center;
            padding: 8px 0 18px 0;
        }

        body.dark-mode .gallery-load-more-btn,
        html.dark-mode .gallery-load-more-btn {
            background: rgba(255, 255, 255, 0.14) !important;
            border-color: rgba(255, 255, 255, 0.28) !important;
            color: rgba(255, 255, 255, 0.9) !important;
            box-shadow: 0 4px 14px rgba(0,0,0,0.28) !important;
        }

        /* Dark Mode: Top Header – fast schwarz wie Scroll-Indikator, Buttons grau wie Gemini */
        body.dark-mode .top-header,
        html.dark-mode .top-header {
            background: #0a0a0a !important;
            border-bottom: 1px solid rgba(255, 255, 255, 0.15) !important;
            box-shadow: 0 10px 30px rgba(0,0,0,0.6), 0 0 0 1px rgba(255, 255, 255, 0.08) !important;
        }

        body.dark-mode .top-header a,
        body.dark-mode .top-header button,
        body.dark-mode .top-header span:not([data-kiki-color]),
        body.dark-mode .top-header .credits-text,
        body.dark-mode .top-header .edit-characters-button,
        body.dark-mode .top-header .top-header-home,
        body.dark-mode .top-header-credits-row .credits-text,
        body.dark-mode .top-header-credits-row .username-text,
        html.dark-mode .top-header a,
        html.dark-mode .top-header button,
        html.dark-mode .top-header span:not([data-kiki-color]),
        html.dark-mode .top-header .credits-text,
        html.dark-mode .top-header .edit-characters-button,
        html.dark-mode .top-header .top-header-home,
        html.dark-mode .top-header-credits-row .credits-text,
        html.dark-mode .top-header-credits-row .username-text {
            color: #e0e0e0 !important;
        }

        body.dark-mode .top-header .menu-button,
        body.dark-mode .top-header .credits-text,
        body.dark-mode .top-header .edit-characters-button,
        body.dark-mode .top-header .username-text,
        body.dark-mode .top-header .top-header-home,
        body.dark-mode .top-header-credits-row .credits-text,
        body.dark-mode .top-header-credits-row .username-text,
        html.dark-mode .top-header .menu-button,
        html.dark-mode .top-header .credits-text,
        html.dark-mode .top-header .edit-characters-button,
        html.dark-mode .top-header .username-text,
        html.dark-mode .top-header .top-header-home,
        html.dark-mode .top-header-credits-row .credits-text,
        html.dark-mode .top-header-credits-row .username-text {
            background: rgba(255, 255, 255, 0.08) !important;
            color: #667eea !important;
            border-color: rgba(255, 255, 255, 0.12) !important;
        }

        body.dark-mode .top-header .menu-button:hover,
        body.dark-mode .top-header .credits-text:hover,
        body.dark-mode .top-header .edit-characters-button:hover,
        body.dark-mode .top-header .top-header-home:hover,
        body.dark-mode .top-header-credits-row .credits-text:hover,
        body.dark-mode .top-header-credits-row .username-text:hover,
        html.dark-mode .top-header .menu-button:hover,
        html.dark-mode .top-header .credits-text:hover,
        html.dark-mode .top-header .edit-characters-button:hover,
        html.dark-mode .top-header .top-header-home:hover,
        html.dark-mode .top-header-credits-row .credits-text:hover,
        html.dark-mode .top-header-credits-row .username-text:hover {
            background: rgba(255, 255, 255, 0.14) !important;
        }

        /* Dark Mode: Scroll Indicator – fast schwarz, deutliche Aussenlinie */
        body.dark-mode .scroll-indicator,
        html.dark-mode .scroll-indicator {
            background: #0a0a0a !important;
            border: 1px solid rgba(255, 255, 255, 0.15) !important;
            box-shadow: 0 10px 30px rgba(0,0,0,0.6), 0 0 0 1px rgba(255, 255, 255, 0.08) !important;
        }

        /* Dark Mode: Scroll-Indicator Buttons – grau wie Gemini-Tools-Buttons */
        body.dark-mode .scroll-indicator button,
        body.dark-mode .scroll-indicator .scroll-dot,
        body.dark-mode .scroll-indicator .scroll-nav-button,
        body.dark-mode .scroll-indicator .scroll-indicator-item,
        html.dark-mode .scroll-indicator button,
        html.dark-mode .scroll-indicator .scroll-dot,
        html.dark-mode .scroll-indicator .scroll-nav-button,
        html.dark-mode .scroll-indicator .scroll-indicator-item {
            background: rgba(255, 255, 255, 0.08) !important;
            color: #667eea !important;
            border-color: rgba(255, 255, 255, 0.12) !important;
        }

        body.dark-mode .scroll-indicator .scroll-dot:hover,
        body.dark-mode .scroll-indicator .scroll-nav-button:hover,
        html.dark-mode .scroll-indicator .scroll-dot:hover,
        html.dark-mode .scroll-indicator .scroll-nav-button:hover {
            background: rgba(255, 255, 255, 0.14) !important;
        }

        @media (max-width: 768px) {
            body {
                padding-top: 60px;
            }
        }

        /* Scroll-Indikatoren - Styles werden von menueband.js bereitgestellt */
        
        /* Menüband-Styles werden von menueband.js bereitgestellt */

        .greeting-banner {
            /* Hellmodus: wie Hauptseite (#2c3e50) */
            background: linear-gradient(135deg, rgba(255, 107, 157, 0.35) 0%, rgba(102, 126, 234, 0.35) 100%);
            color: #2c3e50;
            padding: 10px 18px;
            border-radius: 999px;
            font-size: 18px;
            font-weight: 700;
            font-family: 'JetBrains Mono', monospace;
            display: block;
            margin: 0 auto 12px auto;
            box-shadow: 0 4px 14px rgba(44, 62, 80, 0.15);
            text-align: center;
            width: fit-content;
            animation: none;
            text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
            letter-spacing: 0.2px;
            cursor: pointer;
            transition: all 0.3s ease;
            border: 1px solid rgba(102, 126, 234, 0.35);
            line-height: 1.4;
            backdrop-filter: blur(10px);
            -webkit-backdrop-filter: blur(10px);
        }

        .greeting-banner:hover {
            transform: translateY(-1px) scale(1.01);
            box-shadow: 0 6px 18px rgba(44, 62, 80, 0.2);
            border-color: rgba(102, 126, 234, 0.5);
            background: linear-gradient(135deg, rgba(255, 107, 157, 0.45) 0%, rgba(102, 126, 234, 0.45) 100%);
        }

        body.dark-mode .greeting-banner,
        html.dark-mode .greeting-banner {
            color: #ffffff !important;
            border-color: #444444 !important;
            background: #1a1a1a !important;
            text-shadow: none !important;
            box-shadow: 0 4px 12px rgba(0,0,0,0.3) !important;
        }
        body.dark-mode .greeting-banner:hover,
        html.dark-mode .greeting-banner:hover {
            border-color: #667eea !important;
            background: #2a2a2a !important;
            box-shadow: 0 6px 16px rgba(0,0,0,0.4) !important;
        }

        .greeting-banner:active {
            transform: scale(0.98);
        }

        .greeting-info-wrap {
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 8px;
            margin-bottom: 12px;
        }

        /* Info-Button: gleiches Design wie Chat-Arena-Button auf Startseite (gelb, blinkend) */
        .mal-tool-info-btn {
            padding: 10px 20px;
            font-size: 15px;
            font-weight: 800;
            font-family: 'JetBrains Mono', monospace;
            background: linear-gradient(135deg, rgba(255, 215, 0, 0.5) 0%, rgba(255, 165, 0, 0.5) 100%);
            color: #FFD700;
            border: 2px solid rgba(255, 215, 0, 0.7);
            border-radius: 999px;
            cursor: pointer;
            transition: all 0.2s ease;
            box-shadow: 0 4px 16px rgba(255, 215, 0, 0.4), 0 0 20px rgba(255, 165, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.3);
            text-shadow: 2px 2px 6px rgba(0, 0, 0, 0.6), 0 0 10px rgba(255, 215, 0, 0.3);
        }

        .mal-tool-info-btn:hover {
            background: linear-gradient(135deg, rgba(255, 215, 0, 0.7) 0%, rgba(255, 165, 0, 0.7) 100%);
            border-color: rgba(255, 215, 0, 0.95);
            box-shadow: 0 6px 20px rgba(255, 215, 0, 0.5), 0 0 25px rgba(255, 165, 0, 0.35);
        }

        .mal-tool-info-emoji {
            display: inline-block;
            margin-right: 6px;
        }

        /* Gelbes Blinken wie Chat-Arena FREE-Badge */
        .mal-tool-info-btn-blink {
            animation: mal-tool-info-btn-glow 1s ease-in-out infinite;
        }

        .mal-tool-info-btn-blink .mal-tool-info-emoji {
            animation: mal-tool-info-blink 1s ease-in-out infinite;
        }

        @keyframes mal-tool-info-btn-glow {
            0%, 100% {
                box-shadow: 0 4px 16px rgba(255, 215, 0, 0.4), 0 0 20px rgba(255, 165, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.3);
            }
            50% {
                box-shadow: 0 4px 24px rgba(255, 215, 0, 0.7), 0 0 30px rgba(255, 165, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.4);
            }
        }

        @keyframes mal-tool-info-blink {
            0%, 100% { opacity: 1; }
            50% { opacity: 0.35; }
        }

        body.dark-mode .mal-tool-info-btn,
        html.dark-mode .mal-tool-info-btn {
            background: linear-gradient(135deg, rgba(255, 215, 0, 0.5) 0%, rgba(255, 165, 0, 0.5) 100%);
            color: #FFD700;
            border-color: rgba(255, 215, 0, 0.7);
        }

        body.dark-mode .mal-tool-info-btn:hover,
        html.dark-mode .mal-tool-info-btn:hover {
            background: linear-gradient(135deg, rgba(255, 215, 0, 0.7) 0%, rgba(255, 165, 0, 0.7) 100%);
        }

        .mal-tool-info-modal {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: rgba(0, 0, 0, 0.5);
            z-index: 99999;
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 20px;
        }

        .mal-tool-info-content {
            background: #ffffff;
            border-radius: 16px;
            padding: 24px 28px;
            max-width: 420px;
            width: 100%;
            box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
        }

        .mal-tool-info-content h3 {
            margin: 0 0 16px 0;
            font-size: 18px;
            color: #333;
        }

        .mal-tool-info-body {
            margin-bottom: 20px;
        }

        .mal-tool-info-body p {
            margin: 0 0 10px 0;
            font-size: 14px;
            line-height: 1.5;
            color: #555;
        }

        .mal-tool-info-body p:last-child {
            margin-bottom: 0;
        }

        .mal-tool-info-close {
            width: 100%;
            padding: 10px 20px;
            font-size: 14px;
            font-weight: 600;
            font-family: inherit;
            background: #667eea;
            color: white;
            border: none;
            border-radius: 10px;
            cursor: pointer;
            transition: background 0.2s ease;
        }

        .mal-tool-info-close:hover {
            background: #5a6fd6;
        }

        body.dark-mode .mal-tool-info-content,
        html.dark-mode .mal-tool-info-content {
            background: #1a1a1a;
        }

        body.dark-mode .mal-tool-info-content h3,
        html.dark-mode .mal-tool-info-content h3 {
            color: #ffffff;
        }

        body.dark-mode .mal-tool-info-body p,
        html.dark-mode .mal-tool-info-body p {
            color: #e0e0e0;
        }

        /* Nicht #komplexContainer: globale Kiki-Animation nutzt dieselbe Klasse, braucht 180px Höhe (kiki-styles.css) */
        .kiki-container:not(#komplexContainer) {
            display: flex;
            align-items: center;
            justify-content: center;
            margin: 20px auto 30px auto;
            padding-top: 30px;
            padding-bottom: 30px;
            cursor: pointer;
            gap: 0;
            width: 140px;
            max-width: 140px;
            position: relative;
            min-height: 140px;
            height: 140px;
        }

        .kiki-image {
            width: 140px;
            height: 140px;
            cursor: pointer;
            margin: 0 auto;
            padding-top: 0;
            padding-bottom: 0;
            display: block;
            animation: shake 0.5s ease-in-out infinite, glow 2s ease-in-out infinite alternate;
            background: transparent;
            border: none;
            flex-shrink: 0;
            position: relative;
            left: auto;
            transform: none;
            z-index: 10;
            filter: drop-shadow(0 0 20px rgba(255, 215, 0, 0.8)) drop-shadow(0 0 40px rgba(255, 107, 157, 0.6)) drop-shadow(0 0 60px rgba(102, 126, 234, 0.4));
        }

        .kiki-image:hover {
            animation: shake 0.3s ease-in-out infinite, glow 1s ease-in-out infinite alternate;
            filter: drop-shadow(0 0 30px rgba(255, 215, 0, 1)) drop-shadow(0 0 50px rgba(255, 107, 157, 0.8)) drop-shadow(0 0 70px rgba(102, 126, 234, 0.6));
        }

        .kiki-text {
            font-family: 'JetBrains Mono', monospace;
            font-size: 31px;
            font-weight: 700;
            color: #2c3e50;
            text-shadow: 0 2px 4px rgba(0,0,0,0.1);
            letter-spacing: -0.5px;
            line-height: 1.3;
            margin: 0;
            padding: 0;
            margin-top: 0;
            margin-left: 0;
            cursor: pointer;
            animation: shake 0.5s ease-in-out infinite;
            display: none;
            background: linear-gradient(135deg, #FF6B9D 0%, #667eea 50%, #4ecdc4 100%);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
            letter-spacing: 1px;
            white-space: nowrap;
            position: relative;
            z-index: 1;
        }

        .kiki-container:not(#komplexContainer):hover .kiki-text {
            animation: shake 0.3s ease-in-out infinite;
        }

        @keyframes shake {
            0%, 100% { transform: translateX(0) rotate(0deg); }
            10% { transform: translateX(-5px) rotate(-5deg); }
            20% { transform: translateX(5px) rotate(5deg); }
            30% { transform: translateX(-5px) rotate(-5deg); }
            40% { transform: translateX(5px) rotate(5deg); }
            50% { transform: translateX(-3px) rotate(-3deg); }
            60% { transform: translateX(3px) rotate(3deg); }
            70% { transform: translateX(-3px) rotate(-3deg); }
            80% { transform: translateX(3px) rotate(3deg); }
            90% { transform: translateX(-2px) rotate(-2deg); }
        }

        @keyframes glow {
            0% {
                filter: drop-shadow(0 0 20px rgba(255, 215, 0, 0.8)) drop-shadow(0 0 40px rgba(255, 107, 157, 0.6)) drop-shadow(0 0 60px rgba(102, 126, 234, 0.4));
            }
            100% {
                filter: drop-shadow(0 0 30px rgba(255, 215, 0, 1)) drop-shadow(0 0 50px rgba(255, 107, 157, 0.8)) drop-shadow(0 0 70px rgba(102, 126, 234, 0.6));
            }
        }

        .waving-hand {
            display: inline-block;
            animation: wave 1s ease-in-out infinite;
            transform-origin: 70% 70%;
        }

        @keyframes wave {
            0%, 100% {
                transform: rotate(0deg);
            }
            25% {
                transform: rotate(20deg);
            }
            75% {
                transform: rotate(-20deg);
            }
        }

        .main-title {
            font-family: 'JetBrains Mono', monospace;
            font-weight: 700;
            font-size: 20px;
            color: #2c3e50;
            margin-top: 30px; /* 20px nach oben verschoben (von 50px auf 30px) */
            margin-bottom: 10px;
            animation: none;
            text-align: center;
            text-shadow: 0 2px 4px rgba(0,0,0,0.1);
            padding: 0;
            display: flex;
            align-items: center; /* Vertikal zentrieren */
            justify-content: center; /* Horizontal zentrieren */
            border: none;
            box-shadow: none;
            background: transparent;
            width: fit-content;
            margin-left: auto;
            margin-right: auto;
            letter-spacing: -0.3px;
            line-height: 1.3;
        }

        .subtitle {
            font-family: 'JetBrains Mono', monospace;
            font-weight: 700;
            font-size: 16px;
            color: #2c3e50;
            text-shadow: 0 2px 4px rgba(0,0,0,0.1);
            margin-bottom: 0;
            letter-spacing: -0.3px;
            line-height: 1.3;
            background: transparent;
            padding: 0;
            display: block;
            border: none;
            box-shadow: none;
            width: fit-content;
            margin-left: auto;
            margin-right: auto;
            text-align: center;
            animation: none;
        }

        @keyframes bounce {
            0%, 100% { transform: translateY(0); }
            50% { transform: translateY(-10px); }
        }

        .container {
            max-width: 1400px;
            margin: 0 auto;
            padding: 0;
            position: relative;
        }

        .character-selection {
            background: transparent;
            border-radius: 0;
            padding: 0 20px 20px 20px; /* Top padding entfernt */
            margin-top: 8px; /* Minimaler Abstand unter Info-Button */
            margin-bottom: 0; /* Kein Abstand zum visual-selection */
            box-shadow: none;
            text-align: center;
            position: relative;
        }
        
        /* Pseudo-Element nur innerhalb character-selection (nicht nach unten erweitern),
           damit Gemini-Buttons darunter nicht blockiert werden */
        .character-selection::after {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            pointer-events: none;
            z-index: -1;
        }
        
        /* Blockiere Klicks auf Hintergrund ab character-grid */
        .character-grid {
            position: relative;
            z-index: 1;
        }
        
        /* Blockiere Klicks auf Hintergrund für alle Elemente ab character-selection */
        .visual-selection,
        .drawing-area,
        .my-gallery {
            position: relative;
            width: 100%;
            max-width: 100%;
            box-sizing: border-box;
            overflow-x: hidden !important; /* Verhindere horizontales Scrollen bei Zoom */
            overflow-y: visible; /* Erlaube vertikales Scrollen */
        }
        
        /* Erlaube Interaktionen mit den Inhalten selbst */
        .visual-selection > *,
        .drawing-area > *,
        .my-gallery > *,
        .character-grid > * {
            position: relative;
            z-index: 1;
            pointer-events: auto;
        }

        .character-title {
            font-family: 'JetBrains Mono', monospace;
            font-size: 32px;
            color: #667eea;
            margin-bottom: 20px;
            text-align: center;
            text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
            background: transparent;
            padding: 0;
            display: inline-block;
            border: none;
            box-shadow: none;
        }

        /* Character-Grid: kompakt, Bilder dicht nebeneinander – max-width verhindert Auseinanderziehen */
        .character-grid {
            column-count: 3;
            column-gap: 12px;
            max-width: 336px; /* 3×100 + 2×12 + etwas Puffer */
            margin: 0 auto;
            margin-bottom: 0;
            position: relative;
            z-index: 1;
        }
        @media (min-width: 600px) {
            .character-grid { column-count: 4; max-width: 448px; }
        }
        @media (min-width: 850px) {
            .character-grid { column-count: 5; max-width: 560px; }
        }
        @media (min-width: 1100px) {
            .character-grid { column-count: 6; max-width: 672px; }
        }
        @media (min-width: 1300px) {
            .character-grid { column-count: 8; max-width: 896px; } /* 8 Spalten in großen Ansichten */
        }

        /* Character-Größe fließend: groß 100px, klein 65px */
        @media (max-width: 999px) {
            .character-grid { column-gap: 10px; max-width: 370px; } /* 4×85 + 3×10 */
            .character-item { max-width: 85px; margin-bottom: 10px; }
            .character-item-info { padding: 6px 4px; }
            .character-item-title { font-size: 11px; }
            .add-button-placeholder .add-button-content { font-size: 2.8rem; }
        }
        @media (max-width: 767px) {
            .character-grid { column-gap: 8px; max-width: 324px; } /* 4×75 + 3×8 */
            .character-item { max-width: 75px; margin-bottom: 8px; }
            .character-item-info { padding: 5px 3px; }
            .character-item-title { font-size: 10px; }
            .add-button-placeholder .add-button-content { font-size: 2.4rem; }
        }
        @media (max-width: 479px) {
            .character-grid { column-gap: 8px; max-width: 304px; } /* 4×70 + 3×8 */
            .character-item { max-width: 70px; margin-bottom: 8px; }
            .character-item-info { padding: 4px 3px; }
            .character-item-title { font-size: 9px; }
            .add-button-placeholder .add-button-content { font-size: 2.2rem; }
        }
        @media (max-width: 359px) {
            .character-grid { column-gap: 6px; max-width: 276px; } /* 4×65 + 3×6 */
            .character-item { max-width: 65px; margin-bottom: 6px; }
            .character-item-info { padding: 4px 2px; }
            .character-item-title { font-size: 8px; }
            .add-button-placeholder .add-button-content { font-size: 2rem; }
        }

        /* Character cards – Firm-Card-Styling */
        .character-item {
            position: relative;
            break-inside: avoid;
            width: 100%;
            max-width: 100px;
            margin: 0 auto 12px auto;
            box-sizing: border-box;
            background: #fff;
            border-radius: 12px;
            box-shadow: 0 4px 6px rgba(0,0,0,0.05);
            border: 1px solid rgba(0,0,0,0.08);
            transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.25s ease, filter 0.25s ease;
            cursor: pointer;
            display: flex;
            flex-direction: column;
            overflow: hidden;
            container-type: inline-size;
        }

        /* Nicht ausgewählte Charaktere abdunkeln */
        .character-item:not(.selected):not(.api-selected):not(.add-button) {
            opacity: 0.62;
            filter: brightness(0.92);
        }
        .character-item:not(.selected):not(.api-selected):not(.add-button):hover {
            opacity: 1;
            filter: brightness(1);
        }

        .character-item:hover {
            transform: translateY(-5px);
            box-shadow: 0 10px 20px rgba(0,0,0,0.1);
        }

        .character-item.selected {
            border: 1px solid rgba(184, 134, 11, 0.9);
            box-shadow: 0 0 0 1px rgba(184, 134, 11, 0.9), 0 4px 16px rgba(184, 134, 11, 0.2);
            background: linear-gradient(135deg, rgba(255, 250, 240, 0.6) 0%, rgba(255, 248, 220, 0.4) 100%) !important;
        }

        /* Auswahlmodus aktiv */
        .character-item.api-select-mode-active {
            position: relative;
            z-index: 100;
        }

        .character-item.api-select-mode-active.selected {
            border-color: rgba(0,0,0,0.08);
            box-shadow: 0 4px 6px rgba(0,0,0,0.05);
        }

        .character-item.api-select-mode-active.selected:hover {
            transform: translateY(-5px);
            box-shadow: 0 10px 20px rgba(0,0,0,0.1);
        }

        .character-item.api-selected {
            border: 1px solid rgba(255, 107, 157, 0.9) !important;
            box-shadow: 0 0 0 1px rgba(255, 107, 157, 0.9), 0 4px 16px rgba(255, 107, 157, 0.25) !important;
            background: linear-gradient(135deg, rgba(255, 240, 245, 0.7) 0%, rgba(255, 228, 236, 0.5) 100%) !important;
            z-index: 101;
        }

        /* Cover-Bereich wie firm-card-cover */
        .character-item-cover {
            position: relative;
            width: 100%;
            padding-top: 133.33%;
            overflow: hidden;
            background: #eee;
        }

        .character-item-cover img {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            object-fit: cover;
            object-position: top center;
            transition: transform 0.5s ease;
        }

        .character-item:hover .character-item-cover img {
            transform: scale(1.05);
        }

        .character-item.api-selected .character-item-cover img {
            filter: drop-shadow(0 4px 12px rgba(255, 107, 157, 0.3));
        }

        /* Platzhalter für Add-Buttons (wie firm-card-placeholder) */
        .character-item-placeholder {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            display: flex !important;
            align-items: center;
            justify-content: center;
            font-size: 2.5rem;
            color: rgba(0,0,0,0.3);
            background: linear-gradient(135deg, #f0f0f0 0%, #e0e0e0 100%);
        }

        .add-button-placeholder .add-button-content {
            font-size: 4rem;
            color: rgba(102, 126, 234, 0.6);
        }
        .add-button-placeholder {
            border: 1px solid rgba(102, 126, 234, 0.15);
            border-radius: 8px;
            box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.5);
        }
        .character-item.add-button:hover .add-button-placeholder {
            border-color: rgba(102, 126, 234, 0.3);
            box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.6), 0 2px 8px rgba(102, 126, 234, 0.1);
        }

        /* Info-Bereich wie firm-card-info */
        .character-item-info {
            padding: 8px 6px;
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 4px;
            text-align: center;
        }

        .character-item-title {
            font-family: 'JetBrains Mono', monospace;
            font-size: clamp(12px, 12cqi, 18px);
            font-weight: 800;
            margin: 0;
            line-height: 1.2;
            letter-spacing: 0.2px;
            color: var(--arena-secondary, #003366);
            overflow: hidden;
            text-overflow: ellipsis;
            display: -webkit-box;
            -webkit-line-clamp: 2;
            -webkit-box-orient: vertical;
        }

        .character-item.selected .character-item-title {
            color: #b8860b;
        }

        /* Dark Mode: Character cards (wie arena firm-card) */
        body.dark-mode .character-item,
        html.dark-mode .character-item {
            background: #2a2a2a !important;
            border-color: rgba(255,255,255,0.15) !important;
        }
        body.dark-mode .character-item-cover,
        html.dark-mode .character-item-cover {
            background: #1a1a1a !important;
        }
        body.dark-mode .character-item-title,
        html.dark-mode .character-item-title {
            color: rgba(255,255,255,0.9) !important;
        }
        body.dark-mode .character-item.selected .character-item-title,
        html.dark-mode .character-item.selected .character-item-title {
            color: #fbbf24 !important;
        }
        body.dark-mode .character-item.selected,
        html.dark-mode .character-item.selected {
            background: linear-gradient(135deg, rgba(251, 191, 36, 0.12) 0%, rgba(245, 158, 11, 0.08) 100%) !important;
            border-color: rgba(251, 191, 36, 0.7) !important;
        }
        body.dark-mode .character-item.api-selected,
        html.dark-mode .character-item.api-selected {
            background: linear-gradient(135deg, rgba(255, 107, 157, 0.15) 0%, rgba(236, 72, 153, 0.1) 100%) !important;
            border-color: rgba(255, 107, 157, 0.8) !important;
        }
        body.dark-mode .character-item-placeholder,
        html.dark-mode .character-item-placeholder {
            background: #1a1a1a !important;
            color: rgba(255,255,255,0.4) !important;
        }
        body.dark-mode .add-button-placeholder .add-button-content,
        html.dark-mode .add-button-placeholder .add-button-content {
            color: rgba(102, 126, 234, 0.7) !important;
        }
        body.dark-mode .character-item.add-button,
        html.dark-mode .character-item.add-button {
            background: linear-gradient(135deg, rgba(42, 42, 42, 0.98) 0%, rgba(35, 38, 50, 0.95) 100%) !important;
            border-color: rgba(102, 126, 234, 0.35) !important;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3), inset 0 0 0 1px rgba(255, 255, 255, 0.05) !important;
        }
        body.dark-mode .character-item.add-button:hover,
        html.dark-mode .character-item.add-button:hover {
            border-color: rgba(102, 126, 234, 0.5) !important;
            box-shadow: 0 8px 20px rgba(102, 126, 234, 0.15), inset 0 0 0 1px rgba(255, 255, 255, 0.08) !important;
        }
        body.dark-mode .add-button-placeholder,
        html.dark-mode .add-button-placeholder {
            border-color: rgba(102, 126, 234, 0.25) !important;
        }
        body.dark-mode .character-item.add-button:hover .add-button-placeholder,
        html.dark-mode .character-item.add-button:hover .add-button-placeholder {
            border-color: rgba(102, 126, 234, 0.45) !important;
        }

        .delete-icon {
            position: absolute;
            top: 5px;
            left: 5px;
            background: rgba(231, 76, 60, 0.95);
            color: white;
            width: 35px;
            height: 35px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 20px;
            cursor: pointer;
            z-index: 10;
            box-shadow: 0 3px 10px rgba(231, 76, 60, 0.5);
            transition: all 0.3s ease;
            border: 2px solid white;
        }

        .delete-icon:hover {
            background: rgba(192, 57, 43, 1);
            transform: scale(1.15);
            box-shadow: 0 5px 15px rgba(231, 76, 60, 0.7);
        }

        .api-select-icon {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            background: rgba(102, 126, 234, 0.95);
            color: white;
            width: 80px;
            height: 80px;
            border-radius: 50%;
            display: none; /* Standardmäßig versteckt */
            align-items: center;
            justify-content: center;
            font-size: 45px;
            cursor: pointer;
            z-index: 102;
            transition: all 0.3s ease;
            box-shadow: 0 4px 15px rgba(102, 126, 234, 0.5);
        }

        /* Zeige Auswahl-Symbol nur wenn Auswahlmodus aktiv ist (nur für Gallery-Items) */
        .gallery-item.api-select-mode-active .api-select-icon {
            display: flex;
        }

        .api-select-icon:hover {
            background: rgba(102, 126, 234, 1);
            transform: translate(-50%, -50%) scale(1.15);
            box-shadow: 0 6px 20px rgba(102, 126, 234, 0.7);
        }

        /* Wenn Bild bereits für API ausgewählt ist, zeige Symbol auch ohne Modus (nur für Gallery-Items) */
        .gallery-item.api-selected .api-select-icon {
            display: flex;
            background: rgba(255, 107, 157, 0.95);
        }

        .gallery-item.api-selected .api-select-icon:hover {
            background: rgba(255, 107, 157, 1);
            box-shadow: 0 6px 20px rgba(255, 107, 157, 0.7);
        }

        .character-item.add-button {
            background: linear-gradient(135deg, rgba(251, 251, 255, 0.98) 0%, rgba(248, 250, 255, 0.95) 100%) !important;
            border: 1px solid rgba(102, 126, 234, 0.2) !important;
            box-shadow: 0 2px 8px rgba(102, 126, 234, 0.08), inset 0 0 0 1px rgba(255, 255, 255, 0.8) !important;
            cursor: pointer;
            outline: none !important;
        }

        .character-item.add-button:hover {
            transform: translateY(-5px);
            box-shadow: 0 8px 20px rgba(102, 126, 234, 0.15), inset 0 0 0 1px rgba(255, 255, 255, 0.9) !important;
            border: 1px solid rgba(102, 126, 234, 0.35) !important;
            outline: none !important;
        }

        .character-item.add-button .character-item-title {
            color: var(--arena-secondary, #003366) !important;
        }

        .character-selected-badge {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            background: #4CAF50;
            color: white;
            border-radius: 50%;
            width: 35px;
            height: 35px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 20px;
            font-weight: bold;
            box-shadow: 0 3px 10px rgba(0,0,0,0.3);
            z-index: 5;
        }

        /* Visual-Sektion: kompakt in allen Ansichten */
        .visual-selection {
            background: transparent;
            border-radius: 0;
            padding: 0 4px 4px 4px;
            margin-top: 0;
            margin-bottom: 2px;
            box-shadow: none;
            text-align: center;
        }

        .dropdowns-container {
            display: flex;
            flex-wrap: wrap;
            gap: 4px;
            margin-bottom: 4px;
            align-items: flex-start;
            max-width: 100%;
            justify-content: center;
            padding: 4px;
            background: transparent;
            border-radius: 0;
            border: none;
        }

        .dropdown-wrapper {
            display: flex;
            flex-direction: column;
            flex: 0 1 auto;
            width: 180px;
            min-width: 180px;
            max-width: 180px;
            padding: 5px 8px;
            align-items: center;
            transition: all 0.3s ease;
            overflow: visible;
        }

        /* Dropdown-Wrapper ohne Auswahl abdunkeln */
        .dropdown-wrapper:not(:has(.dropdown-select:not(.empty))) {
            opacity: 0.6;
            filter: brightness(0.95);
        }
        .dropdown-wrapper:not(:has(.dropdown-select:not(.empty))):hover {
            opacity: 1;
            filter: brightness(1);
        }

        .dropdown-wrapper .dropdown-select {
            width: 100% !important;
            min-width: 0 !important;
            max-width: 100% !important;
            box-sizing: border-box;
        }

        .dropdown-content {
            width: 100%;
            overflow: visible;
        }

        .dropdown-wrapper:hover {
            transform: translateY(-2px);
        }

        /* Dropdown-Wrapper mit ausgewähltem Menüpunkt: dezente Markierung */
        .dropdown-wrapper:has(.dropdown-select:not(.empty)) {
            background: linear-gradient(135deg, rgba(102, 126, 234, 0.06) 0%, rgba(255, 107, 157, 0.04) 100%);
            border: 1px solid rgba(102, 126, 234, 0.25);
            border-radius: 10px;
            box-shadow: 0 2px 8px rgba(102, 126, 234, 0.08);
        }
        .dropdown-wrapper:has(.dropdown-select:not(.empty)):hover {
            border-color: rgba(102, 126, 234, 0.35);
            box-shadow: 0 3px 12px rgba(102, 126, 234, 0.12);
        }

        .dropdown-label {
            font-family: 'JetBrains Mono', monospace;
            font-size: 14px;
            background: linear-gradient(135deg, #FF6B9D 0%, #667eea 100%);
            -webkit-background-clip: text;
            background-clip: text;
            -webkit-text-fill-color: transparent;
            margin-bottom: 2px;
            text-align: center;
            font-weight: 700;
            white-space: nowrap;
            text-shadow: none;
            letter-spacing: 0.3px;
            line-height: 1.4;
            cursor: pointer;
            user-select: none;
            transition: opacity 0.2s ease;
        }

        .dropdown-label:hover {
            opacity: 0.8;
        }

        .dropdown-select {
            width: 100%;
            min-width: 0;
            max-width: 100%;
            padding: 4px 12px 4px 5px;
            font-size: 14px;
            box-sizing: border-box;
        }

        /* Dropdown mit Label-Stil (wenn leer) */
        .dropdown-select-with-label.empty {
            font-size: 14px !important;
            font-weight: 700;
            background: transparent !important;
            border: none !important;
            padding: 0 !important;
            color: transparent !important;
            background-image: linear-gradient(135deg, #FF6B9D 0%, #667eea 100%) !important;
            -webkit-background-clip: text !important;
            background-clip: text !important;
            -webkit-text-fill-color: transparent !important;
            text-align: center !important;
            letter-spacing: 0.3px;
            line-height: 1.4;
            box-shadow: none !important;
            cursor: pointer;
            margin-bottom: 2px;
            position: relative;
            width: fit-content !important;
            min-width: fit-content !important;
            max-width: fit-content !important;
        }

        .dropdown-select-with-label.empty option {
            color: #7a6eea;
            background: white;
        }

        .dropdown-select.empty {
            color: rgba(102, 126, 234, 0.5);
            background: rgba(255, 255, 255, 0.7);
            border-color: rgba(102, 126, 234, 0.15);
            font-size: 14px !important;
            width: 100% !important;
            min-width: 0 !important;
            max-width: 100% !important;
            box-sizing: border-box !important;
        }

        .dropdown-select:not(.empty) {
            border: 1px solid rgba(102, 126, 234, 0.35);
            background: linear-gradient(180deg, #ffffff 0%, rgba(248, 250, 255, 0.95) 100%);
            color: #667eea;
            font-size: 14px;
            box-shadow: 0 1px 4px rgba(102, 126, 234, 0.06);
        }

        .dropdown-select:hover {
            border-color: rgba(102, 126, 234, 0.4); /* Leicht hellere Linie beim Hover */
            background: #ffffff; /* Weißer Hintergrund bleibt */
            box-shadow: none; /* Keine 3D-Effekte */
        }

        .dropdown-select:not(.empty):hover {
            border-color: rgba(102, 126, 234, 0.4); /* Leicht hellere Linie beim Hover */
            background: #ffffff; /* Weißer Hintergrund bleibt */
        }

        .dropdown-select:focus {
            outline: none;
            border: 1px solid rgba(102, 126, 234, 0.5) !important; /* Dezente Linie beim Fokus */
            box-shadow: none; /* Keine 3D-Effekte */
            background: #ffffff; /* Weißer Hintergrund bleibt */
        }

        .dropdown-select:not(.empty):focus {
            outline: none;
            border: 1px solid rgba(102, 126, 234, 0.5) !important; /* Dezente Linie beim Fokus */
            background: #ffffff; /* Weißer Hintergrund bleibt */
        }
        
        /* WICHTIG: select:active entfernt den Border, was zu Flackern führt - daher entfernt */

        .dropdown-select option {
            padding: 6px 8px;
            font-size: 9px;
            font-weight: 700;
            font-family: 'JetBrains Mono', monospace;
            text-align: left;
            color: #667eea; /* Blauer Text im hellen Modus */
            line-height: 1.5;
            background: #ffffff; /* Weißer Hintergrund */
            letter-spacing: 0.2px;
            transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
            border-bottom: 1px solid rgba(102, 126, 234, 0.15); /* Dünne Trennlinie */
        }
        
        .dropdown-select option:last-child {
            border-bottom: none; /* Keine Linie beim letzten Element */
        }
        
        .dropdown-select option:hover {
            background: rgba(102, 126, 234, 0.1); /* Leichter blauer Hintergrund beim Hover */
            color: #667eea;
        }
        
        .dropdown-select option:checked {
            background: rgba(102, 126, 234, 0.2); /* Dezenter blauer Hintergrund für ausgewählte Option */
            color: #667eea;
        }

        .dropdown-select option[value=""] {
            color: rgba(122, 110, 234, 0.5);
            font-weight: 700;
        }
        
        /* Dark Mode: Dropdown-Wrapper mit Auswahl */
        body.dark-mode .dropdown-wrapper:has(.dropdown-select:not(.empty)),
        html.dark-mode .dropdown-wrapper:has(.dropdown-select:not(.empty)) {
            background: linear-gradient(135deg, rgba(102, 126, 234, 0.12) 0%, rgba(167, 139, 250, 0.06) 100%) !important;
            border-color: rgba(102, 126, 234, 0.4) !important;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2) !important;
        }
        body.dark-mode .dropdown-wrapper:has(.dropdown-select:not(.empty)):hover,
        html.dark-mode .dropdown-wrapper:has(.dropdown-select:not(.empty)):hover {
            border-color: rgba(102, 126, 234, 0.5) !important;
        }

        /* Dark Mode Styles für Dropdown-Select */
        body.dark-mode .dropdown-select:not(.empty) {
            background: #2a2a2a !important;
            color: #ffffff !important;
            font-size: 14px !important;
            background-image: none !important; /* Kein Pfeil */
        }
        
        body.dark-mode .dropdown-select:not(.empty):hover {
            background: #333333 !important;
        }
        
        body.dark-mode .dropdown-select:not(.empty):focus {
            background: #333333 !important;
            border-color: #667eea !important;
        }
        
        body.dark-mode .dropdown-select.empty {
            background: #1a1a1a !important;
            color: #888888 !important;
        }
        
        body.dark-mode .dropdown-select option {
            background: #2a2a2a !important;
            color: #ffffff !important;
        }
        
        body.dark-mode .dropdown-select option:hover {
            background: #333333 !important;
        }
        
        body.dark-mode .dropdown-select option:checked {
            background: rgba(102, 126, 234, 0.3) !important;
        }
        
        /* Dark Mode: Dropdown-Labels – Mal-Tool (Gradient) */
        body.dark-mode .dropdown-label,
        html.dark-mode .dropdown-label {
            background: linear-gradient(135deg, #FF6B9D 0%, #A78BFA 100%) !important;
            -webkit-background-clip: text !important;
            background-clip: text !important;
            -webkit-text-fill-color: transparent !important;
        }
        
        /* Dark Mode: Dropdown-Select-With-Label (leer) – Mal-Tool */
        body.dark-mode .dropdown-select-with-label.empty,
        html.dark-mode .dropdown-select-with-label.empty {
            background-image: linear-gradient(135deg, #FF6B9D 0%, #A78BFA 100%) !important;
            -webkit-background-clip: text !important;
            background-clip: text !important;
            -webkit-text-fill-color: transparent !important;
        }

        .dropdown-select option:hover {
            background: linear-gradient(135deg, rgba(255, 107, 157, 0.1) 0%, rgba(102, 126, 234, 0.1) 100%);
        }

        .drawing-area {
            background: transparent;
            border-radius: 0;
            padding: 0 20px 20px 20px;
            box-shadow: none;
            margin-bottom: 15px;
            margin-top: 0;
            text-align: center;
        }

        .drawing-title {
            font-family: 'JetBrains Mono', monospace;
            font-size: 32px;
            color: #667eea;
            margin-bottom: 20px;
            text-align: center;
            text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
            padding: 0;
            display: inline-block;
            border: none;
            box-shadow: none;
            background: transparent;
        }

        /* Erlaube Textauswahl in Input-Feldern */
        input, textarea {
            -webkit-user-select: text !important;
            user-select: text !important;
        }

        /* Text-Antwort (nur Text, kein Bild) – ChatGPT-Style oberhalb Gemini */
        .mal-tool-text-response {
            max-width: 900px;
            margin: 0 auto 12px auto;
            padding: 0 20px;
            box-sizing: border-box;
        }
        .mal-tool-text-response-inner {
            background: #f7f7f8;
            border-radius: 18px;
            padding: 16px 20px;
            border: 1px solid rgba(0,0,0,0.06);
            box-shadow: 0 1px 3px rgba(0,0,0,0.06);
        }
        .mal-tool-text-response-content {
            font-family: 'JetBrains Mono', monospace;
            font-size: 15px;
            line-height: 1.6;
            color: #2c3e50;
            white-space: pre-wrap;
            word-wrap: break-word;
        }
        body.dark-mode .mal-tool-text-response-inner,
        html.dark-mode .mal-tool-text-response-inner {
            background: #2d2d2d !important;
            border-color: rgba(255,255,255,0.1) !important;
        }
        body.dark-mode .mal-tool-text-response-content,
        html.dark-mode .mal-tool-text-response-content {
            color: #e0e0e0 !important;
        }

        /* Gemini-Style Eingabebereich - z-index sichert Klickbarkeit über anderen Bereichen */
        .gemini-input-container {
            position: relative;
            z-index: 10;
            max-width: 900px;
            margin: 8px auto 20px auto;
            background: transparent;
            width: 100%;
            box-sizing: border-box;
        }

        /* Toggle-Button: Galerie und Inhalt darunter ein-/ausblenden (nur Symbol) */
        .mal-tool-toggle-below {
            display: flex;
            align-items: center;
            justify-content: center;
            width: 100%;
            max-width: 900px;
            margin: 0 auto 8px auto;
            padding: 6px;
            background: transparent;
            border: none;
            cursor: pointer;
            font-size: 36px;
            color: #667eea;
        }

        .mal-tool-toggle-below:hover {
            opacity: 0.8;
        }

        .mal-tool-toggle-icon {
            display: block;
            line-height: 1;
        }

        body.dark-mode .mal-tool-toggle-below,
        html.dark-mode .mal-tool-toggle-below {
            color: #667eea !important;
        }

        .gemini-input-wrapper {
            flex: 1;
            position: relative;
            background: #ffffff;
            border-radius: 24px;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
            transition: box-shadow 0.2s ease;
            overflow: hidden;
            display: flex;
            flex-direction: column;
            padding-right: 0; /* Standard: kein zusätzliches Padding */
        }
        
        /* Zusätzliches Padding rechts in Ansichten größer als 500px */
        @media (min-width: 501px) {
            .gemini-input-wrapper {
                padding-right: 60px;
            }
        }

        .gemini-input-wrapper:focus-within {
            box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
        }

        .api-image-title-display {
            display: none;
            flex-direction: row;
            align-items: center;
            padding: 8px 20px;
            background: rgba(102, 126, 234, 0.1);
            border-top: 1px solid rgba(102, 126, 234, 0.2);
            font-size: 14px;
            font-family: 'JetBrains Mono', monospace;
            color: #667eea;
            gap: 8px;
        }
        
        .api-image-title-label {
            font-weight: 600;
            color: #667eea;
        }
        
        .api-image-title-text {
            font-weight: 400;
            color: #1a1a1a;
        }
        
        /* Dark Mode: Auswahlmodus Info Container - gleiches Aussehen wie Hellmodus */
        body.dark-mode .api-image-title-display,
        html.dark-mode .api-image-title-display {
            background: rgba(102, 126, 234, 0.1) !important;
            border-top-color: rgba(102, 126, 234, 0.2) !important;
            color: #667eea !important;
            box-shadow: none !important;
        }
        
        body.dark-mode .api-image-title-label,
        html.dark-mode .api-image-title-label {
            color: #667eea !important;
            font-weight: 600;
        }
        
        body.dark-mode .api-image-title-text,
        html.dark-mode .api-image-title-text {
            color: #e0e0e0 !important;
            font-weight: 400;
        }

        /* Dark Mode: Gemini-Container – Mal-Tool */
        body.dark-mode .gemini-input-wrapper,
        html.dark-mode .gemini-input-wrapper {
            background: linear-gradient(135deg, #1a1a1a 0%, #2a2a2a 100%) !important;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.08) !important;
        }
        body.dark-mode .gemini-input-wrapper::after,
        html.dark-mode .gemini-input-wrapper::after {
            content: '';
            position: absolute;
            top: 0;
            right: 0;
            width: 80px;
            height: 100%;
            background: linear-gradient(to left, rgba(0, 0, 0, 0.3), transparent);
            pointer-events: none;
            border-radius: 0 24px 24px 0;
        }
        body.dark-mode .gemini-input-wrapper:focus-within,
        html.dark-mode .gemini-input-wrapper:focus-within {
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5), 0 0 0 1px #667eea !important;
        }
        body.dark-mode .gemini-prompt-input,
        html.dark-mode .gemini-prompt-input {
            background: transparent !important;
            color: #e0e0e0 !important;
        }
        body.dark-mode .gemini-prompt-input::placeholder,
        html.dark-mode .gemini-prompt-input::placeholder {
            color: #888888 !important;
        }
        body.dark-mode .gemini-input-controls,
        html.dark-mode .gemini-input-controls {
            background: rgba(0, 0, 0, 0.2) !important;
            border-top-color: rgba(255, 255, 255, 0.12) !important;
        }
        body.dark-mode .gemini-tools-button,
        html.dark-mode .gemini-tools-button {
            background: rgba(255, 255, 255, 0.08) !important;
            color: #667eea !important;
        }
        body.dark-mode .gemini-tools-button:hover,
        html.dark-mode .gemini-tools-button:hover {
            background: rgba(255, 255, 255, 0.14) !important;
        }
        body.dark-mode .gemini-tools-button.active,
        html.dark-mode .gemini-tools-button.active {
            border-color: #FFD700 !important;
            background: rgba(255, 215, 0, 0.15) !important;
        }
        body.dark-mode .gemini-tools-button.active:hover,
        html.dark-mode .gemini-tools-button.active:hover {
            background: rgba(255, 215, 0, 0.2) !important;
        }
        body.dark-mode .gemini-send-button,
        html.dark-mode .gemini-send-button {
            background: rgba(102, 126, 234, 0.7) !important;
            color: #ffffff !important;
        }
        body.dark-mode .gemini-send-button:hover:not(:disabled),
        html.dark-mode .gemini-send-button:hover:not(:disabled) {
            background: rgba(102, 126, 234, 0.9) !important;
            box-shadow: 0 4px 12px rgba(102, 126, 234, 0.5) !important;
        }
        body.dark-mode .session-limit-info,
        html.dark-mode .session-limit-info,
        body.dark-mode #sessionLimitInfo,
        html.dark-mode #sessionLimitInfo {
            color: #aaaaaa !important;
        }
        body.dark-mode .loading,
        html.dark-mode .loading,
        body.dark-mode .loading p,
        html.dark-mode .loading p {
            color: #667eea !important;
        }
        body.dark-mode .spinner,
        html.dark-mode .spinner {
            border-color: rgba(255, 255, 255, 0.15) !important;
            border-top-color: #667eea !important;
        }

        .gemini-prompt-input {
            width: 100%;
            padding: 12px 20px; /* Top/Bottom Padding um 50% reduziert: 24px → 12px */
            border: none;
            border-radius: 24px 24px 0 0;
            font-size: 16px;
            font-family: 'JetBrains Mono', monospace;
            font-weight: 400;
            resize: none;
            overflow-y: auto;
            overflow-x: hidden;
            background: transparent;
            color: #1a1a1a;
            line-height: 1.5;
            min-height: 60px;
            max-height: 200px;
            height: auto;
            /* Erlaube Scrollen an die Seite weiterzugeben, wenn Textarea am Ende */
            overscroll-behavior-y: auto;
        }
        
        /* Dynamische Höhenanpassung für Textarea */
        .gemini-prompt-input:focus {
            height: auto;
        }

        .gemini-prompt-input:focus {
            outline: none;
        }

        .gemini-prompt-input::placeholder {
            color: #9aa0a6;
            font-weight: 400;
        }

        .gemini-input-controls {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 6px 16px; /* Top/Bottom Padding um 50% reduziert: 12px → 6px */
            border-top: 1px solid #e8eaed;
            background: #ffffff;
            gap: 8px;
            border-radius: 0 0 24px 24px;
            flex-shrink: 0;
            position: relative;
            z-index: 1;
            pointer-events: auto;
        }

        .gemini-tools-section {
            display: flex;
            align-items: center;
            gap: 8px;
            position: relative;
            pointer-events: auto;
            min-width: 0;
            overflow-x: auto;
            overflow-y: hidden;
            -webkit-overflow-scrolling: touch;
            scrollbar-width: thin;
        }

        .gemini-tools-button {
            display: flex;
            align-items: center;
            gap: 6px;
            padding: 8px 12px;
            border: 3px solid transparent;
            background: #ffffff;
            border-radius: 20px;
            cursor: pointer;
            font-size: 14px;
            font-family: 'JetBrains Mono', monospace;
            color: #667eea;
            transition: background-color 0.2s ease, border-color 0.2s ease;
            pointer-events: auto;
        }

        .gemini-tools-button:hover {
            background: #f5f5f5;
        }

        .gemini-tools-button.active {
            border-color: #FFD700;
        }

        .gemini-tools-button.active:hover {
            background: #ffffff;
            border-color: #FFD700;
        }

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

        .tools-text {
            font-weight: 500;
        }

        /* Kleine Ansichten: Symbole kompakter, damit alle Platz haben */
        @media (max-width: 500px) {
            .gemini-input-controls {
                padding: 6px 10px;
                gap: 6px;
            }
            .gemini-tools-section {
                gap: 6px;
            }
            .gemini-tools-button {
                padding: 6px 10px;
                flex-shrink: 0;
            }
            .tools-icon {
                font-size: 18px;
            }
            .gemini-send-button {
                width: 36px;
                height: 36px;
            }
            .gemini-send-button svg {
                width: 20px;
                height: 20px;
            }
        }
        @media (max-width: 380px) {
            .gemini-input-controls {
                padding: 6px 8px;
                gap: 4px;
            }
            .gemini-tools-section {
                gap: 4px;
            }
            .gemini-tools-button {
                padding: 6px 8px;
            }
            .tools-icon {
                font-size: 16px;
            }
            .gemini-send-button {
                width: 34px;
                height: 34px;
            }
            .gemini-send-button svg {
                width: 18px;
                height: 18px;
            }
        }

        /* Modal für gespeicherte Prompts */
        .saved-prompts-modal {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.5);
            z-index: 10000;
            display: flex;
            align-items: center;
            justify-content: center;
            animation: fadeIn 0.2s ease;
        }

        .saved-prompts-modal-content {
            background: #ffffff;
            border-radius: 20px;
            width: 90%;
            max-width: 600px;
            max-height: 80vh;
            display: flex;
            flex-direction: column;
            box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
            animation: slideUp 0.3s ease;
        }

        .saved-prompts-modal-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 20px;
            border-bottom: 1px solid #e8eaed;
        }

        .saved-prompts-modal-header h3 {
            margin: 0;
            font-size: 20px;
            color: #2c3e50;
            font-family: 'JetBrains Mono', monospace;
        }

        .saved-prompts-close {
            background: none;
            border: none;
            font-size: 24px;
            cursor: pointer;
            color: #667eea;
            padding: 0;
            width: 30px;
            height: 30px;
            display: flex;
            align-items: center;
            justify-content: center;
            border-radius: 50%;
            transition: background 0.2s ease;
        }

        .saved-prompts-close:hover {
            background: #f5f5f5;
        }

        .saved-prompts-list {
            padding: 20px;
            overflow-y: auto;
            flex: 1;
            /* Erlaube Scrollen an die Seite weiterzugeben, wenn Liste am Ende */
            overscroll-behavior-y: auto;
        }

        .saved-prompts-loading {
            text-align: center;
            padding: 40px;
            color: #667eea;
            font-size: 16px;
        }

        .saved-prompt-item {
            padding: 15px;
            margin-bottom: 10px;
            border: 2px solid #e8eaed;
            border-radius: 12px;
            cursor: pointer;
            transition: all 0.2s ease;
            background: #ffffff;
        }

        .saved-prompt-item:hover {
            border-color: #667eea;
            background: #f8f9ff;
            transform: translateY(-2px);
            box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
        }

        .saved-prompt-title {
            font-weight: 700;
            color: #2c3e50;
            margin-bottom: 8px;
            font-size: 16px;
            font-family: 'JetBrains Mono', monospace;
        }

        .saved-prompt-text {
            color: #666;
            font-size: 14px;
            line-height: 1.5;
            max-height: 60px;
            overflow: hidden;
            text-overflow: ellipsis;
            display: -webkit-box;
            -webkit-line-clamp: 3;
            line-clamp: 3;
            -webkit-box-orient: vertical;
            font-family: 'JetBrains Mono', monospace;
        }

        .saved-prompt-date {
            color: #999;
            font-size: 12px;
            margin-top: 8px;
            font-family: 'JetBrains Mono', monospace;
        }

        .saved-prompts-empty {
            text-align: center;
            padding: 40px;
            color: #999;
            font-size: 16px;
        }

        @keyframes fadeIn {
            from { opacity: 0; }
            to { opacity: 1; }
        }

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

        body.dark-mode .saved-prompts-modal-content {
            background: #1a1a1a;
        }

        body.dark-mode .saved-prompts-modal-header {
            border-bottom-color: #333;
        }

        body.dark-mode .saved-prompts-modal-header h3 {
            color: #ffffff;
        }

        body.dark-mode .saved-prompt-item {
            background: #2a2a2a;
            border-color: #444;
        }

        body.dark-mode .saved-prompt-item:hover {
            background: #333;
            border-color: #667eea;
        }

        body.dark-mode .saved-prompt-title {
            color: #ffffff;
        }

        body.dark-mode .saved-prompt-text {
            color: #ccc;
        }

        body.dark-mode .saved-prompt-date {
            color: #888;
        }

        .gemini-speed-section {
            display: flex;
            align-items: center;
            gap: 4px;
            padding: 8px 12px;
            border-radius: 20px;
            cursor: pointer;
            transition: background-color 0.2s ease;
            background: rgba(102, 126, 234, 0.5);
            color: #ffffff;
        }

        .gemini-speed-section:hover {
            background: rgba(102, 126, 234, 0.7);
        }

        .speed-text {
            font-size: 14px;
            font-family: 'JetBrains Mono', monospace;
            color: #ffffff;
            font-weight: 500;
        }

        .speed-chevron {
            font-size: 12px;
            color: #ffffff;
        }

        .gemini-books-section {
            display: flex;
            align-items: center;
            gap: 4px;
            padding: 8px 12px;
            border-radius: 20px;
            cursor: pointer;
            transition: background-color 0.2s ease;
            background: rgba(118, 75, 162, 0.5);
            color: #ffffff;
        }

        .gemini-books-section:hover {
            background: rgba(118, 75, 162, 0.7);
        }

        .books-text {
            font-size: 14px;
            font-family: 'JetBrains Mono', monospace;
            color: #ffffff;
            font-weight: 500;
        }

        .gemini-send-button {
            width: 40px;
            height: 40px;
            border: none;
            background: rgba(102, 126, 234, 0.5);
            border-radius: 50%;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            color: white;
            transition: all 0.2s ease;
            flex-shrink: 0;
            pointer-events: auto;
            box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
            margin-left: auto;
        }

        .gemini-send-button:hover {
            background: rgba(85, 104, 211, 0.7);
            transform: scale(1.05);
            box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
        }

        .gemini-send-button:active {
            transform: scale(0.95);
        }

        .gemini-send-button:disabled {
            opacity: 0.5;
            cursor: not-allowed;
            transform: none;
        }

        .session-limit-info {
            position: absolute;
            bottom: -25px;
            left: 0;
            font-size: 12px;
            color: #9aa0a6;
            font-weight: 400;
        }

        .image-result-container {
            position: relative;
            width: 100%;
            max-width: 1000px;
            margin: 0 auto;
            display: none;
        }

        .image-result-container.show {
            display: block;
        }

        .image-result {
            width: 100%;
            max-width: 1000px;
            margin: 0 auto;
            display: block;
            border-radius: 5px;
            box-shadow: 0 10px 40px rgba(0,0,0,0.3);
            animation: fadeIn 0.5s ease-in;
        }

        .image-result-timestamp {
            position: absolute;
            bottom: 8px;
            left: 50%;
            transform: translateX(-50%); /* Zentriert horizontal */
            background: rgba(0, 0, 0, 0.7);
            color: rgba(255, 255, 255, 1);
            padding: 6px 12px;
            border-radius: 4px;
            font-size: 12px;
            font-family: 'JetBrains Mono', monospace;
            font-weight: 600;
            letter-spacing: 0.3px;
            backdrop-filter: blur(4px);
            -webkit-backdrop-filter: blur(4px);
            pointer-events: none; /* Verhindert, dass der Zeitstempel Klicks blockiert */
            z-index: 10;
            line-height: 1.2;
            white-space: nowrap; /* Verhindert Zeilenumbruch */
            opacity: 1;
            display: block;
        }

        .close-image-button {
            position: absolute;
            top: 8px;
            right: 8px;
            width: 40px;
            height: 40px;
            background: rgba(0, 0, 0, 0.7);
            color: white;
            border: 2px solid rgba(255, 255, 255, 0.8);
            border-radius: 50%;
            font-size: 24px;
            font-weight: bold;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            z-index: 100;
            transition: all 0.3s ease;
            backdrop-filter: blur(4px);
            -webkit-backdrop-filter: blur(4px);
            line-height: 1;
            padding: 0;
        }

        .close-image-button:hover {
            background: rgba(255, 0, 0, 0.8);
            border-color: rgba(255, 255, 255, 1);
            transform: scale(1.1);
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
        }

        .close-image-button:active {
            transform: scale(0.95);
        }

        #imageContainer {
            text-align: center;
            margin: 15px 0;
        }

        .image-actions {
            display: flex;
            gap: 15px;
            justify-content: center;
            margin-top: 15px;
            flex-wrap: wrap;
        }

        .download-button, .save-button {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            border: none;
            padding: 15px 30px;
            border-radius: 25px;
            font-size: 20px;
            font-weight: 700;
            font-family: 'JetBrains Mono', monospace;
            cursor: pointer;
            transition: all 0.3s ease;
            box-shadow: 0 5px 15px rgba(0,0,0,0.2);
        }

        .download-button:hover, .save-button:hover {
            transform: scale(1.05);
            box-shadow: 0 8px 20px rgba(0,0,0,0.3);
        }

        .save-button {
            background: linear-gradient(135deg, #f093fb 0%, #4facfe 100%);
        }

        .edit-characters-button {
            background: linear-gradient(135deg, #FF6B9D 0%, #667eea 100%);
            color: white;
            border: 3px solid rgba(255, 255, 255, 0.8);
            padding: 10px 15px;
            border-radius: 50px;
            font-size: 24px;
            font-weight: 700;
            font-family: 'JetBrains Mono', monospace;
            cursor: pointer;
            transition: all 0.3s ease;
            box-shadow: 0 4px 15px rgba(0,0,0,0.3);
            width: 50px;
            height: 50px;
            display: flex;
            align-items: center;
            justify-content: center;
            margin-right: 10px;
            text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
            transform: scale(1) rotate(0deg);
        }

        .edit-characters-button:hover:not(:active) {
            transform: scale(1.1) rotate(5deg);
            box-shadow: 0 6px 20px rgba(0,0,0,0.4);
            border-color: #FFD700;
        }

        .edit-characters-button:active {
            transform: scale(0.95) rotate(0deg) !important;
            transition: transform 0.1s ease;
        }

        .my-gallery {
            background: transparent;
            border-radius: 0;
            padding: 20px;
            margin-top: 15px;
            box-shadow: none;
            text-align: center;
            width: 100% !important;
            max-width: 100% !important;
            box-sizing: border-box;
            overflow-x: visible;
        }

        .gallery-title {
            font-family: 'JetBrains Mono', monospace;
            font-size: 32px;
            color: #667eea;
            text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
            margin-bottom: 20px;
            text-align: center;
            background: linear-gradient(135deg, rgba(255, 107, 157, 0.1) 0%, rgba(102, 126, 234, 0.1) 100%);
            padding: 15px 30px;
            border-radius: 25px;
        }
        
        .books-toggle-button {
            display: flex;
            align-items: center;
            gap: 6px;
            padding: 8px 12px;
            border: 3px solid transparent;
            background: #ffffff;
            border-radius: 20px;
            cursor: pointer;
            font-size: 14px;
            font-family: 'JetBrains Mono', monospace;
            color: #667eea;
            transition: background-color 0.2s ease, border-color 0.2s ease;
        }
        
        .books-toggle-button:hover {
            background: #f5f5f5;
        }
        
        .books-toggle-button.active {
            border-color: #FFD700;
        }
        
        .books-toggle-button.active:hover {
            background: #ffffff;
            border-color: #FFD700;
        }

        .books-manager {
            margin-bottom: 20px;
            display: flex;
            justify-content: center;
            align-items: center;
        }

        .books-dropdown-container {
            display: flex;
            gap: 10px;
            align-items: stretch;
            flex-direction: column;
            justify-content: center;
            width: 100%;
            max-width: 800px;
            position: relative;
        }
        
        /* Buttons nebeneinander auf größeren Bildschirmen */
        @media (min-width: 769px) {
            .books-dropdown-container {
                flex-direction: row;
                flex-wrap: wrap;
            }
            
            .book-create-btn,
            .book-pdf-btn,
            .book-publish-btn,
            .book-unpublish-btn,
            .book-delete-btn {
                flex: 1;
                min-width: 200px;
                max-width: 100%;
            }
        }

        /* Entferne alle dekorativen Pseudo-Elemente (Dreiecke) */
        .books-dropdown-container::before,
        .books-dropdown-container::after,
        .books-manager::before,
        .books-manager::after,
        .books-dropdown::before,
        .books-dropdown::after,
        .books-dropdown-container *::before,
        .books-dropdown-container *::after {
            display: none !important;
            content: none !important;
        }

        .books-dropdown {
            flex: 1;
            min-width: auto;
            max-width: 400px;
            padding: 7.56px 21px; /* Gleiche Größe wie dropdown-select */
            font-size: 18px; /* Reduziert für bessere Lesbarkeit */
            font-family: 'JetBrains Mono', monospace;
            font-weight: 700;
            border: 1px solid rgba(102, 126, 234, 0.2); /* Dezente Linie */
            border-radius: 4px; /* Minimal abgerundete Ecken */
            background: #ffffff; /* Weißer Hintergrund im hellen Modus */
            color: #667eea; /* Blauer Text */
            outline: none;
            cursor: pointer;
            transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
            appearance: none;
            background-image: none !important; /* Kein Pfeil */
            background-repeat: no-repeat;
            background-position: right 6.3px center;
            background-size: 10.08px 10.08px;
            width: auto;
            box-shadow: none; /* Keine 3D-Effekte */
            line-height: 1.4; /* Gleich wie dropdown-select-with-label.empty */
            letter-spacing: 0.42px; /* Gleich wie dropdown-select */
        }

        .books-dropdown:hover {
            border-color: rgba(102, 126, 234, 0.4); /* Leicht hellere Linie beim Hover */
            background: #ffffff; /* Weißer Hintergrund bleibt */
            box-shadow: none; /* Keine 3D-Effekte */
        }
        
        .books-dropdown:focus {
            outline: none;
            border: 1px solid rgba(102, 126, 234, 0.5) !important; /* Dezente Linie beim Fokus */
            box-shadow: none; /* Keine 3D-Effekte */
            background: #ffffff; /* Weißer Hintergrund bleibt */
        }

        .books-dropdown option {
            font-size: 13px !important; /* Kleiner als Dropdown-Feld für bessere Proportionen */
        }
        
        .books-dropdown option[data-published="true"] {
            color: #28a745 !important; /* Grün für veröffentlichte Bilderbücher */
            font-weight: 700 !important;
        }
        
        
        .books-dropdown option:last-child {
            border-bottom: none !important; /* Keine Linie beim letzten Element */
        }
        
        .books-dropdown option:hover {
            background: rgba(102, 126, 234, 0.1) !important; /* Leichter blauer Hintergrund beim Hover */
            color: #667eea !important;
        }
        
        .books-dropdown option:checked {
            background: rgba(102, 126, 234, 0.2) !important; /* Dezenter blauer Hintergrund für ausgewählte Option */
            color: #667eea !important;
        }
        
        /* Dark Mode Styles für Books-Dropdown */
        body.dark-mode .books-dropdown {
            background: #2a2a2a !important;
            color: #ffffff !important;
            font-size: 18px !important; /* Reduziert für bessere Lesbarkeit */
            background-image: none !important; /* Kein Pfeil */
        }
        
        body.dark-mode .books-dropdown:hover {
            background: #333333 !important;
        }
        
        body.dark-mode .books-dropdown:focus {
            background: #333333 !important;
            border-color: #667eea !important;
        }
        
        body.dark-mode .books-dropdown option {
            background: #2a2a2a !important;
            color: #ffffff !important;
        }
        
        body.dark-mode .books-dropdown option[data-published="true"] {
            color: #4caf50 !important;
        }
        
        body.dark-mode .books-dropdown option:hover {
            background: #333333 !important;
        }
        
        body.dark-mode .books-dropdown option:checked {
            background: rgba(102, 126, 234, 0.3) !important;
        }

        /* Entferne alle dekorativen Pseudo-Elemente (Dreiecke) im Dark Mode */
        body.dark-mode .books-dropdown-container::before,
        body.dark-mode .books-dropdown-container::after,
        body.dark-mode .books-manager::before,
        body.dark-mode .books-manager::after,
        body.dark-mode .books-dropdown::before,
        body.dark-mode .books-dropdown::after,
        body.dark-mode .books-dropdown-container *::before,
        body.dark-mode .books-dropdown-container *::after,
        html.dark-mode .books-dropdown-container::before,
        html.dark-mode .books-dropdown-container::after,
        html.dark-mode .books-manager::before,
        html.dark-mode .books-manager::after,
        html.dark-mode .books-dropdown::before,
        html.dark-mode .books-dropdown::after,
        html.dark-mode .books-dropdown-container *::before,
        html.dark-mode .books-dropdown-container *::after {
            display: none !important;
            content: none !important;
        }

        /* Gemeinsame Styles für alle Bilderbuch-Buttons */
        .book-create-btn,
        .book-pdf-btn,
        .book-publish-btn,
        .book-unpublish-btn,
        .book-delete-btn {
            padding: 8px 16px;
            font-size: 16px;
            font-family: 'JetBrains Mono', monospace;
            font-weight: 700;
            border: 3px solid;
            border-radius: 12px;
            cursor: pointer;
            transition: all 0.3s ease;
            white-space: nowrap;
            width: 100%;
            min-height: 40px;
            display: flex;
            align-items: center;
            justify-content: center;
            box-sizing: border-box;
        }

        .book-create-btn {
            border-color: #667eea;
            background: #667eea;
            color: white;
        }

        .book-create-btn:hover {
            background: #764ba2;
            border-color: #764ba2;
            transform: scale(1.02);
        }

        .book-pdf-btn {
            border-color: #FFC966;
            background: #FFC966;
            color: #333333;
        }

        .book-pdf-btn:hover:not(:disabled) {
            background: #FFB84D;
            border-color: #FFB84D;
            transform: scale(1.02);
        }

        .book-pdf-btn:disabled {
            opacity: 0.5;
            cursor: not-allowed;
        }

        .book-publish-btn {
            border-color: #27ae60;
            background: #27ae60;
            color: white;
        }
        
        /* Grün für veröffentlichte Bücher */
        .book-publish-btn.published {
            background: #28a745 !important;
            border-color: #28a745 !important;
        }
        
        .book-publish-btn.published:hover:not(:disabled) {
            background: #218838 !important;
            border-color: #218838 !important;
            transform: scale(1.02);
        }

        .book-publish-btn:hover:not(:disabled) {
            background: #229954;
            border-color: #229954;
            transform: scale(1.02);
        }

        .book-publish-btn:disabled {
            opacity: 0.5;
            cursor: not-allowed;
        }

        .book-unpublish-btn {
            border-color: #ff9800;
            background: #ff9800;
            color: white;
        }

        .book-unpublish-btn:hover:not(:disabled) {
            background: #f57c00;
            border-color: #f57c00;
            transform: scale(1.02);
        }

        .book-unpublish-btn:disabled {
            opacity: 0.5;
            cursor: not-allowed;
        }

        .book-delete-btn {
            border-color: #d32f2f;
            background: #d32f2f;
            color: white;
        }

        .book-delete-btn:hover:not(:disabled) {
            background: #c62828;
            border-color: #c62828;
            transform: scale(1.02);
        }

        .book-delete-btn:disabled {
            opacity: 0.5;
            cursor: not-allowed;
        }

        @media (max-width: 768px) {
            .books-dropdown-container {
                flex-direction: column;
                width: 100%;
                max-width: 100%;
            }
            .books-dropdown {
                width: 100% !important; /* Alle gleich breit */
                min-width: 100% !important;
                max-width: 100% !important;
                font-size: 13px !important; /* Kleinere Schrift für mobile Ansicht */
                padding: 8px 10px !important; /* Reduziertes Padding */
                padding-right: 30px !important;
                background: rgba(255, 255, 255, 0.8) !important; /* Dezenter weißer Hintergrund */
                border: 1px solid rgba(102, 126, 234, 0.15) !important; /* Dezente Linie */
                color: #667eea !important; /* Blauer Text */
                box-shadow: none !important; /* Keine 3D-Effekte */
            }
            .book-create-btn,
            .book-pdf-btn,
            .book-publish-btn,
            .book-unpublish-btn,
            .book-delete-btn {
                width: 100% !important; /* Alle Buttons gleich breit */
            }
            .books-dropdown option {
                font-size: 12px !important; /* Angepasst an Dropdown-Textfeld */
                padding: 6px 8px !important;
                line-height: 1.3 !important;
                font-weight: 700 !important;
                font-family: 'JetBrains Mono', monospace !important;
            }
            .book-create-btn,
            .book-pdf-btn,
            .book-publish-btn,
            .book-unpublish-btn,
            .book-delete-btn {
                width: 100%;
                max-width: 100%;
            }
        }

        /* Container für Freunde-Toggle-Buttons */
        .active-friends-container {
            display: flex;
            flex-wrap: wrap;
            justify-content: center;
            align-items: flex-start;
            gap: 12px;
            margin-bottom: 15px;
            margin-top: 20px;
            padding: 10px;
            max-width: 90%;
            margin-left: auto;
            margin-right: auto;
        }
        
        /* Einzelner Freund-Toggle-Button */
        .friend-toggle-btn {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            padding: 10px 12px;
            border: none;
            border-radius: 16px;
            color: white;
            font-family: 'JetBrains Mono', monospace;
            box-shadow: 0 2px 6px rgba(0,0,0,0.2);
            transition: transform 0.2s ease, opacity 0.2s ease, box-shadow 0.2s ease;
            cursor: pointer;
            min-width: 70px;
            max-width: 90px;
        }
        
        .friend-toggle-btn:hover {
            transform: scale(1.05);
            box-shadow: 0 4px 8px rgba(0,0,0,0.3);
        }
        
        .friend-toggle-btn[data-active="false"] {
            opacity: 0.2;
        }
        
        .friend-toggle-btn[data-active="true"] {
            opacity: 1;
        }
        
        /* Emoji als Avatar */
        .friend-toggle-emoji {
            font-size: 28px;
            margin-bottom: 6px;
            line-height: 1;
        }
        
        /* Info-Container mit Name und Username */
        .friend-toggle-info {
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 2px;
            width: 100%;
        }
        
        .friend-toggle-name {
            font-size: 11px;
            font-weight: 700;
            text-align: center;
            line-height: 1.2;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            max-width: 100%;
        }
        
        .friend-toggle-username {
            font-size: 9px;
            font-weight: 500;
            text-align: center;
            line-height: 1.2;
            opacity: 0.85;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            max-width: 100%;
        }
        
        /* Dark Mode für Freunde-Toggle */
        body.dark-mode .active-friends-container,
        html.dark-mode .active-friends-container {
            background: transparent;
        }
        
        .gallery-filters {
            display: flex;
            gap: 10.5px; /* Gleicher Abstand wie books-filters */
            margin-bottom: 14px; /* Gleiche Größe wie books-filters */
            margin-top: 40px; /* Top margin von 40px */
            flex-wrap: wrap;
            justify-content: center;
            align-items: center;
            max-width: 70%; /* Gleiche Breite wie books-filters */
            margin-left: auto;
            margin-right: auto;
        }

        .gallery-search-input {
            flex: 1;
            min-width: 122.5px; /* Gleiche Größe wie books-search-input */
            max-width: 196px; /* Gleiche Größe wie books-search-input */
            padding: 8.4px 14px; /* Gleiche Größe wie books-search-input */
            font-size: 11px; /* Gleiche Größe wie books-search-input */
            font-family: 'JetBrains Mono', monospace;
            border: none; /* Rahmen entfernt */
            border-radius: 10.5px; /* Gleiche Größe wie books-search-input */
            background: white;
            color: #333;
            outline: none;
            transition: all 0.3s ease;
        }

        .gallery-search-input:focus {
            border: none; /* Rahmen entfernt */
            box-shadow: none; /* Schatten entfernt */
        }

        .gallery-sort-select {
            padding: 8.4px 14px; /* Gleiche Größe wie books-sort-select */
            font-size: 12.6px; /* Gleiche Größe wie books-sort-select */
            font-family: 'JetBrains Mono', monospace;
            font-weight: 700;
            border: none; /* Rahmen entfernt */
            border-radius: 10.5px; /* Gleiche Größe wie books-sort-select */
            background: white;
            color: #333;
            outline: none;
            cursor: pointer;
            transition: all 0.3s ease;
            min-width: 122.5px; /* Gleiche Größe wie books-sort-select */
            max-width: 196px; /* Gleiche Größe wie books-sort-select */
        }

        .gallery-sort-select:hover,
        .gallery-sort-select:focus {
            border: none; /* Rahmen entfernt */
            box-shadow: none; /* Schatten entfernt */
        }

        .gallery-refresh-btn {
            padding: 8.4px 14px; /* Gleiche Größe wie gallery-sort-select */
            font-size: 20px; /* Emoji-Größe */
            font-family: 'JetBrains Mono', monospace;
            font-weight: 700;
            border: none; /* Rahmen entfernt */
            border-radius: 10.5px; /* Gleiche Größe wie gallery-sort-select */
            background: white;
            color: #333;
            outline: none;
            cursor: pointer;
            transition: all 0.3s ease;
            min-width: 45px; /* Quadratischer Button */
            height: 38px; /* Gleiche Höhe wie Select */
            display: flex;
            align-items: center;
            justify-content: center;
            line-height: 1;
        }

        .gallery-refresh-btn:hover {
            background: #f0f0f0;
            transform: rotate(180deg);
        }

        .gallery-refresh-btn:disabled {
            opacity: 0.5;
            cursor: not-allowed;
            transform: none;
        }

        .gallery-refresh-btn:disabled:hover {
            background: inherit;
            transform: none;
        }

        .gallery-refresh-btn:active {
            transform: rotate(360deg);
        }

        /* Löschen-Button: keine Rotation, rot blinkend wenn Bilder ausgewählt */
        .gallery-delete-selected-btn:hover,
        .gallery-delete-selected-btn:active {
            transform: none;
        }
        .gallery-delete-selected-btn:not(:disabled) {
            background: #dc2626;
            color: white;
            animation: gallery-delete-btn-blink 1.2s ease-in-out infinite;
        }
        .gallery-delete-selected-btn:not(:disabled):hover {
            background: #b91c1c;
            color: white;
        }
        @keyframes gallery-delete-btn-blink {
            0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.5); }
            50% { opacity: 0.9; box-shadow: 0 0 12px 4px rgba(220, 38, 38, 0.6); }
        }

        /* Dark Mode Styles für Aktualisierungs-Button */
        body.dark-mode .gallery-refresh-btn,
        html.dark-mode .gallery-refresh-btn {
            background: #2a2a2a;
            color: #ffffff;
        }

        body.dark-mode .gallery-refresh-btn:hover,
        html.dark-mode .gallery-refresh-btn:hover {
            background: #3a3a3a;
        }

        body.dark-mode .gallery-refresh-btn:active,
        html.dark-mode .gallery-refresh-btn:active {
            background: #3a3a3a;
        }

        body.dark-mode .gallery-refresh-btn:disabled,
        html.dark-mode .gallery-refresh-btn:disabled {
            opacity: 0.5;
        }

        body.dark-mode .gallery-delete-selected-btn:not(:disabled),
        html.dark-mode .gallery-delete-selected-btn:not(:disabled) {
            background: #dc2626;
            color: white;
        }

        .gallery-filter-clear {
            padding: 0;
            margin: 0;
            font-size: 48px;
            font-family: 'JetBrains Mono', monospace;
            font-weight: 700;
            border: none;
            border-radius: 0;
            background: transparent;
            color: #667eea;
            cursor: pointer;
            transition: all 0.3s ease;
            line-height: 1;
            width: auto;
            height: auto;
            display: inline-block;
        }

        .gallery-filter-clear:hover {
            transform: scale(1.2);
            color: #764ba2;
        }

        .gallery-zoom-controls {
            display: flex;
            justify-content: center;
            align-items: center;
            margin-bottom: 20px;
            margin-top: 10px;
            padding: 10px 20px;
            width: 100%;
            box-sizing: border-box;
        }

        .gallery-zoom-controls label {
            display: flex;
            align-items: center;
            gap: 10px;
            justify-content: center;
            width: auto;
            max-width: 500px;
            box-sizing: border-box;
        }

        .gallery-zoom-controls input[type="range"] {
            -webkit-appearance: none;
            appearance: none;
            height: 8px;
            border-radius: 5px;
            background: #e0e0e0;
            outline: none;
            transition: background 0.3s ease;
            flex: 1;
            min-width: 150px;
            max-width: 300px;
            box-sizing: border-box;
            /* Verbessere Touch-Unterstützung für mobile Geräte */
            touch-action: pan-y;
            -webkit-tap-highlight-color: transparent;
        }

        .gallery-zoom-controls input[type="range"]::-webkit-slider-thumb {
            -webkit-appearance: none;
            appearance: none;
            width: 20px;
            height: 20px;
            border-radius: 50%;
            background: #667eea;
            cursor: pointer;
            box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
            transition: all 0.3s ease;
            /* Verbessere Touch-Unterstützung für mobile Geräte */
            touch-action: none;
            -webkit-tap-highlight-color: transparent;
        }

        .gallery-zoom-controls input[type="range"]::-webkit-slider-thumb:hover {
            background: #764ba2;
            transform: scale(1.1);
        }

        .gallery-zoom-controls input[type="range"]::-moz-range-thumb {
            width: 20px;
            height: 20px;
            border-radius: 50%;
            background: #667eea;
            cursor: pointer;
            border: none;
            box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
            transition: all 0.3s ease;
            /* Verbessere Touch-Unterstützung für mobile Geräte */
            touch-action: none;
        }

        .gallery-zoom-controls input[type="range"]::-moz-range-thumb:hover {
            background: #764ba2;
            transform: scale(1.1);
        }

        .gallery-zoom-controls input[type="range"]:focus {
            outline: none;
        }

        .gallery-zoom-controls input[type="range"]:focus::-webkit-slider-thumb {
            box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.3);
        }

        .gallery-zoom-controls input[type="range"]:focus::-moz-range-thumb {
            box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.3);
        }

        #galleryZoomValue {
            font-family: 'JetBrains Mono', monospace;
            font-weight: 700;
            color: #667eea;
            font-size: 14px;
        }

        @media (max-width: 768px) {
            .active-friends-container {
                max-width: 100%;
                padding: 8px;
                gap: 10px;
            }
            
            .friend-toggle-btn {
                width: 70px; /* Feste Breite für alle Buttons gleich groß */
                min-width: 70px;
                max-width: 70px;
                padding: 8px 0; /* Seitliches Padding entfernt */
            }
            
            .friend-toggle-emoji {
                font-size: 24px;
            }
            
            .friend-toggle-name {
                font-size: 10px;
                padding: 0; /* Kein Padding seitlich */
            }
            
            .friend-toggle-username {
                font-size: 8px;
                padding: 0; /* Kein Padding seitlich */
            }
            
            .gallery-filters {
                flex-direction: column;
            }
            .gallery-search-input,
            .gallery-sort-select {
                width: 100%;
                max-width: 100%;
            }
            .gallery-zoom-controls {
                max-width: 100%;
                padding: 10px;
            }
            .gallery-zoom-controls label {
                flex-direction: column;
                gap: 8px;
                width: auto;
                max-width: 100%;
            }
            .gallery-zoom-controls input[type="range"] {
                width: 100%;
                max-width: 100%;
            }
            /* Stelle sicher, dass gallery-edit-container die volle Breite behält */
            .gallery-edit-container {
                width: 100% !important;
                min-width: 0 !important;
                max-width: 100% !important;
                padding: 2px 0 !important;
                flex: 1 1 auto !important;
            }
            .gallery-edit-textarea {
                width: 100% !important;
                min-width: 0 !important;
                max-width: 100% !important;
            }
            .gallery-edit-buttons-container {
                width: 100% !important;
            }
        }

        .gallery-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)) !important; /* So viele Spalten wie möglich, min 300px (250px + 20%) */
            gap: 15px;
            margin-top: 15px; /* Platz oben für Hover-Effekt */
            margin-left: 0; /* Standard: kein Margin, wird in Media Query für größere Ansichten überschrieben */
            margin-right: 0; /* Standard: kein Margin, wird in Media Query für größere Ansichten überschrieben */
            width: 100%;
            max-width: 100% !important;
            box-sizing: border-box;
            overflow-x: visible; /* Sichtbar, damit Hover-Effekt seitlich nicht abgeschnitten wird */
            padding-left: 10px; /* Padding links für Hover-Effekt */
            padding-right: 10px; /* Padding rechts für Hover-Effekt */
            padding-top: 15px; /* Padding oben für Hover-Effekt */
            overflow-y: visible; /* Erlaube vertikales Scrollen */
            background: transparent !important; /* Entferne grauen Hintergrund */
            align-items: start; /* Cards oben ausrichten */
            /* Stelle sicher, dass auch bei nur 1 Item die volle Breite genutzt wird */
            grid-auto-columns: minmax(300px, 1fr);
        }
        
        /* Begrenze Breite von Gallery-Items - auch bei nur 1 Item */
        /* Maximale Breite basierend auf minmax-Werten: 300px (Standard) + Padding/Margin = ~400px */
        .gallery-item {
            max-width: 400px; /* Maximale Breite für alle Gallery-Items */
        }
        
        /* Bei nur 1 Item: zentriere es und begrenze die Breite */
        .gallery-grid:has(> .gallery-item:only-child) {
            grid-template-columns: 1fr !important;
            justify-items: center; /* Zentriere das einzelne Item */
        }
        
        /* Fallback für Browser ohne :has() Support */
        .gallery-grid > .gallery-item:only-child {
            max-width: 400px !important; /* Maximale Breite auch bei nur 1 Item */
            width: 100%;
            margin-left: auto; /* Zentriere */
            margin-right: auto; /* Zentriere */
        }

        /* Für sehr große Bildschirme: so viele Spalten wie möglich */
        @media (min-width: 1400px) {
            .gallery-grid {
                grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)) !important; /* So viele Spalten wie möglich, min 300px (250px + 20%) */
            }
        }

        /* Für mittlere große Bildschirme: so viele Spalten wie möglich */
        @media (max-width: 1399px) and (min-width: 1025px) {
            .gallery-grid {
                grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)) !important; /* So viele Spalten wie möglich, min 300px (250px + 20%) */
            }
        }

        @media (max-width: 1024px) and (min-width: 769px) {
            .gallery-grid {
                grid-template-columns: repeat(auto-fit, minmax(336px, 1fr)) !important; /* Dynamische Anpassung, min 336px (280px + 20%) */
                max-width: 100% !important; /* Volle Breite */
                margin-left: 0 !important; /* Standard: kein Margin */
                margin-right: 0 !important; /* Standard: kein Margin */
                width: 100% !important;
                padding-left: 10px !important; /* Padding für Hover-Effekt */
                padding-right: 10px !important; /* Padding für Hover-Effekt */
            }
            /* Bei mittleren Bildschirmen: max-width etwas höher (336px + Padding) */
            .gallery-item {
                max-width: 400px !important; /* Einheitliche maximale Breite */
            }
            /* Stelle sicher, dass gallery-edit-container die volle Breite behält */
            .gallery-edit-container {
                width: 100% !important;
                min-width: 0 !important;
                max-width: 100% !important;
                padding: 2px 0 !important;
                flex: 1 1 auto !important;
            }
            .gallery-edit-textarea {
                width: 100% !important;
                min-width: 0 !important;
                max-width: 100% !important;
            }
            .gallery-edit-buttons-container {
                width: 100% !important;
            }
        }
        
        /* Media Query für 465px bis 768px - separate Behandlung um Konflikte zu vermeiden */
        @media (max-width: 768px) and (min-width: 465px) {
            .gallery-grid {
                grid-template-columns: repeat(auto-fit, minmax(336px, 1fr)) !important; /* Dynamische Anpassung, min 336px (280px + 20%) */
                max-width: 100% !important; /* Volle Breite */
                margin-left: 0 !important; /* Standard: kein Margin */
                margin-right: 0 !important; /* Standard: kein Margin */
                width: 100% !important;
                padding-left: 10px !important; /* Padding für Hover-Effekt */
                padding-right: 10px !important; /* Padding für Hover-Effekt */
            }
            /* Bei mittleren Bildschirmen: max-width etwas höher (336px + Padding) */
            .gallery-item {
                max-width: 400px !important; /* Einheitliche maximale Breite */
            }
            /* Stelle sicher, dass gallery-edit-container die volle Breite behält */
            .gallery-edit-container {
                width: 100% !important;
                min-width: 0 !important;
                max-width: 100% !important;
                padding: 2px 0 !important;
                flex: 1 1 auto !important;
            }
            .gallery-edit-textarea {
                width: 100% !important;
                min-width: 0 !important;
                max-width: 100% !important;
            }
            .gallery-edit-buttons-container {
                width: 100% !important;
            }
        }

        @media (max-width: 464px) {
            .gallery-grid {
                grid-template-columns: 1fr;
                gap: 10px;
                max-width: 100%; /* Volle Breite auf Mobile */
                padding-left: 0 !important; /* Kein seitliches Padding */
                padding-right: 0 !important; /* Kein seitliches Padding */
                margin-left: 0 !important; /* Explizit kein seitliches Margin */
                margin-right: 0 !important; /* Explizit kein seitliches Margin */
                width: 100% !important; /* Volle Breite */
                justify-items: center; /* Zentriere Items auf Mobile */
            }
            .gallery-item {
                margin-left: 0 !important; /* Explizit kein seitliches Margin */
                margin-right: 0 !important; /* Explizit kein seitliches Margin */
                padding-left: 0 !important; /* Explizit kein seitliches Padding */
                padding-right: 0 !important; /* Explizit kein seitliches Padding */
                max-width: 100% !important; /* Auf Mobile: volle Breite erlaubt */
            }
            /* Stelle sicher, dass gallery-edit-container die volle Breite behält */
            .gallery-edit-container {
                width: 100% !important;
                min-width: 0 !important;
                max-width: 100% !important;
                padding: 2px 0 !important; /* Kein seitliches Padding */
            }
            .gallery-edit-textarea {
                width: 100% !important;
                min-width: 0 !important;
                max-width: 100% !important;
            }
            .gallery-edit-buttons-container {
                width: 100% !important;
            }
        }

        .gallery-item {
            background: rgba(255, 255, 255, 0.5); /* 50% transparent - Standard-Hintergrund (wie auf Startseite) */
            border-radius: 20px;
            overflow: visible; /* Sichtbar, damit Hover-Effekt nicht abgeschnitten wird - Vorlesetext-Container ist innerhalb scrollbar */
            box-shadow: none !important; /* Entferne grauen Schatten */
            transition: transform 0.3s ease, border 0.3s ease;
            cursor: pointer;
            position: relative;
            display: flex;
            flex-direction: column;
            border: 5px solid transparent; /* Gleicher Border wie book-card */
            width: 100%; /* Volle Breite im Grid */
            max-width: 400px; /* Maximale Breite für alle Gallery-Items */
            box-sizing: border-box; /* Border in Breite einberechnen */
            aspect-ratio: 1 / 1.6; /* Fixes Seitenverhältnis: Breite zu Höhe = 1:1.6 */
            height: auto; /* Höhe wird durch aspect-ratio bestimmt */
            min-height: 0; /* Erlaube keine Mindesthöhe, die das Aspect Ratio überschreibt */
            max-height: none; /* Keine maximale Höhe, die das Aspect Ratio überschreibt */
            margin-left: auto; /* Zentriere bei Bedarf */
            margin-right: auto; /* Zentriere bei Bedarf */
            margin-top: 30px; /* Mehr Platz oben für Hover-Effekt */
            margin-bottom: 20px; /* Gleicher Margin wie book-card */
            margin-left: 10px; /* Platz links für Hover-Effekt */
            margin-right: 10px; /* Platz rechts für Hover-Effekt */
            padding: 3.75px 3.75px 0 3.75px; /* Einheitliches Padding - nochmal 50% reduziert: 7.5px → 3.75px */
            min-width: 0; /* Erlaube Shrinking */
            flex: 1 1 auto; /* Flexibel aber nutze verfügbaren Platz */
        }
        
        /* Buttons und interaktive Elemente sollen pointer haben */
        .gallery-item button,
        .gallery-item .gallery-edit-btn,
        .gallery-item .gallery-delete-btn,
        .gallery-item .gallery-publish-btn,
        .gallery-item .gallery-item-fullscreen-btn,
        .gallery-item .book-control-btn,
        .gallery-item .book-arrow-btn {
            cursor: pointer;
        }
        
        .gallery-item-fullscreen-btn {
            position: absolute;
            top: 15px;
            right: 15px;
            background: rgba(0, 0, 0, 0.7);
            color: white;
            border: none;
            width: 50px;
            height: 50px;
            border-radius: 50%;
            font-size: 24px;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: all 0.3s ease;
            z-index: 10;
            box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
        }
        
        .gallery-item-fullscreen-btn:hover {
            background: rgba(0, 0, 0, 0.9);
            transform: scale(1.1);
        }
        
        .gallery-item-fullscreen-btn:active {
            transform: scale(0.95);
        }
        
        /* Vollbild-Modal */
        .fullscreen-modal {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            width: 100vw;
            height: 100vh;
            background: rgba(0, 0, 0, 0.95);
            z-index: 10000;
            display: flex;
            align-items: center;
            justify-content: center;
            animation: fadeIn 0.3s ease;
            padding: 0 !important; /* Kein Padding zum Rand */
            margin: 0 !important; /* Kein Margin zum Rand */
        }
        
        @keyframes fadeIn {
            from {
                opacity: 0;
            }
            to {
                opacity: 1;
            }
        }
        
        .fullscreen-modal-content {
            position: relative;
            width: 100%;
            height: 100%;
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 0 !important; /* Kein Padding zum Rand */
            margin: 0 !important; /* Kein Margin zum Rand */
        }
        
        .fullscreen-modal-content img {
            max-width: 100vw;
            max-height: 100vh;
            width: 100vw;
            height: 100vh;
            object-fit: contain;
            border-radius: 0; /* Kein Border-Radius für volle Breite */
            box-shadow: none; /* Kein Schatten für volle Breite */
            transform-origin: center center;
            transition: transform 0.3s ease;
            margin: 0 !important; /* Kein Margin */
            padding: 0 !important; /* Kein Padding */
        }
        
        .fullscreen-close {
            position: absolute;
            top: 30px;
            right: 30px;
            background: rgba(255, 255, 255, 0.9);
            color: #333;
            border: none;
            width: 60px;
            height: 60px;
            border-radius: 50%;
            font-size: 32px;
            font-weight: bold;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: all 0.3s ease;
            z-index: 10001;
            box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
        }
        
        .fullscreen-close:hover {
            background: white;
            transform: scale(1.1) rotate(90deg);
        }
        
        .fullscreen-close:active {
            transform: scale(0.95) rotate(90deg);
        }

        /* Vollbild-Edit-Modal für Titel und Vorlesetext */
        .fullscreen-edit-modal {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            width: 100vw;
            height: 100vh;
            height: 100dvh; /* Dynamische Viewport-Höhe: passt sich Tastatur an */
            max-height: 100dvh;
            background: rgba(0, 0, 0, 0.6);
            z-index: 10002;
            display: flex;
            align-items: center;
            justify-content: center;
            animation: fadeIn 0.3s ease;
            padding: 20px;
            overflow-y: auto;
        }
        
        .fullscreen-edit-content {
            position: relative;
            width: 100%;
            max-width: 560px;
            max-height: calc(100dvh - 40px); /* Platz für Padding, passt sich Tastatur an */
            padding: 32px 40px;
            background: #ffffff;
            border-radius: 12px;
            box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
            overflow-y: auto;
            display: flex;
            flex-direction: column;
        }
        
        .fullscreen-edit-close {
            position: absolute;
            top: 16px;
            right: 16px;
            background: transparent;
            color: #6b7280;
            border: none;
            padding: 8px 12px;
            font-size: 14px;
            font-weight: 500;
            cursor: pointer;
            transition: color 0.2s ease;
            z-index: 10;
        }
        
        .fullscreen-edit-close:hover {
            color: #111827;
        }
        
        .fullscreen-edit-fields {
            display: flex;
            flex-direction: column;
            gap: 20px;
            margin-top: 8px;
            flex: 1 1 auto;
            min-height: 0;
        }
        
        .fullscreen-edit-label {
            font-size: 13px;
            font-weight: 600;
            color: #374151;
            letter-spacing: 0.02em;
        }
        
        .fullscreen-edit-title {
            font-size: 16px;
            line-height: 1.5;
            padding: 12px 16px;
            border: 1px solid #e5e7eb;
            border-radius: 8px;
            resize: vertical;
            min-height: 60px;
            font-family: inherit;
            width: 100%;
            max-width: 100%;
            box-sizing: border-box;
        }
        
        .fullscreen-edit-title:focus {
            outline: none;
            border-color: #3b82f6;
            box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
        }
        
        .fullscreen-edit-vorlese {
            font-size: 16px;
            line-height: 1.5;
            padding: 14px 16px;
            border: 1px solid #e5e7eb;
            border-radius: 8px;
            resize: vertical;
            min-height: 180px;
            font-family: inherit;
            width: 100%;
            max-width: 100%;
            box-sizing: border-box;
        }
        
        .fullscreen-edit-vorlese:focus {
            outline: none;
            border-color: #3b82f6;
            box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
        }
        
        .fullscreen-edit-buttons {
            display: flex;
            gap: 12px;
            margin-top: 24px;
            padding-top: 20px;
            padding-bottom: env(safe-area-inset-bottom, 0);
            border-top: 1px solid #e5e7eb;
            justify-content: flex-end;
            flex-shrink: 0;
            background: #ffffff;
        }
        
        .fullscreen-edit-save,
        .fullscreen-edit-cancel {
            padding: 10px 20px;
            font-size: 14px;
            font-weight: 500;
            border-radius: 8px;
            cursor: pointer;
            transition: all 0.15s ease;
        }
        
        .fullscreen-edit-save {
            background: #2563eb;
            color: white;
            border: none;
        }
        
        .fullscreen-edit-save:hover {
            background: #1d4ed8;
        }
        
        .fullscreen-edit-cancel {
            background: #ffffff;
            color: #374151;
            border: 1px solid #d1d5db;
        }
        
        .fullscreen-edit-cancel:hover {
            background: #f9fafb;
            border-color: #9ca3af;
        }
        
        /* Fullscreen-Edit-Modal: Dark Mode – wie Profil */
        body.dark-mode .fullscreen-edit-modal,
        html.dark-mode .fullscreen-edit-modal {
            background: rgba(0, 0, 0, 0.85) !important;
        }
        
        body.dark-mode .fullscreen-edit-content,
        html.dark-mode .fullscreen-edit-content {
            background: #1a1a1a !important;
            box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6) !important;
        }
        
        body.dark-mode .fullscreen-edit-close,
        html.dark-mode .fullscreen-edit-close {
            color: #cccccc !important;
        }
        
        body.dark-mode .fullscreen-edit-close:hover,
        html.dark-mode .fullscreen-edit-close:hover {
            color: #ffffff !important;
        }
        
        body.dark-mode .fullscreen-edit-label,
        html.dark-mode .fullscreen-edit-label {
            color: #ffffff !important;
        }
        
        body.dark-mode .fullscreen-edit-title,
        body.dark-mode .fullscreen-edit-vorlese,
        html.dark-mode .fullscreen-edit-title,
        html.dark-mode .fullscreen-edit-vorlese {
            background: #2a2a2a !important;
            border-color: #444444 !important;
            color: #ffffff !important;
        }
        
        body.dark-mode .fullscreen-edit-title::placeholder,
        body.dark-mode .fullscreen-edit-vorlese::placeholder,
        html.dark-mode .fullscreen-edit-title::placeholder,
        html.dark-mode .fullscreen-edit-vorlese::placeholder {
            color: #888888 !important;
        }
        
        body.dark-mode .fullscreen-edit-title:focus,
        body.dark-mode .fullscreen-edit-vorlese:focus,
        html.dark-mode .fullscreen-edit-title:focus,
        html.dark-mode .fullscreen-edit-vorlese:focus {
            border-color: #667eea !important;
            box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.25) !important;
        }
        
        body.dark-mode .fullscreen-edit-buttons,
        html.dark-mode .fullscreen-edit-buttons {
            border-top-color: #444444 !important;
            background: #1a1a1a !important;
        }
        
        body.dark-mode .fullscreen-edit-save,
        html.dark-mode .fullscreen-edit-save {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
            color: white !important;
        }
        
        body.dark-mode .fullscreen-edit-save:hover,
        html.dark-mode .fullscreen-edit-save:hover {
            background: linear-gradient(135deg, #7c8ef5 0%, #8b5bb8 100%) !important;
        }
        
        body.dark-mode .fullscreen-edit-cancel,
        html.dark-mode .fullscreen-edit-cancel {
            background: #2a2a2a !important;
            color: #cccccc !important;
            border-color: #444444 !important;
        }
        
        body.dark-mode .fullscreen-edit-cancel:hover,
        html.dark-mode .fullscreen-edit-cancel:hover {
            background: #333333 !important;
            border-color: #667eea !important;
        }
        
        @media (max-width: 768px) {
            .fullscreen-edit-modal {
                height: 100dvh;
                max-height: 100dvh;
                align-items: flex-start;
                padding: 12px;
            }
            .fullscreen-edit-content {
                padding: 24px 20px;
                max-height: calc(100dvh - 24px);
            }
            .fullscreen-edit-title {
                font-size: 18px;
                min-height: 50px;
            }
            .fullscreen-edit-vorlese {
                font-size: 18px;
                min-height: 120px;
            }
            /* Buttons sticky am unteren Rand – sichtbar auch bei geöffneter Tastatur */
            .fullscreen-edit-buttons {
                position: sticky;
                bottom: 0;
                margin-top: 16px;
                margin-left: -20px;
                margin-right: -20px;
                margin-bottom: -24px;
                padding: 16px 20px 20px;
                padding-bottom: calc(20px + env(safe-area-inset-bottom, 0));
                box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.08);
            }
        }

        .gallery-item {
            position: relative; /* Wichtig: Für absolute Positionierung des Badges */
        }

        .gallery-item:hover {
            transform: translateY(-15px) scale(1.05);
            box-shadow: none !important; /* Entferne Schatten auch beim Hover */
            border-color: #FFD700; /* Gleiche Hover-Farbe wie book-card */
        }
        
        .gallery-item:active {
            transform: translateY(-10px) scale(1.02);
        }
        
        /* Ausgewähltes Gallery-Item für Vorlesefunktion (wie auf Index-Seite) */
        .gallery-item.selected {
            border: 5px solid #ff0000;
        }

        /* Gallery Item Image Container (wie auf Hauptseite) */
        .gallery-item-image-container {
            position: relative; /* WICHTIG: Für absolute Positionierung des Edit-Buttons */
            width: 100%;
            height: auto; /* Höhe wird durch JavaScript bestimmt */
            flex: 0 0 auto; /* Feste Höhe, wird durch JavaScript gesetzt */
            overflow: hidden !important; /* WICHTIG: Verhindere, dass Bilder über Container hinausragen */
            border-radius: 20px 20px 0 0;
            min-height: 200px; /* Mindesthöhe für Sichtbarkeit */
            max-height: 70vh; /* Fallback: Maximal 70% der Viewport-Höhe */
        }

        .gallery-item-image-container img {
            width: 100%;
            max-width: 100% !important; /* Verhindere Überschreitung */
            height: 100%;
            max-height: 100% !important; /* Verhindere Überschreitung */
            object-fit: cover;
            object-position: center; /* Zentriere Bild */
            display: block;
            background: transparent;
            border-radius: 20px 20px 0 0;
        }
        
        .gallery-item-image-container video {
            width: 100%;
            max-width: 100% !important; /* Verhindere Überschreitung */
            height: 100%;
            max-height: 100% !important; /* Verhindere Überschreitung */
            object-fit: cover;
            object-position: center; /* Zentriere Video */
            display: block;
            background: transparent;
            border-radius: 20px 20px 0 0;
        }
        
        /* Gallery Item Timestamp (wie auf Hauptseite) */
        .gallery-item-timestamp {
            position: absolute;
            bottom: 8px;
            left: 50%;
            transform: translateX(-50%); /* Zentriert horizontal */
            background: rgba(0, 0, 0, 0.5);
            color: rgba(255, 255, 255, 0.85);
            padding: 4px 8px;
            border-radius: 4px;
            font-size: 10px;
            font-family: 'JetBrains Mono', monospace;
            font-weight: 500;
            letter-spacing: 0.3px;
            backdrop-filter: blur(4px);
            -webkit-backdrop-filter: blur(4px);
            pointer-events: none; /* Verhindert, dass der Zeitstempel Klicks blockiert */
            z-index: 10;
            line-height: 1.2;
            white-space: nowrap; /* Verhindert Zeilenumbruch */
        }
        
        /* Gallery Item Friend Name (wie auf Hauptseite) */
        .gallery-item-friend-name {
            position: absolute;
            top: 10%;
            left: 50%;
            transform: translateX(-50%);
            background: rgba(255, 255, 255, 0.9);
            padding: 8px 16px;
            border-radius: 20px;
            font-family: 'JetBrains Mono', monospace;
            font-weight: 700;
            font-size: 16px;
            box-shadow: 0 2px 8px rgba(0,0,0,0.2);
            z-index: 10;
            border: 2px solid;
        }

        /* Gallery Item Image Wrapper (für Kompatibilität) */
        .gallery-item-image-wrapper {
            position: relative;
            width: 100%;
            display: block;
        }

        .gallery-item img {
            width: 100%;
            height: 100%; /* Füllt Container vollständig */
            object-fit: cover;
            display: block;
            background: transparent;
            border-radius: 20px 20px 0 0;
            pointer-events: auto; /* Stelle sicher, dass Bilder interaktiv sind */
        }

        .gallery-item-title-container {
            position: relative;
            padding: 2px 15px;
            margin-top: 10px;
            text-align: left;
            display: flex;
            flex-direction: column;
            align-items: flex-start;
            gap: 0;
            background: transparent;
            height: auto;
            min-height: auto;
        }
        
        /* Gallery Item Info (1:1 wie auf Hauptseite) */
        .gallery-item-info {
            padding: 10px 0; /* Reduziertes Padding: 20px -> 10px */
            text-align: left; /* Linksbündig für Name und Titel */
            display: flex;
            flex-direction: column; /* Vertikale Anordnung: Titel oben, Username darunter */
            align-items: flex-start;
            justify-content: flex-start; /* Geändert: flex-start statt center */
            gap: 0; /* Kein Gap zwischen Elementen */
            flex: 1; /* Nimmt verfügbaren Platz ein */
            min-height: 0; /* Wichtig für Scrollbarkeit */
            overflow-y: auto; /* Scrollbar machen */
            overflow-x: hidden; /* Kein horizontales Scrollen */
            position: relative; /* Für relative Positionierung */
            /* Verstecke Scrollbars aber behalte Scrollbarkeit */
            scrollbar-width: none; /* Firefox */
            -ms-overflow-style: none; /* IE und Edge */
        }
        
        /* Verstecke Scrollbars für Webkit-Browser (Chrome, Safari, Edge) */
        .gallery-item-info::-webkit-scrollbar {
            display: none; /* Chrome, Safari, Edge */
        }
        
        /* Allgemeine Regel: Verstecke Scrollbars für alle Scroll-Container innerhalb von Gallery-Items */
        .gallery-item * {
            scrollbar-width: none; /* Firefox */
            -ms-overflow-style: none; /* IE und Edge */
        }
        
        .gallery-item *::-webkit-scrollbar {
            display: none; /* Chrome, Safari, Edge */
        }
        
        /* Reihenfolge: Titel oben, Username darunter - verwende order (1:1 wie Startseite) */
        .gallery-item-info > .gallery-title-text {
            order: 1; /* Titel kommt zuerst */
            margin-bottom: 4px !important;
            margin-left: 0;
        }
        
        .gallery-item-info > .gallery-item-name-container {
            order: 2; /* Username kommt danach */
            margin-bottom: 4px !important;
            margin-right: 0 !important;
            width: 100%; /* So breit wie das Item */
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 4px 8px;
            border-radius: 8px;
            box-sizing: border-box;
        }
        
        /* Stelle sicher, dass Hintergrund bei Freund-Items NICHT überschrieben wird */
        .gallery-item-info > .gallery-item-name-container.friend-item {
            background: var(--friend-bg-color) !important;
        }
        
        
        /* Datum und Vorlesetext danach */
        .gallery-item-info > .gallery-item-date {
            order: 3;
            margin-bottom: 2px !important; /* Reduziert: 5px -> 2px */
        }
        
        .gallery-item-info > .vorlese-text {
            order: 4;
            flex-shrink: 0; /* Verhindert, dass der Text schrumpft */
            width: 100%; /* Volle Breite */
            margin-top: 2px !important; /* Reduzierter Abstand oben */
        }

        /* Zentriere die Seitenangabe im gallery-item-info */
        .gallery-item-info small {
            width: 100%;
            display: flex;
            justify-content: center;
            align-items: center;
        }
        
        .gallery-delete-select-checkbox {
            position: absolute;
            top: 8px;
            left: 8px;
            width: 24px;
            height: 24px;
            background: rgba(255, 255, 255, 0.6);
            border: 1px solid rgba(0, 0, 0, 0.2);
            border-radius: 4px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 14px;
            cursor: pointer;
            z-index: 1001;
            transition: all 0.2s ease;
        }
        .gallery-delete-select-checkbox:hover {
            background: rgba(255, 255, 255, 0.9);
            border-color: rgba(0, 0, 0, 0.3);
        }
        .gallery-item.gallery-item-delete-selected {
            outline: 4px solid rgba(220, 38, 38, 1);
            outline-offset: -2px;
            box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.4), inset 0 0 0 2px rgba(220, 38, 38, 0.2);
            position: relative;
        }
        .gallery-item.gallery-item-delete-selected::after {
            content: '🗑️ Zum Löschen';
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            background: rgba(220, 38, 38, 0.9);
            color: white;
            padding: 12px 24px;
            border-radius: 12px;
            font-size: 18px;
            font-weight: 700;
            font-family: 'JetBrains Mono', monospace;
            white-space: nowrap;
            z-index: 100;
            pointer-events: none;
            box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
        }
        
        .gallery-edit-btn {
            position: absolute;
            bottom: 10px; /* Unten im Image-Container */
            right: 10px; /* Rechts ausrichten */
            background: rgba(102, 126, 234, 0.9);
            color: white;
            border: none;
            width: 32px; /* Etwas kleiner: 35px -> 32px */
            height: 32px; /* Etwas kleiner: 35px -> 32px */
            border-radius: 50%;
            font-size: 16px; /* Etwas kleiner: 18px -> 16px */
            z-index: 1000; /* Über dem Bild und anderen Elementen */
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: all 0.3s ease;
            box-shadow: 0 3px 10px rgba(102, 126, 234, 0.5);
            pointer-events: auto;
            flex-shrink: 0; /* Verhindere, dass Button schrumpft */
        }
        
        .gallery-edit-btn:hover {
            background: rgba(102, 126, 234, 1);
            transform: scale(1.1);
        }
        
        .gallery-item-book-badge-container {
            position: absolute;
            bottom: 10px;
            left: 50%;
            transform: translateX(-50%);
            z-index: 15; /* Über dem Bild und Video, aber unter Edit-Button (z-index: 1000) */
            display: flex;
            flex-direction: column;
            gap: 5px;
            max-width: calc(100% - 20px);
            width: auto;
            pointer-events: none; /* Erlaube Klicks durch den Badge */
        }
        
        /* Stelle sicher, dass der Badge auch über Videos angezeigt wird */
        .gallery-item-image-container video {
            position: relative;
            z-index: 1; /* Unter dem Badge */
        }
        
        .gallery-item-image-container img {
            position: relative;
            z-index: 1; /* Unter dem Badge */
        }

        /* Platzhalter wenn Bild nicht geladen werden kann */
        .gallery-item-image-container .gallery-image-error-placeholder {
            display: flex;
            align-items: center;
            justify-content: center;
            z-index: 0;
        }

        .gallery-item-book-badge {
            color: white;
            padding: 8px 15px;
            border-radius: 10px;
            font-size: 16px;
            font-family: 'JetBrains Mono', monospace;
            font-weight: 700;
            box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            pointer-events: auto; /* Erlaube Klicks auf den Badge selbst */
            text-align: center;
            display: inline-block;
            /* Hintergrundfarbe wird dynamisch per inline-style basierend auf Bilderbuch-Name gesetzt */
        }

        .book-arrow-btn {
            width: 40px;
            height: 40px;
            border: none;
            border-radius: 50%;
            background: transparent;
            color: #667eea;
            font-size: 20px;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: all 0.3s ease;
            box-shadow: none;
        }

        .book-arrow-btn:hover {
            background: transparent;
            transform: scale(1.1);
            box-shadow: none;
        }
        
        .gallery-item-book-controls {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            display: flex;
            gap: 8px;
            opacity: 0;
            transition: opacity 0.3s ease;
            z-index: 10;
        }

        /* Zeige Controls immer wenn ein Bilderbuch ausgewählt ist */
        .gallery-item-book-controls.book-controls-visible {
            opacity: 1 !important;
        }

        /* Behalte Hover-Verhalten für den Fall, dass kein Bilderbuch ausgewählt ist */
        .gallery-item:hover .gallery-item-book-controls {
            opacity: 1;
        }

        .book-control-btn {
            width: 50px;
            height: 50px;
            border: none;
            border-radius: 50%;
            background: rgba(102, 126, 234, 0.9);
            color: white;
            font-size: 24px;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: all 0.3s ease;
            box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
        }

        .book-control-btn:hover {
            background: #764ba2;
            transform: scale(1.1);
        }

        .book-control-btn.in-book {
            background: rgba(118, 75, 162, 0.9);
        }
        
        .book-control-btn.locked {
            background: rgba(158, 158, 158, 0.9);
            cursor: not-allowed;
            opacity: 0.6;
        }
        
        .book-control-btn.locked:hover {
            background: rgba(158, 158, 158, 0.9);
            transform: none;
        }
        
        /* Schloss-Symbol wenn Bilderbuch geladen, aber Edit-Mode nicht aktiviert */
        .book-lock-indicator {
            width: 50px;
            height: 50px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 32px;
            color: rgba(102, 126, 234, 0.9);
            cursor: pointer;
            user-select: none;
            filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
            transition: transform 0.2s ease, opacity 0.2s ease;
        }
        
        .book-lock-indicator:hover {
            transform: scale(1.1);
            opacity: 0.8;
        }
        
        .book-lock-indicator:active {
            transform: scale(0.95);
        }
        
        /* Drag & Drop Styles für Bilderbuch-Reihenfolge */
        .gallery-item[draggable="true"] {
            cursor: move;
        }
        
        .gallery-item.dragging {
            opacity: 0.5;
            transform: scale(0.95);
        }
        
        .gallery-item.drop-over {
            border: 3px dashed #667eea;
            transform: scale(1.05);
        }
        
        .gallery-save-btn {
            background: rgba(76, 175, 80, 0.9);
            color: white;
            border: none;
            padding: 4px 12px;
            border-radius: 8px;
            font-size: 13px;
            font-family: 'JetBrains Mono', monospace;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.3s ease;
            margin: 0;
            margin-right: 8px;
            box-shadow: 0 2px 6px rgba(76, 175, 80, 0.5);
            z-index: 1000;
            pointer-events: auto;
            flex: 1;
            min-width: 0;
            line-height: 1.2;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            height: auto;
            min-height: 28px;
            display: flex;
            align-items: center;
            justify-content: center;
        }
        
        .gallery-save-btn:hover {
            background: rgba(76, 175, 80, 1);
            transform: scale(1.05);
        }
        
        .gallery-cancel-btn {
            background: rgba(158, 158, 158, 0.9);
            color: white;
            border: none;
            padding: 4px 12px;
            border-radius: 8px;
            font-size: 13px;
            font-family: 'JetBrains Mono', monospace;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.3s ease;
            margin: 0;
            box-shadow: 0 2px 6px rgba(158, 158, 158, 0.5);
            z-index: 1000;
            pointer-events: auto;
            flex: 1;
            min-width: 0;
            line-height: 1.2;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            height: auto;
            min-height: 28px;
            display: flex;
            align-items: center;
            justify-content: center;
        }
        
        .gallery-cancel-btn:hover {
            background: rgba(158, 158, 158, 1);
            transform: scale(1.05);
        }
        
        .gallery-edit-container {
            display: flex;
            flex-direction: column;
            width: 100% !important; /* Stelle sicher, dass volle Breite immer gilt */
            min-width: 0; /* Wichtig für Flex-Items - erlaube Shrinking, aber nutze verfügbaren Platz */
            max-width: 100% !important; /* Stelle sicher, dass max-width nicht überschritten wird */
            padding: 2px 0; /* Gleiches Padding wie gallery-item-info (kein seitliches Padding) */
            align-items: stretch;
            gap: 8px;
            box-sizing: border-box;
            /* Stelle sicher, dass der Container immer die volle Breite des Items ausfüllt - wie gallery-item-info */
            flex: 1 1 auto; /* flex-grow: 1, flex-shrink: 1, flex-basis: auto - nutze verfügbaren Platz */
            align-self: stretch;
        }
        
        .gallery-edit-buttons-container {
            display: flex;
            flex-direction: row;
            width: 100% !important; /* Stelle sicher, dass volle Breite immer gilt */
            gap: 8px;
            margin-top: 8px;
            align-items: center;
            align-self: stretch;
            box-sizing: border-box;
        }
        
        .gallery-edit-textarea {
            width: 100% !important; /* Stelle sicher, dass volle Breite immer gilt */
            min-width: 0; /* Keine min-width Beschränkung - nutze verfügbaren Platz wie gallery-item-info */
            max-width: 100% !important; /* Stelle sicher, dass max-width nicht überschritten wird */
            min-height: 50px;
            max-height: 80px;
            padding: 8px;
            border: 2px solid #667eea;
            border-radius: 5px;
            font-size: 14px;
            font-family: 'JetBrains Mono', monospace;
            font-weight: 600;
            resize: vertical;
            margin: 0;
            overflow-y: auto;
            white-space: pre-wrap;
            word-wrap: break-word;
            box-sizing: border-box;
            /* Erlaube Scrollen an die Seite weiterzugeben, wenn Textarea am Ende */
            overscroll-behavior-y: auto;
            /* Verstecke Scrollbars aber behalte Scrollbarkeit */
            scrollbar-width: none; /* Firefox */
            -ms-overflow-style: none; /* IE und Edge */
        }
        
        /* Verstecke Scrollbars für Webkit-Browser bei gallery-edit-textarea */
        .gallery-edit-textarea::-webkit-scrollbar {
            display: none; /* Chrome, Safari, Edge */
        }
        
        /* Vorlesetext-Textarea: höher für mehr Platz */
        .gallery-edit-textarea[id^="edit-text-"] {
            min-height: 100px;
            max-height: 200px;
            resize: vertical;
        }
        
        /* Titel-Textarea: nur eine Zeile hoch */
        .gallery-edit-textarea[id^="edit-title-"] {
            min-height: auto;
            max-height: none;
            height: auto;
            line-height: 1.2;
            resize: none;
            white-space: nowrap;
            overflow-x: auto;
            overflow-y: hidden;
            margin-top: 0;
            margin-bottom: 0;
            /* Verstecke Scrollbars aber behalte Scrollbarkeit */
            scrollbar-width: none; /* Firefox */
            -ms-overflow-style: none; /* IE und Edge */
        }
        
        /* Verstecke Scrollbars für Webkit-Browser bei Titel-Textarea */
        .gallery-edit-textarea[id^="edit-title-"]::-webkit-scrollbar {
            display: none; /* Chrome, Safari, Edge */
        }
        
        .gallery-edit-textarea:focus {
            outline: none;
            border-color: #f093fb;
            box-shadow: 0 0 10px rgba(102, 126, 234, 0.3);
        }

        /* Gallery Title Text (1:1 wie auf Hauptseite) */
        .gallery-title-text {
            margin: 0;
            padding: 0;
            background: transparent;
            font-size: 13px; /* Reduziert: 15.68px -> 13px */
            font-family: 'JetBrains Mono', monospace;
            font-weight: 700;
            line-height: 1.2;
            text-align: center; /* Zentriert */
            color: #667eea;
            height: auto;
            min-height: auto;
            display: block; /* Eigene Zeile */
            width: 100%; /* Volle Breite für Zentrierung */
            /* Verstecke Scrollbars falls vorhanden, behalte Scrollbarkeit */
            scrollbar-width: none; /* Firefox */
            -ms-overflow-style: none; /* IE und Edge */
        }
        
        /* Verstecke Scrollbars für Webkit-Browser bei gallery-title-text */
        .gallery-title-text::-webkit-scrollbar {
            display: none; /* Chrome, Safari, Edge */
        }
        
        .gallery-title-text:empty {
            display: none;
        }
        
        /* Container für gallery-item-name (für Freundesfarbe) */
        .gallery-item-name-container {
            width: 100%; /* So breit wie das Item */
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 3px 6px; /* Reduziert: 4px 8px -> 3px 6px */
            border-radius: 8px;
            box-sizing: border-box;
            min-height: auto; /* Nur so hoch wie der Text */
            height: auto;
        }
        
        /* Stelle sicher, dass Hintergrund bei Freund-Items NICHT überschrieben wird */
        .gallery-item-name-container.friend-item {
            background: var(--friend-bg-color) !important;
        }
        
        /* Gallery Item Name (1:1 wie auf Hauptseite) */
        .gallery-item-name {
            margin-bottom: 0 !important; /* Kein Margin mehr, da Container übernimmt */
            margin-right: 0 !important;
            font-family: 'JetBrains Mono', monospace;
            font-size: 12px; /* Reduziert: 14px -> 12px */
            text-shadow: 2px 2px 0px rgba(255,255,255,0.8), 1px 1px 4px rgba(0,0,0,0.3);
            font-weight: 700;
            letter-spacing: 0.5px; /* Reduziert: 1px -> 0.5px */
            display: block; /* Eigene Zeile */
            text-align: center; /* Zentriert */
            width: 100%; /* Volle Breite für Zentrierung */
        }
        
        /* Wenn gallery-item-name-container einen Hintergrund hat (Freund), passe Text-Schatten an */
        .gallery-item-name-container[style*="background"] .gallery-item-name {
            color: white !important; /* Weißer Text auf farbigem Hintergrund */
            text-shadow: 1px 1px 2px rgba(0,0,0,0.5) !important; /* Stärkerer Schatten für bessere Lesbarkeit */
        }
        
        .gallery-item-date {
            margin-bottom: 2px !important; /* Reduziert: 5px -> 2px */
        }
        
        .gallery-item-author {
            font-size: 12px;
            color: #6c757d;
            margin-top: 8px;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 5px;
            font-family: 'JetBrains Mono', monospace;
        }

        .gallery-item-author .author-label {
            font-weight: 600;
        }

        .gallery-item-author .author-name {
            color: #667eea;
            font-weight: 700;
        }

        .gallery-item-info strong {
            margin: 0;
            padding: 0;
            display: block;
        }

        /* Vorlese Text (wie auf Hauptseite) */
        .vorlese-text {
            margin: 0;
            padding: 10px; /* Reduziert: 15px -> 10px */
            background: transparent;
            border-left: 3px solid #9b59b6; /* Reduziert: 4px -> 3px */
            border-radius: 5px;
            font-size: 12px; /* Reduzierte Schriftgröße */
            line-height: 1.5; /* Reduziert: 1.6 -> 1.5 für kompaktere Darstellung */
            text-align: left;
            flex-shrink: 0; /* Verhindert, dass der Text schrumpft */
            width: 100%; /* Volle Breite */
            color: #2c3e50;
            /* Verstecke Scrollbars falls vorhanden, behalte Scrollbarkeit */
            scrollbar-width: none; /* Firefox */
            -ms-overflow-style: none; /* IE und Edge */
        }
        
        /* Verstecke Scrollbars für Webkit-Browser bei vorlese-text */
        .vorlese-text::-webkit-scrollbar {
            display: none; /* Chrome, Safari, Edge */
        }

        .gallery-play-button {
            background: linear-gradient(135deg, #9b59b6 0%, #e74c3c 100%);
            color: white;
            border: none;
            padding: 20px 40px;
            border-radius: 25px;
            font-size: 20px;
            font-weight: 700;
            font-family: 'JetBrains Mono', monospace;
            cursor: pointer;
            width: 100%;
            transition: all 0.3s ease;
            box-shadow: 0 8px 20px rgba(0,0,0,0.2);
            margin-top: 15px;
        }

        .gallery-play-button:hover {
            transform: scale(1.05);
            box-shadow: 0 12px 30px rgba(0,0,0,0.3);
        }

        .gallery-item-actions {
            position: absolute;
            bottom: 10px;
            left: 10px;
            display: flex;
            gap: 5px;
            z-index: 1000;
            pointer-events: auto;
        }

        .gallery-delete-btn {
            background: rgba(255, 107, 107, 0.9);
            color: white;
            border: none;
            border-radius: 50%;
            width: 30px;
            height: 30px;
            cursor: pointer;
            font-size: 16px;
            display: flex;
            align-items: center;
            justify-content: center;
            z-index: 1000;
            position: relative;
            pointer-events: auto;
        }
        
        .gallery-publish-btn {
            background: rgba(0, 0, 0, 0.6); /* Dunkler Hintergrund für bessere Sichtbarkeit */
            color: white;
            border: 2px solid rgba(255, 255, 255, 0.8); /* Weißer Rahmen für Kontrast */
            border-radius: 50%;
            width: 30px;
            height: 30px;
            cursor: pointer;
            font-size: 16px;
            display: flex;
            align-items: center;
            justify-content: center;
            z-index: 1000;
            position: relative;
            pointer-events: auto;
            transition: all 0.3s ease;
            box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
        }
        
        /* Starker grüner Rahmen mit Leuchteffekt für veröffentlichte Bilder */
        .gallery-publish-btn.published {
            border: 3px solid rgba(34, 197, 94, 1);
            background: rgba(0, 0, 0, 0.7); /* Etwas dunklerer Hintergrund für veröffentlichte */
            box-shadow: 0 0 8px rgba(34, 197, 94, 0.6), 0 0 12px rgba(34, 197, 94, 0.4), 0 2px 6px rgba(0, 0, 0, 0.4);
        }
        
        .gallery-publish-btn:hover {
            transform: scale(1.1);
            box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
        }
        
        /* Stärkerer Leuchteffekt beim Hover für veröffentlichte Buttons */
        .gallery-publish-btn.published:hover {
            border-color: rgba(34, 197, 94, 1);
            box-shadow: 0 0 12px rgba(34, 197, 94, 0.8), 0 0 18px rgba(34, 197, 94, 0.6), 0 4px 8px rgba(0, 0, 0, 0.15);
        }
        
        .gallery-publish-btn:active {
            transform: scale(0.95);
        }

        @keyframes fadeIn {
            from {
                opacity: 0;
                transform: scale(0.9);
            }
            to {
                opacity: 1;
                transform: scale(1);
            }
        }

        .loading {
            text-align: center;
            padding: 40px;
            font-size: 20px;
            font-family: 'JetBrains Mono', monospace;
            color: #667eea;
            font-weight: 700;
            display: none;
            letter-spacing: 1px;
        }
        
        .loading p {
            font-family: 'JetBrains Mono', monospace;
            font-weight: 700;
            font-size: 20px;
            letter-spacing: 1px;
        }
        
        .cancel-api-button {
            margin-top: 15px;
            padding: 10px 20px;
            background: #e74c3c;
            color: white;
            border: none;
            border-radius: 8px;
            font-size: 14px;
            font-family: 'JetBrains Mono', monospace;
            cursor: pointer;
            font-weight: 600;
            transition: background 0.2s ease, transform 0.1s ease;
        }
        
        .cancel-api-button:hover {
            background: #c0392b;
            transform: scale(1.05);
        }
        
        .cancel-api-button:active {
            transform: scale(0.95);
        }

        .loading.show {
            display: block;
        }

        .spinner {
            border: 5px solid #f3f3f3;
            border-top: 5px solid #667eea;
            border-radius: 50%;
            width: 50px;
            height: 50px;
            animation: spin 1s linear infinite;
            margin: 20px auto;
        }

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

        #sessionLimitInfo {
            font-size: 14px !important;
            font-weight: 400 !important;
            font-family: 'JetBrains Mono', monospace !important;
            letter-spacing: 0.3px;
            text-align: center !important;
            margin-top: 8px !important;
            color: #999 !important;
            background: transparent !important;
            border: none !important;
            padding: 0 !important;
            opacity: 0.7;
        }

        .error-message {
            background: #ff6b6b;
            color: white;
            padding: 20px;
            border-radius: 8px;
            margin: 20px 0;
            text-align: center;
            font-weight: 600;
            font-size: 20px;
            font-family: 'JetBrains Mono', monospace;
            display: none;
        }

        .error-message.show {
            display: block;
        }


        @media (max-width: 1024px) {
            .container {
                max-width: 100%;
            }
            .gallery-grid {
                grid-template-columns: repeat(2, 1fr);
            }
            .dropdowns-container {
                flex-wrap: wrap;
            }
        }

        @media (max-width: 768px) {
            /* Scroll-Indikator-Styles werden von menueband.js bereitgestellt */
            body {
                padding: 10px;
            }
            .kiki-container:not(#komplexContainer) {
                justify-content: center;
                margin: 20px auto 30px auto;
                width: 120px;
                max-width: 120px;
                min-height: 120px;
                height: 120px;
            }
            .kiki-image {
                width: 120px;
                height: 120px;
            }
            .kiki-text {
                font-size: 26px;
                margin-left: 0;
                margin-top: 0;
                display: none;
            }
            .header {
                padding: 20px 10px;
                margin-bottom: 20px;
                background: transparent;
            }
            .main-title {
                font-size: 20px;
                margin-top: 30px; /* 20px nach oben verschoben (von 50px auf 30px) */
                margin-bottom: 10px;
                padding: 0;
                display: flex; /* Flexbox für vertikale Zentrierung */
                align-items: center; /* Vertikal zentrieren */
                justify-content: center; /* Horizontal zentrieren */
            }
            .subtitle {
                font-size: 16px;
                padding: 0;
                letter-spacing: 2px;
            }
            .greeting-banner {
                font-size: 16px;
                padding: 9px 16px;
            }
            .character-selection,
            .drawing-area,
            .my-gallery {
                padding: 12px 9px;
                margin-bottom: 12px;
            }
            .visual-selection {
                padding: 4px;
            }
            .character-selection {
                margin-bottom: 0; /* Kein Abstand zum visual-selection */
            }
            .visual-selection {
                margin-top: 0; /* Kein Abstand zum character-selection */
            }
            .edit-characters-button {
                width: 45px;
                height: 45px;
                font-size: 20px;
                padding: 8px 12px;
                margin-right: 8px;
            }
            .character-title {
                font-size: 28px;
            }
            .drawing-title,
            .gallery-title {
                font-size: 16.8px; /* 40% kleiner: 28px → 16.8px */
                padding: 7.2px 12px; /* 40% kleiner: 12px → 7.2px, 20px → 12px */
            }
            .character-item-title {
                font-size: 10px;
            }
            .prompt-input {
                font-size: 18px;
                padding: 15px 20px;
            }
            .dropdown-select {
                font-size: 12px; /* Reduziert für kleinere Ansichten */
                padding: 5px 12px; /* Reduziertes Padding */
                padding-left: 6px; /* Reduziertes Padding links */
                padding-right: 30px; /* Platz für Dropdown-Pfeil */
                letter-spacing: 0.3px;
                color: #7a6eea;
                max-width: 100%;
                border: 1px solid rgba(102, 126, 234, 0.25); /* Dünne Linie wie Header-Dropdown */
                border-radius: 12px; /* Runde Ecken wie Header-Dropdown */
                box-shadow: 0 12px 32px rgba(0,0,0,0.15), 0 4px 16px rgba(0,0,0,0.1), inset 0 1px 0 rgba(255,255,255,0.6);
            }
            .dropdown-select option {
                font-size: 11px; /* Proportional kleiner als Dropdown-Feld (12px) */
                padding: 10px 14px;
                border-bottom: 1px solid rgba(102, 126, 234, 0.15); /* Dünne Trennlinie wie Header-Dropdown */
            }
            .generate-button {
                font-size: 20px;
            }
            .download-button,
            .save-button,
            .gallery-play-button {
                font-size: 18px;
            }
            .loading {
                font-size: 18px;
            }
            .loading p {
                font-size: 18px;
            }
            .error-message {
                font-size: 18px;
            }
            #sessionLimitInfo {
                font-size: 13px !important;
            }
            .add-button-placeholder .add-button-content {
                font-size: 3.5rem;
            }
            .character-selected-badge {
                width: 28px;
                height: 28px;
                font-size: 16px;
                top: 50%;
                left: 50%;
                transform: translate(-50%, -50%);
            }
            .dropdown-label {
                font-size: 12px;
                font-weight: 700;
                cursor: pointer;
            }
            /* Visual-Sektion: kompakt auf Mobile */
            .dropdowns-container {
                flex-direction: column;
                align-items: center;
                justify-content: flex-start;
                gap: 4px;
                padding: 4px;
            }
            .dropdown-wrapper {
                width: 180px;
                min-width: 180px;
                max-width: 180px;
                margin: 0 auto;
                padding: 5px 8px;
            }
            .dropdown-wrapper .dropdown-select {
                width: 100% !important;
                min-width: 0 !important;
                max-width: 100% !important;
            }
            .dropdown-select {
                font-size: 11px;
                padding: 4px 20px 4px 6px;
                line-height: 1.4;
                border: 1px solid rgba(102, 126, 234, 0.3);
                border-radius: 8px;
                box-shadow: 0 2px 4px rgba(0,0,0,0.1);
                background: #ffffff;
                box-sizing: border-box;
            }
            .dropdown-select option {
                font-size: 9px;
                font-weight: 700;
                padding: 5px 8px;
                text-align: left;
                letter-spacing: 0.2px;
                color: #667eea;
                line-height: 1.3;
                border-bottom: 1px solid rgba(102, 126, 234, 0.15); /* Dünne Trennlinie wie Header-Dropdown */
            }
            .dropdown-label {
                font-size: 10px;
                margin-bottom: 2px;
                text-align: center;
                width: 100%;
                max-width: 180px;
            }
            .dropdowns-container {
                gap: 4px;
                padding: 4px;
            }
            .books-dropdown {
                font-size: 13px; /* Reduziert für kleinere Ansichten */
                padding: 8px 12px; /* Reduziertes Padding */
                max-width: 100%;
            }
            .books-dropdown option {
                font-size: 13px !important; /* Proportional kleiner als Dropdown-Feld (14px) */
                padding: 6px 8px !important; /* Angepasst an Dropdown-Textfeld */
                line-height: 1.3 !important;
                font-weight: 700 !important;
                font-family: 'JetBrains Mono', monospace !important;
            }
            .book-create-btn,
            .book-pdf-btn,
            .book-publish-btn,
            .book-delete-btn {
                font-size: 14px; /* Reduziert für kleinere Ansichten */
                padding: 8px 12px; /* Reduziertes Padding */
            }
            .books-dropdown-container {
                flex-wrap: wrap;
                gap: 8px; /* Reduzierter Gap */
                width: 100%;
                max-width: 100%;
            }
            .books-dropdown {
                width: 100% !important; /* Alle gleich breit */
                min-width: 100% !important;
                max-width: 100% !important;
                background: rgba(255, 255, 255, 0.8) !important; /* Dezenter weißer Hintergrund */
                border: 1px solid rgba(102, 126, 234, 0.15) !important; /* Dezente Linie */
            }
            .book-create-btn,
            .book-pdf-btn,
            .book-publish-btn,
            .book-delete-btn {
                width: 100% !important; /* Alle Buttons gleich breit */
            }
            /* Burger im Top-Menü: Maße nur in menueband.js (mobile @media), kein Extra-Schrumpfen hier */
            .back-button {
                top: 10px;
                left: 10px;
                padding: 10px 15px;
                font-size: 16px;
            }
            .gallery-grid {
                grid-template-columns: 1fr;
                gap: 10px;
            }
            .gallery-title {
                font-size: 32px;
                padding: 12px 20px;
            }
            .gallery-item-image-container {
                height: auto; /* Höhe wird durch JavaScript bestimmt */
                flex: 0 0 auto; /* Feste Höhe, wird durch JavaScript gesetzt */
                min-height: 200px !important; /* Mindesthöhe für Sichtbarkeit */
            }
            
            .gallery-item img {
                width: 100%;
                max-width: 100%;
                height: 100%; /* Füllt Container vollständig */
                object-fit: cover;
            }
            
            .gallery-item-timestamp {
                font-size: 9px; /* Etwas kleiner auf mobilen Geräten */
                padding: 3px 6px;
                bottom: 6px;
                left: 50%;
                transform: translateX(-50%); /* Zentriert horizontal */
            }
            .gallery-item {
                min-height: 0 !important; /* Keine Mindesthöhe, damit aspect-ratio respektiert wird */
                display: flex;
                align-items: stretch; /* Stretch für gleichmäßige Höhe */
                justify-content: flex-start;
                margin-left: 0 !important; /* Explizit kein seitliches Margin */
                margin-right: 0 !important; /* Explizit kein seitliches Margin */
                padding-left: 0 !important; /* Explizit kein seitliches Padding */
                padding-right: 0 !important; /* Explizit kein seitliches Padding */
            }
            .gallery-item-info {
                padding: 8px 0; /* Reduziert: 10px -> 8px */
            }
            /* Stelle sicher, dass gallery-edit-container die volle Breite behält */
            .gallery-edit-container {
                width: 100% !important;
                min-width: 0 !important;
                max-width: 100% !important;
                padding: 2px 0 !important; /* Kein seitliches Padding */
            }
            .gallery-edit-textarea {
                width: 100% !important;
                min-width: 0 !important;
                max-width: 100% !important;
            }
            .gallery-edit-buttons-container {
                width: 100% !important;
            }
            .vorlese-text {
                font-size: 11px; /* Reduziert: 14px -> 11px */
                padding: 8px; /* Reduziert: 12px -> 8px */
                margin: 2px 0 0 0; /* Reduziert: 3.75px -> 2px */
            }
            .gallery-play-button {
                font-size: 20px;
                padding: 15px 30px;
            }
        }
        /* Sehr kleine Screens: Menüband unten fixieren und Platz schaffen */
        /* Scroll-Indikator-Styles werden von menueband.js bereitgestellt */
        @media (max-width: 480px) {
            body {
                padding-bottom: 0;
            }
            /* Abstand zwischen den Haupt-Containern auf Mobile */
            .character-selection,
            .visual-selection,
            .drawing-area,
            .my-gallery {
                margin-bottom: 50px;
            }
            .character-selection {
                margin-bottom: 0; /* Kein Abstand zum visual-selection */
            }
            .visual-selection {
                margin-top: 0; /* Kein Abstand zum character-selection */
            }
            .books-dropdown-container {
                width: 100% !important;
                max-width: 100% !important;
            }
            .gallery-item {
                margin-left: 0 !important; /* Kein seitliches Margin auf Mobile */
                margin-right: 0 !important; /* Kein seitliches Margin auf Mobile */
                padding-left: 0 !important; /* Kein seitliches Padding auf Mobile */
                padding-right: 0 !important; /* Kein seitliches Padding auf Mobile */
                width: 100% !important; /* Volle Breite auf Mobile */
                max-width: 100% !important; /* Volle Breite auf Mobile */
            }
            .gallery-grid {
                width: 100% !important;
                max-width: 100% !important;
                margin-left: 0 !important;
                margin-right: 0 !important;
                padding-left: 0 !important;
                padding-right: 0 !important;
                box-sizing: border-box !important;
                overflow-x: visible !important; /* Sichtbar, damit Hover-Effekt seitlich nicht abgeschnitten wird */
            }
            .my-gallery {
                width: 100% !important;
                max-width: 100% !important;
                margin-left: 0 !important;
                margin-right: 0 !important;
                padding-left: 0 !important;
                padding-right: 0 !important;
                overflow-x: visible !important; /* Sichtbar, damit Hover-Effekt seitlich nicht abgeschnitten wird */
            }
            .books-dropdown {
                width: 100% !important; /* Alle gleich breit */
                min-width: 100% !important;
                max-width: 100% !important;
                font-size: 13px !important; /* Dezente Größe */
                padding: 8px 12px !important;
                padding-right: 30px;
                border: 1px solid rgba(102, 126, 234, 0.15) !important; /* Dezente Linie */
                background: rgba(255, 255, 255, 0.8) !important; /* Dezenter weißer Hintergrund */
                color: #667eea !important; /* Blauer Text */
                box-shadow: none !important; /* Keine 3D-Effekte */
            }
            .books-dropdown option {
                font-size: 10px !important; /* Angepasst an Dropdown-Textfeld */
                padding: 4px 6px !important; /* Angepasst an Dropdown-Textfeld */
                line-height: 1.2 !important;
                font-weight: 700 !important;
                font-family: 'JetBrains Mono', monospace !important;
            }
            .book-create-btn,
            .book-pdf-btn,
            .book-publish-btn,
            .book-delete-btn {
                font-size: 12px; /* Weitere Reduzierung */
                padding: 6px 10px; /* Weitere Reduzierung */
            }
            .dropdown-select {
                font-size: 11px;
                padding: 4px 20px 4px 6px;
                line-height: 1.4;
                width: 100%;
                min-width: 100%;
                max-width: 100%;
                box-sizing: border-box;
            }
            .dropdown-select option {
                font-size: 14px; /* Lesbare Größe */
                padding: 5px 8px;
                line-height: 1.4;
            }
            .dropdown-label {
                font-size: 10px;
                margin-bottom: 2px;
                max-width: 180px;
            }
            .dropdown-wrapper {
                width: 180px;
                min-width: 180px;
                max-width: 180px;
                padding: 5px 8px;
            }
            .dropdowns-container {
                gap: 4px;
                padding: 4px;
                flex-direction: column; /* Vertikale Anordnung */
                align-items: stretch;
            }
            .books-dropdown-container {
                gap: 6px; /* Weitere Reduzierung */
            }
        }
        
        /* Login Modal */
        /* Login- und Register-Modal CSS wird von login-register.js bereitgestellt */
    

/* Accessibility: Screen Reader Only */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}
