body {
    background-color: #000;
    margin: 0px;
    overflow: hidden;

    color: #fff;
    font-family: Monospace;
    font-size: 13px;
    font-weight: bold;
}

.info {
    text-align: center;

    position: absolute;
    padding: 10px;
    width: 100%;
    text-align: center;
    color: #ffffff;
}

.link-bar {
    position: absolute;
    bottom: 10px;
    width: 100%;
    text-align: center;
}

#loader {
    margin-top: 20%;
}

.disclaimer {
    margin-top: 1em;
    color: gray;
}

#hint-text {
    position: absolute;
    /*right: 270px;*/
    width: 100%;
    top: 10px;
    text-align: center;
    font-weight: normal;
    color: #cccccc;
}

a {
    color: white;
    text-decoration: none;
}

a:hover {
    color: #cccccc;
}

.initially-hidden {
    visibility: hidden;
}

@media screen and (max-width: 800px) {
    .hidden-phone {
        visibility: hidden;
    }

}

/* dat.GUI: hide built-in close button (we wrap in our own panel) */
.dg.main .close-button { display: none !important; }

@media screen and (max-width: 960px) {
    #hint-text {
        top: 6px;
        padding: 0 8px;
        font-size: 11px;
        box-sizing: border-box;
    }
    .link-bar {
        bottom: 6px;
        font-size: 11px;
        line-height: 1.45;
        padding: 0 8px;
        box-sizing: border-box;
    }
    .dg .cr.number input[type=text] {
        font-size: 16px;
    }

    /* ── Side panels — mobile ── */
    .sp-panel {
        width: min(88vw, 400px) !important;
        min-width: 0 !important;
    }
    .sp-resize { display: none; }

    /* Close button inside panel — larger tap target */
    .sp-close {
        width: 36px;
        height: 36px;
        font-size: 20px;
        border-radius: 6px;
    }

    /* ── Side open buttons — mobile redesign ── */
    .sp-open-btn {
        top: auto !important;
        /* Clear the link-bar (≈40px) plus safe-area for iPhones */
        bottom: calc(env(safe-area-inset-bottom, 0px) + 52px) !important;
        height: 40px !important;
        min-height: unset !important;
        line-height: 40px !important;
        padding: 0 16px !important;
        font-size: 11px !important;
        letter-spacing: 0.8px !important;
        font-weight: 700 !important;
        border-radius: 20px !important;
        border: 1px solid #3e6090 !important;
        background: rgba(10, 18, 38, 0.93) !important;
        box-shadow: 0 3px 14px rgba(0, 0, 0, 0.6) !important;
        transform: none !important;
        -webkit-tap-highlight-color: transparent;
        white-space: nowrap;
    }
    .sp-open-btn:active {
        background: rgba(20, 38, 74, 0.98) !important;
        border-color: #5a86bc !important;
        color: #d0eaff !important;
    }
    .sp-open-btn--left {
        left: 10px !important;
        right: auto !important;
    }
    .sp-open-btn--right {
        right: 10px !important;
        left: auto !important;
    }

    /* ── Timeline: hidden on mobile ── */
    #tl-open-btn { display: none !important; }
    .tl-panel    { display: none !important; }

    /* Undo has-timeline-panel shifts that are desktop-only */
    body.has-timeline-panel .sp-panel   { bottom: 0; }
    body.has-timeline-panel .link-bar   { bottom: 6px; }
    body.has-timeline-panel #axes-gizmo-container { bottom: auto !important; }

    #axes-gizmo-container {
        left: auto !important;
        right: 8px !important;
        top: 8px !important;
        bottom: auto !important;
        transform: scale(0.9) !important;
        transform-origin: right top !important;
        z-index: 145 !important;
        pointer-events: auto !important;
    }
    #observer-orbit-shell {
        pointer-events: auto !important;
    }
}

@media screen and (max-width: 520px) {
    #axes-gizmo-container {
        right: 4px !important;
        top: 4px !important;
        transform: scale(0.84) !important;
    }

    /* Extra-small screens: compact side buttons */
    .sp-open-btn {
        padding: 0 12px !important;
        font-size: 10px !important;
        height: 36px !important;
        line-height: 36px !important;
        bottom: calc(env(safe-area-inset-bottom, 0px) + 46px) !important;
        letter-spacing: 0.4px !important;
    }
    .sp-open-btn--left  { left: 6px !important; }
    .sp-open-btn--right { right: 6px !important; }

    /* Panels take nearly full width on small phones */
    .sp-panel { width: min(93vw, 400px) !important; }

    /* Smaller panel header on tiny screens */
    .sp-title { font-size: 10px; letter-spacing: 1.5px; }
}

/* ═══════════════════════════════════════════════════════════════════════════ */
/* Side Panels — shared styles for Controls (right) and Animations (left)   */
/* ═══════════════════════════════════════════════════════════════════════════ */

.sp-panel {
    position: fixed;
    top: 0;
    bottom: 0;
    z-index: 150;
    display: flex;
    flex-direction: column;
    background: rgba(8, 10, 18, 0.97);
    font-family: 'Lucida Grande', 'Segoe UI', sans-serif;
    font-size: 11px;
    color: #ccc;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 0 24px rgba(0,0,0,0.5);
    transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.18s ease,
                bottom  0.22s ease;
    box-sizing: border-box;
}
.sp-panel--left  { left: 0; border-right: 2px solid #1e3054; }
.sp-panel--right { right: 0; border-left:  2px solid #1e3054; }

.sp-panel--left.sp-panel--collapsed {
    transform: translateX(-100%);
    opacity: 0;
    pointer-events: none;
}
.sp-panel--right.sp-panel--collapsed {
    transform: translateX(100%);
    opacity: 0;
    pointer-events: none;
}

/* ── Header ── */
.sp-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-bottom: 1px solid #16283f;
    background: rgba(12, 18, 32, 0.95);
    flex-shrink: 0;
}
.sp-title {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 2px;
    color: #8ab0d8;
    text-transform: uppercase;
}
.sp-close {
    width: 26px;
    height: 26px;
    border: 1px solid #2a4468;
    border-radius: 4px;
    background: linear-gradient(180deg, #14263e 0%, #0e1d31 100%);
    color: #c0d6f0;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    transition: background 0.12s, border-color 0.12s;
}
.sp-close:hover {
    background: linear-gradient(180deg, #1e3a5c 0%, #162e4c 100%);
    border-color: #3e6a9e;
    color: #e2eeff;
}

/* ── Scrollable content area ── */
.sp-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
}

/* ── Resize handles ── */
.sp-resize {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 12px;
    cursor: ew-resize;
    z-index: 3;
    touch-action: none;
}
.sp-resize--left  { left: -6px; }
.sp-resize--right { right: -6px; }
.sp-resize::before {
    content: '';
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 48px;
    border-radius: 2px;
    background: rgba(120, 165, 230, 0.35);
    transition: background 0.14s ease;
}
.sp-resize--left::before  { left: 5px; }
.sp-resize--right::before { right: 5px; }
.sp-panel:hover .sp-resize::before,
.sp-resize:hover::before {
    background: rgba(140, 185, 255, 0.75);
}
body.sp-resizing, body.sp-resizing * {
    cursor: ew-resize !important;
    user-select: none !important;
}

/* ── Open buttons (edge tabs) ── */
.sp-open-btn {
    position: fixed;
    top: 50%;
    z-index: 130;
    border: 1px solid #2e5080;
    background: rgba(14, 24, 44, 0.92);
    color: #80b4e8;
    font-family: 'Lucida Grande', 'Segoe UI', sans-serif;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.2px;
    padding: 8px 14px;
    cursor: pointer;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: 0 2px 12px rgba(0,0,0,0.5);
    transition: background 0.14s, border-color 0.14s, color 0.14s,
                opacity 0.22s ease, transform 0.22s ease;
    text-transform: uppercase;
}
.sp-open-btn:hover {
    background: rgba(24, 44, 78, 0.95);
    border-color: #4a80c0;
    color: #b8dcff;
}
.sp-open-btn--left {
    left: 0;
    transform: translateY(-50%);
    border-radius: 0 6px 6px 0;
    border-left: none;
}
.sp-open-btn--right {
    right: 0;
    transform: translateY(-50%);
    border-radius: 6px 0 0 6px;
    border-right: none;
}
.sp-open-btn--hidden {
    opacity: 0;
    pointer-events: none;
}

/* ── Controls Panel (right) ── */
#controls-panel {
    width: 370px;
    min-width: 300px;
    max-width: 600px;
}
#controls-panel .sp-content {
    overflow-x: auto;
}
#controls-panel .dg.ac {
    position: static !important;
    right: auto !important;
    top: auto !important;
    z-index: auto !important;
    width: auto !important;
}
#controls-panel .dg.main {
    position: static !important;
    float: none !important;
    width: 100% !important;
    max-height: none !important;
    overflow: visible !important;
    z-index: auto !important;
    margin-right: 0 !important;
    box-sizing: border-box !important;
}
#controls-panel .dg.main > ul {
    max-height: none !important;
    overflow-y: visible !important;
}

