/* ---------- Buttons ---------- */
.btn {
    --btn-bg: var(--surface-2);
    --btn-fg: var(--text);
    --btn-line: var(--line-strong);
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    min-height: var(--tap);
    padding: 0 var(--space-5);
    border: 1px solid var(--btn-line);
    border-radius: var(--radius-pill);
    background: var(--btn-bg);
    color: var(--btn-fg);
    font-weight: 700;
    font-size: var(--step-0);
    letter-spacing: 0.005em;
    text-decoration: none;
    cursor: pointer;
    user-select: none;
    transition: transform var(--dur-1) var(--ease-out), background var(--dur-2), box-shadow var(--dur-2), border-color var(--dur-2), opacity var(--dur-2);
}

:is([data-direction="kour"], [data-direction="kourb"]) .btn { border-radius: var(--radius-m); }

.btn:hover { color: var(--btn-fg); border-color: var(--text-3); }
.btn:active { transform: scale(0.97); }

.btn--primary {
    --btn-bg: linear-gradient(180deg, var(--accent-2), var(--accent) 60%);
    --btn-fg: var(--accent-ink);
    --btn-line: transparent;
    box-shadow: 0 0 0 0 var(--glow), 0 8px 24px -8px var(--glow);
}

.btn--primary:hover { box-shadow: 0 0 0 4px var(--accent-soft), 0 10px 30px -8px var(--glow); border-color: transparent; }
.btn--ghost { --btn-bg: transparent; --btn-line: transparent; --btn-fg: var(--text-2); }
.btn--ghost:hover { --btn-bg: var(--surface); }
.btn--danger { --btn-bg: var(--danger-soft); --btn-fg: var(--danger); --btn-line: color-mix(in oklab, var(--danger) 40%, transparent); }
.btn--block { width: 100%; }
.btn--sm { min-height: 44px; padding: 0 var(--space-4); font-size: var(--step--1); }
.btn--lg { min-height: 58px; padding: 0 var(--space-6); font-size: var(--step-1); }

.btn--icon {
    width: var(--tap);
    padding: 0;
    border-radius: 50%;
}

.btn svg { width: 20px; height: 20px; flex: none; }

.btn:disabled,
.btn[aria-disabled="true"] {
    opacity: 0.45;
    pointer-events: none;
}

/* Busy: label fades, an ember spinner takes its place, width stays. */
.btn[aria-busy="true"] { pointer-events: none; }
.btn[aria-busy="true"] > * { opacity: 0; }
.btn[aria-busy="true"]::after {
    content: "";
    position: absolute;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2.5px solid currentColor;
    border-right-color: transparent;
    animation: spin 0.7s linear infinite;
}

/* ---------- Forms ---------- */
.field { display: grid; gap: var(--space-2); }

.label {
    font-weight: 700;
    font-size: var(--step--1);
    color: var(--text-2);
}

.input,
.textarea,
.select {
    width: 100%;
    min-height: var(--tap);
    padding: 0 var(--space-4);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-m);
    background: var(--bg-sunken);
    color: var(--text);
    font-size: 16px; /* prevents iOS zoom on focus */
    transition: border-color var(--dur-2), box-shadow var(--dur-2), background var(--dur-2);
}

.textarea { padding: var(--space-3) var(--space-4); min-height: 110px; resize: vertical; }
.input::placeholder, .textarea::placeholder { color: var(--text-3); }

.input:focus,
.textarea:focus,
.select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-soft);
    background: var(--bg);
}

.select {
    appearance: none;
    padding-right: 44px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238a7e72' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 18px;
}

.help { font-size: var(--step--1); color: var(--text-3); }
.field--error .input, .field--error .textarea { border-color: var(--danger); }
.field--error .input:focus { box-shadow: 0 0 0 4px var(--danger-soft); }
.error-text { font-size: var(--step--1); color: var(--danger); font-weight: 600; display: flex; gap: 6px; align-items: center; }

.search { position: relative; }
.search .input { padding-left: 46px; padding-right: 46px; border-radius: var(--radius-pill); }
.search__icon { position: absolute; left: 16px; top: 50%; translate: 0 -50%; width: 20px; color: var(--text-3); pointer-events: none; }
.search__clear { position: absolute; right: 4px; top: 50%; translate: 0 -50%; }
.search .input:placeholder-shown ~ .search__clear { opacity: 0; pointer-events: none; }

