:root {
    --bg: #0d1016;
    --card: rgba(18, 22, 30, 0.92);
    --line: rgba(255, 255, 255, 0.10);
    --txt: #e8ecf2;
    --dim: #8c97a8;
    --accent: #ffb703;
    --red: #e03131;
    --blue: #1c7ed6;
    --white: #f1f3f5;
    --yellow: #fcc419;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    height: 100%;
    overflow: hidden;
    background: var(--bg);
    color: var(--txt);
    font: 15px/1.5 "Segoe UI", system-ui, sans-serif;
    -webkit-user-select: none;
    user-select: none;
    touch-action: none;
}

#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }

.hidden { display: none !important; }

/* ------------------------------------------------------------- menu */

#ui {
    position: fixed;
    inset: 0;
    overflow: hidden;
    z-index: 30;
}

/* wideo w tle - klatka po klatce, dekodowane sprzętowo */
#bgVideo {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 0;
}
#bgShade {
    position: absolute;
    inset: 0;
    z-index: 1;
    background:
        linear-gradient(90deg, rgba(10, 12, 16, 0.97) 0%, rgba(10, 12, 16, 0.92) 28%, rgba(10, 12, 16, 0.35) 52%, rgba(10, 12, 16, 0) 72%),
        linear-gradient(0deg, rgba(10, 12, 16, 0.55), rgba(10, 12, 16, 0) 45%);
}

/* dynamiczny wjazd elementów menu z lewej (poza ekran -> na miejsce) */
@keyframes slideIn {
    from { opacity: 0; transform: translateX(-90px); }
    to { opacity: 1; transform: none; }
}
@keyframes logoIn {
    0% { opacity: 0; transform: translateX(-120px) rotate(-6deg); }
    60% { opacity: 1; }
    100% { opacity: 1; transform: none; }
}
.menuBox.enter > * { animation: slideIn .5s cubic-bezier(.18, .8, .25, 1) backwards; }
.menuBox.enter > #logo { animation: logoIn .6s cubic-bezier(.18, .8, .25, 1) backwards; }
.menuBox.enter > *:nth-child(1) { animation-delay: .00s; }
.menuBox.enter > *:nth-child(2) { animation-delay: .07s; }
.menuBox.enter > *:nth-child(3) { animation-delay: .13s; }
.menuBox.enter > *:nth-child(4) { animation-delay: .19s; }
.menuBox.enter > *:nth-child(5) { animation-delay: .25s; }
.menuBox.enter > *:nth-child(6) { animation-delay: .31s; }
.menuBox.enter > *:nth-child(7) { animation-delay: .37s; }
.menuBox.enter > *:nth-child(8) { animation-delay: .43s; }
.menuBox.enter > *:nth-child(9) { animation-delay: .49s; }
.menuBox.enter > *:nth-child(10) { animation-delay: .55s; }

@keyframes cardPop {
    from { opacity: 0; transform: translate(-50%, -46%) scale(.94); }
    to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}
.card:not(.hidden) { animation: cardPop .28s ease backwards; }

/* lewy panel menu */
.menuBox {
    position: absolute;
    left: max(24px, 4vw);
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    width: 440px;
    max-width: calc(100% - 40px);
    max-height: 94vh;
    overflow-y: auto;
    padding: 4px;
    scrollbar-width: none;          /* Firefox */
    -ms-overflow-style: none;       /* stary Edge */
}
.menuBox::-webkit-scrollbar { display: none; } /* Chrome/Safari */

.menuTop { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.topLink {
    display: inline-flex; align-items: center; gap: 6px;
    background: rgba(20, 24, 32, .6);
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--txt);
    font-size: 13px;
    font-weight: 600;
    padding: 8px 12px;
}
.topLink:hover { border-color: var(--accent); color: var(--accent); }
.topLink .lico { width: 15px; height: 15px; }

.roomInput {
    width: 100%;
    padding: 13px 15px;
    margin-bottom: 16px;
    background: rgba(20, 24, 32, .72);
    border: 1px solid var(--line);
    border-radius: 9px;
    color: var(--txt);
    font-size: 15px;
    outline: none;
}
.roomInput:focus { border-color: var(--accent); }
#logo { width: 300px; max-width: 78%; display: block; margin-bottom: 22px; filter: drop-shadow(0 6px 20px rgba(0,0,0,.6)); }
.lead2 { font-size: 16px; font-weight: 700; letter-spacing: .04em; line-height: 1.5; color: var(--txt); margin-bottom: 24px; }
.lead2 .acc { color: var(--accent); }

