:root {
    --bg: #0b0f1a;
    --card-bg: rgba(23, 32, 53, 0.8);
    --accent: #00d2ff;
    --accent-glow: rgba(0, 210, 255, 0.3);
    --text: #ffffff;
    --text-dim: #94a3b8;
    --success: #10b981;
    --error: #f43f5e;
    --daily: #f59e0b;
}

/* 1. BASIS-LAYOUT */
body {
    font-family: 'Inter', system-ui, sans-serif;
    background: radial-gradient(circle at center, #1e293b 0%, #0b0f1a 100%);
    color: var(--text);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    overflow: hidden; /* Verhindert Scrollbars durch Partikel */
}

#particleCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 0;
}

#app {
    position: relative;
    z-index: 10;
}

.card {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    padding: 30px;
    border-radius: 28px;
    width: 360px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
    text-align: center;
}

/* 2. NAVIGATION & BUTTONS */
h1 { font-size: 2.2rem; letter-spacing: -1px; margin-bottom: 25px; }
h1 span { color: var(--accent); text-shadow: 0 0 15px var(--accent-glow); }

.main-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 20px;
}

.sub-actions {
    display: flex;
    gap: 8px;
    margin-top: 15px;
}

button {
    padding: 14px;
    border: none;
    border-radius: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: 0.2s;
    font-family: inherit;
}

.btn-primary { 
    background: linear-gradient(135deg, #00d2ff, #3a7bd5); 
    color: white; 
    width: 100%; 
}

.btn-daily {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
    width: 100%;
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.3);
}

.btn-daily small {
    display: block;
    font-size: 0.65rem;
    opacity: 0.9;
    font-weight: 400;
}

.btn-small { 
    flex: 1;
    padding: 10px 5px;
    font-size: 0.75rem; 
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-dim);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-secondary { background: rgba(255, 255, 255, 0.05); color: var(--text-dim); width: 100%; margin-top: 10px; }

/* 3. FORMULAR-ELEMENTE */
.form-group { text-align: left; margin-bottom: 15px; }
label { display: block; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 1.5px; color: var(--text-dim); margin-bottom: 8px; }

select, input {
    width: 100%; padding: 12px; border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(15, 23, 42, 0.8); color: white; font-size: 1rem;
    box-sizing: border-box;
}

.hidden { display: none !important; }

/* 4. GAME SCREEN */
#task { font-size: 3.5rem; font-weight: 800; margin: 25px 0; }
.input-wrapper { display: flex; gap: 8px; }
#btn-check { background: var(--success); color: white; width: 80px; }

#game-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
#timer-container { position: relative; width: 60px; height: 60px; }
#timer-text { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); font-weight: bold; font-size: 14px; }

#timer-ring {
    fill: none; stroke: var(--accent); stroke-width: 4; stroke-linecap: round;
    transform: rotate(-90deg); transform-origin: center;
    stroke-dasharray: 163.36; stroke-dashoffset: 0; transition: stroke-dashoffset 1s linear;
}
.timer-bg { fill: none; stroke: rgba(255,255,255,0.1); stroke-width: 4; }

.streak-fire {
    color: #ffaa00 !important;
    text-shadow: 0 0 10px #ff4400, 0 0 20px #ffaa00;
    transform: scale(1.2);
    transition: all 0.3s ease;
}

/* 5. LEVELS & STATS */
#levelGrid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 20px 0; }
.level-card { background: rgba(0,0,0,0.3); padding: 10px; border-radius: 15px; }
.xp-bar-bg { background: #000; height: 5px; border-radius: 10px; margin-top: 8px; overflow: hidden; }
.xp-bar-fill { background: var(--accent); height: 100%; transition: width 0.6s ease; }

#statsList { max-height: 250px; overflow-y: auto; margin: 15px 0; text-align: left; }
.stat-item { background: rgba(255,255,255,0.03); padding: 12px; border-radius: 12px; margin-bottom: 8px; font-size: 0.8rem; border-left: 3px solid var(--accent); }

/* 6. ACHIEVEMENTS & TOAST */
#achievementGrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; max-height: 300px; overflow-y: auto; padding: 10px; }
.ach-item { 
    background: rgba(0,0,0,0.2); aspect-ratio: 1; border-radius: 10px; 
    display: flex; align-items: center; justify-content: center; font-size: 1.5rem;
    filter: grayscale(1); opacity: 0.3; border: 1px solid transparent;
}
.ach-item.unlocked { filter: grayscale(0); opacity: 1; border-color: var(--accent); background: rgba(0, 210, 255, 0.1); }

#achievement-toast {
    position: fixed; top: 20px; left: 50%; transform: translateX(-50%);
    background: linear-gradient(135deg, #f59e0b, #d97706);
    padding: 15px 25px; border-radius: 15px; display: flex; align-items: center; gap: 15px;
    z-index: 1000; box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    animation: slideDown 0.5s ease forwards;
}
@keyframes slideDown { from { top: -100px; } to { top: 20px; } }

/* 7. SETTINGS & REPORTS */
#settings-trigger { position: fixed; top: 20px; right: 20px; font-size: 24px; cursor: pointer; z-index: 100; transition: 0.3s; }
#settings-trigger:hover { transform: rotate(90deg); }

.modal {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.85); backdrop-filter: blur(8px);
    display: flex; justify-content: center; align-items: center; z-index: 200;
}

