:root {
    --bg: #e9e2cf;
    --panel: #f7f2e6;
    --panel-2: #efe8d6;
    --card: #fffdf8;
    --ink: #2b2620;
    --muted: #7a6f5f;
    --line: #e2d8c3;
    --line-2: #d0c3a6;
    --green: #4f7a28;
    --green-d: #3d6120;
    --green-l: #6a9a3a;
    --green-bg: #eef4e4;
    --wheat: #d9a520;
    --red: #b8432f;
    --red-bg: #fdecea;
    --top: #2f4a1c;
    --top-ink: #f4efe2;
    --map-bg: #2f3a24;
    --radius: 12px;
    --shadow-s: 0 1px 2px rgba(60, 45, 20, .08), 0 1px 1px rgba(60, 45, 20, .04);
    --shadow: 0 4px 14px rgba(43, 38, 32, .14);
    --shadow-l: 0 14px 38px rgba(30, 24, 14, .3);
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
    font-size: 14px;
    color: var(--ink);
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    height: 100%;
    background: var(--bg);
}

[hidden] {
    display: none !important;
}

button,
input,
select {
    font: inherit;
    color: inherit;
}

:focus-visible {
    outline: 2px solid var(--green-l);
    outline-offset: 2px;
}

/* ------------------------------------------------------------ tlačítka a formuláře */

.btn {
    border: 1px solid var(--line-2);
    background: linear-gradient(#fffdf8, #f5efe0);
    border-radius: 9px;
    padding: 7px 13px;
    cursor: pointer;
    font-weight: 600;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .8), 0 1px 2px rgba(60, 45, 20, .08);
    transition: background .15s, border-color .15s, box-shadow .15s, transform .05s;
}

.btn:hover:not(:disabled) {
    border-color: #b9a983;
    background: #fff;
}

.btn:active:not(:disabled) {
    transform: translateY(1px);
}

.btn:disabled {
    opacity: .45;
    cursor: not-allowed;
}

.btn.primary {
    background: linear-gradient(#629437, #4a7425);
    border-color: var(--green-d);
    color: #fff;
    text-shadow: 0 1px 0 rgba(0, 0, 0, .15);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .22), 0 1px 3px rgba(40, 70, 15, .3);
}

.btn.primary:hover:not(:disabled) {
    background: linear-gradient(#6a9e3c, #4f7a28);
    border-color: var(--green-d);
}

.btn.ghost {
    background: transparent;
    border-color: transparent;
    box-shadow: none;
}

.btn.ghost:hover:not(:disabled) {
    background: rgba(60, 45, 20, .06);
    border-color: transparent;
}

.btn.small {
    padding: 4px 10px;
    font-size: 12px;
    border-radius: 8px;
}

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

.btn.ghost.danger:hover:not(:disabled) {
    background: var(--red-bg);
}

input[type=number],
input[type=text],
input:not([type]),
input[type=password],
select {
    border: 1px solid var(--line-2);
    background: #fff;
    border-radius: 8px;
    padding: 6px 9px;
    transition: border-color .15s, box-shadow .15s;
}

input:focus,
select:focus {
    outline: none;
    border-color: var(--green-l);
    box-shadow: 0 0 0 3px rgba(79, 122, 40, .16);
}

/* ------------------------------------------------------------ přihlášení */

.auth {
    min-height: 100%;
    display: grid;
    place-items: center;
    padding: 24px 16px;
    /* obloha a pole s brázdami */
    background:
        radial-gradient(circle at 82% 14%, rgba(255, 236, 160, .9) 0 46px, rgba(255, 236, 160, 0) 47px),
        repeating-linear-gradient(-8deg, rgba(0, 0, 0, .07) 0 3px, transparent 3px 22px) left bottom / 100% 66% no-repeat,
        linear-gradient(#bfdcef 0 34%, #a6c96c 34%, #7aa349 70%, #5f8a36);
}

.auth-card {
    width: min(390px, 100%);
    background: var(--panel);
    border: 1px solid rgba(255, 255, 255, .7);
    border-radius: 18px;
    padding: 30px 28px 22px;
    box-shadow: var(--shadow-l);
    display: grid;
    gap: 12px;
}

.logo {
    margin: 0;
    font-size: 32px;
    letter-spacing: .5px;
    color: var(--green-d);
}

.logo::before {
    content: "🌾 ";
}

.auth-sub {
    margin: -6px 0 6px;
    color: var(--muted);
}

.auth-tabs {
    display: flex;
    gap: 4px;
    background: #ebe3cf;
    padding: 3px;
    border-radius: 10px;
    box-shadow: inset 0 1px 2px rgba(60, 45, 20, .1);
}

.auth-tabs button {
    flex: 1;
    border: 0;
    background: transparent;
    padding: 7px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    color: var(--muted);
}

.auth-tabs button.on {
    background: #fff;
    color: var(--ink);
    box-shadow: var(--shadow-s);
}

.auth-card label {
    display: grid;
    gap: 4px;
    font-weight: 600;
    font-size: 13px;
}

.auth-card input {
    padding: 9px 11px;
}

.auth-card .btn.primary {
    padding: 10px;
    font-size: 15px;
}

.auth-err {
    color: var(--red);
    min-height: 1.2em;
    margin: 0;
    font-size: 13px;
}

/* ------------------------------------------------------------ hra */

.game {
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* horní lišta – tmavě zelená, údaje v „čipech“ */
.topbar {
    position: relative;
    z-index: 5;
    display: flex;
    align-items: center;
    gap: 10px 14px;
    padding: 6px 14px;
    background: linear-gradient(180deg, #3f6025, var(--top));
    color: var(--top-ink);
    border-bottom: 1px solid #22370f;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .2);
    flex-wrap: wrap;
}

/* název farmy s úrovní je tlačítko – po najetí bublina s postupem (#top-pop) */
.tb-farm {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    margin: 0 6px 0 -8px;
    padding: 5px 8px;
    border: 1px solid transparent;
    border-radius: 10px;
    background: none;
    color: inherit;
    cursor: pointer;
    transition: background .15s, border-color .15s;
}

.tb-farm:hover,
.tb-farm[aria-expanded="true"] {
    background: rgba(255, 255, 255, .1);
    border-color: rgba(255, 255, 255, .2);
}

.tb-farm b {
    color: #fff;
    text-shadow: 0 1px 1px rgba(0, 0, 0, .25);
}

.tb-farm .dot {
    width: 14px;
    height: 14px;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, .85);
}

.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
    flex: none;
}

.tb-stat,
.tb-cal {
    background: rgba(255, 255, 255, .08);
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 10px;
    padding: 4px 11px;
}

.tb-stat {
    display: flex;
    align-items: center;
    gap: 8px;
    line-height: 1.15;
}

.tb-ico {
    font-size: 18px;
    line-height: 1;
    filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .25));
}

