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

body {
    font-family: var(--font-family-brand);
    background: var(--color-background-alt);
    height: 100vh;
    overflow: hidden;
}

.container {
    position: relative;
    width: 100vw;
    height: 100vh;
    /* Prevent clipping of transformed SVG overlay */
    overflow: visible;
    /* Let Leaflet handle touch gestures (pan/pinch), prevent browser zoom */
    touch-action: pan-x pan-y pinch-zoom;
}

#map {
    width: 100vw;
    height: 100vh;
    z-index: 1;
    /* Let Leaflet handle touch gestures (pan/pinch), prevent browser zoom */
    touch-action: pan-x pan-y pinch-zoom;
}

#graph-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 2;
    /* Prevent clipping during pan/zoom CSS transforms */
    overflow: visible;
}

/* Enable pointer events on graph nodes for interaction */
#graph-overlay circle {
    pointer-events: all;
    cursor: pointer;
}

/* Keep lines non-interactive so clicks pass through to nodes or map */
#graph-overlay line {
    pointer-events: none;
}


.loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--color-background-overlay);
    padding: var(--spacing-xl);
    border-radius: 10px;
    box-shadow: var(--shadow-lg);
    z-index: var(--z-index-dropdown);
}


/* Error display styles */
#error {
    position: fixed;
    top: var(--spacing-xl);
    right: var(--spacing-xl);
    background-color: var(--color-error);
    color: var(--color-background);
    padding: 15px;
    border-radius: var(--radius-md);
    z-index: var(--z-index-dropdown);
    max-width: 300px;
    box-shadow: var(--shadow-lg);
}



/* Control Panel Styles */
.control-panel {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: var(--z-index-dropdown);
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    padding: var(--spacing-sm);
    font-family: var(--font-family-brand);
    font-size: var(--font-size-base);
    width: 280px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: transform 0.3s ease;
    transform: translateX(0);
}

/* Collapsed state - slide off-screen, leaving tab handle visible */
.control-panel.collapsed {
    transform: translateX(-280px);
}

/* Tab handle for collapse/expand */
.control-panel-tab-handle {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    right: -10px;
    width: 10px;
    height: 120px;
    background: #e9ecef;
    border: 1px solid var(--color-border);
    border-left: none;
    border-radius: 0 6px 6px 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 2px 2px 8px rgba(0, 0, 0, 0.15);
    transition: background 0.2s, width 0.2s ease;
    padding: 0;
}

.control-panel-tab-handle:hover {
    background: #dee2e6;
    width: 14px;
}

.control-panel-tab-handle svg {
    width: 16px;
    height: 16px;
    fill: #495057;
    opacity: 0;
    transition: opacity 0.2s, transform 0.3s ease;
}

.control-panel-tab-handle:hover svg {
    opacity: 1;
}

/* Rotate arrow when panel is collapsed */
.control-panel.collapsed .control-panel-tab-handle svg {
    transform: rotate(180deg);
}

.control-section {
    padding: 1px 0;
    border-bottom: 1px solid var(--color-background-alt);
}

.control-section:last-child {
    border-bottom: none;
    padding: 1px 0;
}

.section-label {
    display: block;
    font-weight: var(--font-weight-semibold);
    margin-bottom: var(--spacing-sm);
    color: var(--color-text-muted);
    font-size: var(--font-size-sm);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.info-icon {
    display: inline-block;
    width: 14px;
    height: 14px;
    line-height: 14px;
    text-align: center;
    border-radius: var(--radius-round);
    font-size: var(--font-size-xs);
    cursor: help;
    margin-left: var(--spacing-xs);
    opacity: 0.6;
    background: var(--color-secondary);
    color: var(--color-background);
}

.info-icon:hover {
    opacity: 1;
}

/* Search Container (in header) */
.search-container {
    position: relative;
    display: flex;
    gap: var(--spacing-xs);
    flex: 7; /* Take ~7/8 of header width, minimal space for help icon */
}

.search-container input {
    flex: 1;
    padding: var(--spacing-sm) 10px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: var(--font-size-base);
    transition: border-color var(--transition-normal), box-shadow var(--transition-normal);
}

.search-container input:focus {
    outline: none;
    border-color: #80bdff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.search-icon-btn {
    min-width: 40px;
}

.wiki-link-icon {
    position: absolute;
    right: var(--spacing-sm);
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-primary);
    opacity: 0.7;
    transition: opacity var(--transition-normal);
    text-decoration: none;
}

.wiki-link-icon:hover {
    opacity: 1;
}

.wiki-link-icon.hidden {
    display: none;
}

.wiki-link-icon-inline {
    position: absolute;
    right: 10px; /* No search button anymore */
    top: 50%;
    transform: translateY(-50%);
    color: #495057; /* Darker grey to match modal icons */
    opacity: 0.8;
    transition: opacity var(--transition-normal);
    text-decoration: none;
    z-index: 10;
    pointer-events: auto;
}

.wiki-link-icon-inline:hover {
    opacity: 1;
}

.wiki-link-icon-inline.hidden {
    display: none;
}

