body { margin: 0; background-color: #1e1e1e; font-family: 'Segoe UI', sans-serif; user-select: none; color: white; overflow: hidden; }

/* Standardgröße definieren */
:root {
    --swatch-size: 36px;
}

/* --- GALERIE STYLES --- */
#gallery-screen { 
    position: absolute; top:0; left:0; width:100%; height:100%; 
    background: #1e1e1e; z-index: 100; 
    display: flex; flex-direction: column; align-items: center; 
    padding: 20px; box-sizing: border-box; overflow-y: auto;
}

.gallery-header { text-align: center; margin-bottom: 30px; }
.total-time-display { font-size: 1.2em; color: #aaa; margin-top: 5px; }

.gallery-grid {
    display: flex; flex-wrap: wrap; gap: 20px; justify-content: center; max-width: 1200px; margin-bottom: 40px;
}

/* Auflösungs-Anzeige */
.res-tag {
    color: #888;
    font-size: 14px;
    font-family: monospace; /* Technische Schriftart */
    background: rgba(0,0,0,0.3);
    padding: 4px 8px;
    border-radius: 4px;
    margin-left: 15px;
    border: 1px solid #444;
}

.level-card {
    background: #2a2a2a; border-radius: 8px; overflow: hidden;
    width: 200px; cursor: pointer; transition: transform 0.2s, box-shadow 0.2s;
    border: 2px solid #444; position: relative;
}
.level-card:hover { transform: translateY(-5px); box-shadow: 0 10px 20px rgba(0,0,0,0.5); border-color: #fff; }

.card-thumb { width: 100%; height: 200px; object-fit: contain; background: #000; image-rendering: pixelated; }
.card-info { padding: 10px; text-align: center; }
.card-title { font-weight: bold; margin-bottom: 5px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.progress-container { background: #444; height: 10px; border-radius: 5px; overflow: hidden; width: 100%; margin-bottom: 5px; }
.progress-bar { height: 100%; background: #2a6; width: 0%; transition: width 0.5s; }
.card-stats { display: flex; justify-content: space-between; font-size: 0.8em; color: #aaa; }
.card-done-badge { position: absolute; top: 10px; right: 10px; background: #2a6; color: #fff; padding: 2px 8px; border-radius: 10px; font-size: 0.8em; font-weight: bold; display: none; box-shadow: 0 2px 5px black; }

/* Backup Controls */
.backup-controls { display: flex; gap: 10px; margin-top: 20px; padding: 15px; background: #333; border-radius: 8px; }

/* --- GAME UI STYLES --- */
#game-ui { display: none; position: absolute; top: 0; left: 0; width: 100%; height: 100vh; pointer-events: none; }

.top-bar { pointer-events: auto; background: rgba(0,0,0,0.9); padding: 8px 15px; position: absolute; top: 10px; left: 10px; border-radius: 8px; display: flex; gap: 15px; align-items: center; box-shadow: 0 4px 10px rgba(0,0,0,0.5); }

button { background: #444; color: white; border: 1px solid #666; padding: 5px 15px; cursor: pointer; border-radius: 4px; font-size: 14px; }
button:hover { background: #666; }
button.back-btn { background: #333; border-color: #555; }
button.danger { background: #722; border-color: #a44; font-size: 0.8em; padding: 2px 8px; }
button.action { background: #26a; border-color: #48c; }

.toggle-switch { display: flex; align-items: center; gap: 5px; font-size: 0.9em; cursor: pointer; }
.toggle-switch input { accent-color: #2a6; width: 16px; height: 16px; cursor: pointer; }

#palette-container { pointer-events: auto; position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%); background: rgba(0,0,0,0.95); padding: 10px; border-radius: 8px; display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; box-shadow: 0 4px 15px rgba(0,0,0,0.6); max-height: 25vh; overflow-y: auto; max-width: 95%; transition: width 0.3s; }

.swatch { width: var(--swatch-size); height: var(--swatch-size); border: 2px solid #555; cursor: pointer; border-radius: 4px; position: relative; box-sizing: border-box; flex-shrink: 0; transition: transform 0.2s, width 0.2s, opacity 0.2s; }
.swatch.active { border-color: white; transform: scale(1.15); box-shadow: 0 0 10px white; z-index: 3; }
/* Neue Logik: display none wenn fertig */
.swatch.done { display: none; } 

.swatch-num { position: absolute; top: -6px; left: -6px; font-size: 10px; background: #333; color: #fff; padding: 1px 4px; border-radius: 4px; font-weight: bold; border: 1px solid #777; z-index: 4; }
.swatch-count { position: absolute; bottom: 0; right: 0; font-size: 9px; background: rgba(0,0,0,0.7); color: white; padding: 1px 3px; border-top-left-radius: 3px; pointer-events: none; }

#number-input-overlay { position: absolute; bottom: 140px; right: 50px; background: rgba(0, 0, 0, 0.9); color: white; padding: 10px 30px; border-radius: 10px; font-size: 3em; font-weight: bold; border: 2px solid white; display: none; z-index: 200; box-shadow: 0 0 20px rgba(0,0,0,0.8); }

canvas { display: block; cursor: default; }

/* Wird angewendet, wenn die Karte die zusätzliche Klasse 'golden-complete' hat */
.level-card.golden-complete {
    border: 3px solid #FFD700; /* Goldener Rahmen */
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.6); /* Goldener Leuchteffekt */
}

/* Der Pokal (Unicode Icon) */
.trophy-icon {
    position: absolute;
    top: 0px;
    left: 5px;
    font-size: 4em;
    z-index: 10;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.7)); /* Schatten für 3D Effekt */
    display: none; /* Standardmäßig versteckt */
    pointer-events: none; /* Klicks gehen durch den Pokal auf die Karte */
    transform: rotate(-40deg);
}

/* Zeige den Pokal NUR an, wenn die Karte den goldenen Status hat */
.level-card.golden-complete .trophy-icon {
    display: block;
    animation: trophyPop 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275); /* Kleine Animation beim Laden */
}

/* Optional: Das alte "FERTIG" Badge auch golden machen */
.golden-complete .card-done-badge {
    background: #FFD700;
    color: #000;
    box-shadow: 0 2px 10px rgba(255, 215, 0, 0.5);
}

.golden-bar { background-color: gold; }

/* Kleine Animation für den Pokal */
@keyframes trophyPop {
    0% { transform: scale(0) rotate(0deg); }
    100% { transform: scale(1) rotate(-40deg); }
}

/* Prestige Badge (Anzahl der Lösungen) */
.prestige-badge {
    position: absolute;
    top: 25px;
    right: 8px;
    /* Schöner blauer Verlauf (Cyan zu Dunkelblau) */
    background: linear-gradient(45deg, #00c6ff, #0072ff); 
    color: white; /* Weiße Schrift für besseren Kontrast */
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 1.2em;
    font-weight: bold;
    box-shadow: 0 2px 5px rgba(0,0,0,0.5);
    border: 1px solid #fff;
    z-index: 5;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5); /* Kleine Schattierung für den Text */
    transform: rotate(30deg);
}

/* Verstecke den normalen Reset Button, wenn wir fertig sind (wird per JS gesteuert) */
.hidden { display: none !important; }

/* Prestige Button Style */
button.prestige-btn {
    background: linear-gradient(to bottom, #FFD700, #DAA520);
    color: black;
    font-weight: bold;
    border: 1px solid #fff;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.4);
    animation: pulse 2s infinite;
}
@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(255, 215, 0, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(255, 215, 0, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 215, 0, 0); }
}

/* Roter Hintergrund bei ungültiger Nummer */
#number-input-overlay.invalid {
    background: rgba(200, 0, 0, 0.9);
    border-color: #faa;
}

/* --- KATEGORIE / AKKORDEON STYLES --- */
.category-section {
    width: 100%;
    max-width: 1200px;
    margin-bottom: 20px;
}

.category-header {
    background-color: #333;
    color: white;
    padding: 15px 20px;
    cursor: pointer;
    border-radius: 8px;
    font-size: 1.2em;
    font-weight: bold;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid #555;
    transition: background 0.2s;
    user-select: none;
}
.category-header:hover { background-color: #444; border-color: #888; }

.category-content {
    padding: 20px 0;
    display: flex; /* Standard: Sichtbar */
    flex-wrap: wrap;
    gap: 20px;
    justify-content: center;
    animation: fadeIn 0.3s ease-in-out;
}

/* Klasse zum Verstecken */
.category-content.collapsed {
    display: none;
}

.arrow-icon { transition: transform 0.3s; }
.collapsed .category-header .arrow-icon { transform: rotate(-90deg); } /* Funktioniert so nicht direkt, wir drehen per JS Klasse am Header */

.cat-closed .arrow-icon { transform: rotate(-90deg); }

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

/* Delete Button auf der Karte */
.delete-btn {
    position: absolute;
    top: 5px;
    left: 5px;
    background: rgba(200, 0, 0, 0.8);
    color: white;
    border: 1px solid #f55;
    border-radius: 4px;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 20; /* Über dem Bild liegen */
    font-size: 16px;
    transition: background 0.2s;
}
.delete-btn:hover {
    background: red;
    transform: scale(1.1);
}
