* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

/* Utility class for hiding elements (no !important to allow JS override) */
.hidden {
    display: none;
}

/* Hide Mapbox watermark/logo */
.mapboxgl-ctrl-logo,
.mapboxgl-ctrl-attrib,
.mapboxgl-ctrl-bottom-left,
.mapboxgl-ctrl-bottom-right {
    display: none !important;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #0a0a0f;
    color: #ffffff;
    overflow-x: hidden;
    min-height: 100vh;
    line-height: 1.6;
}

/* Toast Notifications */
.game-toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(20px);
    padding: 1rem 1.5rem;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 500;
    z-index: 10000;
    opacity: 0;
    transition: all 0.3s ease;
    text-align: center;
    max-width: 90%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.game-toast.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.game-toast-error {
    border: 1px solid rgba(239, 68, 68, 0.5);
    color: #fca5a5;
}

.game-toast-success {
    border: 1px solid rgba(74, 222, 128, 0.5);
    color: #86efac;
}

.game-toast-info {
    border: 1px solid rgba(102, 126, 234, 0.5);
    color: #a5b4fc;
}

.toast-message {
    margin-bottom: 0.75rem;
}

.toast-close {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
    padding: 0.5rem 1.5rem;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.toast-close:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

/* Background Effects */
.bg-gradient {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(ellipse at 20% 20%, rgba(72, 187, 120, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(102, 126, 234, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, rgba(118, 75, 162, 0.04) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

/* Header */
.header {
    background: rgba(10, 10, 15, 0.95);
    backdrop-filter: blur(20px);
    padding: 0.5rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.header-top {
    gap: 1rem;
    position: relative;
}

.header-top .logo {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.header-bottom {
    gap: 0.75rem;
    flex-wrap: wrap;
    justify-content: space-between;
    position: relative;
}

.player-stats {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
    justify-content: center;
}

.header-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-shrink: 0;
    position: absolute;
    right: 1rem;
}

.dev-btn {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
    border: 2px solid rgba(255, 107, 107, 0.5);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 1rem;
    font-weight: 600;
}

.dev-btn:hover {
    background: linear-gradient(135deg, #ee5a6f 0%, #ff6b6b 100%);
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(255, 107, 107, 0.5);
}

.dev-btn.active {
    background: linear-gradient(135deg, #4caf50 0%, #8bc34a 100%);
    border-color: rgba(76, 175, 80, 0.5);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(76, 175, 80, 0.7); }
    50% { box-shadow: 0 0 0 10px rgba(76, 175, 80, 0); }
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.logo-text {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 2px 8px rgba(72, 187, 120, 0.4));
}

.back-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    color: #a0aec0;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.back-btn:hover {
    border-color: rgba(102, 126, 234, 0.4);
    color: #ffffff;
    background: rgba(255, 255, 255, 0.06);
}

/* Level Badge */
.level-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 10px;
    font-weight: 700;
    font-size: 0.9rem;
}

.level-badge-icon {
    font-size: 1rem;
}

.xp-bar-container {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 120px;
}

.xp-bar-label {
    font-size: 0.65rem;
    color: #718096;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.xp-bar {
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
    border: none;
}

.xp-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    border-radius: 3px;
    transition: width 0.5s ease;
}

.coins-display {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(255, 215, 0, 0.1);
    border: 1px solid rgba(255, 215, 0, 0.25);
    border-radius: 10px;
}

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

.coins-amount {
    font-weight: 700;
    color: #ffd700;
    font-size: 0.95rem;
}

/* Main Content */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.page-title {
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: #ffffff;
}

.page-title .world-number {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 800;
}

.page-subtitle {
    text-align: center;
    color: #888;
    margin-bottom: 3rem;
    font-size: 1.1rem;
}

/* World Selection */
.worlds-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.world-card {
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid #667eea;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    padding: 2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.world-card:hover {
    transform: translateY(-5px);
    border-color: #667eea;
    box-shadow: 0 10px 40px rgba(102, 126, 234, 0.3);
}

.world-card.locked {
    opacity: 0.5;
    cursor: not-allowed;
    border-color: rgba(100, 100, 100, 0.4);
    box-shadow: none;
    filter: grayscale(50%);
}

.world-card.locked:hover {
    transform: none;
    border-color: rgba(100, 100, 100, 0.4);
    box-shadow: none;
}

.world-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.world-title {
    font-size: 1.5rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.world-number {
    color: #667eea;
    font-weight: 800;
}

.world-description {
    color: #888;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    min-height: 2.7em; /* Fixed height for 2 lines to align progress bars */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.world-progress {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.world-stars {
    font-size: 1.2rem;
}

.world-difficulty {
    background: rgba(255, 255, 255, 0.1);
    padding: 0.25rem 0.75rem;
    border-radius: 50px;
    font-size: 0.8rem;
}

.lock-icon {
    position: absolute;
    top: 1rem;
    right: 1rem;
    font-size: 2rem;
    opacity: 0.5;
}

/* Chapter Selection */
.chapters-header {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 2rem;
}

/* Desktop Grid Layout (Default) */
.chapters-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr); /* 5 columns for desktop */
    gap: 1.5rem;
    margin-bottom: 2rem;
}

/* Center the 11th chapter (World Mix) in the 3rd row */
.chapters-grid .chapter-card:last-child:nth-child(11) {
    grid-column: 3; /* Center column (3rd of 5) */
}

.chapter-card {
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid #667eea;
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative; /* Needed for absolute positioning of ::before */
    overflow: hidden;   /* Crops the zoomed image */
    z-index: 0;         /* Establishes stacking context */
}

/* Pseudo-element for the zoomed background image */
.chapter-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* Load image from variable, add gradient overlay */
    background-image: linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.8)), var(--chapter-bg);
    background-size: cover;
    background-position: center;
    transform: scale(1.15); /* THE ZOOM to hide watermark */
    z-index: -1; /* Behind the text */
    transition: transform 0.3s ease;
}

.chapter-card:hover::before {
    transform: scale(1.25); /* Zoom more on hover */
}

.chapter-card:hover {
    transform: translateY(-3px);
    border-color: #667eea;
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.3);
}

.chapter-card.locked {
    opacity: 0.5;
    cursor: not-allowed;
    filter: grayscale(100%);
    transform: scale(0.95);
    border-color: rgba(100, 100, 100, 0.3);
}

.chapter-card.locked::before {
    filter: grayscale(100%) brightness(0.6);
}

.chapter-card.locked::after {
    content: '🔒';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2rem;
    z-index: 10;
    opacity: 0.8;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
}

.chapter-card.locked:hover {
    transform: scale(0.95);
    border-color: rgba(100, 100, 100, 0.3);
    box-shadow: none;
}