.lucky-btn-inline {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    color: #495057;
    opacity: 0.6;
    transition: opacity var(--transition-normal);
    pointer-events: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.lucky-btn-inline:hover {
    opacity: 1;
}

.lucky-btn-inline.hidden {
    display: none;
}

/* Search Dropdown */
.search-dropdown {
    position: absolute;
    top: calc(100% + var(--spacing-xs));
    left: 0;
    right: 44px; /* Leave space for the search button */
    background: var(--color-background);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    max-height: 200px;
    overflow-y: auto;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    z-index: 1001;
}

.search-dropdown.hidden {
    display: none;
}

.search-result-item {
    padding: var(--spacing-sm) var(--spacing-md);
    cursor: pointer;
    border-bottom: 1px solid #f1f3f5;
    transition: background-color 0.1s;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover {
    background-color: var(--color-background-alt);
}

.search-result-item.selected {
    background-color: #e7f3ff;
}

/* Too big for seed styling - greyed and italicized */
.search-result-item.too-big-for-seed {
    color: #999;
    font-style: italic;
}

.search-result-item.too-big-for-seed .search-result-title {
    color: #999;
    font-style: italic;
}

.search-result-item.too-big-for-seed:hover {
    background-color: var(--color-background-alt);
}

/* Warning modal for too-big-for-seed pages */
.too-big-warning-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.too-big-warning-modal {
    background: white;
    padding: var(--spacing-xl);
    border-radius: var(--radius-lg);
    max-width: 400px;
    width: 90%;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    text-align: center;
}

.too-big-warning-modal h3 {
    margin: 0 0 var(--spacing-md) 0;
    color: var(--color-text);
    font-size: 1.25rem;
}

.too-big-warning-modal p {
    margin: 0 0 var(--spacing-md) 0;
    color: var(--color-secondary);
    line-height: 1.5;
}

.too-big-warning-modal .modal-close-btn {
    padding: var(--spacing-sm) var(--spacing-xl);
    background-color: var(--color-primary);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-medium);
    transition: background-color 0.2s;
}

.too-big-warning-modal .modal-close-btn:hover {
    background-color: #0056b3;
}

.search-result-title {
    font-weight: var(--font-weight-medium);
    color: var(--color-text);
    font-size: var(--font-size-base);
}

.search-result-meta {
    font-size: var(--font-size-sm);
    color: var(--color-secondary);
    margin-top: 2px;
}

/* Location Container */
.location-container {
    position: relative;
    display: flex;
    gap: var(--spacing-xs);
}

.location-container input {
    flex: 1;
    padding: var(--spacing-sm) 10px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: var(--font-size-base);
}

.location-container input:focus {
    outline: none;
    border-color: #80bdff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.icon-btn {
    position: relative;
    padding: var(--spacing-xs);
    background: var(--color-primary);
    color: var(--color-text);
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background-color var(--transition-normal);
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-btn:hover {
    background: var(--color-primary-hover);
}

.icon-btn:active {
    background: var(--color-border);
}

/* Section Header Row */
.section-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0;
    padding-top: var(--spacing-sm);
}

/* Accordion Chevron */
.accordion-chevron {
    display: inline-block;
    margin-right: var(--spacing-sm);
    transition: transform var(--transition-normal) ease;
    font-size: var(--font-size-sm);
    transform: rotate(90deg); /* Point down when open by default */
}

/* Collapsible Content */
.collapsible-content {
    max-height: 500px;
    overflow: visible;
    transition: max-height var(--transition-slow) ease-out, opacity var(--transition-slow) ease-out;
    opacity: 1;
}

.collapsible-content.collapsed {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
}

/* Histogram Container */
.histogram-container {
    margin-bottom: var(--spacing-sm);
    height: 50px;
    background: var(--color-background-alt);
    border-radius: var(--radius-md);
    padding: 5px;
}

.selectivity-histogram {
    width: 100%;
    height: 100%;
}

/* Slider with Eye Container */
.slider-with-eye-container {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    margin-bottom: 10px;
}

.slider-container {
    flex: 1;
    display: flex;
    align-items: center;
}

#selectivity-filter {
    width: 100%;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    background: linear-gradient(to right, #d0d0d0 0%, #d0d0d0 50%, #6c757d 50%, #6c757d 100%);
    border-radius: 3px;
    outline: none;
}

/* Slider thumb (the draggable circle) */
#selectivity-filter::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #495057; /* darker grey */
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

#selectivity-filter::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #495057; /* darker grey */
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Eye Icon Button */
.eye-icon-btn {
    background-color: var(--color-secondary);
    color: var(--color-background);
    border: none;
    padding: var(--spacing-sm);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-normal) ease;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    min-width: 40px;
    height: 40px;
}

.eye-icon-btn:hover {
    background-color: #5a6268;
    transform: translateY(-1px);
}

.eye-icon-btn:active {
    background-color: #545b62;
    transform: translateY(1px);
}

.hidden-count-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    background-color: #E5C0C0; /* Light red (Wikipedia brand color) */
    color: #333;
    border-radius: 10px;
    padding: 2px 6px;
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-bold);
    min-width: 18px;
    text-align: center;
}

.hidden-count-badge:empty {
    display: none;
}

/* Blink animation for auto-hide notification */
@keyframes blink {
    0%, 100% { background-color: var(--color-secondary); }
    50% { background-color: var(--color-danger); }
}

/* Spinner rotation animation */
@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.icon-spinner {
    animation: spin 1s linear infinite;
}

.blink-notification {
    animation: blink 0.5s ease-in-out 3;
}

