        :root {
            --bg-color: #323232;
            --card-bg: #646464;
            --primary: #780b0b;
            --success: #10b981;
            --text: #ffffff;
            --muted: #d0d0d0;
            --xp-bg: #444444;
            --xp-fill: #780b0b;
            --easy: #4caf50;
            --medium: #ff9800;
            --hard: #f44336;
            --border: #780b0b;
        }

        * { box-sizing: border-box; }

        body {
            font-family: 'Segoe UI', sans-serif;
            background-color: var(--bg-color);
            color: var(--text);
            margin: 0;
            padding: 0;
            display: flex;
            min-height: 100vh;
        }

        .app-shell { display: flex; width: 100%; }

/* SIDEBAR */
    .sidebar {
        width: 20%;
        min-width: 220px;
        max-width: 280px;
        background-color: #2a2a2a;
        border-right: 2px solid var(--border);
        padding: 16px;
        display: flex;
        flex-direction: column;
        gap: 12px;
    }
    .sidebar-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 12px;
    }
    .sidebar-title { font-size: 1.1rem; font-weight: 700; }

    /*BUNDLES IN SIDEBAR*/
    .sidebar-add-bundle {
        background: none;
        border: 1px solid var(--border);
        color: var(--text);
        border-radius: 6px;
        padding: 4px 8px;
        font-size: 0.8rem;
        cursor: pointer;
    }
    .bundle-list {
        flex: 1;
        overflow-y: auto;
        padding-right: 4px;
     }
    .bundle {
        margin-bottom: 8px;
        border-radius: 8px;
        background-color: #3a3a3a;
        border: 1px solid var(--border);
    }
    .bundle-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 8px 10px;
        cursor: pointer;
    }
    .bundle-header-left {
        display: flex;
        align-items: center;
        gap: 6px;
    }
    .bundle-toggle { font-size: 0.9rem; }
    .bundle-name { font-size: 0.9rem; font-weight: 600; }
    .bundle-actions { display: flex; gap: 6px; }
    .bundle-gear, .bundle-delete {
        font-size: 0.85rem;
        cursor: pointer;
    }
    .bundle-gear { color: var(--muted); }
    .bundle-delete { color: #ff6b6b; }

    /*ADD TASKS TO BUNDLES SIDEBAR*/
    .bundle-tasks {
        display: none;
        padding: 6px 10px 8px 10px;
        border-top: 1px solid var(--border);
    }
    .bundle.open .bundle-tasks { display: block; }
    .task-entry {
        padding: 6px 8px;
        margin-bottom: 4px;
        border-radius: 6px;
        background-color: #4a4a4a;
        border: 1px solid #555555;
        font-size: 0.85rem;
        cursor: pointer;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    .task-entry:hover { background-color: #555555; }
    .bundle-add-task {
        margin-top: 6px;
        padding: 6px 8px;
        border-radius: 6px;
        border: 1px dashed var(--border);
        background-color: #3a3a3a;
        font-size: 0.8rem;
        cursor: pointer;
        text-align: center;
    }
    .bundle-add-task:hover { background-color: #444444; }
/*MAIN PANEL*/
    .main-panel {
        width: 80%;
        padding: 20px;
        display: flex;
        flex-direction: column;
        gap: 16px;
    }
    .card {
        background: var(--card-bg);
        padding: 18px;
        border-radius: 12px;
        border: 1px solid var(--border);
        box-shadow: 0 4px 16px rgba(0,0,0,0.4);
    }
    h2 {
        margin-top: 0;
        color: #ffffff;
        font-size: 1.1rem;
    }
    /*INFO AND STATS*/
    .top-row {
        display: flex;
        gap: 16px;
        flex-wrap: wrap;
    }
    .mission-card { flex: 1; min-width: 320px; }
    /*LEVEL AND XP*/
    .level-row {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 8px;
        font-size: 0.9rem;
    }
    #level-display { font-weight: 700; }
    .xp-bar {
        width: 100%;
        height: 14px;
        background: var(--xp-bg);
        border-radius: 8px;
        overflow: hidden;
        margin-bottom: 8px;
    }
    #xp-fill {
        height: 100%;
        width: 0%;
        background: var(--xp-fill);
        transition: width 0.3s ease;
    }
    /*STATS*/
    .stats-row {
        display: flex;
        justify-content: space-between;
        font-size: 0.85rem;
        color: var(--muted);
        margin-bottom: 10px;
    }

    /*ACTIVE TASK*/
    #active-task-title {
        min-height: 32px;
        font-size: 1.2rem;
        font-weight: 700;
        color: var(--primary);
        margin-bottom: 4px;
    }
    #active-task-meta {
        min-height: 18px;
        font-size: 0.85rem;
        color: var(--muted);
        margin-bottom: 10px;
    }

    /*ROLL BUTTON*/
    #roll-btn { margin-bottom: 10px; }
    button {
        background-color: var(--primary);
        color: white;
        border: 1px solid var(--border);
        padding: 8px 14px;
        font-size: 0.9rem;
        font-weight: 600;
        border-radius: 8px;
        cursor: pointer;
        transition: all 0.2s ease;
    }
    button:hover { filter: brightness(1.1); }
    button:disabled {
        background-color: #555555;
        color: #aaaaaa;
        border-color: #555555;
        cursor: not-allowed;
    }

    /*DIFFICULTY BUTTONS*/
    .difficulty-buttons {
        display: flex;
        gap: 8px;
        margin: 8px 0 12px 0;
    }
    .difficulty-btn {
        flex: 1;
        border-radius: 8px;
        padding: 8px;
        color: white;
        font-size: 0.85rem;
        font-weight: 600;
        cursor: pointer;
        border: 1px solid #333333;
    }
    .difficulty-btn span {
        display: block;
        font-size: 0.75rem;
        font-weight: 500;
        margin-top: 2px;
    }
    .difficulty-easy { background-color: var(--easy); }
    .difficulty-medium { background-color: var(--medium); }
    .difficulty-hard { background-color: var(--hard); }

    /*START BUTTON*/
    .single-start-btn { margin-top: 8px; }

    /*TIMER*/
    .timer {
        font-size: 3rem;
        font-weight: 800;
        color: var(--primary);
        margin: 12px 0;
        text-align: center;
    }
   .timer-controls {
        display: flex;
        gap: 8px;
        margin-top: 8px;
    }
    .timer-controls button { width: 50%; }

    /*UPLOAD BUTTON*/
    .upload-box { margin-top: 12px; }
    .upload-box p {
        margin: 0 0 6px 0;
        font-size: 0.85rem;
        font-weight: 600;
    }
    input [type="file"] {
        font-size: 0.8rem;
        color: var(--muted);
    }

    /*MOTIVATION*/
    .motivation-banner {
        background-color: #3f6b3f;
        color: #e8ffe8;
        padding: 10px;
        border-radius: 8px;
        margin-top: 12px;
        font-weight: 600;
        display: none;
        border: 1px solid #4caf50;
    }

/*GALLERY*/
    .gallery-grid {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
        gap: 12px;
    }
    .gallery-item {
        border-radius: 10px;
        overflow: hidden;
        background: #555555;
        border: 1px solid var(--border);
        box-shadow: 0 2px 8px rgba(0,0,0,0.5);
        cursor: pointer;
        transition: transform 0.15s ease;
    }
    .gallery-item:hover { transform: scale(1.02); }
    .gallery-item img {
        width: 100%;
        height: 140px;
        object-fit: cover;
        display: block;
    }
    .gallery-item video {
        width: 100%;
        height: 140px;
        object-fit: cover;
        display: block;
    }
    .gallery-thumb {
        width: 100%;
        height: 140px;
        object-fit: cover;
        display: block;
    }
    .gallery-meta {
        padding: 8px 10px;
    }
    .gallery-meta strong {
        display: block;
        font-size: 0.9rem;
        font-weight: 700;
        color: #ffffff;
        margin-bottom: 2px;
    }
    .gallery-meta small {
        display: block;
        font-size: 0.75rem;
        color: var(--muted);
    }

/*ACTIVE EFFECTS*/
.effects-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.effect-item {
    background: #4a4a4a;
    border: 1px solid var(--border);
    padding: 10px 12px;
    border-radius: 8px;
    color: var(--text);
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

.effect-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 4px;
}

.effect-meta {
    font-size: 0.8rem;
    color: var(--muted);
}


/*IMAGE VIEWER*/
    .image-viewer {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0,0,0,0.85);
        display: none;
        justify-content: center;
        align-items: center;
        z-index: 999;
    }
    .image-viewer img {
        max-width: 90%;
        max-height: 90%;
        border-radius: 12px;
        border: 2px solid var(--border);
        cursor: pointer;
    }
    .close-viewer {
        position: absolute;
        top: 20px;
        right: 30px;
        font-size: 2rem;
        color: white;
        cursor: pointer;
    }
    .roulette-anim {
        animation: flash 0.15s ease infinite;
    }
    @keyframes flash {
        0% { color: var(--primary); }
        50% { color: #ff9800; }
        100% { color: #4caf50; }
    }

/*MODAL*/
    .modal-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.7);
        display: none;
        justify-content: center;
        align-items: center;
        z-index: 1000;
    }
    .modal {
        width: 420px;
        max-width: 90%;
        background: var(--card-bg);
        border-radius: 12px;
        border: 2px solid var(--border);
        box-shadow: 0 0 18px rgba(120,11,11,0.6);
        padding: 16px 18px;
        color: var(--text);
        position: relative;
    }
    .modal-title {
        font-size: 1rem;
        font-weight: 700;
        margin-bottom: 8px;
    }
    .modal-close {
        position: absolute;
        top: 10px;
        right: 12px;
        font-size: 1.2rem;
        cursor: pointer;
        color: var(--muted);
    }
    .modal-body { margin-top: 8px; }
    .modal-row { margin-bottom: 8px; }
    .modal-row label {
        display: block;
        font-size: 0.8rem;
        margin-bottom: 2px;
    }
    .modal-row input, .modal-row select, .modal-row textarea {
        width: 100%;
        padding: 6px 8px;
        border-radius: 6px;
        border: 1px solid var(--border);
        background-color: #4a4a4a;
        color: var(--text);
        font-size: 0.85rem;
    }
    .modal-row input::placeholder,
    .modal-row textarea::placeholder {
        color: #cccccc;
    }
    .modal-toggle-row {
        font-size: 0.8rem;
        margin: 6px 0;
    }
    .modal-toggle-row label { margin-right: 8px; }
    .modal-duration-row {
        display: flex;
        gap: 4px;
        margin-bottom: 4px;
    }
    .modal-duration-row input {
        width: 60px;
        text-align: center;
    }
    .modal-footer {
        display: flex;
        justify-content: flex-end;
        gap: 8px;
        margin-top: 10px;
    }
    .btn-secondary { background-color: #555555; border-color: #777777; }
    .btn-danger { background-color: #b00020; border-color: #b00020; }

    @media (max-width: 900px) {
        .sidebar { display: none; }
        .main-panel { width: 100%; }
    }

    .contract-day {
    width: 30px;
    height: 30px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.contract-day.success {
    background: #4CAF50;
    color: white;
}

.contract-day.fail {
    background: #E53935;
    color: white;
}
.contract-days-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, 30px);
    gap: 6px;
    margin-top: 10px;
}

.contract-day {
    width: 30px;
    height: 30px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
}

.contract-day.success {
    background: #4CAF50;
    color: white;
}

.contract-day.fail {
    background: #E53935;
    color: white;
}

.freeze-box {
    background: #42c3f2;
    border: 1px solid #42c3f2;
    padding: 10px;
    border-radius: 6px;
    margin-bottom: 10px;
}
.contract-progress-wrapper {
    margin: 15px 0;
}

.contract-progress-bar {
    width: 100%;
    height: 14px;
    background: #ddd;
    border-radius: 8px;
    overflow: hidden;
}

#contract-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #4CAF50, #66BB6A);
    transition: width 0.4s ease;
}

