/* ===== 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;

    /* Desert Biome Palette */
    --desert-primary: #F4D03F;
    --desert-secondary: #F39C12;
    --desert-accent: #E67E22;
    --desert-gold: #FFD700;
    --desert-text: #5D4037;
    --desert-bg: #FFF8E1;

    /* Forest Biome Palette */
    --forest-primary: #4CAF50;
    --forest-secondary: #2E7D32;
    --forest-accent: #81C784;
    --forest-gold: #A5D6A7;
    --forest-text: #1B5E20;
    --forest-bg: #E8F5E9;

    /* Tundra Biome Palette */
    --tundra-primary: #B8D4E8;
    --tundra-secondary: #7BA7C4;
    --tundra-accent: #A5D8DD;
    --tundra-border: #8EC5E0;
    --tundra-text: #1A3A52;
    --tundra-bg: #EAF4FB;

    /* Deep Sea Biome Palette */
    --deepsea-primary: #00B4D8;
    --deepsea-secondary: #0077B6;
    --deepsea-accent: #90E0EF;
    --deepsea-border: #00B4D8;
    --deepsea-text: #CAF0F8;
    --deepsea-bg: #03045E;

    /* Rarity Colors */
    --rarity-common: #B0B0B0;
    --rarity-uncommon: #4CAF50;
    --rarity-rare: #2196F3;
    --rarity-mythic-start: #9C27B0;
    --rarity-mythic-end: #FFD700;
}

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

body {
    font-family: var(--font-display);
    font-weight: 300;
    background: #FFFFFF;
    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;
}

/* ===== 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: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-icons {
    display: flex;
    gap: var(--spacing-xs);
}

/* ===== Recently Earned — compact top-right corner ===== */
.recently-earned-corner {
    position: absolute;
    top: var(--spacing-lg);
    right: var(--spacing-lg);
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(8px);
    padding: 8px 14px;
    border-radius: 50px;
}

.recent-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    text-shadow: 0 1px 3px rgba(0,0,0,0.4);
    white-space: nowrap;
}

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

.recent-badge-mini {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 2.5px solid var(--desert-gold);
    overflow: hidden;
    cursor: pointer;
    transition: transform var(--transition-base);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    position: relative;
}

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

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

.recent-badge-mini .recent-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);
    text-shadow: none;
}

.recent-badge-mini .recent-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-badge-mini:hover .recent-tooltip {
    opacity: 1;
}

@keyframes badgeGlow {
    0%, 100% { box-shadow: 0 2px 8px rgba(0,0,0,0.3), 0 0 12px rgba(255, 215, 0, 0.6); }
    50% { box-shadow: 0 2px 8px rgba(0,0,0,0.3), 0 0 22px rgba(255, 215, 0, 0.9); }
}

.recent-badge-mini.glow {
    animation: badgeGlow 2s ease-in-out infinite;
}

/* ===== All Badges Header (inside desert header) ===== */
.all-badges-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-md);
    flex-wrap: wrap;
    gap: var(--spacing-sm);
    padding: 0 var(--spacing-sm);
}

.all-badges-header h3 {
    font-size: 1rem;
    font-weight: 700;
    color: #FFFFFF;
    text-shadow: 0 1px 6px rgba(0, 0, 0, 0.5);
    margin: 0;
}

.badge-progress-inline {
    display: flex;
    align-items: center;
    gap: 10px;
}