/* Control Panel Header (Search + Help Icon) */
.control-panel-header {
    padding: var(--spacing-sm);
    display: flex;
    gap: var(--spacing-sm);
    align-items: center;
    border-bottom: 1px solid var(--color-border);
}

/* Help Icon Container - centers the help button */
.help-icon-container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Help Icon Button (in header row) */
.help-icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    color: var(--color-text);
    opacity: 0.7;
    transition: opacity var(--transition-normal) ease, transform var(--transition-normal) ease, background-color var(--transition-normal) ease;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    min-width: 40px;
    min-height: 40px;
    flex-shrink: 0;
}

.help-icon-btn:hover {
    opacity: 1;
    background-color: rgba(0, 0, 0, 0.05);
    transform: scale(1.05);
}

.help-icon-btn:active {
    transform: scale(0.95);
}

/* Ensure container has relative positioning for debug panel */
.container {
    position: relative;
}

/* Node Information Modal Styles */
.node-modal {
    position: fixed;
    z-index: 2001;
    display: none;
    background: var(--color-background);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    /* Default positioning - will be overridden by position classes */
    top: 0;
    right: 0;
    height: 100vh;
    width: 33.33vw;
    transform: translateX(100%);
}

.node-modal.show {
    display: flex;
    flex-direction: column;
}

.node-modal.show .node-modal-content {
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* Debug borders removed - issue identified */

.node-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.3);
    z-index: 2000;
    display: none;
}

.node-modal.show {
    display: flex;
}

.node-modal-content {
    background: var(--color-background);
    overflow: hidden;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    position: relative;
    contain: layout;
}

.node-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: var(--spacing-xl);
    border-bottom: 1px solid var(--color-border);
    background: var(--color-background);
    flex-shrink: 0;
}

.node-modal-title-section {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    flex: 1;
}

.node-modal-title {
    margin: 0;
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text);
    flex: 1;
}

.node-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    font-weight: var(--font-weight-bold);
    color: var(--color-text-light);
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-round);
    transition: all var(--transition-normal) ease;
}

.node-modal-close:hover {
    background-color: var(--color-background-alt);
    color: var(--color-text);
}

.node-modal-close:active {
    background-color: #e0e0e0;
}


.node-modal-body {
    padding: var(--spacing-xs);
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    background: var(--color-background);
    min-height: 0; /* Allow flex item to shrink below content size */
    max-height: calc(100vh - 200px); /* Reserve space for header and footer */
}

/* Adjust modal body for horizontal mode to prevent scrollbars */
.node-modal.position-bottom .node-modal-body {
    max-height: none; /* Remove height constraint in horizontal mode */
    overflow-y: visible; /* Allow content to flow naturally */
}

.node-modal-info p {
    margin: 0 0 var(--spacing-lg) 0;
    font-size: var(--font-size-lg);
    line-height: 1.6;
    color: var(--color-text);
}

.node-modal-info strong {
    color: #000;
    font-weight: var(--font-weight-semibold);
}

/* Responsive positioning based on aspect ratio */
/* Default: wider than tall - position on right */
.node-modal.position-right {
    top: 0;
    right: 0;
    height: 100vh;
    width: 50vw;
    transform: translateX(100%);
}

/* Position classes for dynamic positioning */

.node-modal.position-right.show {
    transform: translateX(0);
}

.node-modal.position-bottom {
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    height: 70vh;
    width: 100vw;
    transform: translateY(100%);
}

.node-modal.position-bottom.show {
    transform: translateY(0);
}

/* Node modal footer */
.node-modal-footer {
    padding: var(--spacing-sm) var(--spacing-md); /* Reduced from lg/xl to sm/md for compact footer */
    background-color: var(--color-background);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--spacing-md);
    flex-shrink: 0; /* Prevent footer from shrinking */
    border-top: 1px solid #e0e0e0; /* Add subtle border to separate from content */
    min-height: 32px; /* Compact footer */
}

/* Hide text styling */
.node-modal-hide-text {
    color: var(--color-secondary);
    cursor: pointer;
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-normal);
    transition: all var(--transition-normal) ease;
    align-self: flex-start;
    padding: 2px var(--spacing-xs);
    border-radius: var(--radius-sm);
    user-select: none;
}

.node-modal-hide-text:hover {
    color: var(--color-secondary-hover);
    background-color: var(--color-background-alt);
}

.node-modal-hide-text:active {
    color: #343a40;
    background-color: var(--color-background-alt);
}

/* Dump date styling */
.dump-date-info {
    margin: 0;
    text-align: right;
}

#dump-date-text {
    font-size: var(--font-size-sm);
    color: #666;
    font-style: italic !important;
    font-family: inherit;
    white-space: nowrap;
}


/* SubGraph Visualization Styles */
.subgraph-container {
    flex: 1;
    min-height: 200px;
    margin-top: var(--spacing-lg);
    margin-bottom: 0px;
    background: transparent;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    z-index: 1; /* Ensure it stays within the modal */
}


