* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    transition: background 0.3s, color 0.3s;
}

/* Dark Mode */
body.dark-mode {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: #e0e0e0;
}

body.dark-mode .welcome-card,
body.dark-mode .game-header,
body.dark-mode .map-section,
body.dark-mode .info-panel,
body.dark-mode .stats-container {
    background: #2d2d3a;
    color: #e0e0e0;
}

body.dark-mode .stat,
body.dark-mode .info-item,
body.dark-mode .achievement-card,
body.dark-mode .stat-card {
    background: #1f1f2e;
}

body.dark-mode .choice-btn {
    background: #3a3a4a;
    border-color: #4a4a5a;
    color: #e0e0e0;
}

body.dark-mode .choice-btn:hover {
    background: #4a4a5a;
}

/* Header */
header {
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

header .container {
    text-align: center;
    padding: 20px;
    position: relative;
}

header h1 {
    font-size: 2.5em;
    color: #667eea;
    margin-bottom: 5px;
}

.tagline {
    color: #666;
    font-size: 1.1em;
}

/* Header Controls */
.header-controls {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    gap: 10px;
}

.control-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 1.2em;
    cursor: pointer;
    transition: all 0.3s;
}

.control-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(20deg) scale(1.1);
}

.control-btn:active {
    transform: rotate(20deg) scale(0.95);
}

/* Screens */
.screen {
    display: none;
}

.screen.active {
    display: block;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* Welcome Card */
.welcome-card {
    background: white;
    border-radius: 15px;
    padding: 40px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.welcome-card h2 {
    font-size: 2em;
    color: #667eea;
    margin-bottom: 15px;
}

.welcome-card > p {
    font-size: 1.2em;
    color: #666;
    margin-bottom: 30px;
}

/* Game Modes */
.game-modes {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
    margin-bottom: 40px;
}

.game-mode-card {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border-radius: 12px;
    padding: 30px;
    text-align: center;
    transition: transform 0.3s, box-shadow 0.3s, background 0.3s;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.game-mode-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s;
}

.game-mode-card:hover::before {
    left: 100%;
}

.game-mode-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 30px rgba(102, 126, 234, 0.3);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.game-mode-card:hover h3,
.game-mode-card:hover p {
    color: white;
}

.game-mode-card .icon {
    font-size: 4em;
    margin-bottom: 15px;
}

.game-mode-card h3 {
    color: #333;
    margin-bottom: 10px;
    font-size: 1.5em;
}

.game-mode-card p {
    color: #666;
    margin-bottom: 20px;
    line-height: 1.6;
}

/* Buttons */
.btn-primary, .btn-secondary, .btn-map, .btn-hint, .btn-danger {
    padding: 12px 30px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 600;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5568d3;
    transform: scale(1.05);
}

.btn-secondary {
    background: #e0e0e0;
    color: #333;
}

.btn-secondary:hover {
    background: #d0d0d0;
}

.btn-danger {
    background: #f44336;
    color: white;
}

.btn-danger:hover {
    background: #da190b;
}

.btn-map {
    background: white;
    color: #333;
    padding: 8px 15px;
    font-size: 0.9em;
    margin: 5px;
}

.btn-map:hover {
    background: #f0f0f0;
}

.btn-hint {
    background: #ffa726;
    color: white;
    padding: 8px 16px;
    font-size: 0.9em;
    margin-bottom: 15px;
}

.btn-hint:hover {
    background: #fb8c00;
}

.btn-hint:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Progress Summary */
.progress-summary {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 25px;
    border-left: 4px solid #667eea;
}

.progress-summary h3 {
    color: #333;
    margin-bottom: 20px;
    font-size: 1.3em;
}

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
}

.stat {
    text-align: center;
    padding: 15px;
    background: white;
    border-radius: 8px;
}

.stat-label {
    display: block;
    color: #666;
    font-size: 0.9em;
    margin-bottom: 8px;
}

.stat-value {
    display: block;
    font-size: 1.8em;
    font-weight: bold;
    color: #667eea;
}

/* Game Screen */
.game-header {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.game-info {
    display: flex;
    gap: 20px;
    align-items: center;
    font-weight: 600;
    font-size: 1.1em;
}

.score-info {
    font-size: 1.2em;
    font-weight: bold;
    color: #667eea;
}

.game-container {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 20px;
    height: calc(100vh - 280px);
}

/* Map Section */
.map-section {
    background: white;
    border-radius: 12px;
    padding: 15px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: relative;
}

#map {
    width: 100%;
    height: calc(100% - 60px);
    border-radius: 8px;
}

.map-controls {
    margin-top: 10px;
    text-align: center;
}

/* Info Panel */
.info-panel {
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    overflow-y: auto;
}

#question-text {
    color: #333;
    margin-bottom: 25px;
    font-size: 1.5em;
}

