/* ===== Google Fonts Import ===== */
@import url('https://fonts.googleapis.com/css2?family=Special+Gothic:wght@300;400;600;700&display=swap');

/* ===== CSS Variables ===== */
:root {
    /* Brand Colors from Palette */
    --primary-purple: #8800FF;
    --primary-yellow: #FFFF00;
    --primary-green: #00FF00;
    --secondary-purple: #8866AA;
    --secondary-sage: #88AA77;
    --secondary-tan: #DDCC88;
    --dark-navy: #2D2855;
    
    /* Functional Colors */
    --success-green: #00FF00;
    --warning-yellow: #FFFF00;
    --error-red: #FF3366;
    --background-gray: #F5F7FA;
    --background-white: #FFFFFF;
    --text-dark: #2D2855;
    --text-medium: #595959;
    --text-light: #8C8C8C;
    --border-light: #D9D9D9;
    --shadow-sm: 0 2px 4px rgba(136, 0, 255, 0.08);
    --shadow-md: 0 4px 12px rgba(136, 0, 255, 0.12);
    --shadow-lg: 0 8px 24px rgba(136, 0, 255, 0.15);
    --shadow-xl: 0 12px 40px rgba(136, 0, 255, 0.2);
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --spacing-xs: 0.5rem;
    --spacing-sm: 0.75rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-xxl: 3rem;
    --transition-fast: 0.15s ease;
    --transition-base: 0.3s ease;
    --transition-slow: 0.5s ease;
    --font-display: 'Lexend Giga', sans-serif;
    --font-mono: 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Code', monospace;
}

/* ===== Base Styles ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-display);
    font-weight: 300;
    background: #D4E5F7;
    color: var(--text-dark);
    line-height: 1.6;
    font-optical-sizing: auto;
    font-variation-settings: "wdth" 100;
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    transition: background-color 1.6s ease;
}
body.biome-reef    { background-color: #81c4d7; }
body.biome-deepsea { background-color: #002c59; }
body.biome-space   { background-color: #000000; }

/* ===== Biome Backgrounds ===== */
/* ::before = default sun-sky layer */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url('images/biomes/sun-sky.png');
    background-size: cover;
    background-position: center bottom;
    background-repeat: no-repeat;
    z-index: -2;
    opacity: 1;
    transition: opacity 1.6s ease;
    will-change: opacity, transform;
}
/* Sun-sky fades out when a biome with its own background is active */
body.biome-reef::before,
body.biome-deepsea::before,
body.biome-space::before { opacity: 0; }

body.biome-forest::before { opacity: 1; }

/* Shared base for biome background overlay divs */
.reef-bg,
.deepsea-bg,
.space-bg {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: -2;
    opacity: 0;
    transition: opacity 1.6s ease;
    pointer-events: none;
}

.reef-bg {
    background-image: url('images/biomes/school_fish.png'), url('images/biomes/school_fish.png');
    background-color: #81c4d7;
    background-size: 50% auto, 50% auto;
    background-position: 110% 50%, -10% 50%;
    background-repeat: no-repeat, no-repeat;
}
body.biome-reef .reef-bg { opacity: 1; }

.deepsea-bg {
    background-image: url('images/biomes/school_fish.png'), url('images/biomes/school_fish.png');
    background-color: #002c59;
    background-size: 50% auto, 50% auto;
    background-position: 110% 50%, -10% 50%;
    background-repeat: no-repeat, no-repeat;
}
body.biome-deepsea .deepsea-bg { opacity: 1; }

.space-bg {
    background-image: url('images/biomes/planets-space.png');
    background-color: #000000;
    background-size: 22% auto;
    background-position: 1% 60%;
    background-repeat: no-repeat;
}
body.biome-space .space-bg { opacity: 1; }
body.biome-space .orbit-space-footer { opacity: 0 !important; }

