/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Helvetica Neue', Arial, sans-serif;
    background-color: #ffffff;
    color: #333333;
    line-height: 1.75;
    font-size: 16px;
}

.logo-corner {
    position: sticky;
    top: clamp(24px, 6vw, 44px);
    right: clamp(24px, 6vw, 44px);
    left: auto;
    margin: clamp(24px, 6vw, 44px) clamp(24px, 6vw, 44px) 0 auto;
    background: rgba(31, 28, 26, 0.94);
    padding: clamp(7px, 1.1vw, 11px) clamp(16px, 4vw, 44px);
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.16);
    z-index: 10;
    text-decoration: none;
    transition: transform 0.25s ease, box-shadow 0.25s ease, opacity 0.25s ease;
}

.logo-corner:hover {
    transform: scale(1.05);
    box-shadow: 0 16px 34px rgba(0, 0, 0, 0.28);
}

.logo-corner:active {
    transform: scale(0.95);
}

.logo-corner:focus-visible {
    outline: 3px solid rgba(255, 255, 255, 0.45);
    outline-offset: 4px;
}

.logo-corner img {
    width: clamp(68px, 6vw, 110px);
    height: auto;
    display: block;
}

@media (max-width: 640px) {
    .logo-corner {
        top: 16px;
        right: 16px;
        left: auto;
        margin: 16px 16px 0 auto;
        padding: 8px clamp(14px, 5vw, 20px);
    }

    .logo-corner img {
        width: clamp(60px, 18vw, 90px);
    }
}

.container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 40px 20px;
    background-color: #ffffff;
}

/* Top Controls Layout */
.top-controls {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
    padding: 10px;
    background-color: #f8f8f8;
    border-radius: 4px;
    border: 1px solid #dddddd;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.top-control-section {
    flex: 1;
    min-width: 0;
}

.top-control-section h3 {
    color: #1a1a1a;
    margin-bottom: 6px;
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    border-bottom: 2px solid #e85d00;
    padding-bottom: 4px;
    line-height: 1.2;
}

/* Compact controls in top section */
.top-control-section .controller-row {
    margin-bottom: 10px;
}

.top-control-section .timeline-controls,
.top-control-section .year-controls {
    margin-top: 10px;
}

.top-control-section .legend-info {
    font-size: 12px;
    line-height: 1.4;
}

.top-control-section .legend-info p {
    margin: 4px 0;
}

.top-control-section .legend-items {
    gap: 15px;
    margin-bottom: 10px;
}

.top-control-section .legend-item {
    font-size: 12px;
    gap: 6px;
}

.top-control-section .percentage-legend {
    margin-top: 10px;
    padding: 8px;
}

.top-control-section .percentage-legend h4 {
    font-size: 13px;
    margin-bottom: 8px;
}

/* Main Content Layout */
.main-content {
    display: flex;
    gap: 30px;
    margin-bottom: 30px;
}

.left-panel {
    flex: 1;
    min-width: 0; /* Allows flex item to shrink below content size */
}

.right-panel {
    flex: 1;
    min-width: 0; /* Allows flex item to shrink below content size */
}

/* Header styles */
header {
    text-align: center;
    margin-bottom: 25px;
    padding: 20px 0 15px;
    border-bottom: 3px solid #e85d00;
}

.header-insight {
    margin: 15px auto 0;
    max-width: 800px;
    color: #333333;
    font-size: 1.05em;
    line-height: 1.4;
}

.highlight-stat {
    color: #e85d00;
    font-weight: 700;
    font-size: 1.1em;
}

header h1 {
    font-size: 2.2em;
    color: #1a1a1a;
    margin-bottom: 4px;
    font-weight: 700;
    letter-spacing: -0.5px;
    line-height: 1.1;
}

header h2 {
    font-size: 1.2em;
    color: #555555;
    margin-bottom: 2px;
    font-weight: 400;
    line-height: 1.2;
}

.subtitle {
    font-size: 0.9em;
    color: #777777;
    font-style: italic;
    font-weight: 300;
    margin-bottom: 15px;
    line-height: 1.3;
}

