/* Knowledge Web - Alien Spacecraft Aesthetic */

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

:root {
    --bg-dark: #000;
    --text-primary: rgba(220, 230, 240, 0.9);
    --text-dim: rgba(180, 190, 200, 0.4);
    --text-bright: rgba(255, 255, 255, 1);
    --accent: rgba(100, 150, 255, 0.8);
    --accent-dim: rgba(100, 150, 255, 0.3);
    --node-color: rgba(200, 220, 255, 0.8);
    --node-dim: rgba(150, 170, 200, 0.4);
    --link-color: rgba(120, 150, 200, 0.3);
    --link-highlight: rgba(150, 180, 255, 0.6);
    --panel-bg: rgba(10, 15, 25, 0.7);
    --panel-bg-strong: rgba(10, 15, 25, 0.85);
    --btn-bg: rgba(30, 40, 60, 0.7);
    --btn-bg-hover: rgba(50, 70, 100, 0.8);
    --btn-border: rgba(100, 130, 180, 0.35);
    --border-dim: rgba(100, 130, 180, 0.2);
    --glow: 0 0 20px rgba(100, 150, 255, 0.3);
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: 'Segoe UI', system-ui, sans-serif;
    background: var(--bg-dark);
    color: var(--text-dim);
}

/* ===========================================
   HUD Progressive Reveal - Dormant State
   Elements start nearly invisible, reveal on interaction
   =========================================== */

/* Dormant: clean slate - only search bar and thin timeline visible */
body.hud-dormant #top-search-bar {
    opacity: 0.4 !important;
    pointer-events: auto;
    top: 50% !important;
    left: 50% !important;
    right: auto !important;
    transform: translateX(-50%) translateY(-50%) !important;
    width: 420px !important;
    max-width: 80vw !important;
    z-index: 200;
}
body.hud-dormant #top-search-filters,
body.hud-dormant #top-bar-actions,
body.hud-dormant #filters-toggle {
    opacity: 0 !important;
    pointer-events: none;
    max-height: 0;
    overflow: hidden;
}
body.hud-dormant #globe-container {
    opacity: 0 !important;
    pointer-events: none;
}
body.hud-dormant #journey-panel {
    opacity: 0 !important;
    pointer-events: none;
}
body.hud-dormant #bio-panel {
    opacity: 0 !important;
    pointer-events: none;
    transform: translateX(20px);
}
body.hud-dormant #timebar-container {
    opacity: 0.12 !important;
    pointer-events: auto;
    padding: 2px 0 !important;
    height: 12px !important;
    min-height: 12px !important;
}
body.hud-dormant .timebar-nav,
body.hud-dormant #timebar-scale,
body.hud-dormant #timebar-labels,
body.hud-dormant #timebar-now-marker .now-year {
    opacity: 0 !important;
    pointer-events: none;
}
body.hud-dormant #timebar {
    height: 10px !important;
}
body.hud-dormant #timebar-track {
    top: 3px !important;
    height: 3px !important;
}
body.hud-dormant #timebar-histogram {
    height: 8px !important;
    opacity: 0.5;
}
body.hud-dormant #timebar::after {
    display: none !important;
}
body.hud-dormant #top-controls {
    opacity: 0 !important;
    pointer-events: none;
}
body.hud-dormant #right-controls {
    opacity: 0 !important;
    pointer-events: none;
}
body.hud-dormant #burke-avatar {
    opacity: 0 !important;
    pointer-events: none;
}
body.hud-dormant #zen-mode-btn {
    opacity: 0 !important;
    pointer-events: none;
}
body.hud-dormant #current-node-info {
    opacity: 0 !important;
}
body.hud-dormant #settings-accordion {
    display: none !important;
}
body.hud-dormant #miniweb,
body.hud-dormant #miniweb-container {
    opacity: 0 !important;
    pointer-events: none;
}
body.force3d-active #miniweb-container {
    pointer-events: none;
}
body.hud-dormant #changelog-indicator {
    opacity: 0 !important;
    pointer-events: none;
}
body.hud-dormant #help-btn {
    opacity: 0 !important;
    pointer-events: none;
}

/* Dormant hover: search bar is the focal point */
body.hud-dormant #top-search-bar:hover,
body.hud-dormant #top-search-bar:focus-within {
    opacity: 1 !important;
}
body.hud-dormant #top-search-bar:hover #top-bar-actions,
body.hud-dormant #top-search-bar:focus-within #top-bar-actions {
    opacity: 1 !important;
    pointer-events: auto;
    max-height: 200px;
}
body.hud-dormant #timebar-container:hover {
    opacity: 0.6 !important;
    padding: 8px 15px !important;
    height: auto !important;
    min-height: auto !important;
}
body.hud-dormant #timebar-container:hover .timebar-nav,
body.hud-dormant #timebar-container:hover #timebar-scale,
body.hud-dormant #timebar-container:hover #timebar-labels,
body.hud-dormant #timebar-container:hover #timebar-now-marker .now-year {
    opacity: 1 !important;
    pointer-events: auto;
}
body.hud-dormant #timebar-container:hover #timebar {
    height: 55px !important;
}
body.hud-dormant #timebar-container:hover #timebar-track {
    top: 22px !important;
    height: 6px !important;
}
body.hud-dormant #timebar-container:hover #timebar-histogram {
    height: 20px !important;
    opacity: 0.8;
}

/* Waking up: transitional state after first node selection */
body.hud-waking #top-search-bar {
    opacity: 0.35 !important;
}
body.hud-waking #top-search-filters,
body.hud-waking #top-bar-actions,
body.hud-waking #filters-toggle {
    opacity: 0 !important;
    pointer-events: none;
    max-height: 0;
    overflow: hidden;
}
body.hud-waking #globe-container {
    opacity: 0.25 !important;
    pointer-events: auto;
}
body.hud-waking #bio-panel {
    opacity: 0.85 !important;
    pointer-events: auto;
    transform: translateX(0);
}
body.hud-waking #timebar-container {
    opacity: 0.4 !important;
    pointer-events: auto;
    padding: 4px 8px !important;
}
body.hud-waking #timebar {
    height: 35px !important;
}
body.hud-waking .timebar-nav {
    opacity: 0.3;
}
body.hud-waking #timebar-scale {
    opacity: 0.2;
}
body.hud-waking #right-controls {
    opacity: 0.3 !important;
    pointer-events: auto;
}
body.hud-waking #journey-panel {
    opacity: 0 !important;
    pointer-events: none;
}
body.hud-waking #burke-avatar {
    opacity: 0 !important;
    pointer-events: none;
}
body.hud-waking #current-node-info {
    opacity: 0.8 !important;
}
body.hud-waking #zen-mode-btn {
    opacity: 0 !important;
    pointer-events: none;
}
body.hud-waking #settings-accordion {
    display: none !important;
}
body.hud-waking #changelog-indicator {
    opacity: 0 !important;
    pointer-events: none;
}

/* Waking hover overrides */
body.hud-waking #top-search-bar:hover,
body.hud-waking #top-search-bar:focus-within {
    opacity: 1 !important;
}
body.hud-waking #top-search-bar:hover #top-bar-actions,
body.hud-waking #top-search-bar:focus-within #top-bar-actions,
body.hud-waking #top-search-bar:focus-within #filters-toggle {
    opacity: 1 !important;
    pointer-events: auto;
    max-height: 200px;
}
body.hud-waking #top-search-bar:focus-within #top-search-filters.filters-visible {
    opacity: 1 !important;
    pointer-events: auto;
    max-height: 200px;
}
body.hud-waking #globe-container:hover {
    opacity: 0.8 !important;
}
body.hud-waking #timebar-container:hover {
    opacity: 0.85 !important;
}
body.hud-waking #right-controls:hover {
    opacity: 0.9 !important;
}

/* All HUD transitions */
#top-search-bar {
    transition: opacity 0.8s ease, transform 0.8s ease, top 0.8s ease, left 0.8s ease, right 0.8s ease, width 0.8s ease, max-height 0.4s ease !important;
}
#top-search-filters,
#top-bar-actions,
#globe-container,
#journey-panel,
#bio-panel,
#timebar-container,
#top-controls,
#right-controls,
#burke-avatar,
#zen-mode-btn,
#current-node-info,
#filters-toggle,
#changelog-indicator,
#help-btn,
#miniweb {
    transition: opacity 0.8s ease, transform 0.6s ease, max-height 0.4s ease, filter 0.3s ease !important;
}

/* Zen Mode - Hide all UI except graph and current node info */
body.zen-mode #top-search-bar,
body.zen-mode #journey-panel,
body.zen-mode #bio-panel,
body.zen-mode #globe-container,
body.zen-mode #timebar-container,
body.zen-mode #top-controls,
body.zen-mode #right-controls,
body.zen-mode #settings-panel,
body.zen-mode #burke-avatar,
body.zen-mode #help-btn {
    opacity: 0 !important;
    pointer-events: none !important;
    transition: opacity 0.3s ease;
}

body.zen-mode #zen-mode-btn {
    opacity: 0.3 !important;
    pointer-events: auto !important;
    position: fixed !important;
    top: 20px !important;
    left: 20px !important;
    z-index: 1000 !important;
}

body.zen-mode #zen-mode-btn:hover {
    opacity: 1 !important;
}

body.zen-mode #current-node-info {
    opacity: 0.8;
}

#zen-mode-btn {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 100;
}

#zen-mode-btn.active {
    color: var(--accent);
    text-shadow: 0 0 10px var(--accent);
}

/* Skip link for accessibility - hidden until focused */
.skip-link {
    position: absolute;
    top: -100px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--accent);
    color: var(--bg-dark);
    padding: 10px 20px;
    z-index: 10000;
    border-radius: 0 0 4px 4px;
    text-decoration: none;
    font-weight: 500;
    transition: top 0.2s;
}

.skip-link:focus {
    top: 0;
    outline: 2px solid var(--text-bright);
    outline-offset: 2px;
}

#app {
    width: 100%;
    height: 100%;
    position: relative;
}

/* Starfield background */
#starfield {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

/* Common UI element styles - floating, no boxes */
.ui-element {
    position: absolute;
    transition: opacity 0.3s ease, color 0.3s ease;
    z-index: 10;
}

.ui-element:hover {
    color: var(--text-primary);
}

/* Top Search Bar - prominent, always visible */
#top-search-bar {
    position: absolute;
    top: 10px;
    left: 210px; /* After globe container */
    right: 360px; /* Before bio panel */
    z-index: 100;
    display: flex;
    align-items: center;
    flex-wrap: wrap; /* Allow wrapping when space is tight */
    gap: 8px 12px;
    padding: 8px 16px;
    background: none;
    border: none;
    border-radius: 8px;
}

#top-search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

#top-search-input {
    width: 380px;
    min-width: 200px;
    flex-shrink: 1;
    height: 46px;
    padding: 0 44px 0 42px;
    background: rgba(18, 20, 30, 0.7);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 23px;
    color: #ffffff;
    font-size: 15px;
    outline: none;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.5);
    transition: border-color 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
}

#top-search-input:focus {
    border-color: rgba(100, 150, 255, 0.45);
    box-shadow: 0 4px 24px rgba(100, 150, 255, 0.15), 0 0 0 1px rgba(100, 150, 255, 0.1);
    background: rgba(18, 20, 30, 0.8);
}

#top-search-input::placeholder {
    color: rgba(255, 255, 255, 0.55);
}

#top-search-icon {
    position: absolute;
    left: 16px;
    color: rgba(255, 255, 255, 0.5);
    font-size: 16px;
    pointer-events: none;
}

.top-bar-btn {
    background: var(--btn-bg);
    border: 1px solid var(--btn-border);
    border-radius: 4px;
    color: rgba(180, 190, 200, 0.8);
    font-size: 16px;
    padding: 6px 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.top-bar-btn:hover {
    background: var(--btn-bg-hover);
    border-color: var(--accent);
    color: var(--text-bright);
}

/* Dice button - inside search pill */
#icon-random {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    border-radius: 50%;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    padding: 0;
    cursor: pointer;
    opacity: 0.5;
    transition: all 0.2s;
    flex-shrink: 0;
}
#icon-random:hover {
    opacity: 1;
    background: rgba(100, 150, 255, 0.15);
}

#top-bar-actions {
    display: none;
}

#dataset-selector {
    position: relative;
}

#dataset-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: rgba(15, 20, 35, 0.95);
    border: 1px solid rgba(100, 130, 180, 0.4);
    border-radius: 8px;
    padding: 8px;
    min-width: 220px;
    z-index: 1000;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

#dataset-dropdown.hidden {
    display: none;
}

.dataset-option {
    padding: 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 4px;
}

.dataset-option:last-child {
    margin-bottom: 0;
}

.dataset-option:hover {
    background: rgba(100, 150, 255, 0.15);
}

.dataset-option.active {
    background: rgba(100, 150, 255, 0.25);
    border: 1px solid rgba(100, 150, 255, 0.4);
}

.dataset-option strong {
    display: block;
    color: var(--text-bright);
    font-size: 14px;
    margin-bottom: 4px;
}

.dataset-option span {
    color: var(--text-dim);
    font-size: 12px;
}

#top-search-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.3s ease, opacity 0.3s ease;
}
#top-search-filters.filters-visible {
    max-height: 50px;
    opacity: 1;
}

#filters-toggle {
    background: none;
    border: 1px solid rgba(100, 130, 180, 0.2);
    border-radius: 4px;
    color: var(--text-dim);
    font-size: 10px;
    padding: 4px 8px;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}
#filters-toggle:hover {
    color: var(--text-bright);
    border-color: var(--accent);
}
#filters-toggle.active {
    color: var(--accent);
    border-color: var(--accent);
}

#top-search-filters select {
    padding: 6px 8px;
    min-width: 80px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border-dim);
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 11px;
    cursor: pointer;
    outline: none;
    transition: all 0.2s;
}

#top-search-filters select:hover,
#top-search-filters select:focus {
    border-color: var(--accent);
}

#top-search-filters select option {
    background: var(--bg-dark);
    color: var(--text-primary);
}