.subgraph-force-simulation-container {
    width: 100%;
    height: 100%;
    min-height: 200px;
    position: relative;
    background: transparent;
    overflow: hidden;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.subgraph-force-simulation-container svg {
    width: 100%;
    height: 100%;
    min-height: 200px;
    max-height: 100%;
    display: block;
    position: relative;
}

.subgraph-svg {
    width: 100%;
    height: 100%;
    min-height: 200px;
    display: block;
}

/* D3 Force Simulation Styles */
.subgraph-force-simulation-container .node {
    cursor: pointer;
    transition: all var(--transition-normal) ease;
}

.subgraph-force-simulation-container .node circle {
    stroke-width: 2px;
    transition: all var(--transition-normal) ease;
}

.subgraph-force-simulation-container .node:hover circle {
    stroke: #ff6b6b;
    stroke-width: 3px;
    filter: brightness(1.1);
}

.subgraph-force-simulation-container .node.dragging circle {
    stroke-width: 4px;
    filter: brightness(1.2);
}

.subgraph-force-simulation-container .node text {
    font-family: var(--font-family-sans);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-bold);
    text-anchor: middle;
    pointer-events: none;
    fill: var(--color-text);
    user-select: none;
    white-space: pre-line;
}

.subgraph-force-simulation-container .node tspan {
    dominant-baseline: hanging;
}

/* Ensure text remains unchanged on hover */
.subgraph-force-simulation-container .node:hover text {
    fill: var(--color-text) !important;
    stroke: none !important;
    stroke-width: 0 !important;
}

.subgraph-force-simulation-container .link {
    stroke: var(--color-text-light);
    stroke-opacity: 0.6;
    stroke-width: 2px;
    pointer-events: none;
    transition: all var(--transition-normal) ease;
}

.subgraph-force-simulation-container .link:hover {
    stroke: #666;
    stroke-width: 3px;
    stroke-opacity: 0.8;
}

.subgraph-force-simulation-container .link.highlighted {
    stroke: #4caf50;
    stroke-width: 3px;
    stroke-opacity: 1;
}

/* Arrow marker styles for D3 */
.subgraph-force-simulation-container .arrow-marker {
    fill: var(--color-text-light);
    stroke: var(--color-text-light);
    stroke-width: 1px;
}

.subgraph-force-simulation-container .arrow-marker.highlighted {
    fill: #4caf50;
    stroke: #4caf50;
}



/* Pagination Controls */
.subgraph-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--spacing-sm);
    margin: 0;
    padding: 0;
}

/* Hide pagination when only one page */
.subgraph-pagination.single-page {
    display: none;
}

.subgraph-pagination-btn {
    background-color: var(--color-primary);
    color: var(--color-text);
    border: none;
    padding: 2px 8px; /* Compact padding to match text height */
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    transition: all var(--transition-normal) ease;
    min-width: 24px;
    height: 20px; /* Same height as text */
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.subgraph-pagination-btn:hover:not(:disabled) {
    background-color: var(--color-primary-hover);
    transform: translateY(-1px);
}

.subgraph-pagination-btn:active:not(:disabled) {
    background-color: var(--color-border);
    transform: translateY(0);
}

.subgraph-pagination-btn:disabled {
    background-color: #ccc;
    color: #666;
    cursor: not-allowed;
    transform: none;
}

.subgraph-page-info {
    font-size: var(--font-size-sm);
    color: #666;
    font-weight: var(--font-weight-medium);
    min-width: 80px;
    text-align: center;
    white-space: nowrap;
}

/* Modal header styling updates */
.node-modal-header h3 {
    margin: 0;
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text);
    flex: 1;
}

/* Hide button styling - Duplicate styles removed, already defined above */

/* Wikipedia link button */
.node-modal-wiki-link {
    color: var(--color-secondary);
    text-decoration: none;
    cursor: pointer;
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-normal);
    transition: all var(--transition-normal) ease;
    align-self: flex-start;
    padding: 2px var(--spacing-xs);
    border-radius: var(--radius-sm);
    user-select: none;
    display: inline-block;
}

.node-modal-wiki-link:hover {
    color: var(--color-secondary-hover);
    background-color: var(--color-background-alt);
}

.node-modal-wiki-link:active {
    color: #343a40;
    background-color: var(--color-background-alt);
}

/* Center on node button */
.node-modal-center-btn {
    color: var(--color-secondary);
    cursor: pointer;
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-normal);
    transition: all var(--transition-normal) ease;
    align-self: flex-start;
    padding: 2px var(--spacing-xs);
    border-radius: var(--radius-sm);
    user-select: none;
    background: none;
    border: none;
}

.node-modal-center-btn:hover {
    color: var(--color-secondary-hover);
    background-color: var(--color-background-alt);
}

.node-modal-center-btn:active {
    color: #343a40;
    background-color: var(--color-background-alt);
}


/* ===================================================================
   MOBILE DEVICE STYLES
   Device-based styling (not viewport-based) - desktop stays desktop even when resized
   =================================================================== */
html.device-mobile {
    /* Typography - Increase base font sizes for readability */
    --font-size-xs: 12px;
    --font-size-sm: 14px;
    --font-size-base: 16px;
    --font-size-md: 16px;
    --font-size-lg: 18px;
}

html.device-mobile .control-panel {
    transform: translateX(-280px);
    opacity: 1;
    pointer-events: auto;
}

html.device-mobile .control-panel.expanded {
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
}

html.device-mobile .control-panel.collapsed {
    opacity: 1;
    pointer-events: auto;
}

/* Touch Targets - Minimum 44×44px for all interactive elements */
html.device-mobile .help-icon-btn,
html.device-mobile .icon-btn,
html.device-mobile .hider-modal-info-btn,
html.device-mobile .eye-icon-btn {
    min-width: 44px;
    min-height: 44px;
    padding: 10px;
}