.chapter-card.locked:hover::before {
    transform: scale(1.15);
}

/* Unlocked chapters - more vibrant */
.chapter-card:not(.locked) {
    border-color: #667eea;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.chapter-card:not(.locked):hover {
    box-shadow: 0 8px 30px rgba(102, 126, 234, 0.4);
}

.chapter-card.boss {
    border-color: #ffd700;
    background: rgba(255, 215, 0, 0.1);
}

.chapter-number {
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.3rem;
    color: #667eea;
    text-shadow: 0 2px 4px rgba(0,0,0,0.4);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.chapter-card.boss .chapter-number {
    color: #ffd700;
}

.chapter-name {
    font-size: 1.15rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    
    /* Gradient Text */
    background: linear-gradient(180deg, #ffffff 20%, #a5b4fc 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    color: white; /* Fallback */
    
    /* Subtle Glow */
    filter: drop-shadow(0 2px 2px rgba(0,0,0,0.8));
    
    margin-bottom: 6px;
    line-height: 1.1;
    
    /* Fixed height for 2 lines to align stars */
    min-height: 2.2em;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.chapter-subtitle {
    font-size: 0.8rem;
    color: #b0b0b0;
    margin-bottom: 0.8rem;
    font-style: normal;
    line-height: 1.3;
    
    /* Fixed height for 2 lines to align stars */
    min-height: 2.6em;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.chapter-stars {
    font-size: 1.2rem;
    margin-top: 0.5rem;
}

.chapter-time {
    font-size: 0.75rem;
    color: #888;
    margin-top: 0.25rem;
}

/* Game Screen */
.game-container {
    display: none;
    height: 100vh;
    height: 100dvh; /* Dynamic viewport height for mobile */
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 200;
    background: #000;
    overflow: hidden; /* Prevent any scrolling */
    touch-action: none; /* Prevent touch scrolling */
}

.game-container.active {
    display: flex;
}

.game-header {
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(10px);
    padding: 0.5rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    /* NOT absolute - takes real space like DEV mode header */
    position: relative;
    z-index: 10;
}

.game-header-left {
    flex: 1;
    display: flex;
    align-items: center;
}

.game-header-center {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
}

.game-header-right {
    flex: 1;
    display: flex;
    justify-content: flex-end;
    align-items: baseline;
    gap: 0.75rem;
}

.game-back-btn {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.85);
    padding: 0.45rem 0.75rem;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.15s ease;
}

.game-back-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.game-back-btn:active {
    transform: translateY(1px);
}

.lives-display {
    display: flex;
    gap: 0.25rem;
    font-size: 1.2rem;
}

.game-coins-display {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    background: rgba(255, 193, 7, 0.15);
    padding: 0.3rem 0.6rem;
    border-radius: 20px;
    border: 1px solid rgba(255, 193, 7, 0.3);
}

.game-coins-display .coins-icon {
    font-size: 1rem;
}

.game-coins-display .coins-amount {
    font-size: 0.95rem;
    font-weight: 600;
    color: #ffc107;
}

.timer-display {
    display: flex;
    align-items: baseline;
    gap: 0.35rem;
    font-size: 1.3rem;
    font-weight: bold;
    color: #667eea;
    line-height: 1;
    min-width: 70px;
    text-align: center;
    justify-content: center;
}

.timer-display.warning {
    color: #ef4444;
    animation: timerPulse 0.5s ease infinite;
}

@keyframes timerPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.question-number {
    font-size: 0.85rem;
    color: #888;
    line-height: 1;
}

#map {
    flex: 1;
    width: 100%;
    position: relative;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

#map img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Power-ups Row (inside game-controls) */
.power-ups-row {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.6rem;
    justify-content: center;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
}

.power-up-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px dashed rgba(255, 255, 255, 0.25);
    color: rgba(255, 255, 255, 0.7);
    padding: 0.25rem 0.4rem;
    border-radius: 4px;
    font-size: 0.55rem;
    font-weight: 400;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.15rem;
    white-space: nowrap;
    flex: 1;
    max-width: 50%;
}

.power-up-btn:hover:not(:disabled) {
    background: rgba(255, 215, 0, 0.1);
    border-color: rgba(255, 215, 0, 0.5);
    color: #ffd700;
}

.power-up-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.power-up-cost {
    font-size: 0.7rem;
    color: #ffd700;
    opacity: 0.8;
    margin-left: 0.4rem;
}

.hint-display {
    background: rgba(102, 126, 234, 0.15);
    border: 1px solid rgba(102, 126, 234, 0.4);
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    margin-bottom: 0.5rem;
    color: #c8d4ff;
    font-size: 0.85rem;
    text-align: center;
    animation: fadeIn 0.3s ease;
}

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

.game-controls {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(20px);
    padding: 0.6rem 1rem 0.9rem 1rem;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    z-index: 20;
    width: 80%;
    max-width: 500px;
    touch-action: auto; /* Allow touch on controls */
}

.options-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
    margin-bottom: 0;
}

.next-location-btn {
    width: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
    padding: 0.5rem;
    border-radius: 4px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 0.5rem;
    margin-bottom: 0;
}

.next-location-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.5);
}

.option-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 0.6rem 0.4rem;
    border-radius: 8px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.option-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.3);
}

.option-btn.correct {
    background: linear-gradient(135deg, #4ade80 0%, #22c55e 100%);
    border-color: #22c55e;
    animation: pulse 0.3s ease;
    color: white;
}

.option-btn.incorrect {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    border-color: #dc2626;
    animation: shake 0.3s ease;
    color: white;
}

.option-btn:disabled {
    cursor: not-allowed;
}

@keyframes pulse {
    0% { 
        transform: scale(1);
    }
    50% { 
        transform: scale(1.05);
    }
    100% { 
        transform: scale(1);
    }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* Results Screen */
.results-screen {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(20px);
    z-index: 1000;
    overflow-y: auto;
    padding: 2rem;
}

.results-screen.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.results-content {
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 3rem;
    max-width: 600px;
    width: 100%;
    text-align: center;
}

.results-title {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.results-stars {
    font-size: 4rem;
    margin: 1rem 0;
}

.results-score {
    font-size: 1.5rem;
    color: #888;
    margin-bottom: 2rem;
}

.results-rewards {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.reward-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.reward-item:last-child {
    border-bottom: none;
}

.reward-label {
    color: #888;
}

.reward-value {
    font-weight: bold;
    color: #667eea;
    font-size: 1.2rem;
}

.results-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 2rem;
    flex-wrap: wrap;
}

.results-actions .btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
    padding: 1rem 2rem;
    border-radius: 10px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 600;
    min-width: 150px;
}

.results-actions .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.5);
}