#top-search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 8px;
    max-height: 400px;
    overflow-y: auto;
    background: rgba(10, 15, 25, 0.95);
    backdrop-filter: blur(15px);
    border: 1px solid var(--border-dim);
    border-radius: 8px;
}

#top-search-results.hidden {
    display: none;
}

#top-search-results .result-item {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid var(--border-dim);
    transition: all 0.15s;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

#top-search-results .result-item .result-thumb {
    width: 40px;
    height: 40px;
    border-radius: 4px;
    background: rgba(60, 80, 120, 0.3);
    flex-shrink: 0;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

#top-search-results .result-item .result-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#top-search-results .result-item .result-thumb .result-thumb-placeholder {
    font-size: 16px;
    opacity: 0.4;
}

#top-search-results .result-item .result-info {
    flex: 1;
    min-width: 0;
}

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

#top-search-results .result-item:hover {
    background: rgba(100, 150, 255, 0.15);
}

#top-search-results .result-item .name {
    color: var(--text-primary);
    font-size: 14px;
    margin-bottom: 3px;
}

#top-search-results .result-item .oneliner {
    color: var(--text-dim);
    font-size: 12px;
}

#top-search-results .result-item .meta {
    color: var(--accent);
    font-size: 11px;
    margin-top: 4px;
}

#top-search-results .search-hint {
    padding: 12px 16px;
    color: var(--text-dim);
    font-size: 12px;
    font-style: italic;
}

#top-search-results .search-hint.llm-hint {
    color: rgba(150, 200, 100, 0.9);
    background: rgba(150, 200, 100, 0.05);
}

#top-search-results .no-results {
    padding: 20px 16px;
    color: var(--text-dim);
    text-align: center;
    font-size: 13px;
}

#top-search-results .result-item.selected {
    background: rgba(100, 150, 255, 0.2);
}

/* Name match highlighting - more prominent */
#top-search-results .result-item.name-match {
    background: rgba(100, 200, 100, 0.08);
    border-left: 2px solid rgba(100, 200, 100, 0.5);
}

#top-search-results .result-item.name-match:hover {
    background: rgba(100, 200, 100, 0.15);
}

/* Bio match - subtle indicator */
#top-search-results .result-item.bio-match {
    opacity: 0.85;
}

/* Match type badges */
.match-badge {
    font-size: 9px;
    padding: 1px 5px;
    border-radius: 3px;
    margin-left: 6px;
    vertical-align: middle;
    font-weight: normal;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.match-badge.name {
    background: rgba(100, 200, 100, 0.3);
    color: rgba(150, 255, 150, 0.9);
}

.match-badge.bio {
    background: rgba(150, 150, 200, 0.2);
    color: var(--text-dim);
}

/* Filter active indicator */
#top-search-filters select.has-filter {
    border-color: var(--accent);
    color: var(--text-bright);
}

/* Keyboard hint removed - search bar has no box */

/* Full 3D force graph */
#force3d-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 5;
    touch-action: none;
}
#force3d-container.hidden {
    display: none;
}

/* 3D graph info box */
#force3d-info {
    position: fixed;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    z-index: 210;
    background: rgba(8, 12, 20, 0.6);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(100, 150, 255, 0.2);
    border-radius: 12px;
    padding: 20px 28px;
    max-width: 420px;
    min-width: 280px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease, transform 0.4s ease;
}
#force3d-info.visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(-50%) translateY(0);
}
#f3d-info-header {
    display: flex;
    gap: 14px;
    margin-bottom: 10px;
    align-items: center;
}
#f3d-info-portrait {
    width: 56px;
    height: 56px;
    min-width: 56px;
    min-height: 56px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    background: rgba(40, 50, 70, 0.5);
}
#f3d-info-portrait img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
#f3d-info-meta {
    flex: 1;
    min-width: 0;
}
#f3d-info-name {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 2px;
    letter-spacing: 0.5px;
}
#f3d-info-dates {
    font-size: 12px;
    color: rgba(180, 195, 210, 0.7);
    margin-bottom: 2px;
}
#f3d-info-category {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    opacity: 0.7;
}
#f3d-info-oneliner {
    font-size: 13px;
    color: rgba(200, 210, 220, 0.8);
    line-height: 1.4;
    margin-bottom: 8px;
}
#f3d-info-connections {
    font-size: 11px;
    color: rgba(150, 170, 200, 0.6);
    margin-bottom: 14px;
}
#f3d-info-explore {
    background: none;
    border: 1px solid rgba(100, 150, 255, 0.4);
    border-radius: 6px;
    color: rgba(100, 150, 255, 0.9);
    padding: 8px 20px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    letter-spacing: 0.5px;
}
#f3d-info-explore:hover {
    background: rgba(100, 150, 255, 0.15);
}
#f3d-info-back {
    position: absolute;
    top: 10px;
    right: 12px;
    background: none;
    border: none;
    color: rgba(150, 170, 200, 0.5);
    font-size: 16px;
    cursor: pointer;
    padding: 4px 8px;
}
#f3d-info-back:hover {
    color: rgba(200, 210, 220, 0.9);
}

/* Search bar positioning when 3D graph is active */
body.force3d-active #top-search-bar,
body.force3d-active.hud-dormant #top-search-bar {
    top: 20px !important;
    left: 50% !important;
    right: auto !important;
    transform: translateX(-50%) !important;
    width: 460px !important;
    max-width: 70vw !important;
    opacity: 0.6 !important;
    pointer-events: auto !important;
    z-index: 200 !important;
    background: none !important;
    backdrop-filter: none !important;
    border: none !important;
    padding: 0 !important;
    transition: opacity 0.3s ease !important;
}
body.force3d-active #top-search-bar:hover,
body.force3d-active #top-search-bar:focus-within {
    opacity: 1 !important;
}
body.force3d-active #top-search-input {
    background: rgba(8, 12, 20, 0.65) !important;
    backdrop-filter: blur(14px) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    animation: searchGlow 3s ease-in-out 2s 1 both;
}
@keyframes searchGlow {
    0% { box-shadow: none; }
    30% { box-shadow: 0 0 12px rgba(100, 150, 255, 0.3), 0 0 4px rgba(100, 150, 255, 0.15); }
    100% { box-shadow: none; }
}

/* Bio panel in 3D mode */
body.force3d-active #bio-panel {
    z-index: 220;
    background: rgba(8, 12, 20, 0.6);
    backdrop-filter: blur(14px);
    border-color: rgba(100, 150, 255, 0.15);
    width: 380px;
    bottom: 50px;
    border-radius: 8px 0 0 8px;
    /* Start hidden — showBioPanel removes .hidden */
    opacity: 0;
    pointer-events: none;
    transform: translateX(20px);
}
body.force3d-active #bio-panel.f3d-bio-visible {
    opacity: 0.9;
    pointer-events: auto;
    transform: translateX(0);
}
body.force3d-active #bio-panel:hover {
    opacity: 0.98;
}
body.force3d-active #bio-panel.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateX(20px);
}
body.force3d-active #bio-header {
    display: flex;
    align-items: center;
    gap: 12px;
}
body.force3d-active #bio-portrait-wrapper {
    width: 50px;
    height: 50px;
    min-width: 50px;
    border-radius: 50%;
    overflow: hidden;
}
body.force3d-active #bio-portrait {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
body.force3d-active #bio-name {
    font-size: 16px;
    font-weight: 600;
}
body.force3d-active #bio-dates {
    font-size: 11px;
    opacity: 0.5;
}
body.force3d-active #bio-oneliner {
    font-size: 12px;
    opacity: 0.7;
    margin-top: 4px;
}

/* 3D timeline */
#f3d-timeline {
    position: fixed;
    bottom: 8px;
    left: 60px;
    right: 60px;
    z-index: 210;
    height: 30px;
    user-select: none;
    padding: 0;
    transition: bottom 0.3s ease;
}
/* Timeline sits between controls and subtitles during narration */
body.narration-active #f3d-timeline {
    bottom: 52px;
    left: 16px;
    right: 16px;
    height: 24px;
    z-index: 510;
}
/* Make timeline track more visible during narration */
body.narration-active #f3d-tl-track {
    height: 3px;
    background: rgba(80, 100, 140, 0.5);
}
/* Push subtitle up to clear timeline */
body.narration-active #narration-subtitle {
    margin-bottom: 32px;
}
#f3d-tl-track {
    position: absolute;
    bottom: 4px;
    left: 0;
    right: 0;
    height: 2px;
    background: rgba(80, 100, 140, 0.25);
    border-radius: 1px;
    cursor: default;
}
#f3d-tl-range {
    position: absolute;
    top: -1px;
    height: 4px;
    background: rgba(100, 150, 255, 0.25);
    border-radius: 2px;
    cursor: grab;
}
#f3d-tl-range:active { cursor: grabbing; }
.f3d-tl-handle {
    position: absolute;
    top: -8px;
    width: 3px;
    height: 18px;
    background: rgba(150, 180, 255, 0.5);
    border-radius: 2px;
    cursor: ew-resize;
    transform: translateX(-1px);
    transition: background 0.15s;
}
.f3d-tl-handle:hover { background: rgba(150, 180, 255, 0.9); }
/* Now marker — narration year indicator */
#f3d-tl-now {
    position: absolute;
    top: -14px;
    width: 2px;
    height: 24px;
    background: rgba(255, 180, 60, 0.9);
    border-radius: 1px;
    display: none;
    pointer-events: none;
    transform: translateX(-1px);
    transition: left 1.2s ease-out;
    box-shadow: 0 0 8px rgba(255, 180, 60, 0.6), 0 0 16px rgba(255, 150, 30, 0.3);
}
#f3d-tl-now-label {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 2px;
    font-size: 11px;
    font-weight: bold;
    color: rgba(255, 200, 100, 0.95);
    white-space: nowrap;
    pointer-events: none;
    text-shadow: 0 0 6px rgba(0,0,0,0.8);
}
/* Lifetime bar for selected node */
#f3d-tl-dot {
    position: absolute;
    top: -1px;
    height: 4px;
    min-width: 2px;
    border-radius: 1px;
    display: none;
    pointer-events: none;
    box-shadow: 0 0 4px currentColor;
}
.f3d-tl-label {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 3px;
    font-size: 10px;
    color: rgba(150, 170, 200, 0.5);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    pointer-events: none;
}

/* Node count */
#f3d-node-count {
    position: fixed;
    bottom: 4px;
    right: 16px;
    z-index: 210;
    font-size: 11px;
    color: rgba(150, 170, 200, 0.35);
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.3px;
}

/* 3D hover tooltip */
#f3d-hover {
    position: fixed;
    z-index: 220;
    display: none;
    width: 260px;
    padding: 10px 12px;
    background: rgba(8, 12, 22, 0.88);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(100, 150, 255, 0.12);
    border-radius: 8px;
    pointer-events: none;
    font-size: 12px;
    color: rgba(200, 210, 230, 0.85);
    line-height: 1.4;
}
#f3d-hover-header {
    display: flex;
    gap: 10px;
    margin-bottom: 6px;
    align-items: center;
}
#f3d-hover-portrait {
    width: 44px;
    height: 44px;
    min-width: 44px;
    border-radius: 50%;
    background: rgba(40, 50, 70, 0.5);
    overflow: hidden;
}
#f3d-hover-portrait img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}
#f3d-hover-name {
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.3px;
}
#f3d-hover-dates {
    font-size: 11px;
    color: rgba(170, 185, 210, 0.6);
}
#f3d-hover-cat {
    font-size: 10px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}
#f3d-hover-oneliner {
    color: rgba(180, 195, 220, 0.7);
    margin-bottom: 4px;
}
#f3d-hover-conns {
    font-size: 10px;
    color: rgba(150, 170, 200, 0.4);
}

/* Globe container - top left */
#globe-container {
    top: 10px;
    left: 10px;
    width: 180px;
    height: 180px;
    opacity: 0.8;
    filter: brightness(1.0);
    transition: all 0.3s ease;
    border-radius: 8px;
}

#globe-container:hover {
    opacity: 1;
    filter: brightness(1.15);
}

#globe-container.large {
    width: 280px;
    height: 280px;
}

#globe-options {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-top: 6px;
}

#globe-options button {
    padding: 2px 8px;
    background: var(--btn-bg);
    border: 1px solid var(--btn-border);
    border-radius: 3px;
    color: rgba(180, 190, 200, 0.7);
    font-size: 9px;
    cursor: pointer;
    transition: all 0.2s ease;
}

#globe-options button:hover {
    background: var(--btn-bg-hover);
    color: var(--text-primary);
    border-color: var(--accent-dim);
}

#globe-options button.active {
    background: var(--accent-dim);
    color: var(--text-bright);
    border-color: var(--accent);
}

#globe-cesium {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    overflow: hidden;
}

#globe-cesium canvas {
    border-radius: 50%;
}

/* Hide all Cesium UI elements */
.cesium-viewer-bottom,
.cesium-viewer-toolbar,
.cesium-viewer-animationContainer,
.cesium-viewer-timelineContainer,
.cesium-viewer-fullscreenContainer,
.cesium-credit-lightbox-overlay,
.cesium-credit-expand-link {
    display: none !important;
}

#location-label {
    text-align: center;
    font-size: 11px;
    margin-top: 5px;
    color: rgba(180, 190, 200, 0.75);
}

#globe-zoom-buttons {
    display: flex;
    justify-content: center;
    gap: 4px;
    margin-top: 6px;
}

#globe-zoom-buttons button {
    width: 22px;
    height: 22px;
    padding: 0;
    background: var(--btn-bg);
    border: 1px solid var(--btn-border);
    border-radius: 3px;
    color: rgba(180, 190, 200, 0.7);
    font-size: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
}

#globe-zoom-buttons button:hover {
    background: var(--btn-bg-hover);
    color: var(--text-primary);
    border-color: var(--accent-dim);
}

#globe-zoom-buttons button.active {
    background: var(--accent-dim);
    color: var(--text-bright);
    border-color: var(--accent);
}