.nameRow { display: flex; gap: 10px; margin-bottom: 16px; }
.nameRow input {
    flex: 1; min-width: 0;
    padding: 12px 13px;
    background: rgba(20, 24, 32, .72);
    border: 1px solid var(--line);
    border-radius: 9px;
    color: var(--txt);
    font-size: 14px;
    outline: none;
}
.nameRow input:focus { border-color: var(--accent); }

.mbtn {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 15px 20px;
    margin-bottom: 10px;
    background: rgba(24, 28, 36, .82);
    border: 1px solid var(--line);
    border-radius: 11px;
    color: var(--txt);
    font-size: 15px;
    font-weight: 700;
    letter-spacing: .05em;
    text-align: left;
}
.mbtn .ico { width: 22px; height: 22px; flex: none; }
.mbtn:hover { background: rgba(36, 42, 52, .9); border-color: rgba(255,255,255,.2); }
.mbtn.primary { background: var(--accent); color: #1a1200; border-color: transparent; box-shadow: 0 8px 24px rgba(255,183,3,.25); }
.mbtn.primary:hover { filter: brightness(1.06); background: var(--accent); }

.hcCard {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    text-align: left;
    padding: 13px 16px;
    margin: 6px 0 18px;
    background: rgba(18, 21, 28, .7);
    border: 1px solid var(--line);
    border-radius: 11px;
}
.hcCard .hcIco { width: 28px; height: 28px; flex: none; opacity: .5; color: var(--dim); }
.link .lico { width: 15px; height: 15px; vertical-align: -3px; margin-right: 5px; }
.hcCard .hcTxt { display: flex; flex-direction: column; gap: 3px; }
.hcCard .hcTxt b { font-size: 13px; letter-spacing: .06em; color: var(--dim); }
.hcCard .hcTxt small { font-size: 11px; color: var(--dim); line-height: 1.35; }
.hcCard.on { border-color: var(--accent); background: rgba(255,183,3,.08); }
.hcCard.on .hcIco { opacity: 1; color: var(--accent); }
.hcCard.on .hcTxt b { color: var(--accent); }

/* modal (popup) - np. otwarte tory */
.modal { position: fixed; inset: 0; z-index: 45; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modalBack { position: absolute; inset: 0; background: rgba(5, 7, 11, .72); backdrop-filter: blur(4px); }
.modalCard {
    position: relative;
    width: 100%; max-width: 460px;
    max-height: 84vh;
    overflow-y: auto;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 22px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, .7);
    animation: modalPop .25s ease backwards;
}
@keyframes modalPop { from { opacity: 0; transform: scale(.94); } to { opacity: 1; transform: none; } }
.helmetPick { display: flex; align-items: center; gap: 8px; margin: -4px 0 12px; flex-wrap: wrap; }
.helmetLabel { font-size: 12px; color: var(--dim); margin-right: 2px; }
.trackPick { display: flex; align-items: center; gap: 6px; margin: 8px 0 12px; flex-wrap: wrap; }
.trk { background: rgba(255,255,255,.06); border: 1px solid var(--line); color: var(--dim); border-radius: 8px; padding: 4px 10px; font-size: 12px; cursor: pointer; }
.trk:hover { color: #fff; }
.trk.on { border-color: var(--accent); color: var(--accent); background: rgba(255,183,3,.12); }
.rtrack { font-size: 11px; color: var(--accent); opacity: .85; }
.helm {
    width: 52px; height: 52px;
    padding: 3px;
    background: rgba(255, 255, 255, .04);
    border: 2px solid var(--line);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
}
.helm img { width: 100%; height: 100%; object-fit: contain; display: block; }
.helm:hover { border-color: rgba(255, 255, 255, .3); }
.helm.on { border-color: var(--accent); background: rgba(255, 183, 3, .12); }
.helm[disabled] { opacity: .3; cursor: not-allowed; filter: grayscale(0.6); }
#lobbyHelmet { justify-content: flex-start; margin: 4px 0 12px; }

.joinHc { display: flex; align-items: flex-start; gap: 9px; font-size: 12px; color: var(--dim); margin: -4px 0 14px; cursor: pointer; line-height: 1.4; }
.joinHc input { margin-top: 1px; width: 16px; height: 16px; accent-color: var(--accent); flex: none; }
.joinHc b { color: var(--txt); }
.modalHead { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.modalHead h2 { margin: 0; }
.xbtn { background: none; color: var(--dim); font-size: 20px; line-height: 1; padding: 4px 8px; }
.xbtn:hover { color: var(--txt); }
#roomsModal #roomList { list-style: none; }
#roomsModal #roomList li {
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px 12px; border-radius: 8px; font-size: 13px;
}
#roomsModal #roomList li:nth-child(odd) { background: rgba(255, 255, 255, .03); }
#roomsModal #roomList li.empty { color: var(--dim); justify-content: center; }
#roomsModal #roomList button { background: rgba(255, 255, 255, .08); color: var(--txt); padding: 6px 12px; font-size: 12px; border-radius: 7px; }

.authSocial { margin-bottom: 12px; }
.socialBtn {
    display: flex; align-items: center; justify-content: center; gap: 10px;
    width: 100%; padding: 11px;
    margin-bottom: 8px;
    background: #fff; color: #1a1a1a;
    border: none; border-radius: 9px;
    font-size: 14px; font-weight: 600;
}
.socialBtn:hover { filter: brightness(0.95); }
.authOr { display: flex; align-items: center; gap: 10px; color: var(--dim); font-size: 11px; margin: 12px 0 4px; }
.authOr::before, .authOr::after { content: ''; flex: 1; height: 1px; background: var(--line); }

#authForm input, #authForgotView input, #authResetView input {
    width: 100%;
    padding: 12px 13px;
    margin-bottom: 10px;
    background: rgba(255, 255, 255, .05);
    border: 1px solid var(--line);
    border-radius: 9px;
    color: var(--txt);
    font-size: 15px;
    outline: none;
}
#authForm input:focus, #authForgotView input:focus, #authResetView input:focus { border-color: var(--accent); }
.authError { color: #ff8787; font-size: 12px; min-height: 16px; margin-bottom: 8px; }
.profRow { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.profRow b { color: var(--accent); font-size: 16px; }
.profStats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.profStats > div { background: rgba(255, 255, 255, .04); border: 1px solid var(--line); border-radius: 10px; padding: 12px; text-align: center; }
.profStats b { display: block; font-size: 22px; font-weight: 800; }
.profStats span { font-size: 11px; color: var(--dim); }

#rankTable, #recTable, #careerTable { width: 100%; border-collapse: collapse; font-size: 13px; }
#rankTable th, #recTable th, #careerTable th { text-align: left; color: var(--dim); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; padding: 6px 6px; border-bottom: 1px solid var(--line); }
#rankTable td, #recTable td, #careerTable td { padding: 8px 6px; border-bottom: 1px solid var(--line); }
#rankTable td.pos, #careerTable td.pos { color: var(--accent); font-weight: 700; width: 30px; }
#rankTable td.pts, #recTable td.pts, #careerTable td.pts { text-align: right; font-weight: 700; }
#rankTable tr.me td, #recTable tr.me td, #careerTable tr.me td { color: var(--accent); }
.careerSeason { color: var(--dim); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 8px; }
.careerRound { margin: 14px 0 10px; font-weight: 700; }
.careerDone { margin: 16px 0 12px; font-weight: 800; font-size: 18px; color: #ffd43b; text-align: center; }
.rankTabs { margin-bottom: 12px; }
.recNone { color: var(--dim); }
.rankPager { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 10px; }
.pgBtn {
    width: 34px; height: 34px; border-radius: 8px;
    background: rgba(255, 255, 255, .05); border: 1px solid var(--line);
    color: var(--txt); font-size: 18px; line-height: 1; cursor: pointer;
}
.pgBtn:disabled { opacity: .35; cursor: default; }
.pgBtn:not(:disabled):hover { border-color: var(--accent); color: var(--accent); }
.pgInfo { color: var(--dim); font-size: 12px; min-width: 96px; text-align: center; }

.botLinks { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 16px; padding-top: 8px; border-top: 1px solid var(--line); margin-top: 4px; }
.gtag { display: inline-block; font-size: 10px; text-transform: uppercase; letter-spacing: .04em; color: var(--dim); border: 1px solid var(--line); border-radius: 6px; padding: 1px 5px; margin-left: 6px; vertical-align: middle; }
.skull { width: 15px; height: 15px; margin-right: 6px; vertical-align: -3px; color: var(--red); }
.you { color: var(--accent); font-weight: 700; }
.squadBtn { pointer-events: auto; background: rgba(10,13,19,.72); color: var(--txt);
    border: 1px solid var(--line); border-radius: 10px; padding: 0 16px; font-size: 13px;
    font-weight: 600; cursor: pointer; letter-spacing: .02em; }
.squadBtn:hover { border-color: var(--accent); color: #fff; }
#squadBody { display: flex; gap: 16px; flex-wrap: wrap; }
.squad { flex: 1 1 220px; }
.squad h4 { display: flex; align-items: center; gap: 8px; margin: 6px 0; }
.squad h4 .sc { margin-left: auto; color: var(--dim); font-weight: 600; }
.squad .legend { font-size: 12px; color: var(--dim); margin-bottom: 8px; }
.squad .chip { display: inline-flex; align-items: center; gap: 4px; margin-right: 10px; }
.hmini { width: 22px; height: 22px; object-fit: contain; vertical-align: middle; }
.roster { list-style: none; padding: 0; margin: 0; }
.roster li { display: flex; justify-content: space-between; gap: 10px; padding: 4px 8px; border-radius: 6px; font-size: 13px; }
.roster li.me { background: rgba(255,183,3,.12); }
.roster .rp { color: var(--dim); font-variant-numeric: tabular-nums; white-space: nowrap; }
tr.heatsum td { color: var(--dim); font-size: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
tr.heatsum .team { display: inline-flex; align-items: center; gap: 5px; margin: 0 4px; }
.rstate { font-size: 11px; color: var(--dim); font-style: italic; }
#roomList button[disabled] { opacity: .35; cursor: not-allowed; filter: grayscale(1); }
.langPick { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; margin-top: 16px; }
.langBtn { width: 30px; height: 20px; padding: 0; border: 1px solid var(--line); border-radius: 4px; overflow: hidden; cursor: pointer; background: none; opacity: .5; transition: opacity .15s, transform .15s, border-color .15s; }
.langBtn svg { width: 100%; height: 100%; display: block; }
.langBtn:hover { opacity: .9; }
.langBtn.on { opacity: 1; border-color: var(--accent); transform: scale(1.1); }
.menuFooter { display: flex; gap: 8px; align-items: center; margin-top: 14px; font-size: 12px; color: var(--dim); }
.menuFooter a { color: var(--dim); text-decoration: none; }
.menuFooter a:hover { color: #fff; text-decoration: underline; }
.roomsDrop {
    list-style: none;
    margin-top: 12px;
    max-height: 180px;
    overflow-y: auto;
    background: rgba(14, 17, 23, .9);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 6px;
}

.card {
    position: absolute;
    left: 50%; top: 50%;
    transform: translate(-50%, -50%);
    z-index: 3;
    width: calc(100% - 40px);
    max-width: 440px;
    max-height: 92vh;
    overflow-y: auto;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 26px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, .7);
    backdrop-filter: blur(6px);
}

.rulesGrid { display: flex; flex-direction: column; gap: 8px; margin: 8px 0 16px; }
.rulesGrid > div { display: flex; align-items: baseline; gap: 12px; font-size: 13px; }
.rulesGrid b { color: var(--accent); min-width: 64px; font-size: 13px; }
.rulesGrid span { color: var(--dim); }
.rulesList { margin: 0 0 4px 18px; font-size: 13px; color: var(--dim); }
.rulesList li { margin-bottom: 6px; }
.rulesList b { color: var(--txt); }

@media (max-width: 640px) {
    .menuBox {
        left: 0; right: 0; top: 0;
        transform: none;
        width: auto; max-width: none;
        margin: 0;
        padding: 18px 20px;
        max-height: 100vh;
    }
    #bgShade { background: linear-gradient(0deg, rgba(10,12,16,.97) 8%, rgba(10,12,16,.72) 55%, rgba(10,12,16,.5) 100%); }
    #logo { width: 220px; margin-bottom: 16px; }
    .lead2 { font-size: 14px; margin-bottom: 16px; }
}

h1 {
    font-size: 34px;
    letter-spacing: .14em;
    font-weight: 800;
    margin-bottom: 2px;
}
h1 span { color: var(--accent); letter-spacing: .05em; font-weight: 400; font-size: 20px; }
h2 { font-size: 20px; margin-bottom: 14px; }

.lead { color: var(--dim); font-size: 13px; margin-bottom: 20px; }
.note { color: var(--dim); font-size: 12px; margin-top: 14px; }

.field { display: block; margin-bottom: 12px; }
.field span { display: block; font-size: 12px; color: var(--dim); margin-bottom: 5px; }
.field input {
    width: 100%;
    padding: 11px 13px;
    background: rgba(255, 255, 255, .05);
    border: 1px solid var(--line);
    border-radius: 9px;
    color: var(--txt);
    font-size: 15px;
    outline: none;
}
.field input:focus { border-color: var(--accent); }

button {
    font: inherit;
    cursor: pointer;
    border: none;
    border-radius: 9px;
}
button.primary {
    width: 100%;
    padding: 13px;
    background: var(--accent);
    color: #1a1200;
    font-weight: 700;
    letter-spacing: .04em;
}
button.primary:hover { filter: brightness(1.08); }
button.primary:disabled { background: #4a4d55; color: #9aa2ae; cursor: default; }
button.ghost {
    padding: 13px 18px;
    background: transparent;
    border: 1px solid var(--line);
    color: var(--dim);
}
.link { background: none; border: none; color: var(--accent); font-size: 12px; padding: 0; text-decoration: none; display: inline-flex; align-items: center; cursor: pointer; }
.link:hover { text-decoration: underline; }

.menuLinks { display: flex; gap: 16px; justify-content: center; margin-top: 12px; }

.optRow {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
    font-size: 14px;
}
.optRow.slim { padding: 6px 0 10px; }
.optRow > span { color: var(--txt); }
.optRow input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--accent); }
.optRow input[type="range"] { width: 150px; accent-color: var(--accent); }
.optSep { font-size: 11px; color: var(--dim); text-transform: uppercase; letter-spacing: .06em; margin: 16px 0 4px; }
.seg { display: flex; gap: 6px; }
.seg button, .camGrid button {
    padding: 7px 10px;
    background: rgba(255, 255, 255, .05);
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--dim);
    font-size: 12px;
    cursor: pointer;
}
.seg button.on, .camGrid button.on { border-color: var(--accent); color: var(--accent); background: rgba(255, 183, 3, .10); }

/* wybór kamery: etykieta nad siatką przycisków - nie rozjeżdża się na mobile */
.camRow { flex-direction: column; align-items: stretch; gap: 8px; }
.camGrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)); gap: 6px; }
.camGrid button { text-align: center; }

.modes { display: flex; gap: 8px; margin-bottom: 14px; }
.mode-btn {
    flex: 1;
    padding: 10px;
    background: rgba(255, 255, 255, .04);
    border: 1px solid var(--line);
    border-radius: 10px;
    color: var(--dim);
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.mode-btn b { color: var(--txt); font-size: 13px; }
.mode-btn small { font-size: 11px; }
.mode-btn.active { border-color: var(--accent); background: rgba(255, 183, 3, .10); }
.mode-btn.active b { color: var(--accent); }

/* lobby drużynowe */
#teams { display: flex; gap: 10px; margin-bottom: 8px; }
.teamcol { flex: 1; border: 1px solid var(--line); border-radius: 10px; padding: 10px; }
.teamcol h4 { font-size: 13px; margin-bottom: 8px; display: flex; align-items: center; gap: 7px; }
.teamcol h4 .dot { width: 12px; height: 12px; border-radius: 50%; }
.teamcol ul { list-style: none; }
.teamcol li { font-size: 13px; padding: 4px 0; display: flex; justify-content: space-between; gap: 6px; }
.teamcol li.me { color: var(--accent); font-weight: 700; }
.teamcol li .rd { color: #51cf66; font-size: 11px; }
.teamcol li.free { color: var(--dim); opacity: .6; font-style: italic; }

/* pasek meczu w HUD */
#matchBar {
    position: absolute;
    top: 14px; left: 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(10, 13, 19, .72);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 5px 14px;
    font-size: 14px;
    white-space: nowrap;
}
#matchBar .heat { color: var(--dim); font-size: 12px; }
#matchBar .sc { font-weight: 800; font-size: 17px; }
#matchBar .vs { color: var(--dim); margin: 0 2px; }

/* wyniki meczu */
#matchScore {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    margin-bottom: 14px;
    font-size: 15px;
}
#matchScore .team { display: flex; align-items: center; gap: 7px; font-weight: 700; }
#matchScore .team .dot { width: 14px; height: 14px; border-radius: 50%; }
#matchScore .big { font-size: 30px; font-weight: 900; }
#matchScore .win { color: var(--accent); }
#resultTable td.tm { width: 16px; }
#scorers { margin-top: 12px; font-size: 12px; color: var(--dim); }
#scorers .sr { display: flex; justify-content: space-between; padding: 2px 0; }
#scorers h4 { color: var(--txt); font-size: 12px; margin-bottom: 5px; text-transform: uppercase; letter-spacing: .05em; }

.check {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    margin-bottom: 14px;
    font-size: 12px;
    color: var(--dim);
    cursor: pointer;
    line-height: 1.4;
}
.check input { margin-top: 2px; width: 16px; height: 16px; accent-color: var(--accent); flex: none; }
.check b { color: var(--txt); }

.badge-hc {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: #ff8787;
    border: 1px solid rgba(255, 107, 107, .5);
    border-radius: 5px;
    padding: 1px 6px;
    margin-left: 6px;
    vertical-align: middle;
}

.row { display: flex; gap: 10px; margin-top: 6px; }
.row .primary { flex: 1; }

.rooms { margin-top: 22px; border-top: 1px solid var(--line); padding-top: 14px; }
.roomsHead { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--dim); margin-bottom: 8px; }
#roomList { list-style: none; max-height: 150px; overflow-y: auto; }
#roomList li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 13px;
}
#roomList li:nth-child(odd) { background: rgba(255, 255, 255, .03); }
#roomList li.empty { color: var(--dim); justify-content: center; font-size: 12px; }
#roomList button { background: rgba(255, 255, 255, .08); color: var(--txt); padding: 5px 11px; font-size: 12px; }