html.device-mobile .node-modal-close,
html.device-mobile .hider-modal-close,
html.device-mobile .about-modal-close {
    width: 44px;
    height: 44px;
    font-size: 28px;
}

/* Search dropdown - Full width on mobile */
html.device-mobile .search-dropdown {
    right: 0;
    left: 0;
    max-height: 50vh;
}

/* Modal adjustments */
html.device-mobile .node-modal-body,
html.device-mobile .hider-modal-body {
    max-height: none;
    flex: 1;
    min-height: 0;
}

/* About modal */
html.device-mobile .about-modal {
    width: 95%;
    max-width: 95%;
}

html.device-mobile .about-modal-header {
    padding: var(--spacing-lg) var(--spacing-lg);
}

/* Welcome modal */
html.device-mobile .welcome-modal-content {
    width: 95%;
    max-width: 95% !important;
    padding: 20px 24px;
}

/* Accordion controls - Larger tap areas */
html.device-mobile .accordion-chevron {
    font-size: 16px;
}

html.device-mobile .section-label {
    padding: 12px 0;
    min-height: 44px;
    display: flex;
    align-items: center;
}

/* Slider touch targets */
html.device-mobile #selectivity-filter::-webkit-slider-thumb {
    width: 24px;
    height: 24px;
}

html.device-mobile #selectivity-filter::-moz-range-thumb {
    width: 24px;
    height: 24px;
}

/* Histogram */
html.device-mobile .histogram-container {
    height: 70px;
}

/* Pagination buttons - Compact on mobile */
html.device-mobile .subgraph-pagination-btn {
    min-width: 28px;
    height: 24px;
    padding: 4px 10px;
    font-size: var(--font-size-sm);
}

/* Badges - Increase readability */
html.device-mobile .hidden-count-badge {
    min-width: 20px;
    font-size: 12px;
    padding: 3px 7px;
}

/* Force tuner - Bottom sheet on mobile */
html.device-mobile .force-tuner {
    width: calc(100vw - 20px);
    left: 10px;
    right: 10px;
    max-height: 50vh;
    bottom: 10px;
    top: auto;
}

/* SubGraph adjustments */
html.device-mobile .subgraph-container {
    min-height: 150px;
}

html.device-mobile .subgraph-force-simulation-container {
    min-height: 150px;
}

html.device-mobile .subgraph-force-simulation-container svg {
    min-height: 150px;
}

html.device-mobile .subgraph-svg {
    min-height: 150px;
}

html.device-mobile .subgraph-force-simulation-container .node text {
    font-size: var(--font-size-sm);
}

html.device-mobile .subgraph-page-info {
    font-size: var(--font-size-sm);
    min-width: 60px;
}

/* Very small screens (320px width) - still viewport-based for actual small screens */
@media (max-width: 375px) {
    html.device-mobile .welcome-modal-content {
        padding: 16px 20px;
    }
}

/* Landscape orientation on mobile - uses viewport detection since it's about actual orientation */
@media (max-width: 768px) and (orientation: landscape) {
    html.device-mobile .about-accordion-content video {
        max-height: 30vh;
    }

    /* Maximize vertical space for subgraph in landscape mode */
    html.device-mobile .node-modal-body {
        padding: 2px 4px;
    }

    /* Hide node info section entirely to save vertical space */
    html.device-mobile #node-modal-info {
        display: none;
    }

    /* Remove top margin and let container flex to fill space */
    html.device-mobile .subgraph-container {
        margin-top: 0;
        flex: 1;
        min-height: 0;
    }

    /* Reduce header padding */
    html.device-mobile .node-modal-header {
        padding: 8px 12px;
    }
}

/* Size warning banner - device-based positioning */
html.device-mobile .size-warning-banner {
    /* Reposition to bottom on mobile to avoid being off-screen */
    left: 10px;
    right: 10px;
    top: auto;
    bottom: 10px;
    transform: translateY(200px); /* Hide below viewport when not showing */
}

html.device-mobile .size-warning-banner.show {
    transform: translateY(0); /* Slide up from bottom */
}

html.device-mobile .size-warning-banner-content {
    padding: var(--spacing-sm) var(--spacing-md);
}

html.device-mobile .size-warning-stats {
    display: none; /* Hide stats on mobile to save space */
}





/* SubGraph Instructions Text */
.subgraph-instructions {
    position: absolute;
    bottom: 0px;
    left: 50%;
    transform: translateX(-50%);
    font-size: var(--font-size-sm);
    color: #666;
    background: rgba(255, 255, 255, 0.7);
    padding: var(--spacing-xs) 2px;
    border-radius: var(--spacing-md);
    pointer-events: none;
    z-index: 2010;
    white-space: nowrap;
    font-family: var(--font-family-system);
}

/* ===== HIDER MODAL STYLES ===== */

.hider-modal {
    position: fixed;
    z-index: 2001;
    display: none;
    background: var(--color-background);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.hider-modal.show {
    display: flex;
    flex-direction: column;
}

.hider-modal.position-right {
    top: 0;
    right: 0;
    height: 100vh;
    width: 50vw;
    transform: translateX(100%);
}

.hider-modal.position-right.show {
    transform: translateX(0);
}

.hider-modal.position-bottom {
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    height: 70vh;
    width: 100vw;
    transform: translateY(100%);
}

.hider-modal.position-bottom.show {
    transform: translateY(0);
}

.hider-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.3);
    z-index: 2000;
    display: none;
}