.choices {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.choice-btn {
    padding: 15px 20px;
    background: #f5f7fa;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.3s;
    text-align: left;
    font-weight: 500;
}

.choice-btn:hover {
    background: #e8eaf0;
    border-color: #667eea;
    transform: translateX(5px);
}

.choice-btn.correct {
    background: #4caf50;
    color: white;
    border-color: #4caf50;
}

.choice-btn.incorrect {
    background: #f44336;
    color: white;
    border-color: #f44336;
}

.choice-btn:disabled {
    cursor: not-allowed;
    opacity: 0.7;
}

/* Info Section */
#info-section {
    animation: fadeIn 0.5s;
}

#info-title {
    color: #667eea;
    margin-bottom: 20px;
    font-size: 1.8em;
}

#info-content {
    line-height: 1.8;
    color: #333;
}

.info-item {
    margin-bottom: 15px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 6px;
    border-left: 3px solid #667eea;
}

.info-item strong {
    color: #667eea;
    display: block;
    margin-bottom: 5px;
}

#next-btn {
    margin-top: 25px;
    width: 100%;
}

/* Feedback */
.feedback-message {
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    font-size: 1.2em;
    font-weight: 600;
    animation: slideIn 0.3s;
}

.feedback-message.correct {
    background: #4caf50;
    color: white;
}

.feedback-message.incorrect {
    background: #f44336;
    color: white;
}

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

@keyframes slideIn {
    from {
        transform: translateX(-100%);
    }
    to {
        transform: translateX(0);
    }
}

/* Responsive */
@media (max-width: 1024px) {
    .game-container {
        grid-template-columns: 1fr;
        height: auto;
    }
    
    .map-section {
        height: 400px;
    }
    
    #map {
        height: calc(100% - 60px);
    }
}

@media (max-width: 768px) {
    header h1 {
        font-size: 2em;
    }
    
    .welcome-card {
        padding: 25px;
    }
    
    .game-modes {
        grid-template-columns: 1fr;
    }
    
    .game-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
}

/* Leaflet Popup Styling */
.leaflet-popup-content-wrapper {
    border-radius: 8px;
}

.leaflet-popup-content {
    font-size: 14px;
    line-height: 1.6;
}

.highlighted-region {
    fill-opacity: 0.7;
    stroke: #667eea;
    stroke-width: 3;
}

/* Achievements Section */
.achievements-section {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 25px;
    margin-top: 20px;
}

.achievements-section h3 {
    color: #333;
    margin-bottom: 20px;
    font-size: 1.3em;
}

.achievements-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.achievement-card {
    background: white;
    border-radius: 10px;
    padding: 15px;
    text-align: center;
    transition: transform 0.3s;
    border: 2px solid #e0e0e0;
}