/* ------------------------------------------------------------- lobby */

#seats { list-style: none; margin-bottom: 14px; }
#seats li {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    margin-bottom: 7px;
    font-size: 14px;
}
#seats .dot { width: 14px; height: 14px; border-radius: 50%; flex: none; box-shadow: 0 0 0 2px rgba(0, 0, 0, .4); }
#seats .who { flex: 1; }
#seats .tag { font-size: 11px; color: var(--dim); text-transform: uppercase; letter-spacing: .06em; }
#seats .tag.ok { color: #51cf66; }
#seats li.free { opacity: .45; }
#seats li.me { border-color: var(--accent); }

.status { font-size: 13px; color: var(--dim); text-align: center; margin: 12px 0; min-height: 20px; }

#resultTable { width: 100%; border-collapse: collapse; font-size: 14px; }
#resultTable td { padding: 9px 6px; border-bottom: 1px solid var(--line); }
#resultTable td.pos { width: 30px; color: var(--accent); font-weight: 700; }
#resultTable td.col { width: 20px; }
#resultTable td.pts { text-align: right; color: var(--dim); }
#resultTable tr.me td { color: var(--accent); }
#resultTable .dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; }

/* ------------------------------------------------------------- HUD */

#hud { position: fixed; inset: 0; pointer-events: none; z-index: 10; }