.contract-progress-label {
    margin-top: 6px;
    font-size: 14px;
    text-align: center;
    opacity: 0.8;
}
.contract-progress-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, 30px);
    gap: 6px;
    margin: 15px 0;
}

.contract-progress-square {
    width: 30px;
    height: 30px;
    border-radius: 6px;
    background: #ccc;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
    color: white;
    opacity: 0.9;
}

.contract-progress-square.success {
    background: #4CAF50;
}

.contract-progress-square.fail {
    background: #E53935;
}

.contract-progress-square.future {
    background: #9e9e9e;
    opacity: 0.5;
}

.reward-shop {
    margin-top: 30px;
    padding: 20px;
    background: #222;
    border-radius: 12px;
    color: white;
}

.reward-points-display {
    font-size: 20px;
    margin-bottom: 15px;
    font-weight: bold;
}

.reward-items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 15px;
}

.reward-item {
    background: #333;
    padding: 15px;
    border-radius: 10px;
    text-align: center;
    transition: 0.2s;
}

.reward-item:hover {
    background: #3d3d3d;
}

.reward-item-icon {
    font-size: 40px;
    margin-bottom: 10px;
}

.reward-item-name {
    font-size: 16px;
    margin-bottom: 6px;
}

.reward-item-cost {
    font-size: 14px;
    opacity: 0.8;
    margin-bottom: 10px;
}

.reward-item button {
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    background: #4CAF50;
    color: white;
    cursor: pointer;
    transition: 0.2s;
}

.reward-item button:hover {
    background: #45a049;
}
