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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
    background: #fafafa;
}

.hero {
    background: #ffffff;
    color: #2c3e50;
    padding: 2.5rem 2rem;
    text-align: center;
    border-bottom: 1px solid #e0e0e0;
}

.hero h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: #1a1a1a;
}

.subtitle {
    font-size: 1rem;
    color: #666;
    max-width: 800px;
    margin: 0 auto;
}

.status-message {
    background: #f8f9fa;
    color: #495057;
    padding: 1rem;
    margin: 0 2rem 1rem 2rem;
    border-radius: 6px;
    text-align: center;
    font-weight: 500;
    border-left: 4px solid #6c757d;
}

.status-message.error {
    background: #fff5f5;
    color: #c62828;
    border-left: 4px solid #c62828;
}

.debug-panel {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 1rem;
    margin: 1rem 2rem;
    max-height: 300px;
    overflow: hidden;
}

.debug-panel h3 {
    margin-bottom: 0.5rem;
    color: #495057;
    font-size: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.toggle-btn {
    background: #6c757d;
    color: white;
    border: none;
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.875rem;
}

.toggle-btn:hover {
    background: #5a6268;
}

#debug-log {
    max-height: 250px;
    overflow-y: auto;
    background: #f8f9fa;
    padding: 0.75rem;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
}

.log-entry {
    padding: 0.25rem 0;
    border-bottom: 1px solid #e9ecef;
}

.log-entry:last-child {
    border-bottom: none;
}

.log-entry.error {
    color: #c62828;
    font-weight: 500;
}

.log-entry.success {
    color: #2e7d32;
}

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

section {
    background: #ffffff;
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    border: 1px solid #e0e0e0;
    position: relative;
}

section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 50%, #667eea 100%);
    border-radius: 12px 12px 0 0;
    opacity: 0.6;
}

h2 {
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
    color: #1a1a1a;
    font-weight: 600;
}

h3 {
    font-size: 1.3rem;
    margin-bottom: 1rem;
    color: #2c3e50;
    font-weight: 600;
}

.section-description {
    color: #666;
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
}

/* Map and Country Selection */
.map-section {
    padding: 2rem;
    position: relative;
}

/* Sidebar Toggle Button */
.sidebar-toggle-btn {
    position: absolute;
    left: 340px;
    top: 120px;
    z-index: 1001;
    background: #4A90E2;
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.3);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-toggle-btn:hover {
    background: #357ABD;
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(74, 144, 226, 0.4);
}

.sidebar-toggle-btn:active {
    transform: scale(0.95);
}

.sidebar-toggle-btn.collapsed {
    left: 20px;
}

.toggle-icon {
    font-size: 1.2rem;
    transition: transform 0.3s ease;
    font-weight: bold;
}

.sidebar-toggle-btn.collapsed .toggle-icon {
    transform: rotate(180deg);
}

.map-controls-wrapper {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 2rem;
    margin-top: 1.5rem;
    transition: grid-template-columns 0.3s ease;
}

.map-controls-wrapper.sidebar-collapsed {
    grid-template-columns: 0 1fr;
}

.country-selector-panel {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 0;
    border: 1px solid #e0e0e0;
    height: fit-content;
    max-height: 600px;
    overflow-y: auto;
    overflow-x: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.map-controls-wrapper.sidebar-collapsed .country-selector-panel {
    width: 0;
    padding: 0;
    opacity: 0;
    border: none;
    margin: 0;
}

.selector-header {
    position: sticky;
    top: 0;
    background: white;
    padding: 1.25rem;
    border-bottom: 2px solid #e8e8e8;
    border-radius: 12px 12px 0 0;
    z-index: 10;
}

.selector-header h3 {
    font-size: 1.1rem;
    margin: 0 0 0.75rem 0;
    color: #1a1a1a;
    font-weight: 600;
}

.selection-actions {
    display: flex;
    gap: 0.5rem;
}

.region-selector {
    padding: 0.5rem;
}

.region-section {
    margin-bottom: 0.5rem;
    border-radius: 8px;
    overflow: hidden;
    background: white;
    border: 1px solid #e8e8e8;
}

.region-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    background: white;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.95rem;
    font-weight: 600;
    color: #333;
}

.region-toggle:hover {
    background: #f8f9fa;
}

.region-toggle.active {
    background: #e8ecf0;
}

.region-icon {
    font-size: 1.25rem;
    font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", "Android Emoji", sans-serif;
    display: inline-block;
}

.region-toggle span:nth-child(2) {
    flex: 1;
    text-align: left;
}

.toggle-arrow {
    font-size: 0.75rem;
    color: #999;
    transition: transform 0.2s ease;
}

.country-buttons-region {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.75rem;
    background: #fafafa;
    border-top: 1px solid #e8e8e8;
}

.country-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 0.875rem;
    background: white;
    border: 2px solid #e8e8e8;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9rem;
    color: #333;
}

.country-btn.small {
    padding: 0.625rem 0.875rem;
    font-size: 0.85rem;
}

.country-btn:hover {
    border-color: #999;
    background: #fafafa;
    transform: translateX(4px);
}

.country-btn.active {
    background: #e8f4f8;
    border-color: #4A90E2;
    box-shadow: 0 2px 6px rgba(74, 144, 226, 0.2);
    font-weight: 600;
}

.country-btn[data-country="US"].active {
    border-left: 4px solid #4A90E2;
}

.country-btn[data-country="CN"].active,
.country-btn[data-country="IN"].active,
.country-btn[data-country="RU"].active,
.country-btn[data-country="DE"].active,
.country-btn[data-country="JP"].active {
    border-left: 4px solid;
}

.btn-flag {
    font-size: 1.5rem;
    line-height: 1;
    flex-shrink: 0;
    margin-right: 0.75rem;
    display: inline-block;
    width: 1.5rem;
    text-align: center;
    border-radius: 3px;
    overflow: hidden;
    transition: transform 0.3s ease;
}

/* For flag-icons library */
.btn-flag.fi {
    width: 1.5rem;
    height: 1.125rem;
    background-size: cover;
    border-radius: 2px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    transform-origin: left center;
    transition: all 0.3s ease;
}

/* Waving animation */
@keyframes wave {
    0%, 100% {
        transform: perspective(400px) rotateY(0deg);
    }
    25% {
        transform: perspective(400px) rotateY(-15deg);
    }
    75% {
        transform: perspective(400px) rotateY(15deg);
    }
}

/* Wave on hover */
.country-btn:hover .btn-flag.fi {
    animation: wave 0.6s ease-in-out;
}

/* Continuous gentle wave on active/selected countries */
.country-btn.active .btn-flag.fi {
    animation: wave 2s ease-in-out infinite;
}

/* For emoji fallback (globe icon) */
.btn-flag.globe-icon {
    font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", "Android Emoji", sans-serif;
}

.btn-name {
    font-weight: 500;
    flex: 1;
    text-align: left;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.country-code {
    font-size: 0.75rem;
    font-weight: 600;
    color: #999;
    background: #f0f0f0;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    margin-left: 0.5rem;
    font-family: 'Courier New', monospace;
}

.action-btn {
    flex: 1;
    padding: 0.5rem 0.875rem;
    background: white;
    border: 1px solid #d0d0d0;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
}

.action-btn:hover {
    background: #f5f5f5;
    border-color: #999;
}

.action-btn.select-all:hover {
    background: #e8f5e9;
    border-color: #4caf50;
    color: #2e7d32;
}

.action-btn.clear-all:hover {
    background: #ffebee;
    border-color: #f44336;
    color: #c62828;
}

#map {
    height: 600px;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #e0e0e0;
    background: white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.summary-section {
    padding: 1rem 2rem;
    min-height: 350px;
    position: relative;
    overflow: hidden;
}

/* Carousel container wrapper */
.carousel-wrapper {
    position: relative;
    width: 100%;
}

#country-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    transition: all 0.4s ease;
    position: relative;
    max-height: 500px;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 0.5rem;
}

