html, body { height: 100%; overflow: hidden; overscroll-behavior: none; }
body { position: relative; -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; }

#ar { position: fixed; inset: 0; background: #000; }
#ar video, #ar canvas { max-width: none; }

[hidden] { display: none !important; }

/* ---------- Full-screen panels (start / loading / error) ---------- */
.screen {
  position: fixed; inset: 0; z-index: 20;
  display: grid; place-items: center;
  padding: max(24px, env(safe-area-inset-top)) 20px max(24px, env(safe-area-inset-bottom));
  background:
    radial-gradient(120% 70% at 50% 0%, #3a2b1a 0%, transparent 60%),
    var(--kain);
  overflow-y: auto;
}
.screen-inner { width: 100%; max-width: 420px; text-align: center; display: grid; gap: 18px; justify-items: center; }
.screen h1 { font-family: var(--font-display); font-weight: 400; font-size: clamp(2.2rem, 9vw, 2.9rem); line-height: 1.05; margin: 0; }
.screen .lede { margin: 0; color: var(--kabus); font-size: 1.0625rem; max-width: 32ch; }
.fineprint { margin: 0; color: var(--kabus); font-size: .9375rem; }
.btn-big { min-height: 56px; padding-inline: 2rem; font-size: 1.0625rem; width: 100%; max-width: 320px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
#screen-start .lang-switch { position: absolute; top: max(14px, env(safe-area-inset-top)); right: 16px; }

/* Three cards fanned out, so a first-time visitor sees what to scan. */
.fan { position: relative; width: 240px; height: 170px; margin: 6px 0 4px; }
.fan img {
  position: absolute; left: 50%; top: 50%; width: 170px; aspect-ratio: 1748 / 1240; object-fit: cover;
  border-radius: 8px; border: 3px solid var(--kapas); box-shadow: 0 12px 30px rgba(0,0,0,.5);
  translate: -50% -50%;
}
.fan img:nth-child(1) { rotate: -12deg; translate: -78% -46%; }
.fan img:nth-child(2) { rotate: 9deg; translate: -22% -46%; }
.fan img:nth-child(3) { rotate: -2deg; translate: -50% -38%; }

.progress { width: 100%; max-width: 280px; height: 8px; background: var(--kain-3); border-radius: 99px; overflow: hidden; }
#progress-bar { height: 100%; width: 0%; background: var(--emas); transition: width .2s; }
.loading-step { margin: 0; font-size: 1.125rem; font-weight: 600; }

/* ---------- HUD ---------- */
.topbar {
  position: fixed; z-index: 10; top: 0; left: 0; right: 0;
  display: flex; justify-content: space-between; align-items: center;
  padding: max(12px, env(safe-area-inset-top)) 14px 0;
  pointer-events: none;
}
.topbar > *, .topbar-right > * { pointer-events: auto; }
.topbar-right { display: flex; gap: 10px; }

.scan { position: fixed; inset: 0; z-index: 5; display: grid; place-items: center; pointer-events: none; }
.frame { position: relative; width: min(78vw, 360px); aspect-ratio: 1748 / 1240; }
.frame i { position: absolute; width: 36px; height: 36px; border: 4px solid var(--kapas); filter: drop-shadow(0 1px 3px rgba(0,0,0,.6)); }
.frame i:nth-child(1) { top: 0; left: 0; border-right: 0; border-bottom: 0; border-top-left-radius: 14px; }
.frame i:nth-child(2) { top: 0; right: 0; border-left: 0; border-bottom: 0; border-top-right-radius: 14px; }
.frame i:nth-child(3) { bottom: 0; left: 0; border-right: 0; border-top: 0; border-bottom-left-radius: 14px; }
.frame i:nth-child(4) { bottom: 0; right: 0; border-left: 0; border-top: 0; border-bottom-right-radius: 14px; }
.frame { animation: breathe 2.4s ease-in-out infinite; }
@keyframes breathe { 50% { transform: scale(1.04); } }
.scan-hint {
  position: fixed; left: 50%; bottom: max(32px, calc(env(safe-area-inset-bottom) + 20px)); translate: -50% 0;
  margin: 0; padding: 10px 18px; border-radius: 999px; white-space: nowrap;
  background: rgba(30, 26, 23, .78); font-weight: 600;
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}

.info {
  position: fixed; z-index: 10; left: 12px; right: 12px;
  bottom: max(14px, env(safe-area-inset-bottom));
  max-width: 520px; margin-inline: auto;
  display: flex; gap: 12px; align-items: flex-start;
  padding: 16px 16px 16px 18px; border-radius: var(--radius-m);
  background: rgba(30, 26, 23, .86); border-top: 3px solid var(--emas);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  animation: rise .25s ease-out;
}
@keyframes rise { from { transform: translateY(16px); opacity: 0; } }
.info-text { flex: 1; min-width: 0; }
.info-people { margin: 0; color: var(--emas); font-weight: 600; font-size: .875rem; }
.info-name { margin: 2px 0 4px; font-family: var(--font-display); font-weight: 400; font-size: 1.6rem; line-height: 1.1; }
.info-desc { margin: 0; color: var(--kabus); font-size: .9375rem; line-height: 1.45; }
.info .icon-btn { flex: none; }

.toast {
  position: fixed; z-index: 15; left: 50%; top: calc(max(12px, env(safe-area-inset-top)) + 62px); translate: -50% 0;
  max-width: calc(100vw - 32px); padding: 10px 16px; border-radius: 12px;
  background: var(--kapas); color: var(--kain); font-weight: 600; text-align: center;
  box-shadow: 0 8px 24px rgba(0,0,0,.35);
}
.toast button { border: 0; background: none; text-decoration: underline; font-weight: 700; cursor: pointer; padding: 0 0 0 6px; }

.sheet {
  border: 0; padding: 22px 22px 18px; border-radius: 18px 18px 0 0;
  width: 100%; max-width: 520px; margin: auto auto 0;
  background: var(--kain-2); color: var(--kapas);
}
.sheet::backdrop { background: rgba(0,0,0,.55); }
.sheet h2 { margin: 0 0 8px; font-family: var(--font-display); font-weight: 400; font-size: 1.6rem; }
.sheet ol { margin: 0 0 18px; padding-left: 1.3em; display: grid; gap: 8px; color: var(--kabus); }
.sheet .btn { width: 100%; }
@media (min-width: 600px) { .sheet { border-radius: 18px; margin: auto; } }