/* Switch */
.switch { display: inline-flex; align-items: center; gap: var(--space-3); cursor: pointer; min-height: var(--tap); }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch__track {
    position: relative;
    width: 52px;
    height: 30px;
    border-radius: 99px;
    background: var(--surface-2);
    border: 1px solid var(--line-strong);
    transition: background var(--dur-2);
    flex: none;
}
.switch__track::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--text-2);
    transition: translate var(--dur-2) var(--ease-spring), background var(--dur-2), box-shadow var(--dur-2);
}
.switch input:checked + .switch__track { background: var(--accent-soft); border-color: var(--accent); }
.switch input:checked + .switch__track::after { translate: 22px 0; background: var(--accent); box-shadow: 0 0 12px var(--glow); }
.switch input:focus-visible + .switch__track { outline: 2px solid var(--accent-2); outline-offset: 3px; }

/* Checkbox + radio */
.check { display: flex; align-items: center; gap: var(--space-3); min-height: var(--tap); cursor: pointer; }
.check input {
    appearance: none;
    flex: none;
    width: 24px;
    height: 24px;
    margin: 0;
    border: 1.5px solid var(--line-strong);
    border-radius: 7px;
    background: var(--bg-sunken);
    display: grid;
    place-content: center;
    transition: background var(--dur-2), border-color var(--dur-2);
}
.check input[type="radio"] { border-radius: 50%; }
.check input::after {
    content: "";
    width: 12px;
    height: 12px;
    scale: 0;
    transition: scale var(--dur-2) var(--ease-spring);
    background: var(--accent-ink);
    clip-path: polygon(14% 52%, 0 66%, 38% 100%, 100% 22%, 86% 8%, 37% 70%);
}
.check input[type="radio"]::after { clip-path: circle(50%); width: 10px; height: 10px; }
.check input:checked { background: var(--accent); border-color: var(--accent); }
.check input:checked::after { scale: 1; }

/* Segmented control */
.segmented {
    display: inline-grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    padding: 4px;
    gap: 4px;
    background: var(--bg-sunken);
    border: 1px solid var(--line);
    border-radius: var(--radius-pill);
}
:is([data-direction="kour"], [data-direction="kourb"]) .segmented { border-radius: var(--radius-m); }
.segmented button {
    min-height: 44px;
    padding: 0 var(--space-4);
    border: 0;
    border-radius: inherit;
    background: transparent;
    color: var(--text-2);
    font-weight: 700;
    cursor: pointer;
    transition: background var(--dur-2), color var(--dur-2);
}
.segmented button svg { width: 20px; height: 20px; display: block; }
.segmented button[aria-pressed="true"] { background: var(--surface-2); color: var(--text); box-shadow: var(--shadow-1); }

/* Stepper */
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line-strong); border-radius: var(--radius-pill); background: var(--bg-sunken); }
.stepper output { min-width: 3ch; text-align: center; font-weight: 800; font-size: var(--step-1); }
.stepper .btn { border: 0; }

/* ---------- Chips, tags, badges ---------- */
.chip {
    --chip-fg: var(--text-2);
    --chip-bg: var(--surface);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 28px;
    padding: 0 12px;
    border-radius: var(--radius-pill);
    background: var(--chip-bg);
    color: var(--chip-fg);
    border: 1px solid color-mix(in oklab, var(--chip-fg) 22%, transparent);
    font-size: var(--step--1);
    font-weight: 700;
    white-space: nowrap;
}
:is([data-direction="kour"], [data-direction="kourb"]) .chip { border-radius: var(--radius-s); }
.chip--ok { --chip-fg: var(--ok); --chip-bg: var(--ok-soft); }
.chip--off { --chip-fg: var(--text-3); --chip-bg: transparent; }
.chip--accent { --chip-fg: var(--accent-2); --chip-bg: var(--accent-soft); }
.chip--warn { --chip-fg: var(--warn); --chip-bg: var(--warn-soft); }
.chip__dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