.results-actions .btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.results-actions .btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Combo Display */
.combo-display {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 3rem;
    font-weight: bold;
    color: #ffd700;
    pointer-events: none;
    opacity: 0;
    z-index: 200;
}

.combo-display.show {
    animation: comboFloat 1s ease-out;
}

@keyframes comboFloat {
    0% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(0.5);
    }
    50% {
        transform: translate(-50%, -50%) scale(1.2);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(1) translateY(-50px);
    }
}

/* Missions Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border-radius: 20px;
    padding: 2rem;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

#exitChapterModal .modal-content h2 {
    text-align: center;
    margin-bottom: 0.75rem;
    font-size: 1.8rem;
}

#exitChapterModal .modal-content p {
    text-align: center;
    color: rgba(255, 255, 255, 0.8);
    margin: 0 0 1.5rem 0;
    line-height: 1.4;
}

.missions-modal h2 {
    text-align: center;
    margin-bottom: 1rem;
    font-size: 2rem;
}

.missions-timer {
    text-align: center;
    color: #888;
    margin-bottom: 2rem;
    font-size: 0.9rem;
}

.missions-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.mission-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 1.5rem;
    transition: all 0.2s ease;
}

.mission-card.completed {
    border-color: rgba(76, 175, 80, 0.5);
    background: rgba(76, 175, 80, 0.1);
}

.mission-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.mission-title {
    font-size: 1.1rem;
    font-weight: 600;
}

.mission-reward {
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
    color: #000;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-weight: bold;
    font-size: 0.9rem;
}

.mission-description {
    color: #aaa;
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
}

.mission-progress {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.mission-progress-bar {
    flex: 1;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
}

.mission-progress-fill {
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    transition: width 0.3s ease;
}

.mission-progress-fill.completed {
    background: linear-gradient(135deg, #4caf50 0%, #8bc34a 100%);
}

.mission-progress-text {
    font-size: 0.85rem;
    color: #888;
    min-width: 60px;
    text-align: right;
}

.mission-claim-btn {
    width: 100%;
    margin-top: 0.75rem;
    background: linear-gradient(135deg, #4caf50 0%, #8bc34a 100%);
    border: none;
    color: white;
    padding: 0.75rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.mission-claim-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(76, 175, 80, 0.5);
}

.mission-claim-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Action Buttons - Subtle with visible border */
.action-btn {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.85rem;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    color: rgba(255, 255, 255, 0.85);
    flex-shrink: 0;
    white-space: nowrap;
}

.action-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(102, 126, 234, 0.5);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
}

.action-btn .btn-icon {
    font-size: 0.9rem;
}

.action-btn .btn-text {
    font-size: 0.8rem;
}

/* Mobile Home Button (top left corner) */
.mobile-home-btn {
    display: none; /* Hidden by default on desktop */
    position: fixed;
    top: 0.6rem;
    left: 0.6rem;
    z-index: 1001;
    background: transparent;
    border: none;
    padding: 0.3rem;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.5);
    transition: color 0.2s ease;
}

.mobile-home-btn:active {
    color: rgba(255, 255, 255, 0.9);
}

/* Mobile Bottom Navigation Bar */
.mobile-bottom-nav {
    display: none; /* Hidden by default on desktop */
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(10, 10, 15, 0.98);
    backdrop-filter: blur(20px);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0.5rem 0.75rem;
    padding-bottom: calc(0.5rem + env(safe-area-inset-bottom, 0px));
    z-index: 1000;
    justify-content: space-around;
    align-items: center;
}

.bottom-nav-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
    padding: 0.5rem 1rem;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: 8px;
    min-width: 60px;
}

.bottom-nav-btn:active {
    background: rgba(102, 126, 234, 0.2);
    color: #ffffff;
}

.bottom-nav-icon {
    font-size: 1.3rem;
}

.bottom-nav-label {
    font-size: 0.65rem;
    font-weight: 500;
    letter-spacing: 0.3px;
}

.mobile-bottom-nav.hidden {
    display: none !important;
}

/* Profile Modal */
.profile-modal {
    max-width: 450px;
}

.profile-modal h2 {
    text-align: center;
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

.profile-name {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    font-size: 1.25rem;
    font-weight: 600;
}

.edit-name-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.edit-name-btn:hover {
    opacity: 1;
}

.profile-stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.profile-stat-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 1rem;
    text-align: center;
    transition: all 0.2s ease;
}

.profile-stat-card:hover {
    border-color: rgba(102, 126, 234, 0.4);
    transform: translateY(-2px);
}

.profile-stat-icon {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.profile-stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 0.25rem;
}

.profile-stat-label {
    font-size: 0.75rem;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.profile-progress-section {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.profile-progress-section h3 {
    font-size: 0.9rem;
    color: #888;
    margin-bottom: 0.75rem;
    font-weight: 500;
}

.profile-progress-bar-container {
    margin-bottom: 0.5rem;
}

.profile-progress-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    margin-bottom: 0.5rem;
    color: #a0aec0;
}

.profile-progress-bar {
    height: 10px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 5px;
    overflow: hidden;
}

.profile-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    border-radius: 5px;
    transition: width 0.5s ease;
}

.profile-level-section {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(102, 126, 234, 0.1);
    border: 1px solid rgba(102, 126, 234, 0.3);
    border-radius: 12px;
    padding: 1rem;
}

.profile-level-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    font-size: 1.1rem;
}

.profile-level-icon {
    font-size: 1.25rem;
}