#hudTop {
    position: absolute;
    top: 14px; left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
}
.panel {
    background: rgba(10, 13, 19, .72);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 6px 14px;
    display: flex;
    align-items: baseline;
    gap: 5px;
}
.panel .big { font-size: 22px; font-weight: 800; line-height: 1; }
.panel .sub { font-size: 11px; color: var(--dim); }

.cornerBtn {
    position: absolute; top: 12px; right: 12px; z-index: 6; pointer-events: auto;
    width: 34px; height: 34px; border-radius: 50%;
    background: rgba(10, 13, 19, .72); border: 1px solid var(--line);
    color: var(--txt); font-size: 15px; cursor: pointer; line-height: 1;
}
.cornerBtn:hover { border-color: var(--red); color: #fff; }

#standings {
    position: absolute;
    top: 54px; right: 14px;
    background: rgba(10, 13, 19, .72);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 8px 10px;
    font-size: 12px;
    min-width: 155px;
}
#standings .r { display: flex; align-items: center; gap: 7px; padding: 3px 0; }
#standings .r .n { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#standings .r .g { color: var(--dim); font-size: 11px; }
#standings .r.me { color: var(--accent); font-weight: 700; }
#standings .dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
#standings .out { color: #ff6b6b; }

#hudBottom {
    position: absolute;
    left: 14px; bottom: 14px;
    display: flex;
    align-items: flex-end;
    gap: 14px;
}
#minimap {
    background: rgba(10, 13, 19, .62);
    border: 1px solid var(--line);
    border-radius: 10px;
}
#speedo { width: 190px; }
.speedVal { display: flex; align-items: baseline; gap: 5px; }
#speedNum { font-size: 40px; font-weight: 800; line-height: 1; text-shadow: 0 2px 12px rgba(0, 0, 0, .8); }
.unit { font-size: 12px; color: var(--dim); }
.speedBar { height: 6px; background: rgba(255, 255, 255, .10); border-radius: 3px; margin-top: 5px; overflow: hidden; }
.speedBar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #51cf66, var(--accent) 65%, var(--red)); }