.chip--live { --chip-fg: #fff; --chip-bg: var(--accent); border-color: transparent; }
.chip--live .chip__dot { animation: live-pulse 1.6s var(--ease-out) infinite; }

.tag {
    display: inline-flex;
    align-items: center;
    height: 26px;
    padding: 0 10px;
    border-radius: var(--radius-s);
    background: var(--bg-sunken);
    color: var(--text-2);
    font-size: var(--step--1);
    font-weight: 600;
}

/* Strength 1-5: five little bars */
.strength { display: inline-flex; align-items: flex-end; gap: 3px; height: 16px; }
.strength i { width: 5px; border-radius: 2px; background: var(--line-strong); }
.strength i:nth-child(1) { height: 30%; }
.strength i:nth-child(2) { height: 47%; }
.strength i:nth-child(3) { height: 64%; }
.strength i:nth-child(4) { height: 82%; }
.strength i:nth-child(5) { height: 100%; }
.strength i.on { background: linear-gradient(var(--accent-2), var(--accent)); }

/* Rank badge: hexagon-ish ember plate */
.rank {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 26px;
    padding: 0 10px 0 4px;
    border-radius: var(--radius-pill);
    background: var(--bg-sunken);
    border: 1px solid var(--line);
    font-size: var(--step--1);
    font-weight: 800;
    color: var(--text-2);
}
.rank__icon { width: 18px; height: 18px; }
.rank--1 { --rank: var(--rank-1); }
.rank--2 { --rank: var(--rank-2); }
.rank--3 { --rank: var(--rank-3); }
.rank--4 { --rank: var(--rank-4); }
.rank--5 { --rank: var(--rank-5); }
.rank--6 { --rank: var(--rank-6); }
.rank { color: var(--rank); border-color: color-mix(in oklab, var(--rank) 30%, transparent); }

/* Avatar + name chip */
.avatar {
    --size: 36px;
    flex: none;
    width: var(--size);
    height: var(--size);
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-weight: 800;
    font-size: calc(var(--size) * 0.4);
    color: var(--accent-ink);
    background: radial-gradient(circle at 35% 30%, var(--ember-1), var(--ember-2) 45%, var(--ember-3));
    box-shadow: 0 0 0 2px var(--bg), 0 0 0 3.5px var(--rank, transparent);
}
.avatar--ash { background: linear-gradient(145deg, var(--coal-top), var(--coal-right)); color: var(--text-2); }
.avatar--lg { --size: 64px; }
.avatar-stack { display: flex; }
.avatar-stack .avatar { --size: 28px; margin-left: -8px; }
.avatar-stack .avatar:first-child { margin-left: 0; }

.namechip { display: inline-flex; align-items: center; gap: var(--space-2); font-weight: 700; }
.namechip small { display: block; font-weight: 600; color: var(--text-3); font-size: 0.78em; }

/* ---------- Cards ---------- */
.card {
    position: relative;
    background: var(--bg-raised);
    border: 1px solid var(--line);
    border-radius: var(--radius-l);
    box-shadow: var(--shadow-1);
    overflow: hidden;
}
.card__body { padding: var(--space-4); }
@media (min-width: 720px) { .card__body { padding: var(--space-5); } }
a.card { color: inherit; text-decoration: none; transition: transform var(--dur-2) var(--ease-out), border-color var(--dur-2); }
a.card:hover { transform: translateY(-2px); border-color: var(--line-strong); }
a.card:active { transform: scale(0.99); }
.card--link { transition: transform var(--dur-2) var(--ease-out), border-color var(--dur-2); }
.card--link:hover { transform: translateY(-2px); border-color: var(--line-strong); }
.stretched { color: inherit; text-decoration: none; }
.stretched::after { content: ""; position: absolute; inset: 0; }
.above-stretch { position: relative; z-index: 1; }

/* Event card: the number is the hero */
.event-card { display: grid; grid-template-columns: auto 1fr; }
.event-card__num {
    display: grid;
    place-content: center;
    min-width: 92px;
    padding: var(--space-4);
    background:
        radial-gradient(120% 90% at 50% 120%, var(--accent-soft), transparent 70%),
        var(--surface);
    border-right: 1px dashed var(--line-strong);
    text-align: center;
}
.event-card__num b {
    font-family: var(--font-display);
    font-weight: var(--display-weight);
    font-size: var(--step-4);
    line-height: 0.9;
    color: var(--accent-2);
    letter-spacing: var(--display-tracking);
}
.event-card__num span { font-size: var(--step--1); color: var(--text-3); font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; }
.event-card__title { font-size: var(--step-1); margin: 6px 0 2px; }
.event-card--live { border-color: color-mix(in oklab, var(--accent) 60%, var(--line)); box-shadow: 0 0 0 1px var(--accent-soft), 0 18px 60px -20px var(--glow); }

/* Capacity bar */
.capacity { display: grid; gap: 6px; }
.capacity__bar { height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.capacity__bar i { display: block; height: 100%; width: var(--pct); border-radius: inherit; background: linear-gradient(90deg, var(--accent-2), var(--accent)); }
.capacity--full .capacity__bar i { background: var(--danger); }

/* Bowl card */
.bowl-card__head { display: flex; align-items: center; gap: var(--space-3); }
.station-badge {
    flex: none;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: var(--radius-m);
    background: var(--bg-sunken);
    border: 1px solid var(--line-strong);
    font-family: var(--font-display);
    font-weight: var(--display-weight);
    font-size: var(--step-1);
}
.bowl-card__smoke { font-weight: 800; font-size: var(--step-1); line-height: 1.2; }
.bowl-card__pair { display: flex; align-items: center; gap: 8px; color: var(--text-2); font-size: var(--step--1); margin-top: 2px; }
.bowl-card__pair svg { width: 16px; height: 16px; color: var(--accent-2); }

/* Tobacco card */
.tobacco-card { display: grid; gap: var(--space-2); }
.tobacco-card__brand { font-size: var(--step--1); font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-3); }
.tobacco-card__name { font-family: var(--font-display); font-weight: var(--display-weight); font-size: var(--step-2); letter-spacing: var(--display-tracking); line-height: 1.05; }
.tobacco-card__meta { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: var(--step--1); color: var(--text-2); }
.tobacco-card__meta b { color: var(--text); }

/* Feed photo card */
.feed-card__img {
    aspect-ratio: 4 / 5;
    width: 100%;
    object-fit: cover;
    background: var(--surface-2);
}
.feed-card__body { display: grid; gap: var(--space-3); padding: var(--space-3) var(--space-4) var(--space-4); }
.feed-card__actions { display: flex; align-items: center; gap: var(--space-2); }
.react {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 44px;
    padding: 0 14px;
    border-radius: var(--radius-pill);
    border: 1px solid var(--line);
    background: transparent;
    color: var(--text-2);
    font-weight: 800;
    cursor: pointer;
    transition: background var(--dur-2), color var(--dur-2), border-color var(--dur-2);
}
.react .coal { --size: 20px; }
.react[aria-pressed="false"] .coal__glow { opacity: 0.25; filter: grayscale(1); }
.react[aria-pressed="true"] { color: var(--accent-2); background: var(--accent-soft); border-color: color-mix(in oklab, var(--accent) 45%, transparent); }
.react[aria-pressed="true"] .coal { animation: pop var(--dur-3) var(--ease-spring); }

.feed-grid { display: grid; gap: var(--space-4); grid-template-columns: 1fr; }
@media (min-width: 640px) { .feed-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1000px) { .feed-grid { grid-template-columns: repeat(3, 1fr); } }

/* Stat tiles */
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-3); }
@media (min-width: 720px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat { padding: var(--space-4); border-radius: var(--radius-m); background: var(--bg-raised); border: 1px solid var(--line); }
.stat b { display: block; font-family: var(--font-display); font-weight: var(--display-weight); font-size: var(--step-3); line-height: 1; letter-spacing: var(--display-tracking); }
.stat span { font-size: var(--step--1); color: var(--text-3); font-weight: 700; }

/* ---------- Leaderboard ---------- */
.board { display: grid; gap: var(--space-2); list-style: none; margin: 0; padding: 0; counter-reset: board; }
.board li {
    counter-increment: board;
    display: grid;
    grid-template-columns: 40px 1fr auto;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-m);
    background: var(--bg-raised);
    border: 1px solid var(--line);
}
.board li::before {
    content: counter(board);
    font-family: var(--font-display);
    font-weight: var(--display-weight);
    font-size: var(--step-2);
    color: var(--text-3);
    text-align: center;
}
.board li:nth-child(1) { border-color: color-mix(in oklab, var(--accent) 55%, var(--line)); background: linear-gradient(90deg, var(--accent-soft), var(--bg-raised) 70%); }
.board li:nth-child(1)::before { color: var(--accent-2); text-shadow: 0 0 18px var(--glow); }
.board li:nth-child(2)::before { color: var(--text); }
.board li:nth-child(3)::before { color: var(--text-2); }
.board__score { text-align: right; }
.board__score b { font-family: var(--font-display); font-size: var(--step-2); font-weight: var(--display-weight); }

