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

body {
    font-family: 'Fredoka', sans-serif;
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    overflow-x: hidden;
    overflow-y: auto;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    margin: 0;
    padding: 0;
    width: 100vw;
    min-height: 100vh;
}

#game-container {
    position: relative;
    width: 100vw;
    min-height: 100vh;
    z-index: 10;
    overflow-x: hidden;
    overflow-y: auto;
}

.world-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    outline: none;
}

/* Loading Screen */
.loading-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-content {
    text-align: center;
    color: white;
    max-width: 400px;
    padding: 40px;
}

.loading-airplane {
    font-size: 4rem;
    animation: fly 2s ease-in-out infinite;
    margin-bottom: 20px;
}

@keyframes fly {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-20px) rotate(5deg); }
}

.loading-content h2 {
    font-size: 2rem;
    margin-bottom: 20px;
    font-weight: 600;
}

.loading-bar {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 15px;
}

.loading-progress {
    height: 100%;
    background: linear-gradient(90deg, #00f2fe, #4facfe);
    border-radius: 4px;
    width: 0%;
    transition: width 0.3s ease;
}

.loading-content p {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* Main Menu */
.main-menu {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    min-height: 100vh;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    z-index: 100;
    padding: 20px;
    overflow-y: auto;
    overflow-x: hidden;
    box-sizing: border-box;
}

.menu-header {
    text-align: center;
    margin-bottom: 30px;
}

.game-title {
    font-size: 3.5rem;
    color: #fff;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    margin-bottom: 10px;
    font-weight: 700;
}

.game-subtitle {
    font-size: 1.3rem;
    color: #b0e0ff;
    font-weight: 400;
}

.menu-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
    max-width: 800px;
    width: 100%;
}

.travel-journal {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 25px;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.travel-journal h3 {
    font-size: 1.5rem;
    color: #333;
    margin-bottom: 15px;
    font-weight: 600;
}

.stamps-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 15px;
}

.stamp-slot {
    width: 80px;
    height: 80px;
    border: 3px dashed #ddd;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f9f9f9;
    font-size: 0.9rem;
    color: #666;
    transition: all 0.3s ease;
}

.stamp-slot.collected {
    border: 3px solid #10b981;
    background: #d1fae5;
    color: #065f46;
    font-weight: 600;
}

.progress-text {
    font-size: 1.1rem;
    color: #333;
    font-weight: 500;
}

.destinations-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
    width: 100%;
    max-width: 600px;
}

.destination-card {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 15px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.destination-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
    border-color: #4facfe;
}

.destination-card.completed {
    background: #d1fae5;
    border-color: #10b981;
}

.destination-card.locked {
    opacity: 0.6;
    cursor: not-allowed;
}

.destination-card.locked:hover {
    transform: none;
    box-shadow: none;
}

.destination-flag {
    font-size: 2.5rem;
    margin-bottom: 10px;
    display: block;
}

.destination-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
}

.destination-country {
    font-size: 0.9rem;
    color: #666;
}

.menu-buttons {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    justify-content: center;
}

.menu-button {
    background: linear-gradient(135deg, #4facfe, #00f2fe);
    color: white;
    border: none;
    padding: 15px 25px;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Fredoka', sans-serif;
    box-shadow: 0 4px 15px rgba(79, 172, 254, 0.4);
}

.menu-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(79, 172, 254, 0.5);
}

.menu-button.start-tour {
    background: linear-gradient(135deg, #10b981, #059669);
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4);
}

/* Game UI */
.game-ui {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    pointer-events: none;
    z-index: 50;
    overflow-y: auto;
}

.ui-top {
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    pointer-events: auto;
}

.current-location {
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 10px 20px;
    border-radius: 25px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.1rem;
    font-weight: 600;
    backdrop-filter: blur(10px);
}

.location-flag {
    font-size: 1.5rem;
}

.tour-progress {
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 10px 20px;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 500;
    backdrop-filter: blur(10px);
}

