* {
    box-sizing: border-box;
}


body {
    margin: 0;
    font-family: system-ui, sans-serif;
    background: #b2d1ef;
}

/* // 8dec */
.hover-focus {
    outline: 3px solid rgba(0, 0, 0, 0.6);
    background: rgba(0, 0, 0, 0.08);
}

/* Controls */
.controls {
    position: sticky;
    top: 0;
    background: white;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 10;
}

.controls select {
    font-size: 1rem;
    padding: 6px;
}

.toggles {
    display: flex;
    gap: 20px;
}

.toggles label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.95rem;
}

/* Layout */
main {
    display: flex;
    flex-direction: column;
}

#graphCanvas {
    width: 100%;
    /* visuele grootte */
    height: 100%;
    display: block;
}

.road-intervals {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.interval-strip {
    position: absolute;
    bottom: 0;
    height: 30%;
    opacity: 0.4;
}

.interval-strip.active {
    opacity: 0.85;
    outline: 2px solid rgba(255, 255, 255, 0.6);
}

.ghost {
    position: absolute;
    bottom: 30%;
    opacity: 0.4;
}

.hint {
    font-size: 0.85rem;
    color: #444;
    margin-top: 6px;
}

/* Panelen */
.panel {
    padding: 10px;
    overflow-x: auto;
}

/* Diagram */
#graphCanvas {
    width: 100%;
    height: 220px;
    border: 1px solid #aaa;
}

.graph-interval.active {
    stroke-width: 5;
    opacity: 1;
}

.graph-interval {
    opacity: 0.6;
}



/* optioneel voor debugging vormgeving */
#road.debug {
    outline: 2px dashed orange;
}

/* Road container */

#road {
    position: relative;
    width: 100%;
    height: 120px;
    overflow: hidden;
    background: linear-gradient(to bottom,
            #e9f4fd 0%,
            #90e5f4 75%,
            #e2f4dd 75%,
            #7ff25d 90%,
            #48c422 95%,
            #8a8989 75%,
            #06481f 95%,
            #3a3a3a 100%);
    border-radius: 12px;
    margin-bottom: 16px;
}

#road .car {
    position: absolute;
    bottom: 10px;
    height: 60px;
    transition: transform 0.1s linear;
    z-index: 20;
}

/* Road background stays as-is */
/* Ghost */
#road .ghost {
    position: absolute;
    bottom: 0;
    opacity: 0.25;
    height: 60px;
    /* width: 80px; */
    pointer-events: none;
    transition: opacity 0.25s;
}

#road .ghost.active {
    opacity: 0.75;
}

/* ---------------------------------------------
   LAYER voor strips en ghosts
--------------------------------------------- */
/* intervalblokken */
.road-intervals {
    position: absolute;
    inset: 0;
    display: flex;
    pointer-events: none;
    z-index: 10;
}



#road .road-interval {
    position: absolute;
    top: 0;
    bottom: 0;

    display: flex;
    height: 20px;
    width: 100%;
    left: 0;
    opacity: 0.8;
    pointer-events: none;
}

#road .road-interval {
    flex: 1;
    /* background: transparent; */
    /* transition: background 0.25s; */
}

#road .road-interval.active {
    border: 2px solid;
    opacity: 0.5;
    background: rgba(100, 60, 200, 0.3);
    /* zacht, net als grafiek */
}

/* ---------------------------------------------
   INTERVAL STRIPS (history)
--------------------------------------------- */
.interval-strip {
    position: absolute;
    top: 0;
    height: 100%;
    opacity: 0.28;
    /* licht zichtbaar */
}

/* Highlighted interval */
.interval-strip.active {
    opacity: 0.6;
    backdrop-filter: brightness(1.5);
    outline: 2px solid rgba(255, 255, 255, 0.6);
}

/* ---------------------------------------------
   GHOSTS (meetmoment-markers)
--------------------------------------------- */
.ghosts {
    position: absolute;
    inset: 0;
    pointer-events: none;
}