.profile-xp-info {
    font-size: 0.9rem;
    color: #a0aec0;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .header {
        padding: 0.75rem 0.75rem 0.4rem;
        padding-top: max(0.75rem, env(safe-area-inset-top));
        gap: 0.4rem;
    }

    .header-top {
        justify-content: center;
    }

    .header-top .back-btn {
        display: none; /* Hide back button in header on mobile */
    }

    .header-bottom {
        flex-direction: row;
        gap: 0.5rem;
        justify-content: center;
    }

    .player-stats {
        width: auto;
        justify-content: center;
        gap: 0.5rem;
    }

    .header-actions {
        display: none; /* Hide action buttons in header on mobile */
    }

    /* Show mobile home button */
    .mobile-home-btn {
        display: block;
    }

    /* Compact world cards on mobile */
    .world-card {
        padding: 1rem 1.25rem;
    }
    
    .world-icon {
        font-size: 2rem;
        margin-bottom: 0.5rem;
    }
    
    .world-title {
        font-size: 1.2rem;
        margin-bottom: 0.25rem;
    }
    
    .world-description {
        font-size: 0.8rem;
        margin-bottom: 0.5rem;
        min-height: 2.4em;
    }
    
    .world-progress {
        margin-top: 0.5rem;
        padding-top: 0.5rem;
    }
    
    .world-stars {
        font-size: 1rem;
    }
    
    .world-difficulty {
        font-size: 0.7rem;
        padding: 0.2rem 0.5rem;
    }

    /* Hide mobile home button during gameplay and results */
    body.in-game .mobile-home-btn {
        display: none !important;
    }

    /* Hide game back button on mobile */
    .game-back-btn {
        display: none !important;
    }

    /* Show mobile bottom navigation */
    .mobile-bottom-nav {
        display: flex;
    }

    /* Add padding to body to account for bottom nav */
    body {
        padding-bottom: 70px;
    }

    .level-badge {
        padding: 0.4rem 0.75rem;
        font-size: 0.8rem;
        border-radius: 8px;
    }

    .level-badge-icon {
        font-size: 0.85rem;
    }

    .xp-bar-container {
        min-width: 80px;
        flex: 1;
        max-width: 120px;
    }

    .xp-bar-label {
        font-size: 0.6rem;
    }

    .xp-bar {
        height: 5px;
    }

    .coins-display {
        padding: 0.4rem 0.75rem;
        border-radius: 8px;
    }

    .coins-icon {
        font-size: 0.9rem;
    }

    .coins-amount {
        font-size: 0.85rem;
    }

    .profile-modal {
        max-width: 100%;
        margin: 0 0.5rem;
    }

    .profile-stats-grid {
        gap: 0.5rem;
    }

    .profile-stat-card {
        padding: 0.75rem;
    }

    .profile-stat-icon {
        font-size: 1.25rem;
    }

    .profile-stat-value {
        font-size: 1.1rem;
    }

    .dev-btn {
        padding: 0.4rem 0.75rem;
        font-size: 0.85rem;
    }

    .back-btn {
        padding: 0.4rem 0.75rem;
        font-size: 0.8rem;
    }

    .logo-icon {
        width: 32px;
        height: 32px;
        font-size: 1rem;
        border-radius: 8px;
    }

    .logo-text {
        font-size: 1rem;
    }

    .container {
        padding: 1rem;
    }

    .page-title {
        font-size: 2rem;
    }

    .worlds-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .chapters-grid {
        grid-template-columns: 1fr; /* 1 column on mobile */
        gap: 1rem;
    }
    
    .chapters-grid .chapter-card:last-child:nth-child(11) {
        grid-column: 1; /* Reset centering on mobile */
    }
    
    .chapter-card {
        padding: 1.2rem;
    }

    .game-controls {
        width: 100%;
        left: 0;
        transform: none;
        border-radius: 0;
        padding: 0.5rem 1rem 0.75rem 1rem;
        max-width: none;
        position: fixed;
        bottom: 0;
    }
    
    .options-grid {
        gap: 0.5rem;
    }
    
    .option-btn {
        padding: 0.75rem 0.5rem;
        font-size: 0.9rem;
        border-radius: 8px;
    }
    
    .next-location-btn {
        padding: 0.75rem;
        font-size: 1rem;
        border-radius: 8px;
        margin-top: 0.5rem;
    }
    
    .game-header {
        padding: 0.35rem 0.75rem;
        gap: 1rem;
        justify-content: space-between;
    }
    
    .game-header-left {
        display: none;
    }
    
    .game-header-center {
        gap: 1rem;
        flex: none;
        order: 2;
    }
    
    .game-header-right {
        gap: 0.75rem;
        flex: none;
        order: 1;
        flex-direction: row-reverse;
    }
    
    .question-number {
        order: 1;
    }
    
    .timer-display {
        order: 2;
    }
    
    .lives-display {
        font-size: 1rem;
    }
    
    .game-coins-display {
        padding: 0.2rem 0.5rem;
    }
    
    .game-coins-display .coins-icon {
        font-size: 0.9rem;
    }
    
    .game-coins-display .coins-amount {
        font-size: 0.85rem;
    }
    
    .timer-display {
        font-size: 1.1rem;
        min-width: 65px;
    }
    
    .question-number {
        font-size: 0.75rem;
    }
    
    .power-ups-row {
        gap: 0.6rem;
        margin-bottom: 0.5rem;
        padding-bottom: 0.5rem;
        justify-content: center;
    }
    
    .power-up-btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
        flex: 1;
    }

    .results-content {
        padding: 2rem 1rem;
    }

    .results-actions {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }
}

/* Tablet Responsive */
@media (min-width: 481px) and (max-width: 768px) {
    .chapters-grid {
        grid-template-columns: repeat(2, 1fr); /* 2 columns on tablet */
    }
    
    .chapters-grid .chapter-card:last-child:nth-child(11) {
        grid-column: 1 / -1; /* Full width centered on tablet */
        max-width: 50%;
        justify-self: center;
    }
}