.hider-modal-content {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    background: var(--color-background);
}

.hider-modal-header {
    padding: var(--spacing-xl);
    border-bottom: 1px solid var(--color-border);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-shrink: 0;
}

.hider-modal-title-section {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: var(--spacing-sm);
    flex: 1;
}

.hider-modal-info-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: var(--color-text);
    opacity: 0.7;
    transition: opacity var(--transition-normal) ease, transform var(--transition-normal) ease;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 8px;
}

.hider-modal-info-btn:hover {
    opacity: 1;
    transform: scale(1.1);
}

.hider-modal-info-btn:active {
    transform: scale(0.95);
}

.hider-modal-info-popup {
    position: fixed;
    z-index: 2002;
    background: var(--color-background);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: var(--spacing-lg);
    max-width: 400px;
    width: 90%; /* Adaptive width for mobile */
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
}

.hider-modal-info-popup.hidden {
    display: none;
}

.hider-modal-info-popup-content h4 {
    margin: 0 0 var(--spacing-md) 0;
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text);
}

.hider-info-section {
    margin-bottom: var(--spacing-md);
}

.hider-info-section:last-child {
    margin-bottom: 0;
}

.hider-info-section strong {
    display: block;
    font-weight: var(--font-weight-semibold);
    color: var(--color-text);
    margin-bottom: var(--spacing-xs);
}

.hider-info-section p {
    margin: 0;
    font-size: var(--font-size-sm);
    color: var(--color-text-light);
    line-height: 1.5;
}

.hider-modal-header h3 {
    margin: 0;
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text);
}

.hider-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    font-weight: var(--font-weight-bold);
    color: var(--color-text-light);
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-round);
    transition: all var(--transition-normal) ease;
}

.hider-modal-close:hover {
    background-color: var(--color-background-alt);
    color: var(--color-text);
}

.hider-modal-close:active {
    background-color: #e0e0e0;
}

.hider-modal-body {
    flex: 1;
    overflow: hidden;
    padding: 0;
    background: var(--color-background);
    display: flex;
    flex-direction: column;
}

.hidden-nodes-list {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

/* Accordion styles */
.accordion-section {
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
}

.accordion-section.disabled {
    opacity: 0.5;
    pointer-events: none;
}

/* Closed sections don't take up flex space */
.accordion-section:not(.open) {
    flex-shrink: 0;
}

/* Open section expands to fill available space */
.accordion-section.open {
    flex: 1;
    min-height: 0; /* Important for flex children with overflow */
}

.accordion-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-lg) var(--spacing-xl);
    background-color: var(--color-background-alt);
    transition: background-color var(--transition-normal);
    user-select: none;
    flex-shrink: 0;
}

.accordion-header:hover:not(.disabled) {
    background-color: var(--color-background-alt);
}

.accordion-title {
    font-size: var(--font-size-md);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text);
}

.accordion-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    padding: 0 var(--spacing-sm);
    background-color: var(--color-secondary);
    color: var(--color-background);
    border-radius: var(--spacing-md);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
}

.accordion-section.open .accordion-badge {
    background-color: var(--color-primary);
}

.accordion-content {
    height: 0;
    overflow: hidden;
    transition: height var(--transition-slow) ease;
}

.accordion-section.open .accordion-content {
    flex: 1;
    height: auto;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.accordion-nodes-list {
    flex: 1;
    overflow-y: auto;
    min-height: 0; /* Important for flex children with overflow */
}

.hidden-node-row {
    display: flex;
    align-items: center;
    padding: var(--spacing-md) var(--spacing-xl);
    border-bottom: 1px solid #eee;
    transition: background-color var(--transition-normal);
}

.hidden-node-row:hover {
    background-color: var(--color-background-alt);
}

.hidden-node-title {
    flex: 1;
    font-size: var(--font-size-md);
    color: var(--color-text);
    font-weight: var(--font-weight-medium);
}

.hidden-node-actions {
    display: flex;
    gap: var(--spacing-md);
}

.hidden-node-action-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--color-secondary);
    padding: var(--spacing-xs);
    border-radius: var(--radius-sm);
    transition: all var(--transition-normal);
    display: flex;
    align-items: center;
    justify-content: center;
}

.hidden-node-action-btn:hover {
    background-color: var(--color-background-alt);
    color: var(--color-secondary-hover);
}

.hidden-node-action-btn:active {
    background-color: #dee2e6;
    color: #343a40;
}

.hidden-node-action-btn.unhide-btn:hover {
    color: var(--color-success);
}

/* Empty state when no hidden nodes */
.empty-state {
    padding: 40px var(--spacing-xl);
    text-align: center;
    color: var(--color-secondary);
}

.empty-state p {
    margin: 0;
    font-size: var(--font-size-md);
    font-style: italic;
}

/* =================================================================
   Size Warning Banner Styles
   ================================================================= */

