:root {
    /* Colors - Neutrals */
    --gray-50: #fafafa;
    --gray-100: #f5f5f5;
    --gray-200: #eeeeee;
    --gray-300: #dddddd;
    --gray-400: #cccccc;
    --gray-500: #999999;
    --gray-600: #666666;
    --gray-700: #444444;
    --gray-800: #333333;
    --gray-900: #222222;

    /* Colors - Accents */
    --color-primary: #0066ff;
    --color-success: #4caf50;
    --color-warning: #ff9800;
    --color-error: #f44336;

    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 12px;
    --space-lg: 16px;
    --space-xl: 24px;

    /* Z-index layers */
    --z-base: 0;
    --z-dropdown: 10;
    --z-overlay: 40;
    --z-modal: 50;
    --z-tooltip: 100;

    /* Typography */
    --font-xs: 10px;
    --font-sm: 11px;
    --font-base: 13px;
    --font-lg: 14px;
    --font-xl: 20px;

    /* Border radius */
    --radius-sm: 3px;
    --radius-md: 4px;
    --radius-lg: 8px;
}

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

body {
    font-family:
        -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    overflow: hidden;
    background: #ffffff;
}

#app-container {
    height: 100vh;
    width: 100vw;
    position: relative;
}

#canvas-container {
    width: 100%;
    height: 100%;
    position: relative;
    background: var(--gray-100);
}

#main-canvas {
    display: block;
}

#viewport-controls-overlay {
    position: absolute;
    top: 20px;
    left: 20px;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 50;
    transition: opacity 0.2s ease;
}

#viewport-controls-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.viewport-controls-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-size: 12px;
    color: var(--gray-600);
    font-weight: 600;
}

.viewport-controls-header kbd {
    background: var(--gray-200);
    padding: 2px 5px;
    border-radius: 3px;
    font-family: monospace;
    font-size: 11px;
}

.viewport-pan-grid {
    display: grid;
    grid-template-columns: repeat(3, 50px);
    gap: 3px;
    margin-bottom: 12px;
}

.viewport-pan-btn {
    width: 50px;
    height: 40px;
    padding: 4px;
    background: var(--gray-700);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}

.viewport-pan-btn:hover {
    background: var(--gray-700);
}

.viewport-pan-btn.reset {
    font-size: 11px;
}

.viewport-zoom-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.viewport-zoom-section label {
    font-size: 11px;
    color: var(--gray-600);
    font-weight: 500;
}

.viewport-zoom-slider {
    width: 100%;
}

.viewport-zoom-display {
    text-align: center;
    font-size: 11px;
    color: var(--gray-600);
}

#sidebar {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 130px;
    width: 400px;
    min-width: 300px;
    max-width: 90vw;
    background: rgba(255, 255, 255, 0.95);
    border-left: 1px solid var(--gray-300);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    -webkit-overflow-scrolling: touch;
    z-index: 40;
    transition: opacity 0.2s ease;
}

#sidebar.hidden {
    opacity: 0;
    pointer-events: none;
}

#sidebar-resize-handle {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 8px;
    cursor: ew-resize;
    background: transparent;
    z-index: 50;
}

#sidebar-resize-handle:hover {
    background: rgba(100, 100, 255, 0.2);
}

#sidebar-resize-handle::after {
    content: "";
    position: absolute;
    left: 3px;
    top: 50%;
    transform: translateY(-50%);
    width: 2px;
    height: 40px;
    background: var(--gray-400);
    border-radius: 1px;
}

#timeline-container {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 130px;
    background: #ffffff;
    border-top: 1px solid var(--gray-300);
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#timeline-container.hidden {
    display: none;
}

.panel-toggle-btn {
    padding: 6px 12px;
    font-size: 12px;
    background: var(--gray-600);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
}

.panel-toggle-btn:hover {
    background: var(--gray-700);
}

.panel-toggle-btn.active {
    background: var(--gray-800);
    font-weight: 600;
}

/* Hide sidebar sections by default, show via JS based on active panel */
#controls,
#preset-manager {
    display: none;
}

#current-year-display {
    font-size: 24px;
    font-weight: bold;
    min-width: 80px;
    text-align: center;
}

.sidebar-section {
    padding: 10px 15px;
    border-bottom: 1px solid var(--gray-300);
}

.sidebar-section h2 {
    font-size: 14px;
    margin-bottom: 8px;
    color: var(--gray-800);
}