/* Scrollbar for grid mode */
#country-cards::-webkit-scrollbar {
    width: 12px;
}

#country-cards::-webkit-scrollbar-track {
    background: var(--notion-surface);
    border-radius: 6px;
    border: 1px solid var(--notion-border);
}

#country-cards::-webkit-scrollbar-thumb {
    background: var(--notion-accent);
    border-radius: 6px;
    border: 2px solid var(--notion-surface);
}

#country-cards::-webkit-scrollbar-thumb:hover {
    background: var(--notion-accent-hover);
}

/* Firefox scrollbar */
#country-cards {
    scrollbar-width: thin;
    scrollbar-color: var(--notion-accent) var(--notion-surface);
}

/* Carousel mode for 3+ countries */
#country-cards.carousel-mode {
    display: flex;
    gap: 1.5rem;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: smooth;
    padding: 1rem 0;
    align-items: stretch;
    justify-content: flex-start;
    height: auto;
    min-height: 280px;
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    scrollbar-width: thin;
    scrollbar-color: #4A90E2 #f0f0f0;
}

/* Custom scrollbar styling */
#country-cards.carousel-mode::-webkit-scrollbar {
    height: 12px;
}

#country-cards.carousel-mode::-webkit-scrollbar-track {
    background: var(--notion-surface);
    border-radius: 6px;
    border: 1px solid var(--notion-border);
}

#country-cards.carousel-mode::-webkit-scrollbar-thumb {
    background: var(--notion-accent);
    border-radius: 6px;
    border: 2px solid var(--notion-surface);
}

#country-cards.carousel-mode::-webkit-scrollbar-thumb:hover {
    background: var(--notion-accent-hover);
}

/* Carousel wrapper for navigation */
#country-cards.carousel-mode {
    flex-wrap: nowrap;
}

.empty-message {
    text-align: center;
    color: #7f8c8d;
    padding: 2rem;
    font-style: italic;
}

.country-card {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    transition: all 0.4s ease;
    min-width: 300px;
    max-width: 350px;
    flex-shrink: 0;
}

.country-card:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 8px 16px rgba(0,0,0,0.15);
}

/* Carousel cards - sliding style */
#country-cards.carousel-mode .country-card {
    opacity: 1;
    transition: all 0.4s ease;
}

#country-cards.carousel-mode .country-card:hover {
    transform: translateY(-8px) scale(1.05);
    z-index: 10;
    box-shadow: 0 12px 24px rgba(0,0,0,0.2);
}

/* Carousel navigation buttons */
.carousel-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 100;
    background: rgba(74, 144, 226, 0.95);
    color: white;
    border: none;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: bold;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    transition: all 0.2s ease;
    opacity: 0;
    pointer-events: none;
}

.summary-section:hover .carousel-nav {
    opacity: 1;
    pointer-events: all;
}

.carousel-nav:hover {
    background: rgba(53, 122, 189, 1);
    transform: translateY(-50%) scale(1.15);
    box-shadow: 0 6px 16px rgba(0,0,0,0.4);
}

.carousel-nav:active {
    transform: translateY(-50%) scale(0.95);
}

.carousel-nav.prev {
    left: 10px;
}

.carousel-nav.next {
    right: 10px;
}

.carousel-nav:disabled {
    opacity: 0.2;
    cursor: not-allowed;
    background: rgba(127, 140, 141, 0.6);
}

.summary-section:hover .carousel-nav:disabled {
    opacity: 0.3;
}

/* Smooth slide animation */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

#country-cards.carousel-mode .country-card {
    animation: slideIn 0.5s ease forwards;
}

#country-cards.carousel-mode .country-card:nth-child(1) {
    animation-delay: 0s;
}

#country-cards.carousel-mode .country-card:nth-child(2) {
    animation-delay: 0.1s;
}

#country-cards.carousel-mode .country-card:nth-child(3) {
    animation-delay: 0.2s;
}

#country-cards.carousel-mode .country-card:nth-child(4) {
    animation-delay: 0.3s;
}

#country-cards.carousel-mode .country-card:nth-child(5) {
    animation-delay: 0.4s;
}

#country-cards.carousel-mode .country-card:nth-child(n+6) {
    animation-delay: 0.5s;
}

.card-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.flag {
    font-size: 2rem;
}

.card-header h3 {
    flex: 1;
    margin: 0;
    font-size: 1.4rem;
}

.remove-btn {
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: background 0.2s;
}

.remove-btn:hover {
    background: #c0392b;
}

.card-body {
    padding-top: 1rem;
    border-top: 1px solid #ecf0f1;
}

.stat {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    padding: 0.25rem 0;
}

.stat-label {
    font-weight: 500;
    color: #7f8c8d;
}

.stat-value {
    font-weight: 700;
    color: #2c3e50;
}

.controls-section {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.controls-section label {
    font-weight: 600;
    color: #2c3e50;
}

#factor-group {
    padding: 0.6rem 1rem;
    font-size: 1rem;
    border: 2px solid #dfe6e9;
    border-radius: 6px;
    background: white;
    cursor: pointer;
    transition: border-color 0.2s;
    min-width: 200px;
}

#factor-group:focus {
    outline: none;
    border-color: #667eea;
}

#factor-group:hover {
    border-color: #b2bec3;
}

/* Storyline Section */
/* ==========================================
   INTERACTIVE TIMELINE JOURNEY
   ========================================== */

.storyline-section {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 2.5rem 2rem;
    position: relative;
    overflow: hidden;
    max-width: 100%;
}

.storyline-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg width="100" height="100" xmlns="http://www.w3.org/2000/svg"><circle cx="50" cy="50" r="2" fill="rgba(255,255,255,0.1)"/></svg>');
    opacity: 0.3;
    pointer-events: none;
}

.storyline-section .section-header {
    border-bottom-color: rgba(255,255,255,0.2);
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
}

.storyline-section .section-icon {
    background: rgba(255,255,255,0.2);
    color: white;
}

.storyline-section h2 {
    color: white;
}

.storyline-section .section-subtitle {
    color: rgba(255,255,255,0.9);
}

/* Timeline View Controls */
.timeline-controls {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    justify-content: center;
    flex-wrap: wrap;
}

.timeline-view-btn {
    background: rgba(255,255,255,0.1);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255,255,255,0.2);
    color: white;
    padding: 0.6rem 1.25rem;
    border-radius: 25px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.timeline-view-btn:hover {
    background: rgba(255,255,255,0.2);
    border-color: rgba(255,255,255,0.4);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.timeline-view-btn.active {
    background: white;
    color: #667eea;
    border-color: white;
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}

.btn-icon {
    font-size: 1.1rem;
}

/* Timeline Container */
.timeline-journey {
    position: relative;
    min-height: 300px;
    max-height: 800px;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 1rem 0.5rem;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.3) rgba(255,255,255,0.1);
}

.timeline-journey::-webkit-scrollbar {
    width: 8px;
}

.timeline-journey::-webkit-scrollbar-track {
    background: rgba(255,255,255,0.1);
    border-radius: 4px;
}

.timeline-journey::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.3);
    border-radius: 4px;
}

