#korea-map {
    width: 100%;
    height: 600px;
    display: block;
}

.province {
    fill: rgba(255,255,255,0.85);
    stroke: rgba(15,16,32,0.85);
    stroke-width: 0.6;
    transition: fill 0.25s ease, filter 0.25s ease, stroke-width 0.25s ease;
}

.province.hovered {
    filter: brightness(1.08) drop-shadow(0 2px 10px rgba(64, 156, 255, 0.35));
    stroke-width: 1.1;
}

#korea-tooltip,
#japan-tooltip,
#usa-tooltip {
    background: rgba(0,0,0,0.75);
    color: #fff;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 12px;
    box-shadow: 0 6px 18px rgba(0,0,0,0.3);
    z-index: 1000;
}
/* World Map Styles */
.world-map-section {
    min-height: 100vh;
    /* Retro poster sky */
    background: linear-gradient(135deg, var(--sky-mint) 0%, var(--sky-teal) 100%);
    padding: 120px 0 60px;
    position: relative;
    overflow: hidden;
}

.world-map-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grid" width="10" height="10" patternUnits="userSpaceOnUse"><path d="M 10 0 L 0 0 0 10" fill="none" stroke="rgba(255,255,255,0.1)" stroke-width="0.5"/></pattern></defs><rect width="100" height="100" fill="url(%23grid)"/></svg>');
    opacity: 0.15; /* lower visual noise for better text contrast */
    pointer-events: none;
}

/* Global readability tweaks within section */
.world-map-section *,
.world-map-section *::before,
.world-map-section *::after {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

.world-map-section h1,
.world-map-section h2,
.world-map-section h3,
.world-map-section p,
.world-map-section .stat-item,
.world-map-section .legend {
    color: #ffffff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.35);
}

.map-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
    background: rgba(0, 0, 0, 0.25); /* darker for higher contrast */
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 20px;
    border: 1px solid rgba(255, 255, 255, 0.28);
}

.control-group {
    display: flex;
    gap: 10px;
}

.control-btn {
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.28);
    color: #ffffff;
    padding: 12px 20px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    text-shadow: 0 1px 1px rgba(0,0,0,0.25);
}

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

.control-btn.active {
    background: rgba(255, 255, 255, 0.22);
    border-color: rgba(255, 255, 255, 0.55);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
}

.stats-display {
    display: flex;
    gap: 30px;
}

.stat-item { text-align: center; color: #ffffff; }

.stat-number {
    display: block;
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 4px;
    text-shadow: 0 1px 2px rgba(0,0,0,0.35);
}

.stat-label {
    font-size: 12px;
    opacity: 0.95;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.map-container {
    position: relative;
    background: rgba(0, 0, 0, 0.18);
    border-radius: 20px;
    padding: 20px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    backdrop-filter: blur(10px);
    min-height: 600px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#world-map, #korea-map, #japan-map, #usa-map {
    width: 100%;
    height: 600px;
    position: relative;
}

#korea-map svg, #japan-map svg, #usa-map svg {
    width: 100%;
    height: 100%;
    display: block;
}

.map-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 20px;
}

.loading-spinner {
    text-align: center;
    color: white;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top: 3px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Real Geographic Map Styles */
.country {
    /* Fill is controlled via SVG gradients from JS */
    stroke: rgba(15,16,32,0.85);
    stroke-width: 0.6;
    transition: fill 0.25s ease, filter 0.25s ease, stroke-width 0.25s ease;
    cursor: pointer;
    opacity: 0.98;
}

.country.hovered {
    filter: brightness(1.06) drop-shadow(0 1px 6px rgba(20,184,166,0.25));
    stroke-width: 1.1;
}

.country.visited-hover {
    filter: brightness(1.12) drop-shadow(0 2px 10px rgba(64, 156, 255, 0.35));
}

.country.unvisited-hover {
    filter: brightness(1.05) drop-shadow(0 1px 8px rgba(0,0,0,0.25));
}

#country-tooltip {
    background: rgba(0,0,0,0.75);
    color: #fff;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 12px;
    box-shadow: 0 6px 18px rgba(0,0,0,0.3);
    z-index: 1000;
}

/* Keep classes for state styling (no direct fills here) */
.country.selected {
    stroke: #ffffff;
    stroke-width: 2;
    filter: brightness(1.25);
}

