/* =========================================
   FireTrail 2026 — tamna tema s vatrenim akcentima iz loga
   ========================================= */
:root {
    --bg: #0B0C10;
    --red: #FF3B3B;
    --red-dark: #cc2f2f;
    --orange: #FF7A1A;
    --yellow: #FFC21A;
    --fire: linear-gradient(90deg, #E8231B 0%, #FF5A1F 45%, #FFB01A 100%);
    --text: #F2F2F2;
    --muted: #9A9CA5;
    --card: rgba(18, 19, 25, 0.58);
    --card-head: rgba(14, 15, 20, 0.95);
    --line: rgba(255, 255, 255, 0.07);
    --row-hover: rgba(255, 122, 26, 0.10);
    --green: #35D07F;
    --header-h: 70px;
    --gap: 12px;
}

* { box-sizing: border-box; }

html, body {
    height: 100%;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    margin: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ---------- LOGO U POZADINI ---------- */
#bg-logo {
    position: fixed;
    inset: -60px;
    background: url("/logo.png") center 58% / min(78vw, 120vh) no-repeat;
    filter: blur(7px) saturate(1.1);
    opacity: 0.26;
    pointer-events: none;
    z-index: 0;
}

/* blaga vatrena svjetlost odozdo */
body::after {
    content: "";
    position: fixed;
    inset: auto 0 0 0;
    height: 40vh;
    background: radial-gradient(ellipse at 50% 100%, rgba(255, 90, 31, 0.10), transparent 70%);
    pointer-events: none;
    z-index: 0;
}

/* ---------- HEADER ---------- */
.header {
    position: relative;
    z-index: 10;
    flex: 0 0 var(--header-h);
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 16px;
    padding: 8px 20px;
    background: rgba(11, 12, 16, 0.78);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.header::after {
    content: "";
    position: absolute;
    left: 0; right: 0; bottom: 0;
    height: 2px;
    background: var(--fire);
}

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

#logo {
    height: 54px;
    width: auto;
    cursor: pointer;
    transition: transform 0.2s, opacity 0.2s;
    filter: drop-shadow(0 2px 8px rgba(255, 90, 31, 0.35));
}

#logo:hover { transform: scale(1.04); opacity: 0.85; }

.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
    min-width: 0;
}

.brand-title {
    font-size: 22px;
    font-weight: 800;
    letter-spacing: 0.5px;
    background: var(--fire);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    white-space: nowrap;
}

.brand-sub {
    font-size: 12px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    white-space: nowrap;
}

.live-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    margin-right: 6px;
    border-radius: 50%;
    background: var(--red);
    box-shadow: 0 0 0 0 rgba(255, 59, 59, 0.6);
    animation: pulse 1.6s infinite;
    vertical-align: 1px;
}

@keyframes pulse {
    0%   { box-shadow: 0 0 0 0 rgba(255, 59, 59, 0.6); }
    70%  { box-shadow: 0 0 0 7px rgba(255, 59, 59, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 59, 59, 0); }
}

/* ---------- ŠTOPERICA ---------- */
.stopwatch-container {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 6px 10px 6px 18px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--line);
}

#stopwatch {
    font-size: 40px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    letter-spacing: 1px;
    min-width: 5.2ch;
    text-align: center;
    transition: color 0.3s, text-shadow 0.3s;
}

#stopwatch.running {
    color: var(--green);
    text-shadow: 0 0 18px rgba(53, 208, 127, 0.35);
}

.sw-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1;
}

.race-state {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--muted);
    margin-top: 2px;
    min-height: 13px;
}

.race-state.finished { color: var(--yellow); }
.race-state.running { color: var(--green); }

#stopwatch.paused {
    color: var(--red);
    text-shadow: 0 0 18px rgba(255, 59, 59, 0.30);
}

.stopwatch-buttons {
    display: flex;
    gap: 6px;
}

.sw-btn {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    background: rgba(255, 59, 59, 0.14);
    border: 1px solid rgba(255, 59, 59, 0.45);
    border-radius: 10px;
    cursor: pointer;
    font-size: 16px;
    color: #fff;
    transition: background 0.15s, transform 0.1s;
}

.sw-btn:hover { background: var(--red); }
.sw-btn:active { transform: scale(0.94); }

/* ---------- GUMBI ---------- */
.actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

.btn {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    padding: 9px 14px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    transition: background 0.15s, border-color 0.15s;
    white-space: nowrap;
}

.btn:hover {
    background: rgba(255, 122, 26, 0.18);
    border-color: var(--orange);
}

.btn-primary {
    background: var(--fire);
    border: none;
    color: #fff;
}

.btn-primary:hover {
    filter: brightness(1.1);
    background: var(--fire);
}

/* ---------- MREŽA TABLICA (jedan red stupaca START → CILJ, puna visina) ----------
   --cols = broj vidljivih punktova (postavlja applyCheckpointLayout u script.js) */
.tables-grid {
    position: relative;
    z-index: 1;
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    padding: var(--gap) 0 var(--gap) var(--gap);
}