.size-warning-banner {
    display: none;
    position: fixed;
    top: 10px; /* Align with control panel top */
    left: 310px; /* Right edge of control panel (280px width + 10px left + 20px gap) */
    right: 80px; /* Leave space for zoom buttons on right side */
    transform: translateY(-200px); /* Hide above viewport */
    background: var(--color-warning-bg, #fff3cd);
    border: 1px solid var(--color-warning, #ffc107);
    border-radius: var(--radius-xl); /* Match control panel border radius */
    box-shadow: var(--shadow-lg);
    z-index: 9999;
    opacity: 0;
    transition: all 0.3s ease;
    pointer-events: none;
}

.size-warning-banner.show {
    display: block;
    opacity: 1;
    transform: translateY(0); /* Slide down to aligned position */
    pointer-events: auto;
}

.size-warning-banner-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-md) var(--spacing-lg);
    gap: var(--spacing-md);
}

.size-warning-message {
    flex: 1;
    font-size: var(--font-size-md);
    font-weight: var(--font-weight-medium);
    color: var(--color-warning-text, #856404);
    line-height: 1.6;
    text-align: center;
    white-space: pre-line; /* Preserve line breaks */
}

.size-warning-stats {
    display: none; /* Hidden per user request */
}

.size-warning-banner-close {
    /* Hidden - banner stays up during simplified mode */
    display: none;
}

.size-warning-banner-close:hover {
    background: rgba(0, 0, 0, 0.1);
    color: var(--color-warning-dark, #664d03);
}

.size-warning-banner-close:active {
    transform: scale(0.95);
}

/* Responsive adjustments - Now handled by device-based styles in html.device-mobile section above */

/* =================================================================
   Heatmap Gaussian Blob Styles
   ================================================================= */

/* Heatmap layer styles - blur is applied synchronously via requestAnimationFrame */

/* Spatial Index Overlay Styles */
#spatial-index-overlay {
    pointer-events: none;
    z-index: 9999;
    opacity: 0.85;
}

#spatial-index-overlay rect {
    stroke-width: 1px;
    transition: opacity 0.2s ease;
}

#spatial-index-overlay .spatial-bbox {
    fill: rgba(128, 128, 128, 0.1);
    stroke: rgba(128, 128, 128, 0.4);
}

#spatial-index-overlay .spatial-bbox-depth-0 {
    stroke: rgba(200, 200, 200, 0.3);
}

#spatial-index-overlay .spatial-bbox-depth-1 {
    stroke: rgba(150, 150, 200, 0.3);
}

#spatial-index-overlay .spatial-bbox-depth-2 {
    stroke: rgba(100, 150, 200, 0.3);
}

#spatial-index-overlay .queried-node {
    fill: rgba(74, 222, 128, 0.4);
    stroke: #4ade80;
    stroke-width: 2px;
}

.spatial-index-stats {
    position: fixed;
    top: 60px;
    left: 10px;
    background: rgba(0, 0, 0, 0.85);
    color: #4ade80;
    padding: 8px 12px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 11px;
    z-index: 10001;
    pointer-events: none;
}

.spatial-index-stats .stat-label {
    color: #888;
    margin-right: 4px;
}

.spatial-index-stats .stat-value {
    color: #4ade80;
}

/* =================================================================
   Force Parameter Tuner Styles
   ================================================================= */

.force-tuner {
    position: fixed;
    top: 10px;
    right: 10px;
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    padding: 16px;
    font-family: var(--font-family-system);
    font-size: var(--font-size-sm);
    width: 320px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    z-index: 10000;
    pointer-events: auto;
}

.force-tuner-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid #4ade80;
}

.force-tuner-title {
    font-weight: var(--font-weight-bold);
    font-size: var(--font-size-base);
    color: var(--color-text);
}

.force-tuner-hint {
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
    font-family: 'Courier New', monospace;
}

.force-tuner-section {
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--color-background-alt);
}

.force-tuner-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.force-tuner-section-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.force-tuner-collapsible {
    cursor: pointer;
    user-select: none;
    transition: background 0.2s;
    padding: 4px;
    margin: -4px;
    border-radius: 4px;
}

.force-tuner-collapsible:hover {
    background: rgba(0, 0, 0, 0.05);
}

.force-tuner-section-title {
    font-weight: var(--font-weight-semibold);
    color: var(--color-text);
}

.force-tuner-label {
    display: block;
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-muted);
    margin-bottom: 8px;
}

.force-tuner-select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    background: var(--color-background);
    color: var(--color-text);
    cursor: pointer;
    transition: border-color 0.2s;
}

.force-tuner-select:hover {
    border-color: var(--color-primary);
}

.force-tuner-select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.1);
}

.force-tuner-param {
    margin-bottom: 12px;
}

.force-tuner-param:last-child {
    margin-bottom: 0;
}

.force-tuner-param-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: var(--font-size-sm);
    color: var(--color-text);
    margin-bottom: 6px;
}

.force-tuner-param-value {
    font-family: 'Courier New', monospace;
    font-weight: var(--font-weight-bold);
    color: var(--color-primary);
}

.force-tuner-slider {
    width: 100%;
    height: 4px;
    border-radius: 2px;
    background: var(--color-background-alt);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.force-tuner-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--color-primary);
    cursor: pointer;
    transition: transform 0.2s;
}

.force-tuner-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.force-tuner-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border: none;
    border-radius: 50%;
    background: var(--color-primary);
    cursor: pointer;
    transition: transform 0.2s;
}

.force-tuner-slider::-moz-range-thumb:hover {
    transform: scale(1.2);
}

.force-tuner-param-range {
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
    text-align: right;
    margin-top: 4px;
}

