/* ─── Timeline container ─────────────────────────────────────────────────────── */
#timeline-container {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1060;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    overflow: visible;
}

/* The whole panel (tab + content) slides up/down together */
#timeline-panel {
    pointer-events: all;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    transform: translateY(calc(100% - 28px)); /* collapsed: only tab peeking */
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: visible;
}

#timeline-container.open #timeline-panel {
    transform: translateY(0);
}

/* ─── Tab button (sits at the very top of the panel) ────────────────────────── */
#timeline-tab {
    align-self: center;
    padding: 5px 18px 4px;
    background: rgba(8, 8, 16, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-bottom: none;
    border-radius: 10px 10px 0 0;
    font-family: 'Cinzel', serif;
    font-size: 0.62rem;
    letter-spacing: 0.18em;
    color: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    transition: color 0.2s, background 0.2s;
    display: flex;
    align-items: center;
    gap: 7px;
    backdrop-filter: blur(12px);
    flex-shrink: 0;
}

#timeline-tab:hover {
    color: rgba(255, 255, 255, 0.85);
    background: rgba(14, 14, 26, 0.98);
}

.tab-arrow {
    font-size: 0.52rem;
    display: inline-block;
    transition: transform 0.3s ease;
}

/* Arrow points up when open (inviting collapse), down when collapsed */
#timeline-container.open .tab-arrow {
    transform: rotate(180deg);
}

/* ─── Inner content area ─────────────────────────────────────────────────────── */
#timeline-inner {
    background: rgba(8, 8, 16, 0.95);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.5);
    padding: 12px 24px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow: visible;
}

/* ─── Controls row ───────────────────────────────────────────────────────────── */
.timeline-controls {
    display: flex;
    align-items: center;
    gap: 16px;
    overflow: visible;
}

.timeline-present-display {
    font-family: 'Cinzel', serif;
    font-size: 0.7rem;
    letter-spacing: 0.12em;
    color: rgba(255, 255, 255, 0.45);
    white-space: nowrap;
}

.timeline-present-display #present-year-val {
    color: #c9a84c;
    font-weight: 600;
    font-size: 0.88rem;
}

.timeline-hint {
    font-family: 'Courier New', monospace;
    font-size: 0.56rem;
    color: rgba(255, 255, 255, 0.18);
    letter-spacing: 0.08em;
    flex: 1;
    text-align: center;
}

.timeline-hidden-count {
    font-family: 'Cinzel', serif;
    font-size: 0.6rem;
    color: rgba(201, 168, 76, 0.55);
    letter-spacing: 0.1em;
    white-space: nowrap;
}

/* ─── Track ──────────────────────────────────────────────────────────────────── */
.timeline-track-wrapper {
    position: relative;
    overflow: hidden;
    height: 70px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.07);
    background: rgba(0, 0, 0, 0.2);
}

/* ─── Era bands ──────────────────────────────────────────────────────────────── */
.timeline-era-bands {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.timeline-era-band {
    position: absolute;
    top: 0;
    bottom: 0;
    opacity: 0.08;
}

/* ─── Tick marks ─────────────────────────────────────────────────────────────── */
.timeline-markers {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: visible;
}

.timeline-tick {
    position: absolute;
    top: 0;
    bottom: 20px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    overflow: visible;
}

.timeline-tick-line {
    width: 1px;
    background: rgba(255, 255, 255, 0.1);
    height: 30%;
    flex-shrink: 0;
}

.timeline-tick-line.major {
    background: rgba(255, 255, 255, 0.2);
    height: 55%;
}

.timeline-tick-label {
    font-family: "Courier New", monospace;
    font-size: 0.53rem;
    color: rgba(255, 255, 255, 0.28);
    white-space: nowrap;
    margin-top: 3px;
    letter-spacing: 0.05em;
    /* flex align-items:center already centers it on the tick */
}

/* ─── Node dots ──────────────────────────────────────────────────────────────── */
#tl-node-dots {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.timeline-node-dot {
    position: absolute;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    pointer-events: all;
    cursor: pointer;
    transition: transform 0.12s;
    opacity: 0.7;
}

.timeline-node-dot:hover {
    transform: translate(-50%, -50%) scale(2);
    opacity: 1;
    z-index: 10;
}

.timeline-node-dot.hidden-dot {
    opacity: 0.15;
    pointer-events: none;
}

/* ─── Present cursor ─────────────────────────────────────────────────────────── */
.timeline-cursor {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #c9a84c;
    box-shadow: 0 0 8px rgba(201, 168, 76, 0.7);
    pointer-events: none;
    z-index: 20;
}