/* Main content layout */
.main-content {
    display: flex;
    gap: 30px;
    margin-bottom: 40px;
}

/* Controls section - now on the side */
.controls {
    background-color: #f8f8f8;
    padding: 25px;
    border-radius: 4px;
    border: 1px solid #dddddd;
    width: 280px;
    flex-shrink: 0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.control-section {
    margin-bottom: 30px;
}

.control-section h3 {
    color: #e85d00;
    margin-bottom: 15px;
    font-size: 18px;
    border-bottom: 2px solid #e85d00;
    padding-bottom: 8px;
    font-weight: 600;
}

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

.control-btn {
    background-color: #e85d00;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    transition: background-color 0.2s;
    flex-shrink: 0;
}

.control-btn:hover {
    background-color: #c74f00;
}

.control-btn:active {
    background-color: #a64200;
}

.slider {
    flex: 1;
    min-width: 200px;
    height: 6px;
    border-radius: 3px;
    background: #dddddd;
    outline: none;
    opacity: 0.9;
    transition: opacity 0.2s;
    cursor: pointer;
}

.slider:hover {
    opacity: 1;
}

.slider::-webkit-slider-thumb {
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #e85d00;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #e85d00;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.date-display {
    font-size: 18px;
    font-weight: 600;
    color: #e85d00;
    min-width: 80px;
}

.controller-row {
    display: flex;
    gap: 15px;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 15px;
}

.speed-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

.speed-controls label {
    color: #555555;
    font-weight: 500;
    margin-right: 10px;
}

.speed-btn {
    background-color: #f0f0f0;
    color: #333333;
    border: 1px solid #cccccc;
    padding: 5px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.speed-btn:hover {
    background-color: #e0e0e0;
    border-color: #e85d00;
}

.speed-btn.active {
    background-color: #e85d00;
    border-color: #e85d00;
    color: white;
}

.speed-display {
    background-color: #e85d00;
    color: white;
    padding: 8px 12px;
    border-radius: 4px;
    font-weight: 600;
    min-width: 40px;
    text-align: center;
    font-size: 14px;
}

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

.legend-controls label {
    color: #555555;
    font-weight: 500;
}

.legend-controls select {
    background-color: #ffffff;
    color: #333333;
    border: 1px solid #cccccc;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
}

.legend-controls select:focus {
    outline: none;
    border-color: #e85d00;
}

#opacity-value {
    color: #e85d00;
    font-weight: 600;
    min-width: 30px;
}

/* Map container */
#map-container {
    position: relative;
    background-color: #fafafa;
    border: 1px solid #dddddd;
    border-radius: 4px;
    overflow: hidden;
    flex: 1;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Leaflet map */
#leaflet-map {
    width: 100%;
    height: 800px;
    background-color: #fafafa;
}

/* Override Leaflet default styles for light theme */
.leaflet-container {
    background-color: #fafafa;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Helvetica Neue', Arial, sans-serif;
}

.leaflet-popup-content-wrapper {
    background-color: rgba(255, 255, 255, 0.98);
    color: #333333;
    border: 1px solid #cccccc;
    border-radius: 4px;
    box-shadow: 0 3px 14px rgba(0,0,0,0.15);
}

.leaflet-popup-tip {
    background-color: rgba(255, 255, 255, 0.98);
}

.leaflet-popup-content h4 {
    color: #e85d00;
    margin: 0 0 8px 0;
    font-weight: 600;
}

.leaflet-popup-content p {
    margin: 4px 0;
    font-size: 14px;
    color: #555555;
}

.leaflet-popup-content button {
    background-color: #e85d00;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    margin-top: 8px;
    font-size: 13px;
    font-weight: 500;
}

.leaflet-popup-content button:hover {
    background-color: #c74f00;
}