#controls {
    flex-shrink: 0;
}

#preset-manager {
    flex-shrink: 0;
}

#people-table-container {
    position: relative;
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
    padding: 8px;
    gap: 6px;
}

#people-content-wrapper {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

#people-table-scroll {
    flex: 8;
    min-height: 200px;
    overflow-y: auto;
    border: 1px solid var(--gray-300);
    border-radius: 4px;
}

#person-detail-panel {
    flex: 1;
    min-height: 50px;
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid var(--gray-300);
    border-radius: 4px;
    background: #fff;
    padding: 0;
}

#person-detail-panel.editing-mode {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    max-height: none;
    flex: none;
    z-index: 50;
    display: flex;
    flex-direction: column;
    margin: 0;
}

#people-search {
    width: 100%;
    padding: 8px;
    margin-bottom: 10px;
    border: 1px solid var(--gray-300);
    border-radius: 4px;
}

#people-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

#people-table th {
    position: sticky;
    top: 0;
    background: var(--gray-100);
    padding: 8px 4px;
    text-align: left;
    border-bottom: 2px solid var(--gray-300);
    border-right: 1px solid var(--gray-300);
    font-weight: 600;
}

#people-table td {
    padding: 6px 4px;
    border-bottom: 1px solid var(--gray-200);
    border-right: 1px solid var(--gray-200);
}

#people-table tr:hover {
    background: var(--gray-100);
}

#people-table tr.highlighted {
    background: #fffacd;
}

#people-table tr.selected {
    background: #e3f2fd;
}

/* Detail panel styles */
.detail-header {
    position: sticky;
    top: 0;
    background: var(--gray-50);
    z-index: 10;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border-bottom: 2px solid var(--gray-300);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.detail-header h3 {
    margin: 0;
    font-size: 18px;
    color: var(--gray-800);
}

.detail-edit-btn,
.detail-save-btn,
.detail-cancel-btn {
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
}

.detail-edit-btn {
    background: var(--gray-700);
    color: white;
}

.detail-edit-btn:hover {
    background: var(--gray-800);
}

.detail-save-btn {
    background: var(--gray-700);
    color: white;
}

.detail-save-btn:hover {
    background: var(--gray-700);
}

.detail-cancel-btn {
    background: #888;
    color: white;
}

.detail-cancel-btn:hover {
    background: #777;
}

.detail-content {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 10px;
}

.detail-content-scroll {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 10px;
    min-height: 0;
}

.detail-section {
    padding: 8px;
    background: #f9f9f9;
    border-radius: 4px;
}

.detail-section h4 {
    margin: 0 0 10px 0;
    font-size: 14px;
    color: var(--gray-700);
    font-weight: 600;
}

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

.detail-field:last-child {
    margin-bottom: 0;
}

.detail-field label {
    min-width: 120px;
    font-size: 13px;
    color: var(--gray-600);
    font-weight: 500;
}

.detail-field span {
    font-size: 13px;
    color: var(--gray-800);
}

.detail-field input[type="text"],
.detail-field input[type="number"] {
    flex: 1;
    min-width: 0;
    padding: 6px;
    font-size: 13px;
    border: 1px solid var(--gray-300);
    border-radius: 3px;
}

.detail-field input[type="color"] {
    width: 60px;
    height: 32px;
    border: 1px solid var(--gray-300);
    border-radius: 3px;
    cursor: pointer;
}

.detail-footer {
    flex-shrink: 0;
    background: var(--gray-50);
    border-top: 2px solid var(--gray-300);
    padding: 12px 15px;
}

.detail-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: flex-end;
}

.edit-errors {
    flex: 1;
    color: #c33;
    font-size: 12px;
}

.edit-errors div {
    margin-top: 4px;
}

/* Waypoints styles */
.waypoints-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}

.waypoint-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    background: #fff;
    border: 1px solid var(--gray-300);
    border-radius: 4px;
    font-size: 13px;
}

.waypoint-fixed {
    background: var(--gray-100);
    border-color: var(--gray-400);
}

.waypoint-editable {
    background: #fffef7;
    border-color: #ffc107;
    flex-direction: column;
}

.waypoint-year {
    font-weight: 600;
    min-width: 60px;
    color: var(--gray-700);
}

.waypoint-city {
    flex: 1;
    min-width: 0;
    color: var(--gray-800);
}

