:root{
    --bg:#0f172a;
    --card:#0b1220;
    --muted:#9aa4b2;
    --accent:#06b6d4;
    --surface:#0b1220;
    --text:#e6eef6;
    --glass: rgba(255,255,255,0.03);
    --radius:12px;
    --gap:12px;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
}

/* reset + layout */
*{
    box-sizing:border-box
}
html,body{
    height:100%
}
body{
    margin:0;
    background: linear-gradient(180deg,var(--bg), #071029 120%);
    color:var(--text);
    -webkit-font-smoothing:antialiased;
    -moz-osx-font-smoothing:grayscale;
    display:flex;
    flex-direction:column;
    min-height: max-content;
    padding-bottom:60px;
}

/* topbar */
.topbar{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:12px;
    padding:12px;
    position:sticky;
    top:0;
    z-index:30;
    backdrop-filter: blur(8px);
    background: linear-gradient(90deg, rgba(10,12,20,0.6), rgba(10,12,20,0.4));
    border-bottom:1px solid rgba(255,255,255,0.03);
}
.brand{
    font-weight:700;
    font-size:1.05rem
}
.tabs {
    display: flex;
    gap: 8px;
    align-items: center;
    flex: 1;
    padding-left: 16px;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;      /* Firefox */
    -ms-overflow-style: none;   /* IE/Edge */
}

.tabs::-webkit-scrollbar {      /* Chrome, Safari */
    display: none;
}

.tab {
    color: wheat;
    background:var(--glass);
    border-radius:10px;
    padding:8px 12px;
    cursor:pointer;
    white-space:nowrap;
    border:1px solid transparent;
    transition:all .18s;
    font-size:0.95rem;
}
.tab.active{
    background:linear-gradient(90deg, rgba(6,182,212,0.12), rgba(6,182,212,0.06));
    border-color:rgba(6,182,212,0.18);
    color:var(--accent)
}

/* print button */
.icon-btn{
    background:transparent;
    border:none;
    color:var(--muted);
    font-size:1.1rem;
    cursor:pointer
}

/* main content */
.content{
    padding:16px;
    max-width:1100px;
    margin:12px auto;
    width:calc(100% - 32px)
}
.center{
    text-align:center;
    color:var(--muted)
}
.hidden{
    display:none
}

/* panels */
.panel{
    background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.01));
    padding:16px;
    border-radius:var(--radius);
    box-shadow: 0 6px 18px rgba(2,6,23,0.7);
    margin-bottom:12px;
    border:1px solid rgba(255,255,255,0.02)
}

/* competition card */
.competition-grid{
    display:grid;
    grid-template-columns: 1fr;
    gap:12px
}
.row{
    display:flex;
    gap:12px;
    align-items:center;
    flex-wrap:wrap
}
.kv{
    flex:1;
    min-width:200px
}
.kv h4{
    margin:0 0 8px 0;
    color:var(--muted);
    font-weight:600;
    font-size:0.85rem
}
.kv p{
    margin:0;
    font-size:1rem;
    color:var(--text)
}

/* accordion */
.accordion{
    display:flex;
    flex-direction:column;
    gap:8px
}
.ac-item{
    background:rgba(255,255,255,0.02);
    border-radius:10px;
    overflow:hidden;
    border:1px solid rgba(255,255,255,0.02)
}
.ac-head{
    padding:10px 12px;
    cursor:pointer;
    display:flex;
    justify-content:space-between;
    align-items:center
}
.ac-title{
    font-weight:600
}
.ac-body{
    padding:0 12px;
    max-height:0;
    overflow:hidden;
    border-top:1px solid rgba(255,255,255,0.02);
    transition:max-height 0.7s ease, padding 0.7s ease;
}
.ac-item.open .ac-body{
    max-height:800px; /* el?g nagy, hogy kif?rjen */
    padding:12px;
}

/* nested lists */
.distance-row{
    display:flex;
    gap:6px;
    align-items:center;
    margin-bottom:8px;
    flex-wrap:wrap
}
.badge{
    background:rgba(255,255,255,0.03);
    padding:6px 8px;
    font-size:0.85rem;
    cursor: pointer;
    pointer-events: auto;
    z-index: 10;
}

/* competitor table */
/* G?rgethet? t?bl?zat mobilon */
.table-container {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 8px;
    font-size: 0.95rem;
    min-width: 600px; /* opcion?lis: ha kisebb kijelz?n is marad ar?nyos */
}

.table th, .table td {
    padding: 8px 10px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    text-align: left;
    white-space: nowrap; /* ne t?rj?n sorba a cella tartalma */
}

.table th {
    color: var(--muted);
    font-weight: 600;
    font-size: 0.82rem;
}
/* Csapatn?v oszlop r?vid?t?se */
.table td.team-col {
    max-width: 150px;        /* itt szab?lyozod, meddig n?het */
    overflow: hidden;
    text-overflow: ellipsis; /* ha t?l hossz?, "..." lesz a v?ge */
    white-space: nowrap;     /* ne t?rj?n sorba */
}

.small{
    font-size:0.9rem;
}