/* Map Style Controls */
.map-style-controls {
    position: absolute;
    bottom: 20px;
    left: 20px;
    z-index: 1000;
    background-color: rgba(255, 255, 255, 0.95);
    padding: 12px 18px;
    border-radius: 4px;
    border: 1px solid #dddddd;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.map-style-controls label {
    color: #555555;
    font-size: 14px;
    font-weight: 500;
    margin-right: 10px;
}

.map-style-selector {
    background-color: #ffffff;
    color: #333333;
    border: 1px solid #cccccc;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.map-style-selector:focus {
    outline: none;
    border-color: #e85d00;
}

.map-style-selector option {
    background-color: #ffffff;
    color: #333333;
}

/* Raster canvas for canvas-based rendering */
#raster-canvas {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
    pointer-events: none;
}

/* Observable Plot container */
#plot-container {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
    pointer-events: none;
}

#plot-container svg {
    display: block;
}

/* Date overlay - reduced size and increased transparency */
.date-overlay {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 1000;
    pointer-events: none;
}

.date-display-large {
    background-color: rgba(255, 255, 255, 0.95);
    padding: 6px 10px;
    border-radius: 4px;
    border: 2px solid #e85d00;
    text-align: center;
    min-width: 100px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.date-display-large #current-month {
    display: block;
    font-size: 18px;
    font-weight: 700;
    color: #e85d00;
    letter-spacing: 0.2px;
    line-height: 1.1;
}

.date-display-large #current-year {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #555555;
    margin-top: 1px;
    line-height: 1.1;
}

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

/* Background map styles */
.background-layer {
    opacity: 0.5;
}

.world-outline {
    fill: #f5f5f5;
    stroke: #cccccc;
    stroke-width: 0.5;
}

.water-body {
    fill: #e6f2ff;
    stroke: #b3d9ff;
    stroke-width: 1;
}

.water-label {
    fill: #4a90e2;
    font-size: 12px;
    font-weight: 600;
    text-anchor: middle;
    opacity: 0.7;
}

/* SVG styles */
.country {
    fill: none;
    stroke: #999999;
    stroke-width: 1;
    opacity: 0.8;
    cursor: pointer;
    transition: all 0.3s ease;
}

.country:hover {
    stroke: #e85d00;
    stroke-width: 2;
    opacity: 1;
}

.country-label {
    pointer-events: none;
    user-select: none;
}

.disputed-area {
    cursor: pointer;
    transition: all 0.3s ease;
}

.disputed-area:hover {
    stroke-width: 4;
    opacity: 1;
}

.district {
    cursor: pointer;
    transition: all 0.3s ease;
}

.district:hover {
    stroke-width: 2;
    stroke-opacity: 0.8;
}

.city {
    cursor: pointer;
    transition: all 0.3s ease;
}

.city:hover {
    r: 8;
    opacity: 1;
}

.city-label {
    pointer-events: none;
    user-select: none;
}

.nightlight-point {
    cursor: pointer;
    transition: r 0.2s ease;
}

.nightlight-point:hover {
    r: 4;
    stroke: #333333;
    stroke-width: 1;
}

/* Tooltip */
.tooltip {
    position: absolute;
    background-color: rgba(255, 255, 255, 0.98);
    color: #333333;
    padding: 12px 16px;
    border-radius: 4px;
    font-size: 14px;
    pointer-events: none;
    z-index: 1000;
    border: 1px solid #cccccc;
    box-shadow: 0 3px 14px rgba(0,0,0,0.2);
    opacity: 0;
    transition: opacity 0.2s;
}

.tooltip.show {
    opacity: 1;
}

.tooltip h4 {
    margin-bottom: 6px;
    color: #e85d00;
    font-weight: 600;
}

.tooltip p {
    margin: 3px 0;
    color: #555555;
}