/* Space biome module header colours */
body.biome-space .module-header {
    background: linear-gradient(135deg, #0d1b3e 0%, #060d1f 100%);
    box-shadow: 0 4px 20px rgba(107, 127, 212, 0.2);
    border-color: rgba(107, 127, 212, 0.35);
}
body.biome-space .module-bg-fill {
    background: linear-gradient(135deg, #1a2b5c 0%, #2d3f7c 100%);
}

body.parallax-active::before {
    animation: parallaxScroll 60s linear infinite;
}

@keyframes parallaxScroll {
    0% {
        transform: translateY(0) scale(1.2);
    }
    100% {
        transform: translateY(-5%) scale(1.2);
    }
}

/* ===== Top Navigation ===== */
.top-nav {
    background-color: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-light);
    padding: var(--spacing-xs) var(--spacing-lg);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}


.nav-btn {
    background: none;
    border: none;
    color: var(--text-medium);
    cursor: pointer;
    padding: var(--spacing-xs);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-btn:hover {
    background-color: rgba(136, 0, 255, 0.1);
    color: var(--primary-purple);
}

.nav-links {
    display: flex;
    gap: var(--spacing-lg);
    align-items: center;
}

.nav-link {
    text-decoration: none;
    color: var(--text-medium);
    font-size: 0.875rem;
    font-weight: 400;
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.nav-link-auth {
    background: var(--primary-purple);
    color: #fff !important;
    border-radius: 50px;
    font-weight: 600;
    padding: 6px 16px;
    font-size: 0.8rem;
    margin-left: 4px;
}

.nav-link-auth:hover {
    background: #6600CC;
    color: #fff !important;
    transform: translateY(-1px);
}

.nav-link:hover {
    color: var(--primary-purple);
    background-color: rgba(136, 0, 255, 0.08);
}

.nav-link.active {
    color: var(--primary-purple);
    font-weight: 600;
    background-color: rgba(136, 0, 255, 0.1);
}

.nav-link.badge-pulse {
    animation: badgePulse 1.5s ease-in-out infinite;
    color: #FFD700;
    font-weight: 600;
}

@keyframes badgePulse {
    0%, 100% { background-color: rgba(255, 215, 0, 0.1); box-shadow: none; }
    50% { background-color: rgba(255, 215, 0, 0.25); box-shadow: 0 0 12px rgba(255, 215, 0, 0.4); }
}

.nav-icons {
    display: flex;
    gap: var(--spacing-xs);
}

/* ===== Levels Container ===== */
.levels-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--spacing-xl) var(--spacing-lg);
    animation: fadeIn 0.6s ease;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(4px);
    border-radius: var(--radius-xl);
    margin-top: var(--spacing-md);
    margin-bottom: 80px;
}

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

/* ===== Progress Header ===== */
.progress-header {
    display: flex;
    justify-content: center;
    gap: var(--spacing-xxl);
    margin-bottom: var(--spacing-xl);
    padding: var(--spacing-lg);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid rgba(255, 255, 255, 0.8);
}

.progress-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-xs);
}

.progress-stat .stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-dark);
}

.progress-stat .stat-label {
    font-size: 0.875rem;
    color: var(--text-medium);
    text-transform: lowercase;
    display: flex;
    align-items: center;
    gap: 4px;
}

.star-icon {
    display: inline-block;
    vertical-align: middle;
}

.mini-progress-bar {
    width: 40px;
    height: 6px;
    background-color: var(--border-light);
    border-radius: 3px;
    overflow: hidden;
}

.mini-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-purple), var(--primary-green));
    border-radius: 3px;
    transition: width 0.5s ease;
    width: 0%;
}

.total-score {
    font-size: 0.875rem;
    color: #666666;
    font-weight: 400;
    margin-left: 8px;
}

/* ===== Section Title ===== */
.section-title {
    font-size: clamp(1.1rem, 3vw, 2rem);
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: var(--spacing-lg);
    text-align: left;
    word-wrap: break-word;
    overflow-wrap: break-word;
    text-shadow: 0 1px 3px rgba(255, 255, 255, 0.8);
}

/* ===== Overall Progress (#6) ===== */
.overall-progress {
    position: relative;
    background: linear-gradient(135deg, #6600CC 0%, #4A0099 100%);
    color: white;
    padding: 14px 24px;
    border-radius: var(--radius-xl);
    margin-bottom: var(--spacing-xxl);
    box-shadow: 0 8px 30px rgba(136, 0, 255, 0.3);
    overflow: hidden;
}

/* Background fill bar */
.progress-bg-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: linear-gradient(135deg, var(--primary-purple) 0%, #7722DD 100%);
    border-radius: var(--radius-xl);
    transition: width 1.2s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 0;
}

.progress-compact-row {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-around;
    gap: 16px;
}

.progress-percentage {
    font-size: 1.6rem;
    font-weight: 700;
}

.progress-stat-item {
    text-align: center;
}

.progress-stat-value {
    display: block;
    font-size: 1.35rem;
    font-weight: 700;
}

.progress-stat-label {
    display: block;
    font-size: 0.6rem;
    opacity: 0.85;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 2px;
}

/* Badges stat with recent pill to the right */
.badges-stat {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
}

.badges-link {
    color: inherit;
    text-decoration: none;
    text-align: center;
    transition: opacity 0.2s;
}
.badges-link:hover { opacity: 0.8; }

/* ===== Badge Info Modal ===== */
.badge-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.15s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.badge-modal {
    background: #fff;
    border-radius: 20px;
    padding: 32px 28px;
    max-width: 320px;
    width: 90vw;
    text-align: center;
    position: relative;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.25);
    animation: modalPop 0.2s ease-out;
}