/* ---------- Badges (Odznaky) ---------- */
.badges { display: grid; gap: var(--space-3); grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); list-style: none; margin: 0; padding: 0; }
.badge { display: grid; align-content: start; gap: 6px; padding: var(--space-3); border-radius: var(--radius-m); background: var(--bg-raised); border: 1px solid var(--line); }
.badge__name { display: flex; align-items: center; gap: 6px; font-weight: 800; }
.badge__icon { flex: none; width: 22px; height: 22px; color: var(--text-3); opacity: 0.45; }
.badge__hint { font-size: var(--step--1); color: var(--text-3); }
.badge--earned { border-color: color-mix(in oklab, var(--accent) 45%, var(--line)); background: linear-gradient(160deg, var(--accent-soft), var(--bg-raised) 70%); }
.badge--earned .badge__icon { color: var(--accent-2); opacity: 1; filter: drop-shadow(0 0 6px var(--glow)); }
.badge--secret .badge__name::after { content: "tajný"; margin-left: auto; font-size: 11px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent-2); }
.badge__bar { height: 4px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.badge__bar i { display: block; height: 100%; width: calc(var(--pct) * 1%); background: linear-gradient(90deg, var(--ember-3), var(--accent)); }
.badge-mini { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-2); }
.badge-mini svg { width: 16px; height: 16px; }
.badge-row { display: inline-flex; flex-wrap: wrap; gap: 4px; }

