:root {
    --bg: #0e1117;
    --bg2: #161b25;
    --panel: #1b2230;
    --line: #2a3346;
    --text: #e7ecf3;
    --muted: #8b97ab;
    --gold: #f5c451;
    --green: #4ccf7a;
    --red: #ef6b6b;
    --accent: #5b8cff;
    --radius: 14px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
    background: radial-gradient(1200px 600px at 50% -10%, #1a2130, var(--bg)) fixed;
    color: var(--text);
    min-height: 100vh;
}

.hidden { display: none !important; }

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 24px;
    border-bottom: 1px solid var(--line);
    background: rgba(14, 17, 23, 0.8);
    backdrop-filter: blur(6px);
    position: sticky;
    top: 0;
    z-index: 10;
}
.brand { font-weight: 700; font-size: 18px; letter-spacing: .3px; }
.brand span { color: var(--muted); font-weight: 500; }

main { max-width: 1180px; margin: 0 auto; padding: 24px; }
.screen { animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* buttons */
button { font: inherit; cursor: pointer; border-radius: 10px; border: 1px solid transparent; }
.primary {
    background: linear-gradient(180deg, var(--gold), #e0ab35);
    color: #201a06; font-weight: 700; padding: 12px 28px; font-size: 16px;
    box-shadow: 0 6px 20px rgba(245, 196, 81, .25);
}
.primary:disabled { opacity: .4; cursor: not-allowed; box-shadow: none; }
.ghost {
    background: transparent; color: var(--muted); border: 1px solid var(--line); padding: 8px 16px;
}
.ghost:hover { color: var(--text); border-color: var(--muted); }

/* start */
.hero { text-align: center; padding: 40px 0; }
.hero h1 { font-size: 34px; margin: 0 0 12px; }
.lead { color: var(--muted); max-width: 620px; margin: 0 auto 28px; line-height: 1.55; }
.sectLabel { font-size: 12px; text-transform: uppercase; letter-spacing: 1.5px; color: var(--muted); margin: 6px 0 12px; }
.eras { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin-bottom: 26px; }
.eraBtn {
    background: var(--panel); border: 1px solid var(--line); color: var(--text);
    padding: 14px 20px; text-align: left; max-width: 320px; display: flex; flex-direction: column; gap: 3px;
}
.eraBtn b { font-size: 16px; }
.eraBtn span { color: var(--muted); font-size: 12px; }
.eraBtn:hover { border-color: var(--muted); }
.eraBtn.sel { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(245,196,81,.22) inset; }
.eraBtn.sel b { color: var(--gold); }

.formations { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; margin-bottom: 28px; }
.formBtn {
    background: var(--panel); border: 1px solid var(--line); color: var(--text);
    padding: 12px 12px 10px; display: flex; flex-direction: column; align-items: center; gap: 8px;
    transition: .15s;
}
.formBtn:hover { border-color: var(--muted); transform: translateY(-2px); }
.formBtn.sel { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(245,196,81,.25) inset; }
.formBtn.sel .formName { color: var(--gold); }
.formName { font-size: 17px; font-weight: 700; letter-spacing: 1px; }

/* Šoupátko rozsahu sezón — dva překryté range inputy, viditelný je jen jejich úchop. */
.seasonRange {
    width: 100%; max-width: 646px; margin: 0 auto 26px; background: var(--panel);
    border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 20px 18px;
}
.seasonRangeLabels {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    font-size: 15px; font-weight: 700; margin-bottom: 12px;
}
.seasonRangeLabels span:not(.seasonRangeSep) { color: var(--gold); }
.seasonRangeSep { color: var(--muted); font-weight: 400; }
.sliderTrack { position: relative; height: 22px; }
.sliderTrack::before {
    content: ''; position: absolute; top: 50%; left: 0; right: 0; height: 4px; transform: translateY(-50%);
    background: var(--bg2); border-radius: 4px;
}
.sliderFill {
    position: absolute; top: 50%; height: 4px; transform: translateY(-50%);
    background: var(--gold); border-radius: 4px; pointer-events: none;
}
.sliderTrack input[type="range"] {
    position: absolute; top: 0; left: 0; width: 100%; height: 22px; margin: 0;
    appearance: none; background: transparent; pointer-events: none;
}
.sliderTrack input[type="range"]::-webkit-slider-runnable-track { background: transparent; height: 22px; }
.sliderTrack input[type="range"]::-moz-range-track { background: transparent; height: 22px; }
.sliderTrack input[type="range"]::-webkit-slider-thumb {
    appearance: none; pointer-events: auto; width: 20px; height: 20px; border-radius: 50%;
    background: var(--gold); border: 3px solid #201a06; margin-top: 1px; cursor: pointer;
    box-shadow: 0 1px 4px rgba(0,0,0,.4);
}
.sliderTrack input[type="range"]::-moz-range-thumb {
    pointer-events: auto; width: 20px; height: 20px; border-radius: 50%;
    background: var(--gold); border: 3px solid #201a06; cursor: pointer;
    box-shadow: 0 1px 4px rgba(0,0,0,.4);
}

/* volitelny prepinac (tezsi mod) */
/* Řada pod formacemi: přepínače ve sloupci vlevo, tlačítko vpravo od nich (stejně vysoké jako sloupec). */
.startRow {
    display: flex; align-items: stretch; justify-content: center; gap: 20px;
    flex-wrap: wrap; margin: 0 auto 26px;
}
.optCol { display: flex; flex-direction: column; gap: 12px; width: 460px; max-width: 100%; }
.startRow #startBtn {
    margin: 0; display: flex; align-items: center; justify-content: center;
}

.optToggle {
    display: flex; align-items: center; gap: 12px; cursor: pointer; user-select: none;
    background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 12px 18px; text-align: left; transition: .15s;
}
/* Přepínač se skrytým obsahem (výběr klubu) uvnitř téže bubliny. */
.optGroup { flex-direction: column; align-items: stretch; gap: 14px; cursor: default; }
.optHead {
    display: flex; align-items: center; gap: 12px; cursor: pointer;
    user-select: none; text-align: left;
}
.optToggle:hover { border-color: var(--muted); }
.optToggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.optDisabled { opacity: .5; }
.optDisabled .optHead, .optDisabled.optToggle { cursor: not-allowed; }
.optBox {
    flex: none; width: 44px; height: 24px; border-radius: 20px; background: var(--bg2);
    border: 1px solid var(--line); position: relative; transition: .15s;
}
.optBox::after {
    content: ''; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px;
    border-radius: 50%; background: var(--muted); transition: .15s;
}
.optToggle input:checked + .optBox { background: var(--gold); border-color: var(--gold); }
.optToggle input:checked + .optBox::after { transform: translateX(20px); background: #201a06; }
.optToggle input:focus-visible + .optBox { box-shadow: 0 0 0 2px rgba(245,196,81,.4); }
.optText { font-size: 14px; font-weight: 600; line-height: 1.35; }
.optText em { display: block; font-style: normal; font-weight: 400; font-size: 12px; color: var(--muted); }

.teamPick { width: 100%; margin: 0; }
#teamSelect {
    width: 100%; background: var(--panel); color: var(--text);
    border: 1px solid var(--line); border-radius: var(--radius);
    padding: 11px 14px; font: inherit; cursor: pointer; transition: .15s;
}
#teamSelect:hover { border-color: var(--muted); }
#teamSelect:focus-visible { outline: none; border-color: var(--gold); box-shadow: 0 0 0 2px rgba(245,196,81,.4); }

.ovrHidden { color: var(--muted) !important; }

/* mini hřiště ve výběru formace */
.pitch { width: 92px; height: 120px; display: block; }
.pitchField { fill: #14331f; stroke: #2f5a3c; stroke-width: 1; }
.pitchLine { stroke: rgba(255, 255, 255, .18); stroke-width: 1; fill: none; }
.dot { stroke: rgba(0, 0, 0, .35); stroke-width: 1; transition: .15s; }
.dot-GK { fill: #ffd36b; }
.dot-DEF { fill: #7fd0ff; }
.dot-MID { fill: #9bef9b; }
.dot-ATT { fill: #ff9b9b; }
.formBtn.sel .dot { stroke: var(--gold); stroke-width: 1.4; }

/* draft layout — hřiště s posekanými pruhy, standardní značení, rohové oblouky */
.draftPitchWrap { margin-bottom: 22px; }
.draftPitch {
    position: relative; width: 100%; min-height: 340px;
    background:
        radial-gradient(120% 55% at 50% 0%, rgba(255,255,255,.05), transparent 62%),
        repeating-linear-gradient(to bottom,
            #1e4429 0, #1e4429 8.333%,
            #183a22 8.333%, #183a22 16.666%);
    box-shadow: inset 0 0 70px rgba(0,0,0,.45);
    border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
}
.pitchHalfLine { position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: rgba(255,255,255,.32); }
.pitchCenterCircle {
    position: absolute; left: 50%; top: 50%; width: clamp(70px, 22%, 110px); aspect-ratio: 1;
    border: 1px solid rgba(255,255,255,.32); border-radius: 50%; transform: translate(-50%, -50%);
}
.pitchCenterSpot {
    position: absolute; left: 50%; top: 50%; width: 5px; height: 5px; border-radius: 50%;
    background: rgba(255,255,255,.55); transform: translate(-50%, -50%);
}
.pitchBoxTop, .pitchBoxBottom {
    position: absolute; left: 50%; width: 34%; height: 15%;
    border: 1px solid rgba(255,255,255,.32); border-top: none; transform: translateX(-50%);
}
.pitchBoxTop { top: 0; }
.pitchBoxBottom { bottom: 0; transform: translateX(-50%) rotate(180deg); }
.pitchGoalAreaTop, .pitchGoalAreaBottom {
    position: absolute; left: 50%; width: 16%; height: 6%;
    border: 1px solid rgba(255,255,255,.32); border-top: none; transform: translateX(-50%);
}
.pitchGoalAreaTop { top: 0; }
.pitchGoalAreaBottom { bottom: 0; transform: translateX(-50%) rotate(180deg); }
.pitchPenaltySpotTop, .pitchPenaltySpotBottom {
    position: absolute; left: 50%; width: 5px; height: 5px; border-radius: 50%;
    background: rgba(255,255,255,.5); transform: translateX(-50%);
}
.pitchPenaltySpotTop { top: 11%; }
.pitchPenaltySpotBottom { bottom: 11%; }
.pitchGoalTop, .pitchGoalBottom {
    position: absolute; left: 50%; width: 12%; height: 3px; border-radius: 2px;
    background: rgba(255,255,255,.6); transform: translateX(-50%);
}
.pitchGoalTop { top: 0; }
.pitchGoalBottom { bottom: 0; }
.pitchCorner { position: absolute; width: 14px; height: 14px; overflow: hidden; }
.pitchCorner.tl { top: 0; left: 0; } .pitchCorner.tr { top: 0; right: 0; }
.pitchCorner.bl { bottom: 0; left: 0; } .pitchCorner.br { bottom: 0; right: 0; }
.pitchCorner::before {
    content: ''; position: absolute; width: 28px; height: 28px;
    border: 1px solid rgba(255,255,255,.4); border-radius: 50%;
}
.pitchCorner.tl::before { top: 0; left: 0; } .pitchCorner.tr::before { top: 0; right: 0; }
.pitchCorner.bl::before { bottom: 0; left: 0; } .pitchCorner.br::before { bottom: 0; right: 0; }

.pitchSlot {
    position: absolute; transform: translate(-50%, -50%); z-index: 1;
    display: flex; flex-direction: column; align-items: center; gap: 5px; width: 76px;
}
.pitchDot {
    width: 24px; height: 24px; border-radius: 50%; background: rgba(255,255,255,.08);
    border: 2px dashed rgba(255,255,255,.32); box-sizing: border-box;
}
.pitchSlot.filled .pitchDot {
    border-style: solid; border-color: rgba(0,0,0,.4);
    box-shadow: 0 3px 8px rgba(0,0,0,.45), inset 0 -4px 6px rgba(0,0,0,.3), inset 0 2px 3px rgba(255,255,255,.4);
    animation: dotPop .3s ease;
}
.pitchSlot.filled .pitchDot.dot-GK { background: #ffd36b; }
.pitchSlot.filled .pitchDot.dot-DEF { background: #7fd0ff; }
.pitchSlot.filled .pitchDot.dot-MID { background: #9bef9b; }
.pitchSlot.filled .pitchDot.dot-ATT { background: #ff9b9b; }
.pitchName {
    font-size: 11px; line-height: 1.2; text-align: center; color: var(--text);
    text-shadow: 0 1px 3px rgba(0,0,0,.8);
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
@keyframes dotPop {
    from { transform: scale(.4); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.draftBottom { display: grid; grid-template-columns: 1fr 340px; gap: 22px; }
@media (max-width: 900px) { .draftBottom { grid-template-columns: 1fr; } }

.rollPanel, .squadPanel {
    background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px;
}
.rollHead { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 14px; gap: 12px; }
.rollHeadRight { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.rollLabel { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 1px; }
.rollTeam { font-size: 24px; font-weight: 700; }
.rollSeason { color: var(--gold); font-weight: 700; font-size: 18px; }
.hint { color: var(--muted); font-size: 13px; margin: 14px 2px 0; }

/* Řazení karet v losu */
.rollSort { display: flex; align-items: center; gap: 8px; margin: 2px 0 14px; flex-wrap: wrap; }
.rollSortLabel { font-size: 12px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); margin-right: 2px; }
.sortBtn {
    background: var(--bg2); border: 1px solid var(--line); color: var(--muted);
    padding: 5px 12px; border-radius: 8px; font-size: 13px; transition: .15s;
}
.sortBtn:hover { color: var(--text); border-color: var(--muted); }
.sortBtn.sel { background: var(--gold); border-color: var(--gold); color: #201a06; font-weight: 600; }

.rerollBtn {
    background: var(--bg2); border: 1px solid var(--line); color: var(--text);
    padding: 7px 12px; font-size: 12px; font-weight: 600; white-space: nowrap;
    display: inline-flex; align-items: center; gap: 6px; transition: .15s;
}
.rerollBtn:hover { border-color: var(--gold); color: var(--gold); transform: translateY(-1px); }
.rerollBtn:disabled { opacity: .5; cursor: not-allowed; transform: none; border-color: var(--line); color: var(--muted); }
.rerollBtn span {
    background: var(--gold); color: #201a06; font-weight: 800; font-size: 10px;
    padding: 1px 6px; border-radius: 20px;
}

.rollTeam.spinning, .rollSeason.spinning { animation: spinBlur .3s ease-in-out infinite; filter: blur(1.5px); color: var(--muted); }
.rollTeam.settle, .rollSeason.settle { animation: popIn .4s cubic-bezier(.2,.8,.3,1); filter: none; }
@keyframes spinBlur { 0%, 100% { opacity: .5; } 50% { opacity: 1; } }
@keyframes popIn {
    0% { transform: scale(1.18); opacity: 0; }
    60% { transform: scale(.97); opacity: 1; }
    100% { transform: scale(1); }
}

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.cards.rolling { min-height: 160px; display: flex; align-items: center; justify-content: center; }
.cards.rolling::after {
    content: '🎲 losuji karty…'; color: var(--muted); font-size: 14px; letter-spacing: .5px;
    animation: spinBlur 1s ease-in-out infinite;
}
.card.cardIn { animation: cardPop .35s ease both; }
@keyframes cardPop {
    from { opacity: 0; transform: translateY(10px) scale(.92); }
    to { opacity: 1; transform: none; }
}

/* player card */
.card {
    position: relative; background: linear-gradient(160deg, #222c3e, #182031);
    border: 1px solid var(--line); border-radius: 12px; padding: 12px; transition: .15s;
}
.card.eligible { cursor: pointer; }
.card.eligible:hover { border-color: var(--gold); transform: translateY(-3px); box-shadow: 0 8px 22px rgba(0,0,0,.35); }
.card.ineligible { opacity: .4; filter: grayscale(.5); }
.cardTop { display: flex; justify-content: space-between; align-items: flex-start; }
.ovr { font-size: 30px; font-weight: 800; line-height: 1; color: var(--gold); }
.pos { font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 6px; background: var(--bg2); color: var(--muted); }
.pos.GK { color: #ffd36b; } .pos.DEF { color: #7fd0ff; } .pos.MID { color: #9bef9b; } .pos.ATT { color: #ff9b9b; }
.pname { font-weight: 700; margin: 8px 0 2px; font-size: 14px; line-height: 1.2; }
.pmeta { color: var(--muted); font-size: 11px; margin-bottom: 8px; }
.attrs { display: flex; flex-direction: column; gap: 3px; }
.attr { display: grid; grid-template-columns: 34px 1fr 24px; align-items: center; gap: 6px; font-size: 11px; }
.attr span:first-child { color: var(--muted); }
.bar { height: 5px; background: var(--bg2); border-radius: 3px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--green)); }
.attr b { text-align: right; }
.badgeReason {
    position: absolute; inset: auto 8px 8px; text-align: center; font-size: 10px;
    color: var(--muted); background: rgba(0,0,0,.4); border-radius: 5px; padding: 2px;
}

/* squad */
.squadPanel h2, .resultCols h2 { font-size: 15px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); margin: 0 0 12px; }
.squadList { display: flex; flex-direction: column; gap: 6px; }
.miniRow {
    display: flex; align-items: center; gap: 10px; background: var(--bg2);
    border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px;
}
.miniRow .mpos { font-size: 10px; font-weight: 700; width: 30px; }
.miniRow .movr { font-weight: 800; color: var(--gold); width: 26px; }
.miniRow .mname { flex: 1; font-size: 13px; }
.miniRow .mmeta { color: var(--muted); font-size: 11px; }

/* result */
.resultTitle { text-align: center; }
.verdict { text-align: center; font-size: 20px; margin: 6px 0 22px; }
.statGrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 26px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px; text-align: center; }
.stat .num { font-size: 26px; font-weight: 800; }
.stat .lbl { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .5px; margin-top: 4px; }
.stat.hi .num { color: var(--gold); }

/* dlaždice "Sdílet" v řadě statistik + rozbalovací nabídka — barevně výrazná (jako .primary) */
.shareStat {
    position: relative; padding: 0; border: none;
    background: linear-gradient(180deg, var(--gold), #e0ab35);
    box-shadow: 0 6px 20px rgba(245, 196, 81, .3);
}
.shareMenuBtn {
    width: 100%; height: 100%; background: transparent; border: none; padding: 16px;
    border-radius: 12px; transition: .15s;
}
.shareMenuBtn:hover { background: rgba(0,0,0,.08); }
.shareMenuBtn .num { color: #201a06; }
.shareMenuBtn .lbl { color: rgba(32,26,6,.72); font-weight: 700; }
.shareMenu {
    position: absolute; top: calc(100% + 8px); left: 50%; transform: translateX(-50%);
    z-index: 20; background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
    padding: 6px; width: max-content; max-width: calc(100vw - 32px);
    box-shadow: 0 10px 30px rgba(0,0,0,.45);
    display: flex; flex-direction: column; gap: 2px;
}
.shareMenu.hidden { display: none; }
.shareMenu button {
    background: transparent; border: none; text-align: left; padding: 10px 14px;
    border-radius: 8px; color: var(--text); font-size: 14px; white-space: nowrap;
}
.shareMenu button:hover { background: var(--bg2); }
.shareMenu button:disabled { opacity: .45; cursor: not-allowed; background: transparent; }

/* koncova ligova tabulka */
.tableTitle { font-size: 15px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); margin: 0 0 12px; }
.leagueTable {
    width: 100%; border-collapse: collapse; font-size: 13px; margin-bottom: 30px;
    background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
}
.leagueTable th, .leagueTable td { text-align: center; padding: 8px 8px; border-bottom: 1px solid var(--line); }
.leagueTable th { color: var(--muted); font-weight: 600; background: var(--bg2); }
.leagueTable th:nth-child(2), .leagueTable td.tteam { text-align: left; }
.leagueTable tbody tr:last-child td { border-bottom: none; }
.leagueTable .rank { color: var(--muted); font-weight: 700; width: 30px; }
.leagueTable .tteam { font-weight: 600; }
.leagueTable .tpts { font-weight: 800; color: var(--gold); }
.leagueTable tr.meRow { background: rgba(245, 196, 81, .1); }
.leagueTable tr.meRow .tteam { color: var(--gold); }
.leagueTable tr.meRow td { border-color: rgba(245, 196, 81, .25); }

.resultCols { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-bottom: 26px; }
@media (max-width: 820px) { .resultCols { grid-template-columns: 1fr; } }
.oppTable { width: 100%; border-collapse: collapse; font-size: 13px; }
.oppTable th, .oppTable td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); }
.oppTable th { color: var(--muted); font-weight: 600; }
.score { display: inline-block; font-weight: 800; font-size: 15px; margin-bottom: 3px; letter-spacing: .5px; }
.score.w { color: var(--green); }
.score.d { color: var(--muted); }
.score.l { color: var(--red); }
.wdl { display: flex; gap: 3px; }
.wdl i { width: 34px; text-align: center; border-radius: 4px; padding: 2px 0; font-style: normal; font-size: 11px; }
.wdl .w { background: rgba(76,207,122,.18); color: var(--green); }
.wdl .d { background: rgba(139,151,171,.15); color: var(--muted); }
.wdl .l { background: rgba(239,107,107,.15); color: var(--red); }

.toast {
    position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
    background: var(--red); color: #fff; padding: 12px 20px; border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,.4); z-index: 50; animation: fade .2s;
}