/* final program list */
.program-list{
    display:flex;
    flex-direction:column;
    gap:8px
}
.program-item{
    border-radius:10px;
    overflow:hidden;
    border:1px solid rgba(255,255,255,0.02)
}
.program-head{
    padding:10px 12px;
    display:flex;
    justify-content:space-between;
    align-items:center;
    background:rgba(255,255,255,0.01);
    cursor:pointer
}
.program-body{
    padding:0 12px;
    max-height:0;
    overflow:hidden;
    transition:max-height 0.7s ease, padding 0.7s ease;
}
.program-item.open .program-body{
    max-height:1200px; /* el?g nagy, hogy kif?rjen */
    padding:12px;
}
/* update flash on data refresh */
@keyframes updateFlash {
    0%   {
        background-color: transparent;
        box-shadow: 0 0 0 rgba(6,182,212,0);
    }
    15%  {
        background-color: rgba(6,182,212,0.12);
        box-shadow: 0 0 0 rgba(6,182,212,0.2);
    }
    100% {
        background-color: transparent;
        box-shadow: 0 0 0 rgba(6,182,212,0);
    }
}
.table-container.updated-flash,
.table.updated-flash {
    animation: updateFlash 1.7s ease;
}


/* raw html entries */
.raw-html{
    padding:8px;
    background:rgba(255,255,255,0.02);
    border-radius:8px
}

/* responsive */
@media (min-width:800px){
    .competition-grid{
        grid-template-columns: 1fr 320px
    }
}

/* print rules (nyomtat?bar?t) */
@media print{
    body{
        background:white;
        color:black
    }
    .topbar, .icon-btn, .tabs{
        display:none
    }
    .panel{
        box-shadow:none;
        border:none;
        background:transparent
    }
    .ac-body{
        display:block !important
    }
    .program-body{
        display:block !important
    }
    .table th, .table td{
        color:black;
        border-color:#ddd
    }
}
.program-head .head-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.program-head .arrow {
    font-size: 0.9rem;
    transition: transform 0.2s ease;
    color: var(--muted);
}

/* amikor nyitva van */
.program-item.open .program-head .arrow {
    transform: rotate(180deg);
}
.timePrefix {
    font-size: 0.8rem;
    font-style: italic;
    color: var(--muted);
    margin-right: 6px;
}
.relay-members td {
    font-size: 13px;
    color: #555;
    padding-top: 0;
    padding-bottom: 6px;
    border-top: none;
}
.relay-members em {
    font-style: italic;
    color: #666;
    display: block;
    line-height: 1.3em;
}

.table-container {
    position: relative;
}
/* diagonal sweep animation on refresh */
@keyframes sweepShine {
    0%   {
        left: 0%;
    }
    100% {
        left: 100%;
    }
}
.sweep-in::after {
    content: "";
    position: absolute;
    top: -50%;
    left: 0%;
    width: 50%;
    height: 200%;
    background: linear-gradient( to right, rgba(255,255,255,0) 0%, rgba(255,255,255,0.7) 50%, rgba(255,255,255,0) 100% );
    transform: rotate(20deg);
    animation: sweepShine 1.5s ease;
    pointer-events: none;
}
/* header green tint during sweep */
.sweep-in .table thead th {
    color: #22c55e !important;
    transition: color 0.5s ease;
}
/* Hide scrollbars during sweep animation */
.sweep-in {
    overflow: hidden;            /* clip + no scrollbars */
    -ms-overflow-style: none;    /* IE/Edge (legacy) */
    scrollbar-width: none;       /* Firefox */
}
.sweep-in::-webkit-scrollbar {
    display: none;               /* Chrome/Safari */
}
.result-head {
    color: #33cc00;
}
#qrOverlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.85);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 99999;
    flex-direction: column;
    justify-content: space-evenly;
}

/* A QR mindig n?gyzet! */
#qrOverlay canvas {
    width: min(80vw, 80vh) !important;
    height: min(80vw, 80vh) !important;
    aspect-ratio: 1 / 1;
    image-rendering: pixelated;
    border-radius: 12px;
}

.qr-icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
}

.qr-icon {
    width: 36px;    /* ?ll?tsd 48px-re ha nagyobbat szeretn?l */
    height: 36px;
    fill: white;    /* vagy black a vil?gos h?tt?rhez */
    transition: transform .2s ease;
}

.qr-icon-btn:hover .qr-icon {
    transform: scale(1.15);
}
.share-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 24px;
    font-size: 18px;
    background: linear-gradient(135deg, #ffffff, #dddddd);
    color: #000;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(0,0,0,0.35);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.share-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.45);
}

.share-btn:active {
    transform: scale(0.97);
}

.share-icon {
    width: 26px;
    height: 26px;
    fill: #000;
}