/* Journey panel - left side below globe */
#journey-panel {
    top: 270px;
    left: 10px;
    width: 200px;
    max-height: calc(100vh - 380px);
    opacity: 0.7;
    filter: brightness(1.0);
    transition: opacity 0.3s ease, filter 0.3s ease, top 0.3s ease;
    border-radius: 8px;
}

/* When globe is expanded, push journey down */
#journey-panel.globe-large {
    top: 370px;
    max-height: calc(100vh - 480px);
}

#journey-panel:hover {
    opacity: 1;
    filter: brightness(1.1);
}

/* Journey accordion */
#journey-accordion {
    margin: 0;
}

#journey-accordion summary {
    font-size: 14px;
    font-weight: 300;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: rgba(180, 190, 200, 0.7);
    cursor: pointer;
    list-style: none;
    padding: 5px 0;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

#journey-accordion summary::-webkit-details-marker {
    display: none;
}

#journey-accordion summary::before {
    content: '▶';
    font-size: 8px;
    transition: transform 0.2s ease;
}

#journey-accordion[open] summary::before {
    transform: rotate(90deg);
}

#journey-accordion summary:hover {
    color: var(--text-bright);
}

#journey-count-badge {
    font-size: 10px;
    background: var(--accent);
    color: var(--bg-dark);
    padding: 1px 6px;
    border-radius: 10px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

#journey-count-badge.has-items {
    opacity: 1;
}

#journey-content {
    animation: slideDown 0.2s ease;
}

#journey-stats {
    font-size: 10px;
    color: var(--text-dim);
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-dim);
}

#journey-stats .stats-count {
    color: var(--accent);
    font-weight: 500;
}

#journey-stats .stats-cats {
    color: rgba(100, 200, 150, 0.8);
}

#journey-stats .stats-hint {
    font-style: italic;
    opacity: 0.7;
}

#journey-log {
    max-height: calc(40vh - 100px);
    overflow-y: auto;
    font-size: 12px;
    line-height: 1.6;
}

#journey-log::-webkit-scrollbar {
    width: 4px;
}

#journey-log::-webkit-scrollbar-thumb {
    background: var(--border-dim);
    border-radius: 2px;
}

.journey-entry {
    margin-bottom: 8px;
    cursor: pointer;
    transition: color 0.2s;
}

.journey-entry:hover {
    color: var(--text-bright);
}

/* Guided journey styles */
.guided-journey-header {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--accent);
    margin-bottom: 10px;
    padding-bottom: 5px;
    border-bottom: 1px solid var(--border-dim);
}

.journey-entry.guided.current {
    background: rgba(100, 150, 255, 0.15);
    border-radius: 4px;
    padding: 6px 8px;
    margin: 4px -8px;
}

.journey-entry.guided.current .journey-node {
    color: var(--text-bright);
    font-weight: 500;
}

.journey-entry.guided.past .journey-node {
    color: var(--text-dim);
}

.journey-entry.guided.future {
    opacity: 0.5;
}

.guided-next-hint {
    font-size: 10px;
    color: var(--accent);
    margin-top: 15px;
    font-style: italic;
}

.guided-complete {
    font-size: 11px;
    color: var(--accent);
    margin-top: 15px;
    text-align: center;
    padding: 10px;
    background: rgba(100, 150, 255, 0.1);
    border-radius: 4px;
}

/* Journey End Overlay */
#journey-end-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 5, 15, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
    animation: fadeIn 0.5s ease-out;
}

#journey-end-overlay.hidden {
    display: none;
}

.journey-end-content {
    text-align: center;
    padding: 40px;
}

.journey-end-icon {
    font-size: 48px;
    margin-bottom: 20px;
    animation: pulse 2s ease-in-out infinite;
}

.journey-end-title {
    font-size: 28px;
    font-weight: 300;
    letter-spacing: 4px;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 15px;
}

.journey-end-subtitle {
    font-size: 14px;
    color: var(--text-dim);
    margin-bottom: 30px;
}

#journey-end-dismiss {
    padding: 12px 30px;
    background: rgba(100, 150, 255, 0.2);
    border: 1px solid var(--accent-dim);
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

#journey-end-dismiss:hover {
    background: rgba(100, 150, 255, 0.4);
    border-color: var(--accent);
    color: var(--text-bright);
}

/* Mobile Gesture Hint Overlay */
#mobile-hint {
    position: absolute;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(10, 15, 25, 0.95);
    border: 1px solid var(--border-dim);
    border-radius: 12px;
    padding: 15px 20px;
    z-index: 100;
    animation: slideUp 0.3s ease;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

#mobile-hint.hidden {
    display: none;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.mobile-hint-content {
    text-align: center;
}

.mobile-hint-gestures {
    display: flex;
    gap: 20px;
    margin-bottom: 15px;
}

.mobile-hint-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.mobile-hint-icon {
    font-size: 20px;
}

.mobile-hint-text {
    font-size: 10px;
    color: var(--text-dim);
    white-space: nowrap;
}

#mobile-hint-dismiss {
    padding: 6px 16px;
    background: rgba(100, 150, 255, 0.2);
    border: 1px solid var(--accent-dim);
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

#mobile-hint-dismiss:hover,
#mobile-hint-dismiss:active {
    background: rgba(100, 150, 255, 0.4);
    border-color: var(--accent);
}

/* Only show mobile hint on touch devices */
@media (hover: hover) and (pointer: fine) {
    #mobile-hint {
        display: none !important;
    }
}

.journey-node {
    color: var(--text-primary);
}

.journey-link {
    color: var(--text-dim);
    font-style: italic;
    padding-left: 10px;
}

.journey-oneliner {
    font-size: 10px;
    color: var(--text-dim);
    opacity: 0.7;
    margin-top: 2px;
    line-height: 1.3;
}

/* Journey nav - always visible outside accordion */
#journey-nav {
    display: flex;
    gap: 6px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border-dim);
}

#journey-nav button {
    flex: 1;
    background: rgba(100, 150, 255, 0.15);
    border: 1px solid rgba(100, 150, 255, 0.4);
    color: var(--text-primary);
    padding: 6px 10px;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s;
    border-radius: 4px;
}

#journey-nav button:hover:not(:disabled) {
    background: rgba(100, 150, 255, 0.3);
    border-color: var(--accent);
}

#journey-nav button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Journey tools (pathfind, curated journeys) */
#journey-tools {
    display: flex;
    gap: 6px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border-dim);
}

.journey-tool-btn {
    flex: 1;
    background: transparent;
    border: 1px solid var(--border-dim);
    color: var(--text-dim);
    padding: 6px 8px;
    font-size: 10px;
    cursor: pointer;
    transition: all 0.2s;
    border-radius: 4px;
    white-space: nowrap;
}

.journey-tool-btn:hover {
    background: rgba(100, 150, 255, 0.15);
    border-color: var(--accent-dim);
    color: var(--text-primary);
}

.journey-entry.current {
    background: rgba(100, 150, 255, 0.2);
    border-left: 3px solid var(--accent);
    padding-left: 9px;
}

.journey-entry.current .journey-node {
    color: var(--text-bright);
    font-weight: 500;
}

#journey-actions {
    margin-top: 10px;
    display: flex;
    gap: 8px;
}

#journey-actions button {
    background: transparent;
    border: 1px solid var(--border-dim);
    color: var(--text-dim);
    padding: 4px 10px;
    font-size: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

#journey-actions button:hover {
    border-color: var(--accent);
    color: var(--text-primary);
}

/* Mini-web container - full width, from top */
#miniweb-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 80px; /* Space for timebar */
    width: 100%;
    z-index: 5;
}

#miniweb {
    width: 100%;
    height: 100%;
    outline: none;
}

#miniweb:focus {
    outline: none;
}

/* View toggle button (sphere/graph) */
/* Graph controls (zoom + sphere toggle) - inline with search bar, before bio */
#right-controls {
    position: fixed;
    top: 100px; /* Below search bar and filters */
    right: 360px; /* Just left of bio panel */
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 3px;
    padding: 6px 10px;
    background: var(--panel-bg-strong);
    backdrop-filter: blur(15px);
    border: 1px solid var(--border-dim);
    border-radius: 8px;
    z-index: 100;
}

#view-toggle-btn {
    font-size: 16px;
}

/* Graph nodes and links */
.node {
    cursor: pointer;
    transition: opacity 0.2s;
}

.node circle {
    fill: var(--node-dim);
    transition: fill 0.2s, r 0.2s;
}

.node:hover circle:not(.has-portrait),
.node.highlighted circle:not(.has-portrait) {
    fill: var(--node-color);
}

.node.center circle:not(.has-portrait) {
    fill: var(--accent);
    filter: drop-shadow(0 0 8px rgba(100, 150, 255, 0.6));
    animation: nodePulse 2s ease-in-out infinite;
}

@keyframes nodePulse {
    0%, 100% {
        filter: drop-shadow(0 0 8px rgba(100, 150, 255, 0.6));
    }
    50% {
        filter: drop-shadow(0 0 15px rgba(100, 150, 255, 0.9));
    }
}

/* Portrait circles */
.node circle.has-portrait {
    stroke: rgba(100, 150, 255, 0.6);
    stroke-width: 1.5px;
    transition: stroke 0.2s, stroke-width 0.2s, filter 0.2s;
}

.node:hover circle.has-portrait,
.node.highlighted circle.has-portrait {
    stroke: rgba(100, 150, 255, 0.9);
    stroke-width: 2px;
    filter: drop-shadow(0 0 6px rgba(100, 150, 255, 0.5));
}

.node.center circle.has-portrait {
    stroke: var(--accent);
    stroke-width: 2.5px;
    filter: drop-shadow(0 0 10px rgba(100, 150, 255, 0.7));
}

.node text {
    fill: var(--text-dim);
    font-size: 11px;
    cursor: pointer;
    transition: fill 0.2s;
    text-shadow: 0 0 3px rgba(0, 0, 0, 0.8);
}

.node:hover text,
.node.highlighted text {
    fill: var(--text-primary);
}

.node.center text {
    fill: var(--text-bright);
    font-size: 13px;
    font-weight: 500;
}

.node .node-oneliner {
    fill: var(--text-dim);
    font-size: 9px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s;
    /* Black background effect using stroke */
    stroke: rgba(0, 0, 0, 0.85);
    stroke-width: 3px;
    paint-order: stroke fill;
}

.node:hover .node-oneliner,
.node.highlighted .node-oneliner {
    fill: var(--text-bright);
    opacity: 1;
}

.node.center .node-oneliner {
    font-size: 9px;
    opacity: 0;
}

.node.center:hover .node-oneliner,
.node.center.highlighted .node-oneliner {
    opacity: 1;
}

.node .connection-count {
    fill: var(--accent);
    font-size: 8px;
    font-weight: 600;
    opacity: 0.7;
    pointer-events: none;
}

.node:hover .connection-count {
    opacity: 1;
}

.link {
    stroke: var(--link-color);
    stroke-width: 1;
    transition: stroke 0.2s, stroke-width 0.2s;
    cursor: pointer;
}

/* Invisible wider stroke for easier hover detection */
.link-hitarea {
    stroke: transparent;
    stroke-width: 12;
    fill: none;
    cursor: pointer;
}

.link:hover,
.link.highlighted {
    stroke: var(--link-highlight);
    stroke-width: 2;
}

.link.dimmed {
    stroke: rgba(80, 100, 140, 0.1);
    stroke-width: 0.5;
}

.node.dimmed circle {
    fill: rgba(100, 120, 150, 0.2);
}

.node.dimmed text {
    fill: rgba(150, 160, 180, 0.2);
}

/* Time filter dimming - nodes outside current time range */
.node.time-filtered {
    opacity: 0.25;
}

.node.time-filtered text {
    fill: rgba(120, 140, 160, 0.4);
}

.node.time-filtered .connection-count {
    opacity: 0.3;
}

.link.time-filtered {
    opacity: 0.2;
    stroke-width: 0.5;
}

.node.search-match circle {
    fill: rgba(255, 200, 100, 0.9);
    filter: drop-shadow(0 0 10px rgba(255, 200, 100, 0.8));
    animation: searchPulse 1s ease-in-out infinite;
}

.node.search-match text {
    fill: var(--text-bright);
}

@keyframes searchPulse {
    0%, 100% {
        filter: drop-shadow(0 0 10px rgba(255, 200, 100, 0.8));
    }
    50% {
        filter: drop-shadow(0 0 20px rgba(255, 200, 100, 1));
    }
}

/* Guided journey next node highlight */
.node.guided-next circle {
    fill: rgba(100, 255, 150, 0.9);
    filter: drop-shadow(0 0 12px rgba(100, 255, 150, 0.8));
    animation: guidedPulse 1.5s ease-in-out infinite;
}

.node.guided-next text {
    fill: var(--text-bright);
    font-weight: 500;
}

@keyframes guidedPulse {
    0%, 100% {
        filter: drop-shadow(0 0 12px rgba(100, 255, 150, 0.8));
    }
    50% {
        filter: drop-shadow(0 0 20px rgba(100, 255, 150, 1));
    }
}

/* Journey path visualization */
.node.journey-node circle {
    stroke: #ffcc00;
    stroke-width: 2px;
    filter: drop-shadow(0 0 6px rgba(255, 204, 0, 0.6));
}

.node.journey-node text {
    fill: #ffcc00;
    font-weight: 500;
}

.link.journey-link {
    stroke: #ffcc00 !important;
    stroke-width: 3px !important;
    stroke-opacity: 0.9;
    filter: drop-shadow(0 0 4px rgba(255, 204, 0, 0.5));
}

/* Contemporaries Ring */
.node.contemporary .node-circle {
    opacity: 0.3;
    stroke: none;
}
.node.contemporary .node-name {
    opacity: 0;
    transition: opacity 0.15s;
    font-size: 9px;
}
.node.contemporary .node-oneliner {
    display: none;
}
.node.contemporary .connection-count {
    display: none;
}
.node.contemporary:hover .node-circle {
    opacity: 0.9;
    filter: drop-shadow(0 0 6px currentColor);
}
.node.contemporary:hover .node-name {
    opacity: 1;
    fill: var(--text-bright);
}