/* Small mobile */
@media (max-width: 480px) {
    .header {
        padding: 1rem 0.5rem 0.3rem;
        padding-top: max(1rem, env(safe-area-inset-top));
        gap: 0.8rem;
    }

    .header-top {
        gap: 0.5rem;
    }

    .player-stats {
        gap: 0.4rem;
    }

    .header-actions {
        gap: 0.3rem;
    }

    .level-badge {
        padding: 0.3rem 0.5rem;
        font-size: 0.7rem;
    }

    .xp-bar-container {
        min-width: 50px;
        max-width: 80px;
    }

    .xp-bar-label {
        font-size: 0.5rem;
    }

    .coins-display {
        padding: 0.3rem 0.5rem;
    }

    .coins-amount {
        font-size: 0.75rem;
    }

    .action-btn {
        padding: 0.3rem 0.45rem;
        gap: 0.2rem;
    }

    .action-btn .btn-icon {
        font-size: 0.8rem;
    }

    .action-btn .btn-text {
        font-size: 0.6rem;
    }

    .back-btn {
        padding: 0.3rem 0.5rem;
        font-size: 0.7rem;
    }

    .logo-icon {
        width: 26px;
        height: 26px;
        font-size: 0.85rem;
    }

    .logo-text {
        font-size: 0.85rem;
    }

    .dev-btn {
        padding: 0.3rem 0.5rem;
        font-size: 0.7rem;
    }

    /* Bottom nav smaller on very small screens */
    .bottom-nav-btn {
        padding: 0.4rem 0.6rem;
        min-width: 50px;
    }

    .bottom-nav-icon {
        font-size: 1.1rem;
    }

    .bottom-nav-label {
        font-size: 0.55rem;
    }

    .profile-stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.4rem;
    }

    .profile-stat-card {
        padding: 0.6rem;
    }

    .profile-stat-icon {
        font-size: 1.1rem;
        margin-bottom: 0.3rem;
    }

    .profile-stat-value {
        font-size: 1rem;
    }

    .profile-stat-label {
        font-size: 0.65rem;
    }

    .dev-btn {
        padding: 0.35rem 0.5rem;
        font-size: 0.75rem;
    }

    .back-btn {
        padding: 0.35rem 0.5rem;
        font-size: 0.75rem;
    }

    .logo-icon {
        width: 28px;
        height: 28px;
        font-size: 0.9rem;
    }

    .logo-text {
        font-size: 0.9rem;
    }

    .chapters-grid {
        grid-template-columns: 1fr; /* 1 column on small mobile */
    }
    
    .chapter-subtitle {
        margin-top: -16px;
    }
    
    .chapters-header .page-title {
        font-size: 1.4rem;
    }
    
    .game-controls {
        padding: 0.5rem 0.75rem 0.6rem 0.75rem;
    }
    
    .options-grid {
        gap: 0.4rem;
    }
    
    .option-btn {
        padding: 0.6rem 0.4rem;
        font-size: 0.85rem;
        border-radius: 8px;
    }
    
    .next-location-btn {
        padding: 0.6rem;
        font-size: 0.95rem;
    }
    
    .game-header {
        padding: 0.3rem 0.5rem;
    }
    
    .game-header-center {
        gap: 1rem;
        flex-wrap: nowrap;
    }
    
    .lives-display {
        font-size: 0.9rem;
        gap: 0.15rem;
        flex-shrink: 0;
        white-space: nowrap;
    }
    
    .game-coins-display {
        flex-shrink: 0;
        white-space: nowrap;
        padding: 0.15rem 0.4rem;
    }
    
    .game-coins-display .coins-icon {
        font-size: 0.8rem;
    }
    
    .game-coins-display .coins-amount {
        font-size: 0.75rem;
    }
    
    .timer-display {
        font-size: 1rem;
        min-width: 40px;
    }
    
    .question-number {
        font-size: 0.7rem;
    }
    
    .power-ups-row {
        gap: 0.5rem;
        margin-bottom: 0.4rem;
        padding-bottom: 0.4rem;
        justify-content: center;
        margin-left: -1rem;
        margin-right: -1rem;
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    .power-up-btn {
        padding: 0.35rem 0.5rem;
        font-size: 0.65rem;
        flex: 1;
        flex-basis: 0;
        min-width: 0;
    }
    
    .hint-display {
        padding: 0.35rem 0.5rem;
        font-size: 0.75rem;
        margin-bottom: 0.35rem;
    }
    
    /* Results screen - compact for mobile */
    .results-content {
        padding: 1rem 0.75rem;
    }
    
    .results-title {
        font-size: 1.5rem;
        margin-bottom: 0.25rem;
    }
    
    .results-stars {
        font-size: 2rem;
        margin: 0.25rem 0;
    }
    
    .results-score {
        font-size: 1rem;
        margin-bottom: 0.5rem;
    }
    
    .results-rewards {
        padding: 0.75rem;
        margin-bottom: 0.75rem;
    }
    
    .reward-item {
        padding: 0.35rem 0;
    }
    
    .results-actions {
        margin-top: 0.75rem;
        gap: 0.5rem;
    }
    
    .results-actions .btn {
        padding: 0.75rem 1.5rem;
        font-size: 0.9rem;
        min-width: 120px;
    }
}

/* BOSS CHAPTER STYLES - Premium Look */
.chapter-card.boss {
    border: 2px solid #ffd700;
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.3);
    overflow: hidden;
    position: relative;
}

/* Override the standard image background for boss cards */
.chapter-card.boss::before {
    background-image: linear-gradient(135deg, #2c0b45 0%, #5e1b32 50%, #b8860b 100%) !important;
    background-size: 200% 200% !important;
    animation: bossGradient 5s ease infinite !important;
    transform: none !important; /* No zoom effect needed */
    opacity: 0.9;
}

.chapter-card.boss:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 0 25px rgba(255, 215, 0, 0.6);
    border-color: #fff;
}

.chapter-card.boss .chapter-number {
    color: #ffd700;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

.chapter-crown {
    font-size: 2rem;
    margin-bottom: 0.25rem;
}

.chapter-card.boss .chapter-name {
    background: linear-gradient(180deg, #fff 0%, #ffd700 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-size: 1.3rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

@keyframes bossGradient {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Global Ranking Modal */
.ranking-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    /* No animation - appears immediately to prevent flash */
}

.ranking-modal {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border: 2px solid #667eea;
    border-radius: 16px;
    width: 90%;
    max-width: 450px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(102, 126, 234, 0.3);
}

.ranking-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.ranking-header h2 {
    margin: 0;
    color: white;
    font-size: 1.3rem;
}

.close-ranking-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.close-ranking-btn:hover {
    color: white;
}

.ranking-player-score {
    background: rgba(102, 126, 234, 0.2);
    padding: 1rem;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.your-score {
    color: white;
    font-size: 1.1rem;
    margin-bottom: 0.25rem;
}

.score-value {
    color: #ffd700;
    font-weight: bold;
    font-size: 1.3rem;
}

.your-stars {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
}

.your-rank {
    color: #4ade80;
    font-weight: bold;
    margin-top: 0.25rem;
}

.ranking-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
}

.no-rankings {
    text-align: center;
    color: rgba(255, 255, 255, 0.5);
    padding: 2rem;
}

.ranking-item {
    display: flex;
    align-items: center;
    padding: 0.6rem 0.75rem;
    border-radius: 8px;
    margin-bottom: 0.4rem;
    background: rgba(255, 255, 255, 0.05);
    transition: background 0.2s ease;
}

.ranking-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.ranking-item.current-player {
    background: rgba(102, 126, 234, 0.3);
    border: 1px solid rgba(102, 126, 234, 0.5);
}

.ranking-position {
    width: 40px;
    font-size: 1rem;
    font-weight: bold;
    color: rgba(255, 255, 255, 0.8);
}

.ranking-info {
    flex: 1;
}

.ranking-name {
    color: white;
    font-weight: 500;
    font-size: 0.95rem;
}

.ranking-details {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.75rem;
}

.ranking-score {
    color: #ffd700;
    font-weight: bold;
    font-size: 1rem;
}

.ranking-footer {
    padding: 0.75rem 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
}

.score-formula {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.7rem;
}

.max-score {
    color: rgba(255, 215, 0, 0.7);
    font-size: 0.7rem;
    margin-top: 0.25rem;
}

/* Welcome Modal */
.welcome-modal {
    text-align: center;
    padding: 2rem;
    max-width: 400px;
}

.welcome-modal h2 {
    color: white;
    margin-bottom: 0.5rem;
    font-size: 1.5rem;
}

.welcome-subtitle {
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
}

.name-input-container {
    margin-bottom: 1.5rem;
}

.name-input-container label {
    display: block;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.name-input-container input {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1.1rem;
    border: 2px solid rgba(102, 126, 234, 0.5);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    text-align: center;
    outline: none;
    transition: border-color 0.2s ease;
}

.name-input-container input:focus {
    border-color: #667eea;
}

.name-input-container input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.start-campaign-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 1rem 2rem;
    font-size: 1.1rem;
    font-weight: bold;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
}

.start-campaign-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.5);
}

.start-campaign-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Next Chapter Confirmation Modal */
.next-chapter-modal {
    width: 95%;
    max-width: 500px;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.5);
    animation: modalSlideIn 0.3s ease-out;
}

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