/* punktovi su stupci u flexu: kad punkt izlazi ili ulazi, širina mu nježno klizi (flex-grow 0 ↔ 1) */
.tables-grid > .checkpoint-table {
    flex: 1 1 0;
    min-width: 0;
    margin-right: var(--gap);
}
.tables-grid.ready > .checkpoint-table {
    transition: flex-grow 0.8s ease, margin-right 0.8s ease, opacity 0.6s ease, border-width 0.8s ease;
}
.tables-grid > .checkpoint-table.cp-hidden:not(.focused) {
    flex-grow: 0;
    margin-right: 0;
    border-width: 0;
    opacity: 0;
    box-shadow: none;
    overflow: hidden;
    pointer-events: none;
}

/* "Svi punktovi": dva reda po četiri, bez klizanja */
.tables-grid.all {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-template-rows: repeat(2, minmax(0, 1fr));
    gap: var(--gap);
    padding: var(--gap);
}
.tables-grid.all > .checkpoint-table { margin-right: 0; transition: none; }

/* povećan jedan checkpoint (klik na naslov) */
.tables-grid.focus .checkpoint-table { display: none; }
.tables-grid.focus .checkpoint-table.focused {
    display: block;
    grid-column: 1 / -1;
    grid-row: 1 / -1;
    flex: 1 1 0;
    opacity: 1;
}

.checkpoint-table {
    container-type: inline-size;
    position: relative;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 14px;
    overflow-y: auto;
    overflow-x: hidden;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 122, 26, 0.5) transparent;
}

.checkpoint-table::-webkit-scrollbar { width: 6px; }
.checkpoint-table::-webkit-scrollbar-thumb {
    background: rgba(255, 122, 26, 0.5);
    border-radius: 3px;
}

/* naslov checkpointa — ostaje gore pri skrolanju */
.cp-head {
    position: sticky;
    top: 0;
    z-index: 3;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 0 12px;
    background: var(--card-head);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    cursor: pointer;
    user-select: none;
}

.cp-head::after {
    content: "";
    position: absolute;
    left: 12px; right: 12px; bottom: 0;
    height: 2px;
    border-radius: 2px;
    background: var(--fire);
    opacity: 0.85;
}