.achievement-card.unlocked {
    border-color: #ffd700;
    background: linear-gradient(135deg, #fff9e6 0%, #ffffff 100%);
}

.achievement-card.locked {
    opacity: 0.5;
    filter: grayscale(1);
}

.achievement-card:hover {
    transform: translateY(-3px);
}

.achievement-icon {
    font-size: 2.5em;
    margin-bottom: 8px;
}

.achievement-name {
    font-weight: bold;
    font-size: 0.9em;
    color: #333;
    margin-bottom: 5px;
}

.achievement-desc {
    font-size: 0.75em;
    color: #666;
}

/* Quick Actions */
.quick-actions {
    display: flex;
    gap: 15px;
    margin-top: 20px;
    flex-wrap: wrap;
    justify-content: center;
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    animation: fadeIn 0.3s forwards;
    opacity: 1;
}

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

.modal-content {
    background: white;
    border-radius: 15px;
    padding: 40px;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.close-modal {
    background: none;
    border: none;
    font-size: 2em;
    cursor: pointer;
    color: #999;
    transition: color 0.3s;
}

.close-modal:hover {
    color: #333;
}

/* Difficulty Selection */
.difficulty-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.difficulty-card {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border-radius: 12px;
    padding: 25px;
    text-align: center;
    transition: transform 0.3s, box-shadow 0.3s;
    cursor: pointer;
}

.difficulty-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.difficulty-icon {
    font-size: 3em;
    margin-bottom: 10px;
}

.difficulty-card h3 {
    margin-bottom: 10px;
    color: #333;
}

.difficulty-card p {
    color: #666;
    font-size: 0.9em;
    margin-bottom: 15px;
}

/* Badge */
.badge {
    background: #ffa726;
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.85em;
    font-weight: 600;
}

.badge.easy {
    background: #4caf50;
}

.badge.medium {
    background: #ffa726;
}

.badge.hard {
    background: #f44336;
}

/* Streak Counter */
.streak-counter {
    margin-right: 20px;
    padding: 5px 10px;
    background: rgba(255, 107, 107, 0.1);
    border-radius: 8px;
    font-weight: 600;
}

/* Timer */
.timer-container {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

.timer-circle {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 5px solid #667eea;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2em;
    font-weight: bold;
    color: #667eea;
    animation: pulse 1s infinite;
}

.timer-circle.warning {
    border-color: #ffa726;
    color: #ffa726;
}

.timer-circle.danger {
    border-color: #f44336;
    color: #f44336;
}

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

/* Hint Section */
.hint-section {
    margin-bottom: 20px;
}

.hint-display {
    background: #fff3cd;
    border-left: 4px solid #ffa726;
    padding: 15px;
    border-radius: 8px;
    margin-top: 10px;
    animation: slideDown 0.3s;
}

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

/* Statistics Screen */
.stats-container {
    background: white;
    border-radius: 15px;
    padding: 40px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.stats-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.stats-header h2 {
    color: #667eea;
    font-size: 2em;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
}

.stat-card {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 25px;
    border-left: 4px solid #667eea;
}

.stat-card h3 {
    color: #333;
    margin-bottom: 20px;
    font-size: 1.2em;
}

/* Achievement Notification */
.achievement-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    z-index: 2000;
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    text-align: center;
    min-width: 300px;
    transition: transform 0.3s;
}

.achievement-popup.show {
    transform: translate(-50%, -50%) scale(1);
    animation: bounceIn 0.6s;
}

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

.achievement-icon-large {
    font-size: 4em;
    margin-bottom: 20px;
}

.achievement-popup h3 {
    color: #667eea;
    font-size: 1.8em;
    margin-bottom: 10px;
}

.achievement-popup .achievement-name {
    font-size: 1.3em;
    font-weight: bold;
    color: #333;
    margin-bottom: 10px;
}

.achievement-popup .achievement-desc {
    color: #666;
    font-size: 1em;
}

/* Info Actions */
.info-actions {
    display: flex;
    gap: 10px;
    margin-top: 25px;
}

.info-actions button {
    flex: 1;
}

/* Animations */
@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive Enhancements */
@media (max-width: 768px) {
    .game-modes {
        grid-template-columns: 1fr;
    }
    
    .stats {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .achievements-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .difficulty-options {
        grid-template-columns: 1fr;
    }
    
    .quick-actions {
        flex-direction: column;
    }
    
    .quick-actions button {
        width: 100%;
    }
    
    .modal-content {
        padding: 20px;
        margin: 20px;
    }
}

@media (max-width: 480px) {
    .stats {
        grid-template-columns: 1fr;
    }
    
    .achievements-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Tooltips */
.tooltip {
    position: relative;
    display: inline-block;
}

.tooltip .tooltiptext {
    visibility: hidden;
    width: 200px;
    background-color: rgba(0, 0, 0, 0.9);
    color: #fff;
    text-align: center;
    border-radius: 6px;
    padding: 8px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    margin-left: -100px;
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 0.85em;
}

.tooltip .tooltiptext::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: rgba(0, 0, 0, 0.9) transparent transparent transparent;
}

.tooltip:hover .tooltiptext {
    visibility: visible;
    opacity: 1;
}

/* Pulse Animation for Interactive Elements */
@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 0 0 5px rgba(102, 126, 234, 0.5);
    }
    50% {
        box-shadow: 0 0 20px rgba(102, 126, 234, 0.8);
    }
}

.interactive-element {
    animation: pulse-glow 2s infinite;
}

/* Shake Animation for Wrong Answers */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.shake {
    animation: shake 0.5s;
}

/* Zoom In Animation for Correct Answers */
@keyframes zoomIn {
    0% { transform: scale(0.8); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.zoom-in {
    animation: zoomIn 0.5s;
}

/* Keyboard Shortcuts Modal */
.shortcuts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.shortcut-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 3px solid #667eea;
}

body.dark-mode .shortcut-item {
    background: #1f1f2e;
}

kbd {
    background: #667eea;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.shortcut-item span {
    color: #333;
    font-weight: 500;
}

body.dark-mode .shortcut-item span {
    color: #e0e0e0;
}