/* Dark m?d ? ha akarod automatikusan */
@media (prefers-color-scheme: dark) {
    .share-btn {
        background: linear-gradient(135deg, #333, #555);
        color: #fff;
    }
    .share-icon {
        fill: #fff;
    }
}

.footer{
    position: fixed;
    width: 100%;
    bottom: 0px;
    display: inline;
    text-align: center;
    background-color: #0A2472;
    color: #c3c9ff;
    text-align: center;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    letter-spacing: 0.5px;
    border-top: 2px solid #6372FD;
}

footer .jogi {
    color: #F6DA61;
    text-decoration: none;
    font-weight: bold;
}

footer .jogi:hover {
    color: #ffffff;
    text-decoration: underline;
}
.types{
    padding-right: 30px;
}
.highlight-race {
    animation: flash 1.5s ease-in-out;
}

@keyframes flash {
    0% {
        box-shadow: 0 0 0px rgba(255,255,0,0);
    }
    50% {
        box-shadow: 0 0 20px rgba(255,255,0.6);
    }
    100% {
        box-shadow: 0 0 0px rgba(255,255,0,0);
    }
}
.gender-head {
    margin-top: 12px;
    margin-bottom: 4px;
    font-weight: bold;
    opacity: .8;
}

.shake {
    animation: shake-row 0.35s ease;
}

@keyframes shake-row {
    0%   {
        margin-left: 0;
    }
    20%  {
        margin-left: -6px;
    }
    40%  {
        margin-left: 6px;
    }
    60%  {
        margin-left: -4px;
    }
    80%  {
        margin-left: 4px;
    }
    100% {
        margin-left: 0;
    }
}
/* --- SEARCH BOX MODERN GLASS STYLE --- */
#searchBox {
    position: relative;
    display: flex;
    align-items: center;
}

#searchBtn {
    color: var(--text);
    padding: 0px;
    cursor: pointer;
    margin-left: 0px;
    font-size: 1.8rem;
    transition: background .2s ease, transform .2s ease;
}

#searchBtn:hover {
    transform: scale(1.15);
}

#searchInput {
    display:none;
    padding: 8px 10px;
    margin-left: 8px;
    border-radius: 8px;
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.25);
    color: white;
    outline: none;
    width: 10px;
    transition: width 0.25s ease;

    -moz-appearance: textfield; /* Firefox */
}

#searchInput::-webkit-inner-spin-button,
#searchInput::-webkit-outer-spin-button {
    -webkit-appearance: none; /* Chrome, Edge, Safari */
    margin: 0;
}
#searchInput::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

#searchInput::-webkit-input-placeholder {
    color: rgba(255, 255, 255, 0.6);
}

#searchInput:-ms-input-placeholder {
    color: rgba(255, 255, 255, 0.6);
}


#searchInput:focus {
    width: 100px;
}

#searchResults {
    position:absolute;
    top: 42px;
    right: 0;
    background: rgba(10,12,20,0.95);
    backdrop-filter: blur(8px);
    color: var(--text);
    border-radius: 10px;
    box-shadow: 0 6px 14px rgba(0,0,0,0.45);
    padding: 10px;
    display: none;
    z-index: 200000; /* QR overlay f?l? ker?l */
    min-width: 260px;
}

#searchResults .racer-header {
    font-weight: bold;
    padding: 6px 0 10px 0;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    margin-bottom: 8px;
    color: var(--accent);
}

#searchResults div[data-id] {
    padding: 6px;
    cursor: pointer;
    border-radius: 6px;
    transition: background .15s ease;
}

#searchResults div[data-id]:hover {
    background: rgba(255,255,255,0.15);
}
.icon-btn {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.25);
    border-radius: 8px;
    padding: 6px;
    cursor: pointer;
    margin-left: 10px;
}

.icon {
    width: 30px;
    height: 30px;
    fill: white;
}
#offlineBanner {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background: #d9534f;
    color: white;
    text-align: center;
    font-size: 15px;
    z-index: 9999;
    font-weight: bold;
}

.show {
    display: block;
}
.pb-badge {
    display: inline-block;
    background: linear-gradient(90deg, #ff4800, #ff9d00);
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.75em;
    font-weight: bold;
    margin-left: 6px;
    box-shadow: 0 0 6px rgba(255, 120, 0, 0.6);
}
.filters-grid {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    margin-top: 14px;
}
.filter-label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    color: var(--muted);
    font-size: 0.9rem;
}
.filter-input {
    background-color: #0A2472;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.12);
    background: var(--glass);
    color: var(--text);
    outline: none;
}
.filter-input:focus {
    border-color: rgba(6,182,212,0.4);
    box-shadow: 0 0 0 3px rgba(6,182,212,0.12);
    background-color: #0A2472;
}
.muted {
    color: var(--muted);
}
.stat-meta {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    flex-wrap: wrap;
}
.ghost-btn {
    background: rgba(255,255,255,0.06);
    color: var(--text);
    border: 1px solid rgba(255,255,255,0.15);
    padding: 10px 14px;
    border-radius: 10px;
    cursor: pointer;
    transition: transform .15s ease, border .15s ease;
}
.ghost-btn:hover {
    transform: translateY(-1px);
    border-color: rgba(6,182,212,0.35);
}
.pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(6,182,212,0.14);
    color: var(--text);
    font-size: 0.85rem;
}
.pill button {
    background: transparent;
    border: none;
    color: var(--text);
    cursor: pointer;
    font-size: 0.95rem;
}
.table-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 6px;
}
.time-col {
    font-variant-numeric: tabular-nums;
}