.ui-controls {
    position: absolute;
    top: 50%;
    right: 20px;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 15px;
    border-radius: 15px;
    text-align: center;
    font-size: 0.9rem;
    backdrop-filter: blur(10px);
    pointer-events: auto;
}

.movement-guide p {
    margin-bottom: 5px;
}

.ui-bottom {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 15px;
    pointer-events: auto;
}

.ui-button {
    background: rgba(0, 0, 0, 0.8);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    font-family: 'Fredoka', sans-serif;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.ui-button:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: translateY(-2px);
}

.ui-button:active {
    transform: translateY(0);
}

/* Modals */
.modal {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    min-height: 100vh;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    backdrop-filter: blur(5px);
    overflow-y: auto;
    padding: 20px 0;
    box-sizing: border-box;
}

.modal-content {
    background: white;
    border-radius: 25px;
    padding: 30px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: #f0f0f0;
}

.landmark-info h2 {
    font-size: 2rem;
    color: #333;
    margin-bottom: 15px;
    font-weight: 700;
}

.country-info {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 10px;
}

.country-flag {
    font-size: 2rem;
}

.capital {
    font-size: 0.9rem;
    color: #666;
    margin-left: auto;
}

.fun-facts h3 {
    font-size: 1.3rem;
    color: #333;
    margin-bottom: 10px;
    font-weight: 600;
}

.fun-facts ul {
    list-style: none;
    padding: 0;
}

.fun-facts li {
    background: #e3f2fd;
    padding: 8px 12px;
    margin-bottom: 5px;
    border-radius: 8px;
    color: #1565c0;
    font-weight: 500;
}

.quiz-section {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px solid #eee;
}

.quiz-section h3 {
    font-size: 1.3rem;
    color: #333;
    margin-bottom: 15px;
    font-weight: 600;
}

.quiz-question {
    font-size: 1.1rem;
    color: #333;
    margin-bottom: 15px;
    font-weight: 500;
}

.quiz-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.quiz-option {
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    padding: 10px 15px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    font-family: 'Fredoka', sans-serif;
    transition: all 0.3s ease;
}

.quiz-option:hover {
    background: #e3f2fd;
    border-color: #2196f3;
}

.quiz-option.correct {
    background: #d4edda;
    border-color: #28a745;
    color: #155724;
}

.quiz-option.incorrect {
    background: #f8d7da;
    border-color: #dc3545;
    color: #721c24;
}

.quiz-result {
    margin-top: 15px;
    padding: 10px;
    border-radius: 8px;
    font-weight: 600;
    text-align: center;
}

.quiz-result.correct {
    background: #d4edda;
    color: #155724;
}

.quiz-result.incorrect {
    background: #f8d7da;
    color: #721c24;
}

/* Success Modal */
.success-content {
    text-align: center;
}

.success-animation {
    font-size: 4rem;
    animation: bounce 0.6s ease infinite alternate;
    margin-bottom: 20px;
}

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

.success-content h2 {
    font-size: 2rem;
    color: #10b981;
    margin-bottom: 20px;
    font-weight: 700;
}