.timeline-cursor-head {
    position: absolute;
    top: -5px;
    left: 50%;
    transform: translateX(-50%);
    width: 9px;
    height: 9px;
    background: #c9a84c;
    border-radius: 50%;
    box-shadow: 0 0 8px rgba(201, 168, 76, 0.9);
}

/* ─── Future overlay ─────────────────────────────────────────────────────────── */
.timeline-future-overlay {
    position: absolute;
    top: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.42);
    pointer-events: none;
    z-index: 15;
    border-left: 1px dashed rgba(201, 168, 76, 0.3);
}

/* ─── Scrub zone (bottom strip for setting present year) ─────────────────────── */
.timeline-scrub-zone {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 20px;
    background: rgba(201, 168, 76, 0.04);
    border-top: 1px solid rgba(201, 168, 76, 0.12);
    z-index: 25;
    transition: background 0.15s, border-color 0.15s;
    pointer-events: none; /* track-wrapper handles events */
}

.timeline-scrub-zone.active {
    background: rgba(201, 168, 76, 0.1);
    border-top-color: rgba(201, 168, 76, 0.3);
}
/* ─── CE / AH pill toggle ────────────────────────────────────────────────────── */
.tl-era-toggle {
    position: relative;
    display: flex;
    align-items: center;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(0, 0, 0, 0.3);
    cursor: pointer;
    overflow: hidden;
    flex-shrink: 0;
    user-select: none;
}

.tl-era-option {
    position: relative;
    z-index: 2;
    padding: 3px 10px;
    font-family: 'Courier New', monospace;
    font-size: 0.58rem;
    letter-spacing: 0.1em;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.35);
    transition: color 0.25s ease;
    white-space: nowrap;
}

.tl-era-option.active {
    color: rgb(12, 12, 18);
}

.tl-era-thumb {
    position: absolute;
    z-index: 1;
    top: 0;
    left: 0;
    width: 50%;
    height: 100%;
    background: rgba(201, 168, 76, 0.9);
    border-radius: 5px;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}
/* ─── Play button ────────────────────────────────────────────────────────────── */
.tl-play-btn {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1.5px solid rgba(201, 168, 76, 0.4);
    background: rgba(201, 168, 76, 0.08);
    color: rgba(201, 168, 76, 0.8);
    font-size: 0.75rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, border-color 0.2s, color 0.2s, box-shadow 0.2s, transform 0.15s;
    line-height: 1;
    padding: 0 0 0 2px; /* optical nudge for play triangle */
}

.tl-play-btn:hover {
    background: rgba(201, 168, 76, 0.18);
    border-color: rgba(201, 168, 76, 0.75);
    color: #c9a84c;
    box-shadow: 0 0 10px rgba(201, 168, 76, 0.25);
}

.tl-play-btn.playing {
    background: rgba(201, 168, 76, 0.15);
    border-color: rgba(201, 168, 76, 0.7);
    color: #c9a84c;
    box-shadow: 0 0 14px rgba(201, 168, 76, 0.3);
    padding: 0; /* pause icon is centered */
}

.tl-play-btn:active {
    transform: scale(0.9);
}

/* ─── Speed control ──────────────────────────────────────────────────────────── */
.tl-speed-control {
    display: flex;
    align-items: center;
    height: max-content;
    gap: 5px;
    flex-shrink: 0;
    overflow: visible;
}

.tl-speed-pips {
    overflow: visible;
    padding: 4px;
}



.tl-speed-label {
    font-family: 'Courier New', monospace;
    font-size: 0.52rem;
    letter-spacing: 0.1em;
    color: rgba(255, 255, 255, 0.2);
    text-transform: uppercase;
    user-select: none;
}

.tl-speed-pips {
    display: flex;
    align-items: center;
    gap: 3px;
}

.tl-speed-pip {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 1.5px solid rgba(201, 168, 76, 0.2);
    background: transparent;
    color: rgba(201, 168, 76, 0.3);
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, border-color 0.15s, box-shadow 0.15s, transform 0.1s;
    padding: 0;
}

/* Scale pips so each is a little bigger than the last — visual speed cue */
.tl-speed-pip:nth-child(1) { width: 12px; height: 12px; }
.tl-speed-pip:nth-child(2) { width: 15px; height: 15px; }
.tl-speed-pip:nth-child(3) { width: 18px; height: 18px; }
.tl-speed-pip:nth-child(4) { width: 21px; height: 21px; }

.tl-speed-pip:hover {
    border-color: rgba(201, 168, 76, 0.55);
    background: rgba(201, 168, 76, 0.1);
    transform: scale(1.15);
}

.tl-speed-pip.active {
    background: rgba(201, 168, 76, 0.85);
    border-color: rgba(201, 168, 76, 0.9);
    box-shadow: 0 0 7px rgba(201, 168, 76, 0.45);
}