@keyframes modalPop {
    from { opacity: 0; transform: scale(0.9) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.badge-modal-close {
    position: absolute;
    top: 12px; right: 16px;
    background: none; border: none;
    font-size: 24px; color: #999;
    cursor: pointer;
    line-height: 1;
}
.badge-modal-close:hover { color: #333; }

.badge-modal-image {
    width: 96px; height: 96px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 16px;
    border: 3px solid #7C5DFA;
    box-shadow: 0 4px 16px rgba(124, 93, 250, 0.25);
}

.badge-modal-name {
    font-size: 1.2rem;
    font-weight: 700;
    color: #1A1A2E;
    margin-bottom: 4px;
}

.badge-modal-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: #7C5DFA;
    margin-bottom: 12px;
}

.badge-modal-desc {
    font-size: 0.9rem;
    color: #555;
    line-height: 1.5;
}

/* ===== Module Section (#1) ===== */
.module-section {
    margin-bottom: var(--spacing-lg);
}

/* ===== Forest biome module headers (Modules 11–20) ===== */
.module-header[data-module="11"],
.module-header[data-module="12"],
.module-header[data-module="13"],
.module-header[data-module="14"],
.module-header[data-module="15"],
.module-header[data-module="16"],
.module-header[data-module="17"],
.module-header[data-module="18"],
.module-header[data-module="19"],
.module-header[data-module="20"] {
    background: linear-gradient(135deg, #2E7D32 0%, #1B5E20 100%);
    border-color: rgba(129, 199, 132, 0.3);
}

.module-header[data-module="11"] .module-bg-fill,
.module-header[data-module="12"] .module-bg-fill,
.module-header[data-module="13"] .module-bg-fill,
.module-header[data-module="14"] .module-bg-fill,
.module-header[data-module="15"] .module-bg-fill,
.module-header[data-module="16"] .module-bg-fill,
.module-header[data-module="17"] .module-bg-fill,
.module-header[data-module="18"] .module-bg-fill,
.module-header[data-module="19"] .module-bg-fill,
.module-header[data-module="20"] .module-bg-fill {
    background: linear-gradient(135deg, #4CAF50 0%, #81C784 100%);
}

/* ===== Snowy Tundra biome module headers (Modules 31–40) ===== */
.module-header[data-module="31"],
.module-header[data-module="32"],
.module-header[data-module="33"],
.module-header[data-module="34"],
.module-header[data-module="35"],
.module-header[data-module="36"],
.module-header[data-module="37"],
.module-header[data-module="38"],
.module-header[data-module="39"],
.module-header[data-module="40"] {
    background: linear-gradient(135deg, #1A3A52 0%, #0D2233 100%);
    border-color: rgba(142, 197, 224, 0.3);
}

.module-header[data-module="31"] .module-bg-fill,
.module-header[data-module="32"] .module-bg-fill,
.module-header[data-module="33"] .module-bg-fill,
.module-header[data-module="34"] .module-bg-fill,
.module-header[data-module="35"] .module-bg-fill,
.module-header[data-module="36"] .module-bg-fill,
.module-header[data-module="37"] .module-bg-fill,
.module-header[data-module="38"] .module-bg-fill,
.module-header[data-module="39"] .module-bg-fill,
.module-header[data-module="40"] .module-bg-fill {
    background: linear-gradient(135deg, #4a90b8 0%, #7BA7C4 100%);
}

/* ===== Deep Sea biome module headers (Modules 41–50) ===== */
.module-header[data-module="41"],
.module-header[data-module="42"],
.module-header[data-module="43"],
.module-header[data-module="44"],
.module-header[data-module="45"],
.module-header[data-module="46"],
.module-header[data-module="47"],
.module-header[data-module="48"],
.module-header[data-module="49"],
.module-header[data-module="50"] {
    background: linear-gradient(135deg, #03045E 0%, #020024 100%);
    border-color: rgba(0, 180, 216, 0.3);
}

.module-header[data-module="41"] .module-bg-fill,
.module-header[data-module="42"] .module-bg-fill,
.module-header[data-module="43"] .module-bg-fill,
.module-header[data-module="44"] .module-bg-fill,
.module-header[data-module="45"] .module-bg-fill,
.module-header[data-module="46"] .module-bg-fill,
.module-header[data-module="47"] .module-bg-fill,
.module-header[data-module="48"] .module-bg-fill,
.module-header[data-module="49"] .module-bg-fill,
.module-header[data-module="50"] .module-bg-fill {
    background: linear-gradient(135deg, #0077B6 0%, #00B4D8 100%);
}

/* ===== Coral Coast biome module headers (Modules 21–30) ===== */
.module-header[data-module="21"],
.module-header[data-module="22"],
.module-header[data-module="23"],
.module-header[data-module="24"],
.module-header[data-module="25"],
.module-header[data-module="26"],
.module-header[data-module="27"],
.module-header[data-module="28"],
.module-header[data-module="29"],
.module-header[data-module="30"] {
    background: linear-gradient(135deg, #0077B6 0%, #023E8A 100%);
    border-color: rgba(72, 202, 228, 0.3);
}

.module-header[data-module="21"] .module-bg-fill,
.module-header[data-module="22"] .module-bg-fill,
.module-header[data-module="23"] .module-bg-fill,
.module-header[data-module="24"] .module-bg-fill,
.module-header[data-module="25"] .module-bg-fill,
.module-header[data-module="26"] .module-bg-fill,
.module-header[data-module="27"] .module-bg-fill,
.module-header[data-module="28"] .module-bg-fill,
.module-header[data-module="29"] .module-bg-fill,
.module-header[data-module="30"] .module-bg-fill {
    background: linear-gradient(135deg, #00B4D8 0%, #48CAE4 100%);
}

.module-header {
    position: relative;
    background: linear-gradient(135deg, #B8860B 0%, #8B6914 100%);
    padding: 20px 28px;
    border-radius: var(--radius-xl);
    margin-bottom: var(--spacing-lg);
    box-shadow: 0 4px 20px rgba(184, 134, 11, 0.25);
    overflow: hidden;
    border: 2px solid rgba(255, 215, 0, 0.3);
}

/* Background fill — same technique as "Your Progress" */
.module-bg-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: linear-gradient(135deg, #DAA520 0%, #F4D03F 100%);
    border-radius: var(--radius-xl);
    transition: width 1.2s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 0;
}

.module-header-top {
    position: relative;
    z-index: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.module-header h2 {
    font-size: 1.15rem;
    font-weight: 700;
    color: #FFFFFF;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
    margin: 0;
}

.module-header h2 code {
    background: rgba(255, 255, 255, 0.2);
    padding: 2px 8px;
    border-radius: 6px;
    font-family: var(--font-mono);
    font-size: 1rem;
    color: #FFFFFF;
}

.module-progress-text {
    position: relative;
    z-index: 1;
    font-size: 1rem;
    font-weight: 700;
    color: #FFFFFF;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
    white-space: nowrap;
}

.module-separator {
    height: 2px;
    background: linear-gradient(to right, transparent 0%, rgba(136, 0, 255, 0.15) 50%, transparent 100%);
    margin: var(--spacing-xl) 0;
}

/* ===== Biome Transition Banner ===== */
.biome-transition-banner {
    display: flex;
    align-items: stretch;
    border-radius: var(--radius-xl);
    overflow: hidden;
    margin: var(--spacing-xl) 0;
    min-height: 160px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.biome-transition-banner.visible {
    opacity: 1;
    transform: translateY(0);
}

.biome-transition-side {
    flex: 1;
    position: relative;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: var(--spacing-lg);
    overflow: hidden;
}

.biome-transition-side img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: bottom center;
}

.biome-transition-side-label {
    position: relative;
    z-index: 2;
    text-align: center;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(6px);
    border-radius: 12px;
    padding: 8px 16px;
    color: #fff;
}

.biome-transition-side-label strong {
    display: block;
    font-size: 0.95rem;
    font-weight: 700;
    text-shadow: 0 1px 4px rgba(0,0,0,0.5);
}

.biome-transition-side-label span {
    font-size: 0.7rem;
    opacity: 0.85;
}

.biome-transition-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: var(--spacing-lg) var(--spacing-xl);
    background: rgba(10, 10, 20, 0.75);
    backdrop-filter: blur(10px);
    min-width: 220px;
    text-align: center;
    z-index: 3;
}

.biome-transition-arrow {
    font-size: 2rem;
    animation: pulseArrow 1.8s ease-in-out infinite;
    line-height: 1;
}

@keyframes pulseArrow {
    0%, 100% { transform: translateX(0); opacity: 0.7; }
    50% { transform: translateX(6px); opacity: 1; }
}

.biome-transition-center p {
    font-size: 0.85rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    text-shadow: 0 1px 6px rgba(0,0,0,0.5);
    line-height: 1.4;
    margin: 0;
}

/* ===== Recent Badges Pill (biomes-style) ===== */
.recent-badges-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(8px);
    padding: 6px 12px;
    border-radius: 50px;
    margin-top: 8px;
    cursor: default;
}

.recent-pill-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    white-space: nowrap;
}

.recent-pill-badges {
    display: flex;
    gap: 6px;
}

.recent-pill-badge {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2.5px solid #FFD700;
    overflow: hidden;
    cursor: pointer;
    transition: transform var(--transition-base);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    position: relative;
    flex-shrink: 0;
}

.recent-pill-badge:hover {
    transform: scale(1.15);
    z-index: 5;
}

.recent-pill-badge img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.recent-pill-badge .pill-tooltip {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.85);
    color: white;
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 0.6rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-fast);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    z-index: 20;
}

.recent-pill-badge .pill-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 4px solid transparent;
    border-top-color: rgba(0, 0, 0, 0.85);
}

.recent-pill-badge:hover .pill-tooltip {
    opacity: 1;
}

/* ===== Levels Grid (#2) ===== */
.levels-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-md);
}

/* ===== Level Card ===== */
.level-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    box-shadow: var(--shadow-lg);
    border: 3px solid rgba(255, 255, 255, 0.5);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-sm);
    cursor: pointer;
    transition: all var(--transition-base);
    text-decoration: none;
    color: inherit;
    position: relative;
    overflow: hidden;
}

.level-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-xl);
    border-color: var(--primary-purple);
}

