/* ESKA Label Print - warstwa wizualna.
   Mobile first, zero zewnetrznych zasobow (RODO: zadnych fontow z CDN).
   Zasada ukladu: krok kadrowania MUSI zmiescic sie na jednym ekranie -
   klient stoi przy ladzie i nie ma jak wygodnie scrollowac jedna reka. */

:root {
    --navy: #0a1733;
    --navy-2: #16244a;
    --navy-3: #22346a;
    --accent: #12b886;
    --accent-dark: #0d8f6a;
    --line: #e3e7ef;
    --bg: #f4f6fb;
    --ink: #0a1733;
    --muted: #5b6479;
    --ok: #12805c;
    --warn: #9a6b00;
    --bad: #b3261e;
    --radius: 16px;
    --shadow: 0 1px 2px rgba(10,23,51,.06), 0 8px 24px rgba(10,23,51,.07);
    --shadow-lg: 0 2px 6px rgba(10,23,51,.08), 0 18px 48px rgba(10,23,51,.16);
}

* { box-sizing: border-box; }

html, body {
    margin: 0; padding: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: "Segoe UI", Roboto, -apple-system, "Helvetica Neue", Arial, sans-serif;
    font-size: 17px;
    line-height: 1.45;
    -webkit-text-size-adjust: 100%;
    overscroll-behavior-y: contain;
}

body {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}