.badge-count {
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.75rem;
    white-space: nowrap;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

.badge-progress-bar-sm {
    width: 100px;
    height: 7px;
    background: rgba(255, 255, 255, 0.25);
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.badge-progress-fill-sm {
    height: 100%;
    background: linear-gradient(90deg, var(--desert-gold), var(--desert-accent));
    border-radius: 6px;
    transition: width 1s ease;
}

.badge-progress-pct {
    font-weight: 700;
    color: var(--desert-gold);
    font-size: 0.8rem;
    min-width: 30px;
    text-align: right;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

/* ===== Module Pills (inside header, after subtitle) ===== */
.module-pills-wrapper {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-bottom: var(--spacing-lg);
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}

.module-pill {
    background: rgba(255, 255, 255, 0.18);
    backdrop-filter: blur(6px);
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-radius: 50px;
    padding: 6px 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all var(--transition-base);
    text-decoration: none;
}

.module-pill:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.module-pill-number {
    width: 26px;
    height: 26px;
    background: var(--desert-secondary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
    flex-shrink: 0;
}

.module-pill-name {
    font-size: 0.65rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.95);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
    font-family: var(--font-mono);
    white-space: nowrap;
}

.module-pill-stars {
    font-size: 0.6rem;
    white-space: nowrap;
}

.module-pill-lock {
    font-size: 0.7rem;
}

.module-pill.completed {
    border-color: rgba(22, 160, 133, 0.7);
    background: rgba(22, 160, 133, 0.25);
}

.module-pill.completed .module-pill-number {
    background: #16A085;
}

.module-pill.in-progress {
    border-color: rgba(243, 156, 18, 0.6);
    background: rgba(243, 156, 18, 0.2);
}

.module-pill.locked {
    border-color: rgba(255, 255, 255, 0.15);
    background: rgba(0, 0, 0, 0.15);
    opacity: 0.5;
    cursor: not-allowed;
}

.module-pill.locked .module-pill-number {
    background: rgba(255, 255, 255, 0.25);
}

.module-pill.locked .module-pill-name {
    color: rgba(255, 255, 255, 0.5);
}

/* ===== Main Container ===== */
.biomes-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: var(--spacing-xl) var(--spacing-lg);
    animation: fadeIn 0.6s ease;
}

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

/* ===== Biome Section ===== */
.biome-section {
    margin-bottom: var(--spacing-xl);
}

/* ===== Biome Header ===== */
.biome-header {
    position: relative;
    border-radius: var(--radius-xl);
    overflow: visible;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: var(--spacing-xl);
}

.desert-header {
    background:
        url('images/biomes/dry-desert-biome.png') bottom center / 100% auto no-repeat;
    background-color: #7ec8d8;
    border-radius: 20px;
    border: 3px solid var(--desert-gold);
    box-shadow:
        0 0 0 2px rgba(243, 156, 18, 0.3),
        0 8px 32px rgba(243, 156, 18, 0.15),
        inset 0 0 60px rgba(255, 215, 0, 0.08);
    padding-bottom: 0;
    overflow: hidden;
}

.desert-sky-img {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: auto;
    z-index: 0;
    pointer-events: none;
    transform: translateY(-55%);
}

.reef-header .desert-sky-img,
.deepsea-header .desert-sky-img,
.space-header .desert-sky-img {
    display: none;
}

.desert-header::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 20px;
    background: linear-gradient(
        to bottom,
        rgba(126, 200, 216, 0.3) 0%,
        rgba(126, 200, 216, 0.15) 30%,
        rgba(0, 0, 0, 0.05) 60%,
        rgba(0, 0, 0, 0.25) 100%
    );
    z-index: 1;
    pointer-events: none;
}

.forest-header {
    background:
        url('images/biomes/lush-forest-biome.png') bottom center / 100% auto no-repeat;
    background-color: #7ec8d8;
    border-radius: 20px;
    border: 3px solid var(--forest-accent);
    box-shadow:
        0 0 0 2px rgba(76, 175, 80, 0.3),
        0 8px 32px rgba(46, 125, 50, 0.2),
        inset 0 0 60px rgba(129, 199, 132, 0.08);
    padding-bottom: 0;
    overflow: hidden;
}

.forest-header::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 20px;
    background: linear-gradient(
        to bottom,
        rgba(126, 200, 216, 0.3) 0%,
        rgba(126, 200, 216, 0.15) 30%,
        rgba(0, 0, 0, 0.05) 60%,
        rgba(0, 0, 0, 0.25) 100%
    );
    z-index: 1;
    pointer-events: none;
}

.reef-header {
    background-image:
        url('images/biomes/coral-coast-biome.png'),
        url('images/biomes/school_fish.png'),
        url('images/biomes/school_fish.png');
    background-color: #81c4d7;
    background-size: 100% auto, 50% auto, 50% auto;
    background-position: bottom center, 110% 50%, -10% 50%;
    background-repeat: no-repeat, no-repeat, no-repeat;
    border-radius: 20px;
    border: 3px solid #4DD0E1;
    box-shadow:
        0 0 0 2px rgba(77, 208, 225, 0.3),
        0 8px 32px rgba(0, 119, 182, 0.2),
        inset 0 0 60px rgba(72, 202, 228, 0.08);
    padding-bottom: 0;
    overflow: hidden;
}

.reef-header::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 20px;
    background: linear-gradient(
        to bottom,
        rgba(129, 196, 215, 0.3) 0%,
        rgba(129, 196, 215, 0.15) 30%,
        rgba(0, 0, 0, 0.05) 60%,
        rgba(0, 0, 0, 0.25) 100%
    );
    z-index: 1;
    pointer-events: none;
}