.waypoint-coords {
    font-family: monospace;
    font-size: 11px;
    color: var(--gray-600);
    white-space: nowrap;
}

.waypoint-year-input,
.waypoint-city-input,
.waypoint-lat-input,
.waypoint-lon-input {
    padding: 4px 6px;
    border: 1px solid var(--gray-300);
    border-radius: 3px;
    font-size: 12px;
    box-sizing: border-box;
}

.waypoint-delete-btn {
    padding: 4px 10px;
    background: var(--color-error);
    color: white;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 11px;
    line-height: 1;
    white-space: nowrap;
}

.waypoint-delete-btn:hover {
    background: #b71c1c;
}

.add-waypoint-btn {
    padding: 8px 12px;
    background: var(--gray-700);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    align-self: flex-start;
}

.add-waypoint-btn:hover {
    background: var(--gray-700);
}

.waypoint-save-btn {
    padding: 4px 10px;
    background: var(--gray-700);
    color: white;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
    white-space: nowrap;
}

.waypoint-save-btn:hover {
    background: var(--gray-700);
}

.control-group {
    margin-bottom: 8px;
}
.year-range-row {
    display: flex;
    gap: 6px;
    align-items: center;
}
.year-range-row .year-input {
    flex: 1 1 0;
    padding: 4px 6px;
    border: 1px solid var(--gray-300);
    border-radius: 4px;
    width: auto;
    box-sizing: border-box;
    font-size: 13px;
}

.control-group label {
    display: block;
    font-size: 12px;
    margin-bottom: 3px;
    color: var(--gray-700);
}

.control-group input[type="number"],
.control-group input[type="text"],
.control-group select {
    width: 100%;
    padding: 4px 6px;
    border: 1px solid var(--gray-300);
    border-radius: 4px;
    font-size: 13px;
}

.control-group input[type="checkbox"] {
    margin-right: 6px;
}

.control-group input[type="range"] {
    width: 100%;
}

button {
    padding: 8px 16px;
    background: var(--gray-700);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
}

button:hover {
    background: var(--gray-800);
}

button:disabled {
    background: var(--gray-400);
    cursor: not-allowed;
}

.color-input {
    display: inline-block;
    width: 40px;
    height: 30px;
    border: 1px solid var(--gray-300);
    border-radius: 4px;
    cursor: pointer;
}

#error-display {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: #ff4444;
    color: white;
    padding: 15px 25px;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    display: none;
    z-index: 1000;
    max-width: 600px;
}

#error-display.show {
    display: block;
}

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

#play-pause-btn {
    min-width: 60px;
    height: 32px;
    padding: 6px 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    line-height: 1;
}

.person-type {
    font-size: 16px;
}

/* When maximized, hide the top area (controls + presets) to give more vertical space to People */
.people-maximized #sidebar-top {
    display: none;
}
/* Small padding tweak when maximized so table aligns nicely */
.people-maximized #people-table-container {
    padding-top: 8px;
}

#loading-indicator {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 30px 50px;
    border-radius: 8px;
    font-size: 18px;
    z-index: 2000;
}

/* ====== People table edit containment & responsive constraints ======
These rules are added to prevent edit inputs and the expansion editor
from pushing the sidebar/table wider than the available area.
They prioritize internal scrolling / clipping and enforce sensible
maximum input widths.
====================================================================== */

/* Use fixed table layout so column widths are stable and content cannot
expand the table beyond its container. The explicit widths on <th>
will be honored. */
#people-table {
    table-layout: auto; /* allow columns to resize */
    width: 100%;
}

/* Dual range slider styling */
#year-range-min,
#year-range-max {
    -webkit-appearance: none;
    appearance: none;
    height: 4px;
    background: transparent;
}

#year-range-min::-webkit-slider-thumb,
#year-range-max::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    background: #0066ff;
    border-radius: 50%;
    cursor: pointer;
}

#year-range-min::-moz-range-thumb,
#year-range-max::-moz-range-thumb {
    width: 14px;
    height: 14px;
    background: #0066ff;
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

#year-range-min::-webkit-slider-runnable-track,
#year-range-max::-webkit-slider-runnable-track {
    height: 4px;
    background: #ddd;
    border-radius: 2px;
}

#year-range-min::-moz-range-track,
#year-range-max::-moz-range-track {
    height: 4px;
    background: #ddd;
    border-radius: 2px;
}

