/* Overlay endurance (referensi v3): tower kiri bawah + panel lap kanan atas. Dimuat paling akhir, hanya menyentuh mode endurance. */
:root { --e-g: #22c55e; --e-y: #facc15; --e-r: #ef4444; --e-p: #c084fc; --e-ink: #0a0c10; }

/* ---------- header tower ---------- */
body.mode-endu .hud-left { width: 500px; }
body.mode-endu .race-header { display: flex; align-items: center; gap: 10px; padding: 6px 12px; }
body.mode-endu .race-badge.endurance { background: #f59e0b; color: #1a1205; font-style: italic; font-weight: 800; padding: 2px 12px; font-size: 12px; }
body.mode-endu .quali-clock { position: static; font-size: 14px; font-weight: 700; color: #f1f3f6; }
.endu-stat { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 700; color: #f1f3f6; }
.endu-stat::before { content: ""; width: 8px; height: 8px; background: var(--e-g); }
.endu-stat.yellow::before { background: var(--e-y); } .endu-stat.red::before { background: var(--e-r); }
.endu-stat[hidden] { display: none; }
body.mode-endu .endu-view { margin-left: auto; color: #aab2c0; }

/* ---------- tower ---------- */
.endu-table { width: 100%; table-layout: fixed; border-collapse: separate; border-spacing: 0; }
.endu-table th { padding: 5px 3px; font-size: 10px; font-weight: 600; letter-spacing: .1em; color: #7d8696; text-align: left; white-space: nowrap; }
.endu-table .h-pos { width: 46px; padding-left: 12px; } .endu-table .h-no { width: 42px; } .endu-table .h-car { width: 48px; } .endu-table .h-drv { width: 44px; }
.endu-table .h-fuel { width: 58px; } .endu-table .h-gi { width: 70px; text-align: right; } .endu-table .h-last { width: 62px; text-align: right; }
.endu-table .h-lap { width: 40px; text-align: right; } .endu-table .h-tag { width: 82px; }
.endu-table .h-gi .gi-g, .endu-table .h-gi .gi-i { color: #7d8696; }
.endu-table .h-gi .gi-g { color: #fff; font-weight: 800; }
.endu-table .h-gi.int-on .gi-g { color: #7d8696; font-weight: 600; } .endu-table .h-gi.int-on .gi-i { color: #fff; font-weight: 800; }
.endu-table td { padding: 3px 3px; font-size: 14px; font-weight: 700; color: #f1f3f6; border-bottom: 1px solid rgba(255,255,255,.06); white-space: nowrap; font-variant-numeric: tabular-nums; }
.endu-table tr.er td { height: 28px; }
.endu-table .e-pos { position: relative; padding-left: 12px; font-weight: 800; }
.endu-table .e-pos .cbar { position: absolute; left: 0; top: 4px; bottom: 4px; width: 3px; background: var(--cc); }
.endu-table .e-pos .pn { display: inline-block; min-width: 18px; }
.endu-table .pa { font-style: normal; font-size: 8px; margin-left: 3px; vertical-align: 2px; } .endu-table .pa.up { color: var(--e-g); } .endu-table .pa.dn { color: var(--e-r); }
.endu-table .nobox { display: inline-block; min-width: 34px; padding: 1px 5px; text-align: center; font-weight: 800; background: var(--cc); color: var(--cn); clip-path: polygon(5px 0, 100% 0, calc(100% - 5px) 100%, 0 100%); }
.endu-table .e-car { font-weight: 800; } .endu-table .e-drv { color: #8b94a5; font-weight: 600; font-size: 12px; }
.endu-table .e-gap { text-align: right; } .endu-table .e-last { text-align: right; } .endu-table .e-lap { text-align: right; color: #aab2c0; font-size: 12px; }
.endu-table .dash { color: #7d8696; }
.endu-table .ls-p { color: var(--e-p); } .endu-table .ls-g { color: var(--e-g); } .endu-table .ls-y { color: var(--e-y); }
.endu-table .e-tag { padding-left: 6px; overflow: visible; }
.endu-table .e-tag .flag-tag, .endu-table .e-tag .pen-tag { margin: 0; padding: 1px 6px; font-size: 11px; font-weight: 800; border-radius: 2px; transform: skewX(-8deg); display: inline-block; }
.endu-table .e-tag .flag-tag.pit { background: #0ea5e9; color: #fff; } .endu-table .e-tag .flag-tag.pit.done { background: var(--e-g); color: #052e16; }
.endu-table .e-tag .flag-tag.blue { background: #3b82f6; color: #fff; } .endu-table .e-tag .pen-tag { background: #f97316; color: #1a0c00; }

/* fuel: bar vertikal + persen. hijau 100-60, kuning 60-30, merah < 30 */
.endu-table .fuel { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; }
.endu-table .fuel .fb { position: relative; width: 5px; height: 16px; background: #2b3442; display: inline-block; }
.endu-table .fuel .fb u { position: absolute; left: 0; right: 0; bottom: 0; transition: height .8s linear; }
.endu-table .fuel u.ok { background: var(--e-g); } .endu-table .fuel u.mid { background: var(--e-y); } .endu-table .fuel u.low { background: var(--e-r); }

/* baris sendiri: pill slate redup (bukan putih, supaya tidak terlalu kontras dengan latar tower); teks tetap terang seperti baris lain */
.endu-table tr.is-me { background: transparent !important; box-shadow: none !important; }
.endu-table tr.is-me td { background: #3a4352; border-bottom-color: transparent; }
.endu-table tr.is-me td:first-child { border-radius: 14px 0 0 14px; } .endu-table tr.is-me td.e-tag { background: transparent; }
.endu-table tr.is-me td.e-lap { border-radius: 0 14px 14px 0; }
.endu-table tr.is-me .fuel .fb { background: #232a36; }
.endu-table tr.endu-class td { padding: 4px 12px; font-size: 11px; }

/* ---------- panel lap kanan atas (endurance + practice + qualifying) ---------- */
.endu-panel { width: 340px; padding: 0; background: var(--lmu-ink, rgba(10,12,16,.86)); border-top: 2px solid #e5173f; transform: scale(var(--ui-scale, 1)); transform-origin: right top; font-variant-numeric: tabular-nums; }
.endu-panel .ep-top { display: flex; align-items: center; gap: 10px; padding: 8px 12px 6px; border-bottom: 1px solid rgba(255,255,255,.08); }
.endu-panel .ep-who { display: flex; flex-direction: column; line-height: 1.1; min-width: 62px; }
.endu-panel .ep-par { font-size: 20px; font-weight: 800; color: #fff; letter-spacing: .02em; }
.endu-panel .ep-no { font-size: 12px; font-weight: 700; color: #cbd5e1; white-space: nowrap; }
.endu-panel .ep-pills { display: flex; flex-direction: column; gap: 3px; align-items: stretch; flex-shrink: 0; }
.endu-panel .pill { padding: 0 10px; border-radius: 10px; background: #fff; color: var(--e-ink); font-size: 11px; font-weight: 800; line-height: 17px; text-align: center; white-space: nowrap; }
.endu-panel .pill.cls { background: var(--cc); color: #fff; }
.endu-panel .ep-clock { margin-left: auto; font-size: 28px; font-weight: 800; color: #fff; white-space: nowrap; }
.endu-panel .ep-clock.low { color: #f87171; }
.endu-panel .ep-grid { display: grid; grid-template-columns: 82px 1fr 1fr; border-top: 0; }
.endu-panel .ep-grid > * { border-right: 1px solid rgba(255,255,255,.08); border-bottom: 1px solid rgba(255,255,255,.08); }
.endu-panel .ep-grid > :nth-child(2), .endu-panel .ep-grid > :nth-child(5) { border-right: 0; }
.endu-panel .ep-lapn { display: flex; align-items: center; justify-content: center; font-size: 22px; font-weight: 800; color: #fff; padding: 8px 4px; }
.endu-panel .ep-cur { grid-column: 2 / 4; display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding: 8px 12px; border-right: 0; }
.endu-panel .lb-l { font-size: 10px; font-weight: 600; letter-spacing: .12em; color: #8b94a5; }
.endu-panel .ep-t { font-size: 34px; font-weight: 800; color: #fff; }
.endu-panel .ep-dc { display: flex; align-items: center; justify-content: center; padding: 6px 4px; }
.endu-panel .ep-d { font-size: 17px; font-weight: 700; } .endu-panel .ep-d.neg { color: #4ade80; } .endu-panel .ep-d.pos { color: #f87171; }
.endu-panel .lb { position: relative; text-align: right; padding: 6px 12px 7px; }
.endu-panel .lb .lb-l { display: block; } .endu-panel .lb-v { display: block; font-size: 22px; font-weight: 700; color: #fff; }
.endu-panel .lb.sp::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: #fff; }
.endu-panel .lb.sp .lb-l { color: #cbd5e1; }
.endu-panel .lb.neg .lb-v { color: #4ade80; } .endu-panel .lb.neg::after { background: #4ade80; }
.endu-panel .lb.pos .lb-v { color: var(--e-y); } .endu-panel .lb.pos::after { background: var(--e-y); }
/* 3 batang sektor: abu-abu = belum dicetak di lap ini; ungu / hijau / kuning setelah dicetak; reset abu-abu tiap lap baru */
.endu-panel .ep-sec { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 0; padding: 8px 12px 10px; border-top: 0; }
.endu-panel .sec { height: 14px; padding: 0; border-radius: 2px; background: #4b5563; }
.endu-panel .sec.none { background: #4b5563; }
.endu-panel .sec i { font-size: 0; line-height: 0; }
.endu-panel .sec.purple { background: #a855f7; } .endu-panel .sec.green { background: #16a34a; } .endu-panel .sec.yellow { background: #ca8a04; }
/* tutup celah antar-sel pada pill */
.endu-table tr.is-me td:not(.e-lap):not(.e-tag) { box-shadow: 1px 0 0 #3a4352 !important; }

/* trackmap digeser ke kiri panel lap endurance (panel 330px + jarak 12px) supaya tidak bertabrakan */
body.mode-endu .track-minimap-section, body.mode-panel .track-minimap-section { right: calc(24px + 352px * var(--ui-scale, 1)); }
body.mode-panel .lap-panel { display: none !important; }