/* Bounce animation for first playable level */
.level-card.start-here {
    border-color: var(--primary-purple);
    box-shadow: 0 0 0 0 rgba(136, 0, 255, 0.4);
    animation: startBounce 2s ease-in-out infinite;
}

@keyframes startBounce {
    0%, 100% { transform: translateY(0); box-shadow: 0 0 0 0 rgba(136, 0, 255, 0.4); }
    30% { transform: translateY(-8px); box-shadow: 0 8px 25px rgba(136, 0, 255, 0.3); }
    50% { transform: translateY(-2px); }
    70% { transform: translateY(-5px); box-shadow: 0 5px 20px rgba(136, 0, 255, 0.25); }
}

.level-card.start-here:hover {
    animation: none;
}

.level-card:active {
    transform: translateY(-1px) scale(0.97);
    box-shadow: var(--shadow-md);
    transition-duration: 0.1s;
}

/* ===== Locked Level (#3) ===== */
.level-card.locked {
    opacity: 0.5;
    cursor: not-allowed;
    background: rgba(245, 247, 250, 0.6);
    border: 3px dashed #CCC;
}

.level-card.locked:hover {
    transform: none;
    box-shadow: var(--shadow-sm);
    border-color: #CCC;
    opacity: 0.55;
}

.level-card.locked:active {
    transform: none;
}