.timeline-journey::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.5);
}

.storyline-empty {
    text-align: center;
    color: rgba(255,255,255,0.8);
    padding: 3rem 2rem;
    font-style: italic;
    font-size: 1.1rem;
}

/* Journey View (Default) */
.timeline-journey.view-journey {
    display: flex;
    flex-direction: column;
    gap: 0;
    position: relative;
    padding: 1rem 1rem;
}

.timeline-journey.view-journey::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 3px;
    background: linear-gradient(180deg, 
        transparent 0%, 
        rgba(255,255,255,0.5) 10%, 
        rgba(255,255,255,0.5) 90%, 
        transparent 100%);
    transform: translateX(-50%);
    z-index: 0;
}

.journey-node {
    position: relative;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 1.5rem;
    margin-bottom: 2.5rem;
    animation: fadeInUp 0.6s ease forwards;
    opacity: 0;
    align-items: center;
}

.journey-node:nth-child(1) { animation-delay: 0.1s; }
.journey-node:nth-child(2) { animation-delay: 0.2s; }
.journey-node:nth-child(3) { animation-delay: 0.3s; }
.journey-node:nth-child(4) { animation-delay: 0.4s; }
.journey-node:nth-child(5) { animation-delay: 0.5s; }

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

/* Remove old alternating styles - no longer needed */
/* Grid handles the layout automatically */

.journey-content {
    width: 100%;
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    cursor: pointer;
}

.journey-content:hover {
    transform: scale(1.02);
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
    background: white;
}

.journey-marker {
    flex-shrink: 0;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    font-weight: 700;
    background: white;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
    position: relative;
    z-index: 1;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 4px 16px rgba(0,0,0,0.15);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 6px 24px rgba(0,0,0,0.2);
    }
}

.journey-spacer {
    flex: 1;
}

.journey-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid #f0f0f0;
}

.journey-node:nth-child(odd) .journey-header {
    justify-content: flex-end;
}

.journey-node:nth-child(even) .journey-header {
    justify-content: flex-start;
}

.journey-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0;
}

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

.journey-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    margin: 1rem 0;
}

.journey-stat {
    text-align: center;
    padding: 0.75rem 0.5rem;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border-radius: 8px;
    transition: all 0.2s ease;
}

.journey-stat:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

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

.stat-label-large {
    display: block;
    font-size: 0.75rem;
    color: #666;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.stat-value-large {
    display: block;
    font-size: 1.1rem;
    font-weight: 700;
    color: #1a1a1a;
}

.journey-flow-viz {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 2px solid #f0f0f0;
}

.flow-bars {
    display: flex;
    gap: 0.5rem;
    height: 50px;
    align-items: flex-end;
    justify-content: center;
}

.flow-bar {
    flex: 1;
    max-width: 80px;
    border-radius: 6px 6px 0 0;
    position: relative;
    transition: all 0.3s ease;
    cursor: pointer;
}

.flow-bar:hover {
    transform: scaleY(1.1);
    filter: brightness(1.1);
}

.flow-label {
    position: absolute;
    bottom: -22px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.7rem;
    font-weight: 600;
    white-space: nowrap;
}

/* Side-by-Side Comparison View */
.timeline-journey.view-comparison {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    padding: 1rem;
    max-height: 700px;
}

.comparison-card {
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    animation: fadeIn 0.5s ease forwards;
    opacity: 0;
    height: fit-content;
    max-height: 600px;
    overflow: hidden;
}

.comparison-card:nth-child(1) { animation-delay: 0.1s; }
.comparison-card:nth-child(2) { animation-delay: 0.15s; }
.comparison-card:nth-child(3) { animation-delay: 0.2s; }
.comparison-card:nth-child(4) { animation-delay: 0.25s; }
.comparison-card:nth-child(5) { animation-delay: 0.3s; }

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.comparison-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}

.comparison-card .journey-header {
    justify-content: center !important;
    text-align: center;
}

.comparison-card .journey-title {
    font-size: 1.2rem;
    word-break: break-word;
}

.comparison-card .journey-stats {
    margin-top: 1rem;
    gap: 0.5rem;
}