#contemporaries-badge {
    position: fixed;
    bottom: 110px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(10, 15, 25, 0.8);
    color: rgba(180, 200, 255, 0.7);
    font-size: 11px;
    padding: 4px 12px;
    border-radius: 12px;
    border: 1px solid rgba(100, 150, 255, 0.2);
    pointer-events: none;
    z-index: 20;
}
#contemporaries-badge.hidden {
    display: none;
}

/* 3D Sphere container */
#sphere-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 5;
    overflow: hidden;
}

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

#sphere-canvas {
    display: block;
    width: 100%;
    height: 100%;
    touch-action: none; /* Prevent browser touch handling */
}

#sphere-info {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s;
}

#sphere-info.visible {
    opacity: 1;
}

#sphere-node-portrait {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--accent);
    margin-bottom: 8px;
    display: none;
    box-shadow: 0 0 15px rgba(100, 150, 255, 0.4);
}

#sphere-node-portrait.visible {
    display: block;
}

#sphere-node-name {
    font-size: 18px;
    color: var(--text-bright);
    text-shadow: 0 0 10px rgba(0, 0, 0, 0.8);
}

#sphere-node-oneliner {
    font-size: 12px;
    color: var(--text-dim);
    margin-top: 3px;
    max-width: 300px;
    text-shadow: 0 0 8px rgba(0, 0, 0, 0.8);
}

#sphere-node-year {
    font-size: 12px;
    color: var(--accent);
    margin-top: 5px;
}

#sphere-controls {
    position: absolute;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    z-index: 10;
}

#sphere-century-label {
    font-size: 12px;
    color: var(--text-primary);
    margin-bottom: 8px;
}

#sphere-century-slider {
    width: 200px;
    -webkit-appearance: none;
    appearance: none;
    height: 4px;
    background: var(--border-dim);
    border-radius: 2px;
    outline: none;
}

#sphere-century-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: var(--accent);
    border-radius: 50%;
    cursor: pointer;
}

#sphere-century-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: var(--accent);
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

#sphere-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin: 15px 0 10px;
}

.sphere-btn {
    padding: 8px 16px;
    background: rgba(20, 30, 50, 0.8);
    border: 1px solid var(--border-dim);
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.sphere-btn:hover {
    background: rgba(100, 150, 255, 0.2);
    border-color: var(--accent-dim);
    color: var(--text-bright);
}

.sphere-btn:active {
    background: rgba(100, 150, 255, 0.3);
}

#sphere-hint {
    font-size: 10px;
    color: var(--text-dim);
    margin-top: 10px;
}

#sphere-node-count {
    font-size: 11px;
    color: var(--text-primary);
    margin-top: 8px;
    padding: 3px 8px;
    background: rgba(100, 150, 255, 0.15);
    border-radius: 8px;
    display: inline-block;
}

/* Hide mobile settings gear on desktop */
#mobile-settings-btn {
    display: none;
}

/* Settings bar (below search, left aligned) */
#top-controls {
    position: fixed;
    top: 100px; /* Below the top search bar and filters */
    left: 210px; /* Aligned with search bar */
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 15px;
    z-index: 15;
}

.zoom-btn {
    width: 32px;
    height: 32px;
    background: var(--btn-bg);
    border: 1px solid var(--btn-border);
    border-radius: 4px;
    color: rgba(180, 190, 200, 0.75);
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.zoom-btn:hover {
    border-color: var(--accent);
    color: var(--text-bright);
}

/* Settings accordion */
#settings-accordion {
    background: var(--panel-bg);
    border: 1px solid var(--btn-border);
    border-radius: 6px;
    font-size: 11px;
}

#settings-accordion summary {
    padding: 6px 12px;
    cursor: pointer;
    color: rgba(180, 190, 200, 0.7);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 6px;
}

#settings-accordion summary::-webkit-details-marker {
    display: none;
}

#settings-accordion summary::before {
    content: '▸';
    transition: transform 0.2s;
}

#settings-accordion[open] summary::before {
    transform: rotate(90deg);
}

#settings-accordion summary:hover {
    color: var(--text-bright);
}

#settings-accordion-content {
    padding: 10px 12px;
    border-top: 1px solid rgba(100, 130, 180, 0.2);
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 12px 20px;
    max-width: 600px;
}

.settings-group {
    display: flex;
    align-items: center;
    gap: 6px;
}

.settings-group .option-label {
    font-size: 10px;
    color: rgba(180, 190, 200, 0.7);
    min-width: auto;
    white-space: nowrap;
}

.settings-group select {
    padding: 3px 6px;
    background: var(--btn-bg);
    border: 1px solid var(--border-dim);
    color: var(--text-primary);
    font-size: 10px;
    border-radius: 3px;
    cursor: pointer;
}

.settings-group select:hover {
    border-color: var(--accent);
}

/* Toggle switch for settings */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 18px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(60, 70, 90, 0.6);
    transition: 0.3s;
    border-radius: 9px;
    border: 1px solid var(--border-dim);
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 12px;
    width: 12px;
    left: 2px;
    bottom: 2px;
    background-color: var(--text-dim);
    transition: 0.3s;
    border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
    background-color: rgba(100, 150, 255, 0.4);
    border-color: var(--accent);
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(18px);
    background-color: var(--accent);
}

/* Override zoom-btn for depth toggle to allow text */
#depth-toggle.zoom-btn {
    width: auto;
    height: auto;
    padding: 4px 10px;
    font-size: 11px;
    white-space: nowrap;
}

/* Graph display options - in top bar */
#graph-options {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
}

#graph-options .options-header {
    font-size: 10px;
    color: rgba(180, 190, 200, 0.7);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
}

#edge-color-controls,
#node-color-controls {
    display: flex;
    align-items: center;
    gap: 5px;
    background: var(--panel-bg);
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid var(--border-dim);
}

#graph-options .option-label {
    font-size: 10px;
    color: rgba(180, 190, 200, 0.7);
    min-width: 40px;
}

#edge-color-controls button {
    padding: 3px 8px;
    background: var(--btn-bg);
    border: 1px solid var(--btn-border);
    border-radius: 3px;
    color: rgba(180, 190, 200, 0.7);
    font-size: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
}

#edge-color-controls button:hover {
    background: var(--btn-bg-hover);
    color: var(--text-bright);
}

#edge-color-controls button.active {
    background: var(--accent-dim);
    color: var(--text-bright);
    border-color: var(--accent);
}

#node-color-select {
    padding: 3px 6px;
    background: var(--btn-bg);
    border: 1px solid var(--border-dim);
    border-radius: 3px;
    color: var(--text-primary);
    font-size: 10px;
    cursor: pointer;
}

#node-color-select:hover {
    border-color: var(--accent);
}

#transition-controls {
    display: flex;
    align-items: center;
    gap: 5px;
    background: var(--panel-bg);
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid var(--border-dim);
}

#transition-speed-select {
    padding: 3px 6px;
    background: var(--btn-bg);
    border: 1px solid var(--border-dim);
    border-radius: 3px;
    color: var(--text-primary);
    font-size: 10px;
    cursor: pointer;
}

#transition-speed-select:hover {
    border-color: var(--accent);
}

.legend-btn {
    width: 18px;
    height: 18px;
    padding: 0;
    background: var(--btn-bg);
    border: 1px solid var(--border-dim);
    border-radius: 50%;
    color: var(--text-dim);
    font-size: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.legend-btn:hover {
    background: var(--accent-dim);
    color: var(--text-bright);
    border-color: var(--accent);
}

/* Color legend panels */
.color-legend {
    position: fixed;
    top: 70px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--panel-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-dim);
    border-radius: 6px;
    padding: 12px;
    max-height: 400px;
    overflow-y: auto;
    z-index: 16;
    min-width: 150px;
}

.color-legend.hidden {
    display: none;
}

.color-legend h4 {
    margin: 0 0 8px 0;
    font-size: 11px;
    color: var(--text-primary);
    font-weight: 500;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 3px 0;
    font-size: 10px;
    color: var(--text-dim);
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 2px;
    flex-shrink: 0;
}

/* Link labels on graph */
.link-label {
    font-size: 9px;
    fill: var(--text-dim);
    pointer-events: none;
    opacity: 0.6;
    transition: all 0.2s ease;
}

.link-label.highlighted {
    font-size: 12px;
    fill: var(--text-bright);
    opacity: 1;
    font-weight: 500;
    text-shadow: 0 0 4px rgba(0, 0, 0, 0.8), 0 0 8px rgba(0, 0, 0, 0.6);
}

/* Current node indicator */
#current-node-info {
    position: absolute;
    bottom: 90px; /* Above timeline */
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    pointer-events: none;
    background: rgba(10, 15, 25, 0.7);
    backdrop-filter: blur(5px);
    padding: 12px 25px;
    border-radius: 20px;
    border: 1px solid var(--border-dim);
    max-width: 400px;
}

#current-node-name {
    font-size: 18px;
    color: var(--text-bright);
    font-weight: 300;
    letter-spacing: 1px;
}

#current-node-oneliner {
    font-size: 12px;
    color: var(--accent);
    font-style: italic;
    margin-top: 4px;
    max-width: 350px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#current-node-meta {
    font-size: 11px;
    color: var(--text-dim);
    margin-top: 6px;
}

#current-node-themes {
    margin-top: 8px;
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: center;
}

#current-node-themes:empty {
    display: none;
}

.theme-tag {
    font-size: 9px;
    padding: 3px 8px;
    background: rgba(100, 150, 255, 0.15);
    border: 1px solid var(--accent-dim);
    border-radius: 10px;
    color: var(--accent);
    cursor: pointer;
    pointer-events: auto;
    transition: all 0.2s;
}

.theme-tag:hover {
    background: rgba(100, 150, 255, 0.3);
    border-color: var(--accent);
}

/* Hover info tooltip */
#hover-info {
    position: fixed;
    pointer-events: none;
    background: var(--panel-bg);
    backdrop-filter: blur(10px);
    padding: 10px 15px;
    border-radius: 4px;
    max-width: 300px;
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 1000;
    display: flex;
    gap: 10px;
    align-items: flex-start;
    border: 1px solid var(--border-dim);
}

#hover-info.visible {
    opacity: 1;
}

#hover-portrait-wrapper {
    flex-shrink: 0;
    width: 40px;
    height: 50px;
    overflow: hidden;
    border-radius: 3px;
    background: rgba(50, 60, 80, 0.3);
    display: none;
}

#hover-portrait-wrapper.loaded {
    display: block;
}

#hover-portrait {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#hover-text {
    flex: 1;
    min-width: 0;
}

#hover-name {
    font-size: 14px;
    color: var(--text-bright);
    margin-bottom: 4px;
}

#hover-oneliner {
    font-size: 12px;
    color: var(--text-primary);
}

#hover-connection {
    font-size: 11px;
    color: var(--accent);
    font-style: italic;
    margin-top: 4px;
}

/* Bio panel - right side, left of icons */
#bio-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 340px;
    background: var(--panel-bg);
    backdrop-filter: blur(10px);
    padding: 15px;
    padding-bottom: 100px; /* Room for overlapping elements */
    overflow-y: auto;
    opacity: 0.75;
    z-index: 5; /* Lower so timeline/Burke sit on top */
    border: 1px solid var(--border-dim);
    border-right: none;
    border-radius: 8px 0 0 8px; /* Only round left side */
    transition: opacity 0.3s ease, transform 0.3s ease;
}

#bio-panel:hover {
    opacity: 0.95;
}

#bio-panel.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateX(20px);
}

#bio-close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    color: var(--text-dim);
    font-size: 22px;
    font-weight: 300;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    z-index: 10;
    opacity: 0.7;
}

#bio-close:hover {
    color: rgba(255, 100, 100, 0.9);
    opacity: 1;
}
body.force3d-active #bio-close {
    width: 36px;
    height: 36px;
    font-size: 24px;
    opacity: 0.9;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 50%;
}

#bio-header {
    margin-bottom: 12px;
    border-bottom: 1px solid var(--border-dim);
    padding-bottom: 12px;
    display: flex;
    gap: 12px;
    align-items: flex-start;
    position: relative;
}

#bio-portrait-wrapper {
    flex-shrink: 0;
    width: 60px;
    height: 75px;
    overflow: hidden;
    border-radius: 4px;
    background: rgba(50, 60, 80, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
}

#bio-portrait-wrapper.hidden {
    display: none;
}

#bio-portrait {
    max-width: 100%;
    max-height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.3s ease;
}

#bio-portrait.loaded {
    opacity: 1;
}

#bio-header-text {
    flex: 1;
    min-width: 0;
}

#bio-name {
    font-size: 16px;
    font-weight: 400;
    color: var(--text-bright);
    margin-bottom: 3px;
    line-height: 1.2;
}

#bio-dates {
    font-size: 11px;
    color: var(--text-dim);
}

#bio-oneliner {
    font-size: 12px;
    color: var(--accent);
    margin-top: 6px;
    font-style: italic;
    line-height: 1.4;
}

#bio-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 10px;
    color: var(--text-dim);
    margin-bottom: 12px;
}

#bio-themes {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 12px;
}

#bio-speak {
    flex-shrink: 0;
    align-self: flex-start;
    background: transparent;
    border: none;
    color: var(--text-dim);
    font-size: 16px;
    padding: 2px;
    cursor: pointer;
    transition: all 0.2s;
    opacity: 0.6;
}

#bio-speak:hover {
    color: var(--text-bright);
    opacity: 1;
}

#bio-speak.speaking {
    color: var(--accent);
    opacity: 1;
}

#bio-content {
    font-family: 'Source Serif 4', Georgia, 'Times New Roman', serif;
    font-size: 13px;
    line-height: 1.7;
    color: var(--text-primary);
    font-optical-sizing: auto;
}

#bio-content a {
    color: var(--accent);
    text-decoration: none;
    cursor: pointer;
    transition: color 0.2s;
}

#bio-content a:hover {
    color: var(--text-bright);
}