/* ---------- Sbírka and Žár ---------- */
.meter { display: block; height: 6px; border-radius: 6px; background: var(--surface-2); overflow: hidden; }
.meter i { display: block; height: 100%; width: calc(var(--pct) * 1%); background: linear-gradient(90deg, var(--ember-3), var(--accent)); }
.meter-row { display: grid; grid-template-columns: 1fr auto; gap: 6px var(--space-2); align-items: baseline; }
.meter-row .meter { grid-column: 1 / -1; }
.meter-row__label { font-weight: 700; }
.meter-row--small { font-size: var(--step--1); color: var(--text-2); }
.meter-row--small .meter { height: 4px; }
.stamp { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border: 1.5px solid var(--accent); border-radius: var(--radius-s); color: var(--accent-2); font-size: 12px; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; white-space: nowrap; rotate: -2deg; }
.stamp svg { width: 14px; height: 14px; }
.stamp--line { rotate: 0deg; border-style: dashed; justify-self: start; }
.tasted { display: inline-flex; align-items: center; gap: 4px; justify-self: start; padding: 1px 8px 1px 4px; border-radius: 999px; background: var(--ok-soft); color: var(--ok); font-size: 12px; font-weight: 800; }
.tasted__icon, .tasted svg { width: 14px; height: 14px; }
.tasted--half { background: transparent; border: 1px dashed var(--ok); padding-left: 8px; }
.zar-summary__total { font-family: var(--font-display); font-size: var(--step-2); font-weight: var(--display-weight); }
.zar-summary .meter { max-width: 320px; }
.zar-history { display: grid; gap: var(--space-2); list-style: none; margin: 0; padding: 0; }
.zar-history li { display: grid; grid-template-columns: 4.5em 1fr auto; gap: var(--space-2); align-items: baseline; padding: var(--space-2) 0; border-bottom: 1px solid var(--line); }
.zar-history__points { color: var(--accent-2); }
.collection-brands { display: grid; gap: var(--space-3); grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.collection-brand__name { font-size: var(--step-1); }
.collection-flavours { display: grid; gap: 6px; list-style: none; margin: 0; }
.collection-flavours li { display: flex; justify-content: space-between; gap: var(--space-2); align-items: center; }

/* ---------- Recommendations ---------- */
.recs { display: grid; gap: var(--space-3); grid-template-columns: 1fr; list-style: none; margin: 0; padding: 0; }
@media (min-width: 640px) { .recs { grid-template-columns: repeat(2, 1fr); } }
.recs__item { display: grid; gap: 4px; color: inherit; text-decoration: none; }
.recs__name { font-family: var(--font-display); font-weight: var(--display-weight); font-size: var(--step-1); line-height: 1.1; }
.recs__tea { display: inline-flex; align-items: center; gap: 6px; font-size: var(--step--1); color: var(--text-2); }

/* ---------- Navigation ---------- */
.appbar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    gap: var(--space-3);
    min-height: 60px;
    padding: 0 var(--gutter);
    background: color-mix(in oklab, var(--bg) 82%, transparent);
    backdrop-filter: blur(14px) saturate(1.4);
    -webkit-backdrop-filter: blur(14px) saturate(1.4);
    border-bottom: 1px solid color-mix(in oklab, var(--line) 70%, transparent);
}
.appbar__title { font-weight: 800; font-size: var(--step-1); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.topnav { display: none; gap: var(--space-1); margin-left: auto; }
.topnav a { padding: 8px 14px; border-radius: var(--radius-pill); color: var(--text-2); text-decoration: none; font-weight: 700; }
.topnav a:hover { color: var(--text); background: var(--surface); }
.topnav a[aria-current="page"] { color: var(--text); background: var(--surface-2); }
@media (min-width: 900px) { .topnav { display: flex; } }
.appbar__more { margin-left: auto; flex: none; }
@media (min-width: 900px) { .appbar__more { margin-left: 0; } }
@media (min-width: 900px) and (max-width: 1199px) { .topnav a { padding: 8px 9px; font-size: var(--step--1); } }

.tabbar {
    position: fixed;
    inset: auto 0 0;
    z-index: 40;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    align-items: end;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    background: color-mix(in oklab, var(--bg-raised) 88%, transparent);
    backdrop-filter: blur(16px) saturate(1.4);
    -webkit-backdrop-filter: blur(16px) saturate(1.4);
    border-top: 1px solid var(--line);
}
.tabbar--static { position: relative; border: 1px solid var(--line); border-radius: var(--radius-l); }
@media (min-width: 900px) { .tabbar:not(.tabbar--static) { display: none; } }

.tabbar a {
    display: grid;
    justify-items: center;
    gap: 2px;
    padding: 6px 0;
    color: var(--text-3);
    text-decoration: none;
    font-size: 11px;
    font-weight: 700;
}
.tabbar a svg { width: 24px; height: 24px; }
.tabbar a[aria-current="page"] { color: var(--text); }
.tabbar a[aria-current="page"] svg { color: var(--accent-2); }

.tabbar__fab {
    justify-self: center;
    display: grid;
    place-items: center;
    width: 60px;
    height: 60px;
    margin-top: -26px;
    border-radius: 50%;
    background: radial-gradient(circle at 40% 30%, var(--ember-1), var(--accent) 55%, var(--ember-3));
    color: var(--accent-ink) !important;
    box-shadow: 0 0 0 5px var(--bg-raised), 0 10px 30px -6px var(--glow);
}
.tabbar__fab svg { width: 28px !important; height: 28px !important; color: var(--accent-ink) !important; }

/* ---------- Sheet + dialog ---------- */
.scrim {
    position: fixed;
    inset: 0;
    z-index: 60;
    background: rgb(0 0 0 / 0.55);
    backdrop-filter: blur(2px);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--dur-2);
}
.scrim[data-open] { opacity: 1; pointer-events: auto; }