.export-section { background: rgba(0,0,0,0.2); padding: 15px; border-radius: 15px; margin-bottom: 15px; }
.report-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-top: 10px; }
.btn-report { background: var(--accent); color: white; border-radius: 8px; padding: 8px; font-size: 0.8rem; }

.btn-danger { background: rgba(244, 63, 94, 0.1); color: var(--error); border: 1px solid var(--error); width: 100%; margin-top: 8px; }
.btn-danger:hover { background: var(--error); color: white; }

hr { border: 0; border-top: 1px solid rgba(255,255,255,0.1); margin: 15px 0; }

/* Level Icon Absetzen */
.lvl-icon { 
    font-size: 1.6rem; 
    display: block; 
    color: var(--accent); 
    margin-bottom: 5px; /* Abstand zum Text "Lvl X" */
}
.lvl-text { 
    font-size: 0.8rem; 
    font-weight: bold; 
    color: var(--text); 
}

/* Achievement Grid & Fortschritt */
#achievementGrid {
    display: grid; 
    grid-template-columns: repeat(3, 1fr); /* 3 Spalten wirken sauberer mit Text */
    gap: 15px;
    padding: 10px;
}

.ach-container {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.ach-item {
    width: 60px;
    height: 60px;
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    transition: 0.3s;
    background: rgba(0,0,0,0.3);
}

.ach-item.locked {
    filter: grayscale(1) brightness(0.5);
    border: 1px solid rgba(255,255,255,0.05);
}

.ach-item.unlocked {
    filter: none;
    border: 2px solid var(--accent);
    background: rgba(0, 210, 255, 0.1);
    box-shadow: 0 0 15px var(--accent-glow);
}

.ach-mini-progress {
    width: 100%;
    height: 4px;
    background: rgba(0,0,0,0.5);
    border-radius: 2px;
    margin: 5px 0;
    overflow: hidden;
}

.ach-mini-fill {
    height: 100%;
    background: var(--accent);
}

/* Daily Tag in der Statistik */
.daily-tag {
    background: var(--daily);
    color: #000;
    font-size: 0.6rem;
    padding: 2px 5px;
    border-radius: 4px;
    font-weight: 900;
    vertical-align: middle;
}

#count-progress-container {
    width: 100%;
    height: 10px;
    background: rgba(0,0,0,0.3);
    border-radius: 5px;
    margin-bottom: 20px;
    overflow: hidden;
    display: block; /* Sicherstellen, dass er nicht hidden bleibt */
}

#count-progress-fill {
    height: 100%;
    width: 0%;
    background: var(--accent);
    transition: width 0.3s ease;
    box-shadow: 0 0 10px var(--accent);
}

/* KATEGORIE ÜBERSICHT */
.category-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 18px;
    padding: 15px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: 0.3s;
    text-align: left;
}
.category-card:hover { background: rgba(255, 255, 255, 0.1); transform: translateY(-2px); }
.cat-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.cat-name { font-weight: bold; font-size: 1rem; color: var(--accent); }
.cat-stats { font-size: 0.7rem; color: var(--text-dim); }

/* Zurück-Button in den Details */
.btn-back-ach { 
    background: none; border: 1px solid var(--text-dim); color: var(--text-dim); 
    padding: 5px 10px; font-size: 0.7rem; margin-bottom: 15px; width: auto;
}