#bio-content .location-ref {
    color: var(--text-primary);
    border-bottom: 1px dotted rgba(100, 200, 150, 0.5);
    cursor: pointer;
    transition: all 0.2s;
    padding: 0 2px;
    border-radius: 2px;
}

#bio-content .location-ref:hover {
    color: rgba(100, 200, 150, 1);
    border-bottom-color: rgba(100, 200, 150, 1);
    background: rgba(100, 200, 150, 0.1);
}

#bio-bibliography {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid var(--border-dim);
}

#bio-bibliography.hidden {
    display: none;
}

#bio-bibliography h3 {
    font-size: 10px;
    font-weight: 500;
    color: var(--text-dim);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

#bio-bibliography-list {
    font-size: 11px;
    color: var(--text-dim);
    line-height: 1.5;
}

.bib-entry {
    margin-bottom: 8px;
    padding-left: 10px;
    border-left: 2px solid var(--border-dim);
}

#bio-connections {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid var(--border-dim);
}

#bio-connections h3 {
    font-size: 10px;
    font-weight: 500;
    color: var(--text-dim);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

#bio-connections-list {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.bio-connection {
    background: rgba(100, 150, 255, 0.1);
    padding: 3px 8px;
    border-radius: 10px;
    font-size: 10px;
    color: var(--text-primary);
    cursor: pointer;
    transition: background 0.2s;
}

.bio-connection:hover {
    background: rgba(100, 150, 255, 0.3);
}

/* Hide current node info - now shown in bio panel */
#current-node-info {
    display: none;
}

/* Link preview tooltip */
#link-preview {
    position: fixed;
    z-index: 1000;
    background: rgba(15, 20, 35, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-dim);
    border-radius: 8px;
    padding: 12px 15px;
    max-width: 300px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(5px);
    transition: opacity 0.15s, transform 0.15s, visibility 0.15s;
    pointer-events: none;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

#link-preview.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.preview-content {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.preview-portrait-wrapper {
    flex-shrink: 0;
    width: 40px;
    height: 50px;
    overflow: hidden;
    border-radius: 3px;
    background: rgba(50, 60, 80, 0.3);
    display: none;
}

.preview-portrait-wrapper.loaded {
    display: block;
}

.preview-portrait {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.preview-text {
    flex: 1;
    min-width: 0;
}

.preview-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-bright);
    margin-bottom: 4px;
}

.preview-year {
    font-size: 11px;
    color: var(--text-dim);
    margin-bottom: 6px;
}

.preview-connection {
    font-size: 11px;
    color: rgba(100, 200, 150, 0.9);
    font-style: italic;
    margin-bottom: 6px;
    padding: 3px 6px;
    background: rgba(100, 200, 150, 0.1);
    border-radius: 3px;
    border-left: 2px solid rgba(100, 200, 150, 0.5);
}

.preview-oneliner {
    font-size: 12px;
    color: var(--accent);
    font-style: italic;
    line-height: 1.4;
    margin-bottom: 6px;
}

.preview-category {
    font-size: 10px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.bio-connection-type {
    color: var(--text-dim);
    font-size: 10px;
}

#bio-footer {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid var(--border-dim);
}

#bio-wiki {
    color: var(--accent);
    text-decoration: none;
    font-size: 12px;
}

#bio-wiki:hover {
    color: var(--text-bright);
}

/* Hidden nodes indicator */
#hidden-nodes-indicator {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 11px;
    color: var(--text-dim);
    background: rgba(10, 15, 25, 0.8);
    padding: 4px 10px;
    border-radius: 10px;
    border: 1px solid rgba(100, 150, 255, 0.2);
    z-index: 100;
    pointer-events: none;
}

#hidden-nodes-indicator.hidden {
    display: none;
}

/* Time bar */
#timebar-container {
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 12px;
    width: 85%;
    max-width: 1000px;
    opacity: 0.75;
    transition: opacity 0.3s ease, filter 0.3s ease, padding 0.4s ease, height 0.4s ease, min-height 0.4s ease;
    padding: 8px 15px;
    background: var(--panel-bg);
    border-radius: 8px 8px 0 0; /* Only round top */
    border: 1px solid var(--btn-border);
    border-bottom: none;
    backdrop-filter: blur(10px);
    z-index: 50; /* Above bio panel */
}

#timebar-container .timebar-nav,
#timebar-container #timebar-scale,
#timebar-container #timebar-labels,
#timebar-container #timebar-now-marker .now-year {
    transition: opacity 0.4s ease;
}

.timebar-nav {
    background: rgba(30, 50, 80, 0.4);
    border: 1px solid rgba(80, 120, 180, 0.4);
    color: rgba(180, 190, 200, 0.75);
    width: 28px;
    height: 28px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.timebar-nav:hover {
    background: rgba(60, 100, 150, 0.4);
    border-color: var(--accent);
    color: var(--text-bright);
    box-shadow: 0 0 10px rgba(100, 150, 255, 0.3);
}

#timebar {
    flex: 1;
    height: 55px;
    position: relative;
    cursor: grab;
    transition: height 0.4s ease;
}

#timebar:active {
    cursor: grabbing;
}

#timebar-track {
    position: absolute;
    top: 22px;
    left: 0;
    right: 0;
    height: 6px;
    background: linear-gradient(90deg,
        rgba(40, 60, 100, 0.4) 0%,
        rgba(60, 90, 130, 0.5) 50%,
        rgba(40, 60, 100, 0.4) 100%);
    border-radius: 3px;
    cursor: pointer;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.3);
}

#timebar-selection {
    position: absolute;
    height: 100%;
    background: linear-gradient(90deg,
        rgba(80, 130, 200, 0.7) 0%,
        rgba(100, 160, 255, 0.8) 50%,
        rgba(80, 130, 200, 0.7) 100%);
    border-radius: 3px;
    pointer-events: none;
    box-shadow: 0 0 12px rgba(100, 150, 255, 0.4);
}

#timebar-lifespan {
    position: absolute;
    height: 100%;
    background: linear-gradient(90deg,
        rgba(80, 180, 130, 0.5) 0%,
        rgba(100, 200, 150, 0.7) 50%,
        rgba(80, 180, 130, 0.5) 100%);
    border-radius: 3px;
    pointer-events: none;
    top: 0;
    display: none;
    box-shadow: 0 0 10px rgba(100, 200, 150, 0.4);
}

#timebar-lifespan.visible {
    display: block;
}

#timebar-lifespan::before,
#timebar-lifespan::after {
    content: '';
    position: absolute;
    top: -8px;
    width: 3px;
    height: 22px;
    background: linear-gradient(180deg, rgba(100, 200, 150, 1), rgba(80, 180, 130, 0.8));
    border-radius: 2px;
    box-shadow: 0 0 6px rgba(100, 200, 150, 0.6);
}

#timebar-lifespan::before {
    left: -1px;
}

#timebar-lifespan::after {
    right: -1px;
}

/* Node dots on timeline */
#timebar-nodes {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 100%;
    pointer-events: none;
}

.timebar-node {
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    cursor: pointer;
    pointer-events: all;
    transition: all 0.15s ease;
    box-shadow: 0 0 4px rgba(0, 0, 0, 0.5);
}

.timebar-node:hover {
    transform: translate(-50%, -50%) scale(1.5);
    z-index: 10;
}

.timebar-node.center {
    width: 12px;
    height: 12px;
    z-index: 5;
    box-shadow: 0 0 8px rgba(255, 200, 100, 0.8);
}

.timebar-node.neighbor {
    opacity: 0.8;
}

.timebar-node.neighbor:hover {
    opacity: 1;
}

.timebar-node.highlighted {
    transform: translate(-50%, -50%) scale(1.4);
    box-shadow: 0 0 12px currentColor;
}

/* Now marker - central time indicator */
#timebar-now-marker {
    position: absolute;
    left: 50%;
    top: -5px;
    bottom: -5px;
    transform: translateX(-50%);
    pointer-events: none;
    z-index: 15;
}

#timebar-now-marker .now-line {
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 2px;
    transform: translateX(-50%);
    background: linear-gradient(180deg,
        rgba(255, 180, 100, 0.9) 0%,
        rgba(255, 140, 80, 0.7) 50%,
        rgba(255, 180, 100, 0.9) 100%);
    box-shadow: 0 0 8px rgba(255, 160, 80, 0.6);
}

#timebar-now-marker .now-year {
    position: absolute;
    left: 50%;
    top: -22px;
    transform: translateX(-50%);
    background: rgba(255, 160, 80, 0.9);
    color: #000;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: bold;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

#timebar-now-marker .now-year::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 5px solid rgba(255, 160, 80, 0.9);
}

#timebar-labels {
    position: absolute;
    bottom: 5px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    color: var(--text-dim);
    user-select: none;
}

#timebar-labels span {
    padding: 3px 8px;
    border-radius: 4px;
    transition: all 0.2s;
    font-family: 'Courier New', monospace;
    letter-spacing: 0.5px;
}

#timebar-labels span:hover {
    color: var(--text-bright);
    background: rgba(80, 130, 200, 0.25);
    box-shadow: 0 0 8px rgba(100, 150, 255, 0.2);
}

#timebar-labels span.active {
    color: var(--accent);
    background: rgba(80, 130, 200, 0.4);
    font-weight: 600;
    box-shadow: 0 0 12px rgba(100, 150, 255, 0.3);
}

#timebar-histogram {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 20px;
    display: flex;
    align-items: flex-end;
    gap: 1px;
    opacity: 0.8;
}

.histogram-bar {
    flex: 1;
    background: linear-gradient(180deg, rgba(80, 130, 200, 0.6), rgba(60, 100, 160, 0.3));
    min-height: 2px;
    border-radius: 1px 1px 0 0;
    transition: opacity 0.2s;
}

.histogram-bar:hover {
    opacity: 1.2;
}

#timebar-scale {
    background: rgba(30, 50, 80, 0.3);
    border: 1px solid rgba(80, 120, 180, 0.3);
    color: var(--text-dim);
    padding: 6px 14px;
    font-size: 10px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 500;
}

#timebar-scale:hover {
    background: rgba(60, 100, 150, 0.4);
    border-color: var(--accent);
    color: var(--text-bright);
    box-shadow: 0 0 10px rgba(100, 150, 255, 0.3);
}

/* Zoom hint */
#timebar::after {
    content: 'Drag to pan • Scroll to zoom';
    position: absolute;
    top: -18px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 9px;
    color: rgba(100, 140, 180, 0.4);
    opacity: 0;
    transition: opacity 0.3s;
    white-space: nowrap;
}

#timebar-container:hover {
    opacity: 1;
    filter: brightness(1.1);
}

#timebar-container:hover #timebar::after {
    opacity: 1;
}

/* Icon buttons */
.icon-btn {
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 18px;
    cursor: pointer;
    padding: 8px;
    transition: all 0.3s ease;
    opacity: 0.8;
    filter: brightness(1.0);
}

.icon-btn:hover {
    color: var(--text-bright);
    opacity: 1;
    filter: brightness(1.2);
    text-shadow: var(--glow), 0 0 20px rgba(100, 150, 255, 0.5);
    transform: scale(1.1);
}

.icon-btn:active {
    transform: scale(0.95);
    filter: brightness(1.5);
}

/* Settings Panel */
#settings-panel {
    position: fixed;
    top: 20px;
    right: 70px;
    width: 260px;
    background: rgba(10, 15, 25, 0.95);
    backdrop-filter: blur(15px);
    border: 1px solid var(--border-dim);
    border-radius: 8px;
    z-index: 100;
    animation: slideIn 0.2s ease;
}

#settings-panel.hidden {
    display: none;
}

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

#settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    border-bottom: 1px solid var(--border-dim);
    font-size: 12px;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--accent);
}

#settings-close {
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 18px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

#settings-close:hover {
    color: var(--text-bright);
}

#settings-content {
    padding: 15px;
}

.settings-section {
    margin-bottom: 18px;
}

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

.settings-section h4 {
    font-size: 11px;
    font-weight: 400;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

.settings-row {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.settings-btn {
    padding: 6px 12px;
    background: rgba(50, 60, 80, 0.5);
    border: 1px solid var(--border-dim);
    border-radius: 4px;
    color: var(--text-dim);
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s;
}

.settings-btn:hover {
    background: rgba(100, 150, 255, 0.2);
    border-color: var(--accent-dim);
    color: var(--text-primary);
}

.settings-btn.active {
    background: rgba(100, 150, 255, 0.3);
    border-color: var(--accent);
    color: var(--text-bright);
}

#settings-content select {
    width: 100%;
    padding: 8px 10px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-dim);
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 12px;
    cursor: pointer;
}

#settings-content select:focus {
    border-color: var(--accent);
    outline: none;
}

/* Burke Avatar - very bottom right */
#burke-avatar {
    position: fixed;
    bottom: 10px;
    right: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    opacity: 0.75;
    transition: all 0.3s ease;
    z-index: 100; /* Above bio panel and timeline */
}

#burke-avatar:hover {
    opacity: 1;
    transform: scale(1.1);
}

#burke-avatar-icon {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, rgba(100, 150, 200, 0.5), rgba(50, 70, 100, 0.7));
    border: 1px solid rgba(100, 150, 255, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: var(--text-bright);
    box-shadow: 0 0 20px rgba(100, 150, 255, 0.3);
}

#burke-avatar-label {
    font-size: 9px;
    color: rgba(180, 190, 200, 0.8);
    margin-top: 5px;
    letter-spacing: 1px;
    text-transform: uppercase;
}

/* Burke Chat Panel */
#burke-chat {
    position: fixed;
    bottom: 100px;
    right: 20px;
    width: 320px;
    max-height: 400px;
    background: rgba(10, 15, 25, 0.95);
    backdrop-filter: blur(15px);
    border: 1px solid var(--border-dim);
    border-radius: 8px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s ease;
}

#burke-chat.hidden {
    display: none;
}

#burke-chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    border-bottom: 1px solid var(--border-dim);
    font-size: 12px;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--accent);
}

#burke-chat-close {
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 18px;
    cursor: pointer;
}

#burke-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    max-height: 250px;
    min-height: 100px;
}