#lights {
    position: absolute;
    top: 24%; left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 14px;
    opacity: 0;
    transition: opacity .25s;
}
#lights.on { opacity: 1; }
#lights i {
    width: 26px; height: 26px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .10);
    border: 2px solid rgba(255, 255, 255, .18);
}
#lights i.lit { background: var(--red); border-color: #ff8787; box-shadow: 0 0 22px var(--red); }
#lights.go i { background: #51cf66; border-color: #8ce99a; box-shadow: 0 0 26px #51cf66; }

#bigMsg {
    position: absolute;
    top: 38%; left: 50%;
    transform: translate(-50%, -50%);
    font-size: 46px;
    font-weight: 900;
    letter-spacing: .05em;
    text-shadow: 0 4px 30px rgba(0, 0, 0, .9);
    opacity: 0;
    transition: opacity .2s;
    text-align: center;
}
#bigMsg.show { opacity: 1; }
#bigMsg.record {
    color: #ffd43b;
    text-shadow: 0 0 26px rgba(255, 212, 59, .9), 0 4px 30px rgba(0, 0, 0, .9);
    animation: recordPop .55s cubic-bezier(.2, 1.4, .4, 1);
    display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.recIco {
    width: 56px; height: 56px;
    filter: drop-shadow(0 0 16px rgba(255, 212, 59, .8));
}
@keyframes recordPop {
    0% { transform: translate(-50%, -50%) scale(.4); }
    100% { transform: translate(-50%, -50%) scale(1); }
}

