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

:root {
    --bg-dark: #0a0a0f;
    --bg-card: rgba(20, 20, 30, 0.85);
    --ramen-orange: #ff6b35;
    --ramen-red: #d62828;
    --ramen-gold: #fcbf49;
    --text-primary: #f8f8f2;
    --text-secondary: #a0a0b0;
    --glow-orange: rgba(255, 107, 53, 0.4);
}

body {
    font-family: 'Outfit', 'Noto Sans JP', sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    overflow: hidden;
    min-height: 100vh;
}

/* Starfield background */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(2px 2px at 20px 30px, rgba(255,255,255,0.3), transparent),
        radial-gradient(2px 2px at 40px 70px, rgba(255,255,255,0.2), transparent),
        radial-gradient(1px 1px at 90px 40px, rgba(255,255,255,0.4), transparent),
        radial-gradient(2px 2px at 160px 120px, rgba(255,255,255,0.3), transparent),
        radial-gradient(1px 1px at 230px 80px, rgba(255,255,255,0.2), transparent),
        radial-gradient(2px 2px at 300px 150px, rgba(255,255,255,0.35), transparent),
        radial-gradient(1px 1px at 370px 50px, rgba(255,255,255,0.25), transparent),
        radial-gradient(2px 2px at 450px 180px, rgba(255,255,255,0.3), transparent),
        radial-gradient(1px 1px at 520px 90px, rgba(255,255,255,0.2), transparent),
        radial-gradient(2px 2px at 600px 140px, rgba(255,255,255,0.4), transparent);
    background-repeat: repeat;
    background-size: 650px 200px;
    pointer-events: none;
    z-index: -1;
    animation: twinkle 8s ease-in-out infinite alternate;
}

@keyframes twinkle {
    0% { opacity: 0.5; }
    100% { opacity: 1; }
}

#globe-container {
    width: 100vw;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
}

.legend-header {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(255, 107, 53, 0.2);
}

.legend-title {
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-shadow: 0 0 20px var(--glow-orange);
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.emoji {
    font-size: 1.8rem;
    filter: drop-shadow(0 0 8px var(--ramen-orange));
    animation: float 3s ease-in-out infinite;
}

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

.legend-subtitle {
    font-size: 0.75rem;
    font-weight: 300;
    color: var(--text-secondary);
    margin-top: 6px;
    line-height: 1.4;
}

.legend {
    position: fixed;
    bottom: 30px;
    left: 30px;
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 107, 53, 0.2);
    border-radius: 16px;
    padding: 20px 24px;
    z-index: 100;
    min-width: 220px;
    max-width: 280px;
}

.legend h3 {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 12px;
}

.source-selector {
    display: flex;
    gap: 6px;
    margin-bottom: 16px;
}

.source-btn {
    flex: 1;
    padding: 8px 10px;
    border: 1px solid rgba(255, 107, 53, 0.3);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.source-btn:hover {
    background: rgba(255, 107, 53, 0.15);
    border-color: rgba(255, 107, 53, 0.5);
}

.source-btn.active {
    background: rgba(255, 107, 53, 0.25);
    border-color: var(--ramen-orange);
    color: var(--ramen-orange);
    font-weight: 500;
}

.source-note {
    font-size: 0.65rem;
    color: var(--text-secondary);
    line-height: 1.4;
    margin: 8px 0 12px 0;
    padding: 8px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 6px;
    border-left: 2px solid var(--ramen-orange);
}

.source-info {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-align: center;
}

.legend-scale {
    margin-bottom: 16px;
}

.legend-bar {
    height: 10px;
    border-radius: 5px;
    background: linear-gradient(90deg, 
        #8a2be2 0%,      /* Purple - few */
        #4169e1 15%,     /* Blue */
        #00ffff 30%,     /* Cyan */
        #00ff00 50%,     /* Green */
        #ffff00 70%,     /* Yellow */
        #ff8c00 85%,     /* Orange */
        #ff3232 100%     /* Red - many */
    );
    box-shadow: 0 0 8px rgba(255, 150, 50, 0.4);
}

.legend-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 6px;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.legend-dot.data {
    background: linear-gradient(135deg, #00ff00, #ff8c00, #ff3232);
    box-shadow: 0 0 6px rgba(255, 140, 0, 0.5);
}

.legend-dot.no-data {
    background: rgba(120, 120, 130, 0.6);
    border: 1px solid rgba(150, 150, 160, 0.4);
}

.legend-text {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.legend-stats {
    display: flex;
    gap: 24px;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.stat {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--ramen-orange);
    text-shadow: 0 0 10px var(--glow-orange);
}

.stat-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.instructions {
    position: fixed;
    bottom: 30px;
    right: 30px;
    display: flex;
    gap: 20px;
    z-index: 100;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.instructions span {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 8px 16px;
}

/* Custom tooltip styling for Globe.GL */
.globe-tooltip {
    background: var(--bg-card) !important;
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 107, 53, 0.3) !important;
    border-radius: 12px !important;
    padding: 16px 20px !important;
    font-family: 'Outfit', 'Noto Sans JP', sans-serif !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 0 20px var(--glow-orange) !important;
}

.tooltip-city {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tooltip-country {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.tooltip-ramen {
    display: flex;
    align-items: baseline;
    gap: 6px;
    margin-bottom: 4px;
}

.tooltip-ramen-count {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--ramen-orange);
    text-shadow: 0 0 10px var(--glow-orange);
}

.tooltip-ramen-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.tooltip-per-capita {
    font-size: 0.8rem;
    color: var(--ramen-gold);
}

.tooltip-comparison {
    display: flex;
    gap: 12px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.tooltip-source {
    margin-top: 6px;
    font-size: 0.7rem;
    color: var(--text-secondary);
    opacity: 0.7;
}

/* No-data markers (grey dots) */
.no-data-marker {
    width: 14px;
    height: 14px;
    transform: translate(-50%, -50%);
}

.no-data-dot {
    width: 100%;
    height: 100%;
    background: rgba(120, 120, 130, 0.6);
    border-radius: 50%;
    border: 1px solid rgba(150, 150, 160, 0.4);
    box-shadow: 0 0 4px rgba(100, 100, 110, 0.3);
}

.no-data-marker:hover .no-data-dot {
    background: rgba(150, 150, 160, 0.8);
    box-shadow: 0 0 8px rgba(150, 150, 160, 0.5);
}

/* Custom tooltip for no-data cities */
.custom-tooltip {
    position: fixed;
    display: none;
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(150, 150, 160, 0.3);
    border-radius: 12px;
    padding: 14px 18px;
    font-family: 'Outfit', 'Noto Sans JP', sans-serif;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    z-index: 1000;
    transform: translate(-50%, -100%);
    pointer-events: none;
    min-width: 180px;
}

.custom-tooltip .tooltip-city {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.custom-tooltip .tooltip-country {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.custom-tooltip .tooltip-no-data {
    font-size: 0.9rem;
    color: #ffa500;
    margin-bottom: 6px;
}

.custom-tooltip .tooltip-population {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .title {
        font-size: 1.8rem;
    }
    
    .emoji {
        font-size: 2rem;
    }
    
    .subtitle {
        font-size: 0.85rem;
    }
    
    .legend {
        left: 15px;
        bottom: 15px;
        padding: 16px;
    }
    
    .instructions {
        display: none;
    }
}