/* Ensure table cells clip overflowing content and allow flexible children to shrink */
#people-table th,
#people-table td {
    box-sizing: border-box;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    min-width: 0; /* allows flex children to shrink on modern browsers */
}

/* Make header cells resizable */
#people-table th {
    resize: horizontal;
    overflow: auto;
    min-width: 40px;
    max-width: 400px;
}

/* Column widths - these are now initial widths, user can resize */
#people-table th:first-child,
#people-table td:first-child {
    width: 40px; /* Checkbox column */
    resize: none; /* Don't resize checkbox column */
}

#people-table .col-name {
    width: 200px; /* Name column - initial width */
}

#people-table .col-occupation {
    width: 120px; /* Occupation column */
}

#people-table .col-years {
    width: 80px; /* Years column */
}

/* Year range dual slider */
.year-range-control {
    display: flex;
    align-items: center;
    gap: 8px;
}

.year-range-slider-container {
    position: relative;
    width: 180px;
    height: 20px;
}

.year-range-slider {
    position: absolute;
    width: 100%;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    pointer-events: none;
}

.year-range-slider::-webkit-slider-track {
    width: 100%;
    height: 4px;
    background: var(--gray-300);
    border-radius: 2px;
}

.year-range-slider::-moz-range-track {
    width: 100%;
    height: 4px;
    background: var(--gray-300);
    border-radius: 2px;
}

.year-range-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--gray-800);
    cursor: pointer;
    pointer-events: auto;
    border: 2px solid white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.year-range-slider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--gray-800);
    cursor: pointer;
    pointer-events: auto;
    border: 2px solid white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.year-range-slider::-webkit-slider-thumb:hover {
    background: var(--gray-700);
}

.year-range-slider::-moz-range-thumb:hover {
    background: var(--gray-700);
}

#year-range-min {
    z-index: 1;
}

#year-range-max {
    z-index: 2;
}

.year-range-values {
    font-size: 11px;
    color: var(--gray-600);
    white-space: nowrap;
    min-width: 90px;
    text-align: center;
}

/* Distance filter dual slider - inherits year-range-slider styles */
.distance-filter-container {
    position: relative;
    width: 100%;
    height: 20px;
}

.distance-slider {
    position: absolute;
    width: 100%;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    pointer-events: none;
}

/* Reuse slider styles from year-range-slider */
.distance-slider::-webkit-slider-track {
    width: 100%;
    height: 4px;
    background: var(--gray-300);
    border-radius: 2px;
}

.distance-slider::-moz-range-track {
    width: 100%;
    height: 4px;
    background: var(--gray-300);
    border-radius: 2px;
}

.distance-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--gray-800);
    cursor: pointer;
    pointer-events: auto;
    border: 2px solid white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.distance-slider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--gray-800);
    cursor: pointer;
    pointer-events: auto;
    border: 2px solid white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.distance-slider::-webkit-slider-thumb:hover {
    background: var(--gray-700);
}

.distance-slider::-moz-range-thumb:hover {
    background: var(--gray-700);
}

#distance-min-slider {
    z-index: 1;
}

#distance-max-slider {
    z-index: 2;
}

/* Note: Slider styles are duplicated because CSS doesn't support shared pseudo-element rules */

/* Class applied to the edit expansion cell created by the people table JS.
It removes extra padding and gives full-width available area for the wrapper. */
.people-edit-cell {
    padding: 0;
}

/* Wrapper inside the expansion cell that holds the edit form. It will
scroll internally in the X axis rather than expanding the parent. */
.people-edit-wrapper {
    box-sizing: border-box;
    max-width: 100%;
    overflow-x: auto; /* internal horizontal scrolling when needed */
    overflow-y: visible;
    padding: 8px;
    background: #fff;
}

/* Inputs and selects inside the edit wrapper should fill the available
wrapper width but are capped with a reasonable absolute max so they
can't grow indefinitely on very wide screens or with long content. */
.people-edit-wrapper input,
.people-edit-wrapper select,
.people-edit-wrapper textarea {
    box-sizing: border-box;
    width: 100%;
    max-width: 640px; /* absolute cap; adjust as needed */
    min-width: 0;
    margin: 3px 0;
    padding: 6px;
    border: 1px solid var(--gray-300);
    border-radius: 4px;
    background: #fff;
    font-size: 13px;
}