/* Legend */
.legend, .country-legend {
    background-color: #f8f8f8;
    padding: 30px;
    border-radius: 4px;
    border: 1px solid #dddddd;
    margin-bottom: 30px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.country-legend {
    margin-top: 0;
}

.legend h3, .country-legend h3 {
    color: #1a1a1a;
    margin-bottom: 20px;
    text-align: center;
    font-size: 22px;
    font-weight: 600;
    border-bottom: 2px solid #e85d00;
    padding-bottom: 10px;
}

.legend-items {
    display: flex;
    justify-content: center;
    gap: 25px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #555555;
    font-size: 15px;
}

.legend-color {
    width: 24px;
    height: 5px;
    border-radius: 2px;
}

.legend-color.ukraine {
    background-color: #0066cc;
}

.legend-color.russia {
    background-color: #cc0000;
}

/* Percentage change legend colors */
.legend-color.increase {
    background-color: #2ca02c;
}

.legend-color.neutral {
    background-color: #ffcc00;
}

.legend-color.decrease {
    background-color: #d62728;
}

.percentage-legend {
    margin-top: 20px;
    padding: 15px;
    background-color: rgba(232, 93, 0, 0.05);
    border-radius: 4px;
    border-left: 4px solid #e85d00;
}

.percentage-legend h4 {
    margin: 0 0 12px 0;
    font-size: 16px;
    color: #1a1a1a;
    font-weight: 600;
}

/* Year navigation controls */
.year-navigation {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
}

.year-arrow-btn {
    background: #e85d00;
    color: white;
    border: none;
    border-radius: 4px;
    width: 32px;
    height: 32px;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.year-arrow-btn:hover {
    background: #c74f00;
}

.year-arrow-btn:disabled {
    background: #cccccc;
    cursor: not-allowed;
}

.year-play-btn {
    background: #e85d00;
    color: white;
    border: none;
    border-radius: 4px;
    width: 26px;
    height: 26px;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
    margin-left: 5px;
}

.year-play-btn:hover {
    background: #c74f00;
}

.year-play-btn:disabled {
    background: #cccccc;
    cursor: not-allowed;
}

.legend-color.disputed {
    background-color: #cc0000;
    background-image: repeating-linear-gradient(
        90deg,
        #cc0000,
        #cc0000 5px,
        transparent 5px,
        transparent 10px
    );
}

.nightlights-legend {
    display: flex;
    justify-content: center;
    gap: 25px;
    margin: 20px 0;
    flex-wrap: wrap;
}

.legend-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid #333333;
}

.legend-dot.ukraine-dot {
    background-color: #0066cc;
}

.legend-dot.russia-dot {
    background-color: #cc0000;
}

#color-legend {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
}

.legend-scale {
    display: flex;
    align-items: center;
    gap: 12px;
}

.legend-gradient {
    width: 220px;
    height: 22px;
    border: 1px solid #cccccc;
    border-radius: 3px;
}

.legend-labels {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 13px;
    color: #555555;
}

.legend-info {
    text-align: center;
    color: #777777;
    font-size: 14px;
    line-height: 1.6;
}

.legend-info p {
    margin: 8px 0;
}

.legend-info strong {
    color: #333333;
    font-weight: 600;
}

/* Legend Info Section */
.legend-info-section {
    background-color: #f8f8f8;
    padding: 20px;
    border-radius: 4px;
    border: 1px solid #dddddd;
    margin-bottom: 30px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

/* Collapsible Legend Sections */
.legend-sections {
    margin-top: 20px;
    margin-bottom: 20px;
}

.collapsible-section {
    background-color: #f8f8f8;
    border-radius: 4px;
    border: 1px solid #dddddd;
    margin-bottom: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.collapsible-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    cursor: pointer;
    background-color: #f0f0f0;
    border-radius: 4px 4px 0 0;
    transition: background-color 0.2s ease;
}

.collapsible-header:hover {
    background-color: #e8e8e8;
}

.collapsible-header h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #1a1a1a;
    border-bottom: none;
    padding-bottom: 0;
}

.toggle-icon {
    font-size: 12px;
    color: #666666;
    transition: transform 0.2s ease;
}

.collapsible-content {
    padding: 12px;
}

.collapsible-content .legend-info {
    margin-top: 8px;
}

.collapsible-content .legend-info p {
    margin: 4px 0;
    font-size: 12px;
    line-height: 1.4;
}