.force-tuner-metrics {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.force-tuner-metric {
    display: flex;
    justify-content: space-between;
    font-size: var(--font-size-xs);
}

.force-tuner-metric-label {
    color: var(--color-text-muted);
}

.force-tuner-metric-value {
    font-family: 'Courier New', monospace;
    font-weight: var(--font-weight-bold);
    color: var(--color-text);
}

.force-tuner-controls {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid var(--color-background-alt);
}

.force-tuner-btn {
    width: 100%;
    padding: 8px 16px;
    border: none;
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    background: var(--color-primary);
    color: var(--color-background);
}

.force-tuner-btn:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

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

.force-tuner-notification {
    animation: slideInRight 0.3s ease-out;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}


/* ============================================
   Simulation Comparison Tool Styles
   ============================================ */

/* Additional styles for simulation-comparison.html demo page */
/* Most styles are inline in the demo page for portability */

.simulation-comparison {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: #1a1a1a;
    color: #ffffff;
}

.simulation-comparison canvas {
    display: block;
    width: 100%;
    height: 100%;
}

/* Welcome Modal */
.welcome-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
    display: none;
    pointer-events: none;
}

.welcome-modal.visible {
    display: block;
    animation: welcomeFadeIn 0.3s ease-out;
}

@keyframes welcomeFadeIn {
    from {
        opacity: 0;
        transform: translate(-50%, -45%);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

.welcome-modal-content {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 24px 32px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    text-align: center;
    max-width: 500px;
    width: 90%; /* Adaptive width for mobile */
    pointer-events: auto;
}

.welcome-modal h2 {
    font-size: 20px;
    font-weight: 600;
    color: #2c3e50;
    margin: 0 0 12px 0;
    line-height: 1.3;
}

.welcome-modal p {
    font-size: 14px;
    color: #5a6c7d;
    margin: 0 0 16px 0;
    line-height: 1.5;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .welcome-modal-content {
        background: rgba(30, 30, 30, 0.95);
    }

    .welcome-modal h2 {
        color: #ecf0f1;
    }

    .welcome-modal p {
        color: #95a5a6;
    }
}

/* ============================================================================
   About Modal Styles (FAQ Accordion)
   ============================================================================ */

.about-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: none;
    z-index: 9998;
}

.about-modal-backdrop.show {
    display: block;
}

.about-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    background: var(--color-background);
    border-radius: var(--radius-xl);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    display: none;
    flex-direction: column;
    z-index: 9999;
}

.about-modal.show {
    display: flex;
}

.about-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-xl) var(--spacing-xxl);
    border-bottom: 1px solid #dee2e6;
    flex-shrink: 0;
}

.about-modal-header h3 {
    margin: 0;
    font-size: var(--font-size-xxl);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text);
}

.about-modal-close {
    background: none;
    border: none;
    font-size: 28px;
    line-height: 1;
    color: var(--color-secondary);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    transition: all var(--transition-normal);
}

.about-modal-close:hover {
    background-color: var(--color-background-alt);
    color: var(--color-text);
}

.about-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

/* About Accordion Sections */
.about-accordion-section {
    border-bottom: 1px solid #e0e0e0;
}

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

.about-accordion-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-lg) var(--spacing-xl);
    background-color: var(--color-background-alt);
    cursor: pointer;
    transition: background-color var(--transition-normal);
    user-select: none;
}

.about-accordion-header:hover {
    background-color: var(--color-background-alt);
}

.about-accordion-title {
    font-size: var(--font-size-md);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text);
    display: flex;
    align-items: center;
}

.about-accordion-title .accordion-chevron {
    display: inline-block;
    margin-right: var(--spacing-sm);
    font-size: var(--font-size-sm);
    transform: rotate(0deg) !important;
    transition: transform var(--transition-normal) ease !important;
}

.about-accordion-section.open .about-accordion-title .accordion-chevron {
    transform: rotate(90deg) !important;
}

.about-accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.2s ease;
    padding: 0 var(--spacing-xl);
}

.about-accordion-section.open .about-accordion-content {
    max-height: 50vh;
    overflow-y: auto;
    padding: 0 var(--spacing-xl) var(--spacing-lg) var(--spacing-xl);
    transition: max-height 0.2s ease, padding 0.2s ease;
}

.about-accordion-content p {
    margin: 0 0 var(--spacing-md) 0;
    line-height: 1.6;
    color: var(--color-text-muted);
    font-size: var(--font-size-md);
}

.about-accordion-content p:last-child {
    margin-bottom: 0;
}

.about-accordion-content video {
    width: 100%;
    max-width: 100%;
    height: auto;
    max-height: 40vh;
    margin: var(--spacing-md) 0;
    border-radius: var(--radius-md);
    display: block;
}


/* Welcome Modal Loading State */
.welcome-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  text-align: center;
  padding: 1rem 0;
}

.loading-message {
  font-size: 1rem;
  font-weight: 400;
  margin: 0 0 2rem 0;
  color: var(--color-text-primary, #1f2937);
  order: -1;
}

.loading-spinner {
  width: 50px;
  height: 50px;
  margin: 0 auto;
  border: 4px solid #CBE0D5;  /* Larger section - light mint */
  border-top-color: #C0E6FF;  /* Smaller section - light blue */
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

.loading-submessage {
  font-size: 0.9rem;
  color: var(--color-text-secondary, #6b7280);
  font-style: italic;
}