/* ── Animations Panel (left) ── */
#anim-panel {
    width: 380px;
    min-width: 300px;
    max-width: 600px;
}
#anim-panel .sp-content {
    padding: 6px 16px 10px;
}

/* Side panels shrink above timeline when it's open */
body.has-timeline-panel .sp-panel {
    bottom: var(--tl-h, 330px);
}

/* Collapsible sections inside the animations panel */
.anim-section {
    border-top: 1px solid #1e2030;
    margin: 0 -2px;
    padding: 0 2px;
}

.anim-section-toggle {
    width: 100%;
    background: none;
    border: none;
    color: #9aa0b8;
    font-family: 'Lucida Grande', 'Segoe UI', sans-serif;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.8px;
    text-transform: uppercase;
    cursor: pointer;
    padding: 10px 0;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 6px;
    outline: none;
}

.anim-section-toggle:hover {
    color: #eeeeff;
}

.anim-section-arrow {
    display: inline-block;
    font-size: 8px;
    transition: transform 0.18s;
    color: #556;
    flex-shrink: 0;
}

.anim-section.is-open > .anim-section-toggle .anim-section-arrow {
    transform: rotate(90deg);
    color: #7799bb;
}

.anim-section-body {
    display: none;
    padding-bottom: 6px;
}

.anim-section.is-open > .anim-section-body {
    display: block;
}

.dive-desc {
    font-size: 10px;
    color: #888;
    line-height: 1.4;
    margin-bottom: 12px;
}

.dive-btn {
    display: block;
    width: 100%;
    padding: 8px 0;
    border: none;
    border-radius: 4px;
    font-family: inherit;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1px;
    cursor: pointer;
    transition: background 0.18s, box-shadow 0.18s, opacity 0.18s;
    outline: none;
}

.dive-btn:disabled {
    opacity: 0.35;
    cursor: default;
}

.dive-btn-start {
    background: linear-gradient(135deg, #1a6bff 0%, #0044cc 100%);
    color: #fff;
    margin-bottom: 12px;
    box-shadow: 0 2px 8px rgba(26, 107, 255, 0.25);
}

.dive-btn-start:hover:not(:disabled) {
    background: linear-gradient(135deg, #3380ff 0%, #0055ee 100%);
    box-shadow: 0 2px 14px rgba(26, 107, 255, 0.4);
}

.dive-btn-reset {
    background: #2a2a34;
    color: #aaa;
    margin-top: 10px;
}

.dive-btn-reset:hover:not(:disabled) {
    background: #3a3a48;
    color: #ddd;
}

.dive-control-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 10px;
}

.dive-control-row label {
    font-size: 10px;
    color: #999;
    white-space: nowrap;
    min-width: 56px;
}

.dive-control-row input[type="range"] {
    flex: 1;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: #333;
    border-radius: 2px;
    outline: none;
}

.dive-control-row input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #5599ff;
    cursor: pointer;
}

#dive-speed-val {
    font-size: 10px;
    color: #8ab4f8;
    min-width: 28px;
    text-align: right;
}

.dive-cinematic-row {
    margin-top: -4px;
    align-items: flex-start;
}

.dive-cinematic-row label {
    padding-top: 1px;
}

.dive-cinematic-row input[type="checkbox"] {
    margin: 0;
    accent-color: #5599ff;
    cursor: pointer;
    flex-shrink: 0;
}

.dive-cinematic-hint {
    font-size: 9px;
    color: #666;
    line-height: 1.3;
}

/* Horizon proximity bar */
.dive-horizon-track {
    position: relative;
    height: 6px;
    background: #1a1a22;
    border-radius: 3px;
    margin-bottom: 8px;
    overflow: hidden;
    border: 1px solid #2a2a34;
    cursor: pointer;
}

.dive-horizon-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.12s ease-out, background 0.4s;
    width: 0%;
}