.collapsible-content .legend-items {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 8px;
}

.collapsible-content .legend-items-two-column {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 12px;
    margin-bottom: 8px;
}

.collapsible-content .legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
}

.collapsible-content .legend-color {
    width: 12px;
    height: 12px;
    border-radius: 2px;
}

.collapsible-content .legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.collapsible-content .percentage-legend {
    margin-top: 8px;
    padding: 6px;
    background-color: #ffffff;
    border-radius: 3px;
    border: 1px solid #e0e0e0;
}

.collapsible-content .percentage-legend h4 {
    margin: 0 0 6px 0;
    font-size: 12px;
    font-weight: 600;
    color: #333333;
}

/* Legend Subsections */
.legend-subsection {
    margin-bottom: 20px;
    padding-bottom: 15px;
}

.legend-subsection:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.legend-subsection h4 {
    margin: 0 0 10px 0;
    font-size: 13px;
    font-weight: 600;
    color: #333333;
    border-bottom: 1px solid #e85d00;
    padding-bottom: 4px;
}

.legend-subsection h5 {
    margin: 0 0 6px 0;
    font-size: 12px;
    font-weight: 600;
    color: #333333;
}

.research-note {
    background-color: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 4px;
    padding: 8px;
    margin-top: 8px;
}

.research-note p {
    margin: 0;
    font-size: 11px;
    line-height: 1.3;
    color: #856404;
}


/* Two Column Content Layout */
.two-column-content {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 30px !important;
    margin: 20px 0 !important;
    width: 100% !important;
}

.two-column-content .column {
    min-width: 0 !important; /* Allows grid item to shrink below content size */
    display: block !important;
}

.two-column-content .column p {
    margin-bottom: 10px !important;
}

.two-column-content .column ul {
    margin: 0 !important;
    padding-left: 20px !important;
}

.two-column-content .column li {
    margin-bottom: 8px !important;
    line-height: 1.4 !important;
}

@media (max-width: 768px) {
    .two-column-content {
        grid-template-columns: 1fr !important;
        gap: 20px !important;
    }
}

/* Citations */
.citations {
    margin: 15px 0;
    padding-left: 20px;
}

.citations li {
    margin-bottom: 10px;
    line-height: 1.5;
    font-size: 14px;
}

.citations a {
    color: #e85d00;
    text-decoration: none;
}

.citations a:hover {
    text-decoration: underline;
}

/* Research Context Section */
.research-context {
    background-color: #f8f9fa;
    border: 1px solid #e85d00;
    border-radius: 6px;
    padding: 20px;
    margin: 20px 0;
}

.research-context h4 {
    color: #1a1a1a;
    font-size: 1.2em;
    margin-bottom: 12px;
    font-weight: 600;
    border-bottom: 2px solid #e85d00;
    padding-bottom: 6px;
}

.research-context p {
    margin-bottom: 12px;
    line-height: 1.5;
}

.research-context ul {
    margin: 12px 0;
    padding-left: 20px;
}

.research-context li {
    margin-bottom: 8px;
    line-height: 1.4;
}