.sheet {
    position: fixed;
    inset: auto 0 0;
    z-index: 70;
    max-height: 88dvh;
    display: flex;
    flex-direction: column;
    padding: 10px var(--gutter) calc(var(--space-5) + env(safe-area-inset-bottom));
    background: var(--bg-raised);
    border-top: 1px solid var(--line-strong);
    border-radius: var(--radius-l) var(--radius-l) 0 0;
    box-shadow: var(--shadow-2);
    translate: 0 105%;
    transition: translate var(--dur-3) var(--ease-out);
}
.sheet[data-open] { translate: 0 0; }
.sheet__grip { width: 44px; height: 5px; margin: 0 auto var(--space-4); border-radius: 9px; background: var(--line-strong); }
.sheet__body { overflow-y: auto; overscroll-behavior: contain; }
@media (min-width: 720px) {
    .sheet { inset: auto auto 50% 50%; width: min(520px, 92vw); border-radius: var(--radius-l); border: 1px solid var(--line-strong); translate: -50% calc(50% + 40px); opacity: 0; pointer-events: none; transition: translate var(--dur-3) var(--ease-out), opacity var(--dur-2); }
    .sheet[data-open] { translate: -50% 50%; opacity: 1; pointer-events: auto; }
    .sheet__grip { display: none; }
}