#flash {
    position: absolute; inset: 0;
    background: #e03131;
    opacity: 0;
    transition: opacity .3s;
}
#flash.on { opacity: .28; transition: opacity .05s; }

#hint {
    position: absolute;
    bottom: 12px; right: 14px;
    font-size: 11px;
    color: rgba(255, 255, 255, .35);
}

/* ------------------------------------------------------------- dotyk */

#touch { display: none; }
.tbtn {
    pointer-events: auto;
    background: rgba(255, 255, 255, .12);
    border: 1px solid rgba(255, 255, 255, .2);
    color: #fff;
    font-size: 30px;
    width: 88px; height: 88px;
    border-radius: 50%;
    backdrop-filter: blur(3px);
}
.tbtn:active { background: rgba(255, 183, 3, .45); }
.tbtn.small { width: 74px; height: 74px; font-size: 12px; font-weight: 700; letter-spacing: .05em; }

body.touch.playing #touch {
    display: flex;
    position: fixed;
    z-index: 20;
    bottom: 26px; left: 0; right: 0;
    justify-content: space-between;
    align-items: center;
    padding: 0 22px;
    pointer-events: none;
}
body.touch #hint { display: none; }
body.touch #hudBottom { bottom: 130px; }

#trainHud { position: fixed; inset: 0; pointer-events: none; z-index: 15; }
#trainHud .tpanel {
    position: absolute;
    top: 16px; left: 16px;
    background: rgba(10, 13, 19, .74);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 12px 16px;
    min-width: 160px;
}
.tlap { font-size: 12px; color: var(--dim); }
.tlap b { color: var(--txt); font-size: 15px; }
.tbig { font-size: 34px; font-weight: 800; font-variant-numeric: tabular-nums; margin: 2px 0 6px; }
.tsmall { font-size: 12px; color: var(--dim); }
.tsmall span { color: var(--txt); font-variant-numeric: tabular-nums; }
.tExitBtn {
    pointer-events: auto;
    position: absolute;
    top: 16px; right: 16px;
    padding: 10px 16px;
    background: rgba(10, 13, 19, .74);
    border: 1px solid var(--line);
    border-radius: 9px;
    color: var(--dim);
}
#trMsg {
    position: absolute;
    top: 34%; left: 50%;
    transform: translate(-50%, -50%);
    font-size: 46px;
    font-weight: 900;
    letter-spacing: .05em;
    text-shadow: 0 4px 30px rgba(0, 0, 0, .9);
    opacity: 0;
    transition: opacity .2s;
}
#trMsg.show { opacity: 1; }

