* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}

:root {
                        --header-bg: #7ba0abff;
                        --header-border: #D1D3D4;
                        --header-shadow: #80A1BA;
                        --header-text: #F0BB78;
                        
                        --panel-bg: #86B0BD;
                        --panel-border: #7ba0abff;

                        --task-bg: #7ba0abff;
                        --task-border: #D1D3D4;
                        
                        --button-primary-bg: #F0BB78;
                        --button-primary-border: #E2A16F;
                        --button-primary-text: #1B3C53;
                        --button-primary-shadow: #d9a862;
                        
                        --progress-fill: #d1a465ff;
                        --progress-border: #b38b53ff;
                        
                        --stat-value: #e5c79dff;
                        
                        --roadmap-bg: #86B0BD;
                        --roadmap-border: #D1D3D4;
                        --roadmap-shadow: #80A1BA;
                        
                        --stage-title-color: #f8f5f0;
                        --stage-progress-color: #f8f5f0;
                        --stage-label-color: #F0BB78;
                        --task-title-color: #EEEFE0;
                        --task-completed-color: #b8d4c0;

                        --progress-completed: #d1a465ff;
                        --progress-completed-border: #b38b53ff;

                        --task-completed-bg: #5686a1ff;
                        --task-completed-border: #93BFCF;
                        --task-daily-bg: #93BFCF;
                        --task-daily-border: #5686a1ff;
}

/* ///////////////////////theme style started//////////////////////////////// */
body {
    font-family: 'Press Start 2P', 'Courier New', monospace;
    background: #FFF0DD;
    color: var(--text-color);
    min-height: 100vh;
    line-height: 1.6;
    /* background-image: 
        linear-gradient(#83b488 1px, transparent 1px),
        linear-gradient(90deg, #83b488 1px, transparent 1px);
    background-size: 20px 20px; */
}

.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 15px;
}

.hidden {
    display: none !important;
}

/* ===== THEME-SPECIFIC BACKGROUNDS & COLORS ===== */

/* Default Theme */
body.theme-default {
    background: #FFF0DD;
    /* animation: waterFlow 15s infinite ease-in-out; */
}