.picklist { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.picklist button {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    min-height: 52px;
    padding: 0 var(--space-3);
    border: 0;
    border-radius: var(--radius-m);
    background: transparent;
    text-align: left;
    cursor: pointer;
}
.picklist button:hover { background: var(--surface); }
.picklist button[aria-selected="true"] { background: var(--accent-soft); color: var(--accent-2); font-weight: 800; }

/* ---------- Toasts ---------- */
.toasts {
    position: fixed;
    z-index: 90;
    left: 50%;
    bottom: calc(92px + env(safe-area-inset-bottom));
    translate: -50% 0;
    display: grid;
    gap: var(--space-2);
    width: min(440px, calc(100vw - 2 * var(--gutter)));
    pointer-events: none;
}
@media (min-width: 900px) { .toasts { bottom: var(--space-6); } }
.toast {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-m);
    background: var(--surface-2);
    border: 1px solid var(--line-strong);
    box-shadow: var(--shadow-2);
    font-weight: 700;
    pointer-events: auto;
    animation: toast-in var(--dur-3) var(--ease-spring);
}
.toast svg { width: 22px; height: 22px; flex: none; }
.toast--ok svg { color: var(--ok); }
.toast--queued svg { color: var(--warn); }
.toast--error { border-color: color-mix(in oklab, var(--danger) 50%, transparent); }
.toast--error svg { color: var(--danger); }
.toast[data-leaving] { animation: toast-out var(--dur-2) var(--ease-out) forwards; }

/* Connection banner */
.netbar {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    justify-content: center;
    padding: 8px var(--gutter);
    background: var(--warn-soft);
    color: var(--warn);
    font-size: var(--step--1);
    font-weight: 700;
}

/* ---------- Loaders ---------- */
.topbar-progress { position: relative; height: 3px; overflow: hidden; background: var(--surface); border-radius: 3px; }
.topbar-progress::after {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 40%;
    background: linear-gradient(90deg, transparent, var(--accent-2), var(--accent), transparent);
    box-shadow: 0 0 12px var(--glow);
    animation: slide 1.1s var(--ease-out) infinite;
}

/* The signature loader: one coal that breathes */
.ember-loader { display: inline-grid; place-items: center; gap: var(--space-2); color: var(--text-3); font-size: var(--step--1); font-weight: 700; }
.ember-loader .coal { --size: 44px; }
.ember-loader .coal__glow { animation: breathe 1.4s ease-in-out infinite; }

/* Three coals igniting in turn */
.coal-dots { display: inline-flex; gap: 6px; }
.coal-dots .coal { --size: 18px; }
.coal-dots .coal__lit { animation: ignite 1.2s ease-in-out infinite; }
.coal-dots .coal:nth-child(2) .coal__lit { animation-delay: 0.2s; }
.coal-dots .coal:nth-child(3) .coal__lit { animation-delay: 0.4s; }

/* Smoke wisp loader */
.smoke-loader { position: relative; width: 56px; height: 64px; }
.smoke-loader i {
    position: absolute;
    left: 50%;
    bottom: 6px;
    width: 18px;
    height: 18px;
    margin-left: -9px;
    border-radius: 50%;
    background: var(--text-3);
    filter: blur(5px);
    opacity: 0;
    animation: smoke-rise 2.1s ease-out infinite;
}
.smoke-loader i:nth-child(2) { animation-delay: 0.7s; }
.smoke-loader i:nth-child(3) { animation-delay: 1.4s; }

.skeleton {
    border-radius: var(--radius-s);
    background: linear-gradient(100deg, var(--surface) 30%, color-mix(in oklab, var(--surface-2) 70%, var(--accent) 6%) 50%, var(--surface) 70%);
    background-size: 300% 100%;
    animation: shimmer 1.5s linear infinite;
}
.skeleton--text { height: 0.9em; margin: 0.35em 0; }
.skeleton--title { height: 1.6em; width: 70%; }
.skeleton--img { aspect-ratio: 4 / 5; border-radius: 0; }
.skeleton--circle { border-radius: 50%; width: 36px; height: 36px; }

.ring-progress { --pct: 0; width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--accent) calc(var(--pct) * 1%), var(--surface-2) 0); font-size: 12px; font-weight: 800; }
.ring-progress::before { content: ""; grid-area: 1 / 1; width: 46px; height: 46px; border-radius: 50%; background: var(--bg-raised); }
.ring-progress span { grid-area: 1 / 1; position: relative; }

/* Pull-to-refresh smoke ring */
.smoke-ring { width: 46px; height: 46px; border-radius: 50%; border: 5px solid color-mix(in oklab, var(--text-2) 70%, transparent); filter: blur(1.4px); animation: ring-out 1.6s var(--ease-out) infinite; }

/* ---------- Empty states ---------- */
.empty { display: grid; justify-items: center; gap: var(--space-3); padding: var(--space-7) var(--space-4); text-align: center; }
.empty__art { width: 120px; height: 120px; position: relative; display: grid; place-items: center; }
.empty__art .coal { --size: 64px; }
.empty__art::after { content: ""; position: absolute; inset: auto 20% 10%; height: 10px; border-radius: 50%; background: rgb(0 0 0 / 0.4); filter: blur(6px); z-index: -1; }
.empty h3 { font-size: var(--step-2); }
.empty p { color: var(--text-2); max-width: 34ch; }