.burke-message {
    margin-bottom: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 12px;
    line-height: 1.5;
}

.burke-message.user {
    background: rgba(100, 150, 255, 0.15);
    margin-left: 20px;
    text-align: right;
}

.burke-message.burke {
    background: rgba(100, 200, 150, 0.1);
    margin-right: 20px;
    border-left: 2px solid rgba(100, 200, 150, 0.5);
}

.burke-message.speaking {
    border-color: var(--accent);
    animation: pulse 1s ease-in-out infinite;
}

#burke-chat-input {
    display: flex;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid var(--border-dim);
}

#burke-input {
    flex: 1;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-dim);
    border-radius: 4px;
    padding: 8px 12px;
    color: var(--text-primary);
    font-size: 12px;
}

#burke-send {
    padding: 8px 16px;
    background: rgba(100, 150, 255, 0.2);
    border: 1px solid var(--accent-dim);
    border-radius: 4px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s;
}

#burke-send:hover {
    background: rgba(100, 150, 255, 0.4);
}

/* Burke suggestion buttons */
.burke-suggestions {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 8px;
    margin-bottom: 8px;
}

.burke-suggestion {
    background: rgba(100, 150, 255, 0.1);
    border: 1px solid rgba(100, 150, 255, 0.3);
    border-radius: 16px;
    padding: 8px 14px;
    color: var(--text-primary);
    font-size: 11px;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s;
}

.burke-suggestion:hover {
    background: rgba(100, 150, 255, 0.25);
    border-color: var(--accent);
}

/* TTS Speaking indicator */
.bio-sidebar-btn.speaking {
    color: var(--accent);
    animation: pulse 1s ease-in-out infinite;
}

/* Modals */
.modal,
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

/* Changelog Modal */
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-dim);
    padding-bottom: 10px;
}

.modal-header h3 {
    margin: 0;
    font-size: 18px;
    color: var(--text-bright);
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.modal-close:hover {
    color: var(--text-bright);
}

.modal-body {
    color: var(--text-primary);
}

.changelog-item {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 8px;
    padding: 10px 0;
    border-bottom: 1px solid rgba(100, 150, 255, 0.1);
}

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

.changelog-item.new {
    background: rgba(100, 200, 100, 0.1);
    margin: 0 -15px;
    padding: 10px 15px;
    border-radius: 4px;
}

.changelog-date {
    font-family: 'Courier New', monospace;
    font-size: 12px;
    color: var(--text-dim);
    min-width: 90px;
}

.new-badge {
    background: rgba(100, 200, 100, 0.3);
    color: #90ee90;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 3px;
    font-weight: bold;
}

.changelog-text {
    flex: 1;
    min-width: 200px;
    color: var(--text-primary);
    font-size: 14px;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: var(--panel-bg);
    backdrop-filter: blur(10px);
    padding: 25px;
    max-width: 500px;
    width: 90%;
    max-height: 70vh;
    overflow-y: auto;
}

.modal-content h3 {
    font-size: 14px;
    font-weight: 400;
    color: var(--text-primary);
    margin-bottom: 15px;
}

.modal-content input[type="text"] {
    width: 100%;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-dim);
    color: var(--text-primary);
    padding: 10px 15px;
    font-size: 14px;
    margin-bottom: 15px;
    outline: none;
}

.modal-content input[type="text"]:focus {
    border-color: var(--accent);
}

#search-results,
#contents-list,
#category-list,
#discipline-list,
#archive-list {
    max-height: 50vh;
    overflow-y: auto;
}

.result-item,
.category-item,
.discipline-item,
.archive-item {
    padding: 10px 12px;
    cursor: pointer;
    color: var(--text-dim);
    transition: all 0.2s;
    border-bottom: 1px solid var(--border-dim);
}

.result-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.result-item:hover,
.category-item:hover,
.discipline-item:hover,
.archive-item:hover {
    color: var(--text-bright);
    background: rgba(100, 150, 255, 0.1);
}

.result-item .result-thumb {
    width: 36px;
    height: 36px;
    border-radius: 4px;
    background: rgba(60, 80, 120, 0.3);
    flex-shrink: 0;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.result-item .result-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.result-item .result-thumb .result-thumb-placeholder {
    font-size: 14px;
    opacity: 0.4;
}

.result-item .result-info {
    flex: 1;
    min-width: 0;
}

.result-item .name {
    color: var(--text-primary);
}

.result-item .oneliner {
    font-size: 12px;
    color: var(--text-dim);
    margin-top: 3px;
}

.search-hint {
    font-size: 11px;
    color: var(--accent);
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-dim);
    font-style: italic;
}

.search-hint.llm-hint {
    color: rgba(150, 200, 100, 0.9);
    background: rgba(150, 200, 100, 0.1);
}

.search-hint.search-loading {
    color: var(--text-dim);
    animation: pulse 1.5s ease-in-out infinite;
}

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

.search-examples {
    font-size: 10px;
    color: var(--text-dim);
    padding: 8px 0 12px 0;
    border-bottom: 1px solid var(--border-dim);
    margin-bottom: 10px;
}

#contents-alphabet {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 15px;
}

.alpha-btn {
    background: transparent;
    border: 1px solid var(--border-dim);
    color: var(--text-dim);
    padding: 5px 8px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.alpha-btn:hover,
.alpha-btn.active {
    border-color: var(--accent);
    color: var(--text-primary);
}

#archive-save {
    width: 100%;
    background: transparent;
    border: 1px solid var(--accent);
    color: var(--accent);
    padding: 10px;
    margin-top: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

#archive-save:hover {
    background: var(--accent);
    color: var(--bg-dark);
}

/* Startup overlay */
#startup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    cursor: pointer;
}

#startup-overlay.fade-out {
    animation: fadeOut 0.8s ease forwards;
    pointer-events: none;
}

#startup-flare {
    width: 10px;
    height: 10px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 0 50px 30px rgba(255, 255, 255, 0.5),
                0 0 100px 60px rgba(200, 220, 255, 0.3);
    animation: flare 2s ease-out forwards;
}

#startup-flare::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    animation: flareCore 2s ease-out forwards;
}

#startup-title {
    font-size: 32px;
    font-weight: 100;
    letter-spacing: 6px;
    color: var(--text-primary);
    margin-top: 50px;
    opacity: 0;
    text-transform: uppercase;
    animation: fadeInTitle 1s ease 0.8s forwards;
}

#startup-subtitle {
    font-size: 12px;
    font-weight: 300;
    letter-spacing: 3px;
    color: var(--text-dim);
    margin-top: 20px;
    opacity: 0;
    animation: fadeInTitle 0.8s ease 1.4s forwards;
    line-height: 2;
}

#startup-subtitle .click-continue {
    display: inline-block;
    margin-top: 10px;
    color: var(--text-primary);
    animation: pulse 2s ease-in-out infinite;
    cursor: pointer;
}

@keyframes flare {
    0% {
        transform: scale(0.1);
        opacity: 0;
        background: #ff4400;
        box-shadow: 0 0 30px 15px rgba(255, 68, 0, 0.8),
                    0 0 60px 30px rgba(255, 68, 0, 0.4);
    }
    10% {
        transform: scale(2);
        opacity: 1;
        background: #ff6600;
        box-shadow: 0 0 80px 40px rgba(255, 100, 0, 0.9),
                    0 0 150px 80px rgba(255, 100, 0, 0.5);
    }
    25% {
        transform: scale(6);
        opacity: 1;
        background: #fff;
        box-shadow: 0 0 200px 100px rgba(255, 255, 255, 1),
                    0 0 400px 200px rgba(200, 220, 255, 0.6);
    }
    50% {
        transform: scale(3);
        opacity: 0.8;
        background: #fff;
        box-shadow: 0 0 100px 50px rgba(255, 255, 255, 0.7),
                    0 0 200px 100px rgba(100, 150, 255, 0.4);
    }
    100% {
        transform: scale(0.6);
        opacity: 0.3;
        background: rgba(100, 150, 255, 0.8);
        box-shadow: 0 0 30px 15px rgba(100, 150, 255, 0.5),
                    0 0 60px 30px rgba(100, 150, 255, 0.2);
    }
}

@keyframes flareCore {
    0%, 10% {
        box-shadow: inset 0 0 10px 5px rgba(255, 200, 100, 1);
    }
    25% {
        box-shadow: inset 0 0 20px 10px rgba(255, 255, 255, 1);
    }
    100% {
        box-shadow: inset 0 0 5px 2px rgba(100, 150, 255, 0.5);
    }
}

@keyframes fadeInTitle {
    to {
        opacity: 1;
    }
}

@keyframes fadeOut {
    to {
        opacity: 0;
    }
}

/* Prompts panel - subtle "built with" indicator */
#prompts-trigger {
    position: absolute;
    bottom: 20px;
    left: 20px;
    font-size: 10px;
    color: var(--text-dim);
    opacity: 0.3;
    cursor: pointer;
    transition: opacity 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    animation: fadeInTitle 1s ease 2s forwards;
    opacity: 0;
}

#prompts-trigger:hover {
    opacity: 0.8;
}

#prompts-icon {
    font-size: 12px;
    animation: twinkle 3s ease-in-out infinite;
}

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

#prompts-label {
    letter-spacing: 1px;
    text-transform: uppercase;
}

/* Solar system link on startup */
#solar-link {
    position: absolute;
    bottom: 20px;
    right: 20px;
    font-size: 10px;
    color: var(--text-dim);
    opacity: 0.3;
    cursor: pointer;
    transition: opacity 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    animation: fadeInTitle 1s ease 2s forwards;
    opacity: 0;
}

#solar-link:hover {
    opacity: 0.8;
}

#solar-icon {
    font-size: 16px;
}

#solar-label {
    letter-spacing: 1px;
    text-transform: uppercase;
}

#prompts-panel {
    position: absolute;
    bottom: 50px;
    left: 20px;
    width: 400px;
    max-height: 60vh;
    background: rgba(5, 10, 20, 0.95);
    border: 1px solid var(--border-dim);
    border-radius: 8px;
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

#prompts-panel.hidden {
    display: none;
}

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

#prompts-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    border-bottom: 1px solid var(--border-dim);
    font-size: 11px;
    color: var(--text-dim);
    letter-spacing: 1px;
    text-transform: uppercase;
}

#prompts-close {
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 18px;
    cursor: pointer;
    padding: 0 5px;
    line-height: 1;
}

#prompts-close:hover {
    color: var(--text-bright);
}

#prompts-list {
    max-height: calc(60vh - 50px);
    overflow-y: auto;
    padding: 10px 0;
}

.prompt-entry {
    padding: 10px 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    transition: background 0.2s;
}

.prompt-entry:hover {
    background: rgba(100, 150, 255, 0.05);
}

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

.prompt-date {
    font-size: 9px;
    color: var(--accent-dim);
    margin-bottom: 4px;
    font-family: monospace;
}

.prompt-text {
    font-size: 11px;
    color: var(--text-primary);
    line-height: 1.5;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-dim);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-dim);
}

/* Themes modal */
.themes-content {
    max-width: 550px;
}

#themes-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    max-height: 60vh;
    overflow-y: auto;
}

.theme-item {
    padding: 15px;
    background: rgba(100, 150, 255, 0.08);
    border: 1px solid var(--border-dim);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.theme-item:hover {
    background: rgba(100, 150, 255, 0.15);
    border-color: var(--accent);
}

.theme-name {
    font-size: 14px;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.theme-desc {
    font-size: 11px;
    color: var(--text-dim);
    line-height: 1.4;
}

.theme-count {
    font-size: 10px;
    color: var(--accent);
    margin-top: 6px;
}

/* Theme results view */
#theme-results-modal .modal-content {
    max-width: 500px;
}

.theme-results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-dim);
}

.theme-results-header h3 {
    margin: 0;
}

.theme-back-btn {
    background: transparent;
    border: 1px solid var(--border-dim);
    color: var(--text-dim);
    padding: 5px 12px;
    font-size: 11px;
    cursor: pointer;
}

.theme-back-btn:hover {
    border-color: var(--accent);
    color: var(--text-primary);
}

#theme-results-list {
    max-height: 50vh;
    overflow-y: auto;
}

@media (max-width: 480px) {
    #themes-list {
        grid-template-columns: 1fr;
    }
}

/* Preselected Journeys modal */
.journeys-content {
    max-width: 550px;
}

.journeys-intro {
    font-size: 12px;
    color: var(--text-dim);
    margin-bottom: 20px;
}

#journeys-list {
    max-height: 60vh;
    overflow-y: auto;
}

.journey-item {
    padding: 15px;
    background: rgba(100, 150, 255, 0.05);
    border: 1px solid var(--border-dim);
    border-radius: 6px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.journey-item:hover {
    background: rgba(100, 150, 255, 0.12);
    border-color: var(--accent);
}

.journey-title {
    font-size: 14px;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.journey-title .journey-arrow {
    color: var(--accent);
    margin: 0 8px;
}

.journey-description {
    font-size: 12px;
    color: var(--text-dim);
    line-height: 1.5;
    margin-bottom: 8px;
}

.journey-meta {
    font-size: 10px;
    color: var(--accent);
}

.journey-preview {
    font-size: 11px;
    color: var(--text-dim);
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border-dim);
}

.journey-preview span {
    margin-right: 8px;
}

.journey-preview span:not(:last-child)::after {
    content: '→';
    margin-left: 8px;
    color: var(--accent-dim);
}

.journeys-loading {
    text-align: center;
    color: var(--text-dim);
    padding: 30px;
    font-style: italic;
}

.journey-section-header {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--accent);
    padding: 8px 0;
    margin: 10px 0 5px 0;
    border-bottom: 1px solid var(--border-dim);
}

.journey-section-header:first-child {
    margin-top: 0;
}

.journey-item.dataset-journey {
    border-left: 3px solid var(--accent);
}

/* Gateways modal */
.modal-intro {
    font-size: 12px;
    color: var(--text-dim);
    margin-bottom: 15px;
}

#gateways-list {
    max-height: 50vh;
    overflow-y: auto;
}

/* Advanced Filter modal */
.filter-content {
    max-width: 450px;
}