.collected-stamp {
    background: linear-gradient(135deg, #d1fae5, #a7f3d0);
    border: 3px solid #10b981;
    border-radius: 15px;
    padding: 20px;
    margin: 20px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 1.2rem;
    font-weight: 600;
}

.stamp-flag {
    font-size: 2rem;
}

/* Complete Modal */
.complete-content {
    text-align: center;
}

.complete-animation {
    font-size: 4rem;
    animation: spin 2s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.complete-content h2 {
    font-size: 2.5rem;
    color: #f59e0b;
    margin-bottom: 20px;
    font-weight: 700;
}

.final-stamps {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin: 20px 0;
}

.completion-stats {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 10px;
    margin: 20px 0;
}

.completion-stats p {
    margin-bottom: 5px;
    font-weight: 500;
}

.modal-button {
    background: linear-gradient(135deg, #4facfe, #00f2fe);
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    font-family: 'Fredoka', sans-serif;
    margin: 0 5px;
    transition: all 0.3s ease;
}

.modal-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(79, 172, 254, 0.4);
}

.modal-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 20px;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

/* Player Stats */
.player-stats {
    display: flex;
    gap: 20px;
    margin-top: 10px;
    justify-content: center;
}

.stat {
    background: rgba(255, 255, 255, 0.1);
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 600;
    color: white;
    backdrop-filter: blur(10px);
}

/* Instructions Panel */
.instructions-panel {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.instructions-panel h3 {
    color: #333;
    margin-bottom: 15px;
    text-align: center;
}

.instructions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 10px;
}

.instruction {
    background: rgba(74, 172, 254, 0.1);
    padding: 12px;
    border-radius: 10px;
    color: #333;
    font-size: 14px;
    border-left: 4px solid #4facfe;
}

/* Game Stats in UI */
.game-stats {
    display: flex;
    gap: 15px;
    align-items: center;
}

.game-stats .stat {
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 6px 12px;
    border-radius: 15px;
    font-size: 14px;
    font-weight: 600;
}

/* Control Buttons */
.control-buttons {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.control-btn {
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.control-btn:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: translateY(-2px);
}

.controls-hint {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.controls-hint span {
    background: rgba(0, 0, 0, 0.6);
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

/* Leaderboard Styles */
.leaderboard-content {
    max-height: 400px;
    overflow-y: auto;
}

.leaderboard-entry {
    display: flex;
    align-items: center;
    padding: 12px;
    margin: 8px 0;
    background: rgba(74, 172, 254, 0.1);
    border-radius: 10px;
    transition: all 0.3s ease;
}

.leaderboard-entry:hover {
    background: rgba(74, 172, 254, 0.2);
    transform: translateX(5px);
}

.leaderboard-entry.current-player {
    background: rgba(255, 193, 7, 0.2);
    border: 2px solid #ffc107;
    font-weight: 600;
}

.leaderboard-entry .rank {
    width: 40px;
    text-align: center;
    font-weight: bold;
    font-size: 18px;
    color: #4facfe;
}

.leaderboard-entry .player-name {
    flex: 1;
    margin-left: 15px;
    font-weight: 500;
}

.leaderboard-entry .score {
    font-weight: bold;
    color: #28a745;
    font-size: 16px;
}

.new-record {
    color: #ffc107;
    font-weight: bold;
    animation: glow 2s ease-in-out infinite alternate;
}

@keyframes glow {
    from { text-shadow: 0 0 5px #ffc107; }
    to { text-shadow: 0 0 20px #ffc107, 0 0 30px #ffc107; }
}

/* Pulse animation for start button */
@keyframes pulse {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(74, 172, 254, 0.7); }
    70% { transform: scale(1.05); box-shadow: 0 0 0 10px rgba(74, 172, 254, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(74, 172, 254, 0); }
}

.fade-in {
    animation: fadeIn 0.5s ease forwards;
}

.fade-out {
    animation: fadeOut 0.5s ease forwards;
}

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

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

/* Responsive Design */
@media (max-width: 768px) {
    .game-title {
        font-size: 2.5rem;
    }
    
    .destinations-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .ui-bottom {
        bottom: 10px;
        flex-wrap: wrap;
        max-width: 90%;
    }
    
    .ui-button {
        padding: 10px 15px;
        font-size: 0.9rem;
    }
    
    .ui-controls {
        right: 10px;
        font-size: 0.8rem;
        padding: 10px;
    }
    
    .menu-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .menu-button {
        width: 100%;
        max-width: 300px;
    }
}

@media (max-width: 480px) {
    .stamps-container {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .stamp-slot {
        width: 70px;
        height: 70px;
        font-size: 0.8rem;
    }
    
    .destinations-grid {
        grid-template-columns: 1fr;
    }
    
    .modal-content {
        padding: 20px;
        margin: 10px;
    }
    
    .ui-top {
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }
}