/* naplac – kiosek (iPad v provozovně). Barvy a fonty jen přes proměnné z core.css / skinu. */

.kiosk {
    display: grid;
    grid-template-rows: auto 1fr auto;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    padding: max(20px, env(safe-area-inset-top)) max(28px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(28px, env(safe-area-inset-left));
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.k-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

/* logo | powered by | admin – prostřední sloupec je opravdu uprostřed, ať je logo jakkoli široké */
.k-foot {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 16px;
}

.k-top .label { font-size: 13px; }

.k-main {
    position: relative;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.k-screen {
    width: 100%;
    max-width: 1100px;
    animation: k-in 0.22s ease-out;
}

@keyframes k-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: none; }
}

.k-title { font-size: clamp(32px, 5vw, 56px); margin: 8px 0 10px; }
.k-name { font-size: clamp(38px, 6.5vw, 76px); margin: 10px 0 12px; overflow-wrap: anywhere; }
.k-sub { font-size: clamp(16px, 1.8vw, 19px); margin: 0; color: var(--text); opacity: 0.9; }

/* --- PIN --- */

.k-pin {
    display: grid;
    grid-template-columns: 1fr minmax(300px, 380px);
    gap: clamp(32px, 6vw, 96px);
    align-items: center;
}

.k-dots {
    display: flex;
    gap: 16px;
    margin-top: 28px;
}

.k-dot {
    width: var(--pin-dot-size);
    height: var(--pin-dot-size);
    border-radius: var(--pin-dot-radius);
    background: var(--pin-dot-off);
    -webkit-mask: var(--pin-dot-mask) center / contain no-repeat;
    mask: var(--pin-dot-mask) center / contain no-repeat;
    transition: background-color 0.12s, transform 0.12s;
}

.k-dot.on {
    background: var(--pin-dot-on);
    transform: scale(1.08);
}

.k-dots.shake { animation: k-shake 0.4s; }

@keyframes k-shake {
    20%, 60% { transform: translateX(-10px); }
    40%, 80% { transform: translateX(10px); }
}

.k-msg {
    min-height: 1.5em;
    margin: 16px 0 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--danger);
}

.k-pad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.k-key {
    aspect-ratio: 1.25;
    border-radius: var(--radius);
    border: 1px solid var(--key-border);
    background: var(--key-bg);
    color: var(--key-text);
    font-family: var(--font-display);
    font-weight: var(--display-weight);
    font-size: clamp(24px, 2.8vw, 32px);
    line-height: 1;
    touch-action: manipulation;
    transition: background-color 0.08s, transform 0.08s;
}

.k-key:active,
.k-key.pressed {
    background: var(--key-active);
    transform: scale(0.97);
}

.k-pad.locked .k-key {
    opacity: 0.35;
    pointer-events: none;
}

.k-key--fn {
    font-family: var(--font-body);
    font-size: 20px;
    font-weight: 500;
    background: transparent;
    border-color: transparent;
    color: var(--text-dim);
}

/* --- potvrzení --- */

.k-warn {
    margin: 18px 0 0;
    max-width: 34em;
    font-size: clamp(15px, 1.6vw, 17px);
    font-weight: 600;
    color: var(--warn);
}

.k-offline {
    position: fixed;
    left: 50%;
    top: max(12px, env(safe-area-inset-top));
    transform: translateX(-50%);
    z-index: 10;
    max-width: calc(100% - 32px);
    padding: 8px 16px;
    border-radius: 999px;
    background: var(--danger);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    text-align: center;
}

.k-confirm,
.k-done,
.k-unpaired { text-align: left; }

.k-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 32px;
    flex-wrap: wrap;
}

.k-action {
    min-width: min(100%, 340px);
    min-height: 84px;
    padding: 14px 32px;
    border: 0;
    border-radius: var(--radius);
    background: var(--accent);
    color: var(--accent-text);
    font-family: var(--font-display);
    font-weight: var(--display-weight);
    text-transform: var(--display-transform);
    font-size: clamp(26px, 3.4vw, 38px);
    letter-spacing: var(--display-tracking);
    touch-action: manipulation;
}