.comparison-card .journey-stat {
    padding: 0.75rem 0.5rem;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.comparison-card .stat-icon-large {
    font-size: 1.3rem;
    margin-bottom: 0.25rem;
}

.comparison-card .stat-label-large {
    font-size: 0.7rem;
    margin-bottom: 0.25rem;
    white-space: nowrap;
}

.comparison-card .stat-value-large {
    font-size: 0.95rem;
    line-height: 1.2;
    word-break: break-all;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.comparison-card .journey-stat > span:last-child {
    font-size: 0.8rem;
    margin-top: 0.25rem;
    font-weight: 600;
    white-space: nowrap;
}

.comparison-total {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 2px solid #f0f0f0;
    text-align: center;
}

.comparison-total-label {
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 0.5rem;
}

.comparison-total-value {
    font-size: 1.6rem;
    font-weight: 700;
    word-break: break-all;
    line-height: 1.2;
}

/* Flow Animation View */
.timeline-journey.view-flow {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    padding: 1rem;
    max-height: 700px;
}

.flow-node {
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    position: relative;
    overflow: hidden;
}

.flow-node::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: shimmer 3s infinite;
}

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

.flow-node .journey-header {
    justify-content: flex-start !important;
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 1rem;
    margin-bottom: 1rem;
}

.flow-animation {
    height: 80px;
    position: relative;
    margin: 1.5rem 0;
    background: linear-gradient(90deg, #f0f0f0 0%, #e0e0e0 50%, #f0f0f0 100%);
    border-radius: 40px;
    overflow: hidden;
}

.flow-particle {
    position: absolute;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    top: 50%;
    transform: translateY(-50%);
    animation: flowMove 4s ease-in-out infinite;
}

@keyframes flowMove {
    0% { left: -20px; opacity: 0; }
    10% { opacity: 1; }
    90% { opacity: 1; }
    100% { left: 100%; opacity: 0; }
}

.flow-particle:nth-child(1) { animation-delay: 0s; background: #667eea; }
.flow-particle:nth-child(2) { animation-delay: 1s; background: #764ba2; }
.flow-particle:nth-child(3) { animation-delay: 2s; background: #f093fb; }

/* Responsive adjustments */
@media (max-width: 1024px) {
    .journey-content {
        max-width: 48%;
        padding: 1.25rem;
    }
    
    .journey-marker {
        width: 50px;
        height: 50px;
        font-size: 1.5rem;
    }
    
    .journey-title {
        font-size: 1.2rem;
    }
    
    .timeline-journey.view-comparison {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    }
}

@media (max-width: 768px) {
    .storyline-section {
        padding: 2rem 1rem;
    }
    
    .timeline-journey {
        max-height: 600px;
    }
    
    .timeline-journey.view-journey::before {
        left: 30px;
    }
    
    .journey-node {
        flex-direction: row !important;
        gap: 1rem;
    }
    
    .journey-marker {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }
    
    .journey-content {
        max-width: calc(100% - 60px) !important;
        text-align: left !important;
        padding: 1rem;
    }
    
    .journey-header {
        justify-content: flex-start !important;
    }
    
    .journey-stats {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    
    .timeline-journey.view-comparison {
        grid-template-columns: 1fr;
    }
}

/* Charts Section */
.charts-section, .category-section {
    padding: 2rem;
    background: white;
}

.category-section {
    margin-bottom: 2rem;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    border: 1px solid #e0e0e0;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #e8e8e8;
}

.section-icon {
    font-size: 2.5rem;
}

.section-title-group {
    flex: 1;
}

.section-title-group h2 {
    margin: 0 0 0.25rem 0;
    font-size: 1.8rem;
    color: #1a1a1a;
    font-weight: 600;
}

.section-subtitle {
    color: #666;
    font-size: 0.95rem;
    margin: 0;
}

.chart-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 1.5rem;
}

.chart-container {
    background: linear-gradient(145deg, #ffffff 0%, #f8f9fa 100%);
    border-radius: 12px;
    padding: 1.5rem;
    border: 1px solid #e0e0e0;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.chart-container:hover {
    transform: translateY(-6px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.12);
    background: #ffffff;
    border-color: #d0d0d0;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid #f0f0f0;
}

.chart-header h3 {
    margin: 0;
    font-size: 1.15rem;
    color: #1a1a1a;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.chart-header h3::before {
    content: '';
    width: 4px;
    height: 20px;
    background: linear-gradient(180deg, #667eea 0%, #764ba2 100%);
    border-radius: 2px;
}

.chart-badge {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 0.3rem 0.75rem;
    border-radius: 16px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 6px rgba(102, 126, 234, 0.3);
}

.chart {
    width: 100%;
    height: 350px;
}

#chart-pie {
    height: 500px;
}

#chart-pie {
    height: 450px;
    position: relative;
}

/* Gauges Section */
.gauges-section {
    background: white;
}

.gauges-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.gauge-item {
    background: linear-gradient(145deg, #ffffff 0%, #f8f9fa 100%);
    border-radius: 12px;
    padding: 1rem;
    border: 1px solid #e0e0e0;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.gauge-item:hover {
    transform: translateY(-6px) scale(1.02);
    box-shadow: 0 8px 20px rgba(0,0,0,0.12);
    background: #ffffff;
    border-color: #d0d0d0;
}

.gauge-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    justify-content: center;
    margin-bottom: 0.25rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #e8e8e8;
}

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

.gauge-header h4 {
    margin: 0;
    font-size: 1rem;
    color: #1a1a1a;
    font-weight: 600;
}

.gauge-chart {
    height: 120px;
    width: 100%;
    margin: 0 auto;
    overflow: hidden;
}

.gauge-footer {
    text-align: center;
    padding-top: 0.5rem;
    border-top: 1px solid #e8e8e8;
    margin-top: 0.25rem;
}

.gauge-value {
    display: block;
    font-size: 1.1rem;
    font-weight: 700;
    color: #1a1a1a;
    margin-bottom: 0.25rem;
}

.gauge-label {
    display: block;
    font-size: 0.8rem;
    color: #666;
    text-transform: capitalize;
}

/* Multi-Dimensional, Distribution, Pattern, Flow Sections */
.multidim-section,
.distribution-section,
.pattern-section,
.flow-section {
    background: white;
}

/* Advanced Charts Section */
.chart-row {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    align-items: start;
}

/* Special styling for pie chart container */
.chart-row .chart-container:has(#chart-pie) {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 500px;
}

.chart-container-wide {
    background: linear-gradient(145deg, #ffffff 0%, #f8f9fa 100%);
    border-radius: 12px;
    padding: 1.5rem;
    border: 1px solid #e0e0e0;
    grid-column: 1 / -1;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.chart-container-wide:hover {
    transform: translateY(-6px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.12);
    background: #ffffff;
    border-color: #d0d0d0;
}

.featured-chart {
    background: linear-gradient(145deg, #ffffff 0%, #fafbfc 100%);
    border: 2px solid #e0e0e0;
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}

.featured-chart:hover {
    border-color: #667eea;
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.15);
}

.featured-chart .chart-badge {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    box-shadow: 0 2px 6px rgba(240, 147, 251, 0.3);
}

.chart-description {
    color: #666;
    font-size: 0.875rem;
    margin-bottom: 1rem;
    padding-left: 0.5rem;
    border-left: 2px solid #d0d0d0;
}

.chart-large {
    width: 100%;
    height: 450px;
}

/* Insights Section */
.insights-section ul {
    list-style: none;
    padding-left: 0;
}

.insights-section li {
    padding: 0.75rem 0;
    padding-left: 1.5rem;
    position: relative;
    border-bottom: 1px solid #ecf0f1;
}

.insights-section li:before {
    content: "•";
    position: absolute;
    left: 0;
    color: #667eea;
    font-size: 1.5rem;
    line-height: 1.2;
}

.insights-section li:last-child {
    border-bottom: none;
}

.insights-section p {
    text-align: center;
    color: #7f8c8d;
    padding: 2rem;
    font-style: italic;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .chart-row {
        grid-template-columns: 1fr;
    }
    
    .chart-container-wide {
        grid-column: 1;
    }
    
    .map-controls-wrapper {
        grid-template-columns: 1fr;
    }
    
    #map {
        order: 1;
        height: 500px;
    }
    
    .country-selector-panel {
        order: 2;
        margin-top: 1rem;
        max-height: 400px;
    }
}

@media (max-width: 768px) {
    .hero h1 {
        font-size: 1.8rem;
    }

    .subtitle {
        font-size: 0.95rem;
    }

    .container {
        padding: 1rem;
    }

    section {
        padding: 1.5rem;
    }

    .charts-section, .chart-grid {
        grid-template-columns: 1fr;
    }

    #country-cards {
        grid-template-columns: 1fr;
    }
    
    #map {
        height: 350px;
    }
    
    .debug-panel {
        margin: 1rem;
    }
    
    .storyline-header {
        flex-wrap: wrap;
    }
    
    .storyline-flag {
        font-size: 2rem;
    }
    
    .storyline-header h3 {
        font-size: 1.4rem;
    }
    
    .storyline-metrics {
        grid-template-columns: 1fr;
    }
    
    .chart {
        height: 300px;
    }
    
    .chart-large {
        height: 350px;
    }
    
    .gauges-grid {
        grid-template-columns: 1fr;
    }
    
    .map-controls-wrapper {
        grid-template-columns: 1fr;
    }
    
    .country-selector-panel {
        max-height: 350px;
    }
    
    .selector-header {
        padding: 1rem;
    }
    
    .selector-header h3 {
        font-size: 1rem;
    }
    
    .region-toggle {
        padding: 0.75rem 0.875rem;
        font-size: 0.9rem;
    }
    
    .country-btn {
        padding: 0.625rem 0.75rem;
        font-size: 0.85rem;
    }
    
    .btn-flag {
        font-size: 1.25rem;
    }
}

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

.chart-container, .chart-container-wide, .gauge-item {
    animation: fadeIn 0.5s ease-out;
}

/* Scrollbar styling */
#debug-log::-webkit-scrollbar,
.country-selector-panel::-webkit-scrollbar {
    width: 10px;
}

.country-selector-panel::-webkit-scrollbar-track {
    background: var(--notion-surface);
    border-radius: 5px;
    border: 1px solid var(--notion-border);
}

.country-selector-panel::-webkit-scrollbar-thumb {
    background: var(--notion-accent);
    border-radius: 5px;
    border: 2px solid #f8f9fa;
}

.country-selector-panel::-webkit-scrollbar-thumb:hover {
    background: var(--notion-accent-hover);
}

/* Firefox scrollbar for sidebar */
.country-selector-panel {
    scrollbar-width: thin;
    scrollbar-color: var(--notion-accent) var(--notion-surface);
}

#debug-log::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

#debug-log::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

#debug-log::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* Mobile Warning Banner */
.mobile-warning {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem;
    background: linear-gradient(135deg, #FFF3E0 0%, #FFE0B2 100%);
    border: 2px solid #FF9800;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 12px rgba(255, 152, 0, 0.2);
    animation: slideDown 0.5s ease-out;
}

.warning-icon {
    font-size: 2rem;
    flex-shrink: 0;
}

.warning-content {
    flex: 1;
}

.warning-content strong {
    display: block;
    font-size: 1.1rem;
    color: #E65100;
    margin-bottom: 0.25rem;
}

.warning-content p {
    margin: 0;
    font-size: 0.95rem;
    color: #5D4037;
    line-height: 1.5;
}

.warning-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #E65100;
    cursor: pointer;
    padding: 0.5rem;
    line-height: 1;
    transition: all 0.2s ease;
    border-radius: 4px;
}

.warning-close:hover {
    background: rgba(230, 81, 0, 0.1);
    transform: scale(1.1);
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
/* ==========================================
   NOTION THEME & NEW FEATURES
   ========================================== */

:root {
    --notion-bg: #FFFFFF;
    --notion-surface: #F7F6F3;
    --notion-border: #E9E9E7;
    --notion-text: #37352F;
    --notion-text-secondary: #787774;
    --notion-accent: #2EAADC;
    --notion-blue: #0B6E99;
    --notion-blue-bg: #E7F3F8;
    --notion-yellow: #DFAB01;
    --notion-yellow-bg: #FBF3DB;
    --notion-shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --notion-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

body {
    background-color: var(--notion-surface);
    color: var(--notion-text);
}

/* Factor Selection Buttons */
.factor-selection-section {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--notion-bg);
    padding: 1.25rem 2rem;
    margin: 0 0 2rem 0;
    border-radius: 0;
    border-bottom: 2px solid var(--notion-border);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.95);
}

.factor-header {
    text-align: center;
    margin-bottom: 1rem;
}

.factor-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--notion-text);
    margin-bottom: 0.25rem;
}

.factor-subtitle {
    font-size: 0.85rem;
    color: var(--notion-text-secondary);
}

.factor-buttons {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 0.75rem;
    max-width: 1400px;
    margin: 0 auto;
}

.factor-btn {
    background: var(--notion-surface);
    border: 2px solid var(--notion-border);
    border-radius: 6px;
    padding: 0.75rem 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    position: relative;
    overflow: hidden;
    min-height: 85px;
}

.factor-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--notion-accent);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.factor-btn:hover {
    background: var(--notion-bg);
    border-color: var(--notion-accent);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.factor-btn:hover::before {
    transform: scaleX(1);
}

.factor-btn.active {
    background: var(--notion-blue-bg);
    border-color: var(--notion-blue);
    box-shadow: 0 2px 6px rgba(11, 110, 153, 0.2);
}

.factor-btn.active::before {
    transform: scaleX(1);
    background: var(--notion-blue);
}

.factor-icon {
    font-size: 1.75rem;
    transition: transform 0.2s ease;
}

.factor-btn:hover .factor-icon {
    transform: scale(1.1);
}

.factor-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--notion-text);
    text-align: center;
    line-height: 1.2;
}

