:root {
  font-family: Inter, system-ui, -apple-system, Segoe UI, sans-serif;
  color: #fff;
  background: #160d35;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  overflow: hidden;
}

.kiosk {
  height: 100dvh;
  overflow: hidden;
  background: radial-gradient(circle at 20% 10%, #ff7a59 0 12%, transparent 28%), linear-gradient(135deg, #160d35, #4c1d95 45%, #0f172a);
  padding: env(safe-area-inset-top, clamp(10px, 2.4vmin, 34px))
           env(safe-area-inset-right, clamp(10px, 2.4vmin, 34px))
           env(safe-area-inset-bottom, clamp(10px, 2.4vmin, 34px))
           env(safe-area-inset-left, clamp(10px, 2.4vmin, 34px));
  display: grid;
  place-items: center;
}

.screen {
  width: min(920px, 100%);
  height: 100%;
  max-height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: clamp(8px, 1.2vmin, 16px);
  justify-content: center;
  overflow: hidden;
}

.hero {
  margin: auto 0;
}

.hero,
.panel {
  background: rgba(255, 255, 255, .13);
  border: 1px solid rgba(255, 255, 255, .25);
  border-radius: clamp(20px, 4vmin, 34px);
  padding: clamp(14px, 3vmin, 32px);
  box-shadow: 0 24px 90px rgba(0, 0, 0, .35);
  backdrop-filter: blur(18px);
}

.panel {
  justify-content: flex-start;
}

h1 {
  font-size: clamp(32px, 7vmin, 78px);
  line-height: .95;
  margin: 0;
  text-align: center;
}

h2 {
  font-size: clamp(24px, 4.6vmin, 52px);
  line-height: 1.05;
  margin: 0;
  text-align: center;
}

.lead {
  font-size: clamp(16px, 2.7vmin, 30px);
  text-align: center;
  color: #ffe8a3;
  margin: .2em 0;
}

.notice {
  margin: 0;
  padding: 10px 14px;
  border-radius: 16px;
  background: rgba(255, 209, 102, .18);
  color: #ffe8a3;
  text-align: center;
  font-weight: 800;
}

.actions,
.price {
  display: grid;
  gap: clamp(8px, 1.4vmin, 14px);
  padding-bottom: env(safe-area-inset-bottom, 0);
  margin-top: auto;
}

.btn {
  border: 0;
  border-radius: 999px;
  padding: clamp(12px, 2.2vmin, 22px) clamp(16px, 3vmin, 30px);
  font-size: clamp(16px, 2.7vmin, 30px);
  font-weight: 900;
  color: #1f1147;
  background: #ffd166;
  box-shadow: 0 clamp(6px, 1.2vmin, 12px) 0 #b7791f;
  cursor: pointer;
}

.btn.secondary {
  background: #fff;
  color: #4c1d95;
  box-shadow: 0 clamp(5px, 1vmin, 10px) 0 #a78bfa;
}

.btn.danger {
  background: #fb7185;
  box-shadow: 0 clamp(5px, 1vmin, 10px) 0 #9f1239;
  color: #fff;
}

.btn:disabled { opacity: .45; filter: grayscale(1); }
.btn.capturing { animation: buttonPress .7s ease-in-out infinite; transform: translateY(8px); box-shadow: 0 4px 0 #9f1239; }

.camera-wrap {
  position: relative;
  border-radius: clamp(18px, 3.4vmin, 34px);
  overflow: hidden;
  background: #000;
  flex: 1 1 auto;
  min-height: 0;
}

.camera-wrap video { transform: scaleX(-1); }

video,
.preview {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.preview {
  max-height: 48dvh;
  border-radius: 22px;
  background: #fff;
}

.oval {
  position: absolute;
  inset: 12% 18%;
  border: clamp(5px, 1.1vmin, 10px) solid #22d3ee;
  border-radius: 50%;
  box-shadow: 0 0 0 999px rgba(0,0,0,.28), 0 0 34px #22d3ee;
  animation: pulse 1.25s infinite;
}

.hint {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 16px;
  text-align: center;
  font-size: clamp(18px, 3vmin, 28px);
  font-weight: 900;
  text-shadow: 0 3px 14px #000;
}

.countdown {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: clamp(64px, 18vmin, 170px);
  font-weight: 1000;
  color: #ffd166;
  text-shadow: 0 8px 28px #000;
  pointer-events: none;
  animation: countPop .65s ease;
}

.camera-wrap.shooting::after { content: ""; position: absolute; inset: 0; background: #fff; animation: flash .18s ease-out; pointer-events: none; }

.grid,
.thumbs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(8px, 1.6vmin, 18px);
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
}

.thumbs { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.tile {
  background: rgba(255,255,255,.15);
  border: 4px solid transparent;
  border-radius: clamp(16px, 2.4vmin, 24px);
  padding: clamp(8px, 1.2vmin, 12px);
  cursor: pointer;
  min-height: 0;
}

.tile.selected { border-color: #ffd166; }

.tile img,
.thumbs img {
  width: 100%;
  border-radius: 18px;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border: 5px solid transparent;
  background: #fff;
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.tile .btn {
  width: 100%;
  margin-top: 8px;
  padding: 10px 12px;
  font-size: clamp(13px, 1.8vmin, 18px);
  box-shadow: none;
}

.thumbs img { aspect-ratio: 3 / 4; }
.thumbs img.selected { border-color: #ffd166; box-shadow: 0 0 0 6px rgba(255,209,102,.35), 0 18px 48px rgba(0,0,0,.38); transform: scale(1.02); }

.loader { height: 30px; background: rgba(255,255,255,.2); border-radius: 999px; overflow: hidden; }
.bar { height: 100%; width: 20%; background: linear-gradient(90deg,#ffd166,#22d3ee); animation: load 8s linear forwards; }
.qr { width: min(220px, 40vmin); height: min(220px, 40vmin); margin: auto; background: repeating-linear-gradient(45deg,#fff 0 12px,#111827 12px 24px); border: 16px solid #fff; border-radius: 18px; }
.muted { color: #d8c7ff; text-align: center; overflow-wrap: anywhere; }
.topline { display: flex; justify-content: space-between; gap: 12px; align-items: center; flex: 0 0 auto; }
.lang { font-size: clamp(14px, 1.8vmin, 18px); padding: 10px 14px; box-shadow: none; }

@keyframes pulse { 50% { transform: scale(1.04); opacity: .72; } }
@keyframes buttonPress { 50% { transform: translateY(10px) scale(.98); filter: brightness(1.22); } }
@keyframes countPop { 0% { transform: scale(.7); opacity: 0; } 45% { transform: scale(1.08); opacity: 1; } 100% { transform: scale(1); opacity: 1; } }
@keyframes flash { 0% { opacity: .92; } 100% { opacity: 0; } }
@keyframes load { to { width: 100%; } }

@media (orientation: landscape) and (max-height: 760px) {
  .screen { width: min(1180px, 100%); gap: 8px; }
  .hero, .panel { padding: 12px; border-radius: 20px; }
  h1 { font-size: clamp(26px, 7vh, 54px); }
  h2 { font-size: clamp(22px, 5.5vh, 40px); }
  .lead { font-size: clamp(14px, 3vh, 22px); }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .thumbs { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .price { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .btn { padding: 10px 14px; font-size: clamp(14px, 3.2vh, 22px); }
  .camera-wrap { min-height: 0; }
}

@media (max-width: 640px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .thumbs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .price { grid-template-columns: 1fr; }
}

@media (max-height: 620px) {
  .tile .btn { display: none; }
  .preview { max-height: 38dvh; }
}

.payment-screen {
  align-items: center;
  overflow: auto;
}

.payment-heading {
  width: min(760px, 100%);
  text-align: center;
}

.payment-heading h2 {
  margin-top: 6px;
}

.payment-kicker {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 6px 12px;
  border: 1px solid rgba(255, 209, 102, .5);
  border-radius: 999px;
  color: #ffe8a3;
  background: rgba(255, 209, 102, .12);
  font-size: clamp(11px, 1.5vmin, 14px);
  font-weight: 950;
  letter-spacing: .14em;
}

.product-grid {
  width: min(820px, 100%);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(12px, 2vmin, 20px);
}

.product-card {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr auto;
  grid-template-areas:
    "icon copy price"
    "button button button";
  gap: 12px;
  align-items: center;
  width: 100%;
  padding: clamp(18px, 2.8vmin, 26px);
  border: 1px solid rgba(255,255,255,.28);
  border-radius: clamp(20px, 3vmin, 28px);
  background: linear-gradient(145deg, rgba(255,255,255,.19), rgba(255,255,255,.07));
  box-shadow: 0 18px 54px rgba(0,0,0,.26);
}

.product-card.featured {
  border-color: rgba(255, 209, 102, .7);
  box-shadow: 0 18px 58px rgba(255, 154, 59, .16);
}

.product-card.sticker-product {
  border-color: rgba(34, 211, 238, .62);
  box-shadow: 0 18px 58px rgba(34, 211, 238, .13);
}

.product-card.single {
  width: min(620px, 100%);
}

.product-icon {
  grid-area: icon;
  width: clamp(52px, 7vmin, 72px);
  height: clamp(52px, 7vmin, 72px);
  display: grid;
  place-items: center;
  border-radius: 20px;
  background: rgba(255,255,255,.15);
  font-size: clamp(28px, 4vmin, 42px);
}

.product-copy {
  grid-area: copy;
  min-width: 0;
}

.product-copy h3 {
  margin: 0 0 6px;
  font-size: clamp(19px, 2.8vmin, 28px);
}

.product-copy p,
.product-copy ul {
  margin: 0;
  color: #e4d9ff;
  font-size: clamp(13px, 1.8vmin, 17px);
  line-height: 1.35;
}

.product-copy ul {
  margin-top: 8px;
  padding-left: 19px;
}

.product-price {
  grid-area: price;
  white-space: nowrap;
  color: #ffd166;
  font-size: clamp(25px, 4vmin, 40px);
  font-weight: 1000;
  text-shadow: 0 5px 18px rgba(255, 209, 102, .24);
}

.product-price span {
  font-size: .72em;
}

.product-card > .btn {
  grid-area: button;
  width: 100%;
}

.product-badge {
  position: absolute;
  top: -10px;
  right: 18px;
  padding: 5px 10px;
  border-radius: 999px;
  color: #281249;
  background: #ffd166;
  font-size: 11px;
  font-weight: 1000;
  letter-spacing: .08em;
}

.product-badge.new {
  color: #083344;
  background: #67e8f9;
}

.payment-status {
  width: min(760px, 100%);
  min-height: 24px;
  margin: 0;
  color: #d8c7ff;
  text-align: center;
  font-size: clamp(13px, 1.8vmin, 17px);
}

.qr-img {
  width: min(320px, 52vmin);
  height: min(320px, 52vmin);
  padding: clamp(8px, 1.6vmin, 14px);
  border-radius: clamp(18px, 3vmin, 28px);
  background: #fff;
  object-fit: contain;
  box-shadow: 0 18px 58px rgba(0, 0, 0, .32);
}

.preview.compact {
  width: min(360px, 56vmin);
  height: min(260px, 34dvh);
  object-fit: contain;
}

.payment-screen .actions {
  width: min(560px, 100%);
}

.sticker-result {
  justify-content: flex-start;
  overflow: auto;
}

.sticker-grid {
  width: min(760px, 100%);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(12px, 2vmin, 20px);
  margin: 0 auto;
}

.sticker-card {
  display: grid;
  gap: 10px;
  padding: clamp(12px, 2vmin, 18px);
  border: 1px solid rgba(255,255,255,.22);
  border-radius: 24px;
  background: rgba(255,255,255,.09);
}

.sticker-preview {
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  border-radius: 18px;
  background-color: #fff;
  background-image:
    linear-gradient(45deg, #d9d9d9 25%, transparent 25%),
    linear-gradient(-45deg, #d9d9d9 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #d9d9d9 75%),
    linear-gradient(-45deg, transparent 75%, #d9d9d9 75%);
  background-size: 24px 24px;
  background-position: 0 0, 0 12px, 12px -12px, -12px 0;
}

.sticker-download {
  display: block;
  padding: 10px 14px;
  text-align: center;
  text-decoration: none;
  font-size: clamp(13px, 1.8vmin, 17px);
  box-shadow: none;
}

.sticker-result .actions {
  width: min(760px, 100%);
  margin-inline: auto;
}

@media (orientation: landscape) and (max-height: 760px) {
  .payment-screen { gap: 8px; }
  .qr-img { width: min(230px, 42vh); height: min(230px, 42vh); }
  .preview.compact { width: min(260px, 42vw); height: min(150px, 25vh); }
  .product-card { padding: 14px; }
  .product-copy ul { display: none; }
  .product-icon { width: 48px; height: 48px; border-radius: 16px; }
}

@media (max-width: 720px) {
  .product-grid { grid-template-columns: 1fr; }
  .product-card {
    grid-template-columns: auto 1fr auto;
    padding: 16px;
  }
  .product-copy ul { display: none; }
  .product-card .btn { font-size: 16px; padding: 13px 16px; }
}

@media (max-width: 480px) {
  .product-card {
    grid-template-columns: auto 1fr;
    grid-template-areas:
      "icon price"
      "copy copy"
      "button button";
  }
  .product-price { text-align: right; }
  .sticker-grid { gap: 8px; }
  .sticker-card { padding: 8px; border-radius: 18px; }
}

/* ── Settings button ───────────────────────────────────────────── */
.settings-btn {
  font-size: clamp(14px, 1.8vmin, 18px);
  padding: 10px 14px;
  box-shadow: none;
  line-height: 1;
}

/* ── Settings overlay ──────────────────────────────────────────── */
.settings-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(14, 7, 30, .72);
  backdrop-filter: blur(6px);
  display: grid;
  place-items: center;
  padding: clamp(16px, 4vmin, 40px);
  animation: fadeIn .18s ease;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ── Settings modal card ───────────────────────────────────────── */
.settings-modal {
  background: rgba(255, 255, 255, .13);
  border: 1px solid rgba(255, 255, 255, .3);
  border-radius: clamp(20px, 4vmin, 34px);
  padding: clamp(20px, 4vmin, 40px);
  box-shadow: 0 32px 100px rgba(0, 0, 0, .5);
  backdrop-filter: blur(24px);
  width: min(560px, 100%);
  display: flex;
  flex-direction: column;
  gap: clamp(16px, 3vmin, 28px);
  animation: slideUp .22s ease;
}

@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.settings-title {
  font-size: clamp(22px, 4vmin, 36px);
  margin: 0;
  text-align: center;
}

/* ── Settings form body ────────────────────────────────────────── */
.settings-body {
  display: flex;
  flex-direction: column;
  gap: clamp(12px, 2vmin, 20px);
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: clamp(15px, 2.4vmin, 22px);
  font-weight: 700;
  color: #e0d4ff;
}

/* ── Language toggle ───────────────────────────────────────────── */
.settings-lang-toggle {
  display: flex;
  gap: 6px;
}

.settings-lang-btn {
  border: 2px solid rgba(255, 255, 255, .35);
  border-radius: 999px;
  padding: 8px 18px;
  font-size: clamp(14px, 2vmin, 18px);
  font-weight: 900;
  background: transparent;
  color: #c4b5fd;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}

.settings-lang-btn.active {
  background: #ffd166;
  color: #1f1147;
  border-color: #ffd166;
}

/* ── Stepper ───────────────────────────────────────────────────── */
.settings-stepper {
  display: flex;
  align-items: center;
  gap: 10px;
}

.settings-step {
  border: 2px solid rgba(255, 255, 255, .35);
  border-radius: 50%;
  width: clamp(36px, 5vmin, 50px);
  height: clamp(36px, 5vmin, 50px);
  font-size: clamp(18px, 3vmin, 26px);
  font-weight: 900;
  background: rgba(255, 255, 255, .08);
  color: #fff;
  cursor: pointer;
  transition: background .15s;
  display: grid;
  place-items: center;
}

.settings-step:hover { background: rgba(255, 255, 255, .2); }

.settings-step-val {
  min-width: 2ch;
  text-align: center;
  font-size: clamp(20px, 3.2vmin, 30px);
  font-weight: 900;
  color: #ffd166;
}

/* ── Select ────────────────────────────────────────────────────── */
.settings-select {
  border: 2px solid rgba(255, 255, 255, .35);
  border-radius: 12px;
  padding: 8px 14px;
  font-size: clamp(13px, 1.9vmin, 17px);
  font-weight: 700;
  background: rgba(255, 255, 255, .1);
  color: #fff;
  cursor: pointer;
  max-width: 220px;
}

/* ── IP input ──────────────────────────────────────────────────── */
.settings-input {
  border: 2px solid rgba(255, 255, 255, .35);
  border-radius: 12px;
  padding: 8px 14px;
  font-size: clamp(14px, 2vmin, 18px);
  font-weight: 700;
  background: rgba(255, 255, 255, .1);
  color: #fff;
  width: 180px;
  outline: none;
  transition: border-color .15s;
}

.settings-input:focus { border-color: #ffd166; }

/* ── Settings actions row ──────────────────────────────────────── */
.settings-actions {
  display: flex;
  gap: clamp(10px, 2vmin, 18px);
  justify-content: flex-end;
}

.settings-actions .btn {
  min-width: 120px;
  font-size: clamp(15px, 2.2vmin, 20px);
}