.dive-horizon-fill.outside {
    background: linear-gradient(90deg, #1a6bff, #4499ff);
}

.dive-horizon-fill.inside {
    background: linear-gradient(90deg, #ff4444, #ff8800, #ffcc00);
}

.dive-horizon-label {
    position: absolute;
    top: -15px;
    right: 0;
    font-size: 9px;
    color: #555;
    letter-spacing: 0.5px;
}

.dive-readout {
    background: #111118;
    border: 1px solid #222230;
    border-radius: 4px;
    padding: 8px 10px;
    margin-bottom: 4px;
}

.dive-metric {
    font-family: 'Courier New', monospace;
    font-size: 13px;
    color: #c0d8ff;
    line-height: 1.6;
}

.dive-status {
    font-size: 11px;
    font-weight: 600;
    margin-top: 4px;
    padding: 3px 0;
    letter-spacing: 0.5px;
}

.dive-status.ready { color: #6688aa; }
.dive-status.approaching { color: #5599ff; }
.dive-status.near-horizon { color: #ff9900; animation: pulse-glow 1s infinite; }
.dive-status.inside { color: #ff4444; animation: pulse-glow 0.7s infinite; }
.dive-status.deep { color: #ff2200; animation: pulse-glow 0.4s infinite; }
.dive-status.paused { color: #aaaaaa; }
.dive-status.singularity { color: #ffcc00; }

@keyframes pulse-glow {
    0%, 100% { opacity: 1.0; }
    50% { opacity: 0.55; }
}

/* Fade-to-black overlay for deep interior */
#dive-fade-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: black;
    opacity: 0;
    pointer-events: none;
    z-index: 90;
    transition: opacity 0.5s ease;
}

/* ─── Hover section styles (within Animations panel) ──────────────────────── */

.hover-desc {
    font-size: 10px;
    color: #7799bb;
    line-height: 1.4;
    margin-bottom: 12px;
}

.hover-btn {
    display: block;
    width: 100%;
    padding: 8px 0;
    border: none;
    border-radius: 4px;
    font-family: inherit;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1px;
    cursor: pointer;
    transition: background 0.18s, box-shadow 0.18s, opacity 0.18s;
    outline: none;
}

.hover-btn:disabled {
    opacity: 0.35;
    cursor: default;
}

.hover-btn-start {
    background: linear-gradient(135deg, #0066cc 0%, #003388 100%);
    color: #d0eaff;
    margin-bottom: 12px;
    box-shadow: 0 2px 8px rgba(0, 102, 204, 0.25);
}

.hover-btn-start:hover:not(:disabled) {
    background: linear-gradient(135deg, #1188ee 0%, #0055bb 100%);
    box-shadow: 0 2px 14px rgba(0, 102, 204, 0.4);
}

.hover-btn-reset {
    background: #1a2a3a;
    color: #8ab4d8;
    margin-top: 10px;
}

.hover-btn-reset:hover:not(:disabled) {
    background: #2a3a4e;
    color: #c0ddff;
}

.hover-control-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 10px;
}

.hover-control-row label {
    font-size: 10px;
    color: #7799bb;
    white-space: nowrap;
    min-width: 78px;
}

.hover-control-row input[type="range"] {
    flex: 1;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: #1a2a3a;
    border-radius: 2px;
    outline: none;
}

.hover-control-row input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #44aaff;
    cursor: pointer;
}

#hover-speed-val {
    font-size: 10px;
    color: #6699cc;
    min-width: 28px;
    text-align: right;
}

/* Hover horizon proximity bar */
.hover-horizon-track {
    position: relative;
    height: 6px;
    background: #0a1422;
    border-radius: 3px;
    margin-bottom: 8px;
    overflow: hidden;
    border: 1px solid #1a3366;
    cursor: pointer;
}

.hover-horizon-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.12s ease-out, background 0.4s;
    width: 0%;
}

.hover-horizon-fill.normal {
    background: linear-gradient(90deg, #1a66cc, #44aaff);
}

.hover-horizon-fill.near {
    background: linear-gradient(90deg, #44aaff, #88ddff, #ffffff);
}

.hover-horizon-label {
    position: absolute;
    top: -15px;
    right: 0;
    font-size: 9px;
    color: #3366aa;
    letter-spacing: 0.5px;
}

.hover-readout {
    background: #060e1c;
    border: 1px solid #1a3366;
    border-radius: 4px;
    padding: 8px 10px;
    margin-bottom: 4px;
}

.hover-metric {
    font-family: 'Courier New', monospace;
    font-size: 13px;
    color: #88ccff;
    line-height: 1.6;
}

.hover-status {
    font-size: 11px;
    font-weight: 600;
    margin-top: 4px;
    padding: 3px 0;
    letter-spacing: 0.5px;
}

.hover-status.ready { color: #5588aa; }
.hover-status.descending { color: #44aaff; }
.hover-status.strong { color: #66ccff; animation: hover-pulse 1.2s infinite; }
.hover-status.extreme { color: #aaeeff; animation: hover-pulse 0.6s infinite; }
.hover-status.paused { color: #889aaa; }
.hover-status.min-radius { color: #ffcc44; }

@keyframes hover-pulse {
    0%, 100% { opacity: 1.0; text-shadow: 0 0 6px rgba(100, 200, 255, 0.4); }
    50% { opacity: 0.6; text-shadow: none; }
}

/* ─── Presentation section styles (inside Animations panel) ───────────────── */

.presentation-desc {
    font-size: 10px;
    color: #8fa5c2;
    line-height: 1.4;
    margin-bottom: 10px;
}

.presentation-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
}

.presentation-row label {
    color: #9cb0cd;
    font-size: 10px;
    min-width: 36px;
    white-space: nowrap;
}

.presentation-row.presentation-toggles label {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 6px;
    color: #b9c9df;
    cursor: pointer;
}

.presentation-row.presentation-toggles input[type="checkbox"] {
    margin: 0;
    accent-color: #4f94ff;
}

.presentation-select,
.presentation-row input[type="number"] {
    flex: 1;
    min-width: 0;
    height: 24px;
    background: #0f1524;
    color: #d8e4f7;
    border: 1px solid #2f4363;
    border-radius: 4px;
    font-size: 11px;
    padding: 0 6px;
    outline: none;
}

.presentation-row input[type="number"] {
    max-width: 64px;
}

.presentation-inline-label {
    min-width: 34px !important;
    text-align: right;
}

.presentation-row.presentation-timeline-row {
    align-items: flex-start;
}

.presentation-row.presentation-timeline-row > label {
    padding-top: 2px;
}

.presentation-timeline-stack {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.presentation-timeline {
    position: relative;
    height: 16px;
    border: 1px solid #2b4467;
    border-radius: 4px;
    background: linear-gradient(180deg, rgba(18, 31, 49, 0.95) 0%, rgba(9, 18, 30, 0.95) 100%);
    cursor: pointer;
    overflow: hidden;
    touch-action: none;
}

.presentation-timeline::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    height: 3px;
    background: #1e2d44;
    border-radius: 999px;
    transform: translateY(-50%);
}

.presentation-timeline-fill {
    position: absolute;
    left: 0;
    top: 50%;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, #2c8aff 0%, #69b2ff 100%);
    border-radius: 999px;
    transform-origin: left center;
    transform: translateY(-50%) scaleX(0);
    pointer-events: none;
    z-index: 1;
}

.presentation-timeline-markers {
    position: absolute;
    left: 0;
    right: 0;
    top: 1px;
    bottom: 1px;
    pointer-events: none;
    z-index: 2;
}

.presentation-timeline-marker {
    position: absolute;
    top: 2px;
    bottom: 2px;
    width: 2px;
    border-radius: 2px;
    transform: translateX(-50%);
    background: rgba(164, 206, 255, 0.82);
}

.presentation-timeline-marker.is-stack {
    width: 3px;
    background: rgba(255, 208, 132, 0.95);
}

.presentation-timeline-playhead {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #8ec8ff;
    box-shadow: 0 0 8px rgba(111, 186, 255, 0.7);
    left: 0%;
    transform: translateX(-50%);
    pointer-events: none;
    z-index: 3;
}

.presentation-timeline-playhead::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: 1px solid #d9eeff;
    background: #64adff;
    transform: translate(-50%, -50%);
}

.presentation-timeline.is-dragging {
    cursor: ew-resize;
}

#presentation-scrub {
    flex: 1;
    height: 12px;
    margin: 0;
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    outline: none;
}

#presentation-scrub::-webkit-slider-runnable-track {
    height: 3px;
    background: #1f2b40;
    border-radius: 999px;
}

#presentation-scrub::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 11px;
    height: 11px;
    margin-top: -4px;
    border-radius: 50%;
    background: #64acff;
    border: 1px solid #b9ddff;
    cursor: pointer;
}

#presentation-scrub::-moz-range-track {
    height: 3px;
    background: #1f2b40;
    border-radius: 999px;
}

#presentation-scrub::-moz-range-thumb {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: #64acff;
    border: 1px solid #b9ddff;
    cursor: pointer;
}

#presentation-scrub-label {
    font-size: 10px;
    color: #9fc6f4;
    min-width: 42px;
    text-align: right;
}

.presentation-btn-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
}

.presentation-btn {
    flex: 1;
    min-height: 28px;
    border: 1px solid #2f4363;
    border-radius: 4px;
    background: #182235;
    color: #dbe8ff;
    font-size: 11px;
    letter-spacing: 0.6px;
    cursor: pointer;
}

.presentation-btn:hover {
    background: #22304a;
}

.presentation-btn-primary {
    background: linear-gradient(135deg, #1a6bff 0%, #0048d6 100%);
    border-color: #2e6fda;
}

.presentation-btn-primary:hover {
    background: linear-gradient(135deg, #2b79ff 0%, #1154e4 100%);
}

.presentation-btn-record {
    background: linear-gradient(135deg, #ba2f2f 0%, #7d1f1f 100%);
    border-color: #b04949;
}

.presentation-btn-record:hover {
    background: linear-gradient(135deg, #cf3a3a 0%, #932828 100%);
}

.presentation-status {
    margin-top: 4px;
    padding: 5px 8px;
    border-radius: 4px;
    border: 1px solid #2f4363;
    background: #0f1524;
    color: #9fb6d6;
    font-size: 10px;
    letter-spacing: 0.4px;
}

.presentation-status.is-playing {
    color: #8ec8ff;
    border-color: #3761a0;
}

.presentation-status.is-recording {
    color: #ffb4b4;
    border-color: #7c3131;
}

.presentation-status.is-warning {
    color: #ffd48f;
    border-color: #835f2a;
}

#presentation-annotation-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 112;
}

/* 3-D axes orientation gizmo */
#axes-gizmo-container {
    position: fixed;
    bottom: 8px;
    left: 10px;
    top: auto;
    right: auto;
    width: 170px;
    height: 170px;
    z-index: 50;
    pointer-events: none;
}

#observer-orbit-shell {
    position: relative;
    width: 170px;
    height: 170px;
    pointer-events: none;
}

#observer-orbit-shell::before {
    content: 'Observer controls';
    position: absolute;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%);
    padding: 3px 9px;
    border: 1px solid rgba(134, 184, 255, 0.75);
    border-radius: 10px;
    background: rgba(8, 24, 56, 0.84);
    color: #cfe2ff;
    font-family: 'Lucida Grande', 'Segoe UI', sans-serif;
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.15px;
    line-height: 1.15;
    white-space: nowrap;
    text-shadow: 0 0 3px rgba(105, 153, 233, 0.55);
    box-shadow: 0 0 10px rgba(22, 52, 102, 0.5);
    pointer-events: none;
    opacity: 0.92;
    transition: opacity 0.16s ease, transform 0.16s ease;
}

#observer-orbit-shell::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    width: 94px;
    height: 94px;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    border: 1px dashed rgba(132, 182, 255, 0.68);
    pointer-events: none;
    opacity: 0.6;
}

#observer-orbit-shell:not(.is-open)::before {
    opacity: 0.92;
}

#observer-orbit-shell:not(.is-open)::after {
    opacity: 0.6;
}

#observer-orbit-shell.is-open::before,
#observer-orbit-shell.is-open::after {
    opacity: 0;
    animation: none;
}