.level-card.locked .level-stars {
    opacity: 0.3;
}

.level-card.locked .level-number {
    color: #999;
}

.level-card.completed {
    border-color: var(--primary-green);
    background: linear-gradient(135deg, rgba(0, 255, 0, 0.05), rgba(255, 255, 0, 0.05));
}

/* ===== Level Number ===== */
.level-number {
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    font-weight: 700;
    color: var(--text-dark);
    font-family: var(--font-mono);
}

/* ===== Level Icon ===== */
.level-icon {
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.level-icon svg {
    width: 100%;
    height: 100%;
}

.drum-icon {
    fill: #8C8C8C;
}

.level-card.completed .drum-icon {
    fill: var(--primary-purple);
}

.level-card.locked .drum-icon {
    fill: #D9D9D9;
}

.badge-icon {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* ===== Stars Display ===== */
.level-stars {
    display: flex;
    gap: var(--spacing-xs);
    margin-top: var(--spacing-xs);
}

.level-star {
    width: 24px;
    height: 24px;
}

.level-star.filled {
    fill: var(--primary-yellow);
    stroke: rgba(136, 102, 170, 0.5);
    stroke-width: 1;
    filter: drop-shadow(0 2px 4px rgba(255, 255, 0, 0.6));
    animation: starPop 0.4s ease both;
}

.level-star.filled:nth-child(1) { animation-delay: 0.1s; }
.level-star.filled:nth-child(2) { animation-delay: 0.25s; }
.level-star.filled:nth-child(3) { animation-delay: 0.4s; }

@keyframes starPop {
    0% { transform: scale(0) rotate(-30deg); opacity: 0; }
    60% { transform: scale(1.3) rotate(5deg); opacity: 1; }
    100% { transform: scale(1) rotate(0deg); }
}

.level-star.empty {
    fill: rgba(0, 0, 0, 0.1);
    stroke: rgba(0, 0, 0, 0.2);
    stroke-width: 1;
}

/* ===== Level Label ===== */
.level-label {
    font-size: 0.875rem;
    color: var(--text-medium);
    text-align: center;
    font-weight: 500;
}

.level-card.locked .level-label {
    color: var(--text-light);
}

/* ===== Lock Icon ===== */
.lock-icon {
    position: absolute;
    top: var(--spacing-sm);
    right: var(--spacing-sm);
    width: 20px;
    height: 20px;
    fill: var(--text-light);
}

/* Touch feedback for nav */
.nav-link:active {
    transform: scale(0.96);
    background-color: rgba(136, 0, 255, 0.15);
}

.nav-btn:active {
    transform: scale(0.9);
}

/* ===== Unlock Icon ===== */
.unlock-icon {
    position: absolute;
    top: var(--spacing-sm);
    right: var(--spacing-sm);
    width: 20px;
    height: 20px;
    fill: var(--success-green);
    opacity: 0.7;
}

/* ===== Mobile Menu ===== */
@media (max-width: 768px) {
    #menu-btn {
        display: flex;
    }

    .nav-links {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        flex-direction: column;
        background: rgba(255, 255, 255, 0.98);
        backdrop-filter: blur(12px);
        border-bottom: 1px solid var(--border-light);
        box-shadow: var(--shadow-md);
        padding: var(--spacing-sm) 0;
        z-index: 99;
    }

    .nav-links.open {
        display: flex;
    }

    .nav-link {
        padding: var(--spacing-sm) var(--spacing-lg);
        font-size: 1rem;
        border-radius: 0;
        min-height: 44px;
        display: flex;
        align-items: center;
    }

    .nav-link:hover {
        background-color: rgba(136, 0, 255, 0.06);
    }

    #menu-btn.active {
        background-color: rgba(136, 0, 255, 0.1);
        color: var(--primary-purple);
    }
}

