/* Story Mode Styles */

/* World Selection Screen */
.story-world-content {
    padding: 20px;
    overflow-y: auto;
}

.world-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    /* 2 columns on PC */
    gap: 20px;
    max-width: 1200px;
    margin: 0 auto;
}

.world-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 24px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.2, 1, 0.3, 1);
    position: relative;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.world-card.unlocked:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(83, 141, 78, 0.3);
}

.world-card.locked {
    background: linear-gradient(135deg, rgba(50, 50, 50, 0.1), rgba(30, 30, 30, 0.05));
    border-color: #444;
    cursor: not-allowed;
    opacity: 0.6;
}

.world-icon {
    font-size: 48px;
    text-align: center;
    margin-bottom: 12px;
}

.world-name {
    font-size: 22px;
    font-weight: 700;
    color: var(--accent-color);
    text-align: center;
    margin: 0 0 8px 0;
}

.world-description {
    font-size: 14px;
    color: #888;
    text-align: center;
    margin: 0 0 16px 0;
}

/* Pixel Art Canvas (replaces old 1024-div grid) */
.pixel-canvas {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
    margin: 0 auto 16px auto;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    border-radius: 0;
}

@keyframes tileReveal {
    0% {
        transform: scale(0);
        opacity: 0;
    }

    50% {
        transform: scale(1.2);
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.completed-world-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    background: #4CAF50;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 700;
    color: white;
}

.world-progress {
    margin-top: 16px;
}

.progress-bar-container {
    width: 100%;
    height: 8px;
    background: #222;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
}

.progress-text {
    font-size: 12px;
    color: #aaa;
    text-align: center;
    font-weight: 600;
}

.locked-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(0, 0, 0, 0.7);
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    color: #888;
}

/* LEVEL LIST — VERTICAL */
.level-grid {
    display: flex;
    flex-direction: column;
    /* vertical list */
    gap: 28px;
    /* spacing between cards */
    max-width: 500px;
    /* centered narrow column */
    margin: 20px auto;
}

.level-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(8px);
    border-radius: 18px;
    padding: 22px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.2, 1, 0.3, 1);
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    min-height: 150px;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.level-card.unlocked:hover {
    transform: translateY(-4px) scale(1.04);
    box-shadow: 0 10px 24px rgba(83, 141, 78, 0.35);
}

.level-card.locked {
    background: linear-gradient(135deg, rgba(40, 40, 40, 0.18), rgba(20, 20, 20, 0.06));
    border-color: #3a3a3a;
    opacity: 0.55;
}

.level-card.completed {
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.22), rgba(76, 175, 80, 0.12));
    border-color: #5fbf63;
}

.level-number {
    font-size: 32px;
    font-weight: 700;
    color: var(--accent-color);
}

.level-name {
    font-size: 13px;
    font-weight: 600;
    color: #ccc;
    text-align: center;
}

.level-target {
    font-size: 11px;
    color: #888;
    font-weight: 600;
}

.completed-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    background: #4CAF50;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: white;
    font-weight: 700;
}

.locked-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 32px;
    opacity: 0.3;
}

/* Story Mode Progress Bar */
.story-progress-container {
    width: 100%;
    max-width: 400px;
    margin-bottom: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.story-progress-label {
    font-size: 10px;
    font-weight: 700;
    color: #888;
}

.story-progress-bar {
    width: 100%;
    height: 20px;
    background: rgba(255,255,255,0.03);
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.1);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.3);
}

.story-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4CAF50, #8BC34A);
    width: 0%;
    transition: width 0.5s ease-out;
}

.story-progress-text {
    font-size: 12px;
    color: #ccc;
    font-weight: 600;
}

#story-complete-overlay {
    background: rgba(0, 0, 0, 0.85);
    z-index: 200;
    text-align: center;
}

#story-complete-overlay h2 {
    color: #FFD700;
    font-size: 32px;
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
    margin-bottom: 10px;
    text-align: center;
}

#story-complete-overlay p {
    color: white;
    font-size: 18px;
    margin-bottom: 30px;
    text-align: center;
}

/* Responsive Design */
@media (max-width: 600px) {
    .world-grid {
        grid-template-columns: 1fr;
    }

    /* preserve vertical layout */
    .level-grid {
        flex-direction: column;
        gap: 20px;
        max-width: 90%;
    }

    .level-card {
        min-height: 120px;
        padding: 16px;
    }

    .level-number {
        font-size: 28px;
    }

    .level-name {
        font-size: 11px;
    }
}