.tb-txt {
    display: grid;
}

.tb-label {
    font-size: 10.5px;
    color: rgba(244, 239, 226, .65);
    text-transform: uppercase;
    letter-spacing: .5px;
}

.tb-stat b {
    color: #fff;
    font-size: 15px;
    font-variant-numeric: tabular-nums;
}

.tb-stat b.neg {
    color: #ff9b8a;
}

/* kalendář roku v horní liště – roztáhne se do volného místa, vysoký jako ostatní čipy
   (sezóna, den a odpočet v jednom řádku, pod ním dny roku) */
.tb-cal {
    display: grid;
    gap: 3px;
    flex: 3 1 260px;
    min-width: 260px;
    max-width: 680px;
    padding: 4px 12px 5px;
}

.cal-head {
    display: flex;
    gap: 8px;
    align-items: baseline;
    font-size: 13px;
    line-height: 1.25;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    min-width: 0;
}

.cal-head b,
#tb-date {
    flex: none;
}

.cal-days {
    display: flex;
    gap: 2px;
}

.cal-days i {
    flex: 1;
    height: 9px;
    border-radius: 3px;
    opacity: .3;
}

/* mezera mezi sezónami */
.cal-days i.sstart {
    margin-left: 5px;
}

.cal-days i.past {
    opacity: .8;
}

.cal-days i.now {
    opacity: 1;
    outline: 2px solid #fff;
    outline-offset: 1px;
}

.cal-days i.flash {
    animation: day-flash .8s ease-out;
}

@keyframes day-flash {
    from {
        transform: scaleY(2.2);
    }
}

/* odpočet vpravo v záhlaví kalendáře – když se nevejde, zkrátí se konec */
.cal-foot {
    margin-left: auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 11px;
    color: rgba(244, 239, 226, .62);
}

.tb-level {
    font-size: 11px;
    font-weight: 700;
    background: linear-gradient(#f4d264, #d9a520);
    color: #3b2a00;
    border-radius: 9px;
    padding: 1px 8px;
    white-space: nowrap;
    flex: none;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .45), 0 1px 2px rgba(0, 0, 0, .25);
}

.tb-spacer {
    flex: 1;
}

.tb-user {
    color: rgba(244, 239, 226, .7);
}

.topbar .btn.ghost {
    color: var(--top-ink);
    border-color: rgba(255, 255, 255, .25);
}

.topbar .btn.ghost:hover {
    background: rgba(255, 255, 255, .1);
    border-color: rgba(255, 255, 255, .4);
}

.toast.season {
    background: var(--top);
    border-left-color: var(--wheat);
    font-size: 14px;
    padding-top: 13px;
    padding-bottom: 13px;
}

.toast.season::before {
    content: "☀";
    background: var(--wheat);
}

/* nová zakázka, na kterou je zboží ve skladu */
.toast.deal {
    border-left-color: var(--wheat);
}

.toast.deal::before {
    content: "★";
    background: var(--wheat);
    color: #3b2a00;
}

.main {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: 1fr 400px;
}

/* schovaný pravý panel – mapa přes celou šířku (animuje se až po načtení, ať se neposouvá při startu) */
.main.ready {
    transition: grid-template-columns .25s ease;
}

.main.side-hidden {
    grid-template-columns: 1fr 0px;
}

.main.side-hidden .side {
    border-left-width: 0;
    box-shadow: none;
}

.side-toggle {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    z-index: 6;
    display: grid;
    place-items: center;
    width: 22px;
    height: 68px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, .7);
    border-right: 0;
    border-radius: 11px 0 0 11px;
    background: rgba(251, 248, 240, .92);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    box-shadow: -2px 2px 10px rgba(0, 0, 0, .2);
    color: var(--muted);
    cursor: pointer;
    transition: width .15s, color .15s;
}

.side-toggle:hover {
    width: 28px;
    color: var(--ink);
}

.side-toggle svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.6;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: transform .25s;
}

.main.side-hidden .side-toggle svg {
    transform: rotate(180deg);
}

.mapwrap {
    position: relative;
    background: var(--map-bg);
    overflow: hidden;
    min-height: 0;
}

#map {
    display: block;
    width: 100%;
    height: 100%;
    touch-action: none;
    cursor: grab;
}

#map.work {
    cursor: crosshair;
}

#map.dragging {
    cursor: grabbing;
}

/* lišty nad mapou – mléčné sklo */
.toolbar,
.mapctl {
    position: absolute;
    display: flex;
    gap: 3px;
    background: rgba(251, 248, 240, .9);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, .7);
    padding: 5px;
    border-radius: 13px;
    box-shadow: var(--shadow);
}

.toolbar {
    top: 10px;
    left: 10px;
    flex-wrap: wrap;
    max-width: calc(100% - 20px);
}