.reef-progress-fill {
    background: linear-gradient(90deg, #48CAE4, #00B4D8) !important;
}

.tundra-header {
    background:
        url('images/biomes/snowy-tundra-biome.png') bottom center / 100% auto no-repeat;
    background-color: #7ec8d8;
    border-radius: 20px;
    border: 3px solid var(--tundra-border);
    box-shadow:
        0 0 0 2px rgba(142, 197, 224, 0.3),
        0 8px 32px rgba(74, 144, 184, 0.2),
        inset 0 0 60px rgba(184, 212, 232, 0.1);
    padding-bottom: 0;
    overflow: hidden;
}

.tundra-header::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 20px;
    background: linear-gradient(
        to bottom,
        rgba(126, 200, 216, 0.3) 0%,
        rgba(126, 200, 216, 0.15) 30%,
        rgba(0, 0, 0, 0.05) 60%,
        rgba(0, 0, 0, 0.25) 100%
    );
    z-index: 1;
    pointer-events: none;
}

.tundra-progress-fill {
    background: linear-gradient(90deg, #A5D8DD, #7BA7C4) !important;
}

.deepsea-header {
    background-image:
        url('images/biomes/deep-sea-biome.png'),
        url('images/biomes/school_fish.png'),
        url('images/biomes/school_fish.png');
    background-color: #002c59;
    background-size: 100% auto, 50% auto, 50% auto;
    background-position: bottom center, 110% 50%, -10% 50%;
    background-repeat: no-repeat, no-repeat, no-repeat;
    border-radius: 20px;
    border: 3px solid var(--deepsea-border);
    box-shadow:
        0 0 0 2px rgba(0, 180, 216, 0.3),
        0 8px 32px rgba(0, 119, 182, 0.25),
        inset 0 0 60px rgba(0, 180, 216, 0.08);
    padding-bottom: 0;
    overflow: hidden;
}

.deepsea-header::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 20px;
    background: linear-gradient(
        to bottom,
        rgba(0, 44, 89, 0.3) 0%,
        rgba(0, 44, 89, 0.15) 40%,
        rgba(0, 0, 0, 0.05) 70%,
        rgba(0, 0, 0, 0.25) 100%
    );
    z-index: 1;
    pointer-events: none;
}

.deepsea-progress-fill {
    background: linear-gradient(90deg, #00B4D8, #0077B6) !important;
}

.savannah-header {
    background:
        url('images/biomes/silver-savanah-biome.png') bottom center / 100% auto no-repeat;
    background-color: #7ec8d8;
    border-radius: 20px;
    border: 3px solid #C9A96E;
    box-shadow:
        0 0 0 2px rgba(201, 169, 110, 0.3),
        0 8px 32px rgba(139, 115, 85, 0.25),
        inset 0 0 60px rgba(201, 169, 110, 0.08);
    padding-bottom: 0;
    overflow: hidden;
}

.savannah-header::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 20px;
    background: linear-gradient(
        to bottom,
        rgba(126, 200, 216, 0.3) 0%,
        rgba(126, 200, 216, 0.15) 30%,
        rgba(0, 0, 0, 0.05) 60%,
        rgba(0, 0, 0, 0.25) 100%
    );
    z-index: 1;
    pointer-events: none;
}

.savannah-progress-fill {
    background: linear-gradient(90deg, #C9A96E, #B8C5D0) !important;
}

.space-header {
    background-image:
        url('images/biomes/planets-space.png');
    background-color: #000000;
    background-size: 22% auto;
    background-position: 1% 60%;
    background-repeat: no-repeat;
    border-radius: 20px;
    border: 3px solid #6B7FD4;
    box-shadow:
        0 0 0 2px rgba(107, 127, 212, 0.3),
        0 8px 32px rgba(30, 20, 80, 0.4),
        inset 0 0 60px rgba(107, 127, 212, 0.08);
    padding-bottom: 0;
    overflow: hidden;
}

.space-header::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 20px;
    background: linear-gradient(
        to bottom,
        rgba(0, 0, 0, 0.4) 0%,
        rgba(0, 0, 0, 0.2) 40%,
        rgba(0, 0, 0, 0.05) 70%,
        rgba(0, 0, 0, 0.3) 100%
    );
    z-index: 1;
    pointer-events: none;
}