.next-chapter-cover {
    position: relative;
    height: 400px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.next-chapter-cover::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: -30px; /* Extend beyond container to hide watermark */
    background: inherit;
    background-size: cover;
    background-position: center;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
    z-index: 0;
}

.next-chapter-gradient {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to bottom,
        rgba(0, 0, 0, 0.1) 0%,
        rgba(0, 0, 0, 0.3) 40%,
        rgba(0, 0, 0, 0.85) 100%
    );
}

.next-chapter-text {
    position: relative;
    z-index: 1;
    width: 100%;
    padding: 2.5rem 1.5rem 1rem 1.5rem;
    text-align: center;
}

.next-chapter-stats-wrapper {
    position: relative;
    z-index: 1;
    width: 100%;
    padding: 1rem 1.5rem 1.5rem 1.5rem;
    text-align: center;
}

.next-chapter-badge {
    display: inline-block;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 0.4rem 1rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.75rem;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.next-chapter-title {
    color: white;
    font-size: 1.6rem;
    font-weight: 700;
    margin: 0 0 0.25rem 0;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.next-chapter-crown {
    font-size: 2.5rem;
    margin: 0.5rem 0;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.next-chapter-subtitle {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.95rem;
    margin: 0;
}

.next-chapter-stats {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.next-chapter-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.next-chapter-stat .stat-value {
    font-size: 1.4rem;
    font-weight: 700;
    color: white;
}

.next-chapter-stat .stat-label {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.7);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.next-chapter-divider {
    width: 1px;
    height: 30px;
    background: rgba(255, 255, 255, 0.3);
}

.next-chapter-actions {
    display: flex;
    background: rgba(15, 15, 35, 0.95);
    padding: 1rem;
    gap: 0.75rem;
}

.next-chapter-actions .btn-back {
    flex: 1;
    padding: 0.9rem 1rem;
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: transparent;
    color: rgba(255, 255, 255, 0.7);
}

.next-chapter-actions .btn-back:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.next-chapter-actions .btn-start {
    flex: 2;
    padding: 0.9rem 1.5rem;
    font-size: 1rem;
    font-weight: 700;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.next-chapter-actions .btn-start:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(102, 126, 234, 0.5);
}

/* Mobile adjustments for next chapter modal */
@media (max-width: 480px) {
    .next-chapter-modal {
        width: 95%;
        max-width: 95%;
    }
    
    .next-chapter-cover {
        height: 350px;
    }
    
    .next-chapter-title {
        font-size: 1.4rem;
    }
    
    .next-chapter-stats {
        gap: 1rem;
        padding: 0.6rem 1rem;
    }
    
    .next-chapter-stat .stat-value {
        font-size: 1.2rem;
    }
}

/* Google Sign-In Section */
.profile-account-section {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
}

.account-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    color: #888;
    font-size: 0.9rem;
}

.account-status.signed-in {
    color: #48bb78;
}

.account-status.signed-in .account-icon {
    color: #48bb78;
}

.google-signin-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.75rem 1rem;
    background: #fff;
    color: #333;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.google-signin-btn:hover {
    background: #f5f5f5;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.google-signin-btn.signed-in {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.google-signin-btn.signed-in:hover {
    background: rgba(239, 68, 68, 0.2);
}

.account-benefit {
    margin-top: 0.75rem;
    font-size: 0.8rem;
    color: #666;
}

.account-benefit.hidden {
    display: none;
}

/* Save Progress Popup */
.save-progress-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 2100;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s ease;
}

.save-progress-overlay.active {
    display: flex;
}

.save-progress-popup {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border-radius: 20px;
    padding: 2rem;
    max-width: 380px;
    width: 90%;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: scaleIn 0.3s ease;
}

.save-progress-icon {
    font-size: 3.5rem;
    margin-bottom: 1rem;
}

.save-progress-title {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.save-progress-text {
    font-size: 0.95rem;
    color: #aaa;
    line-height: 1.5;
    margin-bottom: 1.25rem;
}

.save-progress-benefits {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    text-align: left;
    padding: 0 1rem;
}

.save-progress-benefits span {
    font-size: 0.9rem;
    color: #48bb78;
}

.save-progress-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.save-progress-btn {
    padding: 0.85rem 1.5rem;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

.save-progress-google {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    background: #fff;
    color: #333;
}

.save-progress-google:hover {
    background: #f5f5f5;
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(255, 255, 255, 0.2);
}

.save-progress-later {
    background: transparent;
    color: #888;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.save-progress-later:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

@media (max-width: 480px) {
    .save-progress-popup {
        padding: 1.5rem;
        margin: 1rem;
    }
    
    .save-progress-icon {
        font-size: 3rem;
    }
    
    .save-progress-title {
        font-size: 1.25rem;
    }
    
    .save-progress-text {
        font-size: 0.9rem;
    }
    
    .save-progress-btn {
        padding: 0.75rem 1rem;
        font-size: 0.95rem;
    }
}

/* Tutorial Popup */
.tutorial-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 2000;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s ease;
}

.tutorial-overlay.active {
    display: flex;
}

.tutorial-popup {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border-radius: 20px;
    padding: 2rem;
    max-width: 400px;
    width: 90%;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: scaleIn 0.3s ease;
}

.tutorial-slide {
    display: none;
}

.tutorial-slide.active {
    display: block;
}

.tutorial-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.tutorial-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.tutorial-text {
    font-size: 1rem;
    color: #ccc;
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

.tutorial-text strong {
    color: #fff;
}

.tutorial-example {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    background: rgba(0, 0, 0, 0.3);
    padding: 1rem;
    border-radius: 10px;
    margin-bottom: 1rem;
}

.tutorial-example span {
    font-size: 0.95rem;
    color: #aaa;
}

.tutorial-navigation {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.tutorial-dots {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.tutorial-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    cursor: pointer;
    transition: all 0.2s ease;
}

.tutorial-dot.active {
    background: #48bb78;
    transform: scale(1.2);
}

.tutorial-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.tutorial-btn {
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

.tutorial-skip {
    background: transparent;
    color: #888;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.tutorial-skip:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.tutorial-next {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    min-width: 120px;
}

.tutorial-next:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

/* Mobile adjustments for tutorial */
@media (max-width: 480px) {
    .tutorial-popup {
        padding: 1.5rem;
        margin: 1rem;
    }
    
    .tutorial-icon {
        font-size: 3rem;
    }
    
    .tutorial-title {
        font-size: 1.25rem;
    }
    
    .tutorial-text {
        font-size: 0.9rem;
    }
    
    .tutorial-example span {
        font-size: 0.85rem;
    }
    
    .tutorial-btn {
        padding: 0.6rem 1rem;
        font-size: 0.9rem;
    }
}

/* World Complete Screen */
.world-complete-screen {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #0a0a0f 0%, #1a1a2e 50%, #16213e 100%);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.5s ease;
}

.world-complete-screen.active {
    display: flex;
}

.world-complete-content {
    text-align: center;
    padding: 2rem;
    max-width: 500px;
    animation: scaleIn 0.5s ease;
}

.world-complete-icon {
    font-size: 5rem;
    margin-bottom: 1rem;
    animation: bounce 1s ease infinite;
}

.world-complete-title {
    font-size: 2.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
}

.world-complete-subtitle {
    font-size: 1.2rem;
    color: #888;
    margin-bottom: 2rem;
}

.world-complete-stats {
    display: flex;
    justify-content: center;
    gap: 3rem;
    margin-bottom: 2rem;
}

.world-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.world-stat-value {
    font-size: 2.5rem;
    font-weight: 800;
    color: #ffd700;
}

.world-stat-label {
    font-size: 0.9rem;
    color: #888;
    text-transform: uppercase;
}

.world-complete-unlock {
    background: linear-gradient(135deg, rgba(72, 187, 120, 0.2) 0%, rgba(56, 161, 105, 0.2) 100%);
    border: 1px solid rgba(72, 187, 120, 0.5);
    border-radius: 12px;
    padding: 1rem 2rem;
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
}

.unlock-icon {
    font-size: 1.5rem;
}

.unlock-text {
    font-size: 1.1rem;
    font-weight: 600;
    color: #48bb78;
}

.world-complete-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.world-complete-actions .btn {
    padding: 1rem 2rem;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    min-width: 250px;
}

.world-complete-actions .btn-primary {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(72, 187, 120, 0.4);
}

.world-complete-actions .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(72, 187, 120, 0.5);
}

.world-complete-actions .btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.world-complete-actions .btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border-color: rgba(255, 255, 255, 0.3);
}

/* Game Complete Screen (Final) */
.game-complete-screen {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse at center, #1a1a3e 0%, #0d0d1a 50%, #000 100%);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    overflow-y: auto;
}

.game-complete-screen.active {
    display: flex;
}

/* Animated background particles */
.particles-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(2px 2px at 20px 30px, #ffd700, transparent),
        radial-gradient(2px 2px at 40px 70px, #fff, transparent),
        radial-gradient(2px 2px at 50px 160px, #ffd700, transparent),
        radial-gradient(2px 2px at 90px 40px, #fff, transparent),
        radial-gradient(2px 2px at 130px 80px, #ffd700, transparent),
        radial-gradient(2px 2px at 160px 120px, #fff, transparent),
        radial-gradient(2px 2px at 200px 50px, #ffd700, transparent),
        radial-gradient(2px 2px at 250px 90px, #fff, transparent),
        radial-gradient(2px 2px at 300px 150px, #ffd700, transparent);
    background-repeat: repeat;
    background-size: 350px 200px;
    animation: twinkle 4s ease-in-out infinite;
    opacity: 0.6;
}

@keyframes twinkle {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 0.8; }
}

/* Confetti container */
.confetti-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
}

.game-complete-content {
    text-align: center;
    padding: 2rem;
    max-width: 600px;
    animation: epicEntrance 1s ease-out;
    position: relative;
    z-index: 10;
}

@keyframes epicEntrance {
    0% { 
        transform: scale(0.3) translateY(50px); 
        opacity: 0; 
    }
    50% { 
        transform: scale(1.1) translateY(-10px); 
    }
    100% { 
        transform: scale(1) translateY(0); 
        opacity: 1; 
    }
}

/* Trophy badge with glow */
.game-complete-badge {
    position: relative;
    display: inline-block;
    margin-bottom: 1rem;
}

.badge-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 150px;
    height: 150px;
    background: radial-gradient(circle, rgba(255, 215, 0, 0.4) 0%, transparent 70%);
    border-radius: 50%;
    animation: glowPulse 2s ease-in-out infinite;
}

@keyframes glowPulse {
    0%, 100% { 
        transform: translate(-50%, -50%) scale(1); 
        opacity: 0.6; 
    }
    50% { 
        transform: translate(-50%, -50%) scale(1.3); 
        opacity: 1; 
    }
}

.game-complete-trophy {
    font-size: 5rem;
    position: relative;
    z-index: 2;
    animation: trophyBounce 1s ease-in-out infinite;
    filter: drop-shadow(0 0 20px rgba(255, 215, 0, 0.5));
}

@keyframes trophyBounce {
    0%, 100% { transform: translateY(0) rotate(-3deg); }
    50% { transform: translateY(-10px) rotate(3deg); }
}

.game-complete-title {
    font-size: 2.5rem;
    font-weight: 900;
    background: linear-gradient(135deg, #ffd700 0%, #ffaa00 30%, #ff6b00 60%, #ffd700 100%);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
    animation: shimmer 3s linear infinite;
}

@keyframes shimmer {
    0% { background-position: 0% center; }
    100% { background-position: 200% center; }
}

.game-complete-subtitle {
    font-size: 1.2rem;
    color: #b8b8d1;
    margin-bottom: 1rem;
    animation: fadeInUp 0.8s ease-out 0.3s both;
}

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

/* Achievement badge */
.game-complete-achievement {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.2) 0%, rgba(255, 140, 0, 0.2) 100%);
    border: 2px solid #ffd700;
    border-radius: 50px;
    padding: 0.5rem 1.5rem;
    margin-bottom: 1.5rem;
    animation: achievementPop 0.6s ease-out 0.5s both;
}

@keyframes achievementPop {
    0% { 
        transform: scale(0); 
        opacity: 0; 
    }
    70% { 
        transform: scale(1.2); 
    }
    100% { 
        transform: scale(1); 
        opacity: 1; 
    }
}

.achievement-icon {
    font-size: 1.5rem;
    animation: crownFloat 2s ease-in-out infinite;
}

@keyframes crownFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

.achievement-text {
    font-size: 1rem;
    font-weight: 800;
    color: #ffd700;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.game-complete-stats {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    animation: fadeInUp 0.8s ease-out 0.6s both;
}

.final-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.02) 100%);
    padding: 1rem 1.5rem;
    border-radius: 16px;
    border: 1px solid rgba(255, 215, 0, 0.3);
    backdrop-filter: blur(10px);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.final-stat:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(255, 215, 0, 0.2);
}

.final-stat-icon {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.final-stat-value {
    font-size: 2rem;
    font-weight: 800;
    color: #ffd700;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.final-stat-label {
    font-size: 0.75rem;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.game-complete-message {
    font-size: 1.1rem;
    color: #4ade80;
    margin-bottom: 1.5rem;
    font-weight: 500;
    animation: fadeInUp 0.8s ease-out 0.8s both;
}

.game-complete-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-width: 280px;
    margin: 0 auto;
    animation: fadeInUp 0.8s ease-out 1s both;
}

.game-complete-actions .btn {
    padding: 1rem 2rem;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    width: 100%;
}

.game-complete-actions .btn-primary {
    background: linear-gradient(135deg, #ffd700 0%, #ffaa00 50%, #ff8c00 100%);
    color: #1a1a2e;
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.3);
}

.game-complete-actions .btn-primary:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 8px 25px rgba(255, 215, 0, 0.5);
}

.game-complete-actions .btn-secondary {
    background: linear-gradient(135deg, #374151 0%, #1f2937 100%);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.game-complete-actions .btn-secondary:hover {
    transform: translateY(-3px);
    background: linear-gradient(135deg, #4b5563 0%, #374151 100%);
    box-shadow: 0 8px 20px rgba(55, 65, 81, 0.5);
}

/* Animations */
@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

@keyframes scaleIn {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

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

/* Mobile adjustments */
@media (max-width: 768px) {
    .world-complete-title {
        font-size: 2rem;
    }
    
    .world-complete-icon {
        font-size: 4rem;
    }
    
    .world-stat-value {
        font-size: 2rem;
    }
    
    .game-complete-title {
        font-size: 2rem;
    }
    
    .game-complete-trophy {
        font-size: 4rem;
    }
    
    .final-stat {
        padding: 1rem 1.5rem;
    }
    
    .final-stat-value {
        font-size: 2rem;
    }
    
    .game-complete-stats {
        gap: 0.75rem;
    }
    
    .game-complete-content {
        padding: 1rem;
    }
    
    .game-complete-subtitle {
        font-size: 1rem;
        margin-bottom: 1rem;
    }
    
    .game-complete-message {
        font-size: 1rem;
        margin-bottom: 1rem;
    }
}

/* Extra small screens (height) */
@media (max-height: 650px) {
    .game-complete-trophy {
        font-size: 3rem;
        margin-bottom: 0.5rem;
    }
    
    .game-complete-title {
        font-size: 1.5rem;
    }
    
    .game-complete-subtitle {
        font-size: 0.9rem;
        margin-bottom: 0.75rem;
    }
    
    .game-complete-stats {
        gap: 0.5rem;
        margin-bottom: 1rem;
    }
    
    .final-stat {
        padding: 0.75rem 1rem;
    }
    
    .final-stat-value {
        font-size: 1.5rem;
    }
    
    .final-stat-label {
        font-size: 0.7rem;
    }
    
    .game-complete-message {
        font-size: 0.9rem;
        margin-bottom: 0.75rem;
    }
    
    .game-complete-actions .btn {
        padding: 0.75rem 1.5rem;
        font-size: 0.9rem;
    }
}

/* ==================== How to Play Modal ==================== */
.how-to-play-modal {
    max-width: 600px;
    max-height: 85vh;
    overflow-y: auto;
    padding: 1.5rem;
}

.how-to-play-modal h2 {
    text-align: center;
    font-size: 1.75rem;
    margin-bottom: 1.5rem;
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.htp-content {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.htp-section {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 1rem 1.25rem;
}

.htp-section h3 {
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
    color: #ffffff;
}

.htp-section p {
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.5;
    margin: 0;
}

.htp-section ul {
    margin: 0;
    padding-left: 1.25rem;
    color: rgba(255, 255, 255, 0.8);
}

.htp-section li {
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.htp-section li:last-child {
    margin-bottom: 0;
}

.htp-section li strong {
    color: #ffffff;
}

.stars-explanation {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.star-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.5rem 0.75rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
}

.star-row span:first-child {
    min-width: 60px;
}

.star-row span:last-child {
    color: rgba(255, 255, 255, 0.8);
}

.htp-close-btn {
    width: 100%;
    margin-top: 1.5rem;
    padding: 1rem;
    font-size: 1.1rem;
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    border: none;
    border-radius: 10px;
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.htp-close-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(72, 187, 120, 0.4);
}

/* Full guide link */
.htp-footer {
    text-align: center;
    margin: 1rem 0;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.htp-full-guide-link {
    color: #48bb78;
    text-decoration: none;
    font-size: 0.95rem;
    transition: color 0.2s;
}

.htp-full-guide-link:hover {
    color: #68d391;
    text-decoration: underline;
}

/* Help button style */
.help-btn {
    background: rgba(72, 187, 120, 0.15) !important;
    border-color: rgba(72, 187, 120, 0.3) !important;
}

.help-btn:hover {
    background: rgba(72, 187, 120, 0.25) !important;
    border-color: rgba(72, 187, 120, 0.5) !important;
}

/* Mobile adjustments for How to Play */
@media (max-width: 480px) {
    .how-to-play-modal {
        padding: 1rem;
        max-height: 90vh;
    }
    
    .how-to-play-modal h2 {
        font-size: 1.5rem;
        margin-bottom: 1rem;
    }
    
    .htp-content {
        gap: 1rem;
    }
    
    .htp-section {
        padding: 0.875rem 1rem;
    }
    
    .htp-section h3 {
        font-size: 1rem;
    }
    
    .htp-section p,
    .htp-section li {
        font-size: 0.9rem;
    }
    
    .star-row {
        padding: 0.4rem 0.6rem;
        font-size: 0.9rem;
    }
    
    .htp-close-btn {
        padding: 0.875rem;
        font-size: 1rem;
    }
}