.wrap {
    width: 100%;
    max-width: 560px;
    margin: 0 auto;
    padding: 0 16px 8px;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* ---------- pasek gorny z heksagonowym wzorem ESKA ---------- */
header.top {
    background:
        url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='56' height='48' viewBox='0 0 56 48'><path d='M14 0l14 8v16l-14 8L0 24V8z' fill='none' stroke='rgba(255,255,255,.07)' stroke-width='1.5'/><path d='M42 0l14 8v16l-14 8-14-8V8z' fill='none' stroke='rgba(255,255,255,.07)' stroke-width='1.5'/><path d='M28 24l14 8v16l-14 8-14-8V32z' fill='none' stroke='rgba(255,255,255,.05)' stroke-width='1.5'/></svg>"),
        linear-gradient(120deg, var(--navy) 0%, var(--navy-2) 58%, var(--navy-3) 100%);
    color: #fff;
    padding: 13px 16px;
    box-shadow: 0 2px 14px rgba(10,23,51,.18);
    position: relative;
    z-index: 5;
}
header.top .inner {
    max-width: 560px; margin: 0 auto;
    display: flex; align-items: center; gap: 10px;
}
header.top .logo {
    height: 30px; width: auto; flex: 0 0 auto;
    filter: drop-shadow(0 2px 8px rgba(0,0,0,.28));
}
header.top .brand { font-weight: 800; letter-spacing: .06em; font-size: 18px; }
header.top .sub { opacity: .7; font-size: 13.5px; margin-inline-start: auto; letter-spacing: .01em; }

/* ---------- pasek krokow ---------- */
.steps { display: flex; gap: 7px; margin: 14px 0 10px; flex: 0 0 auto; }
.steps i {
    flex: 1; height: 5px; border-radius: 3px; background: var(--line);
    position: relative; overflow: hidden;
}
.steps i.on::after {
    content: ""; position: absolute; inset: 0;
    background: linear-gradient(90deg, var(--accent), var(--accent-dark));
    animation: fill .45s cubic-bezier(.2,.7,.3,1) both;
}
@keyframes fill { from { transform: translateX(-100%); } to { transform: none; } }

h1 { font-size: 25px; line-height: 1.18; margin: 8px 0 6px; letter-spacing: -.015em; }
p.lead { margin: 0 0 16px; color: var(--muted); }
.hint { font-size: 14px; color: var(--muted); margin-top: 10px; }

/* kroki 2 i 3 maja ciasniejszy naglowek, zeby wszystko weszlo na ekran */
.tight h1 { font-size: 20px; margin: 4px 0 2px; }
.tight p.lead { font-size: 14.5px; margin: 0 0 10px; }

section { animation: rise .34s cubic-bezier(.2,.7,.3,1) both; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 18px;
    margin-bottom: 14px;
    box-shadow: var(--shadow);
}

/* ---------- przyciski ---------- */
.btn {
    display: block; width: 100%;
    padding: 15px 18px;
    border: 0; border-radius: 13px;
    background: linear-gradient(180deg, var(--navy-2), var(--navy));
    color: #fff;
    font-size: 17px; font-weight: 650;
    text-align: center; cursor: pointer;
    font-family: inherit;
    box-shadow: 0 2px 10px rgba(10,23,51,.22);
    transition: transform .12s ease, box-shadow .18s ease, opacity .18s ease;
    text-decoration: none;
}
.btn:active { transform: translateY(1px) scale(.995); box-shadow: 0 1px 5px rgba(10,23,51,.2); }
.btn:disabled { opacity: .5; box-shadow: none; }
.btn.go { background: linear-gradient(180deg, var(--accent), var(--accent-dark)); box-shadow: 0 3px 14px rgba(18,184,134,.4); }
.btn.ghost { background: #fff; color: var(--navy); border: 1.5px solid var(--line); box-shadow: none; font-weight: 600; }
.btn + .btn { margin-top: 9px; }

/* ---------- krok 2: kadrowanie na jeden ekran ---------- */
#stepCrop { display: flex; flex-direction: column; min-height: 0; flex: 1; }

.stage-wrap {
    text-align: center;
    flex: 1 1 auto;
    min-height: 0;
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 6px;
}
.stage {
    position: relative;
    display: inline-block;
    line-height: 0;
    border-radius: 12px;
    overflow: hidden;
    background: #1d2330;
    box-shadow: var(--shadow-lg);
    touch-action: none;
    user-select: none;
    max-width: 100%;
    max-height: 100%;
}
/* obrazek dyktuje rozmiar sceny, wiec ramka w procentach zawsze trafia idealnie */
.stage img {
    display: block;
    max-width: 100%;
    max-height: min(57vh, 520px);
    width: auto; height: auto;
    pointer-events: none;
}

.crop {
    position: absolute;
    border: 2px solid #fff;
    box-shadow: 0 0 0 9999px rgba(8,16,34,.62);
    cursor: move;
    animation: pop .3s cubic-bezier(.2,.8,.3,1) both;
}
@keyframes pop { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: none; } }
.crop::after {
    content: "";
    position: absolute; inset: 0;
    background:
        linear-gradient(to right, transparent 33%, rgba(255,255,255,.28) 33%, rgba(255,255,255,.28) 33.4%, transparent 33.4%,
                        transparent 66.6%, rgba(255,255,255,.28) 66.6%, rgba(255,255,255,.28) 67%, transparent 67%),
        linear-gradient(to bottom, transparent 33%, rgba(255,255,255,.28) 33%, rgba(255,255,255,.28) 33.4%, transparent 33.4%,
                        transparent 66.6%, rgba(255,255,255,.28) 66.6%, rgba(255,255,255,.28) 67%, transparent 67%);
    pointer-events: none;
}
.h { position: absolute; width: 46px; height: 46px; background: transparent; }
.h::before {
    content: ""; position: absolute;
    width: 22px; height: 22px;
    border: 3px solid #fff;
    border-radius: 2px;
    box-shadow: 0 1px 4px rgba(0,0,0,.4);
}
.h.tl { left: -23px; top: -23px; }     .h.tl::before { left: 13px; top: 13px; border-right: 0; border-bottom: 0; }
.h.tr { right: -23px; top: -23px; }    .h.tr::before { right: 13px; top: 13px; border-left: 0; border-bottom: 0; }
.h.bl { left: -23px; bottom: -23px; }  .h.bl::before { left: 13px; bottom: 13px; border-right: 0; border-top: 0; }
.h.br { right: -23px; bottom: -23px; } .h.br::before { right: 13px; bottom: 13px; border-left: 0; border-top: 0; }

/* pasek akcji przyklejony do dolu - przycisk zawsze pod kciukiem */
.actionbar {
    position: sticky; bottom: 0;
    flex: 0 0 auto;
    padding: 8px 0 calc(10px + env(safe-area-inset-bottom));
    background: linear-gradient(to top, var(--bg) 62%, rgba(244,246,251,0));
}
.tools { display: flex; gap: 9px; margin-bottom: 9px; }
.tools .btn { padding: 12px 8px; font-size: 15px; margin: 0; }

.pages { display: flex; gap: 7px; justify-content: center; margin: 6px 0 0; flex-wrap: wrap; }
.pages button {
    border: 1.5px solid var(--line); background: #fff; color: var(--navy);
    border-radius: 9px; padding: 7px 14px; font: inherit; font-size: 15px; cursor: pointer;
}
.pages button[aria-current="true"] { background: var(--navy); color: #fff; border-color: var(--navy); }

/* ---------- krok 3: podglad naklejki ---------- */
.sticker-wrap { text-align: center; margin: 2px 0 10px; }
.sticker {
    display: inline-block;
    position: relative;
    border-radius: 8px;
    background: #fff;
    padding: 6px;
    box-shadow: var(--shadow-lg);
    animation: rise .4s cubic-bezier(.2,.7,.3,1) both;
}
.sticker img {
    display: block;
    max-height: min(38vh, 330px);
    width: auto; max-width: 100%;
    border-radius: 4px;
}
/* delikatny przeblysk, zeby podglad wygladal jak fizyczna naklejka */
.sticker::after {
    content: ""; position: absolute; inset: 0; border-radius: 8px; pointer-events: none;
    background: linear-gradient(115deg, rgba(255,255,255,0) 42%, rgba(255,255,255,.55) 50%, rgba(255,255,255,0) 58%);
    transform: translateX(-120%);
    animation: sheen 1.5s .35s cubic-bezier(.3,.6,.3,1) both;
}
@keyframes sheen { to { transform: translateX(120%); } }
.proof-cap { text-align: center; font-size: 13.5px; color: var(--muted); margin: 0 0 14px; }

.verdict {
    display: flex; gap: 11px; align-items: flex-start;
    padding: 14px; border-radius: 13px; margin-bottom: 14px;
    font-size: 15.5px; line-height: 1.4;
    animation: rise .3s .08s cubic-bezier(.2,.7,.3,1) both;
}
.verdict .dot { width: 11px; height: 11px; border-radius: 50%; flex: 0 0 auto; margin-top: 6px; }
.verdict.ok   { background: #e6f6ef; color: #0d5f45; } .verdict.ok .dot   { background: var(--ok); box-shadow: 0 0 0 4px rgba(18,128,92,.14); }
.verdict.warn { background: #fdf3e0; color: #6b4b00; } .verdict.warn .dot { background: var(--warn); box-shadow: 0 0 0 4px rgba(154,107,0,.14); }
.verdict.bad  { background: #fdeceb; color: #8c1d18; } .verdict.bad .dot  { background: var(--bad); box-shadow: 0 0 0 4px rgba(179,38,30,.14); }

#code {
    width: 100%; padding: 14px;
    border: 1.5px solid var(--line); border-radius: 12px;
    font: inherit; font-size: 26px; letter-spacing: .3em;
    text-align: center; font-variant-numeric: tabular-nums;
}
#code:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 4px rgba(18,184,134,.16); }

/* ---------- krok 4: gotowe ---------- */
.done-mark { display: block; margin: 6px auto 12px; width: 84px; height: 84px; }
.done-mark circle {
    fill: none; stroke: var(--accent); stroke-width: 4;
    stroke-dasharray: 232; stroke-dashoffset: 232;
    animation: draw .6s cubic-bezier(.3,.7,.3,1) forwards;
}
.done-mark path {
    fill: none; stroke: var(--accent); stroke-width: 6; stroke-linecap: round; stroke-linejoin: round;
    stroke-dasharray: 60; stroke-dashoffset: 60;
    animation: draw .35s .5s cubic-bezier(.3,.7,.3,1) forwards;
}
@keyframes draw { to { stroke-dashoffset: 0; } }

.pulse { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .55; } }

/* ---------- konto, tegoed, pakiety ---------- */
.card-h { font-size: 16px; margin: 0 0 10px; letter-spacing: -.01em; }

.bal {
    margin: 0 0 12px; padding: 12px 14px;
    background: #e6f6ef; color: #0d5f45;
    border-radius: 12px; font-weight: 650; font-size: 16px; text-align: center;
}

.subbox { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }

.code-in {
    width: 100%; padding: 13px;
    border: 1.5px solid var(--line); border-radius: 12px;
    font: inherit; font-size: 21px; letter-spacing: .2em;
    text-align: center; text-transform: uppercase;
    font-variant-numeric: tabular-nums;
    margin-bottom: 10px;
}
.code-in:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 4px rgba(18,184,134,.16); }

.codecard { border-color: var(--accent); box-shadow: 0 4px 20px rgba(18,184,134,.22); }
.codecard .ttl { margin: 0; font-size: 14px; color: var(--muted); }
.codecard .big-code {
    margin: 4px 0 8px; font-size: 30px; font-weight: 800;
    letter-spacing: .16em; text-align: center; color: var(--navy);
    font-variant-numeric: tabular-nums;
}

.txt-in {
    width: 100%; padding: 13px;
    border: 1.5px solid var(--line); border-radius: 12px;
    font: inherit; margin-bottom: 9px;
}
.txt-in:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 4px rgba(18,184,134,.16); }

.gbtn { display: flex; align-items: center; justify-content: center; gap: 10px; }

.or {
    display: flex; align-items: center; gap: 12px;
    color: var(--muted); font-size: 13px; margin: 14px 0;
}
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.lnk { color: var(--navy); text-decoration: underline; text-underline-offset: 3px; }

.buy {
    margin-inline-start: 10px;
    border: 0; border-radius: 9px; padding: 7px 14px;
    background: linear-gradient(180deg, var(--accent), var(--accent-dark));
    color: #fff; font: inherit; font-size: 14px; font-weight: 650; cursor: pointer;
}
.buy:active { transform: translateY(1px); }

.pkgs { list-style: none; margin: 0; padding: 0; }
.pkgs li {
    display: flex; align-items: baseline; gap: 10px;
    padding: 9px 0; border-bottom: 1px solid var(--line);
}
.pkgs li:last-child { border-bottom: 0; }
.pkgs .n { font-weight: 700; min-width: 2.4em; }
.pkgs .n::after { content: " x"; font-weight: 400; color: var(--muted); }
.pkgs .p { font-weight: 650; }
.pkgs .u { margin-inline-start: auto; font-size: 13.5px; color: var(--muted); }

/* ---------- jezyki i stopka ---------- */
.langs { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 20px; }
.langs a {
    font-size: 14px; color: var(--muted); text-decoration: none;
    border: 1px solid var(--line); background: #fff;
    border-radius: 999px; padding: 6px 13px;
    transition: transform .12s ease;
}
.langs a:active { transform: scale(.96); }
.langs a[aria-current="true"] { background: var(--navy); color: #fff; border-color: var(--navy); }

footer.credit {
    text-align: center;
    padding: 16px 16px calc(18px + env(safe-area-inset-bottom));
    font-size: 12.5px;
    color: #8a93a6;
    flex: 0 0 auto;
}
footer.credit a { color: #6b7488; text-decoration: none; border-bottom: 1px solid var(--line); }
footer.credit .sep { opacity: .5; margin: 0 7px; }

.spinner {
    width: 20px; height: 20px; border-radius: 50%;
    border: 3px solid rgba(255,255,255,.3); border-top-color: #fff;
    animation: spin .8s linear infinite; display: inline-block; vertical-align: -4px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.hidden { display: none !important; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