/* Hide hamburger on desktop */
@media (min-width: 769px) {
    #menu-btn {
        display: none;
    }
}

/* ===== Responsive Design ===== */

/* Small laptop / tablet landscape (1024px) */
@media (max-width: 1024px) {
    .levels-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .section-title {
        font-size: 1.6rem;
    }

    .level-number {
        font-size: 2.2rem;
    }
}

/* Tablet portrait (768px) */
@media (max-width: 768px) {
    .top-nav {
        padding: var(--spacing-xs) var(--spacing-md);
    }

    .levels-container {
        padding: var(--spacing-lg) var(--spacing-md);
    }
    
    .progress-header {
        gap: var(--spacing-lg);
        flex-wrap: wrap;
    }
    
    .section-title {
        font-size: 1.25rem;
    }

    
    .levels-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: var(--spacing-md);
    }

    .module-header h2 {
        font-size: 0.95rem;
    }

    .module-header {
        padding: 16px 20px;
    }

    .module-progress-text {
        font-size: 0.85rem;
    }

    .overall-progress {
        padding: 20px;
    }

    .progress-percentage {
        font-size: 1.5rem;
    }

    .progress-stat-value {
        font-size: 1.4rem;
    }
    
    .level-number {
        font-size: 2rem;
    }
    
    .level-icon {
        width: 60px;
        height: 60px;
    }

    .level-card {
        padding: var(--spacing-md);
        min-height: 44px;
    }

    .nav-btn {
        min-width: 44px;
        min-height: 44px;
    }

    .desert-footer,
    .forest-footer,
    .reef-footer,
    .tundra-footer,
    .deepsea-footer,
    .savannah-footer,
    .orbit-space-footer {
        height: 40px;
        background-size: auto 40px;
    }

    /* Biome transition banner — tablet */
    .biome-transition-banner {
        min-height: 120px;
    }

    .biome-transition-center {
        min-width: 160px;
        padding: var(--spacing-md);
    }

    .biome-transition-arrow {
        font-size: 1.5rem;
    }

    .biome-transition-center p {
        font-size: 0.8rem;
    }

    .biome-transition-side-label strong {
        font-size: 0.85rem;
    }

    .help-button {
        bottom: 60px;
        right: 16px;
        padding: 10px 16px;
        font-size: 0.75rem;
    }

    .recent-pill-badge {
        width: 30px;
        height: 30px;
    }

    .recent-pill-label {
        font-size: 0.6rem;
    }
}

/* Mobile (480px) */
@media (max-width: 480px) {
    .levels-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .section-title {
        font-size: 1.1rem;
    }

    .level-number {
        font-size: 1.75rem;
    }

    .level-card {
        min-height: 110px;
        padding: var(--spacing-md) var(--spacing-sm);
    }

    .level-label {
        font-size: 0.75rem;
    }

    .module-header h2 {
        font-size: 0.8rem;
    }

    .module-header h2 code {
        font-size: 0.75rem;
    }

    .module-header {
        padding: 14px 16px;
    }

    .module-progress-text {
        font-size: 0.8rem;
    }

    .progress-compact-row {
        flex-wrap: wrap;
        gap: 12px;
    }

    .progress-percentage {
        font-size: 1.3rem;
    }

    .progress-stat-value {
        font-size: 1.2rem;
    }

    .progress-stat-label {
        font-size: 0.55rem;
    }

    .help-button {
        bottom: 52px;
        right: 12px;
        padding: 8px 14px;
        font-size: 0.7rem;
    }

    .desert-footer,
    .forest-footer,
    .reef-footer,
    .tundra-footer,
    .deepsea-footer,
    .savannah-footer,
    .orbit-space-footer {
        height: 30px;
        background-size: auto 30px;
    }

    /* Biome transition banner — mobile: stack vertically, hide side images */
    .biome-transition-banner {
        flex-direction: column;
        min-height: unset;
    }

    .biome-transition-side {
        display: none;
    }

    .biome-transition-center {
        min-width: unset;
        width: 100%;
        padding: var(--spacing-lg);
        border-radius: var(--radius-xl);
    }

    .biome-transition-arrow {
        font-size: 1.75rem;
    }

    .biome-transition-center p {
        font-size: 0.95rem;
    }

    .level-star {
        width: 18px;
        height: 18px;
    }

    .recent-badges-pill {
        padding: 4px 8px;
        gap: 5px;
    }

    .recent-pill-badge {
        width: 26px;
        height: 26px;
    }
}