/* Line Graph Styles */
.line-graph-container {
    background-color: #f8f8f8;
    padding: 30px;
    border-radius: 4px;
    border: 1px solid #dddddd;
    margin-bottom: 30px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.line-graph-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.line-graph-header h3 {
    color: #1a1a1a;
    font-size: 22px;
    font-weight: 600;
    border-bottom: 2px solid #e85d00;
    padding-bottom: 10px;
    margin: 0;
}

.graph-subtitle {
    color: #666666;
    font-size: 14px;
    margin: 5px 0 0 0;
    font-style: italic;
}

.graph-controls {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.graph-toggle-btn {
    background-color: #e85d00;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.2s ease;
}

.graph-toggle-btn:hover {
    background-color: #d04a00;
}

.graph-toggle-btn.hidden {
    background-color: #666666;
}

.graph-city-selector {
    background-color: #ffffff;
    color: #333333;
    border: 1px solid #cccccc;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    min-width: 200px;
    max-height: 120px;
    overflow-y: auto;
}

.graph-city-selector:focus {
    outline: none;
    border-color: #e85d00;
}

.line-graph {
    width: 100%;
    height: 500px;
    background-color: #ffffff;
    border: 1px solid #dddddd;
    border-radius: 4px;
    position: relative;
    overflow: visible;
}

.line-graph.hidden {
    display: none;
}

.line-graph-disabled {
    width: 100%;
    height: 500px;
    background-color: #f5f5f5;
    border: 1px solid #dddddd;
    border-radius: 4px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.disabled-message {
    text-align: center;
    color: #666666;
    padding: 20px;
}

.disabled-message p {
    margin: 10px 0;
    font-size: 14px;
    line-height: 1.5;
}

/* D3 Graph Styles */
.graph-axis {
    font-size: 12px;
    color: #666666;
}

.graph-axis-label {
    font-size: 14px;
    font-weight: 500;
    color: #333333;
}

.graph-line {
    fill: none;
    stroke-width: 2px;
    stroke-linecap: round;
    stroke-linejoin: round;
    opacity: 1;
}

.graph-line.ukraine {
    stroke: #0066cc;
}

.graph-line.russia {
    stroke: #cc0000;
}

.graph-dot {
    stroke-width: 2px;
    cursor: pointer;
    transition: r 0.2s ease;
}

.graph-dot:hover {
    r: 6;
}

.graph-dot.ukraine {
    fill: #0066cc;
    stroke: #ffffff;
}

.graph-dot.russia {
    fill: #cc0000;
    stroke: #ffffff;
}

.graph-tooltip {
    position: absolute;
    background-color: rgba(255, 255, 255, 0.95);
    border: 2px solid #e85d00;
    border-radius: 4px;
    padding: 10px;
    font-size: 13px;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    display: none;
    max-width: 250px;
    line-height: 1.5;
}

.graph-tooltip.visible {
    display: block;
}

.graph-legend {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: rgba(255, 255, 255, 0.9);
    padding: 10px;
    border-radius: 4px;
    border: 1px solid #dddddd;
    font-size: 12px;
}

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

.graph-legend-color {
    width: 12px;
    height: 2px;
    border-radius: 1px;
}

.graph-legend-color.ukraine {
    background-color: #0066cc;
}

.graph-legend-color.russia {
    background-color: #cc0000;
}

/* Label Toggle Controls */
.label-toggles {
    margin-top: 18px;
    padding-top: 18px;
}

.label-toggles h4 {
    color: #e85d00;
    margin: 0 0 12px 0;
    font-size: 15px;
    font-weight: 600;
}

.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    color: #555555;
    font-size: 14px;
    user-select: none;
}

.checkbox-label input[type="checkbox"] {
    display: none;
}

.checkmark {
    width: 18px;
    height: 18px;
    background-color: #ffffff;
    border: 2px solid #e85d00;
    border-radius: 3px;
    margin-right: 10px;
    position: relative;
    transition: all 0.2s ease;
}

.checkbox-label:hover .checkmark {
    background-color: #fef5f0;
}

.checkbox-label input[type="checkbox"]:checked + .checkmark {
    background-color: #e85d00;
}

.checkbox-label input[type="checkbox"]:checked + .checkmark::after {
    content: "✓";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #ffffff;
    font-size: 12px;
    font-weight: bold;
}

/* Grid lines */
.grid-line {
    fill: none;
    stroke: #cccccc;
    stroke-width: 0.5;
    stroke-opacity: 0.6;
    stroke-dasharray: 2,2;
    pointer-events: none;
}

.grid-label {
    font-size: 11px;
    fill: #888888;
    opacity: 0.8;
    pointer-events: none;
    text-anchor: middle;
}


/* Zoom Controls */
.zoom-controls {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.zoom-btn {
    width: 48px;
    height: 48px;
    background-color: rgba(255, 255, 255, 0.95);
    border: 1px solid #dddddd;
    border-radius: 4px;
    color: #e85d00;
    font-size: 22px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    user-select: none;
}

.zoom-btn:hover {
    background-color: #e85d00;
    color: #ffffff;
    transform: scale(1.05);
    box-shadow: 0 3px 12px rgba(0,0,0,0.2);
}

.zoom-btn:active {
    transform: scale(0.98);
}

#zoom-in {
    font-size: 26px;
}

#zoom-out {
    font-size: 28px;
}

#reset-zoom {
    font-size: 20px;
}