.factor-btn.active .factor-name {
    color: var(--notion-blue);
}

/* Pie Chart with External Legend */
.pie-chart-full-row {
    display: grid !important;
    grid-template-columns: 2fr 1fr !important;
    gap: 1.5rem !important;
}

.pie-chart-main {
    grid-column: 1 / 2;
}

.pie-legend-panel {
    grid-column: 2 / 3;
    display: flex;
    flex-direction: column;
}

.pie-legend-container {
    background: var(--notion-surface);
    border: 1px solid var(--notion-border);
    border-radius: 8px;
    padding: 1rem;
    max-height: 450px;
    overflow-y: auto;
    flex: 1;
}

.pie-legend-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--notion-text);
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--notion-border);
}

.pie-legend-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: 6px;
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pie-legend-item:hover {
    background: var(--notion-blue-bg);
}

.pie-legend-color {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    flex-shrink: 0;
}

.pie-legend-text {
    flex: 1;
    font-size: 0.85rem;
    color: var(--notion-text);
}

.pie-legend-value {
    font-weight: 600;
    color: var(--notion-text-secondary);
    font-size: 0.8rem;
}

/* Timeline Insights */
.journey-insight {
    width: 100%;
    background: var(--notion-yellow-bg);
    border: 2px solid var(--notion-yellow);
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 200px;
}

.insight-badge {
    display: inline-block;
    background: var(--notion-yellow);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 1rem;
    width: fit-content;
}

.insight-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--notion-text);
    margin-bottom: 0.75rem;
}

.insight-points {
    list-style: none;
    padding: 0;
    margin: 0;
}

.insight-points li {
    padding: 0.5rem 0;
    padding-left: 1.5rem;
    position: relative;
    color: var(--notion-text-secondary);
    line-height: 1.6;
    font-size: 0.95rem;
}

.insight-points li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: var(--notion-yellow);
    font-weight: bold;
}

/* Responsive */
@media (max-width: 768px) {
    .factor-buttons {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .pie-chart-full-row {
        grid-template-columns: 1fr !important;
    }
    
    .pie-legend-container {
        max-height: 300px;
    }
}

/* Dual Pie Chart Layout */
.dual-pie-row {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 1.5rem !important;
}

.pie-chart-half {
    min-height: 550px;
}

.pie-chart-half .chart {
    height: 450px;
}

@media (max-width: 968px) {
    .dual-pie-row {
        grid-template-columns: 1fr !important;
    }
}

/* Firefox scrollbar for carousel mode */
#country-cards.carousel-mode {
    scrollbar-width: thin;
    scrollbar-color: var(--notion-accent) var(--notion-surface);
}

/* Responsive zigzag for mobile */
@media (max-width: 768px) {
    .journey-node {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto;
        gap: 1rem;
    }
    
    .journey-content,
    .journey-insight {
        max-width: 100%;
    }
    
    .journey-marker {
        justify-self: center;
    }
}