#replayCams {
    position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%);
    z-index: 55; display: flex; flex-wrap: wrap; justify-content: center;
    gap: 8px; pointer-events: auto; max-width: 94vw;
    background: rgba(10,12,16,0.7); padding: 8px; border-radius: 12px;
    border: 1px solid #2a2f3a;
}
#replayCams button {
    background: #1a1f28; color: #cfd4dd; border: 1px solid #333a46;
    border-radius: 8px; padding: 8px 12px; font-size: 13px; cursor: pointer;
}
#replayCams button.on { background: #f5a623; color: #101319; border-color: #f5a623; font-weight: 700; }
#replayCams .rcSep { width: 1px; background: #333a46; margin: 2px 2px; }
#replayCams button[data-act] { background: #232936; }

#trainReview, #raceReview {
    position: fixed; inset: 0; z-index: 60;
    display: flex; align-items: center; justify-content: center;
    background: rgba(0,0,0,0.35); pointer-events: auto;
}
#trainReview .reviewBox, #raceReview .reviewBox {
    background: #12151c; border: 1px solid #2a2f3a; border-radius: 16px;
    padding: 22px; width: min(90vw, 340px);
    display: flex; flex-direction: column; gap: 10px;
    box-shadow: 0 10px 40px rgba(0,0,0,.5);
}
#trainReview h3, #raceReview h3 { margin: 0 0 8px; text-align: center; font-size: 20px; }
#trainReview button, #raceReview button {
    width: 100%; display: flex; align-items: center; justify-content: center;
    gap: 8px; padding: 12px 14px;
}
#trainReview button svg, #raceReview button svg { width: 20px; height: 20px; flex: 0 0 20px; }