/* Footer */
footer {
    padding: 40px;
    background-color: #f8f8f8;
    border-radius: 4px;
    border: 1px solid #dddddd;
    color: #555555;
    font-size: 15px;
    line-height: 1.75;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

footer p {
    margin: 12px 0;
    text-align: left;
}

.footer-section {
    margin-bottom: 35px;
    padding-bottom: 25px;
}

.footer-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.footer-section h3 {
    color: #1a1a1a;
    font-size: 24px;
    margin-bottom: 20px;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid #e85d00;
    padding-bottom: 10px;
}

.footer-section h4 {
    color: #333333;
    font-size: 18px;
    margin: 20px 0 12px 0;
    text-align: left;
    font-weight: 600;
}

.calculation-explanation {
    margin-bottom: 25px;
}

.calculation-explanation p {
    margin: 10px 0;
}

.calculation-explanation code {
    background-color: #f0f0f0;
    padding: 5px 10px;
    border-radius: 3px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'source-code-pro', monospace;
    color: #c7254e;
    border: 1px solid #e0e0e0;
    font-size: 14px;
}

.examples-container {
    display: flex;
    gap: 15px;
    margin: 20px 0;
}

.example-box {
    background-color: #fff8f0;
    border-left: 4px solid #e85d00;
    padding: 15px;
    margin: 0;
    border-radius: 4px;
    flex: 1;
    min-width: 0;
}

.example-box p {
    font-weight: 600;
    color: #333333;
    margin-bottom: 12px;
    font-size: 16px;
}

.example-box ul {
    list-style: none;
    padding-left: 0;
    margin: 0;
}

.example-box li {
    padding: 6px 0;
    color: #555555;
}

.example-box strong {
    color: #e85d00;
    font-weight: 600;
}

.positive-change {
    color: #2ca02c;
    font-weight: 700;
}

.negative-change {
    color: #d62728;
    font-weight: 700;
}

.interpretation-guide {
    margin-top: 25px;
}

.interpretation-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
    background-color: #ffffff;
    border: 1px solid #dddddd;
}

.interpretation-table th,
.interpretation-table td {
    padding: 14px 16px;
    text-align: left;
    border: 1px solid #dddddd;
}

.interpretation-table th {
    background-color: #f8f8f8;
    color: #1a1a1a;
    font-weight: 600;
    font-size: 15px;
}

.interpretation-table td {
    color: #555555;
    font-size: 14px;
}

.color-indicator {
    display: inline-block;
    padding: 5px 14px;
    border-radius: 3px;
    font-weight: 600;
    font-size: 13px;
}

.color-indicator.green {
    background-color: #2ca02c;
    color: #ffffff;
}

.color-indicator.yellow {
    background-color: #ffcc00;
    color: #333333;
}

.color-indicator.red {
    background-color: #d62728;
    color: #ffffff;
}