/* ===== Levels Page Footer ===== */
.site-footer-levels {
    background: rgba(44, 62, 80, 0.9);
    backdrop-filter: blur(10px);
    color: #B0BEC5;
    padding: 32px 24px 80px;
    text-align: center;
    margin-top: var(--spacing-xl);
}

.footer-content-levels {
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.footer-logo-levels {
    font-size: 16px;
    font-weight: 600;
    color: white;
    font-family: var(--font-display);
}

.footer-links-levels {
    display: flex;
    gap: 20px;
}

.footer-links-levels a {
    text-decoration: none;
    color: #B0BEC5;
    font-size: 13px;
    font-family: var(--font-display);
    transition: color 0.2s ease;
}

.footer-links-levels a:hover {
    color: white;
}

.footer-copy-levels {
    font-size: 11px;
    color: #78909C;
    font-family: var(--font-display);
}

/* ===== Welcome Modal ===== */
.welcome-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    backdrop-filter: blur(4px);
    animation: fadeIn 0.3s ease;
}

.welcome-modal {
    background: white;
    border-radius: var(--radius-xl);
    padding: var(--spacing-xxl);
    max-width: 480px;
    width: 90%;
    text-align: center;
    box-shadow: var(--shadow-xl);
    animation: fadeIn 0.4s ease;
}

.welcome-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: var(--spacing-sm);
}

.welcome-text {
    font-size: 0.95rem;
    color: var(--text-medium);
    margin-bottom: var(--spacing-xl);
    line-height: 1.5;
}

.welcome-steps {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    text-align: left;
    margin-bottom: var(--spacing-xl);
}

.welcome-step {
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-md);
}

.welcome-step-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
    margin-top: 2px;
}

.welcome-step strong {
    font-size: 0.95rem;
    color: var(--text-dark);
    display: block;
    margin-bottom: 2px;
}

.welcome-step p {
    font-size: 0.85rem;
    color: var(--text-medium);
    line-height: 1.4;
    margin: 0;
}

.welcome-btn {
    background: linear-gradient(135deg, var(--primary-purple), #6600CC);
    color: white;
    border: none;
    padding: 14px 36px;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 50px;
    cursor: pointer;
    font-family: var(--font-display);
    transition: all var(--transition-base);
    box-shadow: 0 4px 16px rgba(136, 0, 255, 0.3);
}

.welcome-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(136, 0, 255, 0.4);
}

/* ===== Help Button & Modal (#10) ===== */
.help-button {
    position: fixed;
    bottom: 90px;
    right: 24px;
    background: linear-gradient(135deg, var(--primary-purple), #6600CC);
    color: white;
    border: none;
    padding: 14px 22px;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(136, 0, 255, 0.35);
    transition: all var(--transition-base);
    z-index: 90;
    font-family: var(--font-display);
}

.help-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 24px rgba(136, 0, 255, 0.45);
}

.help-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 20px;
    backdrop-filter: blur(4px);
}

.help-modal.active {
    display: flex;
}

.help-modal-content {
    background: white;
    padding: 40px;
    border-radius: var(--radius-xl);
    max-width: 560px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    box-shadow: var(--shadow-xl);
    animation: slideUp 0.4s ease;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

.help-modal-content .close-modal {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    font-size: 2rem;
    color: #999;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all var(--transition-fast);
}

.help-modal-content .close-modal:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #333;
}

.help-modal-content h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: var(--spacing-lg);
}

.help-section {
    margin: var(--spacing-lg) 0;
    padding-bottom: var(--spacing-md);
    border-bottom: 1px solid #EEE;
}

.help-section:last-of-type {
    border-bottom: none;
}

.help-section h3 {
    color: var(--text-dark);
    margin-bottom: 8px;
    font-size: 1rem;
}

.help-section p {
    font-size: 0.85rem;
    color: var(--text-medium);
    line-height: 1.6;
}

.help-section ul {
    list-style: none;
    padding-left: 0;
}

.help-section li {
    padding: 6px 0 6px 24px;
    position: relative;
    font-size: 0.85rem;
    color: var(--text-medium);
    line-height: 1.5;
}

.help-section li::before {
    content: "→";
    position: absolute;
    left: 0;
    color: var(--primary-purple);
    font-weight: bold;
}

