:root {
  --bg: #0b0a0a;
  --surface: #151313;
  --surface-2: #1d1a19;
  --line: #2e2826;
  --text: #f5efe8;
  --muted: #a1978f;
  --orange: #ff6a1a;
  --orange-soft: rgba(255, 106, 26, .55);
  --green: #76ff40;
  --green-soft: rgba(118, 255, 64, .5);
  --yellow: #ffd633;
  --danger: #ff5a5a;
  --radius: 18px;
  --display: Impact, "Anton", "Oswald", "Arial Narrow", "Roboto Condensed", system-ui, sans-serif;
  --body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(90% 50% at 50% -10%, rgba(255, 106, 26, .16), transparent 70%),
    var(--bg);
  color: var(--text);
  font: 16px/1.5 var(--body);
}
a { color: var(--orange); }
img { max-width: 100%; }
[hidden] { display: none !important; }

.wrap { max-width: 460px; margin: 0 auto; padding: 20px 16px calc(32px + env(safe-area-inset-bottom)); }
.wrap.narrow { max-width: 380px; }
.wrap.wide { max-width: 900px; }
.center { text-align: center; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.green { color: var(--green); }

/* ---------- Marka ---------- */
.brand { display: flex; align-items: center; gap: 14px; margin: 4px 0 18px; }
.brand img { border-radius: 50%; box-shadow: 0 0 0 1px var(--line), 0 0 24px rgba(255, 106, 26, .25); }
.brand p { margin: 0; }
.brand-name { font: 28px/1 var(--display); letter-spacing: .02em; color: var(--orange); text-shadow: 0 0 10px var(--orange-soft); }
.brand-tag { color: var(--green); font-size: 13px; letter-spacing: .08em; text-transform: uppercase; text-shadow: 0 0 8px var(--green-soft); }
.brand-small .brand-name { font-size: 22px; }

.neon {
  font: 44px/1.02 var(--display);
  letter-spacing: .01em;
  text-transform: uppercase;
  margin: 8px 0 10px;
  color: #fff4ea;
  text-shadow: 0 0 6px var(--orange), 0 0 18px var(--orange-soft), 0 0 40px rgba(255, 106, 26, .35);
}
.lead { font-size: 18px; color: #e8ded5; margin: 0 0 20px; }
.lead strong { color: #fff; }

/* ---------- Karta z pieczątkami ---------- */
.loyalty {
  background: linear-gradient(180deg, #1b1413 0%, #0f0d0d 100%);
  border: 1px solid #3a2a22;
  border-radius: var(--radius);
  padding: 16px 14px 14px;
  box-shadow: 0 0 0 1px rgba(255, 106, 26, .08), 0 18px 50px rgba(0, 0, 0, .5), 0 0 40px rgba(255, 106, 26, .08);
  margin-bottom: 16px;
}
.loyalty.is-demo { opacity: .95; }
.loyalty-top { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 10px; padding: 0 4px; }
.loyalty-top .right { text-align: right; min-width: 0; }
.loyalty-top strong { display: block; font: 26px/1.1 var(--display); letter-spacing: .02em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.label { display: block; font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--orange); }
.message { margin: 10px 4px 0; color: var(--muted); font-size: 14px; min-height: 1.5em; }

.stamps { display: grid; grid-template-columns: repeat(var(--cols, 5), 1fr); gap: 6px; }
.stamp { aspect-ratio: 1; }
.stamp svg { display: block; width: 100%; height: 100%; overflow: visible; }
.stamp circle { fill: var(--disc); stroke: var(--ring); stroke-width: var(--ring-w, 2.5); }
.stamp {
  --disc: #1a191b; --ring: #3e3a3a;
  --bun: #2d2a2e; --bun2: #2d2a2e; --meat: #2d2a2e; --cheese: #2d2a2e; --leaf: #2d2a2e; --seed: transparent;
  --star: #3a6e26;
  transition: transform .3s;
}
.stamp.is-reward { --disc: #121c0f; --ring: #3a6e26; --bun: #22381a; --bun2: #22381a; --meat: #22381a; --cheese: #22381a; --leaf: #22381a; }
.stamp.is-filled {
  --disc: #2c1208; --ring: var(--orange); --ring-w: 5;
  --bun: #f0a03a; --bun2: #e28c30; --meat: #5c2c16; --cheese: #ffcd32; --leaf: #6ecd3c; --seed: #fff0cd;
  filter: drop-shadow(0 0 5px rgba(255, 106, 26, .75));
}
.stamp.is-reward.is-filled { --disc: #14280e; --ring: var(--green); --star: var(--yellow); filter: drop-shadow(0 0 6px rgba(118, 255, 64, .8)); }
.stamp.is-new { animation: stamp-in .7s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes stamp-in {
  0% { transform: scale(1.9) rotate(-18deg); opacity: 0; }
  60% { transform: scale(.92) rotate(3deg); opacity: 1; }
  100% { transform: scale(1) rotate(0); }
}

.ready {
  margin: 0 0 16px;
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(118, 255, 64, .1);
  border: 1px solid rgba(118, 255, 64, .45);
  color: #dfffd2;
  box-shadow: 0 0 24px rgba(118, 255, 64, .15);
}
.ready strong { color: var(--green); }

/* ---------- Kod QR ---------- */
.qr-box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; text-align: center; margin-bottom: 16px; }
.qr { background: #fff; border-radius: 14px; padding: 12px; width: min(240px, 70vw); margin: 0 auto; aspect-ratio: 1; }
.qr svg { display: block; width: 100%; height: 100%; }
.code { font: 700 24px/1 ui-monospace, "SF Mono", Menlo, Consolas, monospace; letter-spacing: .12em; margin: 14px 0 4px; }
.qr-box .muted { margin: 0; font-size: 14px; }

/* ---------- Wallet ---------- */
.wallets { display: grid; gap: 10px; margin-bottom: 8px; }
.wallet-btn {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  min-height: 56px; padding: 8px 18px;
  background: #000; color: #fff; text-decoration: none;
  border: 1px solid #5a5552; border-radius: 12px;
}
.wallet-btn svg { width: 30px; height: 30px; fill: none; stroke: #fff; stroke-width: 1.6; }
.wallet-btn span { display: flex; flex-direction: column; font-size: 19px; font-weight: 600; line-height: 1.1; }
.wallet-btn small { font-size: 12px; font-weight: 400; }
.wallet-btn.is-other { order: 2; opacity: .8; }

.notice { padding: 12px 14px; border-radius: 12px; background: rgba(255, 106, 26, .12); border: 1px solid rgba(255, 106, 26, .4); margin: 0 0 16px; }
.hint { color: var(--muted); font-size: 14px; text-align: center; }
.alert { padding: 10px 12px; border-radius: 10px; background: rgba(255, 90, 90, .12); border: 1px solid rgba(255, 90, 90, .5); color: #ffd6d6; margin: 0; }

.howto { margin: 20px 0 0; border-top: 1px solid var(--line); padding-top: 12px; color: #d7cdc4; }
.howto summary { cursor: pointer; font-weight: 600; }

/* ---------- Formularze i przyciski ---------- */
.join { display: grid; gap: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 20px; }
.field { display: grid; gap: 6px; }
.field span { font-weight: 600; }
.field small { font-weight: 400; color: var(--muted); }
input[type=text], input:not([type]), input[type=password] {
  width: 100%; min-height: 50px; padding: 10px 14px;
  background: #0e0c0c; color: var(--text);
  border: 1px solid #3b3431; border-radius: 12px;
  font: inherit; font-size: 17px;
}
input:focus-visible, button:focus-visible, a:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }
.pin { font-size: 28px !important; letter-spacing: .4em; text-align: center; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; }
.check input { width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--orange); flex: none; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 10px 20px;
  background: var(--orange); color: #140800;
  border: 0; border-radius: 14px;
  font: 700 17px/1.1 var(--body); text-decoration: none; cursor: pointer;
  box-shadow: 0 0 18px rgba(255, 106, 26, .35);
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: default; }
.btn-xl { width: 100%; min-height: 58px; font-size: 19px; }
.btn-green { background: var(--green); color: #061300; box-shadow: 0 0 22px rgba(118, 255, 64, .35); }
.btn-ghost { background: transparent; color: var(--text); border: 1px solid #4a423e; box-shadow: none; }
.linkish { background: none; border: 0; color: var(--orange); font: inherit; cursor: pointer; padding: 0; }

.steps { counter-reset: s; list-style: none; padding: 0; margin: 0 0 24px; display: grid; gap: 12px; }
.steps li { counter-increment: s; position: relative; padding: 2px 0 0 46px; color: #d9cfc6; }
.steps li::before {
  content: counter(s); position: absolute; left: 0; top: 0;
  width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center;
  font: 18px/1 var(--display); color: var(--orange);
  border: 2px solid var(--orange); box-shadow: 0 0 10px var(--orange-soft);
}
.steps strong { color: #fff; }

.foot { margin-top: 28px; text-align: center; font-size: 14px; }
.foot p { margin: 4px 0; }

.prose h2 { font: 22px/1.2 var(--display); letter-spacing: .02em; color: var(--orange); margin: 26px 0 8px; }
.prose p, .prose li { color: #ddd3ca; }
.prose ol { padding-left: 22px; }
.prose .neon { font-size: 34px; }

/* ---------- Panel obsługi ---------- */
.panel { max-width: 520px; margin: 0 auto; padding: 0 12px calc(24px + env(safe-area-inset-bottom)); }
.panel-bar { display: flex; align-items: center; gap: 8px; padding: 14px 4px; }
.panel-bar strong { font: 22px/1 var(--display); color: var(--orange); letter-spacing: .03em; }
.panel-bar nav { margin-left: auto; display: flex; gap: 16px; align-items: center; }
.panel-bar form { margin: 0; }

.viewfinder { position: relative; aspect-ratio: 1; border-radius: 22px; overflow: hidden; background: #000; border: 1px solid var(--line); }
.viewfinder video { width: 100%; height: 100%; object-fit: cover; display: block; }
.frame {
  position: absolute; inset: 18%;
  border-radius: 18px;
  box-shadow: 0 0 0 999px rgba(0, 0, 0, .45), inset 0 0 16px var(--orange-soft);
  border: 3px solid var(--orange);
}
.viewfinder.is-hit .frame { border-color: var(--green); box-shadow: 0 0 0 999px rgba(0, 0, 0, .45), inset 0 0 22px var(--green-soft); }
.scan-status { position: absolute; left: 0; right: 0; bottom: 10px; margin: 0; text-align: center; font-weight: 600; text-shadow: 0 1px 4px #000; }
.scan > .btn { margin-top: 12px; }
.manual { display: flex; gap: 8px; margin-top: 12px; }
.manual input { flex: 1; min-width: 0; text-transform: uppercase; letter-spacing: .08em; }

.sheet { display: grid; gap: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 16px; }
.sheet-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.c-name { font-size: 22px; font-weight: 700; }
.c-code { font: 600 15px ui-monospace, Menlo, monospace; letter-spacing: .1em; color: var(--muted); }
.c-counter { font: 40px/1 var(--display); color: var(--orange); text-shadow: 0 0 10px var(--orange-soft); white-space: nowrap; }
.sheet .ready { margin: 0; font-size: 18px; }
.qty { display: flex; align-items: center; justify-content: center; gap: 18px; }
.qty button {
  width: 54px; height: 54px; border-radius: 50%;
  background: var(--surface-2); color: var(--text); border: 1px solid #4a423e;
  font-size: 28px; line-height: 1; cursor: pointer;
}
.qty output { font: 40px/1 var(--display); min-width: 2ch; text-align: center; }

.toast {
  position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  max-width: calc(100% - 32px); padding: 12px 18px; border-radius: 14px;
  background: #222; border: 1px solid #444; box-shadow: 0 10px 30px rgba(0, 0, 0, .5);
  font-weight: 600; z-index: 10;
}
.toast.is-ok { border-color: var(--green); color: #e6ffdc; }
.toast.is-bad { border-color: var(--danger); color: #ffe0e0; }

/* ---------- Statystyki ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-bottom: 16px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; }
.tile strong { display: block; font: 34px/1.1 var(--display); letter-spacing: .02em; }
.tile small { color: var(--muted); }
.box { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 16px; margin-bottom: 16px; overflow-x: auto; }
.box h2 { margin: 0 0 12px; font-size: 17px; }
.bars { display: grid; grid-template-columns: repeat(14, 1fr); gap: 4px; height: 150px; align-items: end; }
.bar { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 3px; }
.bar-fill { width: 100%; max-width: 26px; background: var(--orange); border-radius: 4px 4px 0 0; min-height: 2px; }
.bar-n { font-size: 11px; color: var(--muted); }
.bar-d { font-size: 11px; color: var(--muted); }
.events { width: 100%; border-collapse: collapse; font-size: 14px; }
.events th, .events td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.events th { color: var(--muted); font-weight: 600; }
.events .is-undone td { text-decoration: line-through; color: var(--muted); }
.checks { list-style: none; padding: 0; margin: 0 0 14px; display: grid; gap: 6px; }
.checks li::before { content: "●"; margin-right: 8px; }
.checks .is-ok::before { color: var(--green); }
.checks .is-bad::before { color: var(--danger); }
.checks .is-off::before { color: #666; }
.row { display: flex; flex-wrap: wrap; gap: 10px; }
.row form { margin: 0; }

/* ---------- Plakat ---------- */
.print-body { background: #000; }
.poster {
  width: 210mm; min-height: 297mm; margin: 0 auto; padding: 18mm 16mm;
  display: flex; flex-direction: column; align-items: center; text-align: center;
  background: #050505; color: #fff;
}
.poster-logo { width: 62mm; border-radius: 50%; }
.poster .neon { font-size: 22mm; margin: 6mm 0 2mm; }
.poster-lead { font: 11mm/1.1 var(--display); margin: 0 0 8mm; text-transform: uppercase; }
.poster-qr { width: 95mm; height: 95mm; background: #fff; padding: 5mm; border-radius: 6mm; box-shadow: 0 0 0 2mm var(--orange), 0 0 12mm rgba(255, 106, 26, .6); }
.poster-qr svg { width: 100%; height: 100%; display: block; }
.poster-steps { list-style: none; counter-reset: s; padding: 0; margin: 10mm 0 0; font-size: 6mm; line-height: 1.35; text-align: left; }
.poster-steps li { counter-increment: s; margin: 0 0 3mm; }
.poster-steps li::before { content: counter(s) "."; color: var(--orange); font-family: var(--display); margin-right: 3mm; }
.poster-url { margin-top: auto; font-size: 5mm; color: #bbb; letter-spacing: .05em; }
.no-print { padding: 16px; display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.print-body.is-light { background: #eee; }
.is-light .poster { background: #fff; color: #111; }
.is-light .poster .neon { color: #111; text-shadow: none; }
.is-light .poster-qr { box-shadow: 0 0 0 2mm var(--orange); }
.is-light .poster-url { color: #555; }

@media print {
  @page { size: A4; margin: 0; }
  .no-print { display: none; }
  body, .print-body { background: none; }
  .poster { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
@media (max-width: 800px) {
  .poster { width: 100%; min-height: 0; padding: 24px 16px; }
  .poster .neon { font-size: 44px; }
  .poster-lead { font-size: 24px; }
  .poster-qr { width: min(80vw, 320px); height: min(80vw, 320px); }
  .poster-steps { font-size: 17px; }
  .poster-logo { width: 160px; }
}
@media (prefers-reduced-motion: reduce) {
  .stamp.is-new { animation: none; }
}