/* Responsive design */
@media (max-width: 768px) {
    .container {
        padding: 20px 10px;
    }
    
    header {
        padding: 30px 0 20px;
    }
    
    header h1 {
        font-size: 2em;
    }
    
    .main-content {
        flex-direction: column;
    }
    
    .controls {
        width: 100%;
        order: 2;
    }
    
    #map-container {
        order: 1;
        margin-bottom: 20px;
    }
    
    .time-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .legend-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .slider {
        min-width: auto;
    }
    
    #map-svg {
        height: 400px;
    }
    
    /* Responsive layout for top controls */
    .top-controls {
        flex-direction: column;
        gap: 15px;
        padding: 10px;
    }
    
    .top-control-section {
        flex: none;
    }
    
    .top-control-section h3 {
        font-size: 14px;
        margin-bottom: 8px;
    }
    
    /* Responsive layout for side-by-side panels */
    .main-content {
        flex-direction: column;
        gap: 20px;
    }
    
    .left-panel, .right-panel {
        flex: none;
    }
    
    .line-graph {
        height: 400px;
    }
    
    #leaflet-map {
        height: 400px;
    }
    
    .date-display-large {
        padding: 12px 18px;
        min-width: 120px;
    }
    
    .date-display-large #current-month {
        font-size: 20px;
    }
    
    .date-display-large #current-year {
        font-size: 16px;
    }
    
    .zoom-controls {
        top: 10px;
        right: 10px;
    }
    
    .zoom-btn {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }
    
    footer {
        padding: 25px;
    }
    
    /* Stack examples vertically on mobile */
    .examples-container {
        flex-direction: column;
        gap: 10px;
    }
    
    /* Stack percentage legend items vertically on mobile */
    .collapsible-content .legend-items-two-column {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
}

/* Animation classes */
.fade-in {
    animation: fadeIn 0.4s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.pulse {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 0.8; }
    50% { opacity: 1; }
    100% { opacity: 0.8; }
}

/* Year-over-Year Controls */
.year-controls {
    margin-top: 18px;
    padding-top: 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.year-controls label {
    color: #555555;
    font-weight: 500;
    font-size: 14px;
}

.year-controls select {
    background-color: #ffffff;
    color: #333333;
    border: 1px solid #cccccc;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.year-controls select:focus {
    outline: none;
    border-color: #e85d00;
}

#current-year-display {
    color: #e85d00;
    font-weight: 600;
    min-width: 40px;
}

/* Timeline Controls */
.timeline-controls {
    margin-top: 18px;
    padding-top: 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.timeline-controls label {
    color: #555555;
    font-weight: 500;
    font-size: 14px;
}

.timeline-controls input[type="range"] {
    background-color: #ffffff;
    color: #333333;
    border: 1px solid #cccccc;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.timeline-controls input[type="range"]:focus {
    outline: none;
    border-color: #e85d00;
}

#current-date {
    color: #e85d00;
    font-weight: 600;
    min-width: 40px;
    text-align: center;
}

/* Render Mode Selection */
.render-mode-selection {
    margin-top: 18px;
    padding-top: 18px;
}

.render-mode-selection h4 {
    color: #333333;
    margin: 0 0 12px 0;
    font-size: 15px;
    font-weight: 600;
}

/* Visualization Mode Controls */
.visualization-modes {
    margin-top: 18px;
    padding-top: 18px;
}

.visualization-modes h4 {
    color: #e85d00;
    margin: 0 0 12px 0;
    font-size: 15px;
    font-weight: 600;
}

.radio-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.radio-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    color: #555555;
    font-size: 14px;
    user-select: none;
}

.radio-label input[type="radio"] {
    display: none;
}

.radio-mark {
    width: 18px;
    height: 18px;
    background-color: #ffffff;
    border: 2px solid #e85d00;
    border-radius: 50%;
    margin-right: 10px;
    position: relative;
    transition: all 0.2s ease;
}

.radio-label:hover .radio-mark {
    background-color: #fef5f0;
}

.radio-label input[type="radio"]:checked + .radio-mark {
    background-color: #e85d00;
}

.radio-label input[type="radio"]:checked + .radio-mark::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 8px;
    height: 8px;
    background-color: #ffffff;
    border-radius: 50%;
}

/* Heatmap styles */
.heatmap-layer {
    opacity: 0.8;
}

.heatmap-cell {
    stroke: none;
    stroke-width: 0;
}

/* Migration analysis styles */
.migration-arrow {
    stroke-width: 2;
    fill: none;
    opacity: 0.7;
}

.migration-arrow.strong {
    stroke-width: 3;
    opacity: 1.0;
}

.migration-arrow.weak {
    stroke-width: 1;
    opacity: 0.4;
}