/* Country Labels */
.country-label {
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
    pointer-events: none;
}

/* Error Message */
.error-message {
    text-align: center;
    color: white;
    padding: 40px;
}

.error-message i {
    font-size: 48px;
    margin-bottom: 20px;
    color: #e74c3c;
}

.error-message button {
    margin-top: 20px;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    background: rgba(255,255,255,0.2);
    color: white;
    cursor: pointer;
    transition: background 0.3s ease;
}

.error-message button:hover {
    background: rgba(255,255,255,0.3);
}

/* Country Info Panel */
.country-info {
    position: fixed;
    top: 50%;
    right: 30px;
    transform: translateY(-50%);
    width: 350px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 0;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
    max-height: 80vh;
    overflow-y: auto;
}

.country-info.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(-50%) translateX(0);
}

.info-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 20px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.info-header h3 {
    margin: 0;
    color: #2c3e50;
    font-size: 20px;
    font-weight: 600;
}

.close-btn {
    background: none;
    border: none;
    font-size: 18px;
    color: #7f8c8d;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.close-btn:hover {
    background: rgba(0, 0, 0, 0.1);
    color: #2c3e50;
}

.info-content {
    padding: 0 20px 20px;
}

.country-details {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-bottom: 20px;
}

.detail-item {
    text-align: center;
    padding: 15px;
    background: rgba(52, 152, 219, 0.1);
    border-radius: 12px;
    border: 1px solid rgba(52, 152, 219, 0.2);
}

.detail-item i {
    display: block;
    font-size: 20px;
    color: #3498db;
    margin-bottom: 8px;
}

.detail-item span {
    font-size: 14px;
    color: #2c3e50;
    font-weight: 500;
}

.country-description {
    color: #34495e;
    line-height: 1.6;
    margin-bottom: 20px;
    font-size: 14px;
}

.country-photos {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.country-photo {
    width: 100%;
    height: 100px;
    object-fit: cover;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.country-photo:hover {
    transform: scale(1.05);
}

/* Responsive Design */
@media (max-width: 768px) {
    .map-controls {
        flex-direction: column;
        gap: 20px;
        padding: 16px;
    }
    
    .control-group {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .stats-display {
        justify-content: center;
    }
    /* Keep controls and legend fully visible on small screens */
    .map-controls .legend {
        width: 100%;
        flex-wrap: wrap;
        justify-content: center;
        gap: 10px 12px;
    }
    /* Hide spacer that pushes legend off-screen (inline flex:1) */
    .map-controls .legend span[style*="flex:1"] {
        display: none !important;
    }
    .map-controls .legend .legend-group {
        width: 100%;
        justify-content: center;
        display: inline-flex;
        flex-wrap: wrap;
        text-align: center;
    }
    .map-controls .legend .btn,
    .map-controls .legend button {
        padding: 10px 14px;
        font-size: 14px;
    }
    
    .country-info {
        position: fixed;
        top: auto;
        bottom: 20px;
        right: 20px;
        left: 20px;
        width: auto;
        transform: none;
        max-height: 60vh;
    }
    
    .country-info.visible {
        transform: none;
    }
    
    .country-details {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .country-photos {
        grid-template-columns: 1fr;
    }
}

/* Animation Classes */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

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

.pulse {
    animation: pulse 2s infinite;
}

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

/* Custom Scrollbar */
.country-info::-webkit-scrollbar {
    width: 6px;
}

.country-info::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 3px;
}

.country-info::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 3px;
}

.country-info::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.5);
}

/* Legend */
.legend {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(0, 0, 0, 0.22);
    border: 1px solid rgba(255, 255, 255, 0.28);
    padding: 12px 16px;
    border-radius: 12px;
    color: #ffffff;
    max-width: 100%;
    flex-wrap: wrap;
}
.legend-group {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.legend-swatch {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    background: linear-gradient(135deg, #7c8ef0 0%, #4c63d2 100%);
    box-shadow: 0 0 0 1px rgba(0,0,0,0.2) inset;
}
.legend-text {
    font-weight: 700;
    opacity: 0.98;
    text-shadow: 0 1px 2px rgba(0,0,0,0.35);
}
.legend-sep {
    opacity: 0.85;
}
