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

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

        .app-container {
            display: flex;
            height: 100vh;
            width: 100vw;
        }

        /* Linkes Menü */
        .sidebar {
            width: 320px;
            min-width: 320px;
            background: rgba(20, 20, 20, 0.95);
            backdrop-filter: blur(20px);
            border-right: 1px solid rgba(255,255,255,0.1);
            display: flex;
            flex-direction: column;
            overflow-y: auto;
            box-shadow: 2px 0 20px rgba(0,0,0,0.5);
        }

        .sidebar-header {
            padding: 20px;
            border-bottom: 1px solid rgba(255,255,255,0.1);
            background: rgba(10, 10, 10, 0.9);
        }

        .sidebar-header h1 {
            font-size: 1.8rem;
            color: #fff;
            text-align: center;
            margin: 0;
        }

        .sidebar-content {
            flex: 1;
            padding: 20px;
            display: flex;
            flex-direction: column;
            gap: 20px;
        }

        /* Canvas-Bereich */
        .canvas-area {
            flex: 1;
            display: flex;
            flex-direction: column;
            padding: 20px;
            background: rgba(255, 255, 255, 0.98);
            backdrop-filter: blur(10px);
        }

        .canvas-container {
            flex: 1;
            display: flex;
            justify-content: center;
            align-items: center;
            position: relative;
        }

        #drawCanvas {
            border: 3px solid #333;
            border-radius: 15px;
            cursor: crosshair;
            background: white;
            box-shadow: 0 8px 40px rgba(0,0,0,0.2);
            max-width: calc(100% - 40px);
            max-height: calc(100% - 40px);
            touch-action: none; /* Wichtig für iPad Touch-Ereignisse */
        }

        /* Werkzeuge */
        .tools-section {
            background: rgba(249, 249, 249, 0.9);
            border-radius: 12px;
            padding: 15px;
            border: 1px solid rgba(0,0,0,0.1);
        }

        .tools-section h3 {
            font-size: 1.1rem;
            margin-bottom: 15px;
            color: #333;
            text-align: center;
        }

        .tool-group {
            display: flex;
            flex-direction: column;
            gap: 8px;
            margin-bottom: 15px;
        }

        .tool-row {
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .tool-row label {
            font-size: 14px;
            font-weight: 600;
            min-width: 60px;
            color: #333;
        }

        .tool-buttons {
            display: flex;
            gap: 8px;
        }

        button {
            padding: 10px 16px;
            border: 1px solid #ddd;
            border-radius: 8px;
            background: white;
            cursor: pointer;
            font-size: 13px;
            font-weight: 600;
            transition: all 0.2s;
            white-space: nowrap;
            flex: 1;
            color: #333;
        }

        button:hover:not(:disabled) {
            background: #f8f9fa;
            transform: translateY(-1px);
            box-shadow: 0 2px 8px rgba(0,0,0,0.1);
        }

        button:disabled {
            opacity: 0.5;
            cursor: not-allowed;
        }

        .btn-active {
            background: #007AFF !important;
            color: white !important;
            border-color: #0056b3;
        }

        .btn-primary {
            background: #34C759;
            color: white;
            border-color: #28a745;
        }

        .btn-danger {
            background: #FF3B30;
            color: white;
            border-color: #dc3545;
        }

        .btn-upload {
            background: #FF9500;
            color: white;
            border-color: #e68900;
        }

        .btn-camera {
            background: #007AFF;
            color: white;
            border-color: #0056b3;
        }

        .camera-upload-buttons {
            display: flex;
            flex-direction: column;
            gap: 8px;
            margin-bottom: 10px;
        }

        .camera-upload-buttons button {
            width: 100%;
        }

        /* Frames-Bereich */
        .frames-section {
            background: rgba(249, 249, 249, 0.9);
            border-radius: 12px;
            padding: 15px;
            border: 1px solid rgba(0,0,0,0.1);
            max-height: 300px;
            display: flex;
            flex-direction: column;
        }

        .frames-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 15px;
        }

        .frames-header h3 {
            font-size: 1.1rem;
            color: #333;
        }

        .frames-list {
            display: flex;
            gap: 8px;
            overflow-x: auto;
            padding: 5px 0;
            min-height: 70px;
        }

        .frame-item {
            position: relative;
            min-width: 60px;
            width: 60px;
            height: 45px;
            border: 2px solid #ddd;
            border-radius: 6px;
            cursor: grab;
            background: white;
            overflow: hidden;
            transition: all 0.2s;
            flex-shrink: 0;
        }

        .frame-item:active {
            cursor: grabbing;
        }

        .frame-item.dragging {
            opacity: 0.5;
            cursor: grabbing;
        }

        .frame-item:hover {
            border-color: #007AFF;
            transform: scale(1.05);
        }

        .frame-item.active {
            border-color: #34C759;
            border-width: 3px;
            box-shadow: 0 0 8px rgba(52, 199, 89, 0.4);
        }

        .frame-item img {
            width: 100%;
            height: 100%;
            object-fit: contain;
        }

        .frame-number {
            position: absolute;
            top: -8px;
            right: -8px;
            background: #333;
            color: white;
            border-radius: 50%;
            width: 18px;
            height: 18px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 10px;
            border: 2px solid white;
        }

        /* Upload-Bereich */
        .upload-section {
            background: rgba(40, 40, 40, 0.9);
            border: 2px dashed #555;
            border-radius: 12px;
            padding: 20px;
            text-align: center;
            transition: all 0.2s;
        }

        .upload-section:hover {
            border-color: #34C759;
            background: rgba(52, 199, 89, 0.1);
        }

        .upload-section.dragover {
            border-color: #34C759;
            background: rgba(52, 199, 89, 0.2);
        }

        .upload-section h3 {
            font-size: 1.1rem;
            margin-bottom: 10px;
            color: #fff;
        }

        .upload-section p {
            font-size: 14px;
            color: #ccc;
            margin-bottom: 15px;
        }

        #fileInput {
            display: none;
        }

        /* Video-Bereich */
        .video-section {
            background: rgba(249, 249, 249, 0.9);
            border-radius: 12px;
            padding: 20px;
            text-align: center;
            border: 1px solid rgba(0,0,0,0.1);
        }

        .video-section h3 {
            font-size: 1.1rem;
            margin-bottom: 15px;
            color: #333;
        }

        .controls {
            margin: 15px 0;
            display: flex;
            flex-direction: column;
            gap: 12px;
        }

        .control-group {
            display: flex;
            flex-direction: column;
            gap: 5px;
        }

        .control-group label {
            font-size: 14px;
            font-weight: 600;
            color: #333;
        }

        .progress-bar {
            width: 100%;
            height: 8px;
            background: #f0f0f0;
            border-radius: 4px;
            overflow: hidden;
            margin: 10px 0;
        }

        .progress-fill {
            height: 100%;
            background: linear-gradient(90deg, #34C759, #28a745);
            width: 0%;
            transition: width 0.3s ease;
        }

        .result {
            background: white;
            border: 2px solid #34C759;
            border-radius: 12px;
            padding: 15px;
            margin-top: 15px;
            text-align: left;
            font-size: 13px;
        }

        .result h4 {
            color: #34C759;
            margin-bottom: 10px;
            text-align: center;
            font-size: 14px;
        }

        .compression-info {
            background: rgba(0, 122, 255, 0.1);
            border-left: 3px solid #007AFF;
            padding: 10px;
            margin: 10px 0;
            border-radius: 4px;
            font-size: 12px;
        }

        /* Responsive für kleinere iPads und Tablets */
        @media (max-width: 1024px) and (orientation: portrait) {
            .sidebar {
                width: 280px;
                min-width: 280px;
            }
            
            .sidebar-content {
                gap: 15px;
                padding: 15px;
            }
        }

        /* Mobile Geräte - Stack Layout */
        @media (max-width: 768px) {
            .app-container {
                flex-direction: column;
                height: 100vh;
            }
            
            .sidebar {
                width: 100%;
                min-width: auto;
                height: auto;
                max-height: 40vh;
                border-right: none;
                border-bottom: 1px solid rgba(0,0,0,0.1);
            }
            
            .sidebar-header h1 {
                font-size: 1.5rem;
            }
            
            .sidebar-content {
                gap: 10px;
                padding: 15px;
            }
            
            .canvas-area {
                padding: 15px;
            }
            
            .frames-section {
                max-height: 150px;
            }
        }

        /* Scrollbar Styling */
        .frames-list::-webkit-scrollbar,
        .sidebar::-webkit-scrollbar {
            height: 6px;
            width: 6px;
        }

        .frames-list::-webkit-scrollbar-track,
        .sidebar::-webkit-scrollbar-track {
            background: #333;
            border-radius: 3px;
        }

        .frames-list::-webkit-scrollbar-thumb,
        .sidebar::-webkit-scrollbar-thumb {
            background: #666;
            border-radius: 3px;
        }

        .frames-list::-webkit-scrollbar-thumb:hover,
        .sidebar::-webkit-scrollbar-thumb:hover {
            background: #888;
        }

        /* Lizenz-Info */
        .license-info {
            padding: 15px;
            text-align: center;
            font-size: 11px;
            color: #888;
            border-top: 1px solid rgba(255,255,255,0.1);
            margin-top: 20px;
        }

        .license-info a {
            color: #007AFF;
            text-decoration: none;
        }

        .license-info a:hover {
            text-decoration: underline;
        }

        /* Welcome Popup */
        .popup-overlay {
            position: fixed;
            top: 0;
            left: 0;
            width: 100vw;
            height: 100vh;
            background: rgba(0, 0, 0, 0.8);
            backdrop-filter: blur(10px);
            display: flex;
            justify-content: center;
            align-items: center;
            z-index: 1000;
            animation: fadeIn 0.3s ease;
        }

        .popup-content {
            background: rgba(40, 40, 40, 0.95);
            border-radius: 20px;
            padding: 30px;
            max-width: 500px;
            width: 90vw;
            max-height: 80vh;
            overflow-y: auto;
            border: 2px solid rgba(255,255,255,0.1);
            box-shadow: 0 20px 60px rgba(0,0,0,0.5);
            color: #fff;
            text-align: center;
        }

        .popup-content h2 {
            color: #fff;
            margin-bottom: 20px;
            font-size: 1.8rem;
        }

        .features-grid {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 15px;
            margin: 20px 0;
            text-align: left;
        }

        .feature-item {
            background: rgba(60, 60, 60, 0.5);
            padding: 15px;
            border-radius: 10px;
            border: 1px solid rgba(255,255,255,0.1);
        }

        .feature-item h4 {
            color: #007AFF;
            margin-bottom: 8px;
            font-size: 14px;
        }

        .feature-item p {
            font-size: 12px;
            color: #ccc;
            margin: 0;
            line-height: 1.4;
        }

        .popup-buttons {
            display: flex;
            gap: 15px;
            margin-top: 25px;
            justify-content: center;
        }

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

        .popup-btn-primary {
            background: #007AFF;
            color: white;
        }

        .popup-btn-secondary {
            background: #666;
            color: white;
        }

        .popup-btn:hover {
            transform: translateY(-2px);
            box-shadow: 0 4px 15px rgba(0,122,255,0.3);
        }

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

        @media (max-width: 768px) {
            .features-grid {
                grid-template-columns: 1fr;
                gap: 10px;
            }
            
            .popup-content {
                padding: 20px;
                margin: 20px;
            }
            
            .popup-buttons {
                flex-direction: column;
            }
        }

        /* Loading Spinner */
        .loading-spinner {
            border: 2px solid #f3f3f3;
            border-top: 2px solid #007AFF;
            border-radius: 50%;
            width: 16px;
            height: 16px;
            animation: spin 1s linear infinite;
            display: inline-block;
            margin-right: 8px;
        }

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