/* Cafe Theme */
body.theme-cafe {
    background: linear-gradient(135deg, #8B4513 0%, #A0522D 50%, #D2691E 100%);
    background-image: 
        radial-gradient(circle at 50% 50%, rgba(210, 105, 30, 0.4) 0%, transparent 70%);
    background-size: 400px 400px;
    animation: cafePulse 15s infinite ease-in-out;
}

/* Forest Theme */
body.theme-forest {
    background: linear-gradient(135deg, #1b4332 0%, #2d6a4f 50%, #71d492 100%);
    background-image:
        radial-gradient(circle at 50% 50%, rgba(45, 106, 79, 0.3) 0%, transparent 70%);
    background-size: 400px 400px;
    animation: forestPulse 15s infinite ease-in-out;
}

/* Pond Theme */
body.theme-pond {
    background: linear-gradient(135deg, #1e3a5f 0%, #2a4b8d 50%, #4facfe 100%);
    background-image: 
        radial-gradient(circle at 50% 50%, rgba(79, 172, 254, 0.4) 0%, transparent 70%);
    background-size: 400px 400px;
    animation: pondPulse 15s infinite ease-in-out;
}

/* Sunset Theme */
body.theme-sunset {
    background: linear-gradient(135deg, #6a0572 0%, #8a2be2 50%, #fa709a 100%);
    background-image: 
        radial-gradient(circle at 50% 50%, rgba(250, 112, 154, 0.3) 0%, transparent 70%);
    background-size: 400px 400px;
    animation: sunsetPulse 15s infinite ease-in-out;
}

/* Space Theme */
body.theme-space {
    background: linear-gradient(135deg, #0d1b2a 0%, #1b263b 50%, #415a77 100%);
    background-image: 
        radial-gradient(circle at 50% 50%, rgba(138, 137, 137, 0.3) 0%, transparent 70%);
    background-size: 400px 400px;
    animation: starTwinkle 15s infinite ease-in-out;
}

/* Beach Theme */
body.theme-beach {
    background: linear-gradient(135deg, #4FC3F7 0%, #81D4FA 50%, #efe583 100%);
    background-image: 
        url("data:image/svg+xml,%3Csvg width='150' height='100' viewBox='0 0 150 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M0,50 Q37.5,30 75,50 T150,50 L150,100 L0,100 Z' fill='%2381D4FA' opacity='0.2'/%3E%3C/svg%3E");
    background-size: 150px 100px;
    animation: waveMotion 12s infinite linear;
}

/* Library Theme */
body.theme-library {
    background: linear-gradient(135deg, #5D4037 0%, #795548 50%, #BCAAA4 100%);
    background-image: 
        url("data:image/svg+xml,%3Csvg width='80' height='120' viewBox='0 0 80 120' xmlns='http://www.w3.org/2000/svg'%3E%3Crect x='5' y='10' width='15' height='100' fill='%23795548' opacity='0.2'/%3E%3Crect x='25' y='20' width='15' height='90' fill='%235D4037' opacity='0.2'/%3E%3C/svg%3E");
    background-size: 80px 120px;
}

/* ===== BACKGROUND ANIMATIONS ===== */
@keyframes cafePulse {
    0%, 100% { background-size: 400px 400px; opacity: 0.8; }
    50% { background-size: 450px 450px; opacity: 1; }
}

@keyframes forestPulse {
    0%, 100% { background-size: 400px 400px; opacity: 0.8; }
    50% { background-size: 450px 450px; opacity: 1; }
}

@keyframes pondPulse {
    0%, 100% { background-size: 400px 400px; opacity: 0.8; }
    50% { background-size: 450px 450px; opacity: 1; }
}

@keyframes sunsetPulse {
    0%, 100% { background-size: 400px 400px; opacity: 0.8; }
    50% { background-size: 450px 450px; opacity: 1; }
}

@keyframes starTwinkle {
    0%, 100% { background-size: 400px 400px; opacity: 0.8; }
    50% { background-size: 450px 450px; opacity: 1; }
}

@keyframes waveMotion {
    0% { background-position: 0 0; }
    100% { background-position: 150px 0; }
}

@keyframes waterFlow {
    0%, 100% {
        background-position: 
            0% 0%,
            100% 100%,
            50% 50%;
    }
    25% {
        background-position: 
            25% 10%,
            75% 90%,
            60% 40%;
    }
    50% {
        background-position: 
            50% 0%,
            50% 100%,
            40% 60%;
    }
    75% {
        background-position: 
            75% 10%,
            25% 90%,
            60% 40%;
    }
}

/* ===== THEME PREVIEW STYLES ===== */
.theme-preview {
    position: relative;
    background: #FFF0DD;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    min-height: 100px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.theme-preview:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.preview-content {
    position: relative;
    z-index: 2;
    text-align: center;
}

.preview-icon {
    font-size: 2.5rem;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
    z-index: 3;
    position: relative;
}

.preview-title {
    font-size: 0.9rem;
    opacity: 0.9;
    font-weight: 600;
    margin-top: 0.5rem;
    z-index: 3;
    position: relative;
}

/* Theme-specific preview gradients */
.theme-default .theme-preview { 
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); 
    animation: previewGlow 4s infinite ease-in-out;
}
.theme-cafe .theme-preview { 
    background: linear-gradient(135deg, #a46437c4 0%, #D2691E 50%, #F4A460 100%); 
    animation: previewSteam 6s infinite ease-in-out;
}
.theme-pond .theme-preview { 
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 50%, #6be493 100%); 
    animation: previewRipple 5s infinite ease-in-out;
}
.theme-forest .theme-preview { 
    background: linear-gradient(135deg, #77b88d 0%, #38f9d7 50%, #4facfe 100%); 
    animation: previewRustle 7s infinite ease-in-out;
}
.theme-sunset .theme-preview { 
    background: linear-gradient(135deg, #fa709a 0%, #e6d157 100%); 
    animation: previewPulse 4s infinite ease-in-out;
}
.theme-space .theme-preview { 
    background: linear-gradient(135deg, #0c0c0c 0%, #1a237e 50%, #311b92 100%); 
    animation: previewTwinkle 3s infinite ease-in-out;
}
.theme-beach .theme-preview { 
    background: linear-gradient(135deg, #4FC3F7 0%, #81D4FA 50%, #FFF176 100%); 
    animation: previewWaves 6s infinite ease-in-out;
}
.theme-library .theme-preview { 
    background: linear-gradient(135deg, #5D4037 0%, #795548 50%, #BCAAA4 100%); 
    animation: previewPages 10s infinite ease-in-out;
}
/* Preview-specific animations */
@keyframes previewGlow {
    0%, 100% { filter: brightness(1); }
    50% { filter: brightness(1.1); }
}

@keyframes previewSteam {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

@keyframes previewRipple {
    0%, 100% { opacity: 0.9; }
    50% { opacity: 1; }
}

@keyframes previewRustle {
    0%, 100% { transform: rotate(0deg); }
    50% { transform: rotate(0.5deg); }
}

@keyframes previewPulse {
    0%, 100% { filter: saturate(1); }
    50% { filter: saturate(1.3); }
}

@keyframes previewTwinkle {
    0%, 100% { filter: brightness(1); }
    50% { filter: brightness(1.4); }
}

@keyframes previewMist {
    0%, 100% { opacity: 0.9; }
    50% { opacity: 1; }
}

@keyframes previewWaves {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-2px); }
}

@keyframes previewPages {
    0%, 100% { filter: contrast(1); }
    50% { filter: contrast(1.1); }
}

/* ///////////////////////theme style ended//////////////////////////////// */

/* Header Styles */
.header {
    background: var(--header-bg);
    border: 4px solid var(--header-border);
    border-radius: 0;
    padding: 20px;
    margin-bottom: 25px;
    box-shadow: 6px 6px 0px var(--header-shadow);
    position: relative;
}

.header::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: -4px;
    right: -4px;
    height: 8px;
    background: var(--header-border);
    border: 2px solid var(--header-border);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.header h1 {
    font-size: 1.8em;
    font-weight: bold;
    color: var(--header-text);
    text-shadow: 3px 3px 0px 0px;
    letter-spacing: 1px;
}

/* Quest Header */
.quest-header {
    text-align: center;
    margin-bottom: 30px;
}

.quest-header h2 {
    font-size: 1.5em;
    margin-bottom: 15px;
    color: var(--header-text);
    text-shadow: 2px 2px 0px 0px;
    font-weight: bold;
}

.quest-creation-panel h2 
{
    font-size: 1.2em;
    margin-bottom: 15px;
    color: var(--header-text);
    text-shadow: 2px 2px 0px 0px;
    font-weight: bold;
}

.quest-title-section {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 15px;
}

.quest-title-section h2 {
    margin: 0;
    flex: 1;
    font-size: 1.3em;
    color: var(--header-text);
}

.quest-controls {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* ===== STATS & PROGRESS ===== */
/* Player Stats */
.player-stats, .player-journey-stats, .quest-days {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

.player-journey-stats {
    margin-top: 15px;
}

.stat {
    text-align: center;
    background: var(--panel-bg);
    border: 3px solid var(--header-text);
    padding: 12px 15px;
    border-radius: 0;
    min-width: 90px;
}

.stat-label {
    display: block;
    font-size: 0.9em;
    font-weight: bold;
    color: #EEEFE0;
    margin-bottom: 8px;
}

.stat-value {
    display: block;
    font-size: 1.2em;
    font-weight: bold;
    color: var(--stat-value);
}

/* Progress Bars */
.progress-bar {
    width: 100%;
    height: 16px;
    background: var(--header-border);
    border: 2px solid var(--panel-border);
    border-radius: 0;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--progress-fill);
    border: 2px solid var(--progress-border);
    transition: width 0.5s ease;
    width: 0%;
}

.overall-progress {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-top: 12px;
}

.overall-progress .progress-bar {
    flex: 1;
}

/* ===== PIXEL BUTTONS ===== */
.btn {
    font-family: 'Press Start 2P', monospace;
    padding: 12px 20px;
    border: 3px solid;
    border-radius: 0;
    font-size: 0.8em;
    cursor: pointer;
    transition: all 0.1s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    position: relative;
    image-rendering: pixelated;
}

.btn:hover {
    transform: translate(2px, 2px);
}

.btn:active {
    transform: translate(4px, 4px);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.btn:disabled:hover {
    transform: none !important;
}

/* Button Variants - Improved Contrast */
.btn-primary {
    background: var(--button-primary-bg);
    border-color: var(--button-primary-border);
    color: var(--button-primary-text);
    box-shadow: 4px 4px 0px var(--button-primary-shadow);
}

.btn-success {
    background: var(--header-bg);
    border-color: var(--header-border);
    color: #f8f5f0;
    box-shadow: 4px 4px 0px var(--header-shadow);
}

.btn-outline {
    background: var(--button-primary-bg);
    border-color: color-mix(in srgb, var(--button-primary-border) 70%, rgb(118, 118, 118));
    color: var(--button-primary-text);
}

.btn-danger {
    background: #F08787;
    border-color: #d67979;
    color: #f8f5f0;
    box-shadow: 4px 4px 0px #d67979;
}

.btn-warning {
    background: #a7c957;
    border-color: #97b947;
    color: #2c5530;
    box-shadow: 4px 4px 0px #97b947;
}

.btn-info {
    background: #8db580;
    border-color: #7da472;
    color: #2c5530;
    box-shadow: 4px 4px 0px #7da472;
}

.btn-sm {
    padding: 8px 12px;
    font-size: 0.7em;
}

/* ===== FORM ELEMENTS ===== */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 10px;
    font-weight: bold;
    color: var(--stage-label-color);
    font-size: 1em;
}

.form-group input {
    width: 100%;
    padding: 12px 15px;
    border: 3px solid var(--header-text);
    border-radius: 0;
    font-size: 0.9em;
    font-family: 'Press Start 2P', monospace;
    background: var(--panel-bg);
    color: var(--stage-title-color);
    transition: all 0.3s ease;
}

.form-group input:focus {
    outline: none;
    box-shadow: 0 0 0 2px #e9b872;
    background: var(--panel-bg);
}

/* ===== STAGES & TASKS ===== */
/* Stage Containers */
.stages-container, .edit-stages-container {
    margin: 25px 0;
}

.all-stages-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Stage Elements */
.stage, .stage-section, .edit-stage {
    background: var(--panel-bg);
    border: 3px solid var(--panel-border);
    border-radius: 0;
    padding: 20px;
    margin-bottom: 15px;
    transition: all 0.3s ease;
    position: relative;
}

.stage:hover, .stage-section:hover {
    border-color: #e9b872;
    transform: translateY(-2px);
}

.stage-section.completed {
    background: var(--panel-bg);
    border-color: var(--panel-border);
}

.stage-section.ready-to-complete {
    background: var(--task-ready-bg);
    border-color: var(--task-ready-border);
    animation: pixelGlow 2s infinite;
}

@keyframes pixelGlow {
    0%, 100% { box-shadow: 0 0 5px var(--task-ready-border); }
    50% { box-shadow: 0 0 15px var(--task-ready-border), 0 0 20px var(--task-ready-border); }
}

/* Stage Headers */
.stage-header, .edit-stage-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 10px;
}

.stage-title, .edit-stage-title {
    font-size: 1.1em;
    font-weight: bold;
    border: none;
    background: transparent;
    padding: 8px 0;
    flex: 1;
    color: var(--stage-title-color);
    font-family: 'Press Start 2P', monospace;
    border-bottom: 2px solid transparent;
}

.stage-title:focus, .edit-stage-title:focus {
    outline: none;
    border-bottom: 2px solid #e9b872;
}

.stage-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.stage-progress {
    display: flex;
    align-items: center;
    font-weight: normal;
    color: var(--stage-progress-color);
    font-size: 0.7em;
}

/* Task Containers */
.steps-container, .edit-tasks-container {
    margin-left: 15px;
}

.stage-tasks-grid, .stage-tasks {
    display: grid;
    gap: 8px;
}

.edit-daily-badge {
    margin-left: 8px;
    background: #e9b872;
    color: #2c5530;
    padding: 4px 8px;
    border: 2px solid #d9a862;
    font-size: 0.6em;
    font-weight: bold;
}

.edit-task {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    padding: 10px;
    background: var(--panel-bg);
    border: 2px solid var(--panel-border);
    border-radius: 0;
}

.edit-task-title {
    flex: 1;
    padding: 8px 10px;
    border: 2px solid #e9b872;
    border-radius: 0;
    background: #5d8c66;
    color: #f8f5f0;
    font-family: 'Press Start 2P', monospace;
    font-size: 0.7em;
}

/* Task Elements */
.step, .edit-task {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    margin-bottom: 8px;
    background: var(--panel-bg);
    border: 2px solid var(--panel-border);
    border-radius: 0;
}

.stage-task {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: var(--panel-bg);
    border: 3px solid var(--panel-border);
    border-radius: 0;
    transition: all 0.3s ease;
    flex-wrap: wrap;
    gap: 10px;
}

.stage-task:hover {
    border-color: #e9b872;
    transform: translateX(4px);
}

/* Task States */
.stage-task.completed {
    background: var(--progress-fill);
    border-color: var(--progress-border);
}

.stage-task.completed .task-title {
    text-decoration: line-through;
    color: var(--task-completed-color);
}

.stage-task.daily {
    background: var(--task-daily-bg);
    border-color: var(--task-daily-border);
}

.daily-toggle-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.daily-toggle-btn:disabled:hover {
    transform: none;
    box-shadow: none;
}

/* Task Content */
.task-content {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    flex-wrap: wrap;
}

.stage-task, .step, .edit-task {
    background: var(--task-bg);
    border: 2px solid var(--task-border);
    border-radius: 0;
}

.step-title, .edit-task-title, .task-title {
    border: none;
    background: transparent;
    padding: 6px 0;
    flex: 1;
    color: var(--task-title-color);
    font-family: 'Press Start 2P', monospace;
    font-size: 0.9em;
}

.step-title:focus, .edit-task-title:focus {
    outline: none;
    border-bottom: 2px solid #e9b872;
}

.task-title {
    font-size: 0.9em;
}

/* Pixel Checkboxes */
.task-checkbox, .level-checkbox {
    appearance: none;
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    background: var(--roadmap-bg);
    border: 2px solid var(--panel-border);
    border-radius: 0;
    cursor: pointer;
    position: relative;
}

.task-checkbox:checked, .level-checkbox:checked {
    background: var(--button-primary-bg);
    border-color: var(--button-primary-border);
}

.task-checkbox:checked::after, .level-checkbox:checked::after {
    content: '✓';
    position: absolute;
    color: #f8f5f0;
    font-size: 12px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.task-checkbox:disabled, .level-checkbox:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

/* Task Info */
.task-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.task-xp, .level-xp {
    font-weight: bold;
    color: #2c5530;
    background: #e9b872;
    border: 2px solid #d9a862;
    border-radius: 0;
    font-size: 0.7em;
    padding: 4px 8px;
}

/* Level Up Popup Styles */
.level-up-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 2000;
    background: var(--panel-bg);
    border: 4px solid var(--panel-border);
    padding: 2rem;
    border-radius: 12px;
    text-align: center;
    max-width: 350px;
    width: 90%;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    animation: pixelPopInLevel 0.5s ease;
}

.level-up-content h3 {
    color: var(--header-text);
    margin-bottom: 1rem;
    font-size: 1.2em;
}

.level-up-content p {
    color: var(--task-title-color);
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

.level-number {
    color: var(--progress-fill);
    font-weight: bold;
    font-size: 1.3em;
    text-shadow: 2px 2px 0px 0px;
}


@keyframes pixelPopInLevel {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.8);
    }
    100% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

.daily-badge {
    background: #e9b872;
    color: #2c5530;
    padding: 4px 8px;
    border: 2px solid #d9a862;
    border-radius: 0;
    font-size: 0.8em;
    font-weight: bold;
}

.ready-badge {
    background: #a7c957;
    color: #2c5530;
    padding: 4px 8px;
    border: 2px solid #97b947;
    border-radius: 0;
    font-size: 0.8em;
    font-weight: bold;
    margin-left: 8px;
}

/* ===== PIXEL ROADMAP ===== */
.roadmap-container {
    position: relative;
    margin: 30px 0;
    padding: 20px;
    background: var(--roadmap-bg);
    border: 4px solid var(--roadmap-border);
    box-shadow: 6px 6px 0px var(--roadmap-shadow);
    border-radius: 8px;
}

.roadmap {
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 140px;
}

.roadmap-stops {
    display: flex;
    justify-content: space-around;
    align-items: center;
    flex: 1;
    position: relative;
    z-index: 2;
    margin: 0 40px; /* Add margin for start/end points */
}

.roadmap-stop {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    position: relative;
    z-index: 3;
    flex: 1;
    max-width: 140px;
    min-width: 100px;
}

/* Stop Marker */
.stop-marker {
    position: relative;
    width: 60px;
    height: 60px;
    border: 3px solid var(--button-primary-border);
    background: var(--button-primary-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
    transition: all 0.3s ease;
    border-radius: 8px;
    box-shadow: 3px 3px 0px var(--button-primary-shadow);
}

.stop-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    width: 100%;
    min-height: 50px;
    gap: 4px;
}

.stop-marker .marker-icon {
    font-size: 1.4em;
    filter: drop-shadow(1px 1px 1px rgba(0,0,0,0.3));
}

.stop-label h4 {
    margin: 0 0 4px 0;
    font-size: 0.9em;
    font-weight: 600;
    color: var(--stage-title-color);
    line-height: 1.2;
    text-align: center;
    width: 100%;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.stop-label p {
    margin: 0;
    font-size: 0.75em;
    color: var(--stage-progress-color);
    font-weight: 500;
    line-height: 1.3;
    min-height: 1.5em;
}

/* Start Journey Icon States */
.roadmap-stop.start-point.active .stop-marker {
    border-color: var(--button-primary-border);
    background: var(--button-primary-bg);
    transform: scale(1);
    box-shadow: 4px 4px 0px var(--button-primary-shadow);
    animation: pulse 2s infinite;
}

.roadmap-stop.start-point.completed .stop-marker {
    border-color: var(--progress-completed-border);
    background: var(--progress-completed);
    transform: scale(1);
    box-shadow: 3px 3px 0px var(--progress-completed-border);
}

.roadmap-stop.destination-point.active .stop-marker {
    border-color: var(--button-primary-border);
    background: var(--button-primary-bg);
    transform: scale(1);
    box-shadow: 4px 4px 0px var(--button-primary-shadow);
    animation: pulse 2s infinite;
}

.roadmap-stop.destination-point.completed .stop-marker {
    border-color: var(--progress-completed-border);
    background: var(--progress-completed);
    transform: scale(1);
    box-shadow: 3px 3px 0px var(--progress-completed-border);
}

/* Stop States */
.roadmap-stop.active .stop-marker {
    border-color: var(--button-primary-border);
    background: var(--button-primary-bg);
    transform: scale(1);
    box-shadow: 4px 4px 0px var(--button-primary-shadow);
    animation: pulse 2s infinite;
}

.roadmap-stop.completed .stop-marker {
    border-color: var(--progress-completed-border);
    background: var(--progress-completed);
    transform: scale(1);
    box-shadow: 3px 3px 0px var(--progress-completed-border);
}

.roadmap-stop.inactive .stop-marker {
    /* border-color: var(--header-border); */
    background: var(--header-bg);
    opacity: 1;
    transform: scale(1);
}

.completion-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: var(--progress-completed);
    color: var(--button-primary-text);
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: none;
    font-size: 0.7em;
    font-weight: bold;
    border: 2px solid var(--progress-completed-border);
    align-items: center;
    justify-content: center;
    box-shadow: 2px 2px 0px var(--progress-completed-border);
}


.roadmap-stop.completed .completion-badge {
    display: flex;
}

/* Road Path */
.road-path {
    position: absolute;
    top: 30px;
    left: 40px;  /* Start after start point */
    right: 40px; /* End before destination */
    height: 12px;
    background: var(--panel-bg);
    border: 3px solid var(--progress-border);
    border-radius: 6px;
    z-index: 1;
    box-shadow: inset 2px 2px 4px rgba(0,0,0,0.1);
}

.road-progress {
    height: 100%;
    background: linear-gradient(90deg, var(--progress-fill), var(--button-primary-bg));
    width: 0%;
    transition: width 0.8s ease;
    position: relative;
    border-radius: 3px;
}

.road-progress::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: shimmer 2s infinite;
}

/* Progress Traveler */
.progress-traveler {
    position: absolute;
    top: 18px;
    /* left: 0%; */
    transform: translateX(-50%);
    z-index: 4;
    transition: left 1.2s cubic-bezier(0.4, 0, 0.2, 1);
    filter: drop-shadow(3px 3px 0px rgba(0,0,0,0.2));
    pointer-events: auto; /* Ensure tooltip works */
}

.traveler-icon {
    font-size: 2em;
    animation: pixelBounce 2s infinite;
    filter: drop-shadow(2px 2px 0px var(--button-primary-shadow));
    display: block; /* Ensure proper positioning */
}

.traveler-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--button-primary-bg);
    color: var(--button-primary-text);
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 0.8em;
    font-weight: 600;
    white-space: nowrap;
    margin-bottom: 8px;
    border: 2px solid var(--button-primary-border);
    box-shadow: 2px 2px 0px var(--button-primary-shadow);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 5;
    pointer-events: none; /* Don't interfere with hover */
}

.traveler-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: var(--button-primary-border);
}

.progress-traveler:hover .traveler-tooltip {
    opacity: 1;
}

/* Animations */
@keyframes pulse {
    0%, 100% { transform: scale(1.1); }
    50% { transform: scale(1.15); }
}

@keyframes pixelBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

/* @keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
} */

/* Progress percentage styling */
.stage-progress-text {
    font-weight: 700;
    font-size: 0.8em;
    text-align: center;
    background: var(--button-primary-bg);
    color: var(--button-primary-text);
    padding: 2px 6px;
    border-radius: 3px;
    margin-top: 2px;
    border: 1px solid var(--button-primary-border);
    box-shadow: 1px 1px 0px var(--button-primary-shadow);
    /* Responsive width based on number of stops */
    width: 80%;
    max-width: 60px;
    min-width: 30px;
    margin-left: auto;
    margin-right: auto;
    display: block;
    /* Ensure text fits within the container */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.roadmap-stop.completed .stage-progress-text {
    background: var(--progress-completed);
    border-color: var(--progress-completed-border);
}

/* Ensure proper spacing for multiple stages */
.roadmap-stop:not(:last-child)::after {
    content: '';
    position: absolute;
    top: 30px;
    right: -50%;
    width: 100%;
    height: 2px;
    z-index: 1;
}

/* Responsive Design */
@media (max-width: 768px) {
    .roadmap-container {
        margin: 20px 0;
        padding: 15px;
    }
    
    .roadmap-stops {
        margin: 0 20px;
    }
    
    .roadmap-stop {
        max-width: 80px;
        min-width: 60px;
    }
    
    .stop-marker {
        width: 45px;
        height: 45px;
    }
    
    .stop-label h4 {
        font-size: 0.8em;
    }
    
    .stop-label p {
        font-size: 0.7em;
    }
    
    .road-path {
        left: 20px;
        right: 20px;
        top: 22px;
    }
    
    .progress-traveler {
        top: 15px;
    }
    
    .traveler-icon {
        font-size: 1.6em;
    }
}

/* ===== PROGRESS INDICATORS ===== */
.stage-details-panel h3 {
    color: var(--stage-label-color);
    font-size: 1.4em;
    font-weight: 600;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--panel-border);
}

.stage-progress-overview {
    background: var(--task-bg);
    border: 2px solid var(--task-border);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1.5rem;
}

.stage-progress-overview .progress-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-weight: normal;
    color: var(--stage-progress-color);
    font-size: 0.8em;
}

.stage-progress-overview .progress-bar {
    height: 16px;
    background: var(--roadmap-bg);
    border: 1px solid var(--roadmap-border);
}

.stage-progress-overview .progress-fill {
    background: var(--progress-fill);
    border: 1px solid var(--progress-border);
}

/* Individual Stage Progress Bars */
.stage-progress-bar {
    margin: 12px 0;
}

.stage-progress-bar .progress-bar {
    height: 10px;
    background: var(--roadmap-bg);
    border: 1px solid var(--roadmap-border);
}

.stage-progress-bar .progress-fill {
    background: var(--progress-fill);
    border: 1px solid var(--progress-border);
}

.stage-section.completed .stage-progress-bar .progress-fill {
    background: var(--progress-completed);
    border: 1px solid var(--progress-completed-border);
}

/* ===== PIXEL MODALS ===== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.modal-content {
    background: var(--panel-bg);
    padding: 25px;
    border: 4px solid var(--panel-border);
    max-width: 400px;
    width: 90%;
    text-align: center;
    box-shadow: 8px 8px 0px var(--roadmap-border);
    position: relative;
}

.modal-content.large {
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-content::before {
    content: '';
    position: absolute;
    top: -8px;
    left: -8px;
    right: 8px;
    bottom: 8px;
    background: var(--roadmap-border);
    z-index: -1;
}

.modal-content h3 {
    margin-bottom: 15px;
    color: var(--progress-completed-border);
    font-size: 1em;
}

.modal-content p {
    margin-bottom: 20px;
    color: #f8f5f0;
    line-height: 1.5;
    font-size: 0.8em;
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

/* ===== PIXEL CELEBRATION & COMPLETION MESSAGES ===== */
.celebration, .stage-complete-message, .reset-message {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.celebration-content, .stage-complete-message .message-content, .reset-message-content {
    background: var(--panel-bg);
    border: 4px solid var(--panel-border);
    padding: 30px;
    text-align: center;
    max-width: 500px;
    width: 90%;
    animation: pixelPopIn 0.5s ease;
    box-shadow: 8px 8px 0px var(--roadmap-border);
    position: relative;
}

/* Celebration Specific Styles */
.celebration h1 {
    font-size: 1.8em;
    margin-bottom: 20px;
    color: var(--progress-completed-border);
    text-shadow: 3px 3px 0px 0px;
    letter-spacing: 1px;
}

.celebration p {
    font-size: 1em;
    margin-bottom: 25px;
    color: #f8f5f0;
    line-height: 1.5;
}

#newLevel {
    color: var(--progress-completed);
    font-weight: bold;
    font-size: 1.2em;
    text-shadow: 2px 2px 0px 0px;
}

/* Stage Complete Message */
.stage-complete-message .message-content h3 {
    font-size: 1.5em;
    margin-bottom: 15px;
    color: var(--progress-completed-border);
    text-shadow: 2px 2px 0px 0px;
}

.stage-complete-message .message-content p {
    font-size: 0.9em;
    margin-bottom: 15px;
    color: #f8f5f0;
    line-height: 1.5;
}

.auto-complete-note {
    font-size: 0.8em;
    color: #e9b872;
    font-style: italic;
    margin: 15px 0;
    /* background: rgba(233, 184, 114, 0.1); */
    padding: 10px;
    border: 2px solid #e9b872;
}

/* Quest Complete Celebration */
.quest-complete-message {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;
    background: rgba(0, 0, 0, 0.7); /* Semi-transparent overlay */
}

.quest-complete-message .message-content {
    background: var(--panel-bg);
    padding: 2rem;
    border-radius: 12px;
    text-align: center;
    max-width: 400px;
    border: 4px solid var(--panel-border);
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.quest-complete-message h3 {
    color: var(--header-text);
    margin-bottom: 1rem;
    font-size: 1.3em;
}

.quest-complete-message p {
    color: var(--task-title-color);
    margin-bottom: 1rem;
    line-height: 1.5;
}

.completion-note {
    color: var(--stage-label-color);
    font-style: italic;
    font-size: 0.9em;
}

/* Special celebration for quest completion */
.quest-complete-celebration .celebration-content {
    border-color: #a7c957;
    background: #4a7c59;
}

.quest-complete-celebration .celebration-content::before {
    background: #3a6b47;
}

.quest-complete-celebration h1 {
    color: #a7c957;
    text-shadow: 3px 3px 0px #3a6b47;
    font-size: 2em;
}

.quest-complete-celebration p {
    color: #f8f5f0;
    font-weight: normal;
}

/* Close Buttons in Popups */
.celebration-content .btn,
.stage-complete-message .message-content .btn,
.reset-message-content .btn {
    margin-top: 15px;
    font-size: 0.8em;
    padding: 12px 24px;
}

/* ===== THEME SELECTOR MODAL ===== */
.theme-selector-modal .modal-content {
    background: var(--panel-bg);
    border: 4px solid var(--panel-border);
}

.theme-selector-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin: 20px 0;
}

.theme-option {
    background: var(--task-bg);
    border: 3px solid var(--task-border);
    border-radius: 8px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.theme-option:hover {
    transform: translateY(-2px);
    border-color: var(--header-text);
}

.theme-option.active {
    border-color: var(--progress-fill);
    box-shadow: 0 0 0 2px var(--progress-fill);
}

.theme-option.locked {
    opacity: 0.6;
    cursor: not-allowed;
}

.theme-preview-container {
    position: relative;
    margin-bottom: 10px;
}

.lock-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
}

.active-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: var(--progress-fill);
    color: var(--button-primary-text);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.7em;
    font-weight: bold;
}

.theme-info {
    text-align: center;
}

.theme-name {
    font-weight: bold;
    margin-bottom: 5px;
    color: var(--stage-title-color);
}

.theme-status {
    color: var(--progress-fill);
    font-size: 0.8em;
}

.theme-condition {
    color: var(--stage-progress-color);
    font-size: 0.7em;
    opacity: 0.8;
}

/* Confetti for Celebrations */
@keyframes confettiFall {
    0% { 
        transform: translateY(-100px) rotate(0deg) translateX(0); 
        opacity: 1;
    }
    100% { 
        transform: translateY(100vh) rotate(360deg) translateX(20px); 
        opacity: 0;
    }
}

.confetti {
    position: fixed;
    width: 12px;
    height: 12px;
    background: #e9b872;
    animation: confettiFall 3s linear forwards;
    z-index: 1001;
}

.confetti:nth-child(2n) {
    background: #6a994e;
}

.confetti:nth-child(3n) {
    background: #a7c957;
}

.confetti:nth-child(4n) {
    background: #8db580;
}

.confetti:nth-child(5n) {
    background: #bc4749;
}

/* Achievement Unlock Popup */
.achievement-unlock-popup {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #4a7c59;
    border: 4px solid #e9b872;
    padding: 20px;
    border-radius: 0;
    box-shadow: 6px 6px 0px #3a6b47;
    z-index: 1002;
    animation: slideInRight 0.5s ease;
    max-width: 300px;
}

.achievement-unlock-popup::before {
    content: '';
    position: absolute;
    top: -8px;
    left: -8px;
    right: 8px;
    bottom: 8px;
    background: #3a6b47;
    z-index: -1;
}

.achievement-unlock-popup h4 {
    color: #e9b872;
    margin-bottom: 8px;
    font-size: 0.9em;
}

.achievement-unlock-popup p {
    color: #f8f5f0;
    font-size: 0.7em;
    margin-bottom: 5px;
}

.achievement-unlock-popup .xp-reward {
    color: #e9b872;
    font-weight: bold;
    font-size: 0.8em;
}

@keyframes slideInRight {
    0% { transform: translateX(100%); opacity: 0; }
    100% { transform: translateX(0); opacity: 1; }
}

@keyframes slideOutRight {
    0% { transform: translateX(0); opacity: 1; }
    100% { transform: translateX(100%); opacity: 0; }
}

/* Edit Success Message */
.edit-success-message {
    position: fixed;
    font-size: 0.8em;
    top: 20px;
    right: 20px;
    background: #6ccc61ff;
    border: 4px solid #5A9E7C;
    color: var(--button-primary-text);
    padding: 12px 20px;
    border-radius: 8px;
    z-index: 2003;
    animation: slideInRight 0.5s ease;
}

/* Toast Messages */
.toast-message {
    position: fixed;
    font-size: 0.8em;
    top: 20px;
    right: 20px;
    background: #6ccc61ff;
    border: 4px solid #5A9E7C;
    color: var(--button-primary-text);
    padding: 12px 20px;
    border-radius: 8px;
    z-index: 2003;
    animation: slideInRight 0.5s ease;
}

.toast-info {
    border-color: #5A9E7C;
    color: var(--button-primary-text);
}

.toast-success {
    border-color:  #5A9E7C;
    color: var(--button-primary-text);
}

.toast-warning {
    border-color: var(--button-primary-bg);
    color: var(--button-primary-text);
}

/* Pixel animations for celebrations */
@keyframes pixelPopIn {
    0% { 
        transform: scale(0.8) translateY(-20px); 
        opacity: 0; 
    }
    50% { 
        transform: scale(1.05) translateY(5px); 
    }
    100% { 
        transform: scale(1) translateY(0); 
        opacity: 1; 
    }
}

@keyframes pixelBounceCelebration {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-8px); }
    60% { transform: translateY(-4px); }
}

.celebration-content, .stage-complete-message .message-content {
    animation: pixelPopIn 0.6s ease;
}

.celebration-content h1 {
    animation: pixelBounceCelebration 2s infinite;
}

.liquid-ether-container {
  position: relative;
  overflow: hidden;
  width: 100%;
  height: 100%;
  touch-action: none;
}


/* ===== FIREBASE STYLES ===== */
.firebase-loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(74, 124, 89, 0.95);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    border: 4px solid #e9b872;
}

.firebase-loading.hidden {
    display: none;
}

.loading-spinner {
    font-size: 2em;
    margin-bottom: 15px;
    animation: pixelSpin 1s linear infinite;
}

@keyframes pixelSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.user-info {
    margin-left: 15px;
}

.user-id {
    font-size: 0.7em;
    color: #d1e0d7;
    background: #3a6b47;
    padding: 4px 8px;
    border: 2px solid #2c5530;
    border-radius: 0;
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 768px) {
    .app-container {
        padding: 10px;
    }
    
    .header-content {
        flex-direction: column;
        gap: 15px;
        text-align: left;
    }
    
    .player-stats, .player-journey-stats, .quest-days {
        gap: 10px;
    }
    
    .stat {
        min-width: 80px;
        padding: 8px 10px;
    }
    
    .quest-title-section {
        flex-direction: column;
        gap: 12px;
        text-align: left;
        color: var(--text-color);
    }
    
    .quest-controls {
        flex-direction: column;
        width: 100%;
    }
    
    .stage-header, .edit-stage-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .stage-actions {
        width: 100%;
        justify-content: space-between;
    }
    
    .stage-task {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        background: var(--progress-fill);
    }
    
    .task-content {
        width: 100%;
    }
    
    .task-info {
        width: 100%;
        justify-content: space-between;
    }
    
    .achievements-grid {
        grid-template-columns: 1fr;
    }
    
    .modal-actions {
        flex-direction: column;
    }
    
    /* Roadmap Mobile */
    .roadmap {
        flex-direction: column;
        min-height: auto;
        gap: 20px;
    }
    
    .roadmap-stops {
        flex-direction: column;
        gap: 25px;
        width: 100%;
    }
    
    .roadmap-stop {
        max-width: none;
        width: 100%;
    }
    
    .road-path {
        display: none;
    }
    
    .progress-traveler {
        display: none;
    }
    
    /* Celebration messages mobile */
    .celebration-content, 
    .stage-complete-message .message-content, 
    .reset-message-content {
        padding: 20px;
        margin: 10px;
    }
    
    .celebration h1 {
        font-size: 1.5em;
    }
    
    .stage-complete-message .message-content h3 {
        font-size: 1.3em;
    }
}

/* Pixel Scrollbar */
::-webkit-scrollbar {
    width: 12px;
}

::-webkit-scrollbar-track {
    background: #3a6b47;
    border: 2px solid #2c5530;
}

::-webkit-scrollbar-thumb {
    background: #e9b872;
    border: 2px solid #2c5530;
}

::-webkit-scrollbar-thumb:hover {
    background: #d9a862;
}

/* Toast Messages */
@keyframes pixelSlideDown {
    0% { transform: translateX(-50%) translateY(-100%); opacity: 0; }
    100% { transform: translateX(-50%) translateY(0); opacity: 1; }
}

@keyframes pixelSlideUp {
    0% { transform: translateX(-50%) translateY(0); opacity: 1; }
    100% { transform: translateX(-50%) translateY(-100%); opacity: 0; }
}


@keyframes pixelGlow {
    0%, 100% { box-shadow: 0 0 5px var(--progress-fill); }
    50% { box-shadow: 0 0 15px var(--progress-fill), 0 0 20px var(--progress-fill); }
}

@keyframes pixelBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

.stage-section.ready-to-complete {
    background: var(--task-daily-bg);
    border-color: var(--header-text);
    animation: pixelGlow 2s infinite;
}

/* Pixel Scrollbar */
::-webkit-scrollbar {
    width: 12px;
}

::-webkit-scrollbar-track {
    background: var(--header-border);
    border: 2px solid var(--panel-border);
}

::-webkit-scrollbar-thumb {
    background: var(--progress-fill);
    border: 2px solid var(--panel-border);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--progress-border);
}