.cp-name {
    font-size: 15px;
    font-weight: 800;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cp-head:hover .cp-name { color: var(--yellow); }

.cp-count {
    flex: 0 0 auto;
    min-width: 28px;
    padding: 2px 9px;
    border-radius: 999px;
    background: var(--fire);
    color: #fff;
    font-size: 13px;
    font-weight: 800;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.cp-final .cp-name::before { content: "🏁 "; }

/* ---------- TABLICA ---------- */
table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    font-size: 13px;
}

th {
    position: sticky;
    top: 38px;
    z-index: 2;
    background: rgba(14, 15, 20, 0.95);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    text-align: left;
    padding: 5px 6px;
}

td {
    padding: 2px 6px;
    height: 22px;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

td.num, th.num {
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.col-order { width: 30px; color: var(--muted); }
.col-time  { width: 64px; }
.col-diff  { width: 64px; color: var(--muted); }
.col-gap   { width: 62px; color: #fdba74; }
.col-act   { width: 34px; text-align: right; }
td.col-act { overflow: visible; text-overflow: clip; padding-right: 8px; }

tr:hover td { background: var(--row-hover); }

.empty {
    padding: 18px 12px;
    color: var(--muted);
    font-size: 13px;
    text-align: center;
}

/* mali gumbi u redu: pojave se jače na hover */
.row-btn {
    width: 22px;
    height: 19px;
    padding: 0;
    margin-left: 3px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 5px;
    color: var(--muted);
    font-size: 11px;
    line-height: 17px;
    font-family: "Segoe UI Symbol", system-ui, sans-serif;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.15s, background 0.15s, color 0.15s;
}

tr:hover .row-btn { opacity: 1; }
.row-btn svg { width: 11px; height: 11px; vertical-align: -1px; }
.row-btn:hover { background: rgba(255, 255, 255, 0.12); color: #fff; }
.row-btn.del:hover { background: var(--red); border-color: var(--red); }

/* odustali */
tr.dropped-row td {
    background: rgba(255, 59, 59, 0.20);
    color: #ff9d9d;
    font-weight: 700;
}
tr.dropped-row td.num { font-weight: 400; }   /* podebljana vremena ne stanu u stupac */

tr.dropped-row td.col-name::after {
    content: "ODUSTAO";
    margin-left: 6px;
    padding: 1px 5px;
    border-radius: 4px;
    background: var(--red);
    color: #fff;
    font-size: 9px;
    letter-spacing: 0.5px;
    vertical-align: 1px;
}


/* povećani checkpoint: veća slova */
.focused table { font-size: 16px; }
.focused td { height: 32px; }
.focused .col-time, .focused .col-diff, .focused .col-gap { width: 96px; }

/* ---------- POPUP ---------- */
.popup {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 999;
}

.hidden { display: none; }

.popup-content {
    position: relative;
    background: rgba(20, 21, 27, 0.96);
    border: 1px solid rgba(255, 122, 26, 0.45);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 59, 59, 0.15);
    padding: 26px;
    border-radius: 16px;
    width: min(380px, 92vw);
    text-align: center;
}

.popup-content::before {
    content: "";
    position: absolute;
    left: 0; right: 0; top: 0;
    height: 3px;
    border-radius: 16px 16px 0 0;
    background: var(--fire);
}

.popup-content h2 {
    margin: 0 0 18px;
    font-size: 20px;
    color: #fff;
}

.popup-content input,
.popup-content select {
    width: 100%;
    padding: 11px 12px;
    margin-top: 8px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    font-size: 16px;
    outline: none;
}

.popup-content select option { background: #16171d; }

.popup-content input:focus,
.popup-content select:focus {
    border-color: var(--orange);
    box-shadow: 0 0 0 3px rgba(255, 122, 26, 0.2);
}

.popup-buttons {
    margin-top: 18px;
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}

.popup-save,
.popup-continue,
.popup-edit {
    border: none;
    padding: 10px 18px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    color: #fff;
    transition: filter 0.15s, background 0.15s;
}

.popup-save { background: var(--fire); }
.popup-continue, .popup-edit { background: rgba(255, 255, 255, 0.10); }
.popup-save:hover, .popup-continue:hover, .popup-edit:hover { filter: brightness(1.15); }

.popup-close {
    margin-top: 12px;
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    font-size: 14px;
}

.popup-close:hover { color: #fff; }

/* gumb "Odustao" / "Vrati" */
.dropped-btn {
    background: rgba(255, 59, 59, 0.18) !important;
    border: 1px solid var(--red) !important;
    color: #ffb3b3 !important;
}

.dropped-btn:hover {
    background: var(--red) !important;
    color: #fff !important;
}

/* ---------- MANJI EKRANI ---------- */
@media (max-width: 1400px) {
    .brand-text { display: none; }
}

@media (max-width: 980px) {
    body { overflow: auto; height: auto; }
    .header {
        grid-template-columns: auto 1fr;
        grid-template-rows: auto auto;
        height: auto;
        flex: none;
        position: sticky;
        top: 0;
    }
    .actions { grid-column: 1 / -1; justify-content: center; }
    .stopwatch-container { justify-self: end; }
    .tables-grid, .tables-grid.all {
        display: grid;
        gap: var(--gap);
        padding: var(--gap);
        grid-template-columns: repeat(2, minmax(0, 1fr));
        grid-template-rows: none;
        grid-auto-rows: 60vh;
    }
    .tables-grid > .checkpoint-table { margin-right: 0; }
    .tables-grid > .checkpoint-table.cp-hidden:not(.focused) { display: none; }
}

@media (max-width: 640px) {
    .header { grid-template-columns: 1fr; justify-items: center; gap: 8px; padding: 8px 12px; }
    .stopwatch-container { justify-self: center; }
    .brand { justify-content: center; }
    #logo { height: 44px; }
    #stopwatch { font-size: 30px; }
    .sw-btn { width: 34px; height: 34px; }
    .stopwatch-container { padding: 4px 8px 4px 12px; gap: 8px; }
    .tables-grid, .tables-grid.all { grid-template-columns: minmax(0, 1fr); grid-auto-rows: 70vh; }
    .col-time, .col-diff { width: 58px; }
    .col-gap { width: 54px; }
}

/* ---------- VATRENI ISPIS IMENA (novi unos) ---------- */
.fire-name {
    position: relative;
    display: inline-block;
}

.fire-name .ch {
    display: inline-block;
    white-space: pre;
    animation: ignite 1.1s ease-out both;
}

@keyframes ignite {
    0%   { opacity: 0; color: #fff6c2; transform: translateY(5px) scale(1.5);
           filter: blur(3px); text-shadow: 0 0 6px #fff, 0 0 14px #FFC21A, 0 0 24px #FF5A1F, 0 -6px 18px #E8231B; }
    25%  { opacity: 1; color: #FFE27A; transform: translateY(-2px) scale(1.15);
           filter: blur(0); text-shadow: 0 0 4px #fff3b0, 0 0 12px #FFB01A, 0 -4px 16px #FF5A1F; }
    55%  { color: #FF9A2E; transform: translateY(0) scale(1);
           text-shadow: 0 0 8px #FF7A1A, 0 -3px 12px #E8231B; }
    100% { opacity: 1; color: inherit; transform: none; filter: none; text-shadow: none; }
}

/* plamen koji "piše" ime s lijeva na desno */
.fire-name::after {
    content: "🔥";
    position: absolute;
    top: -0.45em;
    left: 0;
    font-size: 1.35em;
    pointer-events: none;
    animation: flame-run var(--dur, 1s) linear var(--d0, 0ms) both,
               flame-out 0.5s ease-in calc(var(--dur, 1s) + var(--d0, 0ms)) forwards;
    filter: drop-shadow(0 0 6px #FF7A1A);
}

@keyframes flame-run {
    from { left: -0.6em; }
    to   { left: 100%; }
}

@keyframes flame-out {
    to { opacity: 0; transform: translateY(-8px) scale(0.6); }
}

/* cijeli novi red kratko zasvijetli vatreno */
tr.flash td { animation: flash 3s ease-out both; animation-delay: var(--d0, 0ms); }
tr.flash td:first-child { animation-name: flash-first; }

@keyframes flash {
    0%   { background: rgba(255, 122, 26, 0.40); }
    100% { background: transparent; }
}

@keyframes flash-first {
    0%   { background: rgba(255, 122, 26, 0.40); box-shadow: inset 3px 0 0 #FFB01A; }
    100% { background: transparent; box-shadow: inset 3px 0 0 transparent; }
}

@media (prefers-reduced-motion: reduce) {
    .fire-name .ch, .fire-name::after, tr.flash td { animation: none !important; }
}

/* ---------- RUČNI UNOS: odabir postojećeg ili novi natjecatelj ---------- */
.suggest-wrap { position: relative; }

.suggest {
    position: absolute;
    left: 0; right: 0;
    top: calc(100% + 4px);
    z-index: 5;
    max-height: 260px;
    overflow-y: auto;
    text-align: left;
    background: #16171d;
    border: 1px solid rgba(255, 122, 26, 0.45);
    border-radius: 10px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
}

.suggest-item {
    padding: 9px 12px;
    cursor: pointer;
    font-size: 15px;
    border-bottom: 1px solid var(--line);
}

.suggest-item:last-child { border-bottom: none; }
.suggest-item:hover, .suggest-item.active { background: rgba(255, 122, 26, 0.16); }
.suggest-item .tail { color: var(--muted); font-size: 12px; margin-left: 6px; }
.suggest-item.new { color: var(--yellow); font-weight: 700; }

.manual-mode {
    min-height: 20px;
    margin-top: 8px;
    font-size: 13px;
    font-weight: 700;
    text-align: left;
}

.manual-mode.existing { color: var(--green); }
.manual-mode.new { color: var(--yellow); }

/* ---------- ZAPISNIK ---------- */
.log-content {
    width: min(1100px, 96vw);
    height: min(80vh, 900px);
    display: flex;
    flex-direction: column;
    text-align: left;
    padding: 20px 20px 12px;
}

.log-head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.log-head h2 { margin: 0; white-space: nowrap; }

.log-head input {
    flex: 1;
    margin: 0;
    font-size: 14px;
    padding: 8px 12px;
}

.btn-danger {
    padding: 8px 12px;
    font-size: 13px;
    background: rgba(255, 59, 59, 0.14);
    border-color: rgba(255, 59, 59, 0.45);
}

.btn-danger:hover {
    background: var(--red);
    border-color: var(--red);
}

.log-x {
    margin: 0;
    font-size: 18px;
    padding: 4px 8px;
}

.log-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    border-radius: 10px;
    border: 1px solid var(--line);
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 122, 26, 0.5) transparent;
}

.log-table { font-size: 13px; }
.log-table th { top: 0; }
.log-table td { height: 26px; }
.log-table td.det { white-space: normal; overflow: visible; }
.lc-ts { width: 90px; }
.lc-race { width: 76px; }
.lc-act { width: 150px; }
.lc-ip { width: 130px; }
.log-table .muted { color: var(--muted); }

.badge {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.10);
    color: #ddd;
}

.badge.scan   { background: rgba(53, 208, 127, 0.18); color: #7be3ab; }
.badge.manual { background: rgba(255, 176, 26, 0.20); color: #ffd27a; }
.badge.del    { background: rgba(255, 59, 59, 0.25);  color: #ff9d9d; }
.badge.timer  { background: rgba(90, 160, 255, 0.20); color: #9cc6ff; }
.badge.warn   { background: rgba(255, 59, 59, 0.45);  color: #fff; }

@media (max-width: 700px) {
    .lc-ip, .log-table td:nth-child(5), .log-table th:nth-child(5) { display: none; }
    .lc-act { width: 110px; }
}

/* ---------- PADAJUĆI IZBORNICI (Slike, Izvoz) ---------- */
.dropdown { position: relative; }
.caret { font-size: 11px; opacity: 0.8; margin-left: 2px; }

.menu {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    min-width: 240px;
    z-index: 50;
    padding: 6px;
    background: rgba(20, 21, 27, 0.97);
    border: 1px solid rgba(255, 122, 26, 0.35);
    border-radius: 12px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(10px);
}

.dropdown.open .menu { display: block; }
.dropdown.open > .btn { border-color: var(--orange); background: rgba(255, 122, 26, 0.18); }

.menu button {
    display: block;
    width: 100%;
    text-align: left;
    padding: 10px 12px;
    background: none;
    border: none;
    border-radius: 8px;
    color: var(--text);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

.menu button:hover { background: rgba(255, 122, 26, 0.16); }

/* ---------- UPLOAD ---------- */
.upload-content { width: min(560px, 94vw); }

.upload-author { margin: 0 0 12px !important; }

.drop-zone {
    display: block;
    padding: 26px 16px;
    border: 2px dashed rgba(255, 122, 26, 0.5);
    border-radius: 14px;
    cursor: pointer;
    color: var(--text);
    transition: background 0.15s, border-color 0.15s;
}

.drop-zone:hover, .drop-zone.over { background: rgba(255, 122, 26, 0.10); border-color: var(--orange); }
.dz-icon { font-size: 30px; margin-bottom: 6px; color: var(--orange); }
.dz-sub { margin-top: 6px; font-size: 12px; color: var(--muted); }

.upload-list { margin-top: 12px; max-height: 240px; overflow-y: auto; text-align: left; }

.up-item {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 4px 10px;
    padding: 7px 4px;
    border-bottom: 1px solid var(--line);
    font-size: 13px;
}

.up-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.up-state { color: var(--muted); font-variant-numeric: tabular-nums; }
.up-state.ok { color: var(--green); }
.up-state.err { color: var(--red); }
.up-bar { grid-column: 1 / -1; height: 4px; border-radius: 2px; background: rgba(255,255,255,0.08); overflow: hidden; }
.up-bar > div { height: 100%; width: 0; background: var(--fire); transition: width 0.2s; }
.upload-note { margin-top: 10px; font-size: 13px; color: var(--muted); min-height: 18px; }
.popup-save:disabled { opacity: 0.45; cursor: default; }

/* ---------- SLIDESHOW ---------- */
.slideshow {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: #000;
    cursor: none;
}

.slideshow.show-ui { cursor: default; }
.slideshow.hidden { display: none; }

.ss-stage { position: absolute; inset: 0; overflow: hidden; }

.ss-img, .ss-video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    opacity: 0;
    transition: opacity 1.2s ease;
}

.ss-img.visible, .ss-video.visible { opacity: 1; }
.ss-img.kenburns { animation: kenburns var(--ss-dur, 7s) ease-out both; }

@keyframes kenburns {
    from { transform: scale(1.0); }
    to   { transform: scale(1.06); }
}

.ss-msg {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    color: var(--muted);
    font-size: 22px;
    text-align: center;
    padding: 20px;
    pointer-events: none;
}

.ss-logo {
    position: absolute;
    top: 18px;
    left: 22px;
    height: 64px;
    opacity: 0.85;
    filter: drop-shadow(0 2px 10px rgba(0, 0, 0, 0.7));
    pointer-events: none;
}

.ss-bar {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px 22px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.75));
    opacity: 0;
    transition: opacity 0.3s;
}

.slideshow.show-ui .ss-bar { opacity: 1; }
.ss-counter { font-weight: 800; color: var(--yellow); font-variant-numeric: tabular-nums; }
.ss-name { flex: 1; color: var(--text); opacity: 0.8; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ss-ctrl { display: flex; gap: 8px; }

.ss-ctrl button {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.25);
    background: rgba(255, 255, 255, 0.10);
    color: #fff;
    font-size: 17px;
    cursor: pointer;
}

.ss-ctrl button:hover { background: var(--red); border-color: var(--red); }

.ss-progress { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; }
.ss-progress > div { height: 100%; width: 0; background: var(--fire); }

/* ---------- UREĐIVANJE PRIVOLE ---------- */
.consent-edit { height: min(90vh, 980px); }
.ce-version { color: var(--muted); font-size: 13px; white-space: nowrap; }
.ce-body { padding: 4px 16px 16px; }
.ce-body h3 { margin: 16px 0 8px; font-size: 15px; color: var(--yellow); }
.ce-hint { color: var(--muted); font-size: 12px; font-weight: 400; }
.ce-body label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.ce-body input, .ce-body textarea {
    display: block; width: 100%; margin-top: 4px; padding: 9px 11px;
    background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.16);
    border-radius: 9px; color: var(--text); font-size: 14px; font-family: inherit; outline: none;
}
.ce-body input:focus, .ce-body textarea:focus { border-color: var(--orange); }
.ce-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.ce-wide { grid-column: 1 / -1; }
.ce-code { font-family: ui-monospace, Consolas, monospace !important; font-size: 12px !important; }
.ce-foot { padding-top: 10px; border-top: 1px solid var(--line); }
.ce-bump { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; text-align: left; cursor: pointer; }
.ce-bump input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--orange); }
@media (max-width: 700px) { .ce-grid { grid-template-columns: 1fr; } }

/* Kratka obavijest (npr. "Link kopiran") */
.toast {
    position: fixed;
    left: 50%;
    bottom: 28px;
    transform: translate(-50%, 20px);
    background: rgba(20, 14, 10, 0.94);
    color: #fff;
    border: 1px solid rgba(255, 122, 26, 0.6);
    border-radius: 10px;
    padding: 10px 18px;
    font-size: 15px;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.5);
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s, transform .25s;
    z-index: 10000;
    max-width: calc(100vw - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Logistika na checkpointu (iz aplikacije) — uz naziv u naslovu kartice */
.cp-staff {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 12px;
    font-weight: 600;
    color: #ffd27a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: right;
}
.cp-name { flex: 0 1 auto; }
.prijevoz-staff { color: #ffd27a; font-weight: 600; }

/* 🆘 Pomoć */
.help-alert {
    background: #d91f1f;
    color: #fff;
    border-color: #ff6b6b;
    font-weight: 800;
    animation: helpPulse 1.1s ease-in-out infinite;
}
@keyframes helpPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255, 59, 59, 0.7); }
    50%      { box-shadow: 0 0 0 10px rgba(255, 59, 59, 0); }
}
.help-map {
    height: 340px;
    border-radius: 10px;
    margin-bottom: 10px;
    border: 1px solid rgba(255, 255, 255, 0.12);
}
tr.help-open td { background: rgba(255, 59, 59, 0.12); }
#helpRows .btn { padding: 4px 10px; font-size: 13px; margin: 2px 0; display: block; width: 100%; box-sizing: border-box; text-align: center; white-space: nowrap; overflow: visible; text-overflow: clip; text-decoration: none; }
#helpRows .help-phone { white-space: nowrap; font-weight: 600; color: var(--green, #35D07F); text-decoration: none; }
#helpContactsText { width: 100%; font-family: inherit; }


/* ---------- GRUPE i POREDAK ---------- */
.seg { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.seg button {
    background: rgba(255, 255, 255, 0.06); color: var(--text); border: 1px solid var(--line);
    border-radius: 999px; padding: 6px 14px; font: inherit; font-size: 14px; cursor: pointer;
}
.seg button:hover { border-color: var(--orange); }
.seg button.on { background: var(--fire); border-color: transparent; color: #fff; font-weight: 700; }
.seg-cp { margin: 0 0 10px; }
.seg-cp button { font-size: 13px; padding: 4px 11px; }
.seg-cp button .n { opacity: .75; margin-left: 4px; font-size: 12px; }
.grp-body { padding: 12px; }
.grp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.grp-card { background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; }
.grp-card.warn { border-color: rgba(255, 194, 26, 0.6); }
.grp-card.bad { border-color: rgba(255, 59, 59, 0.7); }
.grp-head { display: flex; align-items: center; gap: 8px; }
.grp-head b { flex: 1; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grp-size { font-size: 12px; font-weight: 700; padding: 1px 8px; border-radius: 999px; background: rgba(53, 208, 127, 0.15); color: var(--green); }
.grp-card.warn .grp-size { background: rgba(255, 194, 26, 0.15); color: var(--yellow); }
.grp-card.bad .grp-size { background: rgba(255, 59, 59, 0.15); color: var(--red); }
.grp-member { display: flex; align-items: center; gap: 8px; font-size: 14px; padding: 2px 0; border-bottom: 1px solid var(--line); }
.grp-member .bib { color: var(--muted); min-width: 34px; font-variant-numeric: tabular-nums; }
.grp-member .nm { flex: 1; }
.grp-member.dropped .nm { color: var(--red); }
.grp-add { display: flex; gap: 6px; margin-top: 4px; }
.grp-add input { flex: 1; min-width: 0; background: rgba(0, 0, 0, 0.3); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; font: inherit; font-size: 13px; }
.grp-add .btn { padding: 5px 10px; font-size: 13px; }
.grp-free { margin-top: 14px; font-size: 13px; color: var(--muted); line-height: 1.8; }
.grp-free .chip { display: inline-block; background: rgba(255, 255, 255, 0.06); border: 1px solid var(--line); border-radius: 999px; padding: 0 9px; margin: 0 4px 4px 0; color: var(--text); }
#standRows .members { color: var(--muted); font-size: 12px; }
#standRows tr.drop td { color: #ff8a8a; }
#standRows tr.partial td { color: var(--muted); }

/* prekidač Pojedinačno / Grupe u zaglavlju */
.view-toggle { white-space: nowrap; min-width: 150px; }
.view-toggle.grp { border-color: var(--orange); background: rgba(255, 122, 26, 0.18); }
/* Uprava: odjeljci u dva stupca */
.dropdown.open .menu.menu-wide { display: grid; grid-template-columns: repeat(2, minmax(230px, 1fr)); gap: 4px 8px; min-width: 500px; }
.menu-sec { padding: 4px 0; border-top: 1px solid var(--line); }
.menu-sec:nth-child(-n+2) { border-top: none; }
.menu-title { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 6px 12px 2px; }
.menu-wide button { padding: 8px 12px; }
/* grupna tablica u kartici punkta */
.grp-members { display: block; color: var(--muted); font-size: 11px; font-weight: 400; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
tr.grp-partial td { color: var(--muted); }
.col-passed { width: 52px; }
@media (max-width: 720px) { .dropdown.open .menu.menu-wide { grid-template-columns: 1fr; min-width: 250px; } .menu-sec:nth-child(2) { border-top: 1px solid var(--line); } }

/* široki ekrani: tipke desno uvijek u jednom redu (Uprava ne smije pasti ispod), sat između logotipa i tipki */
@media (min-width: 981px) {
    .header { grid-template-columns: auto 1fr auto; }
    .stopwatch-container { justify-self: center; }
    .actions { flex-wrap: nowrap; }
}

/* zaključna arhiva */
.arch-content { height: min(70vh, 700px); }
.arch-state { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 12px 14px; border-radius: 12px;
    border: 1px solid var(--line); background: rgba(255, 255, 255, 0.04); margin-bottom: 10px; }
.arch-state.on { border-color: rgba(53, 208, 127, 0.6); background: rgba(53, 208, 127, 0.08); }
.arch-state .lamp { font-size: 15px; font-weight: 700; }
.arch-state .grow { flex: 1; min-width: 220px; color: var(--muted); font-size: 13px; }
.arch-what { margin: 0 0 10px; line-height: 1.6; }
#archRows .files { color: var(--muted); font-size: 12px; white-space: normal; }

/* ručno dodavanje Logistike */
.staff-add { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 10px; padding: 10px 12px;
    border: 1px solid rgba(255, 122, 26, 0.35); border-radius: 12px; background: rgba(255, 122, 26, 0.06); }
.staff-add.hidden { display: none; }
.staff-add input, .staff-add select { background: rgba(0, 0, 0, 0.35); color: var(--text); border: 1px solid var(--line);
    border-radius: 8px; padding: 8px 10px; font: inherit; font-size: 14px; }
.staff-add #staffAddName { flex: 1 1 200px; }
.staff-add #staffAddPhone { flex: 0 1 190px; }
.staff-add .ce-hint { flex-basis: 100%; }
.staff-add input, .staff-add select { width: auto; margin: 0; }
.staff-add #staffAddName { min-width: 180px; }
.staff-add #staffAddCp { flex: 0 0 170px; }

/* preuzimanje zahvalnice/certifikata: gumb preko cijele širine ćelije, samo strelica */
.dl-btn, .dl-none {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 26px;
    border-radius: 6px;
    text-decoration: none;
}
.dl-btn {
    color: var(--orange);
    background: rgba(255, 122, 26, 0.10);
    border: 1px solid rgba(255, 122, 26, 0.45);
    transition: background .15s, color .15s, border-color .15s;
}
.dl-btn svg { width: 15px; height: 15px; }
.dl-btn:hover { background: var(--orange); border-color: var(--orange); color: #fff; }
.dl-btn.cert { color: var(--yellow); background: rgba(255, 194, 26, 0.10); border-color: rgba(255, 194, 26, 0.45); }
.dl-btn.cert:hover { background: var(--yellow); border-color: var(--yellow); color: #1a1a1a; }
.dl-none { color: var(--muted); opacity: .45; border: 1px dashed rgba(255, 255, 255, 0.12); cursor: help; }

/* Upisani natjecatelji: širi prozor (12 stupaca), ZIP gumbi bez podcrtavanja */
#runnersPopup .log-content { width: min(1560px, 97vw); }
.btn-dl { display: inline-flex; align-items: center; gap: 7px; text-decoration: none; color: var(--text); }
.btn-dl svg { width: 15px; height: 15px; color: var(--orange); }
.btn-dl:hover svg { color: #fff; }

/* Uprava → prazne zahvalnice/certifikati: SVG strelica umjesto emojija */
.menu button .mi-dl { width: 14px; height: 14px; vertical-align: -2px; margin-right: 7px; color: var(--orange); }

/* ---------- PUNKT KROZ KOJI SU PROŠLI SVI (koji su startali, bez odustalih) ---------- */
.checkpoint-table.cp-done {
    border-color: rgba(34, 197, 94, 0.85);
    background: linear-gradient(rgba(34, 197, 94, 0.16), rgba(34, 197, 94, 0.16)), var(--card);
    box-shadow: 0 0 0 1px rgba(34, 197, 94, 0.55), 0 8px 24px rgba(0, 0, 0, 0.35);
}
.cp-done .cp-head { background: rgba(21, 128, 61, 0.55); }
.cp-done .cp-head::after { background: #22c55e; }
.cp-done .cp-count { background: #16a34a; }
.cp-done .cp-name::after { content: " ✓"; color: #86efac; }

#hiddenToggle.on { background: rgba(34, 197, 94, 0.25); border-color: rgba(34, 197, 94, 0.7); }

/* uski stupci: bez stupca Dionica, manji razmaci */
@container (max-width: 330px) {
    .col-diff, th.col-diff { display: none; }
    col.col-diff { width: 0; }
    col.col-order { width: 26px; }
    col.col-time { width: 62px; }
    col.col-gap { width: 50px; }
    td.col-gap { font-size: 11.5px; }
    col.col-act { width: 28px; }
    td, th { padding-left: 4px; padding-right: 4px; }
    .cp-head { padding: 0 8px; }
    .cp-name { font-size: 13px; letter-spacing: 0.3px; }
}

/* tipka "odustao" u retku (zastavica); crvena kad je natjecatelj već odustao */
.row-btn.drop:hover { color: var(--red); }
.row-btn.drop.on { color: var(--red); opacity: 1; }

/* ---------- PUNKT IZGARA (svi su prošli i njega i sljedeći) ----------
   --burn ide od dna prema vrhu: ispod ruba je karta izgorjela (maska), na rubu plamen 🔥 i žar;
   nakon izgaranja .burnt + .cp-hidden skupe stupac, a ostali se nježno prošire */
@property --burn {
    syntax: "<percentage>";
    inherits: true;
    initial-value: 0%;
}
.checkpoint-table.burning {
    pointer-events: none;
    border-color: rgba(255, 122, 26, 0.9);
    transition: border-color 0.5s ease;
    -webkit-mask-image: linear-gradient(to top, transparent var(--burn), #000 calc(var(--burn) + 5%));
            mask-image: linear-gradient(to top, transparent var(--burn), #000 calc(var(--burn) + 5%));
    /* prvih ~0,3 s samo se zažari, zatim plamen jednoliko jede karticu od dna prema vrhu */
    animation: ft-burn 2s cubic-bezier(.42, 0, .58, 1) forwards;
}
.checkpoint-table.burning::before {        /* žar iznad ruba — polako se pojavi */
    content: "";
    position: absolute;
    inset: 0;
    z-index: 5;
    pointer-events: none;
    background: linear-gradient(to top,
        transparent var(--burn),
        rgba(255, 214, 90, 0.9) calc(var(--burn) + 1%),
        rgba(255, 92, 20, 0.75) calc(var(--burn) + 6%),
        rgba(160, 30, 0, 0.38) calc(var(--burn) + 14%),
        rgba(60, 10, 0, 0.15) calc(var(--burn) + 26%),
        transparent calc(var(--burn) + 42%));
    mix-blend-mode: screen;
    opacity: 0;
    animation: ft-glow-in 0.45s ease-out forwards, ft-flicker 0.42s ease-in-out 0.45s infinite alternate;
}
.checkpoint-table.burning::after {         /* plamenovi na rubu — izranjaju ispod kartice */
    content: "🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥";
    position: absolute;
    left: -6px; right: -6px;
    bottom: calc(var(--burn) + 1%);
    z-index: 6;
    pointer-events: none;
    font-size: 30px;
    line-height: 1;
    white-space: nowrap;
    overflow: hidden;
    text-align: left;
    letter-spacing: -9px;
    filter: drop-shadow(0 0 6px rgba(255, 120, 0, 0.9));
    animation: ft-flicker 0.36s ease-in-out infinite alternate;
}
@keyframes ft-burn {
    0%   { --burn: -7%; }
    15%  { --burn: -7%; }
    100% { --burn: 108%; }
}
@keyframes ft-glow-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}
@keyframes ft-flicker {
    from { opacity: 1;    transform: translateY(0); }
    to   { opacity: 0.86; transform: translateY(-1.5px); }
}
/* izgorjelo: nevidljivo odmah (bez povratnog bljeska), samo se širina skuplja */
.tables-grid.ready > .checkpoint-table.burnt {
    opacity: 0;
    transition: flex-grow 0.9s ease, margin-right 0.9s ease, border-width 0.9s ease;
}

/* zaostatak: naslov stupca je ujedno prekidač */
.gap-th { cursor: pointer; text-decoration: underline dotted; text-underline-offset: 3px; }
/* 📱 Spojeni uređaji */
.dev-content { width: min(560px, 92vw); max-width: 560px; }
.dev-content .log-head { justify-content: space-between; }
.dev-hint { margin: 2px 0 10px; }
.dev-table { width: 100%; table-layout: auto; }
.dev-table td { padding: 6px 10px; text-align: left; white-space: nowrap; overflow: visible; }
.dev-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.dev-chart { display: flex; align-items: flex-end; gap: 1px; height: 90px; margin-top: 8px;
             border-bottom: 1px solid rgba(255, 255, 255, 0.25); }
.dev-chart i { flex: 1; min-width: 1px; background: var(--orange); opacity: 0.85; border-radius: 1px 1px 0 0; }

/* ✉️ Poruke Logistici (Uprava) */
.poruka-nova { display: flex; flex-direction: column; gap: 8px; margin: 4px 0 12px; }
.poruka-nova textarea { width: 100%; box-sizing: border-box; resize: vertical; min-height: 70px;
    background: rgba(0,0,0,.35); color: inherit; border: 1px solid rgba(255,255,255,.18);
    border-radius: 10px; padding: 10px 12px; font: inherit; font-size: 15px; }
.poruka-dno { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.log-table td.poruka-tekst { white-space: pre-wrap; word-break: break-word; overflow: visible; text-overflow: clip; }

/* 👁 Pogled: odabrana stavka s kvačicom, kratki opis na tipki */
.menu button.on { color: var(--orange); font-weight: 700; }
.menu button.on::after { content: " ✓"; }
.menu-title-sep { border-top: 1px solid var(--line); margin-top: 4px; padding-top: 8px; }
.view-hint { font-weight: 400; opacity: .75; font-size: .9em; }
@media (max-width: 720px) { .view-hint { display: none; } }
.poruke-tabs { display: flex; gap: 6px; }

/* 📱 Aplikacija (Uprava): istek i logo */
.aplikacija-content { max-width: 760px; }
.aplikacija-body { overflow-y: auto; padding: 4px 18px 18px; display: grid; gap: 18px; }
.aplikacija-body h3 { margin: 6px 0 6px; font-size: 17px; color: #FFB01A; }
.aplikacija-body section { background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.08); border-radius: 12px; padding: 12px 14px; }
.apl-red { display: flex; align-items: center; gap: 10px; margin: 8px 0; flex-wrap: wrap; }
.apl-stup { display: grid; gap: 6px; margin: 8px 0; }
.apl-stup textarea, .apl-red input[type=datetime-local] { background: rgba(0,0,0,.35); color: inherit; border: 1px solid rgba(255,255,255,.18); border-radius: 8px; padding: 8px; font: inherit; }
.apl-dno { display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.apl-dno .ce-hint { margin-right: auto; }
.apl-logo { display: flex; gap: 16px; align-items: center; justify-content: center; flex-wrap: wrap; margin: 10px 0; }
.apl-logo img { max-height: 150px; max-width: 45%; border-radius: 10px; background: rgba(0,0,0,.25); padding: 6px; }

/* 🧯 Zahvalnice za Logistiku · 🧨 reset */
.zahv-log-table td { padding: 4px 6px; }
.zl-in { width: 100%; box-sizing: border-box; background: rgba(0,0,0,.35); color: inherit; border: 1px solid rgba(255,255,255,.15); border-radius: 6px; padding: 6px 8px; font: inherit; }
.menu button.danger { color: #FF6B6B; }