#tunePanel, #ragdollPanel, #crashPanel {
    position: fixed;
    top: 0; right: 0; bottom: 0;
    width: 320px;
    max-width: 90vw;
    z-index: 40;
    pointer-events: none;
    display: flex;
    align-items: stretch;
}
.tuneBox { overflow-y: auto; }
.tuneBox {
    pointer-events: auto;
    width: 100%;
    background: var(--card);
    border-left: 1px solid var(--line);
    padding: 18px;
    overflow-y: auto;
    box-shadow: -10px 0 40px rgba(0, 0, 0, .5);
}
.tuneBox h3 { font-size: 17px; margin-bottom: 6px; }
.thint { font-size: 11px; color: var(--dim); margin: 8px 0 4px; }
.tuneRows label {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 4px 8px;
    font-size: 12px;
    color: var(--dim);
    margin-bottom: 9px;
}
.tuneRows label input { grid-column: 1 / -1; width: 100%; accent-color: var(--accent); }
.tuneRows label b { grid-row: 1; grid-column: 2; color: var(--txt); font-variant-numeric: tabular-nums; }
.tuneChecks { display: flex; gap: 14px; margin: 6px 0 14px; }
.chk { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--txt); cursor: pointer; }
.chk input { accent-color: var(--accent); }
#t_out {
    width: 100%;
    background: rgba(0, 0, 0, .3);
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--dim);
    font: 11px/1.4 monospace;
    padding: 8px;
    resize: none;
}

#toast {
    position: fixed;
    top: 20px; left: 50%;
    transform: translateX(-50%);
    background: var(--red);
    color: #fff;
    padding: 10px 18px;
    border-radius: 9px;
    font-size: 13px;
    z-index: 60;
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s;
}
#toast.show { opacity: 1; }

@media (max-width: 700px) {
    /* info o biegu (mecz) pod panelami okrążeń, wyśrodkowane */
    #matchBar {
        top: 56px; left: 50%; right: auto; transform: translateX(-50%);
        font-size: 12px; padding: 4px 10px; gap: 8px;
    }
    /* aktualny skład biegu POZIOMO (rząd kolorowych chipów), niżej */
    #standings {
        display: flex; flex-direction: row; gap: 6px;
        top: 90px; left: 50%; right: auto; transform: translateX(-50%);
        padding: 5px 8px; min-width: 0; font-size: 11px;
    }
    #standings .r { flex-direction: column; align-items: center; gap: 2px; padding: 0; max-width: 64px; }
    #standings .r .n { font-size: 10px; max-width: 60px; }
    #standings .r .g { display: none; } /* brak miejsca na odstęp w poziomie */
    #speedo { width: 130px; }
    #speedNum { font-size: 30px; }
    #minimap { display: none; } /* na mobile mapka zasłania za dużo ekranu */
    #bigMsg { font-size: 30px; }
}