/* ---------------------------------------------
   AUTO
--------------------------------------------- */
/* MAIN CAR */

/* De auto */



.car.flash {
    filter: drop-shadow(0 0 12px white) brightness(200%);
    transition: filter 0.1s;
}


/* Tabel */
table {
    border-collapse: collapse;
    min-width: 100%;
}

.delta-cell {
    width: 120px;
    /* vaste schaal per interval  31 DEC vertical align bottom */
    vertical-align: bottom;
    padding: 4px;
}

.cum-cell {
    text-align: center;
    font-size: 0.9em;
}

.cum-value {
    margin-top: 4px;
}

th,
td {
    border: 1px solid #aaa;
    padding: 6px;
    font-size: 0.85rem;
    text-align: center;
}

.distanceBar {
    height: 10px;
    background: steelblue;
    margin-bottom: 4px;
}

/* herstel CSS */
.distance-table td,
.distance-table th {
    border: 1px solid #ccc;
    text-align: center;
}

/* // tbv '26 kleurcontract' */
.distance-table th.active,
.distance-table td.active {
    background-color: var(--focus-bg);
    outline: 2px solid var(--focus-outline);
}

/* zelfde kleur opachtergrond als grafiek-column highlight */
td.active {
    position: relative;
}

td.active::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: currentColor;
    opacity: 0.18;
    /* zelfde transparantie als grafiekband ~20% */
    pointer-events: none;
}


.active-col {
    background: rgba(255, 230, 150, 0.4);
}

/*/////////////////////////////
delta-wrapper en delta-bar voldoen aan minimale eisen 31 dec
/////////////*/
/* container voor bar + getal naast elkaar */
.delta-wrapper {
    display: flex;
    align-items: flex-end;
    height: 48px;
    gap: 6px;
}

.delta-wrapper {
    grid-template-columns: 1fr auto;
    align-items: end;
    display: flex;
    align-items: flex-end;
    /* 🔑 staaf groeit omhoog */
    gap: 6px;
    height: 48px;
    /* didactisch gekozen schaal */
}

/* de verticale staaf zelf 31 DEC*/
.delta-bar {
    width: 10px;
    border-radius: 2px;
    background-color: var(--data-blue);
    align-self: end;
    display: block;
}

/* numerieke waarde */
.delta-value {
    font-size: 0.85em;
    align-self: end;
    color: #222;
    white-space: nowrap;
}

.delta-bar.active {
    outline: 2px solid black;
}

/* De cel waarin de interval-staaf komt  31 DEC*/
td.delta-bar-cell {
    height: 48px;
    /* vaste visuele hoogte */
    vertical-align: bottom;
    padding: 4px;
}

/* De container voor de staaf 31 DEC*/
.delta-bar-container {
    position: relative;
    height: 100%;
    display: flex;
    align-items: flex-end;
}


.interval-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    /* ← essentieel */
}

.interval-table th,
.interval-table td {
    text-align: center;
    padding: 4px;
}

.distanceBar {
    height: 12px;
    margin: 0 auto;
    background: transparent;
}

.interval-table td.active,
.interval-table th.active {
    background: rgba(0, 0, 0, 0.08);
}

.distance-table td.active-col,
.distance-table th.active-col {
    background-color: rgba(255, 230, 150, 0.4);
}

.distance-table .active,
.distance-table .active {
    background-color: rgba(255, 230, 150, 0.4);
}

/* strovoscopische effect */
#road.flash::after {
    content: "";
    position: absolute;
    inset: 0;
    box-shadow: inset 0 0 0 9999px rgba(246, 6, 6, 0.25);
    /* background: rgba(255, 255, 255, 0.6); */
    pointer-events: none;
    animation: flash 120ms ease-out;
}

@keyframes flash {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
    }
}

/* einde stroboscopische effect */

/* Tablet en groter */
@media (min-width: 768px) {
    #graphCanvas {
        height: 300px;
    }
}