.k-action:active { transform: scale(0.98); }
.k-action:disabled { opacity: 0.6; }

.k-action--out {
    background: transparent;
    color: var(--accent);
    box-shadow: inset 0 0 0 3px var(--accent);
}

.k-back { font-size: 17px; min-height: 56px; padding: 10px 20px; color: var(--text-dim); }

/* --- hotovo --- */

.k-check {
    width: 68px;
    height: 68px;
    border-radius: 50%;
    background: var(--accent);
    position: relative;
}

.k-check::after {
    content: "";
    position: absolute;
    left: 24px;
    top: 13px;
    width: 18px;
    height: 32px;
    border: solid var(--accent-text);
    border-width: 0 6px 6px 0;
    border-radius: 3px;
    transform: rotate(45deg);
}

.k-progress {
    margin-top: 36px;
    height: 5px;
    max-width: 340px;
    border-radius: 3px;
    background: var(--line);
    overflow: hidden;
}

.k-progress span {
    display: block;
    height: 100%;
    width: 100%;
    background: var(--accent);
    transform-origin: left;
}

.k-progress span.run { animation: k-bar var(--done-ms, 5000ms) linear forwards; }

@keyframes k-bar {
    from { transform: scaleX(1); }
    to { transform: scaleX(0); }
}

.k-pair { margin-top: 28px; display: flex; flex-direction: column; gap: 10px; }
.k-pair__row { display: flex; gap: 14px; flex-wrap: wrap; }

.k-pair__input {
    width: 7.5em;
    min-height: 68px;
    padding: 0 20px;
    border-radius: var(--radius);
    border: 2px solid var(--key-border);
    background: var(--key-bg);
    color: var(--key-text);
    font-family: var(--font-display);
    font-weight: var(--display-weight);
    font-size: 34px;
    letter-spacing: 0.12em;
    text-align: center;
    user-select: text;
    -webkit-user-select: text;
}

.k-pair__input:focus { outline: 3px solid var(--accent); outline-offset: 2px; }
.k-pair__go { min-width: 0; min-height: 68px; padding: 10px 28px; font-size: 26px; }
.k-pair__admin { display: inline-block; margin-top: 24px; text-decoration: none; }

/* --- patička --- */

.k-logo { height: 20px; opacity: 0.85; }
.k-admin { justify-self: end; text-decoration: none; opacity: 0.45; padding: 8px 0 8px 16px; }
.k-powered { white-space: nowrap; }

/* --- iPad na výšku / menší displeje --- */

@media (orientation: portrait), (max-width: 820px) {
    .k-pin {
        grid-template-columns: 1fr;
        gap: 36px;
        justify-items: center;
        text-align: center;
    }
    .k-pin__info { display: flex; flex-direction: column; align-items: center; }
    .k-dots { justify-content: center; margin-top: 24px; }
    .k-pad { width: min(100%, 400px); }
    .k-confirm, .k-done, .k-unpaired { text-align: center; }
    .k-actions { justify-content: center; flex-direction: column; }
    .k-pair { align-items: center; }
    .k-pair__row { justify-content: center; }
    .k-check, .k-progress { margin-left: auto; margin-right: auto; }
}

/* úzký displej: logo + podpis + admin se do jedné řady nevejdou, podpis jde pod ně */
@media (max-width: 560px) {
    .k-foot { grid-template-columns: 1fr auto; row-gap: 4px; }
    .k-powered { grid-row: 2; grid-column: 1 / -1; justify-self: center; }
}

/* nízký displej na výšku (telefon): PIN + klávesnice se jinak nevejdou a lezou pod hlavičku a patičku */
@media (max-height: 760px) and (orientation: portrait) {
    .k-pin { gap: 20px; }
    .k-dots { margin-top: 16px; }
    .k-msg { margin-top: 10px; }
    .k-key { aspect-ratio: 1.5; }
}

@media (max-height: 640px) and (orientation: landscape) {
    .k-title { font-size: 32px; }
    .k-key { aspect-ratio: 1.6; }
}