/* Smaller inline editors that appear inside table cells (double-click) */
.edit-inline-input {
    box-sizing: border-box;
    width: 100%;
    max-width: 240px; /* prevents huge inline inputs from pushing layout */
    min-width: 0;
    padding: 4px;
    border: 1px solid var(--gray-400);
    border-radius: 3px;
    font-size: 13px;
}

/* When the expansion content uses flex children, allow them to shrink */
.people-edit-row .flex-child,
.people-edit-wrapper .flex-child {
    min-width: 0;
}

/* Provide a subtle affordance for editable cells; don't rely on JS to style */
.editable-cell {
    cursor: text;
}
.editable-cell:hover::after {
    content: " ✎";
    color: #888;
    margin-left: 6px;
    font-size: 0.95em;
}

/* Error state styling for inputs */
.input-error {
    border: 1px solid #c33;
    background: rgba(255, 200, 200, 0.06);
}

.validation-error {
    color: var(--color-error);
    font-size: 11px;
    margin-top: 2px;
    display: block;
}

/* Detail panel tabs */
.detail-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--gray-300);
    margin-bottom: 15px;
}

.detail-tab {
    flex: 1;
    padding: 10px;
    background: var(--gray-100);
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    color: var(--gray-600);
    transition: all 0.2s ease;
}

.detail-tab:hover {
    background: #e8e8e8;
    color: var(--gray-800);
}

.detail-tab.active {
    background: white;
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
}

/* Waypoints table */
.waypoints-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
    margin-bottom: 10px;
}

.waypoints-table thead th {
    background: var(--gray-100);
    padding: 8px 6px;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid var(--gray-300);
    font-size: 10px;
    color: var(--gray-700);
}

.waypoints-table tbody td {
    padding: 6px;
    border-bottom: 1px solid var(--gray-200);
}

.waypoints-table tr.waypoint-fixed {
    background: #f9f9f9;
    font-weight: 500;
}

.waypoints-table tr.waypoint-row.editable:hover {
    background: var(--gray-50);
}

.waypoints-table input {
    padding: 4px;
    border: 1px solid var(--gray-300);
    border-radius: 3px;
    font-size: 11px;
}

.waypoint-delete-btn {
    background: var(--color-error);
    color: white;
    border: none;
    border-radius: 3px;
    cursor: pointer;
}

.waypoint-delete-btn:hover {
    background: #b71c1c;
}

/* Responsive tweaks: on narrow sidebars, allow inputs to stack and reduce max widths */
@media (max-width: 420px) {
    .people-edit-wrapper input,
    .people-edit-wrapper select,
    .people-edit-wrapper textarea {
        max-width: 100%;
        font-size: 12px;
    }
    .edit-inline-input {
        max-width: 180px;
        font-size: 12px;
    }
}

/* Wikipedia language dropdown */
.wikipedia-dropdown {
    background: white;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-md);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 200px;
    max-width: 300px;
    max-height: 400px;
    overflow-y: auto;
}

.wikipedia-dropdown-content {
    padding: 4px;
}

.wiki-lang-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    text-decoration: none;
    color: var(--gray-800);
    border-radius: var(--radius-sm);
    font-size: var(--font-sm);
    transition: background 0.1s;
}

.wiki-lang-link:hover {
    background: var(--gray-100);
}

.wiki-lang-code {
    font-family: monospace;
    font-weight: 600;
    color: var(--color-primary);
    min-width: 24px;
    font-size: 10px;
}

.wiki-lang-name {
    color: var(--gray-700);
    font-size: 11px;
}

.wiki-divider {
    height: 1px;
    background: var(--gray-200);
    margin: 4px 0;
}

.wiki-show-all-btn {
    width: 100%;
    padding: 6px 8px;
    background: var(--gray-50);
    border: none;
    border-radius: var(--radius-sm);
    color: var(--color-primary);
    font-size: 10px;
    cursor: pointer;
    text-align: center;
    transition: background 0.1s;
}

.wiki-show-all-btn:hover {
    background: var(--gray-100);
}

.wiki-all-languages {
    margin-top: 4px;
}

/* Wikidata link styling in table */
.wikidata-link {
    color: var(--color-primary);
    text-decoration: none;
    font-family: monospace;
    font-size: 10px;
    padding: 2px 4px;
    border-radius: var(--radius-sm);
    transition: background 0.1s;
    cursor: pointer;
    display: inline-block;
}

.wikidata-link:hover {
    background: var(--gray-100);
    text-decoration: underline;
}