.space-progress-fill {
    background: linear-gradient(90deg, #6B7FD4, #A78BFA) !important;
}

.locked-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to top,
        rgba(0, 0, 0, 0.8) 0%,
        rgba(0, 0, 0, 0.5) 40%,
        rgba(0, 0, 0, 0.3) 100%
    );
    z-index: 1;
}

.biome-header-content {
    position: relative;
    z-index: 2;
    text-align: center;
    padding: var(--spacing-xxl) var(--spacing-xl) var(--spacing-lg);
    width: 100%;
}

.biome-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: #FFFFFF;
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.5);
    margin-bottom: var(--spacing-xs);
}

.biome-subtitle {
    font-size: 1.125rem;
    font-weight: 300;
    color: rgba(255, 255, 255, 0.85);
    text-shadow: 0 1px 6px rgba(0, 0, 0, 0.4);
    margin-bottom: var(--spacing-lg);
}

/* ===== Biome Progress Bar (in header) ===== */
.biome-progress-wrapper {
    max-width: 500px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-xs);
}

.biome-progress-label {
    font-size: 0.9rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.9);
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

.biome-progress-bar {
    width: 100%;
    height: 16px;
    background: rgba(255, 255, 255, 0.25);
    border-radius: 8px;
    overflow: hidden;
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.biome-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--desert-gold), var(--desert-accent));
    border-radius: 8px;
    transition: width 1.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.biome-progress-fill::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.35) 50%, transparent 100%);
    animation: shimmer 2.5s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

@keyframes fishShimmer {
    0% { transform: translateX(-120%); }
    100% { transform: translateX(120%); }
}

.reef-header::after,
.deepsea-header::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 4;
    pointer-events: none;
    overflow: hidden;
    background: linear-gradient(
        105deg,
        transparent 25%,
        rgba(255, 255, 255, 0.18) 50%,
        transparent 75%
    );
    animation: fishShimmer 5s ease-in-out infinite;
}

.biome-progress-percent {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--desert-gold);
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
}

.biome-stars-label {
    font-size: 0.85rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.9);
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
    margin-top: var(--spacing-xs);
}

/* ===== Forest progress overrides ===== */
.forest-progress-fill {
    background: linear-gradient(90deg, var(--forest-primary), var(--forest-accent));
}

#forestBadgeProgressFill {
    background: linear-gradient(90deg, var(--forest-primary), var(--forest-accent));
}

#forestBadgeProgressPct {
    color: var(--forest-accent);
}

#forest-progress-percent {
    color: var(--forest-accent);
}

/* ===== Lock Message ===== */
.biome-lock-message {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    color: rgba(255, 255, 255, 0.7);
    font-size: 1.1rem;
    font-weight: 400;
    margin-top: var(--spacing-sm);
}

.lock-svg {
    stroke: rgba(255, 255, 255, 0.7);
}

/* ===== Badges Section (inside header) ===== */
.badges-section {
    position: relative;
    z-index: 3;
    padding: 0 var(--spacing-xl) var(--spacing-xl);
    width: 100%;
}

.badges-row {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: center;
    padding: var(--spacing-md) 0;
}

/* ===== Badge Item ===== */
.badge-item {
    width: 120px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-xs);
    cursor: pointer;
    transition: transform var(--transition-base);
    position: relative;
    outline: none;
}

.badge-item:focus-visible {
    outline: 2px solid var(--primary-purple);
    outline-offset: 4px;
    border-radius: var(--radius-md);
}

.badge-item:hover {
    transform: scale(1.08);
}

.badge-circle {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: visible;
    transition: all var(--transition-base);
}

/* Unlocked Badge */
.badge-item.unlocked .badge-circle {
    border: 3px solid var(--desert-gold);
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.4), 0 4px 12px rgba(0, 0, 0, 0.1);
    background: rgba(255, 255, 255, 0.95);
}

.badge-item.unlocked:hover .badge-circle {
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.6), 0 6px 20px rgba(0, 0, 0, 0.15);
    border-color: #FFA500;
}

/* Locked Badge */
.badge-item.locked .badge-circle {
    border: 3px solid #9E9E9E;
    background: rgba(200, 200, 200, 0.3);
    box-shadow: 0 0 12px rgba(158, 158, 158, 0.35);
}

.badge-item.locked {
    cursor: pointer;
}

.badge-item.locked:hover {
    transform: scale(1.03);
}

/* Clips the image inside the circle, allowing check/lock indicators to overflow */
.badge-image-clip {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    overflow: hidden;
}

.badge-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scale(1.15);
}

.badge-item.locked .badge-image {
    filter: grayscale(100%) brightness(0.5);
}