/* Responsive sticky factor section */
@media (max-width: 1200px) {
    .factor-buttons {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .factor-selection-section {
        padding: 1rem;
        top: 0;
    }
    
    .factor-header h3 {
        font-size: 1.1rem;
    }
    
    .factor-subtitle {
        font-size: 0.75rem;
    }
    
    .factor-buttons {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }
    
    .factor-btn {
        padding: 0.6rem 0.4rem;
        min-height: 75px;
    }
    
    .factor-icon {
        font-size: 1.5rem;
    }
    
    .factor-name {
        font-size: 0.7rem;
    }
}

@media (max-width: 480px) {
    .factor-buttons {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .factor-btn {
        padding: 0.5rem 0.3rem;
        min-height: 70px;
    }
    
    .factor-icon {
        font-size: 1.4rem;
    }
    
    .factor-name {
        font-size: 0.65rem;
    }
}


/* ==========================================
   FLOW-RINGS VISUALIZATION STYLES
   ========================================== */

.flow-rings-section {
    background: white;
    padding: 2.5rem;
    margin: 2rem 0;
}

/* Control Panel */
.flow-rings-controls {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: var(--notion-surface);
    border-radius: 12px;
    border: 2px solid var(--notion-border);
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.control-group label {
    font-weight: 600;
    color: var(--notion-text);
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
}

.country-multiselect {
    width: 100%;
    min-height: 140px;
    padding: 0.5rem;
    border: 2px solid var(--notion-border);
    border-radius: 8px;
    font-size: 0.9rem;
    background: white;
    font-family: inherit;
    cursor: pointer;
}

.country-multiselect option {
    padding: 0.5rem;
    cursor: pointer;
    border-radius: 4px;
    margin: 2px 0;
}

.country-multiselect option:checked {
    background: linear-gradient(var(--notion-blue-bg), var(--notion-blue-bg));
    color: var(--notion-blue);
    font-weight: 600;
}

.country-multiselect option:hover {
    background: var(--notion-surface);
}

.button-group {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.flow-btn {
    padding: 0.6rem 1.2rem;
    background: var(--notion-accent);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.flow-btn:hover {
    background: var(--notion-blue);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.flow-btn:active {
    transform: translateY(0);
}

.flow-btn.export-btn {
    background: #10b981;
}

.flow-btn.export-btn:hover {
    background: #059669;
}

/* Category Toggles */
.category-toggles {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.category-toggle {
    padding: 0.5rem 1rem;
    background: white;
    border: 2px solid var(--notion-border);
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.category-toggle.active {
    background: var(--notion-blue-bg);
    border-color: var(--notion-blue);
    color: var(--notion-blue);
}

.category-toggle:hover {
    border-color: var(--notion-accent);
    transform: translateY(-1px);
}

/* Visualization Container */
.flow-rings-container {
    position: relative;
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 2rem;
    min-height: 700px;
}

.flow-rings-viz {
    width: 100%;
    min-height: 800px;
    background: white;
    border-radius: 12px;
    border: 2px solid var(--notion-border);
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
    position: relative;
}

.flow-rings-viz svg {
    display: block;
}

/* Side Panel */
.flow-rings-panel {
    background: var(--notion-surface);
    border-radius: 12px;
    border: 2px solid var(--notion-border);
    padding: 1.5rem;
    max-height: 700px;
    overflow-y: auto;
    display: none;
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
}

.flow-rings-panel.visible {
    display: block;
    animation: slideIn 0.3s ease;
}

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

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--notion-border);
}

.panel-header h4 {
    margin: 0;
    color: var(--notion-text);
    font-size: 1.2rem;
}

.close-panel {
    background: none;
    border: none;
    font-size: 1.8rem;
    cursor: pointer;
    color: var(--notion-text-secondary);
    transition: all 0.2s ease;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
}

.close-panel:hover {
    background: rgba(0,0,0,0.05);
    color: var(--notion-text);
}

.panel-content {
    color: var(--notion-text);
}

.panel-placeholder {
    text-align: center;
    color: var(--notion-text-secondary);
    padding: 3rem 1rem;
    font-style: italic;
}

.panel-section {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--notion-border);
}

.panel-section:last-child {
    border-bottom: none;
}

.panel-section h5 {
    margin: 0 0 1rem 0;
    color: var(--notion-text);
    font-size: 1rem;
}

.panel-section p {
    margin: 0.5rem 0;
    font-size: 0.9rem;
    color: var(--notion-text-secondary);
}

.panel-section p strong {
    color: var(--notion-text);
}

.panel-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.panel-table thead {
    background: var(--notion-surface);
}

.panel-table th {
    padding: 0.5rem;
    text-align: left;
    font-weight: 600;
    color: var(--notion-text);
    border-bottom: 2px solid var(--notion-border);
}

.panel-table td {
    padding: 0.5rem;
    border-bottom: 1px solid var(--notion-border);
    color: var(--notion-text-secondary);
}

.panel-table tr:last-child td {
    border-bottom: none;
}

/* Tooltip */
.flow-tooltip {
    position: fixed;
    display: block;
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    color: white;
    padding: 14px 16px;
    border-radius: 10px;
    font-size: 13px;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    z-index: 10000;
    min-width: 200px;
    max-width: 280px;
    box-shadow: 
        0 10px 30px rgba(0, 0, 0, 0.3),
        0 0 0 1px rgba(255, 255, 255, 0.1) inset;
    backdrop-filter: blur(10px);
}

.flow-tooltip.visible {
    opacity: 1;
    visibility: visible;
}

.flow-tooltip strong {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
    color: #4fc3f7;
    border-bottom: 1px solid rgba(255,255,255,0.2);
    padding-bottom: 0.25rem;
}

.flow-tooltip div {
    margin: 0.25rem 0;
    line-height: 1.4;
}

/* SVG Elements */
.flow-arc {
    cursor: pointer;
    transition: all 0.2s ease;
    stroke: white;
    stroke-width: 1;
}

.flow-arc:hover {
    opacity: 0.85;
    stroke-width: 2;
    filter: brightness(1.1);
}

.flow-connector {
    fill: none;
    opacity: 0.25;
    transition: all 0.2s ease;
    pointer-events: stroke;
}

.flow-connector:hover {
    opacity: 0.7;
    stroke-width: 3 !important;
}

.flow-connector.highlighted {
    opacity: 0.8;
    stroke-width: 3;
    filter: drop-shadow(0 0 4px rgba(255,255,255,0.8));
}

.ring-label {
    font-size: 13px;
    font-weight: 700;
    fill: var(--notion-text);
    text-anchor: middle;
    letter-spacing: 1px;
}

.arc-label {
    font-size: 10px;
    fill: white;
    font-weight: 600;
    text-anchor: middle;
    pointer-events: none;
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

/* Instructions */
.flow-instructions {
    margin-top: 2rem;
    padding: 1.5rem;
    background: var(--notion-blue-bg);
    border-radius: 12px;
    border-left: 4px solid var(--notion-blue);
}

.flow-instructions h4 {
    margin: 0 0 1rem 0;
    color: var(--notion-text);
    font-size: 1rem;
}

.flow-instructions ul {
    margin: 0;
    padding-left: 1.5rem;
}

.flow-instructions li {
    margin: 0.5rem 0;
    color: var(--notion-text-secondary);
    line-height: 1.6;
}

.flow-instructions strong {
    color: var(--notion-text);
}

/* Responsive Design */
@media (max-width: 1400px) {
    .flow-rings-controls {
        grid-template-columns: 1fr 1fr;
    }
    
    .flow-rings-container {
        grid-template-columns: 1fr 320px;
    }
}

@media (max-width: 1024px) {
    .flow-rings-controls {
        grid-template-columns: 1fr;
    }
    
    .flow-rings-container {
        grid-template-columns: 1fr;
    }
    
    .flow-rings-panel {
        max-height: 400px;
    }
}

@media (max-width: 768px) {
    .flow-rings-section {
        padding: 1.5rem;
    }
    
    .flow-rings-viz {
        min-height: 500px;
    }
    
    .category-toggles {
        flex-direction: column;
    }
    
    .category-toggle {
        width: 100%;
        text-align: center;
    }
    
    .button-group {
        flex-direction: column;
    }
    
    .flow-btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .flow-rings-viz {
        min-height: 400px;
    }
    
    .country-multiselect {
        min-height: 100px;
    }
}

/* Print Styles */
@media print {
    .flow-rings-controls,
    .flow-tooltip,
    .close-panel {
        display: none !important;
    }
    
    .flow-rings-panel {
        break-inside: avoid;
    }
}
/* ==========================================
   CHORD-SANKEY INTEGRATED STYLES
   Matches existing page design
   ========================================== */

/* Chart controls styling to match existing buttons */
.chart-controls {
    display: flex;
    gap: 10px;
    margin: 15px 0;
    flex-wrap: wrap;
}

.chart-control-btn {
    padding: 8px 16px;
    background: linear-gradient(135deg, rgba(74, 144, 226, 0.1), rgba(80, 227, 194, 0.1));
    border: 2px solid rgba(74, 144, 226, 0.3);
    border-radius: 8px;
    color: #4A90E2;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.chart-control-btn:hover {
    background: linear-gradient(135deg, rgba(74, 144, 226, 0.2), rgba(80, 227, 194, 0.2));
    border-color: rgba(74, 144, 226, 0.5);
    transform: translateY(-1px);
}

.chart-control-btn.active {
    background: linear-gradient(135deg, #4A90E2, #50E3C2);
    border-color: #4A90E2;
    color: white;
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.3);
}

/* Extra large chart size for Chord-Sankey */
.chart-xlarge {
    width: 100%;
    height: 700px;
    min-height: 700px;
    background: linear-gradient(135deg, #0f0c29, #302b63, #24243e);
    border-radius: 12px;
    position: relative;
}

/* Instructions styling */
.chart-instructions {
    display: flex;
    gap: 20px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.instruction-item {
    flex: 1;
    min-width: 250px;
    padding: 12px 16px;
    background: rgba(74, 144, 226, 0.05);
    border-left: 3px solid #4A90E2;
    border-radius: 6px;
    font-size: 13px;
    line-height: 1.6;
    color: #666;
}

.instruction-icon {
    font-size: 18px;
    margin-right: 8px;
}

.instruction-item strong {
    color: #333;
    font-weight: 600;
}

/* SVG container styling */
#chart-chord-sankey svg {
    width: 100%;
    height: 100%;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .chart-xlarge {
        height: 500px;
        min-height: 500px;
    }
    
    .chart-instructions {
        flex-direction: column;
    }
    
    .instruction-item {
        min-width: 100%;
    }
}

/* ==========================================
   3D TOPOGRAPHIC IMPACT CARTOGRAM STYLES
   Ultra-modern, sleek design
   ========================================== */

.topo-section {
    background: linear-gradient(135deg, #0a0a0f 0%, #1a1a2e 50%, #0a0a0f 100%);
    padding: 80px 0;
    position: relative;
    overflow: hidden;
}

.topo-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 50%, rgba(74, 144, 226, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 50%, rgba(231, 76, 60, 0.1) 0%, transparent 50%);
    pointer-events: none;
}

.topo-container {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 40px;
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 40px;
    position: relative;
}

/* Info Panel */
.topo-info-panel {
    background: rgba(15, 15, 25, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 30px;
    backdrop-filter: blur(20px);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.topo-description h3 {
    font-size: 20px;
    font-weight: 700;
    color: #ffffff;
    margin: 0 0 16px 0;
    letter-spacing: -0.5px;
}

.topo-description p {
    font-size: 14px;
    line-height: 1.7;
    color: rgba(255, 255, 255, 0.7);
    margin: 0 0 24px 0;
}

.topo-legend {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 24px;
}

.topo-legend h4 {
    font-size: 13px;
    font-weight: 700;
    color: #4a90e2;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 0 0 16px 0;
}

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

.legend-item {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.8);
}

.legend-peak {
    width: 40px;
    height: 24px;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.topo-features {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 24px;
}

.topo-features h4 {
    font-size: 13px;
    font-weight: 700;
    color: #4a90e2;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 0 0 12px 0;
}

.topo-features ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.topo-features li {
    font-size: 13px;
    line-height: 1.8;
    color: rgba(255, 255, 255, 0.7);
    padding-left: 20px;
    position: relative;
}

.topo-features li::before {
    content: '▸';
    position: absolute;
    left: 0;
    color: #4a90e2;
}

.topo-features strong {
    color: rgba(255, 255, 255, 0.9);
}

/* Mode Controls */
.topo-controls {
    margin-bottom: 24px;
}

.topo-controls h4 {
    font-size: 13px;
    font-weight: 700;
    color: #4a90e2;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 0 0 16px 0;
}

.topo-mode-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.topo-mode-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

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

.topo-mode-btn:hover::before {
    left: 100%;
}

.topo-mode-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(74, 144, 226, 0.5);
    transform: translateX(4px);
}

.topo-mode-btn.active {
    background: linear-gradient(135deg, rgba(74, 144, 226, 0.2) 0%, rgba(74, 144, 226, 0.1) 100%);
    border-color: #4a90e2;
    box-shadow: 0 0 20px rgba(74, 144, 226, 0.3);
}

.mode-icon {
    font-size: 24px;
}

.mode-label {
    font-size: 15px;
    font-weight: 700;
    color: #ffffff;
}

.mode-desc {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
}

/* Interaction Guide */
.topo-interaction-guide {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 24px;
}

.topo-interaction-guide h4 {
    font-size: 13px;
    font-weight: 700;
    color: #4a90e2;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 0 0 16px 0;
}

.interaction-hints {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.hint-item {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.7);
}

.hint-icon {
    font-size: 18px;
    width: 28px;
    text-align: center;
}

/* Stats Summary */
.topo-stats-summary {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    padding: 20px;
}

.topo-stats-summary h4 {
    font-size: 13px;
    font-weight: 700;
    color: #4a90e2;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 0 0 16px 0;
}

.summary-stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.summary-stat:last-child {
    border-bottom: none;
}

.stat-label {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
}

.stat-value {
    font-size: 14px;
    font-weight: 700;
    color: #4a90e2;
}

/* 3D Visualization */
.topo-3d-wrapper {
    position: relative;
    background: linear-gradient(135deg, #0f0f19 0%, #1a1a2e 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.topo-3d-canvas {
    width: 100%;
    height: 700px;
    position: relative;
    cursor: grab;
}

.topo-3d-canvas:active {
    cursor: grabbing;
}

/* Loading Overlay */
.topo-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(10, 10, 15, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.topo-loading.active {
    opacity: 1;
    pointer-events: all;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(74, 144, 226, 0.2);
    border-top-color: #4a90e2;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.topo-loading p {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 600;
}

/* Ensure canvas fills container */
.topo-3d-canvas canvas {
    width: 100% !important;
    height: 100% !important;
    display: block;
}

/* Tooltip */
.topo-tooltip {
    position: absolute;
    bottom: 20px;
    left: 20px;
    background: rgba(10, 10, 15, 0.95);
    border: 1px solid rgba(74, 144, 226, 0.5);
    border-radius: 12px;
    padding: 16px 20px;
    min-width: 220px;
    backdrop-filter: blur(20px);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    opacity: 0;
    display: none;
    transition: opacity 0.3s;
    z-index: 100;
}

.topo-tooltip-header {
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.topo-tooltip-header strong {
    font-size: 16px;
    color: #ffffff;
    font-weight: 700;
}

.topo-tooltip-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.topo-stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
}

.topo-stat-label {
    color: rgba(255, 255, 255, 0.6);
}

.topo-stat-value {
    color: #4a90e2;
    font-weight: 700;
}

/* View Controls */
.topo-view-controls {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    gap: 10px;
    z-index: 10;
}

.view-control-btn {
    width: 44px;
    height: 44px;
    background: rgba(10, 10, 15, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
    font-size: 20px;
}

.view-control-btn:hover {
    background: rgba(74, 144, 226, 0.3);
    border-color: #4a90e2;
    transform: scale(1.1);
    box-shadow: 0 0 20px rgba(74, 144, 226, 0.4);
}

.view-control-btn:active {
    transform: scale(0.95);
}

/* Responsive */
@media (max-width: 1400px) {
    .topo-container {
        grid-template-columns: 320px 1fr;
        gap: 30px;
    }
}

@media (max-width: 1200px) {
    .topo-container {
        grid-template-columns: 1fr;
    }
    
    .topo-info-panel {
        max-width: 100%;
    }
    
    .topo-3d-canvas {
        height: 600px;
    }
}

@media (max-width: 768px) {
    .topo-section {
        padding: 40px 0;
    }
    
    .topo-container {
        padding: 0 20px;
        gap: 20px;
    }
    
    .topo-info-panel {
        padding: 20px;
    }
    
    .topo-3d-canvas {
        height: 500px;
    }
    
    .topo-mode-buttons {
        gap: 8px;
    }
    
    .topo-mode-btn {
        padding: 12px;
    }
    
    .mode-label {
        font-size: 14px;
    }
    
    .mode-desc {
        font-size: 11px;
    }
    
    .topo-tooltip {
        left: 10px;
        bottom: 10px;
        min-width: 180px;
        padding: 12px 16px;
    }
}

/* Canvas Styling */
canvas {
    display: block;
    outline: none;
}

/* Selection Highlight */
.topo-3d-canvas.selecting {
    cursor: crosshair;
}

/* Performance Hints */
.topo-3d-wrapper::after {
    content: 'Hardware Acceleration Enabled';
    position: absolute;
    bottom: 10px;
    right: 10px;
    font-size: 10px;
    color: rgba(255, 255, 255, 0.3);
    font-family: monospace;
    pointer-events: none;
}

/* ==========================================
   3D TOPOGRAPHIC TERRAIN STYLES
   Pure CSS 3D transforms
   ========================================== */

/* 3D Scene Container */
.terrain-3d-scene {
    width: 100%;
    height: 100%;
    perspective: 1200px;
    perspective-origin: 50% 50%;
    position: relative;
    overflow: hidden;
    background: radial-gradient(ellipse at center, #1a1a2e 0%, #0a0a0f 100%);
}

/* Terrain Globe */
.terrain-globe {
    width: 600px;
    height: 600px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform-style: preserve-3d;
    transform: translate(-50%, -50%) rotateX(45deg) rotateY(0deg);
    transition: transform 0.1s linear;
}

/* Base Terrain Layer */
.terrain-base {
    width: 100%;
    height: 100%;
    position: absolute;
    background: 
        radial-gradient(ellipse at 30% 30%, rgba(74, 144, 226, 0.1) 0%, transparent 50%),
        radial-gradient(ellipse at 70% 70%, rgba(231, 76, 60, 0.1) 0%, transparent 50%),
        linear-gradient(135deg, #0f0f19 0%, #1a1a2e 100%);
    border-radius: 8px;
    box-shadow: 
        0 0 60px rgba(0, 0, 0, 0.5),
        inset 0 0 100px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

/* Terrain Grid */
.terrain-grid {
    width: 100%;
    height: 100%;
    position: absolute;
    background-image: 
        repeating-linear-gradient(0deg, 
            transparent, 
            transparent 49px, 
            rgba(255, 255, 255, 0.03) 49px, 
            rgba(255, 255, 255, 0.03) 50px),
        repeating-linear-gradient(90deg, 
            transparent, 
            transparent 49px, 
            rgba(255, 255, 255, 0.03) 49px, 
            rgba(255, 255, 255, 0.03) 50px);
    pointer-events: none;
}

/* Countries Container */
.terrain-countries {
    width: 100%;
    height: 100%;
    position: absolute;
    transform-style: preserve-3d;
}

/* Individual Terrain Peak */
.terrain-peak {
    position: absolute;
    width: 50px;
    height: 50px;
    transform-style: preserve-3d;
    transform: translate(-50%, -50%) translateZ(0);
    cursor: pointer;
    animation: peakRise 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    opacity: 0;
}

@keyframes peakRise {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) translateZ(0) scale(0);
    }
    100% {
        opacity: 1;
        transform: translate(-50%, -50%) translateZ(var(--peak-height, 50px)) scale(1);
    }
}

/* Peak Top Face */
.peak-top {
    position: absolute;
    width: 40px;
    height: 40px;
    top: -20px;
    left: 5px;
    background: var(--peak-color, #4a90e2);
    transform: rotateX(90deg);
    box-shadow: 
        0 0 20px rgba(74, 144, 226, 0.5),
        inset 0 0 10px rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

/* Peak Side 1 (Front-Right) */
.peak-side-1 {
    position: absolute;
    width: 40px;
    height: var(--peak-height, 50px);
    top: 0;
    left: 5px;
    background: var(--peak-color, #4a90e2);
    transform-origin: bottom;
    transform: rotateY(45deg);
    box-shadow: inset -5px 0 10px rgba(0, 0, 0, 0.3);
}

/* Peak Side 2 (Front-Left) */
.peak-side-2 {
    position: absolute;
    width: 40px;
    height: var(--peak-height, 50px);
    top: 0;
    left: 5px;
    background: var(--peak-color, #4a90e2);
    transform-origin: bottom;
    transform: rotateY(-45deg);
    box-shadow: inset 5px 0 10px rgba(0, 0, 0, 0.3);
}

/* Peak Base (Shadow) */
.peak-base {
    position: absolute;
    width: 60px;
    height: 60px;
    top: 0;
    left: -5px;
    background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.4) 0%, transparent 70%);
    transform: translateZ(-1px);
    border-radius: 50%;
    filter: blur(8px);
}

/* Peak Glow */
.peak-glow {
    position: absolute;
    width: 50px;
    height: 50px;
    top: -5px;
    left: 0;
    background: var(--peak-color, #4a90e2);
    border-radius: 50%;
    opacity: 0.2;
    filter: blur(15px);
    transform: translateZ(-2px);
    animation: glowPulse 3s ease-in-out infinite;
}

@keyframes glowPulse {
    0%, 100% {
        opacity: 0.2;
        transform: translateZ(-2px) scale(1);
    }
    50% {
        opacity: 0.4;
        transform: translateZ(-2px) scale(1.2);
    }
}

/* Peak Contour Lines */
.peak-contour {
    position: absolute;
    width: 100%;
    height: 2px;
    left: 0;
    border-top: 1px solid;
    opacity: 0.3;
    transform-style: preserve-3d;
}

/* Hovered Peak */
.peak-hovered {
    animation: none;
    z-index: 10;
}

.peak-hovered .peak-top {
    box-shadow: 
        0 0 40px currentColor,
        inset 0 0 20px rgba(255, 255, 255, 0.4);
    filter: brightness(1.3);
}

.peak-hovered .peak-glow {
    opacity: 0.6;
    filter: blur(20px);
}

.peak-hovered .peak-side-1,
.peak-hovered .peak-side-2 {
    filter: brightness(1.2);
}

/* Responsive Terrain */
@media (max-width: 1200px) {
    .terrain-globe {
        width: 500px;
        height: 500px;
    }
    
    .terrain-peak {
        width: 40px;
        height: 40px;
    }
    
    .peak-top,
    .peak-side-1,
    .peak-side-2 {
        width: 30px;
    }
}

@media (max-width: 768px) {
    .terrain-3d-scene {
        perspective: 800px;
    }
    
    .terrain-globe {
        width: 400px;
        height: 400px;
    }
    
    .terrain-peak {
        width: 30px;
        height: 30px;
    }
    
    .peak-top,
    .peak-side-1,
    .peak-side-2 {
        width: 25px;
    }
}

/* Loading State Override */
.topo-3d-canvas {
    position: relative;
}

/* Ensure terrain renders above everything */
.terrain-3d-scene {
    z-index: 1;
}