.filter-row {
    margin-bottom: 15px;
}

.filter-row label {
    display: block;
    font-size: 11px;
    color: var(--text-dim);
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.filter-row select,
.filter-row input[type="text"] {
    width: 100%;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-dim);
    color: var(--text-primary);
    padding: 10px;
    font-size: 13px;
}

.filter-row select:focus,
.filter-row input[type="text"]:focus {
    border-color: var(--accent);
    outline: none;
}

.filter-row select option {
    background: var(--bg-dark);
}

#filter-apply {
    width: 100%;
    padding: 12px;
    background: var(--accent);
    border: none;
    color: var(--bg-dark);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: opacity 0.2s;
    margin-bottom: 15px;
}

#filter-apply:hover {
    opacity: 0.8;
}

#filter-results-count {
    font-size: 12px;
    color: var(--text-dim);
    margin-bottom: 10px;
}

#filter-results {
    max-height: 40vh;
    overflow-y: auto;
}

/* Path Finding modal */
.pathfind-content {
    max-width: 500px;
}

.pathfind-selectors {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    margin-bottom: 20px;
}

.pathfind-field {
    flex: 1;
    position: relative;
}

.pathfind-field label {
    display: block;
    font-size: 11px;
    color: var(--text-dim);
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.pathfind-field input {
    width: 100%;
}

.pathfind-arrow {
    font-size: 24px;
    color: var(--accent);
    padding-top: 25px;
}

.pathfind-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--panel-bg);
    border: 1px solid var(--border-dim);
    max-height: 150px;
    overflow-y: auto;
    z-index: 10;
    display: none;
}

.pathfind-results.visible {
    display: block;
}

.pathfind-results .result-item {
    padding: 8px 10px;
    font-size: 12px;
}

.pathfind-selected {
    margin-top: 8px;
    padding: 8px 12px;
    background: rgba(100, 150, 255, 0.15);
    border-radius: 4px;
    font-size: 13px;
    color: var(--text-primary);
    display: none;
}

.pathfind-selected.visible {
    display: block;
}

#pathfind-go {
    width: 100%;
    padding: 12px;
    background: transparent;
    border: 1px solid var(--accent);
    color: var(--accent);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

#pathfind-go:hover:not(:disabled) {
    background: var(--accent);
    color: var(--bg-dark);
}

#pathfind-go:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

#pathfind-result {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid var(--border-dim);
}

#pathfind-result.hidden {
    display: none;
}

.pathfind-path {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 15px;
}

.pathfind-path-node {
    padding: 6px 12px;
    background: rgba(100, 150, 255, 0.2);
    border-radius: 15px;
    font-size: 12px;
    color: var(--text-primary);
    cursor: pointer;
    transition: background 0.2s;
}

.pathfind-path-node:hover {
    background: rgba(100, 150, 255, 0.4);
}

.pathfind-path-arrow {
    color: var(--text-dim);
    font-size: 14px;
}

.pathfind-start-btn {
    width: 100%;
    padding: 10px;
    background: var(--accent);
    border: none;
    color: var(--bg-dark);
    font-size: 13px;
    cursor: pointer;
    transition: opacity 0.2s;
}

.pathfind-start-btn:hover {
    opacity: 0.8;
}

.pathfind-no-path {
    color: var(--text-dim);
    font-style: italic;
    text-align: center;
    padding: 20px;
}

/* Help button */
#help-btn {
    position: absolute;
    bottom: 10px;
    left: 10px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 1px solid var(--border-dim);
    font-size: 14px;
    z-index: 50;
}

/* Help modal content */
.help-content {
    max-width: 450px;
}

.help-content h4 {
    font-size: 12px;
    font-weight: 500;
    color: var(--accent);
    margin-top: 20px;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.help-content p {
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-dim);
    margin-bottom: 10px;
}

.help-content ul {
    list-style: none;
    font-size: 13px;
    color: var(--text-dim);
}

.help-content li {
    margin-bottom: 6px;
    padding-left: 15px;
    position: relative;
}

.help-content li::before {
    content: '›';
    position: absolute;
    left: 0;
    color: var(--accent-dim);
}

.help-content kbd {
    background: rgba(100, 150, 255, 0.15);
    padding: 2px 8px;
    border-radius: 3px;
    font-family: monospace;
    font-size: 12px;
    color: var(--text-primary);
}

/* Share modal */
.share-content {
    max-width: 500px;
}

#share-stats {
    font-size: 13px;
    color: var(--text-dim);
    margin-bottom: 20px;
    padding: 10px;
    background: rgba(100, 150, 255, 0.1);
    border-radius: 4px;
}

.share-section {
    margin-bottom: 20px;
}

.share-section label {
    display: block;
    font-size: 12px;
    color: var(--accent);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.share-input-row {
    display: flex;
    gap: 8px;
}

.share-input-row input {
    flex: 1;
    padding: 10px;
    background: rgba(20, 30, 50, 0.8);
    border: 1px solid var(--border-dim);
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 12px;
    font-family: monospace;
}

.share-input-row button,
.share-section > button {
    padding: 10px 15px;
    background: rgba(100, 150, 255, 0.2);
    border: 1px solid var(--accent-dim);
    border-radius: 4px;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
}

.share-input-row button:hover,
.share-section > button:hover {
    background: rgba(100, 150, 255, 0.4);
    border-color: var(--accent);
}

#share-text {
    width: 100%;
    padding: 12px;
    background: rgba(20, 30, 50, 0.8);
    border: 1px solid var(--border-dim);
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 12px;
    font-family: inherit;
    line-height: 1.5;
    resize: vertical;
    margin-bottom: 10px;
}

#share-copy-text {
    width: 100%;
}

.share-actions {
    margin-top: 25px;
    padding-top: 15px;
    border-top: 1px solid var(--border-dim);
}

.share-action-btn {
    width: 100%;
    padding: 12px 20px;
    font-size: 14px;
    background: rgba(100, 200, 150, 0.15);
    border: 1px solid rgba(100, 200, 150, 0.4);
    color: rgba(100, 200, 150, 1);
    transition: all 0.2s;
}

.share-action-btn:hover {
    background: rgba(100, 200, 150, 0.3);
    border-color: rgba(100, 200, 150, 0.8);
}

/* Responsive - medium screens */
@media (max-width: 1100px) {
    #top-search-bar {
        left: 10px;
        right: 380px; /* Still leave room for bio */
    }

    #right-controls {
        right: 380px;
        padding: 4px 6px;
        gap: 2px;
    }
}

/* Responsive - small screens */
@media (max-width: 768px) {
    #top-search-bar {
        left: 10px;
        right: 10px;
        padding: 6px 10px;
        flex-wrap: wrap;
        gap: 8px;
    }

    #top-search-input {
        width: 100%;
        font-size: 16px; /* Prevent iOS zoom */
    }

    #top-search-filters {
        width: 100%;
        justify-content: space-between;
    }

    #top-search-filters select {
        flex: 1;
        min-width: 0;
        font-size: 11px;
        padding: 6px 4px;
    }

    #top-search-results {
        max-height: 50vh;
    }

    #top-search-bar::after {
        display: none; /* Hide keyboard hint on mobile */
    }

    #journey-panel {
        width: 160px;
        max-height: 25vh;
        top: 90px; /* Below the globe */
        left: 10px;
        border-radius: 8px;
    }

    #journey-accordion summary {
        font-size: 12px;
    }

    #bio-panel {
        position: fixed;
        top: auto;
        bottom: 55px;
        left: 0;
        right: 0;
        width: auto;
        max-height: 30vh;
        padding: 10px;
        z-index: 20;
        border-radius: 8px 8px 0 0;
    }

    #bio-header {
        gap: 10px;
    }

    #bio-portrait-wrapper {
        width: 50px;
        height: 65px;
    }

    #bio-name {
        font-size: 14px;
    }

    /* Bio content has no max-height - single scrollbar on panel */

    /* Hide inline settings on mobile - use gear button + bottom sheet instead */
    #top-controls {
        display: none !important;
    }

    /* Show gear button only on mobile */
    #mobile-settings-btn {
        display: inline-flex !important;
    }

    /* Settings bottom sheet on mobile */
    #settings-accordion.mobile-sheet {
        position: fixed;
        bottom: 60px;
        left: 0;
        right: 0;
        z-index: 200;
        background: rgba(10, 15, 25, 0.97);
        border: none;
        border-top: 1px solid rgba(100, 150, 255, 0.3);
        border-radius: 12px 12px 0 0;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.5);
        max-height: 50vh;
        overflow-y: auto;
    }

    #settings-backdrop {
        position: fixed;
        inset: 0;
        z-index: 199;
        background: rgba(0, 0, 0, 0.4);
    }

    #settings-accordion.mobile-sheet summary {
        display: none;
    }

    #settings-accordion.mobile-sheet #settings-accordion-content {
        display: flex;
        flex-direction: column;
        gap: 12px;
        padding: 16px 20px;
    }

    #settings-accordion.mobile-sheet .settings-group {
        justify-content: space-between;
    }

    #settings-accordion.mobile-sheet .settings-group .option-label {
        font-size: 13px;
        color: rgba(200, 210, 230, 0.9);
    }

    #right-controls {
        top: auto;
        bottom: 80px;
        right: 10px;
        transform: none;
    }

    #bio-connections {
        display: none;
    }

    #bio-footer {
        display: none;
    }

    #miniweb-container {
        bottom: 70px;
    }

    #timebar-container {
        width: 95%;
        bottom: 0;
        border-radius: 8px 8px 0 0;
    }

    #globe-container {
        width: 60px;
        height: 60px;
        top: 10px;
        left: 10px;
        border-radius: 8px;
    }

    .icon-btn {
        font-size: 16px;
        padding: 6px;
    }

    #current-node-info {
        bottom: 80px;
        max-width: 90vw;
        padding: 10px 15px;
    }

    #current-node-name {
        font-size: 14px;
    }

    #current-node-oneliner {
        font-size: 11px;
        max-width: 80vw;
    }

    #current-node-meta {
        font-size: 9px;
    }

    #help-btn {
        bottom: 10px;
        left: 10px;
    }

    .modal-content {
        width: 95%;
        max-height: 80vh;
        padding: 15px;
    }

    #startup-title {
        font-size: 24px;
        letter-spacing: 4px;
    }
}

@media (max-width: 480px) {
    #journey-panel {
        display: none;
    }

    #globe-container {
        display: none;
    }

    #sphere-controls {
        bottom: 70px;
        width: 90%;
    }

    #sphere-buttons {
        flex-wrap: wrap;
        gap: 8px;
    }

    .sphere-btn {
        padding: 6px 12px;
        font-size: 11px;
    }

    #sphere-century-slider {
        width: 100%;
    }

    #sphere-hint {
        font-size: 9px;
    }

    #timebar-labels span {
        font-size: 9px;
        padding: 1px 3px;
    }

    #miniweb-container {
        bottom: 60px;
    }

    .icon-btn {
        font-size: 14px;
        padding: 5px;
    }

    #current-node-themes {
        display: none;
    }
}

/* ========== Mobile Carousel Layout ========== */

#mobile-view-nav {
    display: none;
}

@media (max-width: 768px) {
    /* Mobile nav bar - above timeline */
    #mobile-view-nav {
        display: flex;
        position: fixed;
        bottom: 48px;
        left: 0;
        right: 0;
        z-index: 55;
        justify-content: center;
        gap: 2px;
        padding: 4px 10px;
        background: var(--panel-bg-strong);
        backdrop-filter: blur(10px);
        border-top: 1px solid var(--border-dim);
    }

    .mobile-view-tab {
        flex: 1;
        max-width: 110px;
        padding: 7px 10px;
        background: transparent;
        border: 1px solid transparent;
        color: var(--text-dim);
        font-size: 11px;
        font-family: inherit;
        border-radius: 4px;
        cursor: pointer;
        text-align: center;
        transition: all 0.2s;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 4px;
    }

    .mobile-view-tab.active {
        background: var(--btn-bg);
        color: var(--text-bright);
        border-color: var(--accent-dim);
    }

    .mvt-icon {
        font-size: 14px;
    }

    .mvt-label {
        font-size: 11px;
    }

    /* Dot indicators */
    #mobile-view-nav::after {
        content: '';
        position: absolute;
        bottom: -2px;
        left: 50%;
        transform: translateX(-50%);
        width: 40px;
        height: 2px;
        background: var(--accent-dim);
        border-radius: 1px;
    }

    /* ---- Adjust spacing when mobile nav is present ---- */

    body[data-mobile-view] #miniweb-container {
        bottom: 40px;
    }

    body[data-mobile-view] #current-node-info {
        bottom: 50px;
    }

    body[data-mobile-view] #right-controls {
        bottom: 50px;
    }

    /* ---- Graph view (default) ---- */
    body[data-mobile-view="graph"] #miniweb-container {
        display: block !important;
    }

    body[data-mobile-view="graph"] #bio-panel {
        display: none !important;
    }

    body[data-mobile-view="graph"] #sphere-container {
        display: none !important;
    }

    /* ---- Sphere / 3D view ---- */
    body[data-mobile-view="sphere"] #miniweb-container {
        display: none !important;
    }

    body[data-mobile-view="sphere"] #bio-panel {
        display: none !important;
    }

    body[data-mobile-view="sphere"] #right-controls {
        display: none !important;
    }


    body[data-mobile-view="sphere"] #top-controls {
        display: none !important;
    }

    body[data-mobile-view="sphere"] #current-node-info {
        display: none !important;
    }

    body[data-mobile-view="sphere"] #globe-container {
        display: none !important;
    }

    body[data-mobile-view="sphere"] #journey-panel {
        display: none !important;
    }

    body[data-mobile-view="sphere"] #hidden-nodes-indicator {
        display: none !important;
    }

    /* Override hidden class when sphere tab is active */
    body[data-mobile-view="sphere"] #sphere-container.hidden {
        display: block !important;
    }

    body[data-mobile-view="sphere"] #sphere-container {
        display: block !important;
        position: fixed !important;
        top: 0;
        left: 0;
        right: 0;
        bottom: 40px;
        width: auto !important;
        height: auto !important;
    }

    body[data-mobile-view="sphere"] #sphere-controls {
        bottom: 10px;
        width: 95%;
    }

    /* ---- Bio view ---- */
    body[data-mobile-view="bio"] #miniweb-container {
        display: none !important;
    }

    body[data-mobile-view="bio"] #sphere-container {
        display: none !important;
    }

    body[data-mobile-view="bio"] #right-controls {
        display: none !important;
    }

    body[data-mobile-view="bio"] #top-controls {
        display: none !important;
    }

    body[data-mobile-view="bio"] #current-node-info {
        display: none !important;
    }

    body[data-mobile-view="bio"] #globe-container {
        display: none !important;
    }

    body[data-mobile-view="bio"] #journey-panel {
        display: none !important;
    }

    body[data-mobile-view="bio"] #hidden-nodes-indicator {
        display: none !important;
    }

    body[data-mobile-view="bio"] #bio-panel {
        display: block !important;
        position: fixed !important;
        top: 55px;
        left: 0;
        right: 0;
        bottom: 40px;
        width: auto !important;
        max-height: none !important;
        padding: 15px;
        padding-bottom: 20px;
        z-index: 20;
        border-radius: 0;
        opacity: 1 !important;
        overflow-y: auto;
    }

    /* Show full bio content in bio view */
    body[data-mobile-view="bio"] #bio-connections {
        display: block !important;
    }

    body[data-mobile-view="bio"] #bio-footer {
        display: block !important;
    }

    body[data-mobile-view="bio"] #bio-content {
        max-height: none;
    }

    /* Empty bio state */
    body[data-mobile-view="bio"] #bio-panel.hidden {
        display: flex !important;
        align-items: center;
        justify-content: center;
        opacity: 0.5 !important;
    }

    body[data-mobile-view="bio"] #bio-panel.hidden::after {
        content: 'Select a node to see biography';
        color: var(--text-dim);
        font-size: 14px;
    }
}