#observer-orbit-shell.is-open::before {
    transform: translateX(-50%) translateY(-5px);
}

#observer-orbit-shell.is-open::after {
    transform: translate(-50%, -50%) scale(0.9);
}

#axes-gizmo {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 80px;
    height: 80px;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    pointer-events: auto;
    cursor: pointer;
    filter: drop-shadow(0 0 8px rgba(120, 176, 255, 0.35));
    transition: filter 0.16s ease;
}

#axes-gizmo:hover {
    filter: drop-shadow(0 0 14px rgba(120, 176, 255, 0.62));
}

.observer-distance-arc {
    position: absolute;
    inset: 0;
    opacity: 0;
    transform: scale(0.94);
    transform-origin: 50% 50%;
    transition: opacity 0.16s ease, transform 0.16s ease;
    pointer-events: none;
}

#observer-orbit-shell.is-open .observer-distance-arc {
    opacity: 1;
    transform: scale(1.0);
    pointer-events: auto;
}

.observer-distance-track,
.observer-distance-fill,
.observer-distance-hit {
    fill: none;
    stroke-linecap: round;
}

.observer-distance-track {
    stroke: rgba(110, 140, 200, 0.34);
    stroke-width: 8;
}

.observer-distance-fill {
    stroke: #7fb6ff;
    stroke-width: 8;
    filter: drop-shadow(0 0 5px rgba(125, 180, 255, 0.6));
}

.observer-distance-hit {
    stroke: rgba(0, 0, 0, 0);
    stroke-width: 20;
    pointer-events: stroke;
    cursor: pointer;
}

.observer-distance-knob {
    fill: #dfeaff;
    stroke: #5f96e3;
    stroke-width: 2;
    filter: drop-shadow(0 0 6px rgba(140, 189, 255, 0.8));
    pointer-events: none;
}

.observer-orbit-btn {
    position: absolute;
    min-width: 58px;
    padding: 5px 8px;
    border: 1px solid #3968b2;
    border-radius: 14px;
    background: rgba(11, 32, 74, 0.92);
    color: #dbe8ff;
    font-family: 'Lucida Grande', 'Segoe UI', sans-serif;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.6px;
    text-align: center;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.45);
    cursor: pointer;
    opacity: 0;
    transform: scale(0.84);
    transition: opacity 0.16s ease, transform 0.16s ease, background 0.14s ease;
    pointer-events: none;
}

#observer-orbit-shell.is-open .observer-orbit-btn {
    opacity: 1;
    transform: scale(1.0);
    pointer-events: auto;
}

.observer-orbit-btn-motion {
    top: 16px;
    left: 2px;
}

.observer-orbit-btn-motion.is-active {
    background: rgba(20, 73, 34, 0.94);
    border-color: #43a05a;
    color: #dcffe7;
}

.observer-orbit-btn-reset {
    top: 16px;
    right: 2px;
    border-color: #813535;
    background: rgba(86, 22, 22, 0.92);
    color: #ffe6e6;
}

.observer-orbit-btn:hover {
    background: rgba(18, 50, 106, 0.98);
}

.observer-orbit-btn-reset:hover {
    background: rgba(113, 33, 33, 0.96);
}

.observer-orbit-distance {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    padding: 3px 8px;
    border-radius: 10px;
    background: rgba(10, 29, 67, 0.9);
    color: #dce9ff;
    font-family: 'Lucida Grande', 'Segoe UI', sans-serif;
    font-size: 10px;
    letter-spacing: 0.4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
    opacity: 0;
    transition: opacity 0.16s ease;
}

.observer-orbit-help {
    position: absolute;
    top: 52px;
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
    color: #b8cff8;
    font-family: 'Lucida Grande', 'Segoe UI', sans-serif;
    font-size: 9px;
    letter-spacing: 0.2px;
    opacity: 0;
    transition: opacity 0.16s ease;
}

#observer-orbit-shell.is-open .observer-orbit-distance,
#observer-orbit-shell.is-open .observer-orbit-help {
    opacity: 1;
}

.observer-orbit-tag {
    position: absolute;
    left: 50%;
    bottom: -6px;
    transform: translateX(-50%);
    color: #9ab8ee;
    font-family: 'Lucida Grande', 'Segoe UI', sans-serif;
    font-size: 9px;
    letter-spacing: 1.2px;
    text-shadow: 0 0 6px rgba(82, 128, 202, 0.55);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.16s ease;
}

#observer-orbit-shell.is-open + .observer-orbit-tag {
    opacity: 1;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Timeline Panel (bottom-docked dopesheet)
   ═══════════════════════════════════════════════════════════════════════════ */

.tl-panel {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    height: 320px;
    min-height: 180px;
    max-height: 70vh;
    background: rgba(8, 10, 18, 0.97);
    border-top: 2px solid #1e3054;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 -4px 24px rgba(0,0,0,0.65);
    z-index: 200;
    display: flex;
    flex-direction: column;
    font-family: 'Lucida Grande', 'Segoe UI', sans-serif;
    font-size: 11px;
    color: #ccc;
    transition: transform 0.22s cubic-bezier(.4,0,.2,1), opacity 0.22s ease;
    box-sizing: border-box;
}
.tl-panel--collapsed {
    transform: translateY(100%);
    opacity: 0;
    pointer-events: none;
}

body.has-timeline-panel .link-bar { bottom: var(--tl-h, 330px); transition: bottom 0.22s ease; }
body.has-timeline-panel #axes-gizmo-container { bottom: var(--tl-h, 330px); transition: bottom 0.22s ease; }