.badge-lock-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.25);
    border-radius: 50%;
}

.badge-lock-overlay svg {
    width: 28px;
    height: 28px;
    stroke: rgba(255, 255, 255, 0.85);
    filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.4));
}

/* Badge check indicator - circular, overlaps circle edge */
.badge-check {
    position: absolute;
    bottom: -4px;
    right: -4px;
    width: 30px;
    height: 30px;
    background: #16A085;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    color: white;
    font-weight: bold;
    box-shadow: 0 2px 8px rgba(22, 160, 133, 0.4);
    border: 3px solid white;
    z-index: 5;
}

/* Lock indicator for locked badges in grid */
.badge-lock-indicator {
    position: absolute;
    bottom: -4px;
    right: -4px;
    width: 30px;
    height: 30px;
    background: #95A5A6;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    border: 3px solid white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    z-index: 5;
}

/* Badge Name */
.badge-name {
    font-size: 0.75rem;
    font-weight: 600;
    color: #FFFFFF;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
    text-align: center;
    line-height: 1.3;
    max-width: 100%;
}

.badge-item.locked .badge-name {
    color: rgba(255, 255, 255, 0.5);
}

/* ===== Locked Badges Section ===== */
.locked-badges-section {
    opacity: 0.45;
    filter: grayscale(80%);
    pointer-events: none;
}

.locked-badges-row .badge-item {
    cursor: not-allowed;
}


/* ===== Biome Separator ===== */
.biome-separator {
    display: none;
    height: 0;
    margin: 0;
}

/* ===== Badge Modal ===== */
.badge-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.25s ease;
    backdrop-filter: blur(6px);
}

.badge-modal-content {
    background: var(--background-white);
    border-radius: var(--radius-xl);
    padding: var(--spacing-xxl);
    max-width: 480px;
    width: 92%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalSlideUp 0.3s ease;
    text-align: center;
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
}