.toolbar button,
.mapctl button {
    border: 1px solid transparent;
    background: transparent;
    border-radius: 9px;
    padding: 6px 10px;
    cursor: pointer;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: background .15s, color .15s;
}

.toolbar button span {
    font-size: 15px;
    line-height: 1;
}

.toolbar button:hover,
.mapctl button:hover {
    background: rgba(60, 45, 20, .07);
}

.toolbar button.on,
.mapctl button.on {
    background: linear-gradient(#629437, #4a7425);
    border-color: var(--green-d);
    color: #fff;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .2), 0 1px 3px rgba(40, 70, 15, .35);
}

.toolbar select {
    padding: 5px 7px;
}

.mapctl {
    bottom: 10px;
    right: 10px;
}

.hint {
    position: absolute;
    left: 50%;
    top: 62px;
    transform: translateX(-50%);
    background: rgba(30, 26, 20, .78);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    color: #fff;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    pointer-events: none;
    white-space: nowrap;
    box-shadow: 0 4px 14px rgba(0, 0, 0, .25);
}

.hint:empty {
    display: none;
}

/* okno práce (výběr na mapě) */
.plan {
    position: absolute;
    left: 10px;
    bottom: 10px;
    width: min(430px, calc(100% - 20px));
    background: var(--panel);
    border: 1px solid rgba(255, 255, 255, .8);
    border-top: 4px solid var(--green);
    border-radius: 14px;
    box-shadow: var(--shadow-l);
    padding: 12px 14px 14px;
    display: grid;
    gap: 8px;
    animation: pop-in .18s ease-out;
}

@keyframes pop-in {
    from {
        transform: translateY(8px);
        opacity: 0;
    }
}

.plan h3 {
    margin: 0;
    font-size: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.opt {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 2px 10px;
    align-items: center;
    text-align: left;
    border: 1px solid var(--line);
    background: var(--card);
    border-radius: 10px;
    padding: 9px 12px;
    cursor: pointer;
    box-shadow: var(--shadow-s);
    transition: border-color .15s, background .15s, box-shadow .15s, transform .1s;
}

.opt:hover:not(:disabled) {
    border-color: var(--green-l);
    background: #f6faef;
    box-shadow: 0 3px 10px rgba(79, 122, 40, .15);
    transform: translateY(-1px);
}

.opt:disabled {
    cursor: not-allowed;
    opacity: .55;
    box-shadow: none;
}

.opt b {
    font-size: 13.5px;
}

.opt small {
    color: var(--muted);
    grid-column: 1;
}

.opt small.warn-text {
    color: var(--red);
}

.opt .opt-side {
    grid-row: 1 / span 2;
    grid-column: 2;
    text-align: right;
    font-variant-numeric: tabular-nums;
    font-size: 12.5px;
    font-weight: 700;
}

.opt .warn {
    color: var(--red);
    font-weight: 600;
}

/* ------------------------------------------------------------ boční panel */

.side {
    position: relative;
    z-index: 2;
    background: var(--panel);
    border-left: 1px solid var(--line-2);
    box-shadow: -3px 0 12px rgba(30, 24, 14, .08);
    display: flex;
    flex-direction: column;
    min-height: 0;
    min-width: 0;
    overflow: hidden;
}

/* obsah panelu drží šířku, při schovávání se jen odsune pod okraj */
@media (min-width: 901px) {

    .side>.tabs,
    .side>.panel {
        min-width: 399px;
    }
}

/* záložky: ikonka nad popiskem, všech 8 se vejde vedle sebe (bez posouvání) */
.tabs {
    display: grid;
    grid-template-columns: repeat(8, minmax(0, 1fr));
    border-bottom: 1px solid var(--line-2);
    padding: 0 4px;
    background: linear-gradient(#fbf8f0, var(--panel));
}

.tabs button {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    min-width: 0;
    border: 0;
    background: transparent;
    font-size: 11.5px;
    white-space: nowrap;
    padding: 9px 0 6px;
    cursor: pointer;
    font-weight: 600;
    color: var(--muted);
    border-bottom: 3px solid transparent;
    border-radius: 8px 8px 0 0;
    transition: color .15s, background .15s;
}

/* odznak na ikonce záložky (porouchané stroje) */
.tabs button {
    position: relative;
}

.tab-badge,
.seg-alert {
    display: inline-grid;
    place-items: center;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 99px;
    background: #d9381e;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.tab-badge {
    position: absolute;
    top: 4px;
    left: calc(50% + 5px);
    box-shadow: 0 0 0 2px var(--panel);
    animation: badge-pop .35s ease-out;
}

.seg-alert {
    margin-left: 4px;
    vertical-align: 1px;
}

/* dobrá zpráva (někoho jde povýšit) – zlatě, ne červeně jako porucha */
.tab-badge.good {
    background: var(--wheat);
    color: #3b2a00;
}

/* povýšení zaměstnanců – hvězdičky u jména, postup odpracovaného času, tlačítko Povýšit */
.stars {
    margin-left: 2px;
    font-size: 12px;
    letter-spacing: 1px;
    color: var(--wheat);
    white-space: nowrap;
}

.stars i {
    font-style: normal;
    color: var(--line-2);
}

.promo {
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px dashed var(--line);
}

.promo .bar.thin {
    height: 4px;
    margin-top: 4px;
}

.promo.ready {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

/* karta, u které jde hned něco udělat – povýšit člověka, vzít zakázku se zbožím ve skladu */
.card.ready-card {
    border-color: #ecd27a;
    box-shadow: inset 3px 0 0 var(--wheat), var(--shadow-s);
}

@keyframes badge-pop {
    from {
        transform: scale(.4);
    }

    70% {
        transform: scale(1.2);
    }
}

.tabs button:hover {
    color: var(--ink);
    background: rgba(60, 45, 20, .04);
}

.tabs button.on {
    color: var(--ink);
    border-bottom-color: var(--green);
    background: linear-gradient(rgba(79, 122, 40, 0), rgba(79, 122, 40, .09));
}

.ti {
    width: 21px;
    height: 21px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: transform .15s;
}

.tabs button.on .ti {
    color: var(--green);
    transform: translateY(-1px);
}

/* ikonky strojů (SVG z boku, game.js machineIcon) – na dlaždici s pruhem trávy */
.micon {
    display: block;
    width: 60px;
    height: 40px;
    flex: none;
    padding: 3px 4px 2px;
    border-radius: 9px;
    background: linear-gradient(#f3f7ec 0 78%, #d8e6c2 78%);
    box-shadow: inset 0 0 0 1px rgba(79, 122, 40, .12);
}

.micon.small {
    display: inline-block;
    width: 32px;
    height: 20px;
    padding: 0;
    background: none;
    box-shadow: none;
    vertical-align: -5px;
    margin-right: 4px;
}

.mcard {
    display: grid;
    grid-template-columns: 60px 1fr;
    gap: 0 12px;
    align-items: center;
}

.shop-item.with-icon {
    grid-template-columns: 60px 1fr auto;
}

/* servisák nahoře v Mých strojích */
.card.mech {
    border-left: 4px solid #2a78d6;
}

.card.mech .seg {
    margin: 4px 0 6px;
}

/* stav stroje: barva jen doplňuje číslo a slovo (dobrý / opotřebovaný / zralý na servis) */
.mcard.broken {
    border-left: 4px solid var(--red);
}

.cond-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0 10px;
    margin-top: 6px;
}

.bar.cond {
    margin-top: 3px;
}

.bar.cond.mid i {
    background: linear-gradient(90deg, #e9c14a, var(--wheat));
}

.bar.cond.low i {
    background: linear-gradient(90deg, #d8604a, var(--red));
}

.btns {
    display: inline-flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 6px;
}

/* ikonky staveb – pohled shora jako na mapě (game.js buildingIcon) */
.bicon {
    display: block;
    width: 60px;
    height: 40px;
    flex: none;
    border-radius: 9px;
    background: #9cc463;
    box-shadow: inset 0 0 0 1px rgba(60, 90, 30, .2);
}

.bcard {
    display: grid;
    grid-template-columns: 60px 1fr;
    gap: 0 12px;
    align-items: center;
}

.shop-item.with-icon .bicon {
    grid-row: span 2;
}

.shop-item.locked .bicon {
    filter: grayscale(1);
    opacity: .45;
}

/* stroj v dílně: šedá ikona, barevná část nabíhá zleva podle postupu servisu (--p = 0…1) */
.micon-svc {
    position: relative;
    width: 60px;
    height: 40px;
}

.micon-svc > .micon {
    filter: grayscale(1);
    opacity: .45;
}

.micon-svc .svc-fill {
    position: absolute;
    inset: 0;
    clip-path: inset(0 calc((1 - var(--p, 0)) * 100%) 0 0);
    transition: clip-path 1s linear;
}

/* čára na hraně postupu */
.micon-svc::after {
    content: "";
    position: absolute;
    top: 2px;
    bottom: 2px;
    left: calc(var(--p, 0) * 100% - 1px);
    width: 2px;
    border-radius: 2px;
    background: #2a78d6;
    transition: left 1s linear;
}

.micon-svc .svc-pct {
    position: absolute;
    left: 50%;
    bottom: -7px;
    transform: translateX(-50%);
    padding: 0 6px;
    border-radius: 99px;
    background: #2a5a9e;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 15px;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.shop-item.with-icon .micon {
    grid-row: span 2;
}

.shop-item.with-icon small {
    grid-column: 2 / -1;
}

.shop-item.locked .micon {
    filter: grayscale(1);
    opacity: .45;
}

.panel {
    flex: 1;
    overflow: auto;
    padding: 14px 14px 28px;
    scrollbar-width: thin;
    scrollbar-color: var(--line-2) transparent;
}

.panel::-webkit-scrollbar {
    width: 8px;
}

.panel::-webkit-scrollbar-thumb {
    background: var(--line-2);
    border-radius: 4px;
}

/* nadpisy sekcí s linkou do strany */
.panel h2 {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .8px;
    color: #8a7c62;
    margin: 20px 2px 8px;
}

.panel h2::after {
    content: "";
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, var(--line-2), transparent);
}

.panel h2:first-child {
    margin-top: 2px;
}

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 11px 13px;
    margin-bottom: 8px;
    box-shadow: var(--shadow-s);
}

/* barevný proužek vlevo podle druhu karty */
.card.job {
    border-left: 4px solid var(--green-l);
}

.card.queue-item {
    border-left: 4px solid #c9b47a;
}

.card.task {
    border-left: 4px solid var(--wheat);
}

.level-card {
    background: linear-gradient(135deg, #fff6d9, var(--card) 70%);
    border-color: #ecd9a0;
}

.level-card > .row b {
    font-size: 15px;
}

.row {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: space-between;
}

.muted {
    color: var(--muted);
}

.small {
    font-size: 12px;
}

.num {
    font-variant-numeric: tabular-nums;
}

.kv {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0 12px;
    font-size: 13px;
    margin: 0;
}

.kv dt,
.kv dd {
    padding: 4px 0;
    border-bottom: 1px dashed var(--line);
}

.kv dt:last-of-type,
.kv dd:last-of-type {
    border-bottom: 0;
}

.kv dt {
    color: var(--muted);
}

.kv dd {
    margin: 0;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.bar {
    height: 8px;
    background: #ece4d1;
    border-radius: 99px;
    overflow: hidden;
    margin-top: 6px;
    box-shadow: inset 0 1px 2px rgba(60, 45, 20, .12);
}

.bar i {
    display: block;
    height: 100%;
    border-radius: 99px;
    background: linear-gradient(90deg, #7fae4a, var(--green));
    transition: width .4s ease;
}

.bar.full i {
    background: linear-gradient(90deg, #d8604a, var(--red));
}

/* zakázky: dodáno + ve skladu, části oddělené 2px mezerou, barvy ověřené na barvoslepost */
.bar.stack {
    display: flex;
    gap: 2px;
}

.bar.stack i {
    border-radius: 0;
}

.bar.stack i:first-child {
    border-radius: 99px 0 0 99px;
}

.bar.stack i:last-child {
    border-radius: 0 99px 99px 0;
}

.bar.stack i:only-child {
    border-radius: 99px;
}

.bar i.done,
.stock-key .k-done {
    background: #4f7a28;
}

.bar i.stock,
.stock-key .k-stock {
    background: #d9a520;
}

.bar i.road,
.stock-key .k-road {
    background: #2a78d6;
}

/* sklad výrobny a její zásobovací auto */
.proc-stock {
    margin-top: 8px;
}

.proc-head {
    font-size: 11px;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .04em;
    margin: 8px 0 2px;
}

.proc-row {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    font-size: 12.5px;
    margin-top: 4px;
}

.proc-stock .bar {
    margin-top: 3px;
}

.proc-van {
    margin-top: 8px;
    font-size: 12.5px;
}

.stock-key {
    display: flex;
    flex-wrap: wrap;
    gap: 2px 12px;
    margin-top: 5px;
    font-size: 12px;
    color: var(--muted);
}

.stock-key span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.stock-key i {
    width: 9px;
    height: 9px;
    border-radius: 2px;
}

.ok-text {
    color: #1f6f3a;
    font-weight: 600;
}

.level-card .bar i {
    background: linear-gradient(90deg, #f4d264, var(--wheat));
}

.task .bar,
.queue-item .small {
    margin: 5px 0 3px;
}

/* řádek skladu: ikonka · zboží · množství, pod tím tenký pruh, kolik místa z kapacity zabírá */
.store-row {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    font-size: 13px;
    padding: 5px 0 6px;
    border-bottom: 1px dashed var(--line);
}

.store-row:last-child {
    border-bottom: 0;
}

.store-row .bar.thin {
    grid-column: 2 / -1;
    height: 4px;
    margin-top: 4px;
}

/* ikonka zboží (emoji, u mouky vlastní SVG) – vždy stejně široká, ať názvy pod sebou lícují */
.ii {
    display: inline-grid;
    place-items: center;
    width: 1.35em;
    margin-right: .25em;
    font-size: 1.05em;
    font-weight: 400;
    line-height: 1;
    vertical-align: -.08em;
}

.ii svg {
    display: block;
    width: 1.1em;
    height: 1.1em;
}

/* výkup: větší ikonka zboží na dlaždici vedle názvu */
.mk-name {
    display: flex;
    align-items: center;
    gap: 10px;
}

.mk-name .ii {
    width: 38px;
    height: 38px;
    margin: 0;
    font-size: 23px;
    border-radius: 10px;
    background: var(--panel-2);
    box-shadow: inset 0 0 0 1px var(--line);
    flex: none;
}

/* peníze a sklad v horní liště jsou tlačítka – po najetí / ťuknutí ukážou bublinu s podrobnostmi */
.tb-pop-btn {
    cursor: pointer;
    text-align: left;
    transition: background .15s, border-color .15s;
}

.tb-pop-btn:hover,
.tb-pop-btn[aria-expanded="true"] {
    background: rgba(255, 255, 255, .16);
    border-color: rgba(255, 255, 255, .32);
}

.top-pop {
    position: fixed;
    z-index: 55;
    width: 310px;
    max-width: calc(100vw - 16px);
    padding: 12px 14px 10px;
    border-radius: var(--radius);
    background: var(--card);
    color: var(--ink);
    border: 1px solid var(--line);
    box-shadow: var(--shadow-l);
    animation: pop-in .12s ease-out;
}

/* šipka k tlačítku */
.top-pop::before {
    content: "";
    position: absolute;
    top: -7px;
    left: var(--arrow, 24px);
    width: 12px;
    height: 12px;
    background: var(--card);
    border-left: 1px solid var(--line);
    border-top: 1px solid var(--line);
    transform: translateX(-50%) rotate(45deg);
}

/* neviditelný most přes mezeru, ať bublina nezmizí cestou myši z tlačítka */
.top-pop::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: -12px;
    height: 12px;
}

@keyframes pop-in {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
}

.pop-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 10px;
}

.pop-head .num {
    font-size: 12.5px;
    color: var(--muted);
}

.pop-list {
    margin-top: 6px;
    max-height: min(46vh, 360px);
    overflow-y: auto;
}

.pop-h {
    margin: 10px 0 2px;
    font-size: 11px;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .4px;
}

.pop-sub {
    display: grid;
    gap: 2px;
    padding: 5px 0;
    font-size: 12.5px;
    border-top: 1px dashed var(--line);
}

.pop-sub > span:last-child {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.chip {
    display: inline-flex;
    align-items: center;
    padding: 1px 8px 1px 3px;
    border-radius: 99px;
    background: var(--panel-2);
    border: 1px solid var(--line);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.chip .ii {
    margin-right: .15em;
}

.pop-foot {
    margin-top: 8px;
    padding-top: 6px;
    border-top: 1px solid var(--line);
}

/* bublina u peněz – zůstatek, dnešní pohyby a denní platby v malé účetní tabulce */
.pop-head .pop-money {
    font-size: 16px;
    color: var(--ink);
}

.pop-head .pop-money.neg {
    color: var(--red);
}

.pop-ledger {
    margin-top: 4px;
    font-size: 12.5px;
}

.pop-ledger tr.sec th {
    padding-top: 9px;
}

.pop-ledger tr.sum td {
    font-weight: 600;
}

.pop-go {
    display: block;
    width: 100%;
    margin-top: 8px;
}

/* bublina u úrovně – zlatý pruh jako na kartě úrovně, odemčené věci jako čipy, úkoly s tenkým pruhem */
.bar.lvl i {
    background: linear-gradient(90deg, #f4d264, var(--wheat));
}

.pop-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.pop-chips .chip {
    padding: 2px 9px 2px 5px;
    gap: 3px;
}

.pop-chips .micon.small {
    width: 26px;
    height: 16px;
    margin-right: 0;
    vertical-align: middle;
}

.pop-task {
    padding: 4px 0 5px;
    font-size: 12.5px;
    border-bottom: 1px dashed var(--line);
}

.pop-task .row {
    align-items: baseline;
    gap: 8px;
}

.pop-task .row .small {
    white-space: nowrap;
}

.pop-task .bar.thin {
    height: 4px;
    margin-top: 3px;
}

.pop-note {
    margin-top: 8px;
}

.job {
    font-size: 13px;
}

.job .row b {
    font-weight: 600;
}

/* zprávy jako časová osa */
.events {
    list-style: none;
    margin: 0 0 0 4px;
    padding: 0;
    font-size: 13px;
}

.events li {
    position: relative;
    padding: 6px 0 8px 16px;
    border-left: 2px solid var(--line);
}

.events li::before {
    content: "";
    position: absolute;
    left: -6px;
    top: 9px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--card);
    border: 2px solid var(--green-l);
}

.events li:first-child::before {
    background: var(--green-l);
}

.events li.empty {
    margin-left: -4px;
    border: 1px dashed var(--line-2);
    padding: 10px 12px;
}

.events li.empty::before {
    display: none;
}

.events time {
    color: var(--muted);
    font-size: 11px;
    display: block;
}

.machine-name {
    font-weight: 600;
}

.badge {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 99px;
    background: var(--panel-2);
    border: 1px solid var(--line);
    color: var(--muted);
    white-space: nowrap;
}

.badge.busy {
    background: #fff3d6;
    border-color: #f0d68f;
    color: #8a6200;
}

.badge.bad {
    background: var(--red-bg);
    border-color: #f1b9ad;
    color: var(--red);
}

.badge.service {
    background: #e8f0fb;
    border-color: #b9cdea;
    color: #2a5a9e;
}

.badge.locked {
    background: #efe8d8;
    color: var(--muted);
}

.shop-item {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 3px 10px;
    align-items: center;
}

.shop-item small {
    color: var(--muted);
}

.mk {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 4px 10px;
    align-items: center;
}

.mk .price {
    font-size: 19px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.trend-up {
    color: var(--green);
}

.trend-down {
    color: var(--red);
}

.spark {
    grid-column: 1 / -1;
    width: 100%;
    height: 42px;
    display: block;
    border-radius: 6px;
    background: linear-gradient(rgba(79, 122, 40, .04), rgba(79, 122, 40, 0));
}

.sell {
    grid-column: 1 / -1;
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
    padding-top: 8px;
    border-top: 1px dashed var(--line);
}

.sell input {
    width: 80px;
}

.sell .preview {
    font-size: 12px;
    color: var(--muted);
    flex-basis: 100%;
}

.offer {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 4px 10px;
    align-items: center;
    font-size: 13px;
}

.offer input {
    width: 70px;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.form-grid label {
    display: grid;
    gap: 4px;
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
}

.form-grid .full {
    grid-column: 1 / -1;
}

/* žebříček – každá farma jako karta, první tři s medailí */
.player {
    display: grid;
    grid-template-columns: 28px 1fr auto;
    gap: 2px 10px;
    align-items: center;
    padding: 9px 12px 9px 10px;
    margin-bottom: 6px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-s);
    cursor: pointer;
    transition: box-shadow .15s, transform .1s, border-color .15s;
}

.player:hover {
    border-color: var(--line-2);
    box-shadow: var(--shadow);
    transform: translateY(-1px);
}

.player .rank {
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--panel-2);
    color: var(--muted);
    font-weight: 700;
    font-size: 12px;
}

.player:nth-of-type(1) .rank {
    background: linear-gradient(#f6d76b, #d9a520);
    color: #4a3500;
}

.player:nth-of-type(2) .rank {
    background: linear-gradient(#e4e7ea, #aeb4ba);
    color: #3a3f44;
}

.player:nth-of-type(3) .rank {
    background: linear-gradient(#e8b98a, #b97a43);
    color: #3d2410;
}

.online {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #3fb950;
    display: inline-block;
    margin-left: 6px;
    vertical-align: 1px;
    box-shadow: 0 0 0 3px rgba(63, 185, 80, .2);
}

.empty {
    color: var(--muted);
    font-size: 13px;
    padding: 10px 12px;
    border: 1px dashed var(--line-2);
    border-radius: 10px;
    background: rgba(255, 255, 255, .35);
}

.btn-row {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.warn-text {
    color: var(--red);
    font-weight: 600;
}

.clickable {
    cursor: pointer;
    transition: box-shadow .15s, transform .1s, border-color .15s;
}

.clickable:hover {
    border-color: var(--line-2);
    box-shadow: var(--shadow);
    transform: translateY(-1px);
}

/* emoji staveb na malé dlaždici */
.icon {
    display: inline-grid;
    place-items: center;
    width: 26px;
    height: 26px;
    margin-right: 3px;
    border-radius: 7px;
    background: var(--panel-2);
    box-shadow: inset 0 0 0 1px var(--line);
    font-size: 15px;
    line-height: 1;
    vertical-align: middle;
}

.seg {
    display: flex;
    gap: 4px;
    background: #ebe3cf;
    padding: 3px;
    border-radius: 10px;
    margin-bottom: 12px;
    box-shadow: inset 0 1px 2px rgba(60, 45, 20, .1);
}

.seg button {
    flex: 1;
    border: 0;
    background: transparent;
    padding: 6px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    color: var(--muted);
    transition: background .15s, color .15s;
}

.seg button:hover {
    color: var(--ink);
}

.seg button.on {
    background: #fff;
    color: var(--ink);
    box-shadow: var(--shadow-s);
}

.neg {
    color: var(--red);
}

.alert {
    background: var(--red-bg);
    border: 1px solid #f3b8ae;
    border-left: 4px solid var(--red);
    color: #8a2a1b;
    border-radius: var(--radius);
    padding: 10px 12px;
    margin-bottom: 12px;
    font-size: 13px;
}

/* ------------------------------------------------------------ banka – přehled hospodaření */

.seg.small {
    margin: 0;
    padding: 2px;
}

.seg.small button {
    padding: 3px 10px;
    font-size: 12px;
    white-space: nowrap;
}

.econ-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 20px 2px 8px;
}

.econ-head h2 {
    flex: 1;
    margin: 0 !important;
}

.stat-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(104px, 1fr));
    gap: 6px;
    margin-bottom: 8px;
}

.stat {
    display: grid;
    gap: 2px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 8px 10px;
    box-shadow: var(--shadow-s);
}

.stat span {
    font-size: 11px;
    color: var(--muted);
}

/* velká čísla s proporčními číslicemi */
.stat b {
    font-size: 15px;
    white-space: nowrap;
}

.pos {
    color: #1f6f3a;
}

.stat b.neg {
    color: var(--red);
}

.chart-card {
    padding: 10px 12px 8px;
}

.chart-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 12.5px;
    font-weight: 700;
    margin-bottom: 4px;
}

.chart-key {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 400;
    color: var(--muted);
}

.chart-key i {
    width: 9px;
    height: 9px;
    border-radius: 2px;
    margin-left: 6px;
}

.chart {
    display: block;
    width: 100%;
    height: auto;
    overflow: visible;
}

.chart .grid {
    stroke: #ece5d4;
    stroke-width: 1;
}

.chart .base {
    stroke: #c9bda3;
    stroke-width: 1;
}

.chart .ax {
    font-size: 10px;
    fill: var(--muted);
}

.chart .xhair {
    stroke: #b9ab8c;
    stroke-width: 1;
}

.chart .hit {
    fill: transparent;
    cursor: crosshair;
}

.chart .bar {
    transition: opacity .1s;
}

.chart .bar.dim {
    opacity: .35;
}

.chart-tip {
    position: fixed;
    z-index: 60;
    display: grid;
    gap: 1px;
    max-width: 230px;
    padding: 7px 10px;
    border-radius: 9px;
    background: rgba(36, 32, 26, .95);
    color: #fff;
    font-size: 12px;
    line-height: 1.45;
    pointer-events: none;
    box-shadow: 0 6px 18px rgba(0, 0, 0, .3);
}

.chart-tip .muted {
    color: rgba(255, 255, 255, .65);
    font-size: 11px;
}

/* složení majetku – skládaný pruh s 2px mezerami, krajní konce zaoblené */
.worth-bar {
    display: flex;
    gap: 2px;
    height: 14px;
    margin-bottom: 10px;
}

.worth-bar i {
    min-width: 3px;
}

.worth-bar i:first-child {
    border-radius: 4px 0 0 4px;
}

.worth-bar i:last-child {
    border-radius: 0 4px 4px 0;
}

.worth-bar i:only-child {
    border-radius: 4px;
}

.legend {
    display: grid;
    grid-template-columns: 12px 1fr auto 40px;
    gap: 5px 8px;
    align-items: center;
    font-size: 13px;
}

.legend .sw {
    width: 12px;
    height: 12px;
    border-radius: 3px;
}

.legend .num {
    text-align: right;
}

.legend b:last-of-type {
    text-align: right;
}

.legend > b {
    padding-top: 5px;
    border-top: 1px solid var(--line);
}

.ledger {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.ledger td,
.ledger th {
    padding: 4px 0;
    border-bottom: 1px dashed var(--line);
    text-align: left;
}

.ledger .num {
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.ledger tr.sec th {
    padding-top: 10px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .6px;
    color: #8a7c62;
    border-bottom: 1px solid var(--line-2);
}

.ledger tr.sec:first-child th {
    padding-top: 0;
}

.ledger tr.sum td {
    font-weight: 700;
    border-bottom: 0;
}

.ledger tr.total td {
    font-weight: 700;
    font-size: 14px;
    padding-top: 8px;
    border-top: 2px solid var(--line-2);
    border-bottom: 0;
}

.day-table summary {
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
}

.day-table[open] summary {
    margin-bottom: 6px;
}

.plan-worker {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
}

.plan-worker select {
    flex: 1;
    font-weight: 400;
}

/* ------------------------------------------------------------ osevní plány */

/* nový plán: pořadí plodin pod sebou, číslo vlevo */
.crop-seq {
    display: grid;
    gap: 5px;
}

.crop-seq label {
    display: grid;
    grid-template-columns: 22px 1fr;
    align-items: center;
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
}

.plan .check {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 13px;
}

.plan-save {
    justify-self: start;
}

/* karta plánu: plodiny jako čipy se šipkami, příští zlatě */
.crop-chips {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    margin: 6px 0 4px;
}

.crop-chips .chip.next {
    background: #fff3d6;
    border-color: #f0d68f;
    font-weight: 600;
}

.crop-chips .arrow {
    color: var(--muted);
    font-size: 12px;
}

.plan-card.paused {
    opacity: .7;
}

.plan-card .btn-row {
    margin-top: 6px;
}

.queue-item.from-plan {
    border-style: dashed;
}

/* zbytek práce po poruše – dodělá se po opravě */
.queue-item.resume {
    box-shadow: inset 3px 0 0 var(--red), var(--shadow-s);
}

/* ------------------------------------------------------------ obchodník */

.trader-card.hired {
    border-color: #ecd27a;
    box-shadow: inset 3px 0 0 var(--wheat), var(--shadow-s);
}

.card.mk.watched {
    box-shadow: inset 3px 0 0 var(--wheat), var(--shadow-s);
}

/* nastavení u zboží: nechat [ ] t · min. [ ] Kč/t, pod tím co obchodník dělá */
.trader-set {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 6px;
    padding: 7px 0 2px;
    border-top: 1px dashed var(--line);
    font-size: 12.5px;
    color: var(--muted);
}

.trader-set input {
    width: 76px;
    padding: 3px 6px;
}

.ts-label {
    font-weight: 600;
    color: var(--ink);
}

.ts-status {
    flex-basis: 100%;
}

.ts-status.go {
    color: var(--green);
}

.ts-status.wait {
    color: #8a6200;
}

/* ------------------------------------------------------------ hlášky */

.toasts {
    position: fixed;
    right: 16px;
    bottom: 16px;
    display: grid;
    gap: 8px;
    z-index: 50;
    width: min(370px, calc(100% - 32px));
}

.toast {
    position: relative;
    background: rgba(36, 32, 26, .95);
    color: #fff;
    padding: 11px 14px 11px 44px;
    border-radius: 12px;
    border-left: 4px solid var(--green-l);
    box-shadow: 0 8px 24px rgba(0, 0, 0, .3);
    font-size: 13px;
    line-height: 1.4;
    animation: toast-in .2s ease-out;
}

.toast::before {
    content: "✓";
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    display: grid;
    place-items: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--green-l);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
}

.toast.err {
    background: rgba(62, 30, 24, .96);
    border-left-color: #e5604a;
}

.toast.err::before {
    content: "!";
    background: #e5604a;
}

@keyframes toast-in {
    from {
        transform: translateY(8px);
        opacity: 0;
    }
}

button {
    touch-action: manipulation;
}

.sheet-handle,
.mobile-only {
    display: none;
}

/* ------------------------------------------------------------ mobil
   mapa přes celou obrazovku, panel jako vysouvací list zespodu */

@media (max-width: 900px) {
    .game {
        height: 100dvh;
    }

    .main {
        display: block;
        position: relative;
    }

    .mapwrap {
        position: absolute;
        inset: 0 0 60px 0;
    }

    .side {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        height: 60px;
        z-index: 20;
        border-left: 0;
        border-radius: 16px 16px 0 0;
        box-shadow: 0 -4px 18px rgba(0, 0, 0, .2);
        transition: height .2s ease;
    }

    .side.open {
        height: min(60dvh, 560px);
    }

    .side .panel {
        display: none;
    }

    .side.open .panel {
        display: block;
    }

    .sheet-handle {
        display: block;
        position: absolute;
        top: 4px;
        left: 50%;
        transform: translateX(-50%);
        width: 44px;
        height: 5px;
        border: 0;
        border-radius: 3px;
        background: var(--line-2);
        padding: 0;
        cursor: pointer;
    }

    /* sbalený list ukazuje jen záložky – ikonky + popisky pod úchytem */
    .tabs {
        padding: 10px 2px 0;
        border-radius: 16px 16px 0 0;
    }

    .tabs button {
        padding: 3px 0 5px;
        font-size: 11px;
    }

    .topbar {
        gap: 5px 6px;
        padding: 6px 8px;
    }

    .tb-farm {
        font-size: 14px;
        max-width: 29vw;
        margin: 0 0 0 -5px;
        padding: 1px 5px;
        gap: 5px;
        min-width: 0;
    }

    .tb-level {
        font-size: 10px;
        padding: 1px 6px;
    }

    .tb-stat {
        padding: 3px 7px;
        gap: 4px;
    }

    .tb-ico {
        font-size: 14px;
    }

    /* odhlášení je na mobilu v záložce Hráči, v liště by ji zalomilo */
    #logout,
    .tb-spacer {
        display: none;
    }

    .mobile-only {
        display: flex;
    }

    .tb-farm b {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    /* popisky se nevejdou, sezóna ale zůstává – rozhoduje, co jde sít */
    .tb-user,
    .tb-label:not(#tb-season) {
        display: none;
    }

    .tb-stat b {
        font-size: 13px;
    }

    /* kalendář na mobilu na celou šířku pod ostatními údaji */
    .tb-cal {
        order: 10;
        flex: 1 1 100%;
        max-width: none;
    }

    .cal-days i.sstart {
        margin-left: 3px;
    }

    /* na mobilu je panel vysouvací list, schovávací tlačítko nepotřebuje */
    .side-toggle {
        display: none;
    }

    /* nástroje v jednom řádku, posouvají se prstem */
    .toolbar {
        left: 8px;
        right: 8px;
        top: 8px;
        flex-wrap: nowrap;
        overflow-x: auto;
        max-width: none;
        scrollbar-width: none;
    }

    .toolbar::-webkit-scrollbar {
        display: none;
    }

    .toolbar button,
    .toolbar select {
        flex: 0 0 auto;
        min-height: 40px;
    }

    .mapctl {
        bottom: 10px;
        right: 8px;
    }

    .mapctl button {
        min-width: 42px;
        min-height: 40px;
        justify-content: center;
    }

    .hint {
        top: 66px;
        white-space: normal;
        width: max-content;
        max-width: calc(100% - 24px);
        text-align: center;
    }

    .plan {
        position: fixed;
        left: 8px;
        right: 8px;
        bottom: 68px;
        width: auto;
        max-height: 55dvh;
        overflow: auto;
        z-index: 25;
    }

    .opt {
        padding: 10px 12px;
    }

    .toasts {
        top: 64px;
        bottom: auto;
        left: 8px;
        right: 8px;
        width: auto;
    }

    .btn.small {
        padding: 7px 11px;
        font-size: 13px;
    }
}