/* ---------- Upload ---------- */
.dropzone {
    display: grid;
    justify-items: center;
    gap: var(--space-3);
    padding: var(--space-6) var(--space-4);
    border: 1.5px dashed var(--line-strong);
    border-radius: var(--radius-l);
    background: var(--bg-sunken);
    text-align: center;
    cursor: pointer;
    transition: border-color var(--dur-2), background var(--dur-2);
}
.dropzone:hover,
.dropzone[data-over] { border-color: var(--accent); background: var(--accent-soft); }
.dropzone svg { width: 40px; height: 40px; color: var(--accent-2); }
.upload-item { display: grid; grid-template-columns: 64px 1fr auto; gap: var(--space-3); align-items: center; padding: var(--space-2); border-radius: var(--radius-m); background: var(--surface); }
.upload-item img, .upload-item .skeleton { width: 64px; height: 64px; object-fit: cover; border-radius: var(--radius-s); }

/* ---------- Print: laminated station card (A6) ---------- */
.qr-card {
    width: 105mm;
    max-width: 100%;
    aspect-ratio: 105 / 148;
    display: grid;
    grid-template-rows: auto 1fr auto;
    justify-items: center;
    padding: 9mm 8mm 7mm;
    border-radius: 6mm;
    background: #12100e;
    color: #f3ece4;
    box-shadow: var(--shadow-2);
    text-align: center;
}
.qr-card__num { font-family: var(--font-display); font-weight: 800; font-size: 34mm; line-height: 0.9; color: #ffb03a; letter-spacing: -0.04em; text-shadow: 0 0 10mm rgb(255 98 18 / 0.45); }
.qr-card__qr { width: 46mm; padding: 3mm; border-radius: 3mm; background: #f3ece4; align-self: center; }
.qr-card__hint { font-weight: 700; font-size: 3.6mm; color: #bfb3a6; }

/* ---------- Admin: Servis grid ---------- */
.servis { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-3); }
@media (min-width: 640px) { .servis { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1000px) { .servis { grid-template-columns: repeat(5, 1fr); } }
.servis__tile {
    display: grid;
    gap: 6px;
    align-content: start;
    min-height: 128px;
    padding: var(--space-3);
    border-radius: var(--radius-m);
    border: 1px dashed var(--line-strong);
    background: transparent;
    color: var(--text-3);
    text-align: left;
    cursor: pointer;
}
.servis__tile b { font-family: var(--font-display); font-size: var(--step-3); font-weight: var(--display-weight); color: var(--text-2); line-height: 1; }
.servis__tile--on { border-style: solid; border-color: color-mix(in oklab, var(--accent) 50%, var(--line)); background: linear-gradient(160deg, var(--accent-soft), var(--bg-raised) 60%); color: var(--text); }
.servis__tile--on b { color: var(--accent-2); }

/* ---------- Animations ---------- */
@keyframes spin { to { rotate: 360deg; } }
@keyframes slide { from { translate: -100% 0; } to { translate: 260% 0; } }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -200% 0; } }
@keyframes live-pulse { 0% { box-shadow: 0 0 0 0 rgb(255 255 255 / 0.8); } 100% { box-shadow: 0 0 0 8px rgb(255 255 255 / 0); } }
@keyframes pop { 0% { scale: 1; } 40% { scale: 1.35; } 100% { scale: 1; } }
@keyframes toast-in { from { opacity: 0; translate: 0 16px; scale: 0.96; } }
@keyframes toast-out { to { opacity: 0; translate: 0 10px; } }
@keyframes breathe { 0%, 100% { opacity: 0.25; filter: drop-shadow(0 0 0 transparent); } 50% { opacity: 1; filter: drop-shadow(0 0 10px var(--glow)); } }
@keyframes ignite { 0%, 100% { opacity: 0.15; } 40% { opacity: 1; } }
@keyframes smoke-rise { 0% { opacity: 0; translate: 0 0; scale: 0.6; } 20% { opacity: 0.7; } 100% { opacity: 0; translate: 6px -52px; scale: 2.2; } }
@keyframes ring-out { 0% { scale: 0.4; opacity: 0.9; } 100% { scale: 1.4; opacity: 0; } }