@keyframes modalSlideUp {
    from { opacity: 0; transform: translateY(40px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.badge-modal-close {
    position: absolute;
    top: var(--spacing-md);
    right: var(--spacing-md);
    background: none;
    border: none;
    font-size: 2rem;
    color: var(--text-light);
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all var(--transition-fast);
    line-height: 1;
}

.badge-modal-close:hover {
    background: var(--background-gray);
    color: var(--text-dark);
}

.badge-modal-image-wrapper {
    width: 140px;
    height: 140px;
    margin: 0 auto var(--spacing-lg);
    border-radius: 50%;
    overflow: hidden;
    border: 4px solid var(--desert-gold);
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
}

.badge-modal-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.badge-modal-name {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 4px;
}

.badge-modal-title-text {
    font-size: 1rem;
    color: var(--desert-accent);
    font-style: italic;
    font-weight: 400;
    margin-bottom: var(--spacing-md);
}

.badge-modal-divider {
    border: none;
    height: 1px;
    background: var(--border-light);
    margin: var(--spacing-md) 0;
}

.badge-modal-description {
    font-size: 0.95rem;
    color: var(--text-medium);
    line-height: 1.7;
    margin-bottom: var(--spacing-lg);
    font-weight: 300;
}

.badge-modal-criteria {
    background: rgba(243, 156, 18, 0.08);
    border: 1px solid rgba(243, 156, 18, 0.2);
    border-radius: var(--radius-md);
    padding: var(--spacing-md) var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.criteria-icon {
    font-size: 1rem;
}

.criteria-text {
    font-size: 0.85rem;
    font-weight: 400;
    color: var(--text-dark);
    line-height: 1.5;
}

.badge-modal-meta {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-xl);
    text-align: center;
}

.badge-modal-meta-item {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    font-size: 0.9rem;
    color: var(--text-dark);
}

.meta-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
}

.meta-text {
    font-weight: 400;
}

.badge-modal-actions {
    display: flex;
    gap: var(--spacing-md);
    justify-content: center;
}

.badge-modal-btn {
    padding: var(--spacing-sm) var(--spacing-xl);
    border-radius: 50px;
    font-family: var(--font-display);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all var(--transition-base);
}

.badge-modal-btn-close {
    background: var(--background-gray);
    color: var(--text-dark);
    border: 2px solid var(--border-light);
}

.badge-modal-btn-close:hover {
    background: var(--border-light);
    transform: translateY(-2px);
}

/* ===== Badge Tooltip ===== */
.badge-tooltip {
    position: fixed;
    z-index: 500;
    pointer-events: none;
    animation: tooltipFadeIn 0.2s ease;
}

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

.badge-tooltip-content {
    background: rgba(26, 26, 26, 0.92);
    backdrop-filter: blur(8px);
    color: white;
    padding: var(--spacing-md) var(--spacing-lg);
    border-radius: var(--radius-md);
    font-size: 0.8rem;
    line-height: 1.6;
    max-width: 260px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.badge-tooltip-content .tooltip-title {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 4px;
}

.badge-tooltip-content .tooltip-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.2);
    margin: 6px 0;
}

.badge-tooltip-content .tooltip-criteria {
    color: rgba(255, 255, 255, 0.8);
    font-weight: 300;
}

.badge-tooltip-content .tooltip-date {
    color: var(--desert-gold);
    font-weight: 400;
    margin-top: 4px;
}


/* ===== Counter Animation ===== */
.count-up {
    display: inline-block;
}

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

/* Desktop (1200px+) - default styles above */

/* Tablet */
@media (max-width: 1199px) {
    .badges-row {
        gap: 16px;
    }

    .badge-item {
        width: 110px;
    }

    .badge-circle {
        width: 90px;
        height: 90px;
    }
}

/* Tablet small */
@media (max-width: 768px) {
    .biomes-container {
        padding: var(--spacing-lg) var(--spacing-md);
    }

    .biome-title {
        font-size: 1.75rem;
    }

    .biome-subtitle {
        font-size: 1rem;
    }

    .badges-section {
        padding: 0 var(--spacing-md) var(--spacing-lg);
    }

    .badge-item {
        width: 100px;
    }

    .badge-circle {
        width: 80px;
        height: 80px;
    }

    .nav-links {
        gap: var(--spacing-sm);
    }

    .nav-link {
        font-size: 0.8rem;
        padding: var(--spacing-xs);
    }

    .recently-earned-corner {
        top: var(--spacing-sm);
        right: var(--spacing-sm);
        padding: 6px 10px;
        gap: 6px;
    }

    .recent-badge-mini {
        width: 36px;
        height: 36px;
    }

    .module-pill {
        padding: 5px 10px;
        gap: 6px;
    }

    .module-pill-number {
        width: 22px;
        height: 22px;
        font-size: 0.6rem;
    }

    .module-pill-name {
        font-size: 0.55rem;
    }
}

/* Mobile */
@media (max-width: 480px) {
    .desert-header,
    .forest-header,
    .reef-header,
    .tundra-header,
    .deepsea-header {
        background-size: 150% auto;
    }

    .biome-title {
        font-size: 1.4rem;
    }

    .biome-header-content {
        padding: var(--spacing-xl) var(--spacing-md) var(--spacing-sm);
    }

    .badge-item {
        width: 80px;
    }

    .badge-circle {
        width: 65px;
        height: 65px;
    }

    .badge-name {
        font-size: 0.6rem;
    }

    .badge-check,
    .badge-lock-indicator {
        width: 24px;
        height: 24px;
        font-size: 0.7rem;
    }

    .recently-earned-corner {
        position: relative;
        top: auto;
        right: auto;
        justify-content: center;
        margin: var(--spacing-sm) auto;
    }

    .recent-badge-mini {
        width: 32px;
        height: 32px;
    }

    .module-pills-wrapper {
        gap: 6px;
    }

    .module-pill {
        padding: 4px 8px;
    }

    .module-pill-name {
        display: none;
    }

    .badge-modal-content {
        padding: var(--spacing-xl);
        width: 96%;
        max-height: 95vh;
    }

    .badge-modal-image-wrapper {
        width: 110px;
        height: 110px;
    }

    .badge-modal-name {
        font-size: 1.25rem;
    }

    .biome-separator {
        height: 80px;
    }

    .badges-row {
        gap: 12px;
    }
}

/* ===== Touch Active States ===== */
.badge-item:active {
    transform: scale(0.95);
    transition-duration: 0.1s;
}

.module-pill:active {
    transform: scale(0.96);
    transition-duration: 0.1s;
}

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

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

/* ===== Accessibility ===== */
.badge-item:focus-visible {
    outline: 3px solid var(--primary-purple);
    outline-offset: 4px;
    border-radius: var(--radius-md);
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ===== Screen Reader Only ===== */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ===== Easter Egg Crown Overlay ===== */
.badge-crown {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 30px;
    object-fit: contain;
    pointer-events: none;
    filter: drop-shadow(0 1px 3px rgba(0,0,0,0.5));
    z-index: 2;
}