/* Image Lightbox */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox.hidden {
    display: none;
}

.lightbox-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    cursor: pointer;
}

.lightbox-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    z-index: 1;
}

#lightbox-image {
    max-width: 90vw;
    max-height: 85vh;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 0 40px rgba(100, 150, 255, 0.3);
}

#lightbox-close {
    position: absolute;
    top: -40px;
    right: 0;
    background: transparent;
    border: none;
    color: var(--text-dim);
    font-size: 32px;
    cursor: pointer;
    padding: 5px 10px;
    transition: color 0.2s;
}

#lightbox-close:hover {
    color: var(--text-bright);
}

#bio-portrait-wrapper {
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

#bio-portrait-wrapper:hover {
    transform: scale(1.05);
    box-shadow: 0 0 15px rgba(100, 150, 255, 0.4);
}

/* Changelog modal */
.changelog-item {
    padding: 10px 0;
    border-bottom: 1px solid var(--border-dim);
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.changelog-item.new {
    background: rgba(100, 200, 100, 0.1);
    margin: 0 -15px;
    padding: 10px 15px;
}

.changelog-date {
    color: var(--text-dim);
    font-size: 12px;
    min-width: 80px;
}

.changelog-text {
    color: var(--text-primary);
    flex: 1;
}

.new-badge {
    background: rgba(100, 200, 100, 0.8);
    color: #000;
    font-size: 9px;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 3px;
}

/* ---- Narration overlay ---- */
#narration-overlay {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 99999;
    pointer-events: none;
    transition: opacity 0.4s;
}
#narration-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

#narration-subtitle {
    text-align: center;
    padding: 16px 40px;
    font-size: 22px;
    font-weight: 400;
    letter-spacing: 0.02em;
    line-height: 1.5;
    color: rgba(220, 225, 240, 0.95);
    text-shadow:
        0 0 8px rgba(0,0,0,1),
        0 0 20px rgba(0,0,0,1),
        0 2px 10px rgba(0,0,0,0.9),
        0 0 40px rgba(0,0,0,0.7);
    background: radial-gradient(ellipse at center, rgba(0,0,0,0.6) 0%, rgba(0,0,0,0.3) 60%, transparent 100%);
    max-width: 800px;
    margin: 0 auto 8px;
    font-family: 'Georgia', serif;
}

/* ---- Narration active: hide distracting UI ---- */
body.narration-active #mobile-hint,
body.narration-active #mobile-view-nav,
body.narration-active #f3d-debug,
body.narration-active #top-search-bar {
    display: none !important;
}

/* Narration mode: compact info pill (top-left) instead of full card */
body.narration-active #force3d-info.visible {
    bottom: auto !important;
    top: 12px !important;
    left: 12px !important;
    right: auto !important;
    transform: none !important;
    padding: 8px 14px !important;
    border-radius: 24px !important;
    max-width: 260px !important;
    min-width: 0 !important;
    max-height: 56px !important;
    overflow: hidden !important;
    opacity: 0.85 !important;
}
body.narration-active #f3d-info-oneliner,
body.narration-active #f3d-info-connections,
body.narration-active #f3d-info-explore,
body.narration-active #f3d-info-back {
    display: none !important;
}
body.narration-active #f3d-info-header {
    margin-bottom: 0 !important;
    gap: 10px !important;
}
body.narration-active #f3d-info-portrait {
    width: 36px !important;
    height: 36px !important;
    min-width: 36px !important;
    min-height: 36px !important;
}
body.narration-active #f3d-info-name {
    font-size: 13px !important;
}
body.narration-active #f3d-info-dates {
    font-size: 10px !important;
}
body.narration-active #f3d-info-category {
    display: none !important;
}

/* Mobile narration: smaller subtitles, more graph space */
@media (max-width: 768px) {
    body.narration-active #narration-subtitle {
        font-size: 16px;
        padding: 10px 20px;
        line-height: 1.4;
        max-height: 80px;
        overflow: hidden;
    }
    body.narration-active #narration-controls {
        padding: 6px 12px;
    }
}
#narration-subtitle .word-current {
    color: #fff;
    text-shadow: 0 0 12px rgba(100, 160, 255, 0.8), 0 0 30px rgba(80, 130, 255, 0.4);
    transition: color 0.1s, text-shadow 0.1s;
}
#narration-subtitle .word-past {
    color: rgba(180, 195, 220, 0.85);
}
#narration-subtitle .word-future {
    color: rgba(140, 155, 180, 0.55);
}

#narration-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    background: rgba(8, 12, 24, 0.75);
    backdrop-filter: blur(12px);
    border-top: 1px solid rgba(80, 120, 200, 0.15);
    pointer-events: auto;
}
#narration-controls button {
    background: none;
    border: none;
    color: rgba(180, 200, 240, 0.8);
    cursor: pointer;
    padding: 6px;
    border-radius: 4px;
    transition: color 0.2s, background 0.2s;
}
#narration-controls button:hover {
    color: #fff;
    background: rgba(80, 120, 200, 0.2);
}
#narration-close {
    font-size: 22px;
    line-height: 1;
    margin-left: auto;
}
#narration-progress-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
}
#narration-progress-bar {
    flex: 1;
    height: 4px;
    background: rgba(60, 80, 120, 0.4);
    border-radius: 2px;
    cursor: pointer;
    position: relative;
}
#narration-progress-fill {
    height: 100%;
    background: rgba(100, 160, 255, 0.7);
    border-radius: 2px;
    width: 0%;
    transition: width 0.1s linear;
}
#narration-time {
    font-size: 12px;
    color: rgba(140, 160, 200, 0.6);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

/* Episode selector in 3D view */
#episode-selector {
    position: fixed;
    bottom: 50px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 210;
    display: none;
    align-items: center;
    gap: 0;
    background: rgba(10, 15, 30, 0.6);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(100, 160, 255, 0.25);
    border-radius: 20px;
    overflow: hidden;
}
#episode-play-btn {
    background: none;
    border: none;
    border-right: 1px solid rgba(100, 160, 255, 0.2);
    color: rgba(180, 200, 240, 0.85);
    padding: 8px 16px;
    cursor: pointer;
    font-size: 13px;
    font-family: inherit;
    letter-spacing: 0.05em;
    transition: all 0.3s;
    white-space: nowrap;
}
#episode-play-btn:hover {
    background: rgba(20, 30, 60, 0.75);
    color: #fff;
}
#episode-select {
    background: none;
    border: none;
    color: rgba(150, 175, 220, 0.75);
    padding: 8px 12px;
    font-size: 12px;
    font-family: inherit;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    max-width: 260px;
}
#episode-select:hover {
    color: #fff;
}
#episode-select option {
    background: #0a0f1e;
    color: #ccd;
}
body.force3d-active #episode-selector {
    display: flex;
}
body.force3d-active #episode-selector.narration-active {
    display: none;
}

/* ========== Mobile Hamburger Menu ========== */

#mobile-hamburger {
    display: none;
}

#mobile-menu-panel {
    display: none;
}

@media (max-width: 768px) {
    /* Hide old tab bar */
    #mobile-view-nav {
        display: none !important;
    }

    #mobile-hamburger {
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 4px;
        position: fixed;
        top: 14px;
        left: 10px;
        z-index: 200;
        width: 36px;
        height: 36px;
        background: rgba(10, 15, 25, 0.7);
        border: 1px solid rgba(100, 150, 255, 0.15);
        border-radius: 6px;
        cursor: pointer;
        padding: 0;
        backdrop-filter: blur(8px);
        transition: background 0.2s;
    }

    #mobile-hamburger:active {
        background: rgba(20, 30, 50, 0.8);
    }

    #mobile-hamburger span {
        display: block;
        width: 18px;
        height: 2px;
        background: rgba(180, 200, 240, 0.85);
        border-radius: 1px;
        transition: transform 0.2s, opacity 0.2s;
    }

    #mobile-hamburger.open span:nth-child(1) {
        transform: translateY(6px) rotate(45deg);
    }
    #mobile-hamburger.open span:nth-child(2) {
        opacity: 0;
    }
    #mobile-hamburger.open span:nth-child(3) {
        transform: translateY(-6px) rotate(-45deg);
    }

    #mobile-menu-panel {
        display: none;
        position: fixed;
        top: 56px;
        left: 10px;
        z-index: 199;
        background: rgba(10, 15, 25, 0.85);
        border: 1px solid rgba(100, 150, 255, 0.15);
        border-radius: 8px;
        padding: 10px 12px;
        min-width: 140px;
        backdrop-filter: blur(12px);
    }

    #mobile-menu-panel.open {
        display: block;
    }

    .mmp-section {
        margin-bottom: 8px;
    }
    .mmp-section:last-child {
        margin-bottom: 0;
    }

    .mmp-label {
        font-size: 10px;
        text-transform: uppercase;
        letter-spacing: 0.08em;
        color: rgba(100, 150, 255, 0.6);
        margin-bottom: 4px;
    }

    .mmp-view-btn {
        display: block;
        width: 100%;
        padding: 6px 10px;
        background: transparent;
        border: 1px solid transparent;
        border-radius: 4px;
        color: rgba(180, 200, 240, 0.85);
        font-size: 13px;
        font-family: inherit;
        text-align: left;
        cursor: pointer;
        transition: all 0.15s;
    }

    .mmp-view-btn:active,
    .mmp-view-btn.active {
        background: rgba(100, 150, 255, 0.12);
        border-color: rgba(100, 150, 255, 0.25);
        color: #fff;
    }

    .mmp-action-btn {
        display: block;
        width: 100%;
        padding: 6px 10px;
        background: transparent;
        border: 1px solid transparent;
        border-radius: 4px;
        color: rgba(180, 200, 240, 0.85);
        font-size: 13px;
        font-family: inherit;
        text-align: left;
        cursor: pointer;
    }
    .mmp-action-btn:active {
        background: rgba(100, 150, 255, 0.12);
    }

    .mmp-toggle {
        display: flex;
        align-items: center;
        gap: 8px;
        font-size: 12px;
        color: rgba(180, 200, 240, 0.85);
        cursor: pointer;
        padding: 4px 0;
    }

    .mmp-toggle input[type="checkbox"] {
        accent-color: rgba(100, 150, 255, 0.8);
    }

    .mmp-slider-row {
        display: flex;
        align-items: center;
        gap: 8px;
        font-size: 12px;
        color: rgba(180, 200, 240, 0.85);
        padding: 3px 0;
    }
    .mmp-slider-row span {
        min-width: 36px;
    }
    .mmp-slider-row input[type="range"] {
        flex: 1;
        height: 3px;
        accent-color: rgba(100, 150, 255, 0.8);
    }
}

/* ========== Virtual Thumbsticks ========== */

.f3d-thumbstick {
    display: none;
    position: fixed;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(8, 12, 20, 0.4);
    border: 1px solid rgba(100, 150, 255, 0.15);
    z-index: 150;
    touch-action: none;
    pointer-events: auto;
}

.f3d-thumbstick-knob {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(100, 150, 255, 0.25);
    border: 1px solid rgba(100, 150, 255, 0.35);
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.f3d-thumbstick-left {
    left: 25%;
    bottom: 120px;
    transform: translateX(-50%);
}

.f3d-thumbstick-right {
    right: 25%;
    bottom: 120px;
    transform: translateX(50%);
}

body.force3d-active .f3d-thumbstick {
    display: block;
}

/* Hide during narration — subtitles + controls take that space */
body.narration-active .f3d-thumbstick {
    display: none !important;
}

/* Only show on touch devices — JS adds the elements only on touch devices anyway,
   but hide on desktop just in case resize triggers */
@media (hover: hover) and (pointer: fine) {
    .f3d-thumbstick {
        display: none !important;
    }
}

/* On touch devices, move info box to top so thumbsticks stay usable */
@media (hover: none), (pointer: coarse) {
    #force3d-info {
        bottom: auto;
        top: 20px;
        transform: translateX(-50%) translateY(-20px);
        max-width: min(90vw, 360px);
        padding: 14px 18px;
    }
    #force3d-info.visible {
        transform: translateX(-50%) translateY(0);
    }
}