body.tl-resizing, body.tl-resizing * {
    cursor: ns-resize !important;
    user-select: none !important;
}

/* ── Resize handle ── */
.tl-resize-handle {
    position: absolute;
    top: -6px; left: 0; right: 0;
    height: 12px;
    cursor: ns-resize;
    z-index: 3;
}
.tl-resize-handle::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 4px;
    transform: translateX(-50%);
    width: 48px;
    height: 4px;
    border-radius: 2px;
    background: rgba(120, 165, 230, 0.35);
    transition: background 0.14s ease;
}
.tl-resize-handle:hover::before {
    background: rgba(140, 185, 255, 0.75);
}

/* ── Transport bar ── */
.tl-transport {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-bottom: 1px solid #16283f;
    background: rgba(12, 18, 32, 0.95);
    flex-shrink: 0;
}
.tl-transport-left  { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.tl-transport-center{ flex: 1; min-width: 80px; }
.tl-transport-right { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.tl-transport-sep   { width: 1px; height: 16px; background: #1e3050; }

.tl-btn {
    border: 1px solid #2a4468;
    border-radius: 4px;
    background: linear-gradient(180deg, #14263e 0%, #0e1d31 100%);
    color: #c0d6f0;
    font-family: inherit;
    font-size: 11px;
    font-weight: 600;
    padding: 4px 10px;
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s, color 0.12s;
    white-space: nowrap;
}
.tl-btn:hover { background: linear-gradient(180deg, #1e3a5c 0%, #162e4c 100%); border-color: #3e6a9e; color: #e2eeff; }
.tl-btn--accent { border-color: #3472a8; color: #8cc4ff; }
.tl-btn--accent:hover { border-color: #4a92cc; color: #b8dcff; background: linear-gradient(180deg, #1a3d64 0%, #143254 100%); }
.tl-btn--warn { border-color: #8a6420; color: #ffd070; }
.tl-btn--warn:hover { border-color: #b08030; color: #ffe4a0; }
.tl-btn--motion { border-color: #5a2a82; color: #c080ff; }
.tl-btn--motion:hover { border-color: #7a40a8; color: #d8a8ff; background: linear-gradient(180deg, #22143a 0%, #190e2e 100%); }
.tl-btn.is-active { border-color: #7a40c0 !important; color: #d0a0ff !important; background: linear-gradient(180deg, #2a1848 0%, #1e1038 100%) !important; }

/* ── Motion Functions modal ── */
.tl-motion-modal {
    display: none;
    position: absolute;
    bottom: calc(100% + 4px);
    right: 8px;
    width: 300px;
    background: #0d1626;
    border: 1px solid #2a3f5f;
    border-radius: 8px 8px 6px 6px;
    box-shadow: 0 -6px 28px rgba(0,0,0,0.7);
    z-index: 300;
    font-size: 11px;
    color: #c0cce0;
    overflow: hidden;
}
.tl-motion-modal.is-open { display: block; }
.tl-motion-hdr {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 10px 6px 12px;
    background: rgba(90, 42, 130, 0.28);
    border-bottom: 1px solid #2a3a5a;
}
.tl-motion-title {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    color: #c090ff;
}
.tl-motion-hdr .tl-btn {
    padding: 2px 7px;
    font-size: 13px;
    line-height: 1;
    border-color: #3a2a5a;
    background: transparent;
    color: #8070a0;
}
.tl-motion-hdr .tl-btn:hover { color: #c090ff; border-color: #7040b0; background: rgba(100,50,160,0.2); }
.tl-motion-params { padding: 0 8px; }
.tl-motion-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 0;
    border-bottom: 1px solid rgba(40,60,100,0.4);
}
.tl-motion-row:last-child { border-bottom: none; }
.tl-motion-type-row { padding: 7px 12px; border-bottom: 1px solid #1e3050; }
.tl-motion-row label {
    flex: 0 0 140px;
    font-size: 10px;
    color: #8090b0;
    letter-spacing: 0.3px;
}
.tl-motion-input {
    flex: 1;
    min-width: 0;
    border: 1px solid #1e3050;
    border-radius: 3px;
    background: #0a1422;
    color: #90b8e0;
    font-family: inherit;
    font-size: 11px;
    padding: 3px 6px;
    -moz-appearance: textfield;
    appearance: textfield;
}
.tl-motion-input::-webkit-inner-spin-button,
.tl-motion-input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.tl-motion-input:focus { outline: none; border-color: #5a40a0; background: #0e1830; }
.tl-motion-footer {
    display: flex;
    justify-content: flex-end;
    padding: 8px 12px;
    border-top: 1px solid #1e3050;
    background: rgba(8,12,24,0.6);
}

/* ── REC button ─────────────────────────────────────────────────── */
.tl-btn--rec { border-color: #702020; color: #ff6060; }
.tl-btn--rec:hover { border-color: #a03030; color: #ff9090; background: linear-gradient(180deg, #2a0e0e 0%, #1e0808 100%); }
.tl-btn--rec.is-active { border-color: #a03030; background: rgba(80,10,10,0.4); }
.tl-btn--rec.is-recording {
    border-color: #c02020;
    color: #ff4040;
    animation: tl-rec-blink 1s step-start infinite;
}
@keyframes tl-rec-blink { 0%,100% { opacity: 1; } 50% { opacity: 0.35; } }

/* ── REC modal ──────────────────────────────────────────────────── */
.tl-rec-modal {
    display: none;
    position: absolute;
    bottom: calc(100% + 4px);
    right: 8px;
    width: 340px;
    background: #0b1622;
    border: 1px solid #1e3050;
    border-radius: 5px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.7);
    z-index: 120;
    user-select: none;
}
.tl-rec-modal.is-open { display: block; }
.tl-rec-hdr {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 10px 6px 12px;
    background: rgba(80,10,10,0.35);
    border-bottom: 1px solid #3a1010;
    border-radius: 4px 4px 0 0;
}
.tl-rec-title {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1px;
    color: #ff8080;
    text-transform: uppercase;
}
.tl-rec-hdr .tl-btn { color: #ff6060; border-color: transparent; background: transparent; padding: 1px 6px; min-height: 0; }
.tl-rec-hdr .tl-btn:hover { color: #ff9090; border-color: #7040b0; background: rgba(100,20,20,0.3); }
.tl-rec-body { padding: 8px 12px; }
.tl-rec-checks { display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; }
.tl-rec-check {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: #90b0d0;
    cursor: pointer;
}
.tl-rec-check input[type="checkbox"] { accent-color: #ff6060; cursor: pointer; }
.tl-rec-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 0;
    border-bottom: 1px solid #122040;
    font-size: 11px;
    color: #90b0d0;
}
.tl-rec-row:last-child { border-bottom: none; }
.tl-rec-row label { flex: 0 0 70px; color: #7090b0; }
.tl-rec-select {
    flex: 1;
    background: #0a1726;
    border: 1px solid #1e3552;
    border-radius: 3px;
    color: #90b8e0;
    font-size: 11px;
    padding: 2px 4px;
}
.tl-rec-select:focus { outline: none; border-color: #5a40a0; }
.tl-rec-num {
    width: 52px;
    background: #0a1726;
    border: 1px solid #1e3552;
    border-radius: 3px;
    color: #90b8e0;
    font-size: 11px;
    padding: 2px 4px;
    text-align: right;
}
.tl-rec-num::-webkit-inner-spin-button,
.tl-rec-num::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.tl-rec-num:focus { outline: none; border-color: #5a40a0; background: #0e1830; }
.tl-rec-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    padding: 8px 12px;
    border-top: 1px solid #1e3050;
    background: rgba(8,12,24,0.6);
}
.tl-rec-actions .tl-mini-btn {
    flex: 1 1 92px;
    text-align: center;
}
.tl-rec-status {
    padding: 5px 12px;
    font-size: 11px;
    color: #7090b0;
    border-top: 1px solid #0e1e34;
    min-height: 22px;
    border-radius: 0 0 4px 4px;
    background: rgba(5,8,16,0.5);
}
.tl-rec-status.is-recording { color: #ff8080; }
.tl-rec-status.is-warning  { color: #e0b040; }

.tl-time-display {
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 130px;
}
.tl-time-input {
    width: 58px;
    border: 1px solid #1e3552;
    border-radius: 3px;
    background: #0a1726;
    color: #90b8e0;
    font-family: Consolas, 'Courier New', monospace;
    font-size: 12px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.6px;
    text-align: center;
    padding: 2px 4px;
    -moz-appearance: textfield;
    appearance: textfield;
}
.tl-time-input::-webkit-inner-spin-button,
.tl-time-input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.tl-time-input:focus {
    border-color: #4080c0;
    outline: none;
    background: #0e1e34;
    color: #c0daf0;
}
.tl-time-sep {
    color: #506880;
    font-size: 12px;
    font-weight: 700;
}

/* ── Preset selector ── */
.tl-preset-label {
    font-size: 10px;
    font-weight: 600;
    color: #7a9ec8;
    letter-spacing: 0.6px;
    text-transform: uppercase;
}
.tl-preset-select {
    border: 1px solid #2a4468;
    border-radius: 3px;
    background: #0e1d31;
    color: #c0d6f0;
    font-family: inherit;
    font-size: 10px;
    padding: 3px 6px;
    max-width: 180px;
    cursor: pointer;
}
.tl-preset-select:hover { border-color: #3e6a9e; }
.tl-btn--del-preset {
    padding: 2px 4px;
    font-size: 12px;
    line-height: 1;
    border-color: #4a2020;
    color: #d06060;
    min-width: 0;
}
.tl-btn--del-preset:hover { border-color: #802020; color: #ff6060; background: rgba(128,20,20,0.3); }
.tl-btn--save { border-color: #2a5020; color: #88cc60; }
.tl-btn--save:hover { border-color: #408030; color: #a0e080; background: linear-gradient(180deg, #102018 0%, #081810 100%); }

/* ── Scrubber ── */
.tl-scrubber {
    position: relative;
    height: 18px;
    border: 1px solid #1e3554;
    border-radius: 4px;
    background: linear-gradient(180deg, #0c1a2e 0%, #081320 100%);
    overflow: hidden;
    cursor: pointer;
    touch-action: none;
}
.tl-scrub-fill {
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 0;
    background: linear-gradient(90deg, rgba(60,130,220,0.25) 0%, rgba(80,150,240,0.35) 100%);
    pointer-events: none;
}
.tl-scrub-head {
    position: absolute;
    top: 0; bottom: 0; left: 0;
    width: 2px;
    transform: translateX(-50%);
    background: linear-gradient(180deg, #ffc85c 0%, #e28d2d 100%);
    box-shadow: 0 0 6px rgba(244,173,82,0.5);
    pointer-events: none;
}

/* ── Body 3-column layout ── */
.tl-body {
    flex: 1;
    display: flex;
    min-height: 0;
    overflow: hidden;
}

/* -- Track list (left) -- */
.tl-tracks {
    width: 220px;
    min-width: 140px;
    max-width: 320px;
    border-right: 1px solid #182c46;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    background: rgba(6, 10, 20, 0.5);
}
.tl-tracks-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 10px;
    border-bottom: 1px solid #152640;
    flex-shrink: 0;
}
.tl-tracks-title {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 1.2px;
    color: #7a9ec8;
    text-transform: uppercase;
}
.tl-track-list {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 4px 0;
}
.tl-track-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1px;
    width: 100%;
    border: none;
    border-left: 3px solid transparent;
    background: none;
    color: #b8d0ee;
    padding: 5px 10px;
    font-family: Consolas, 'Courier New', monospace;
    font-size: 10px;
    cursor: pointer;
    text-align: left;
    transition: background 0.1s, border-color 0.1s;
}
.tl-track-main {
    display: flex;
    align-items: center;
    width: 100%;
    gap: 4px;
}
.tl-track-hud-btn {
    margin-left: auto;
    flex-shrink: 0;
    font-size: 10px;
    opacity: 0.3;
    cursor: pointer;
    padding: 1px 3px;
    border-radius: 3px;
    transition: opacity 0.15s, background 0.15s;
    line-height: 1;
}
.tl-track-hud-btn:hover { opacity: 0.7; background: rgba(100, 160, 220, 0.18); }
.tl-track-hud-btn.is-active { opacity: 1; color: #7cc5ff; background: rgba(80, 140, 210, 0.2); }
.tl-track-item:hover { background: rgba(30, 60, 110, 0.35); }
.tl-track-item.is-sel {
    background: rgba(30, 60, 120, 0.5);
    border-left-color: #5a9ae0;
}
.tl-track-item.is-sel.is-sel--row {
    background: rgba(80, 30, 30, 0.5);
    border-left-color: #e05a5a;
}
.tl-track-path {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}
.tl-track-keycount {
    font-family: 'Lucida Grande', 'Segoe UI', sans-serif;
    font-size: 9px;
    color: #6d90b5;
    letter-spacing: 0.35px;
}

/* -- Dopesheet (center) -- */
.tl-dopesheet {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    position: relative;
}
/* ── Timeline scroll/zoom ── */
.tl-scroll-wrap {
    flex: 1;
    overflow-x: auto;
    overflow-y: hidden;
    min-height: 0;
    scrollbar-width: thin;
    scrollbar-color: #2a4060 transparent;
}
.tl-scroll-wrap::-webkit-scrollbar { height: 5px; }
.tl-scroll-wrap::-webkit-scrollbar-track { background: transparent; }
.tl-scroll-wrap::-webkit-scrollbar-thumb { background: #2a4060; border-radius: 3px; }
.tl-time-content {
    display: flex;
    flex-direction: column;
    min-width: 100%;
    height: 100%;
}
.tl-zoom-ctrls {
    position: absolute;
    right: 0; top: 0;
    z-index: 20;
    height: 24px;
    display: flex;
    align-items: center;
    background: rgba(8,16,28,0.88);
    border-left: 1px solid #1a2d47;
    padding: 0 3px;
    gap: 1px;
}
.tl-zoom-btn {
    height: 18px;
    min-width: 18px;
    border: 1px solid #1e3552;
    border-radius: 2px;
    background: rgba(20,36,60,0.7);
    color: #6a96c4;
    font-size: 12px;
    cursor: pointer;
    padding: 0 3px;
    line-height: 1;
}
.tl-zoom-btn:hover { background: rgba(30,60,100,0.8); color: #a0c8f0; }
.tl-zoom-level { min-width: 28px; text-align: center; font-size: 9px; font-weight: 700; letter-spacing: 0.5px; }
.tl-ruler {
    position: relative;
    height: 24px;
    border-bottom: 1px solid #1a2d47;
    background: #0c1626;
    flex-shrink: 0;
    overflow: hidden;
    cursor: pointer;
}
.tl-ruler-tick {
    position: absolute;
    top: 0; bottom: 0;
    width: 1px;
    background: rgba(120, 170, 230, 0.2);
}
.tl-ruler-label {
    position: absolute;
    top: 2px; left: 4px;
    color: #6a96c4;
    font-size: 8px;
    white-space: nowrap;
    pointer-events: none;
}
.tl-ruler-playhead {
    position: absolute;
    top: 0; bottom: 0;
    width: 2px;
    transform: translateX(-50%);
    background: linear-gradient(180deg, #ffd073 0%, #e28d2d 100%);
    box-shadow: 0 0 6px rgba(244,173,82,0.45);
    z-index: 2;
}

.tl-lanes {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}
.tl-lane {
    position: relative;
    height: 28px;
    border-bottom: 1px solid #111f32;
    transition: background 0.1s;
}
.tl-lane:hover { background: rgba(20, 40, 75, 0.3); }
.tl-lane.is-sel { background: rgba(30, 60, 120, 0.35); }

.tl-lane-playhead {
    position: absolute;
    top: 0; bottom: 0;
    width: 1px;
    background: rgba(255, 200, 80, 0.35);
    pointer-events: none;
    z-index: 1;
}

.tl-diamond {
    position: absolute;
    top: 50%;
    width: 12px;
    height: 12px;
    transform: translate(-50%, -50%) rotate(45deg);
    border: 2px solid #4080c0;
    background: #1a3050;
    border-radius: 2px;
    cursor: grab;
    z-index: 2;
    transition: background 0.1s, border-color 0.1s, box-shadow 0.1s;
    padding: 0;
}
.tl-diamond:hover {
    background: #244a72;
    border-color: #60a0e0;
    box-shadow: 0 0 6px rgba(80, 150, 240, 0.4);
}
.tl-diamond.is-sel {
    background: #2e5a8c;
    border-color: #f0b840;
    box-shadow: 0 0 8px rgba(240, 184, 64, 0.45);
}

/* During keyframe drag: grabbing cursor on lanes, suppress hover transitions */
.tl-lanes--dragging {
    cursor: grabbing;
    user-select: none;
}
.tl-lanes--dragging .tl-diamond {
    cursor: grabbing;
    transition: none;
}

/* -- Inspector (right) -- */
.tl-inspector {
    width: 240px;
    min-width: 180px;
    max-width: 320px;
    border-left: 1px solid #182c46;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 10px 12px;
    flex-shrink: 0;
    overflow-y: auto;
    background: rgba(6, 10, 20, 0.5);
}

#tl-key-section,
#tl-ev-section {
    padding: 6px 2px 2px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.tl-inspector-title {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 1.2px;
    color: #7a9ec8;
    text-transform: uppercase;
}
.tl-insp-summary {
    color: #a8c8e8;
    font-size: 10px;
    line-height: 1.35;
    padding: 4px 6px;
    border: 1px solid #1a2e4a;
    border-radius: 4px;
    background: #0a1524;
    min-height: 20px;
}
.tl-ev-end-banner {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 8px;
    border: 1px solid #3a2a10;
    border-radius: 4px;
    background: #1a1408;
    color: #d4a84b;
    font-size: 10px;
}
.tl-ev-end-banner span {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.tl-mini-btn {
    padding: 2px 8px;
    border-radius: 3px;
    border: 1px solid #3a3a2a;
    background: #252514;
    color: #ccc080;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.8px;
    cursor: pointer;
    flex-shrink: 0;
    white-space: nowrap;
}
.tl-mini-btn:hover { background: #3a3518; }
.tl-mini-btn--danger { border-color: #4a2010; background: #200c06; color: #e07050; }
.tl-mini-btn--danger:hover { background: #3a1408; }
.tl-insp-row {
    display: flex;
    align-items: center;
    gap: 6px;
}
.tl-insp-row label {
    min-width: 42px;
    font-size: 10px;
    color: #8aa8cc;
    text-align: right;
    flex-shrink: 0;
}
.tl-insp-row input,
.tl-insp-row select {
    flex: 1;
    min-width: 0;
    border: 1px solid #1e3552;
    border-radius: 3px;
    background: #0a1726;
    color: #d0e4ff;
    padding: 3px 6px;
    font-family: Consolas, 'Courier New', monospace;
    font-size: 10px;
}
.tl-insp-row select {
    font-family: 'Lucida Grande', 'Segoe UI', sans-serif;
}
.tl-insp-actions {
    display: flex;
    gap: 6px;
}

.tl-mini-btn {
    border: 1px solid #263e5e;
    border-radius: 3px;
    background: #0e1e34;
    color: #a0bede;
    font-family: 'Lucida Grande', 'Segoe UI', sans-serif;
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.5px;
    padding: 3px 8px;
    cursor: pointer;
    transition: background 0.1s, border-color 0.1s, color 0.1s;
}
.tl-mini-btn:hover { background: #162e4e; border-color: #3a6090; color: #d0e8ff; }
.tl-mini-btn--accent { border-color: #2e6498; color: #70b4f0; }
.tl-mini-btn--accent:hover { border-color: #4080c0; color: #a0d4ff; }
.tl-mini-btn--danger { border-color: #6a3030; color: #e08080; }
.tl-mini-btn--danger:hover { border-color: #904040; color: #ffaaaa; background: #2a1018; }

/* -- Status bar -- */
.tl-status {
    padding: 3px 12px;
    font-size: 10px;
    color: #6a90b8;
    border-top: 1px solid #14243c;
    background: rgba(8, 14, 26, 0.8);
    flex-shrink: 0;
}
.tl-status--warn { color: #e8b848; }
.tl-status--error { color: #e06060; }
.tl-status--info { color: #6ab8e0; }

.tl-empty {
    color: #506880;
    font-size: 10px;
    padding: 12px 10px;
    text-align: center;
}

/* ── Events row (left) + events lane (center) ── */
.tl-events-row {
    display: flex;
    align-items: center;
    height: 28px;
    padding: 0 10px;
    border-bottom: 1px solid #1e3050;
    background: rgba(20, 10, 38, 0.55);
    flex-shrink: 0;
    cursor: default;
}
.tl-events-row.is-sel-ch { background: rgba(30, 12, 55, 0.75); }
/* ── Annotation track column containers ── */
.tl-annot-track-col,
.tl-annot-lane-col {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
}
/* ── Annotation section header row ── */
.tl-ann-hdr {
    display: flex;
    align-items: center;
    height: 22px;
    padding: 0 6px 0 10px;
    background: rgba(14, 8, 30, 0.7);
    border-bottom: 1px solid #12243a;
    flex-shrink: 0;
}
.tl-ann-hdr-title {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 1px;
    color: #9060d8;
    text-transform: uppercase;
    flex: 1;
    white-space: nowrap;
}
.tl-ann-add-btn {
    flex-shrink: 0;
    width: 18px;
    height: 16px;
    border: 1px solid #3a2460;
    border-radius: 3px;
    background: rgba(80, 30, 120, 0.35);
    color: #c080ff;
    font-size: 13px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.1s;
}
.tl-ann-add-btn:hover { background: rgba(120, 50, 180, 0.5); color: #e0a0ff; }
.tl-ann-del-ch {
    flex-shrink: 0;
    margin-left: auto;
    width: 16px;
    height: 16px;
    border: none;
    border-radius: 3px;
    background: transparent;
    color: #6040a0;
    font-size: 13px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    opacity: 0.5;
    transition: opacity 0.1s, color 0.1s;
}
.tl-ann-del-ch:hover { color: #ff6060; opacity: 1; }
.tl-ann-hdr-spacer {
    height: 22px;
    flex-shrink: 0;
    background: rgba(14, 8, 30, 0.7);
    border-bottom: 1px solid #12243a;
}
.tl-events-row-title {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.8px;
    color: #c080ff;
    text-transform: uppercase;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}
.tl-events-lane {
    position: relative;
    height: 28px;
    border-bottom: 1px solid #1a2d47;
    background: rgba(20, 10, 36, 0.4);
    flex-shrink: 0;
    overflow: hidden;
}
.tl-events-lane:hover { background: rgba(30, 14, 52, 0.5); }
.tl-events-lane.tl-lane--drag-target {
    background: rgba(60, 120, 255, 0.18);
    outline: 1px dashed rgba(100, 160, 255, 0.65);
}
.tl-ev-hint {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 9px;
    color: #604878;
    white-space: nowrap;
    pointer-events: none;
}
.tl-ev-marker {
    position: absolute;
    top: 3px;
    transform: translateX(-50%);
    width: 14px;
    height: 22px;
    border: 1.5px solid #8050cf;
    background: rgba(130, 70, 210, 0.3);
    border-radius: 2px 2px 0 0;
    cursor: grab;
    padding: 0;
    z-index: 3;
    transition: background 0.1s, border-color 0.1s, box-shadow 0.1s;
}
.tl-ev-marker:active { cursor: grabbing; }
.tl-ev-marker:hover {
    background: rgba(160, 100, 240, 0.5);
    border-color: #c080ff;
    box-shadow: 0 0 6px rgba(180, 100, 255, 0.4);
}
.tl-ev-marker.is-sel {
    background: rgba(100, 60, 180, 0.7);
    border-color: #f0b840;
    box-shadow: 0 0 8px rgba(240, 184, 64, 0.45);
}
.tl-ev-marker.is-clear {
    border-style: dashed;
    background: rgba(80, 40, 120, 0.2);
}
.tl-ev-marker.has-dur {
    transform: none;
    border-radius: 2px;
    min-width: 14px;
}

/* Transport TEXT button */
.tl-btn--text { border-color: #1a4070; color: #7cc5ff; }
.tl-btn--text:hover { border-color: #2a6090; color: #a8d8ff; background: linear-gradient(180deg, #0e2038 0%, #08162a 100%); }
.tl-btn--text.is-active { border-color: #2a6090 !important; color: #a8d8ff !important; }

/* ── Event inspector section ── */
.tl-ev-section {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.tl-insp-row--tall {
    align-items: flex-start;
    gap: 6px;
}
.tl-insp-row--tall label { margin-top: 4px; }
.tl-insp-row textarea {
    flex: 1;
    min-width: 0;
    border: 1px solid #1e3552;
    border-radius: 3px;
    background: #0a1726;
    color: #d0e4ff;
    padding: 3px 6px;
    font-family: 'Lucida Grande', 'Segoe UI', sans-serif;
    font-size: 10px;
    resize: vertical;
    min-height: 50px;
    line-height: 1.4;
}
.tl-insp-row textarea:focus { outline: none; border-color: #5a40a0; background: #0e1830; }
.tl-ev-color-input {
    flex: 0 0 auto;
    width: 44px;
    height: 22px;
    padding: 1px;
    border: 1px solid #1e3552;
    border-radius: 3px;
    background: #0a1726;
    cursor: pointer;
}

/* ── Auto Key initial-state modal ── */
.tl-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 300;
    background: rgba(0, 0, 0, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
}
.tl-modal {
    background: #0e1828;
    border: 1px solid #2a4a70;
    border-radius: 8px;
    padding: 24px 28px 20px;
    min-width: 340px;
    max-width: 480px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.7);
    font-family: 'Segoe UI', 'Lucida Grande', sans-serif;
    color: #c0d8f0;
}
.tl-modal-title {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 1px;
    color: #80c8ff;
    text-transform: uppercase;
    margin-bottom: 12px;
}
.tl-modal-body {
    font-size: 12px;
    line-height: 1.55;
    margin: 0 0 18px;
    color: #a0b8d0;
}
.tl-modal-body b { color: #c0e0ff; }
.tl-modal-choices {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 10px;
}
.tl-modal-btn {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
    padding: 10px 14px;
    border-radius: 6px;
    border: 1px solid #2a4060;
    background: rgba(20, 36, 60, 0.8);
    color: #b0cce8;
    cursor: pointer;
    text-align: left;
    transition: background 0.12s, border-color 0.12s;
    width: 100%;
}
.tl-modal-btn:hover { background: rgba(40, 70, 110, 0.9); border-color: #4080c0; }
.tl-modal-btn--full  { border-color: #1e5080; }
.tl-modal-btn--full:hover  { border-color: #40a0e0; background: rgba(20, 60, 100, 0.9); }
.tl-modal-btn--diff  { border-color: #2a4060; }
.tl-modal-btn-label { font-size: 12px; font-weight: 700; color: #d0e8ff; }
.tl-modal-btn--full  .tl-modal-btn-label { color: #70d8ff; }
.tl-modal-btn-sub   { font-size: 10px; color: #6080a0; line-height: 1.4; }
.tl-modal-btn--cancel {
    display: block;
    width: 100%;
    margin-top: 6px;
    padding: 7px 14px;
    border-radius: 5px;
    border: 1px solid #1e2e40;
    background: transparent;
    color: #506070;
    font-size: 11px;
    cursor: pointer;
    text-align: center;
    transition: color 0.12s, border-color 0.12s;
}
.tl-modal-btn--cancel:hover { color: #90a8c0; border-color: #304050; }

/* ── Drag overlay for positioning annotation box & pointer ── */
.tl-drag-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 200;
    background: rgba(0, 0, 0, 0.15);
    cursor: default;
}
.tl-drag-help {
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(14, 24, 44, 0.92);
    color: #a0c8f0;
    font-family: 'Segoe UI', 'Lucida Grande', sans-serif;
    font-size: 12px;
    padding: 7px 18px;
    border-radius: 6px;
    border: 1px solid #2e5080;
    pointer-events: none;
    white-space: nowrap;
    z-index: 201;
}
.tl-drag-help b { color: #70daff; }
.tl-drag-handle {
    position: absolute;
    z-index: 202;
    cursor: grab;
    transform: translate(-50%, -50%);
}
.tl-drag-handle:active { cursor: grabbing; }
.tl-drag-handle--box {
    width: 24px;
    height: 24px;
    border: 3px solid #70daff;
    border-radius: 4px;
    background: rgba(112, 218, 255, 0.15);
    box-shadow: 0 0 10px rgba(112, 218, 255, 0.35);
}
.tl-drag-handle--ptr {
    width: 16px;
    height: 16px;
    border: 3px solid #ff8060;
    border-radius: 50%;
    background: rgba(255, 128, 96, 0.2);
    box-shadow: 0 0 10px rgba(255, 128, 96, 0.35);
}

/* ── Open-timeline button (injected by gui.js) ── */
#tl-open-btn {
    position: fixed;
    left: 50%;
    bottom: 40px;
    transform: translateX(-50%);
    z-index: 130;
    border: 1px solid #2e5080;
    border-radius: 5px;
    background: rgba(14, 24, 44, 0.92);
    color: #80b4e8;
    font-family: 'Lucida Grande', 'Segoe UI', sans-serif;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.5px;
    padding: 6px 20px;
    cursor: pointer;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.5);
    transition: background 0.14s, border-color 0.14s, color 0.14s, bottom 0.22s ease, opacity 0.22s ease;
    text-transform: uppercase;
}
#tl-open-btn:hover {
    background: rgba(24, 44, 78, 0.95);
    border-color: #4a80c0;
    color: #b8dcff;
}
body.has-timeline-panel #tl-open-btn {
    opacity: 0;
    pointer-events: none;
    bottom: -40px;
}

/* ── Responsive ── */
@media screen and (max-width: 900px) {
    .tl-tracks { width: 140px; }
    .tl-inspector { width: 180px; }
}
@media screen and (max-width: 640px) {
    .tl-tracks { display: none; }
    .tl-inspector { display: none; }
}