.help-got-it-btn {
    display: block;
    width: 100%;
    background: linear-gradient(135deg, var(--primary-purple), #6600CC);
    color: white;
    border: none;
    padding: 14px 32px;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 50px;
    cursor: pointer;
    font-family: var(--font-display);
    transition: all var(--transition-base);
    margin-top: var(--spacing-lg);
    box-shadow: 0 4px 16px rgba(136, 0, 255, 0.3);
}

.help-got-it-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(136, 0, 255, 0.4);
}

/* ===== Locked Tooltip ===== */
.lock-tooltip {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: white;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 0.7rem;
    white-space: nowrap;
    z-index: 10;
    pointer-events: none;
    animation: tooltipFade 0.3s ease;
}

.lock-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #333;
}

@keyframes tooltipFade {
    from { opacity: 0; transform: translateX(-50%) translateY(4px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ===== Desert Footer ===== */
.desert-footer {
    position: fixed;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 60px;
    background-image: url('images/biomes/dry-desert-biome.png');
    background-position: bottom left;
    background-size: auto 60px;
    z-index: 50;
    pointer-events: none;
    transition: opacity 1.6s ease;
}

.forest-footer {
    position: fixed;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 60px;
    background-image: url('images/biomes/lush-forest-biome.png');
    background-position: bottom left;
    background-size: auto 60px;
    z-index: 50;
    pointer-events: none;
    opacity: 0;
    transition: opacity 1.6s ease;
}

body.biome-forest .desert-footer { opacity: 0; }
body.biome-forest .forest-footer { opacity: 1; }

/* ===== Reef Footer ===== */
.reef-footer {
    position: fixed;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 60px;
    background-image: url('images/biomes/coral-coast-biome.png');
    background-position: bottom left;
    background-size: auto 60px;
    z-index: 50;
    pointer-events: none;
    opacity: 0;
    transition: opacity 1.6s ease;
}

body.biome-reef .desert-footer  { opacity: 0; }
body.biome-reef .forest-footer  { opacity: 0; }
body.biome-reef .reef-footer    { opacity: 1; }

/* ===== Tundra Footer ===== */
.tundra-footer {
    position: fixed;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 60px;
    background-image: url('images/biomes/snowy-tundra-biome.png');
    background-position: bottom left;
    background-size: auto 60px;
    z-index: 50;
    pointer-events: none;
    opacity: 0;
    transition: opacity 1.6s ease;
}

body.biome-tundra .desert-footer  { opacity: 0; }
body.biome-tundra .forest-footer  { opacity: 0; }
body.biome-tundra .reef-footer    { opacity: 0; }
body.biome-tundra .tundra-footer  { opacity: 1; }

/* ===== Deep Sea Footer ===== */
.deepsea-footer {
    position: fixed;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 60px;
    background-image: url('images/biomes/deep-sea-biome.png');
    background-position: bottom left;
    background-size: auto 60px;
    z-index: 50;
    pointer-events: none;
    opacity: 0;
    transition: opacity 1.6s ease;
}

body.biome-deepsea .desert-footer  { opacity: 0; }
body.biome-deepsea .forest-footer  { opacity: 0; }
body.biome-deepsea .reef-footer    { opacity: 0; }
body.biome-deepsea .tundra-footer  { opacity: 0; }
body.biome-deepsea .deepsea-footer { opacity: 1; }

/* ===== Silver Savannah Footer ===== */
.savannah-footer {
    position: fixed;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 60px;
    background-image: url('images/biomes/silver-savanah-biome.png');
    background-position: bottom left;
    background-size: auto 60px;
    z-index: 50;
    pointer-events: none;
    opacity: 0;
    transition: opacity 1.6s ease;
}

body.biome-savannah .desert-footer   { opacity: 0; }
body.biome-savannah .forest-footer   { opacity: 0; }
body.biome-savannah .reef-footer     { opacity: 0; }
body.biome-savannah .tundra-footer   { opacity: 0; }
body.biome-savannah .deepsea-footer  { opacity: 0; }
body.biome-savannah .savannah-footer { opacity: 1; }

.orbit-space-footer {
    position: fixed;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 60px;
    background-image: url('images/biomes/orbit-space-biome.png');
    background-position: bottom left;
    background-size: auto 60px;
    z-index: 50;
    pointer-events: none;
    opacity: 0;
    transition: opacity 1.6s ease;
}

body.biome-space .desert-footer       { opacity: 0; }
body.biome-space .forest-footer       { opacity: 0; }
body.biome-space .reef-footer         { opacity: 0; }
body.biome-space .tundra-footer       { opacity: 0; }
body.biome-space .deepsea-footer      { opacity: 0; }
body.biome-space .savannah-footer     { opacity: 0; }
body.biome-space .orbit-space-footer  { opacity: 1; }
