/* =========================================================
   CEKREK BOOTH — colourful, edgy, iOS-flavoured photobooth
   ========================================================= */
:root {
  --ink: #0b0b0f;
  --paper: #f6f3ea;
  --pink: #ff3d9a;
  --lime: #c6ff1a;
  --blue: #2f6bff;
  --orange: #ff6a1a;
  --violet: #8b5cff;
  --cyan: #22e4ff;
  --yellow: #ffd60a;
  --red: #ff3b30;
  --green: #30d158;
  --display: "Unbounded", "Segoe UI Variable Display", "Segoe UI", system-ui, sans-serif;
  --mono: "Space Mono", "Cascadia Mono", Consolas, monospace;
  --serif: "Instrument Serif", Georgia, serif;
  --ios: -apple-system, "SF Pro Text", "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
  --spring: cubic-bezier(.2, .9, .25, 1.18);
  --ease: cubic-bezier(.2, .8, .2, 1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
/* iOS Safari enlarges text by itself when the phone is turned sideways — keep the sizes we set */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  background: #060608;
  color: #f5f5f7;
  font-family: var(--ios);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -webkit-user-select: none; user-select: none;
}
input, textarea { -webkit-user-select: text; user-select: text; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
button:disabled { cursor: default; }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible { outline: 2px solid var(--lime); outline-offset: 2px; }
svg { display: block; }
[hidden] { display: none !important; }
kbd {
  display: inline-block; min-width: 1.6em; padding: 1px 5px; border-radius: 5px;
  font: 700 .85em var(--mono); text-align: center;
  background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .22); border-bottom-width: 2px;
}
.eyebrow { font: 700 10.5px var(--mono); letter-spacing: .2em; color: var(--lime); margin-bottom: 6px; }

/* ---------- background ---------- */
.bg { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.blob { position: absolute; border-radius: 50%; opacity: .55; animation: drift 24s ease-in-out infinite alternate; }
.b1 { width: 64vmax; height: 64vmax; left: -24vmax; top: -30vmax; background: radial-gradient(circle, var(--pink) 0, transparent 62%); }
.b2 { width: 56vmax; height: 56vmax; right: -22vmax; top: -10vmax; background: radial-gradient(circle, var(--blue) 0, transparent 62%); animation-duration: 30s; animation-delay: -8s; }
.b3 { width: 52vmax; height: 52vmax; left: 16vmax; bottom: -34vmax; background: radial-gradient(circle, var(--lime) 0, transparent 60%); opacity: .3; animation-duration: 34s; }
.b4 { width: 42vmax; height: 42vmax; right: 4vmax; bottom: -24vmax; background: radial-gradient(circle, var(--orange) 0, transparent 62%); opacity: .45; animation-duration: 28s; animation-delay: -12s; }
@keyframes drift { to { transform: translate(6vmax, 4vmax) scale(1.12); } }
.dots {
  position: absolute; inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, .1) 1px, transparent 1.6px);
  background-size: 24px 24px;
  -webkit-mask-image: radial-gradient(ellipse at 50% 40%, #000 15%, transparent 75%);
  mask-image: radial-gradient(ellipse at 50% 40%, #000 15%, transparent 75%);
}
.grain {
  position: absolute; inset: -120px; opacity: .14;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 .55 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  animation: grain 1.1s steps(5) infinite;
}
@keyframes grain {
  0% { transform: translate(0, 0); } 20% { transform: translate(-40px, 20px); } 40% { transform: translate(30px, -30px); }
  60% { transform: translate(-20px, -40px); } 80% { transform: translate(40px, 30px); }
}

/* ---------- top bar ---------- */
.topbar { position: relative; z-index: 10; height: 64px; display: flex; align-items: center; gap: 22px; padding: 0 28px; }
.logo { display: flex; align-items: baseline; gap: 6px; line-height: 1; white-space: nowrap; }
.logo-word { font: 900 24px var(--display); letter-spacing: -.03em; }
.logo-star { font: 900 19px var(--display); color: var(--lime); display: inline-block; animation: spin 7s linear infinite; }
.logo-serif { font: italic 400 31px var(--serif); color: var(--pink); }
@keyframes spin { to { transform: rotate(360deg); } }
.cam-wrap { position: relative; }
.cam-info {
  display: flex; align-items: center; gap: 9px; padding: 6px 11px 6px 13px; border-radius: 999px;
  font: 700 10.5px var(--mono); letter-spacing: .14em; color: rgba(255, 255, 255, .65);
  border: 1px solid rgba(255, 255, 255, .12); background: rgba(255, 255, 255, .04); transition: background .2s, color .2s;
}
.cam-info:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.cam-info .chev { width: 13px; height: 13px; opacity: .7; }
body.phone-cam .cam-info { border-color: rgba(34, 228, 255, .5); color: #c9f8ff; }
.cam-menu {
  position: absolute; top: calc(100% + 10px); left: 0; z-index: 30; width: 340px; padding: 8px; border-radius: 22px;
  background: rgba(20, 20, 26, .92); border: 1px solid rgba(255, 255, 255, .14); backdrop-filter: blur(24px) saturate(160%);
  box-shadow: 0 24px 60px rgba(0, 0, 0, .55); animation: popIn .3s var(--spring);
}
.cam-menu .pop-title { color: rgba(255, 255, 255, .45); }
.cam-item {
  width: 100%; display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 13px;
  font: 500 14px var(--ios); text-align: left; transition: background .2s;
}
.cam-item:hover { background: rgba(255, 255, 255, .08); }
.cam-item .ci-ic { font-size: 18px; }
.cam-item .ci-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cam-item .ci-check { font-style: normal; color: var(--lime); opacity: 0; font-weight: 800; }
.cam-item.on { background: rgba(198, 255, 26, .1); }
.cam-item.on .ci-check { opacity: 1; }
.cam-empty { padding: 10px 12px; font: 500 13px var(--ios); color: rgba(255, 255, 255, .55); }
.cam-help {
  margin: 8px 4px 6px; padding: 12px 14px; border-radius: 14px; background: rgba(34, 228, 255, .08); border: 1px solid rgba(34, 228, 255, .22);
  font: 400 12.5px / 1.5 var(--ios); color: rgba(255, 255, 255, .82);
}
.cam-help b { color: #fff; }
.cam-help ol { margin: 6px 0 6px 18px; }
.cam-help li { margin: 2px 0; }
.cam-help small { display: block; color: rgba(255, 255, 255, .55); font-size: 11.5px; }
.cam-refresh { width: 100%; padding: 10px; border-radius: 13px; font: 600 13px var(--ios); color: var(--cyan); }
.cam-refresh:hover { background: rgba(34, 228, 255, .1); }
.cam-info .rec { width: 8px; height: 8px; border-radius: 50%; background: var(--red); box-shadow: 0 0 10px var(--red); animation: blink 1.4s steps(2) infinite; }
body.is-demo .cam-info .rec { background: var(--yellow); box-shadow: 0 0 10px var(--yellow); }
@keyframes blink { 50% { opacity: .25; } }
.top-actions { margin-left: auto; display: flex; gap: 10px; }
.pill {
  display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 16px; border-radius: 999px;
  background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .15);
  font: 600 14px var(--ios); backdrop-filter: blur(12px); transition: background .2s, transform .2s;
}
.pill:hover { background: rgba(255, 255, 255, .16); }
.pill:active { transform: scale(.95); }
.pill.icon { flex: none; width: 38px; padding: 0; justify-content: center; font-size: 20px; }
.pill svg { width: 18px; height: 18px; }
.pill b { min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: var(--lime); color: #000; font: 800 11px/22px var(--display); text-align: center; }
.snd .off-ic { display: none; }
body.muted .snd .on-ic { display: none; }
body.muted .snd .off-ic { display: block; }

/* ---------- stage ---------- */
.stage {
  position: relative; z-index: 2; height: calc(100% - 64px - 42px);
  display: grid; grid-template-columns: minmax(0, 1fr) clamp(300px, 25vw, 380px);
  gap: 28px; padding: 4px 28px 18px;
}
.cam-col { position: relative; min-width: 0; min-height: 0; display: flex; flex-direction: column; gap: 14px; }
.phone-wrap {
  position: relative; flex: 1; min-height: 0; container-type: size;
  display: grid; place-items: center;
  transition: filter .5s var(--ease), transform .6s var(--ease);
}

/* ---------- the phone (landscape iPhone, cosmic orange) ---------- */
.phone {
  --r: clamp(34px, 10cqh, 66px);
  --bz: clamp(7px, 2.2cqh, 13px);
  position: relative;
  width: min(calc(var(--cqw, 100vw) * 100 / 100) - 48px, (calc(var(--cqh, 100vh) * 100 / 100) - 64px) * 2.08); width: min(100cqw - 48px, (100cqh - 64px) * 2.08);
  aspect-ratio: 2.08;
  border-radius: var(--r);
  padding: 6px;
  background: linear-gradient(120deg, #ffa25a 0%, #ff6a1a 20%, #ffc79a 36%, #ff7a2a 50%, #d24c0c 68%, #ffb070 86%, #ff6a1a 100%);
  box-shadow:
    0 0 0 1.5px rgba(0, 0, 0, .7),
    inset 0 0 0 1px rgba(255, 255, 255, .5),
    0 40px 80px -24px rgba(0, 0, 0, .8),
    0 0 140px -30px rgba(255, 106, 26, .6);
}
@supports not (container-type: size) {
  .phone { --r: clamp(34px, calc(var(--cqh, 100vh) * .1), 66px); --bz: clamp(7px, calc(var(--cqh, 100vh) * .022), 13px); }
}
.hw { position: absolute; height: 5px; border-radius: 3px; background: linear-gradient(#ffb070, #c9480c); box-shadow: 0 0 0 1px rgba(0, 0, 0, .5); }
.hw-action { top: -5px; left: 13%; width: 4.5%; }
.hw-vol1 { top: -5px; left: 20%; width: 8%; }
.hw-vol2 { top: -5px; left: 30%; width: 8%; }
.hw-power { bottom: -5px; left: 22%; width: 11%; }
.hw-cc { bottom: -5px; right: 29%; width: 8%; background: linear-gradient(#3a3a40, #111); }
.bezel { height: 100%; border-radius: calc(var(--r) - 6px); background: #000; padding: var(--bz); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .1); }
.screen {
  position: relative; height: 100%; overflow: hidden; background: #000;
  border-radius: calc(var(--r) - 6px - var(--bz));
  display: grid; grid-template-columns: minmax(0, .62fr) auto minmax(0, 1fr); grid-template-rows: 100%;
}

/* rails */
.rail { position: relative; min-width: 0; display: flex; flex-direction: column; align-items: center; }
.rail-l { justify-content: center; gap: clamp(8px, calc(var(--cqh, 100vh) * 2.6 / 100), 16px); gap: clamp(8px, 2.6cqh, 16px); }
.r-btn {
  width: clamp(30px, calc(var(--cqh, 100vh) * 8.6 / 100), 40px); width: clamp(30px, 8.6cqh, 40px); aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center;
  background: rgba(255, 255, 255, .1); color: #fff; transition: background .2s, color .2s, transform .2s;
}
.r-btn svg { width: 50%; height: 50%; }
.r-btn:hover { background: rgba(255, 255, 255, .2); }
.r-btn:active { transform: scale(.9); }
.r-btn.on { color: var(--yellow); background: rgba(255, 214, 10, .16); }
#btnFlash.on { background: var(--yellow); color: #000; }

/* dynamic island — sits on the left edge because the phone is landscape */
.island {
  width: clamp(22px, calc(var(--cqh, 100vh) * 6.4 / 100), 30px); width: clamp(22px, 6.4cqh, 30px); height: clamp(60px, calc(var(--cqh, 100vh) * 18 / 100), 86px); height: clamp(60px, 18cqh, 86px);
  margin: clamp(2px, calc(var(--cqh, 100vh) * 1.5 / 100), 10px) 0; margin: clamp(2px, 1.5cqh, 10px) 0; border-radius: 999px; background: #000;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .09), inset 0 0 6px rgba(255, 255, 255, .04);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px;
  transition: height .55s var(--spring), width .55s var(--spring), box-shadow .3s;
}
.island i { width: 9px; height: 9px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #4a5f9a, #0d1530 60%); box-shadow: 0 0 0 2px #070910; transition: background .3s, box-shadow .3s; }
.island b { font: 700 9.5px var(--ios); color: #fff; letter-spacing: .02em; writing-mode: vertical-rl; transform: rotate(180deg); white-space: nowrap; }
.island:not([data-mode="idle"]) { height: clamp(92px, calc(var(--cqh, 100vh) * 30 / 100), 140px); height: clamp(92px, 30cqh, 140px); width: clamp(26px, calc(var(--cqh, 100vh) * 7.4 / 100), 34px); width: clamp(26px, 7.4cqh, 34px); box-shadow: 0 0 0 1px rgba(255, 255, 255, .14), 0 0 22px rgba(255, 255, 255, .06); }
.island[data-mode="shoot"] i { background: var(--red); box-shadow: 0 0 10px var(--red); animation: blink 1s steps(2) infinite; }
.island[data-mode="print"] i { background: var(--orange); box-shadow: 0 0 10px var(--orange); }
.island[data-mode="done"] i { background: var(--green); box-shadow: 0 0 10px var(--green); }
.island[data-mode="done"] b { color: var(--green); writing-mode: horizontal-tb; transform: none; font-size: 13px; }

/* viewfinder */
.viewfinder { position: relative; height: 100%; aspect-ratio: 4 / 3; overflow: hidden; background: #0d0d10; cursor: crosshair; container-type: size; }
.viewfinder video {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  transform: scaleX(var(--mx, -1)) scale(var(--zoom, 1)); transition: transform .35s var(--ease);
}
.vf-grid {
  position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .3s;
  background:
    linear-gradient(90deg, transparent calc(33.33% - .5px), rgba(255,255,255,.4) 0, rgba(255,255,255,.4) calc(33.33% + .5px), transparent 0, transparent calc(66.66% - .5px), rgba(255,255,255,.4) 0, rgba(255,255,255,.4) calc(66.66% + .5px), transparent 0),
    linear-gradient(180deg, transparent calc(33.33% - .5px), rgba(255,255,255,.4) 0, rgba(255,255,255,.4) calc(33.33% + .5px), transparent 0, transparent calc(66.66% - .5px), rgba(255,255,255,.4) 0, rgba(255,255,255,.4) calc(66.66% + .5px), transparent 0);
}
body.show-grid .vf-grid { opacity: 1; }
.pips {
  position: absolute; top: 12px; left: 50%; transform: translate(-50%, -8px); opacity: 0;
  display: flex; gap: 7px; padding: 7px 11px; border-radius: 999px; background: rgba(0, 0, 0, .5); backdrop-filter: blur(8px);
  transition: opacity .3s, transform .4s var(--spring);
}
.pips i { width: 9px; height: 9px; border-radius: 50%; background: rgba(255, 255, 255, .3); transition: background .3s, transform .3s var(--spring); }
.pips i.on { background: var(--lime); transform: scale(1.25); box-shadow: 0 0 8px var(--lime); }
body[data-phase="shooting"] .pips { opacity: 1; transform: translate(-50%, 0); }
.demo-badge {
  position: absolute; top: 12px; left: 12px; display: none; padding: 4px 9px; border-radius: 7px;
  background: var(--yellow); color: #000; font: 700 10px var(--mono); letter-spacing: .12em;
}
body.is-demo .demo-badge { display: block; }
.vf-hint {
  position: absolute; top: 12px; right: 12px; padding: 6px 11px; border-radius: 999px;
  background: rgba(0, 0, 0, .45); backdrop-filter: blur(8px); font: 600 12px var(--ios); color: rgba(255, 255, 255, .9);
  transition: opacity .3s;
}
body:not([data-phase="idle"]) .vf-hint { opacity: 0; }
.zoom {
  position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 4px; padding: 4px; border-radius: 999px; background: rgba(0, 0, 0, .38); backdrop-filter: blur(8px);
  transition: opacity .3s;
}
.zoom button { min-width: 32px; height: 32px; border-radius: 50%; font: 700 11px var(--ios); background: rgba(255, 255, 255, .12); transition: color .2s, background .2s; }
.zoom button.on { color: var(--yellow); background: rgba(0, 0, 0, .6); font-size: 12.5px; }
body:not([data-phase="idle"]) .zoom { opacity: 0; pointer-events: none; }
.countdown {
  position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; opacity: 0;
  font: 900 90px / 1 var(--display); font-size: clamp(90px, calc(var(--cqh, 100vh) * 46 / 100), 260px); font-size: clamp(90px, 46cqh, 260px); color: var(--lime);
  -webkit-text-stroke: clamp(3px, calc(var(--cqh, 100vh) * 1 / 100), 6px) #000; -webkit-text-stroke: clamp(3px, 1cqh, 6px) #000; text-shadow: clamp(5px, calc(var(--cqh, 100vh) * 2 / 100), 10px) clamp(5px, calc(var(--cqh, 100vh) * 2 / 100), 10px) 0 #000; text-shadow: clamp(5px, 2cqh, 10px) clamp(5px, 2cqh, 10px) 0 #000;
}
.countdown.pop { animation: cd 1s var(--ease) forwards; }
@keyframes cd {
  0% { opacity: 0; transform: scale(1.9) rotate(-10deg); }
  18% { opacity: 1; transform: scale(1) rotate(0); }
  75% { opacity: 1; transform: scale(.94); }
  100% { opacity: 0; transform: scale(.7) rotate(4deg); }
}
.cam-msg {
  position: absolute; left: 50%; bottom: 56px; transform: translateX(-50%); width: max-content; max-width: 88%;
  display: none; align-items: center; gap: 12px; padding: 9px 9px 9px 14px; border-radius: 14px;
  background: rgba(0, 0, 0, .72); backdrop-filter: blur(10px); border: 1px solid rgba(255, 255, 255, .15);
  font: 500 12.5px/1.4 var(--ios); cursor: default;
}
.cam-msg.show { display: flex; }
.cam-msg button { flex: none; padding: 7px 12px; border-radius: 9px; background: var(--yellow); color: #000; font-weight: 700; }
.focus { position: absolute; width: 74px; height: 74px; border: 1.5px solid var(--yellow); pointer-events: none; opacity: 0; transform: translate(-50%, -50%); }
.focus::before, .focus::after { content: ''; position: absolute; background: var(--yellow); }
.focus::before { left: 50%; top: -1px; width: 1.5px; height: 7px; }
.focus::after { top: 50%; left: -1px; height: 1.5px; width: 7px; }
.focus.go { animation: focus 1.2s var(--ease) forwards; }
@keyframes focus {
  0% { opacity: 1; transform: translate(-50%, -50%) scale(1.5); }
  25% { transform: translate(-50%, -50%) scale(1); }
  40% { opacity: .5; } 50% { opacity: 1; } 85% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1); }
}

/* right rail */
.rail-r { flex-direction: row; align-items: stretch; justify-content: center; gap: clamp(8px, calc(var(--cqh, 100vh) * 3 / 100), 18px); gap: clamp(8px, 3cqh, 18px); padding: 0 clamp(8px, calc(var(--cqh, 100vh) * 2 / 100), 16px); padding: 0 clamp(8px, 2cqh, 16px); }
.modes {
  list-style: none; display: flex; flex-direction: column; justify-content: center; gap: clamp(7px, calc(var(--cqh, 100vh) * 2.6 / 100), 13px); gap: clamp(7px, 2.6cqh, 13px);
  font: 600 9px var(--ios); font-size: clamp(9px, calc(var(--cqh, 100vh) * 2.5 / 100), 11.5px); font-size: clamp(9px, 2.5cqh, 11.5px); letter-spacing: .08em; color: rgba(255, 255, 255, .5); text-align: right;
}
.modes li.on { color: var(--yellow); }
.shoot-col { display: flex; flex-direction: column; align-items: center; justify-content: space-between; padding: clamp(12px, calc(var(--cqh, 100vh) * 5 / 100), 26px) 0; padding: clamp(12px, 5cqh, 26px) 0; }
.shutter {
  width: clamp(56px, calc(var(--cqh, 100vh) * 18 / 100), 84px); width: clamp(56px, 18cqh, 84px); aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center;
  border: clamp(3px, calc(var(--cqh, 100vh) * 1 / 100), 5px) solid #fff; border: clamp(3px, 1cqh, 5px) solid #fff; padding: clamp(3px, calc(var(--cqh, 100vh) * 1 / 100), 5px); padding: clamp(3px, 1cqh, 5px); transition: transform .2s;
}
.shutter i { width: 100%; height: 100%; border-radius: 50%; background: #fff; transition: transform .3s var(--spring), border-radius .3s, background .3s; }
.shutter:hover i { transform: scale(.93); }
.shutter:active i { transform: scale(.82); }
body[data-phase="idle"] .shutter { animation: breathe 2.6s ease-in-out infinite; }
@keyframes breathe { 50% { box-shadow: 0 0 0 8px rgba(198, 255, 26, .18), 0 0 28px rgba(198, 255, 26, .35); } }
/* during a session the shutter means "jepret sekarang" (skip the countdown), so it stays a shutter */
body[data-phase="shooting"] .shutter { border-color: var(--lime); animation: shootPulse 1.1s ease-in-out infinite; }
@keyframes shootPulse { 50% { box-shadow: 0 0 0 7px rgba(198, 255, 26, .22); } }
body[data-phase="review"] .shutter i, body[data-phase="printing"] .shutter i, body[data-phase="boot"] .shutter i { background: rgba(255, 255, 255, .28); }
.last-thumb { width: clamp(34px, calc(var(--cqh, 100vh) * 10.5 / 100), 50px); width: clamp(34px, 10.5cqh, 50px); aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: #1c1c1f; border: 1.5px solid rgba(255, 255, 255, .55); }
.last-thumb canvas { width: 100%; height: 100%; display: block; }
.fly-thumb { position: fixed; z-index: 30; pointer-events: none; object-fit: cover; transform-origin: 50% 50%; border-radius: 6px; }

/* stickers on the phone */
.stk { position: absolute; z-index: 4; pointer-events: none; filter: drop-shadow(4px 5px 0 #000); }
.stk-burst { width: clamp(80px, calc(var(--cqh, 100vh) * 23 / 100), 124px); width: clamp(80px, 23cqh, 124px); top: calc(clamp(80px, calc(var(--cqh, 100vh) * 23 / 100), 124px) * -.38); top: calc(clamp(80px, 23cqh, 124px) * -.38); left: calc(clamp(80px, calc(var(--cqh, 100vh) * 23 / 100), 124px) * -.32); left: calc(clamp(80px, 23cqh, 124px) * -.32); transform: rotate(-14deg); animation: wobble 5s ease-in-out infinite; }
.stk-heart { width: clamp(46px, calc(var(--cqh, 100vh) * 13 / 100), 70px); width: clamp(46px, 13cqh, 70px); bottom: calc(clamp(46px, calc(var(--cqh, 100vh) * 13 / 100), 70px) * -.42); bottom: calc(clamp(46px, 13cqh, 70px) * -.42); left: 4%; transform: rotate(-16deg); }
.stk-smile { width: clamp(40px, calc(var(--cqh, 100vh) * 11 / 100), 58px); width: clamp(40px, 11cqh, 58px); top: calc(clamp(40px, calc(var(--cqh, 100vh) * 11 / 100), 58px) * -.5); top: calc(clamp(40px, 11cqh, 58px) * -.5); right: 15%; transform: rotate(12deg); }
.stk-holo {
  bottom: -15px; right: 36%; padding: 6px 14px; border-radius: 999px; transform: rotate(-4deg);
  font: 900 9px var(--display); font-size: clamp(9px, calc(var(--cqh, 100vh) * 2.6 / 100), 12px); font-size: clamp(9px, 2.6cqh, 12px); letter-spacing: .04em; color: #0b0b0f; border: 2.5px solid #0b0b0f;
  background: linear-gradient(110deg, #ffd1f0, #c6f2ff 30%, #eaffb8 50%, #ffd9bf 70%, #e2cbff);
  background-size: 200% 100%; animation: holoShift 4s linear infinite;
}
@keyframes wobble { 50% { transform: rotate(-6deg) scale(1.04); } }
@keyframes holoShift { to { background-position: 200% 0; } }

/* ---------- dock ---------- */
.dock {
  position: relative; z-index: 6; display: flex; align-items: center; gap: 16px; padding: 9px 12px 9px 10px; border-radius: 24px;
  background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .12); backdrop-filter: blur(18px) saturate(150%);
  transition: opacity .4s, filter .4s;
}
.dock-frames { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; }
.dock-label { writing-mode: vertical-rl; transform: rotate(180deg); font: 700 10px var(--mono); letter-spacing: .3em; color: rgba(255, 255, 255, .45); }
.fchips-wrap { position: relative; flex: 1; min-width: 0; display: flex; container-type: inline-size; }
/* narrow strip (small laptops): names only, so 2–3 frames fit next to the arrows */
@container (max-width: 380px) {
  .fchips-wrap .fchip { gap: 8px; padding-right: 11px; }
  .fchips-wrap .fchip small { display: none; }
}
.fchips { flex: 1; display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 3px; min-width: 0; overscroll-behavior-x: contain; }
/* fade + arrow only on the side that still has frames to scroll to */
.fchips-wrap.can-next .fchips {
  -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 70px), transparent calc(100% - 6px));
  mask-image: linear-gradient(90deg, #000 calc(100% - 70px), transparent calc(100% - 6px));
}
.fchips-wrap.can-prev .fchips {
  -webkit-mask-image: linear-gradient(90deg, transparent 6px, #000 70px);
  mask-image: linear-gradient(90deg, transparent 6px, #000 70px);
}
.fchips-wrap.can-prev.can-next .fchips {
  -webkit-mask-image: linear-gradient(90deg, transparent 6px, #000 70px, #000 calc(100% - 70px), transparent calc(100% - 6px));
  mask-image: linear-gradient(90deg, transparent 6px, #000 70px, #000 calc(100% - 70px), transparent calc(100% - 6px));
}
.fc-nav {
  position: absolute; top: 50%; z-index: 2; width: 30px; height: 30px; margin-top: -15px; border-radius: 50%;
  display: grid; place-items: center; padding-bottom: 3px; background: #fff; color: #000; font: 900 21px / 1 var(--display);
  box-shadow: 0 4px 16px rgba(0, 0, 0, .55); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s var(--spring), background .2s;
}
.fc-nav.prev { left: 0; }
.fc-nav.next { right: 0; }
.fchips-wrap.can-prev .fc-nav.prev, .fchips-wrap.can-next .fc-nav.next { opacity: 1; pointer-events: auto; }
.fc-nav:hover { background: var(--lime); transform: scale(1.1); }
.fc-all {
  flex: none; align-self: stretch; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  padding: 6px 12px; border-radius: 16px; background: rgba(255, 255, 255, .06); border: 1.5px dashed rgba(255, 255, 255, .3);
  transition: background .2s, border-color .2s, transform .25s var(--spring);
}
.fc-all svg { width: 18px; height: 18px; color: var(--lime); }
.fc-all b { font: 800 10.5px var(--display); letter-spacing: .04em; }
.fc-all small { font: 400 10px var(--ios); color: rgba(255, 255, 255, .55); white-space: nowrap; }
.fc-all:hover { background: rgba(255, 255, 255, .12); border-color: var(--lime); transform: translateY(-2px); }
.fchips::-webkit-scrollbar { display: none; }
.fchip {
  flex: none; display: flex; align-items: center; gap: 10px; padding: 6px 14px 6px 6px; border-radius: 16px; text-align: left;
  background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .1);
  transition: background .2s, transform .25s var(--spring), border-color .2s, color .2s;
}
.fchip canvas { height: clamp(42px, 7vh, 60px); width: auto; border-radius: 5px; box-shadow: 0 2px 10px rgba(0, 0, 0, .45); }
.fchip b { display: block; font: 800 11.5px var(--display); letter-spacing: .02em; }
.fchip small { display: block; font: 400 11px var(--ios); color: rgba(255, 255, 255, .55); margin-top: 3px; }
.fchip:hover { background: rgba(255, 255, 255, .12); transform: translateY(-2px); }
.fchip.on { background: var(--lime); border-color: var(--lime); color: #000; }
.fchip.on small { color: rgba(0, 0, 0, .62); }
.dock-opts { display: grid; grid-template-columns: auto auto; gap: 6px; }
.seg.wide { grid-column: 1 / -1; }
.seg.wide button { flex: 1; }
#segPose button[data-v="1"].on { background: var(--lime); color: #000; }
.seg { display: flex; align-items: center; gap: 2px; padding: 3px; border-radius: 12px; background: rgba(0, 0, 0, .4); border: 1px solid rgba(255, 255, 255, .08); }
.seg span { font: 700 9.5px var(--mono); letter-spacing: .16em; color: rgba(255, 255, 255, .5); padding: 0 8px 0 7px; min-width: 60px; }
.seg button { min-width: 42px; height: 28px; padding: 0 10px; border-radius: 9px; font: 600 13px var(--ios); color: rgba(255, 255, 255, .8); transition: background .2s, color .2s; }
.seg button:hover { color: #fff; }
.seg button.on { background: #fff; color: #000; }
body:not([data-phase="idle"]) .dock { opacity: .3; pointer-events: none; }

/* ---------- filter sheet (iOS bottom sheet) ---------- */
.sheet {
  position: absolute; inset: 0; z-index: 8;
  display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto; gap: 14px; padding: 10px 22px 18px;
  border-radius: 32px; background: rgba(16, 16, 20, .8); border: 1px solid rgba(255, 255, 255, .14);
  backdrop-filter: blur(30px) saturate(170%); box-shadow: 0 30px 90px rgba(0, 0, 0, .65), inset 0 1px 0 rgba(255, 255, 255, .12);
  opacity: 0; visibility: hidden; transform: translateY(46px) scale(.98);
  transition: opacity .3s var(--ease), transform .5s var(--spring), visibility 0s .5s;
}
body[data-phase="review"] .sheet { opacity: 1; visibility: visible; transform: none; transition: opacity .35s var(--ease), transform .6s var(--spring), visibility 0s; }
body[data-phase="review"] .phone-wrap { filter: blur(8px) brightness(.4); transform: scale(.96); }
.grabber { justify-self: center; width: 44px; height: 5px; border-radius: 3px; background: rgba(255, 255, 255, .3); }
.sheet-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; }
.sheet h2, .reveal h2, .gallery h2 { font: 800 clamp(20px, 2.1vw, 28px) / 1.05 var(--display); letter-spacing: -.02em; }
.sheet h2 em, .reveal h2 em, .gallery h2 em { font: italic 400 1.2em var(--serif); letter-spacing: 0; color: var(--pink); }
.sheet-tools { display: flex; align-items: center; gap: 12px; }
.kbd-hint { font: 500 12px var(--ios); color: rgba(255, 255, 255, .55); white-space: nowrap; }
.sheet-body { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr) clamp(116px, 12.5vw, 190px); gap: 18px; min-height: 0; }
.preview-wrap { container-type: size; min-height: 0; display: grid; place-items: center; }
.preview {
  width: min(calc(var(--cqw, 100vw) * 100 / 100), calc(var(--cqh, 100vh) * 100 / 100) * 1.333); width: min(100cqw, 100cqh * 1.333); aspect-ratio: 4 / 3;
  display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; gap: 8px;
}
.preview.six { width: min(calc(var(--cqw, 100vw) * 100 / 100), calc(var(--cqh, 100vh) * 100 / 100) * .889); width: min(100cqw, 100cqh * .889); aspect-ratio: 8 / 9; grid-template-rows: repeat(3, 1fr); }
.pv { position: relative; min-height: 0; border-radius: 14px; overflow: hidden; background: #111; box-shadow: 0 10px 30px rgba(0, 0, 0, .35); }
.pv canvas { display: block; width: 100%; height: 100%; }
.pv span {
  position: absolute; left: 8px; bottom: 8px; padding: 3px 8px; border-radius: 7px;
  background: rgba(0, 0, 0, .6); backdrop-filter: blur(6px); font: 700 10px var(--mono); letter-spacing: .12em;
}
.pv.empty { display: grid; place-items: center; text-align: center; background: transparent; box-shadow: none; border: 1.5px dashed rgba(255, 255, 255, .22); }
.pv.empty p { font: 700 10px var(--mono); letter-spacing: .16em; color: rgba(255, 255, 255, .5); }
.pv.empty b { display: block; margin: 6px 0; font: 800 18px var(--display); letter-spacing: 0; color: var(--lime); }
.pv.empty small { font: 400 11px var(--ios); letter-spacing: 0; }
.fgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(66px, 1fr)); gap: 10px 8px; align-content: center; overflow: auto; min-height: 0; padding: 4px; scrollbar-width: thin; }
.ftile { display: flex; flex-direction: column; gap: 6px; border-radius: 14px; padding: 4px; transition: transform .25s var(--spring), background .2s; }
.ftile canvas { width: 100%; aspect-ratio: 4 / 3; height: auto; border-radius: 10px; display: block; background: #1a1a1f; box-shadow: 0 0 0 1.5px rgba(255, 255, 255, .08); transition: box-shadow .2s; }
.ftile span { font: 700 10.5px var(--mono); letter-spacing: .1em; color: rgba(255, 255, 255, .7); white-space: nowrap; }
.ftile:hover { transform: translateY(-3px); }
.ftile.on { background: rgba(198, 255, 26, .12); }
.ftile.on canvas { box-shadow: 0 0 0 3px var(--lime), 0 8px 24px rgba(198, 255, 26, .3); }
.ftile.on span { color: var(--lime); }
.sheet-foot { display: flex; align-items: center; gap: 12px; }
.caption {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; height: 52px; padding: 0 16px; border-radius: 16px;
  background: rgba(255, 255, 255, .07); border: 1px solid rgba(255, 255, 255, .12); transition: border-color .2s;
}
.caption:focus-within { border-color: var(--lime); }
.caption span { font: 700 10px var(--mono); letter-spacing: .2em; color: rgba(255, 255, 255, .5); }
.caption input { flex: 1; min-width: 0; background: none; border: 0; outline: 0; color: #fff; font: 500 15px var(--ios); user-select: text; }
.caption input::placeholder { color: rgba(255, 255, 255, .35); }

/* buttons */
.btn {
  height: 52px; padding: 0 20px; border-radius: 16px; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: 700 14px var(--ios); white-space: nowrap; transition: transform .15s, background .2s, box-shadow .15s;
}
.btn svg { width: 18px; height: 18px; }
.btn.ghost { background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .15); }
.btn.ghost:hover { background: rgba(255, 255, 255, .16); }
.btn.ghost:active { transform: scale(.97); }
.btn.ghost.hot { border-color: var(--pink); color: var(--pink); }
.btn.go {
  padding: 0 28px; background: var(--lime); color: #000; font: 900 17px var(--display); letter-spacing: .02em;
  border: 2.5px solid #000; box-shadow: 5px 5px 0 var(--pink);
}
.btn.go:hover { transform: translate(-2px, -2px); box-shadow: 7px 7px 0 var(--pink); }
.btn.go:active { transform: translate(3px, 3px); box-shadow: 2px 2px 0 var(--pink); }
.btn.go span { display: inline-block; animation: spin 4s linear infinite; }
.btn.wide { width: 100%; }

/* ---------- the printer machine ---------- */
.machine-col { position: relative; min-height: 0; display: flex; padding: 0 10px 10px 0; }
.machine {
  position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; align-items: center;
  padding: 16px 16px 14px; border-radius: 32px; color: var(--ink); border: 3px solid var(--ink);
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0) 0 3px, rgba(255, 255, 255, .25) 3px 4px, rgba(0, 0, 0, .025) 4px 5px),
    linear-gradient(165deg, #ffd3ef 0%, #d7f3ff 28%, #efffc4 52%, #ffe3c9 76%, #ecd6ff 100%);
  background-size: auto, 100% 220%;
  box-shadow: 10px 10px 0 var(--ink), inset 0 2px 0 rgba(255, 255, 255, .9), inset 0 -16px 30px rgba(0, 0, 0, .08);
  animation: holo 9s ease-in-out infinite alternate;
}
@keyframes holo { to { background-position: 0 0, 0 100%; } }
.machine.is-printing { animation: holo 9s ease-in-out infinite alternate, buzz .1s linear infinite; }
@keyframes buzz { 50% { translate: .45px -.3px; } }

.flapboard {
  container-type: inline-size; width: 100%; display: flex; gap: 3px; padding: 9px;
  border-radius: 14px; background: #0c0c0f; border: 2.5px solid var(--ink);
  box-shadow: inset 0 3px 12px rgba(0, 0, 0, .8), 0 2px 0 rgba(255, 255, 255, .8);
}
.flap {
  position: relative; flex: 1; aspect-ratio: .7; perspective: 240px;
  font: 700 16px / 1 var(--mono); font-size: calc((calc(var(--cqw, 100vw) * 100 / 100) - 27px) / 10 * .98); font-size: calc((100cqw - 27px) / 10 * .98); color: var(--flap-ink, #f4f4f4);
  transition: color .3s;
}
.flap > div { position: absolute; left: 0; right: 0; height: 50%; overflow: hidden; background: linear-gradient(#24242a, #18181c); }
.flap .f-top, .flap .f-leaf-top { top: 0; border-radius: 4px 4px 0 0; transform-origin: 50% 100%; }
.flap .f-bot, .flap .f-leaf-bot { bottom: 0; border-radius: 0 0 4px 4px; transform-origin: 50% 0; background: linear-gradient(#141418, #1c1c21); }
.flap span { position: absolute; left: 0; right: 0; height: 200%; display: flex; align-items: center; justify-content: center; }
.flap .f-top span, .flap .f-leaf-top span { top: 0; }
.flap .f-bot span, .flap .f-leaf-bot span { bottom: 0; }
.flap .f-leaf { visibility: hidden; z-index: 2; backface-visibility: hidden; }
.flap::after { content: ''; position: absolute; left: 0; right: 0; top: 50%; height: 1.5px; margin-top: -.75px; background: #000; z-index: 3; }

.plate {
  position: relative; margin-top: 14px; padding: 7px 24px 6px; border-radius: 7px; text-align: center;
  background: linear-gradient(#fbfbfb, #dadada); border: 1.5px solid rgba(0, 0, 0, .6);
  font: 700 9.5px / 1.25 var(--mono); letter-spacing: .16em;
  box-shadow: 0 3px 0 rgba(0, 0, 0, .2), inset 0 1px 0 #fff;
}
.plate b { display: block; font-size: 12px; animation: bob 1.6s ease-in-out infinite; }
.plate::before, .plate::after {
  content: ''; position: absolute; top: 50%; width: 6px; height: 6px; margin-top: -3px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff, #888 60%, #444);
}
.plate::before { left: 8px; }
.plate::after { right: 8px; }
@keyframes bob { 50% { transform: translateY(3px); } }
.slot {
  position: relative; z-index: 3; flex: none; width: 88%; height: 44px; margin-top: 12px; border-radius: 24px;
  display: grid; place-items: center; background: linear-gradient(#f4f4f6, #b9bac1); border: 2.5px solid var(--ink);
  box-shadow: inset 0 2px 0 #fff, 0 9px 14px -6px rgba(0, 0, 0, .4);
}
.slot-mouth { width: calc(100% - 22px); height: 15px; border-radius: 10px; background: #050506; box-shadow: inset 0 5px 8px #000, 0 1px 0 rgba(255, 255, 255, .8); }
.machine.is-printing .slot-mouth { box-shadow: inset 0 5px 8px #000, 0 1px 0 rgba(255, 255, 255, .8), 0 0 14px rgba(255, 106, 26, .7); }
.paper-out { position: relative; z-index: 2; width: 100%; flex: 1; min-height: 0; margin-top: -22px; overflow: hidden; }
.strip-holder {
  position: absolute; left: 0; right: 0; top: 0; margin: 0 auto; background: #fff;
  transform: translateY(-101%);
  box-shadow: 0 18px 30px -10px rgba(0, 0, 0, .5), 0 0 0 1px rgba(0, 0, 0, .15); cursor: zoom-in;
}
/* the paper is moved by one Web Animation (transform only), so it gets its own layer while printing */
.machine.is-printing .strip-holder { will-change: transform; }
.strip-holder img { display: block; width: 100%; height: 100%; }
.strip-holder canvas, .tilt canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: none; }
.tilt canvas { border-radius: 6px; }
body.has-motion.view-motion .strip-holder canvas, body.has-motion.view-motion .tilt canvas { display: block; }
/* "developing": a washed-out paper layer that fades away — only opacity animates (a blur filter
   on the whole strip was too heavy for phones) */
.strip-holder::after { content: ''; position: absolute; inset: 0; pointer-events: none; background: #f4f2ec; opacity: 0; }
.strip-holder.developing::after { opacity: .84; }
.strip-holder.developing.developed::after { opacity: 0; transition: opacity 2.6s ease; }
/* a light glint sliding over the paper (transform only) */
.sheen { position: absolute; inset: 0; overflow: hidden; pointer-events: none; opacity: 0; }
.sheen::before {
  content: ''; position: absolute; top: -10%; bottom: -10%; left: 0; width: 60%;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, .42) 50%, rgba(255, 255, 255, 0));
  transform: translateX(-130%) skewX(-14deg);
}
.machine.is-printing .sheen { opacity: 1; }
.machine.is-printing .sheen::before { animation: sheen 1.4s linear infinite; }
@keyframes sheen { to { transform: translateX(230%) skewX(-14deg); } }
.idle-hint {
  position: absolute; inset: 36px 17% 6px; border: 2px dashed rgba(0, 0, 0, .25); border-radius: 8px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; text-align: center;
  font: 700 9.5px / 1.6 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: rgba(0, 0, 0, .45);
}
.ih-arrow { font-size: 24px; animation: bob 1.6s ease-in-out infinite reverse; }
.m-status { margin: 10px 0; font: 700 10px var(--mono); letter-spacing: .22em; color: rgba(0, 0, 0, .6); min-height: 14px; white-space: nowrap; }
.machine.is-printing .m-status { animation: blink 1s steps(2) infinite; }

.glassbar { position: relative; display: flex; align-items: center; gap: 8px; width: 100%; }
.glass {
  background: linear-gradient(180deg, rgba(255, 255, 255, .66), rgba(255, 255, 255, .28));
  border: 1px solid rgba(255, 255, 255, .9);
  box-shadow: 0 8px 20px -6px rgba(0, 0, 0, .28), inset 0 1px 1px #fff, inset 0 -2px 6px rgba(0, 0, 0, .06);
  backdrop-filter: blur(14px) saturate(180%);
}
.g-round { flex: none; width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; color: var(--ink); transition: transform .15s, opacity .2s; }
.g-round:active { transform: scale(.9); }
.g-round:disabled { opacity: .45; }
.g-round svg { width: 20px; height: 20px; }
/* the pill only shows something when there is something to show: progress while printing, "cetak ulang" after */
.g-pill { flex: 1; min-width: 0; height: 46px; border-radius: 23px; display: flex; align-items: center; justify-content: center; padding: 0 6px; transition: opacity .3s; }
body:not([data-phase="printing"]):not([data-phase="done"]) .g-pill { opacity: 0; pointer-events: none; }
.g-prog { flex: 1; min-width: 0; display: none; align-items: center; gap: 10px; padding: 0 8px 0 12px; }
body[data-phase="printing"] .g-prog { display: flex; }
.g-prog b { flex: none; min-width: 34px; font: 700 11px var(--mono); color: var(--ink); text-align: right; }
.g-track { flex: 1; height: 6px; border-radius: 3px; background: rgba(0, 0, 0, .13); overflow: hidden; }
.g-track i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--pink), var(--orange), #9be000); transform: scaleX(0); transform-origin: 0 50%; }
.g-reprint {
  display: none; align-items: center; justify-content: center; gap: 7px; width: 100%; height: 36px; border-radius: 18px;
  font: 700 13px var(--ios); color: var(--ink); transition: background .2s;
}
body[data-phase="done"] .g-reprint { display: inline-flex; }
.g-reprint:hover { background: rgba(255, 255, 255, .55); }
.g-reprint svg { width: 16px; height: 16px; transition: transform .35s; }
.g-reprint:hover svg { transform: rotate(-90deg); }

.popover {
  position: absolute; right: 12px; bottom: 74px; z-index: 20; width: 260px; padding: 8px; border-radius: 22px;
  color: var(--ink); background: rgba(255, 255, 255, .86); border: 1px solid #fff; backdrop-filter: blur(20px) saturate(180%);
  box-shadow: 0 20px 50px rgba(0, 0, 0, .35); animation: popIn .3s var(--spring);
}
@keyframes popIn { from { opacity: 0; transform: translateY(10px) scale(.96); } }
.pop-title { padding: 8px 10px 4px; font: 700 10px var(--mono); letter-spacing: .2em; color: rgba(0, 0, 0, .5); }
.pop-row { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 11px 10px; border-radius: 12px; font: 500 14px var(--ios); text-align: left; }
.pop-row + .pop-row { border-top: 1px solid rgba(0, 0, 0, .08); }
.pop-row:hover { background: rgba(0, 0, 0, .04); }
.pop-row select { max-width: 150px; padding: 5px 8px; border-radius: 9px; border: 1px solid rgba(0, 0, 0, .15); background: #fff; font: 500 12px var(--ios); color: var(--ink); }
.switch { position: relative; flex: none; width: 46px; height: 28px; border-radius: 14px; background: rgba(0, 0, 0, .16); transition: background .25s; }
.switch::after { content: ''; position: absolute; top: 2px; left: 2px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .25); transition: transform .3s var(--spring); }
.switch.on { background: var(--green); }
.switch.on::after { transform: translateX(18px); }

.m-sticker {
  position: absolute; top: -18px; right: -16px; z-index: 5; width: 74px; height: 74px; border-radius: 50%;
  display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1;
  background: var(--pink); color: #fff; border: 3px solid var(--ink); box-shadow: 4px 4px 0 var(--ink);
  font: 900 10px var(--display); letter-spacing: .04em; transform: rotate(12deg); pointer-events: none;
}
.m-sticker b { font-size: 15px; }
.m-sticker small { font: italic 400 13px var(--serif); letter-spacing: 0; margin-top: 2px; }

/* ---------- marquee ---------- */
.marquee {
  position: relative; z-index: 3; height: 42px; overflow: hidden; display: flex; align-items: center;
  background: var(--lime); color: #000; border-top: 2.5px solid #000;
}
.marquee-track { display: flex; flex: none; white-space: nowrap; animation: marquee 46s linear infinite; }
.marquee-track span { display: inline-flex; align-items: center; gap: 22px; padding-right: 22px; font: 900 14px var(--display); letter-spacing: .02em; }
.marquee-track em { font: italic 400 22px var(--serif); letter-spacing: 0; }
.marquee-track i { font-style: normal; color: var(--pink); -webkit-text-stroke: 1px #000; }
@keyframes marquee { to { transform: translateX(-50%); } }

/* ---------- flash ---------- */
.flash { position: fixed; inset: 0; z-index: 60; background: #fffaf0; opacity: 0; pointer-events: none; }
.flash.pre { opacity: 1; transition: opacity .12s; }
.flash.fire { animation: flash .6s ease-out; }
@keyframes flash { 0% { opacity: .92; } 100% { opacity: 0; } }

/* ---------- reveal ---------- */
.reveal { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; }
.reveal-bg { position: absolute; inset: 0; background: rgba(6, 6, 9, .76); backdrop-filter: blur(16px) saturate(140%); opacity: 0; transition: opacity .4s; }
.reveal.show .reveal-bg { opacity: 1; }
.reveal-body { position: relative; display: flex; align-items: center; gap: clamp(24px, 4vw, 64px); max-width: calc(100vw - 48px); }
.tilt-wrap { perspective: 1400px; }
.tilt { position: relative; transform-style: preserve-3d; transition: transform .25s ease-out; border-radius: 6px; }
.tilt img {
  display: block; max-height: calc(100vh - 72px); max-width: min(42vw, 560px); width: auto; height: auto; border-radius: 6px;
  box-shadow: 0 50px 100px -20px rgba(0, 0, 0, .85), 0 0 0 1px rgba(255, 255, 255, .1); transition: opacity .25s;
}
.reveal.busy .tilt img { opacity: .45; }
.glare {
  position: absolute; inset: 0; border-radius: 6px; pointer-events: none; mix-blend-mode: overlay;
  background:
    radial-gradient(circle at var(--gx, 50%) var(--gy, 30%), rgba(255, 255, 255, .4), transparent 45%),
    linear-gradient(115deg, transparent 30%, rgba(255, 61, 154, .2) 42%, rgba(34, 228, 255, .2) 50%, rgba(198, 255, 26, .2) 58%, transparent 70%);
}
.r-panel {
  width: 350px; padding: 26px; border-radius: 30px; background: rgba(22, 22, 26, .8); border: 1px solid rgba(255, 255, 255, .14);
  backdrop-filter: blur(24px); box-shadow: 0 30px 80px rgba(0, 0, 0, .5);
  opacity: 0; transform: translateX(30px); transition: opacity .5s .25s, transform .7s .25s var(--spring);
}
.reveal.show .r-panel { opacity: 1; transform: none; }
.reveal h2 { font-size: 30px; }
.r-sub { margin: 10px 0 20px; font: 400 14px / 1.45 var(--ios); color: rgba(255, 255, 255, .62); }
.r-label { font: 700 10px var(--mono); letter-spacing: .2em; color: rgba(255, 255, 255, .45); margin-bottom: 8px; }
.r-frames { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 20px; }
.r-frames .fchip { padding: 7px 11px; border-radius: 11px; }
.r-frames .fchip small { display: none; }
.r-frames .fchip b { font-size: 10.5px; }
.r-actions { display: flex; flex-direction: column; gap: 10px; }
.r-actions .btn.go { box-shadow: 5px 5px 0 var(--pink); }
.r-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.r-row .btn { height: 46px; }
.r-keys { margin-top: 18px; font: 500 11.5px var(--ios); color: rgba(255, 255, 255, .45); }
.r-close { position: absolute; top: 20px; right: 24px; }

/* ---------- gallery ---------- */
.gallery {
  position: fixed; inset: 0; z-index: 45; display: flex; flex-direction: column; padding: 28px 36px;
  background: rgba(6, 6, 9, .88); backdrop-filter: blur(18px); opacity: 0; transition: opacity .3s;
}
.gallery.show { opacity: 1; }
.gal-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.gallery h2 { font-size: 34px; }
.gal-tools { display: flex; gap: 10px; align-items: center; }
.gal-tools .btn { height: 40px; }
.gal-grid { flex: 1; overflow: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 26px 22px; align-content: start; padding: 6px; }
.gal-item { display: flex; flex-direction: column; gap: 10px; animation: popIn .4s var(--spring) both; }
.gal-img { height: 320px; display: flex; align-items: center; justify-content: center; padding: 12px; border-radius: 16px; background: rgba(255, 255, 255, .04); border: 1px solid rgba(255, 255, 255, .08); }
.gal-img img { max-width: 100%; max-height: 296px; border-radius: 4px; box-shadow: 0 14px 30px rgba(0, 0, 0, .5); }
.gal-item figcaption { display: flex; flex-direction: column; gap: 2px; font: 600 13px var(--ios); }
.gal-item figcaption small { font: 700 9.5px var(--mono); letter-spacing: .14em; color: rgba(255, 255, 255, .5); }
.gal-actions { display: flex; gap: 8px; }
.mini {
  flex: 1; height: 34px; display: grid; place-items: center; border-radius: 10px; text-decoration: none;
  font: 700 12.5px var(--ios); color: #000; background: var(--lime);
}
.mini.danger { background: rgba(255, 255, 255, .08); color: #ff8a80; border: 1px solid rgba(255, 255, 255, .12); }
.gal-empty { grid-column: 1 / -1; margin-top: 12vh; text-align: center; font: 800 26px / 1.3 var(--display); color: rgba(255, 255, 255, .55); }
.gal-empty em { font: italic 400 1.3em var(--serif); color: var(--pink); }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 62px; z-index: 70; max-width: min(560px, 90vw); padding: 12px 18px; border-radius: 16px;
  background: rgba(20, 20, 24, .92); border: 1px solid rgba(255, 255, 255, .16); backdrop-filter: blur(14px);
  font: 600 14px var(--ios); text-align: center; pointer-events: none;
  opacity: 0; transform: translate(-50%, 20px); transition: opacity .3s, transform .45s var(--spring);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- print ---------- */
#printArea { display: none; }
@media print {
  /* 4R photo paper (4×6 in) with two strips side by side */
  @page { size: 4in 6in; margin: 0; }
  body { background: #fff !important; overflow: visible; }
  body > *:not(#printArea) { display: none !important; }
  #printArea { display: block !important; }
  #printArea img { display: block; width: 100vw; height: 100vh; object-fit: contain; }
}

/* ---------- smaller screens ---------- */
@media (max-width: 1080px) {
  body { overflow: auto; }
  .stage { height: auto; grid-template-columns: 1fr; }
  .phone-wrap { flex: none; height: 52vw; min-height: 280px; }
  .sheet { position: fixed; inset: 12px; }
  .machine-col { height: 760px; }
  .cam-wrap { display: none; }
}
@media (max-height: 720px) {
  .topbar { height: 54px; }
  .stage { height: calc(100% - 54px - 36px); }
  .marquee { height: 36px; }
  .dock { padding-block: 6px; }
}
@media (prefers-reduced-motion: reduce) {
  .blob, .grain, .logo-star, .stk-burst, .stk-holo, .machine, .marquee-track { animation: none !important; }
}

/* ---------- motion photo ---------- */
.live-chip {
  position: absolute; left: 12px; bottom: 14px; display: none; align-items: center; gap: 6px; padding: 5px 10px 5px 8px;
  border-radius: 999px; font: 700 10.5px var(--ios); letter-spacing: .12em; color: var(--yellow);
  background: rgba(0, 0, 0, .45); border: 1px solid rgba(255, 214, 10, .55); backdrop-filter: blur(8px);
}
.live-chip i { width: 12px; height: 12px; border-radius: 50%; border: 1.5px dotted currentColor; box-shadow: inset 0 0 0 2.5px rgba(0, 0, 0, .45), inset 0 0 0 5px currentColor; }
.viewfinder .live-chip { display: flex; }
body.is-live .live-chip { background: var(--yellow); color: #000; border-color: var(--yellow); animation: livePulse .8s ease-in-out infinite; }
body.is-live .viewfinder { box-shadow: inset 0 0 0 4px var(--yellow); }
@keyframes livePulse { 50% { box-shadow: 0 0 0 6px rgba(255, 214, 10, .25); } }
.pv-live {
  position: absolute; right: 8px; top: 8px; padding: 3px 8px; border-radius: 7px; font: 700 10px var(--ios); font-style: normal;
  letter-spacing: .12em; background: var(--yellow); color: #000;
}
.motion-only { display: none !important; }
body.has-motion .r-actions .motion-only { display: inline-flex !important; }
body.has-motion .r-keys .motion-only { display: inline !important; }
#recCanvas, #storyCanvas { position: fixed; left: -10000px; top: 0; width: 8px; height: 8px; pointer-events: none; }
.gal-img { position: relative; }
.gal-img video { max-width: 100%; max-height: 296px; border-radius: 4px; box-shadow: 0 14px 30px rgba(0, 0, 0, .5); }
.gal-live { position: absolute; top: 18px; right: 18px; padding: 3px 8px; border-radius: 7px; font: 700 10px var(--ios); font-style: normal; letter-spacing: .12em; background: var(--yellow); color: #000; }

/* ---------- palm shutter ---------- */
.hint-palm { display: none; }
body.palm-on .hint-key { display: none; }
body.palm-on .hint-palm { display: inline; }
#btnPalm.on { color: #000; background: var(--cyan); }
body.palm-loading #btnPalm { animation: blink .8s steps(2) infinite; }
.palm-meter {
  position: absolute; left: 50%; top: 50%; width: clamp(110px, calc(var(--cqh, 100vh) * 34 / 100), 170px); width: clamp(110px, 34cqh, 170px); aspect-ratio: 1; transform: translate(-50%, -50%) scale(.8);
  display: grid; place-items: center; border-radius: 50%; background: rgba(0, 0, 0, .45); backdrop-filter: blur(6px);
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .3s var(--spring);
}
.palm-meter.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.palm-meter svg { position: absolute; inset: 6px; width: calc(100% - 12px); height: calc(100% - 12px); transform: rotate(-90deg); }
.palm-meter circle { fill: none; stroke-width: 3.2; }
.pm-track { stroke: rgba(255, 255, 255, .2); }
.pm-fill { stroke: var(--cyan); stroke-linecap: round; stroke-dasharray: 100; stroke-dashoffset: calc(100 - var(--p, 0) * 100); filter: drop-shadow(0 0 6px var(--cyan)); }
.pm-hand { font-size: clamp(36px, calc(var(--cqh, 100vh) * 12 / 100), 58px); font-size: clamp(36px, 12cqh, 58px); line-height: 1; margin-top: -10px; }
.palm-meter b { position: absolute; bottom: 22%; font: 700 9px var(--mono); font-size: clamp(9px, calc(var(--cqh, 100vh) * 2.6 / 100), 12px); font-size: clamp(9px, 2.6cqh, 12px); letter-spacing: .2em; color: var(--cyan); }

/* ---------- AR accessories ---------- */
#arCanvas {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; pointer-events: none;
  transform: scaleX(var(--mx, -1)) scale(var(--zoom, 1)); transition: transform .35s var(--ease);
}
#fxCanvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.ar-btn {
  flex: none; display: flex; align-items: center; gap: 10px; align-self: stretch; padding: 6px 16px 6px 12px; border-radius: 16px;
  background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .12); text-align: left;
  transition: background .2s, transform .25s var(--spring), border-color .2s;
}
.ar-btn:hover { background: rgba(255, 255, 255, .12); transform: translateY(-2px); }
.ar-btn i { font-size: 26px; font-style: normal; line-height: 1; letter-spacing: -4px; }
.ar-btn b { display: block; font: 800 12px var(--display); }
.ar-btn small { display: block; font: 400 11px var(--ios); color: rgba(255, 255, 255, .6); margin-top: 3px; white-space: nowrap; }
body.ar-on .ar-btn { background: linear-gradient(135deg, var(--pink), var(--violet)); border-color: transparent; }
body.ar-on .ar-btn small { color: rgba(255, 255, 255, .9); }
body.ar-loading .ar-btn i { animation: blink .8s steps(2) infinite; }
/* the AR picker replaces the dock while open (no popup over the camera): pick, and see it on your face right away */
.ar-panel { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; animation: popIn .3s var(--spring); }
body.ar-open .dock > :not(.ar-panel):not(.frame-peek) { display: none; }
body.ar-open .dock { border-color: rgba(255, 61, 154, .55); box-shadow: 0 0 0 1px rgba(255, 61, 154, .25), 0 0 30px rgba(255, 61, 154, .18); }
.ar-top { display: flex; align-items: center; gap: 10px; min-width: 0; flex-wrap: wrap; }
.ar-title { flex: none; font: 900 15px / 1.05 var(--display); }
.ar-title small { display: block; font: 400 10.5px var(--ios); color: rgba(255, 255, 255, .55); }
.ar-tabs { display: flex; gap: 3px; padding: 3px; border-radius: 12px; background: rgba(0, 0, 0, .4); border: 1px solid rgba(255, 255, 255, .08); }
.ar-tab {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 11px; border-radius: 9px;
  font: 700 10px var(--mono); letter-spacing: .14em; color: rgba(255, 255, 255, .72); transition: background .2s, color .2s;
}
.ar-tab i { font-style: normal; font-size: 15px; letter-spacing: 0; line-height: 1; }
.ar-tab:hover { color: #fff; }
.ar-tab.on { background: #fff; color: #000; }
.ar-tools { margin-left: auto; display: flex; gap: 6px; }
.ar-tools .btn { height: 34px; padding: 0 12px; border-radius: 11px; font-size: 12.5px; }
.ar-tools .btn.go { padding: 0 14px; border-width: 2px; font-size: 12.5px; box-shadow: 3px 3px 0 var(--pink); }
.ar-tools .btn.go:hover { box-shadow: 4px 4px 0 var(--pink); }
.ar-items { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: thin; padding-bottom: 2px; }
.ar-item {
  flex: none; width: 72px; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 7px 3px 6px; border-radius: 13px;
  background: rgba(255, 255, 255, .04); border: 1px solid transparent; transition: background .2s, transform .25s var(--spring), border-color .2s;
}
.ar-item i { font-size: 24px; font-style: normal; line-height: 1; }
.ar-item span { font: 500 10px/1.15 var(--ios); color: rgba(255, 255, 255, .7); text-align: center; }
.ar-item:hover { background: rgba(255, 255, 255, .1); transform: translateY(-2px); }
.ar-item.on { background: rgba(198, 255, 26, .14); border-color: var(--lime); }
.ar-item.on span { color: var(--lime); }
#arRandom.on { border-color: var(--yellow); color: var(--yellow); }

/* ---------- photo editor ---------- */
.pv[data-i] { cursor: grab; }
.pv.dragging { opacity: .4; }
.pv.drop-target { box-shadow: 0 0 0 3px var(--lime), 0 10px 30px rgba(198, 255, 26, .3); }
.pv-num {
  position: absolute; top: 8px; left: 8px; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;
  background: #fff; color: #000; font: 800 12px var(--display); box-shadow: 0 2px 8px rgba(0, 0, 0, .4);
}
.pv-tools {
  position: absolute; left: 50%; bottom: 10px; transform: translate(-50%, 6px); display: flex; gap: 6px;
  opacity: 0; transition: opacity .2s, transform .25s var(--spring);
}
.pv:hover .pv-tools, .pv:focus-within .pv-tools { opacity: 1; transform: translate(-50%, 0); }
.pv-tools button {
  padding: 6px 11px; border-radius: 10px; font: 700 12px var(--ios); color: #fff; white-space: nowrap;
  background: rgba(0, 0, 0, .62); border: 1px solid rgba(255, 255, 255, .25); backdrop-filter: blur(8px);
}
.pv-tools button:hover { background: var(--lime); color: #000; border-color: var(--lime); }
.pv-tools em { font-style: normal; }
.pv:hover span { opacity: 0; }
.editor { position: fixed; inset: 0; z-index: 55; display: grid; place-items: center; }
.ed-bg { position: absolute; inset: 0; background: rgba(6, 6, 9, .78); backdrop-filter: blur(14px); }
.ed-card {
  position: relative; width: min(880px, calc(100vw - 32px)); padding: 18px 20px 16px; border-radius: 28px;
  background: rgba(20, 20, 26, .96); border: 1px solid rgba(255, 255, 255, .14); box-shadow: 0 40px 90px rgba(0, 0, 0, .6);
  animation: popIn .3s var(--spring);
}
.ed-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.ed-head h3 { font: 800 22px var(--display); letter-spacing: -.01em; }
.ed-head h3 em { font: italic 400 1.2em var(--serif); color: var(--pink); }
.ed-stage { position: relative; margin: 0 auto; width: min(100%, calc((100vh - 290px) * 4 / 3)); border-radius: 16px; overflow: hidden; background: #000; }
#edCanvas { display: block; width: 100%; height: auto; aspect-ratio: 4 / 3; cursor: grab; touch-action: none; }
#edCanvas.grabbing { cursor: grabbing; }
.ed-grid {
  position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(90deg, transparent calc(33.33% - .5px), rgba(255,255,255,.35) 0, rgba(255,255,255,.35) calc(33.33% + .5px), transparent 0, transparent calc(66.66% - .5px), rgba(255,255,255,.35) 0, rgba(255,255,255,.35) calc(66.66% + .5px), transparent 0),
    linear-gradient(180deg, transparent calc(33.33% - .5px), rgba(255,255,255,.35) 0, rgba(255,255,255,.35) calc(33.33% + .5px), transparent 0, transparent calc(66.66% - .5px), rgba(255,255,255,.35) 0, rgba(255,255,255,.35) calc(66.66% + .5px), transparent 0);
}
.ed-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.ed-tools .btn { height: 44px; }
.ed-zoom { flex: 1; min-width: 220px; display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 14px; border-radius: 14px; background: rgba(255, 255, 255, .07); border: 1px solid rgba(255, 255, 255, .12); }
.ed-zoom span { font: 700 10px var(--mono); letter-spacing: .2em; color: rgba(255, 255, 255, .5); }
.ed-zoom input { flex: 1; accent-color: var(--lime); }
.ed-zoom b { min-width: 46px; text-align: right; font: 700 12px var(--mono); color: var(--lime); }
#edFlip.on { border-color: var(--cyan); color: var(--cyan); }
.ed-note { margin-top: 10px; font: 400 12px var(--ios); color: rgba(255, 255, 255, .5); }

/* ---------- confirm dialog ---------- */
.confirm { position: fixed; inset: 0; z-index: 75; display: grid; place-items: center; }
.cf-bg { position: absolute; inset: 0; background: rgba(6, 6, 9, .7); backdrop-filter: blur(10px); animation: fadeIn .2s ease; }
.cf-card {
  position: relative; width: min(360px, calc(100vw - 32px)); padding: 26px 22px 18px; border-radius: 26px; text-align: center;
  background: rgba(26, 26, 32, .97); border: 1px solid rgba(255, 255, 255, .14); box-shadow: 0 30px 80px rgba(0, 0, 0, .6);
  animation: popIn .3s var(--spring);
}
.cf-icon { font-size: 34px; line-height: 1; margin-bottom: 10px; }
.cf-card h3 { font: 800 19px var(--display); letter-spacing: -.01em; }
.cf-card p { margin: 10px 4px 20px; font: 400 14px / 1.45 var(--ios); color: rgba(255, 255, 255, .7); }
.cf-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cf-actions .btn { height: 46px; padding: 0 12px; font-size: 13.5px; }
.btn.danger { background: var(--red); color: #fff; border: 0; }
.btn.danger:hover { background: #ff574d; }
.btn.danger:active { transform: scale(.97); }
#cfNo:focus-visible { outline: 2px solid var(--lime); outline-offset: 2px; }
@keyframes fadeIn { from { opacity: 0; } }

/* ---------- background swap ---------- */
#bgCanvas {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; pointer-events: none; opacity: 0;
  transform: scaleX(var(--mx, -1)) scale(var(--zoom, 1)); transition: transform .35s var(--ease);
}
body.bg-live #bgCanvas { opacity: 1; }
body.bg-loading .ar-btn i { animation: blink .8s steps(2) infinite; }
.ar-btn i { max-width: 92px; overflow: hidden; white-space: nowrap; }

/* ---------- pose challenge ---------- */
.pose-banner {
  position: absolute; left: 50%; bottom: clamp(10px, calc(var(--cqh, 100vh) * 4 / 100), 22px); bottom: clamp(10px, 4cqh, 22px); z-index: 2; max-width: 90%; pointer-events: none;
  display: flex; align-items: center; gap: clamp(8px, calc(var(--cqh, 100vh) * 2.4 / 100), 14px); gap: clamp(8px, 2.4cqh, 14px); padding: clamp(6px, calc(var(--cqh, 100vh) * 2 / 100), 11px) clamp(12px, calc(var(--cqh, 100vh) * 3.6 / 100), 20px) clamp(6px, calc(var(--cqh, 100vh) * 2 / 100), 11px) clamp(8px, calc(var(--cqh, 100vh) * 2.4 / 100), 13px); padding: clamp(6px, 2cqh, 11px) clamp(12px, 3.6cqh, 20px) clamp(6px, 2cqh, 11px) clamp(8px, 2.4cqh, 13px);
  border-radius: 18px; background: var(--lime); color: #000; border: 3px solid #000; box-shadow: 5px 5px 0 #000;
  opacity: 0; transform: translate(-50%, 24px) rotate(-2deg); transition: opacity .3s, transform .5s var(--spring);
}
.pose-banner.show { opacity: 1; transform: translate(-50%, 0) rotate(-2deg); }
body:not([data-phase="shooting"]) .pose-banner { opacity: 0; }
.pose-banner i { font-style: normal; font-size: clamp(24px, calc(var(--cqh, 100vh) * 9 / 100), 46px); font-size: clamp(24px, 9cqh, 46px); line-height: 1; }
.pose-banner small { display: block; font: 700 8px var(--mono); font-size: clamp(8px, calc(var(--cqh, 100vh) * 2.3 / 100), 10.5px); font-size: clamp(8px, 2.3cqh, 10.5px); letter-spacing: .2em; }
.pose-banner b { display: block; margin-top: 2px; font: 900 13px / 1.1 var(--display); font-size: clamp(13px, calc(var(--cqh, 100vh) * 4.6 / 100), 24px); font-size: clamp(13px, 4.6cqh, 24px); letter-spacing: -.01em; }

/* ---------- popover extras ---------- */
.pop-val { flex: none; min-width: 46px; padding: 4px 9px; border-radius: 9px; background: rgba(0, 0, 0, .1); font: 800 11px var(--display); text-align: center; color: rgba(0, 0, 0, .55); }
.pop-val.on { background: var(--green); color: #fff; }
a.pop-row { color: inherit; text-decoration: none; }
.pop-row span small { display: block; margin-top: 1px; font: 400 11px var(--ios); color: rgba(0, 0, 0, .5); }
.pop-val.warn { background: var(--yellow); color: #000; }
body.pin-locked .lockable { position: relative; }
body.pin-locked .lockable::after {
  content: '\1F512'; position: absolute; top: -7px; right: -7px; width: 20px; height: 20px; border-radius: 50%;
  display: grid; place-items: center; font-size: 10px; background: #16161c; border: 1px solid rgba(255, 255, 255, .25);
}
body.pin-locked .cam-info.lockable::after { top: -8px; right: -8px; }

/* ---------- event pill ---------- */
.ev-pill {
  display: inline-flex; align-items: center; gap: 8px; min-width: 0; max-width: min(320px, 28vw); height: 32px; padding: 0 14px 0 10px;
  border-radius: 999px; background: var(--ev, var(--pink)); color: var(--ev-fg, #fff); border: 2.5px solid #000; box-shadow: 3px 3px 0 #000;
  font: 800 11.5px var(--display); letter-spacing: .04em; text-transform: uppercase; transform: rotate(-1.5deg);
  transition: transform .25s var(--spring);
}
.ev-pill:hover { transform: rotate(0) translateY(-1px); }
.ev-pill span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ev-pill i { font-style: normal; display: inline-block; animation: spin 6s linear infinite; }

/* ---------- QR share ---------- */
.r-share {
  display: flex; align-items: center; gap: 14px; margin: 12px 0 18px; padding: 10px; border-radius: 18px;
  background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .12);
}
.qr-box { position: relative; flex: none; width: 116px; height: 116px; padding: 5px; border-radius: 12px; background: #fff; }
.qr-box canvas { display: block; width: 100%; height: 100%; image-rendering: pixelated; transition: opacity .25s; }
.r-share:not([data-state="ok"]) .qr-box canvas { opacity: .06; }
.qr-spin {
  position: absolute; inset: 0; margin: auto; width: 30px; height: 30px; border-radius: 50%; display: none;
  border: 3px solid rgba(0, 0, 0, .14); border-top-color: var(--pink); animation: spin .8s linear infinite;
}
.r-share[data-state="wait"] .qr-spin { display: block; }
.qr-txt { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.qr-txt b { font: 800 14px var(--display); }
.qr-txt span { font: 600 13px / 1.35 var(--ios); color: var(--lime); }
.r-share[data-state="err"] .qr-txt span { color: #ff8a80; }
.qr-txt small { font: 400 11px / 1.35 var(--ios); color: rgba(255, 255, 255, .5); overflow-wrap: anywhere; }
#qrUrl { font: 700 10.5px var(--mono); color: rgba(255, 255, 255, .72); }
.r-panel { max-height: calc(100vh - 40px); overflow-y: auto; scrollbar-width: thin; }

/* ---------- kiosk auto reset ---------- */
.auto-reset {
  position: relative; margin-top: 14px; padding: 9px 12px 11px; border-radius: 12px; overflow: hidden;
  background: rgba(255, 255, 255, .06); font: 500 12px var(--ios); color: rgba(255, 255, 255, .72);
}
.auto-reset i { position: absolute; left: 0; bottom: 0; height: 3px; width: calc(var(--p, 1) * 100%); background: var(--pink); transition: width .25s linear; }
.auto-reset b { color: #fff; font-family: var(--mono); }

/* ---------- modals: event + PIN ---------- */
.modal { position: fixed; inset: 0; z-index: 76; display: grid; place-items: center; }
.md-bg { position: absolute; inset: 0; background: rgba(6, 6, 9, .74); backdrop-filter: blur(12px); animation: fadeIn .2s ease; }
.md-card {
  position: relative; width: min(470px, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow-y: auto; padding: 20px 22px 18px;
  border-radius: 28px; background: rgba(22, 22, 28, .97); border: 1px solid rgba(255, 255, 255, .14);
  box-shadow: 0 40px 90px rgba(0, 0, 0, .6); animation: popIn .3s var(--spring);
}
.md-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.md-head h3 { font: 800 22px var(--display); letter-spacing: -.01em; }
.md-head h3 em { font: italic 400 1.2em var(--serif); color: var(--pink); }
.ev-toggle {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; padding: 12px 14px;
  border-radius: 16px; background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .1); text-align: left;
}
.ev-toggle b { display: block; font: 700 14px var(--ios); }
.ev-toggle small { display: block; margin-top: 2px; font: 400 12px var(--ios); color: rgba(255, 255, 255, .55); }
.ev-toggle .switch { background: rgba(255, 255, 255, .2); }
.ev-toggle .switch.on { background: var(--green); }
.ev-field { display: block; margin-bottom: 12px; transition: opacity .2s; }
.ev-field > span { display: block; margin-bottom: 6px; font: 700 10px var(--mono); letter-spacing: .2em; color: rgba(255, 255, 255, .5); }
.ev-field input:not([type="color"]) {
  width: 100%; height: 44px; padding: 0 14px; border-radius: 13px; background: rgba(0, 0, 0, .35); border: 1px solid rgba(255, 255, 255, .14);
  color: #fff; font: 600 15px var(--ios); user-select: text;
}
.ev-field input::placeholder { color: rgba(255, 255, 255, .32); font-weight: 400; }
.ev-colors { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ev-colors [data-c] { width: 30px; height: 30px; border-radius: 50%; background: var(--c); border: 2px solid rgba(255, 255, 255, .28); transition: transform .2s var(--spring), box-shadow .2s; }
.ev-colors [data-c]:hover { transform: scale(1.1); }
.ev-colors [data-c].on { box-shadow: 0 0 0 3px #16161c, 0 0 0 5px #fff; }
.ev-colors input[type="color"] { width: 36px; height: 32px; padding: 0; border: 0; background: none; cursor: pointer; }
.ev-preview {
  display: flex; align-items: center; gap: 10px; height: 46px; margin: 2px 0 14px; padding: 0 16px; border-radius: 10px;
  font: 800 14px var(--display); letter-spacing: .03em; transition: background .2s, color .2s, opacity .2s;
}
.ev-preview span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ev-preview small { font: 700 10px var(--mono); letter-spacing: .14em; }
.ev-card.off .ev-preview, .ev-card.off .ev-field { opacity: .5; }
.ev-seg { width: max-content; max-width: 100%; }
.ev-seg button { min-width: 64px; }
.ev-note { margin: 0 0 14px; font: 400 12px / 1.45 var(--ios); color: rgba(255, 255, 255, .5); }
.md-actions { display: grid; grid-template-columns: 1fr 1.5fr; gap: 10px; }
.md-actions .btn { height: 48px; }
.md-actions .btn.go { box-shadow: 4px 4px 0 var(--pink); }
.pin-card { width: min(330px, calc(100vw - 32px)); padding: 24px 22px 22px; text-align: center; }
.pin-card h3 { font: 800 22px var(--display); }
.pin-sub { margin-top: 4px; font: 400 13px var(--ios); color: rgba(255, 255, 255, .55); }
.pin-dots { display: flex; justify-content: center; gap: 14px; margin: 20px 0 22px; }
.pin-dots i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .85); transition: background .15s; }
.pin-dots i.on { background: #fff; }
.pin-card.bad .pin-dots { animation: shake .38s; }
.pin-card.bad .pin-dots i { border-color: var(--red); }
@keyframes shake { 20%, 60% { transform: translateX(-10px); } 40%, 80% { transform: translateX(10px); } }
.pin-pad { display: grid; grid-template-columns: repeat(3, 70px); gap: 12px 20px; justify-content: center; }
.pin-pad button { width: 70px; height: 70px; border-radius: 50%; background: rgba(255, 255, 255, .12); font: 400 28px var(--ios); transition: background .15s, transform .15s; }
.pin-pad button:hover { background: rgba(255, 255, 255, .2); }
.pin-pad button:active { background: rgba(255, 255, 255, .38); transform: scale(.94); }
.pin-pad button.fn { background: none; font: 600 14px var(--ios); }

/* reveal panel: make room for the QR on short laptop screens */
@media (max-height: 820px) {
  .r-panel { width: 380px; padding: 20px 20px 18px; border-radius: 26px; }
  .reveal h2 { font-size: 24px; }
  .r-sub { margin: 8px 0 14px; }
  .r-share { margin: 10px 0 14px; padding: 8px; }
  .qr-box { width: 100px; height: 100px; }
  .r-frames { gap: 5px; margin-bottom: 14px; }
  .r-frames .fchip { padding: 6px 9px; }
  .r-actions { gap: 8px; }
  .r-actions .btn.go { height: 46px; }
  .r-row .btn { height: 42px; }
  .r-keys { display: none; }
  .auto-reset { margin-top: 10px; }
}

/* ---------- result: FOTO / MOTION ---------- */
.r-view { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; padding: 3px; border-radius: 14px; background: rgba(0, 0, 0, .4); border: 1px solid rgba(255, 255, 255, .1); }
.r-view button { height: 36px; border-radius: 11px; font: 800 12px var(--display); letter-spacing: .04em; color: rgba(255, 255, 255, .7); transition: background .2s, color .2s; }
.r-view button:hover { color: #fff; }
.r-view button.on { background: #fff; color: #000; }
.r-view button[data-v="motion"].on { background: var(--yellow); }
#btnSave.vid { background: var(--yellow); }
#btnSave:disabled { opacity: .8; cursor: progress; transform: none; }
.r-share[data-state="hint"] .qr-box, .r-share[data-state="hint"] #qrUrl, .r-share[data-state="hint"] .qr-wifi { display: none; }
.r-share[data-state="hint"] { border-color: rgba(255, 214, 10, .35); background: rgba(255, 214, 10, .07); }
.r-share[data-state="hint"] .qr-txt span { color: var(--yellow); font-weight: 500; }

/* ---------- help button ---------- */
.pill.help { font: 900 16px var(--display); }

/* ---------- how-to ---------- */
.intro-card { width: min(520px, calc(100vw - 32px)); padding: 16px 16px 14px; }
.intro-step { display: none; }
.intro-step.on { display: block; animation: introIn .45s var(--spring); }
@keyframes introIn { from { opacity: 0; transform: translateX(24px); } }
.intro-step h3 { margin-top: 2px; font: 800 26px var(--display); letter-spacing: -.02em; }
.intro-step h3 em { font: italic 400 1.2em var(--serif); color: var(--pink); }
.intro-step > p:not(.eyebrow) { margin: 8px 2px 4px; min-height: 4.4em; font: 400 14.5px / 1.5 var(--ios); color: rgba(255, 255, 255, .72); }
.intro-step > p b { color: #fff; }
.intro-step .eyebrow { margin: 16px 2px 4px; }
.ia {
  position: relative; height: clamp(150px, 30vh, 210px); border-radius: 20px; overflow: hidden; display: grid; place-items: center;
  border: 2.5px solid #000; box-shadow: 5px 5px 0 #000;
}
.ia::before { content: ''; position: absolute; inset: 0; background-image: radial-gradient(rgba(0, 0, 0, .16) 1.5px, transparent 2px); background-size: 16px 16px; }
.ia1 { background: linear-gradient(135deg, var(--pink), var(--orange)); }
.ia2 { background: linear-gradient(135deg, var(--lime), var(--cyan)); }
.ia3 { background: linear-gradient(135deg, var(--violet), var(--pink)); }
.ia4 { background: linear-gradient(135deg, var(--blue), var(--cyan)); }
.ia-emo { position: relative; font-size: clamp(64px, 13vh, 96px); line-height: 1; filter: drop-shadow(4px 5px 0 rgba(0, 0, 0, .35)); animation: wobble 2.6s ease-in-out infinite; }
.ia-tag {
  position: absolute; padding: 6px 11px; border-radius: 10px; background: #fff; color: #000; border: 2px solid #000; box-shadow: 3px 3px 0 #000;
  font: 900 12px var(--display); letter-spacing: .03em; white-space: nowrap;
}
.ia-tag.t1 { left: 7%; top: 14%; transform: rotate(-7deg); }
.ia-tag.t2 { right: 7%; top: 22%; transform: rotate(6deg); background: var(--yellow); }
.ia-tag.t3 { left: 50%; bottom: 10%; transform: translateX(-50%) rotate(-2deg); background: #000; color: #fff; border-color: #fff; box-shadow: 3px 3px 0 var(--pink); }
.intro-foot { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; margin-top: 12px; }
.intro-foot .btn { height: 46px; }
.intro-foot .btn.go { min-width: 150px; box-shadow: 4px 4px 0 var(--pink); }
.intro-dots { display: flex; justify-content: center; gap: 7px; }
.intro-dots i { width: 8px; height: 8px; border-radius: 4px; background: rgba(255, 255, 255, .25); transition: width .3s var(--spring), background .3s; }
.intro-dots i.on { width: 22px; background: var(--lime); }
.intro-hide { display: flex; align-items: center; gap: 8px; margin-top: 12px; font: 500 12px var(--ios); color: rgba(255, 255, 255, .55); cursor: pointer; }
.intro-hide input { accent-color: var(--lime); width: 15px; height: 15px; }
.intro-hide small { color: rgba(255, 255, 255, .35); font-size: 11px; }
@media (max-height: 720px) {
  .ia { height: 130px; }
  .intro-step .eyebrow { margin-top: 12px; }
  .intro-step h3 { font-size: 22px; }
}
.btn.go #btnSaveTxt, .btn.go #gvSaveTxt, .ar-tools .btn.go span { display: inline; animation: none; }

/* ---------- frame peek ---------- */
.frame-peek {
  position: absolute; bottom: calc(100% + 14px); left: 0; z-index: 11; display: flex; flex-direction: column; gap: 8px;
  padding: 10px 10px 9px; border-radius: 20px; pointer-events: none;
  background: rgba(18, 18, 24, .96); border: 1px solid rgba(255, 255, 255, .16); box-shadow: 0 26px 60px rgba(0, 0, 0, .6);
  animation: popIn .25s var(--spring);
}
.frame-peek::after {
  content: ''; position: absolute; left: var(--ax, 50%); bottom: -8px; width: 14px; height: 14px; transform: translateX(-50%) rotate(45deg);
  background: rgb(18, 18, 24); border-right: 1px solid rgba(255, 255, 255, .16); border-bottom: 1px solid rgba(255, 255, 255, .16);
}
.frame-peek canvas {
  display: block; height: clamp(220px, calc(100vh - 360px), 420px); width: auto; max-width: 300px; margin: 0 auto;
  border-radius: 5px; box-shadow: 0 10px 26px rgba(0, 0, 0, .55);
}
.fp-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 0 2px; }
.fp-head b { display: block; font: 800 13px var(--display); letter-spacing: .02em; }
.fp-head small { display: block; margin-top: 2px; font: 400 11px var(--ios); color: rgba(255, 255, 255, .55); }
.fp-live {
  flex: none; padding: 3px 7px; border-radius: 6px; font: 700 9.5px var(--ios); font-style: normal; letter-spacing: .14em;
  background: var(--red); color: #fff; animation: blink 1.4s steps(2) infinite;
}
.fp-foot { text-align: center; font: 700 10px var(--mono); letter-spacing: .14em; color: rgba(255, 255, 255, .5); text-transform: uppercase; }
.fp-used { display: none; color: var(--lime); }
.frame-peek.is-on .fp-used { display: inline; }
.frame-peek.is-on .fp-pick { display: none; }

/* ---------- result: scrollable frame list ---------- */
.r-frames {
  display: grid; grid-auto-flow: column; grid-template-rows: repeat(3, auto); grid-auto-columns: max-content; justify-content: start;
  overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: thin; padding-bottom: 6px;
  -webkit-mask-image: linear-gradient(90deg, #000 86%, transparent); mask-image: linear-gradient(90deg, #000 86%, transparent);
}

/* ---------- shooting: "jepret sekarang" hint + cancel ---------- */
.shoot-hint {
  display: none; align-self: center; text-align: right; color: rgba(255, 255, 255, .6);
  font: 600 8.5px / 1.4 var(--ios); font-size: clamp(8.5px, calc(var(--cqh, 100vh) * 2.4 / 100), 11px); font-size: clamp(8.5px, 2.4cqh, 11px); letter-spacing: .02em;
}
.shoot-hint b { display: block; margin-top: .5em; color: var(--lime); font-weight: 800; }
body[data-phase="shooting"] .modes { display: none; }
body[data-phase="shooting"] .shoot-hint { display: block; }
.vf-cancel {
  position: absolute; top: 12px; left: 12px; z-index: 3; display: none; align-items: center; gap: 6px; height: 32px; padding: 0 14px;
  border-radius: 999px; background: rgba(0, 0, 0, .6); border: 1px solid rgba(255, 255, 255, .3); backdrop-filter: blur(8px);
  font: 700 12.5px var(--ios); color: #fff; cursor: pointer; transition: background .2s, border-color .2s;
}
.vf-cancel:hover { background: var(--red); border-color: var(--red); }
body[data-phase="shooting"] .vf-cancel { display: inline-flex; }
body.is-demo[data-phase="shooting"] .demo-badge { display: none; }

/* ---------- camera not available: a clear screen instead of a cartoon demo cam ---------- */
.cam-block {
  position: absolute; inset: 0; z-index: 4; display: grid; place-items: center; padding: 4%; cursor: default;
  background: radial-gradient(circle at 50% 35%, #23232d, #09090c 72%);
}
.cb-card { max-width: 94%; display: flex; flex-direction: column; align-items: center; gap: clamp(6px, calc(var(--cqh, 100vh) * 2.4 / 100), 12px); gap: clamp(6px, 2.4cqh, 12px); text-align: center; }
.cb-ic { font-size: clamp(26px, calc(var(--cqh, 100vh) * 10 / 100), 50px); font-size: clamp(26px, 10cqh, 50px); line-height: 1; }
.cb-card > b { font: 800 14px / 1.15 var(--display); font-size: clamp(14px, calc(var(--cqh, 100vh) * 5 / 100), 22px); font-size: clamp(14px, 5cqh, 22px); letter-spacing: -.01em; }
.cb-card ol { margin: 0 0 0 1.3em; text-align: left; font: 500 11px / 1.45 var(--ios); font-size: clamp(11px, calc(var(--cqh, 100vh) * 3.3 / 100), 14px); font-size: clamp(11px, 3.3cqh, 14px); color: rgba(255, 255, 255, .82); }
.cb-card ol b { color: #fff; }
.cb-card li + li { margin-top: .25em; }
.cb-card .btn { height: clamp(34px, calc(var(--cqh, 100vh) * 10 / 100), 46px); height: clamp(34px, 10cqh, 46px); padding: 0 clamp(14px, calc(var(--cqh, 100vh) * 5 / 100), 26px); padding: 0 clamp(14px, 5cqh, 26px); font-size: clamp(12px, calc(var(--cqh, 100vh) * 3.6 / 100), 15px); font-size: clamp(12px, 3.6cqh, 15px); }
.cam-block.shake .cb-card { animation: shake .38s; }
body.no-cam .vf-hint, body.no-cam .zoom, body.no-cam .live-chip, body.no-cam .demo-badge { display: none; }
body.no-cam .shutter { opacity: .3; animation: none; }
body.no-cam .cam-info .rec { background: var(--yellow); box-shadow: 0 0 10px var(--yellow); }

/* ---------- filter sheet: what the strip will look like ---------- */
.result-prev { min-height: 0; display: flex; flex-direction: column; gap: 8px; }
.rp-label { font: 700 9.5px var(--mono); letter-spacing: .16em; color: rgba(255, 255, 255, .5); text-align: center; white-space: nowrap; }
.rp-box { position: relative; flex: 1; min-height: 0; cursor: pointer; }
.rp-box canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; display: block; filter: drop-shadow(0 10px 22px rgba(0, 0, 0, .6)); transition: opacity .2s; }
.rp-box.busy canvas { opacity: .55; }
.rp-btn {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 6px; border-radius: 14px;
  background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .15); transition: background .2s, border-color .2s;
}
.rp-btn span { font: 700 9px var(--mono); letter-spacing: .18em; color: rgba(255, 255, 255, .5); }
.rp-btn b { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 800 12px var(--display); color: var(--lime); }
.rp-btn i { font: 600 11px var(--ios); font-style: normal; color: rgba(255, 255, 255, .75); }
.rp-btn:hover { background: rgba(255, 255, 255, .16); border-color: var(--lime); }

/* ---------- all frames at once ---------- */
.fpk-card { width: min(1060px, calc(100vw - 32px)); height: min(840px, calc(100vh - 32px)); display: flex; flex-direction: column; overflow: hidden; }
.fpk-grid {
  flex: 1; min-height: 0; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(116px, 1fr));
  gap: 14px 12px; align-content: start; padding: 4px 4px 10px; scrollbar-width: thin; overscroll-behavior: contain;
}
.fpk-item {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 6px; border-radius: 16px; text-align: center;
  background: rgba(255, 255, 255, .05); border: 1.5px solid transparent; transition: background .2s, transform .25s var(--spring), border-color .2s;
}
.fpk-item canvas { display: block; width: 100%; height: clamp(120px, 20vh, 176px); object-fit: contain; margin-bottom: 4px; filter: drop-shadow(0 6px 14px rgba(0, 0, 0, .55)); }
.fpk-item b { font: 800 11.5px var(--display); letter-spacing: .02em; }
.fpk-item small { font: 400 11px / 1.25 var(--ios); color: rgba(255, 255, 255, .55); }
.fpk-item:hover { background: rgba(255, 255, 255, .1); transform: translateY(-3px); }
.fpk-item.on { background: rgba(198, 255, 26, .1); border-color: var(--lime); }
.fpk-item.on b { color: var(--lime); }
.fpk-item.on b::after { content: ' \2713'; }

/* ---------- result panel: fewer, clearer buttons ---------- */
.r-label { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.r-all { font: 700 11.5px var(--ios); letter-spacing: 0; color: var(--lime); padding: 2px 4px; border-radius: 6px; }
.r-all:hover { background: rgba(198, 255, 26, .12); }
.r-row.r-two .btn { height: auto; min-height: 50px; padding: 6px 8px; flex-direction: column; gap: 1px; white-space: normal; text-align: center; }
.r-two .btn span { font: 700 13px var(--ios); }
.r-two .btn small { font: 400 10.5px var(--ios); color: rgba(255, 255, 255, .55); }
.r-more { border-radius: 16px; background: rgba(255, 255, 255, .04); border: 1px solid rgba(255, 255, 255, .13); }
.r-more summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px; border-radius: 16px; }
.r-more summary::-webkit-details-marker { display: none; }
.r-more summary:hover { background: rgba(255, 255, 255, .06); }
.r-more summary span { font: 700 13.5px var(--ios); }
.r-more summary small { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 400 11px var(--ios); color: rgba(255, 255, 255, .5); }
.r-more summary i { font-style: normal; transition: transform .25s; }
.r-more[open] summary i { transform: rotate(180deg); }
.r-more-list { display: flex; flex-direction: column; gap: 6px; padding: 2px 8px 8px; }
.r-more-list .btn {
  height: auto; min-height: 44px; padding: 7px 12px; flex-direction: column; align-items: flex-start; justify-content: center; gap: 1px;
  white-space: normal; text-align: left;
}
.r-more-list .btn span { font: 800 12px var(--display); letter-spacing: .02em; }
.r-more-list .btn small { font: 400 11px / 1.3 var(--ios); color: rgba(255, 255, 255, .55); }
.r-more-list .btn:disabled { opacity: .45; cursor: default; }

/* ---------- toast with a button (e.g. "⬇ Download") ---------- */
.toast { display: flex; align-items: center; justify-content: center; gap: 12px; }
.toast.has-action { padding: 8px 8px 8px 18px; text-align: left; }
.toast.has-action.show { pointer-events: auto; }
.toast button { flex: none; height: 36px; padding: 0 14px; border-radius: 11px; background: var(--lime); color: #000; font: 800 13px var(--ios); white-space: nowrap; }
.toast button:hover { background: #d8ff5c; }

/* ---------- gallery: download hint + big preview ---------- */
.gal-note { margin-top: 8px; font: 400 13px / 1.4 var(--ios); color: rgba(255, 255, 255, .6); }
.gal-note b { color: #fff; }
.gal-img { cursor: zoom-in; transition: border-color .2s, background .2s; }
.gal-img::after {
  content: '\1F50D  Lihat'; position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); padding: 5px 11px; border-radius: 999px;
  background: rgba(0, 0, 0, .72); font: 700 11.5px var(--ios); white-space: nowrap; opacity: 0; transition: opacity .2s; pointer-events: none;
}
.gal-item:hover .gal-img { border-color: rgba(255, 255, 255, .3); background: rgba(255, 255, 255, .07); }
.gal-item:hover .gal-img::after { opacity: 1; }
a.btn { text-decoration: none; }
.gal-view {
  position: fixed; inset: 0; z-index: 5; display: grid; grid-template-columns: auto minmax(0, 1fr) auto 300px;
  align-items: center; gap: 18px; padding: 28px 36px;
}
.gv-bg { position: absolute; inset: 0; background: rgba(6, 6, 9, .95); }
.gv-stage { position: relative; min-width: 0; height: calc(100vh - 56px); display: flex; align-items: center; justify-content: center; }
.gv-stage img, .gv-stage video { display: block; max-width: 100%; max-height: 100%; border-radius: 6px; box-shadow: 0 40px 90px rgba(0, 0, 0, .8); }
.gv-stage video, .gal-view.motion .gv-stage img { display: none; }
.gal-view.motion .gv-stage video { display: block; }
.gv-nav {
  position: relative; width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; padding-bottom: 4px;
  background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .2); font: 900 28px / 1 var(--display); transition: background .2s, color .2s;
}
.gv-nav:hover:not(:disabled) { background: var(--lime); color: #000; }
.gv-nav:disabled { opacity: .2; }
.gv-panel {
  position: relative; display: flex; flex-direction: column; gap: 12px; padding: 22px; border-radius: 26px;
  background: rgba(22, 22, 26, .9); border: 1px solid rgba(255, 255, 255, .14);
}
.gv-panel .eyebrow { margin: 0; }
.gv-panel h3 { font: 800 22px / 1.1 var(--display); letter-spacing: -.01em; }
.gv-meta { margin-top: -6px; font: 400 13px / 1.4 var(--ios); color: rgba(255, 255, 255, .6); }
.gv-hint { margin-top: -4px; text-align: center; font: 400 12px var(--ios); color: rgba(255, 255, 255, .5); }
.gv-hint b { color: rgba(255, 255, 255, .8); }
.gv-del { height: 42px; color: #ff8a80; }
.gv-keys { font: 500 11.5px var(--ios); color: rgba(255, 255, 255, .45); }
.gv-close { position: absolute; top: 20px; right: 24px; }
@media (max-width: 900px) {
  .gal-view { grid-template-columns: auto minmax(0, 1fr) auto; grid-template-rows: minmax(0, 1fr) auto; padding: 16px; overflow-y: auto; }
  .gv-stage { height: 55vh; }
  .gv-panel { grid-column: 1 / -1; }
}

/* ---------- medium screens: compact toggles so the frame list keeps room ---------- */
@media (max-width: 1400px) {
  .dock { gap: 12px; }
  .seg span { min-width: 0; padding: 0 6px 0 6px; letter-spacing: .12em; }
  .seg button { min-width: 34px; padding: 0 8px; }
  .ar-btn { padding: 6px 12px 6px 10px; }
}

/* ---------- narrow screens for the new bits ---------- */
@media (max-width: 1080px) {
  .sheet-body { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-auto-rows: minmax(0, 1fr); overflow-y: auto; }
  .result-prev { grid-column: 1 / -1; min-height: 260px; }
  .ar-tools { margin-left: 0; }
}


/* ---------- 🎨 decorate the strip: stickers + doodles ---------- */
.r-deco { height: auto; min-height: 48px; margin: -6px 0 14px; padding: 6px 12px; flex-direction: column; gap: 1px; border-color: rgba(255, 61, 154, .55); }
.r-deco span { font: 800 13.5px var(--ios); }
.r-deco small { font: 400 11px var(--ios); color: rgba(255, 255, 255, .55); }
.r-deco:hover { border-color: var(--pink); background: rgba(255, 61, 154, .12); }
.deco { position: fixed; inset: 0; z-index: 56; display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 22px; padding: 22px 26px; }
.dc-bg { position: absolute; inset: 0; background: rgba(6, 6, 9, .95); }
.dc-stage { position: relative; min-width: 0; min-height: 0; display: grid; place-items: center; }
#dcCanvas { display: block; touch-action: none; cursor: crosshair; border-radius: 6px; box-shadow: 0 30px 80px rgba(0, 0, 0, .7); }
.deco[data-mode="sticker"] #dcCanvas { cursor: grab; }
.dc-panel {
  position: relative; align-self: center; max-height: calc(100vh - 44px); overflow-y: auto; scrollbar-width: thin;
  display: flex; flex-direction: column; gap: 12px; padding: 20px; border-radius: 26px;
  background: rgba(22, 22, 26, .92); border: 1px solid rgba(255, 255, 255, .14); animation: popIn .3s var(--spring);
}
.dc-panel .eyebrow { margin-bottom: 4px; }
.dc-panel h3 { font: 800 22px var(--display); letter-spacing: -.01em; }
.dc-panel h3 em { font: italic 400 1.2em var(--serif); color: var(--pink); }
.dc-tool { display: flex; flex-direction: column; gap: 10px; }
.dc-emo { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.dc-emo button {
  aspect-ratio: 1; display: grid; place-items: center; border-radius: 12px; background: rgba(255, 255, 255, .06);
  font: 24px / 1 "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif; transition: transform .2s var(--spring), background .2s;
}
.dc-emo button:hover { background: rgba(255, 255, 255, .14); transform: scale(1.08); }
.dc-lbls { display: flex; flex-wrap: wrap; gap: 7px; }
.dc-lbls button {
  padding: 6px 10px; border-radius: 999px; border: 2px solid #000; background: var(--c); color: #000;
  font: 900 10.5px var(--display); letter-spacing: .02em; box-shadow: 2px 2px 0 #000; transition: transform .2s var(--spring);
}
.dc-lbls button:hover { transform: rotate(-4deg) scale(1.06); }
.dc-hint { font: 400 12px / 1.45 var(--ios); color: rgba(255, 255, 255, .55); }
.dc-lbl { font: 700 10px var(--mono); letter-spacing: .2em; color: rgba(255, 255, 255, .5); }
.dc-colors { display: flex; flex-wrap: wrap; gap: 9px; }
.dc-colors button { width: 30px; height: 30px; border-radius: 50%; background: var(--c); border: 2px solid rgba(255, 255, 255, .3); transition: transform .2s var(--spring); }
.dc-colors button:hover { transform: scale(1.1); }
.dc-colors button.on { box-shadow: 0 0 0 3px #16161c, 0 0 0 5px #fff; }
.dc-sizes { width: 100%; }
.dc-sizes button { flex: 1; }
.dc-del { height: 40px; color: #ff8a80; }
.dc-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.dc-row .btn { height: 42px; }
.dc-foot { display: grid; grid-template-columns: 1fr 1.4fr; gap: 10px; margin-top: 2px; }
.dc-foot .btn { height: 48px; }
.dc-foot .btn.go { box-shadow: 4px 4px 0 var(--pink); }
@media (max-width: 900px) {
  .deco { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr) auto; padding: 12px; overflow-y: auto; }
  .dc-panel { max-height: none; }
}

/* operator hint: the tenant's auto-save folder needs its permission again (⋯ → Menu tenant) */
body.folder-warn #btnMore { position: relative; }
body.folder-warn #btnMore::before {
  content: ''; position: absolute; top: 2px; right: 2px; width: 11px; height: 11px; border-radius: 50%;
  background: var(--yellow); border: 2px solid #0b0b0f; animation: blink 1.2s steps(2) infinite;
}

/* =========================================================
   PHONES — portrait (camera-app layout) and landscape.
   Laptop and tablet layouts above stay as they are.
   ========================================================= */
@media (hover: none) {
  /* keyboard / hover helpers mean nothing on a touch screen */
  .vf-hint, .kbd-hint, .r-keys, .gv-keys, .frame-peek { display: none !important; }
  button, a, label, summary { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
}
@media (display-mode: standalone), (display-mode: fullscreen) {
  #btnFull { display: none; }
}
/* phones & tablets: live blur over a moving background repaints every frame and makes the
   camera stutter, so touch devices get a still background and solid "glass" instead */
@media (hover: none) and (pointer: coarse) {
  *, *::before, *::after { -webkit-backdrop-filter: none !important; backdrop-filter: none !important; }
  .blob, .stk-burst, .stk-holo, .marquee-track, .machine { animation: none; }
  .machine.is-printing { animation: buzz .1s linear infinite; }
  .grain { display: none; }
  body[data-phase="idle"] .shutter { animation: none; }
  .pill { background: rgba(38, 38, 46, .92); }
  .dock { background: rgba(24, 24, 30, .94); }
  .sheet { background: rgba(16, 16, 20, .97); }
  .glass { background: linear-gradient(180deg, rgba(255, 255, 255, .92), rgba(255, 255, 255, .74)); }
  .popover { background: rgba(255, 255, 255, .97); }
  .rail-l .r-btn, .zoom, .pips, .vf-cancel, .cam-msg, .live-chip { background-color: rgba(0, 0, 0, .6); }
  .reveal-bg { background: rgba(6, 6, 9, .94); }
  .gallery { background: rgba(6, 6, 9, .97); }
  .md-bg, .cf-bg, .ed-bg { background: rgba(6, 6, 9, .9); }
  body[data-phase="printing"] .machine-col, body[data-phase="done"] .machine-col { background: rgba(6, 6, 9, .94); }
}

/* ---------- shared by portrait + landscape phones ---------- */
@media (orientation: portrait) and (max-width: 1100px), (orientation: landscape) and (max-height: 540px) {
  body {
    height: calc(var(--vh, 1vh) * 100); height: 100dvh; overflow: hidden; display: flex; flex-direction: column;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  }
  .marquee, .cam-wrap, .stk, .hw, .island, .vf-hint, .kbd-hint, .r-keys, .gv-keys { display: none; }
  .modes, .shoot-hint { display: none !important; }
  .topbar { flex: none; height: 50px; gap: 10px; padding: 0 12px; }
  .logo-word { font-size: 19px; }
  .logo-star { font-size: 15px; }
  .logo-serif { font-size: 25px; }
  .top-actions { gap: 6px; }
  .pill { height: 36px; padding: 0 12px; font-size: 13px; }
  .pill.icon { width: 36px; }
  .ev-pill { max-width: 34vw; height: 28px; padding: 0 10px 0 8px; font-size: 10px; }

  /* no stacking context here: the full-screen sheet and printer must cover the top bar */
  .stage { flex: 1; min-height: 0; height: auto; z-index: auto; display: grid; gap: 10px; padding: 0 12px 12px; }
  .cam-col { display: contents; }
  .phone-wrap { grid-area: cam; min-height: 0; }
  .dock { grid-area: dock; }
  .machine-col { grid-area: mach; height: auto; padding: 0; }

  /* the camera without the phone mock-up: picture + shutter on one dark card, like a camera app */
  .phone { --r: 26px; --bz: 0px; width: 100%; aspect-ratio: auto; padding: 0; background: none; box-shadow: none; }
  .bezel { padding: 0; background: none; box-shadow: none; }
  .screen { background: rgba(0, 0, 0, .55); border: 1px solid rgba(255, 255, 255, .12); }
  /* quick toggles float over the top-left of the picture */
  .rail-l { position: absolute; z-index: 3; top: 10px; left: 10px; flex-direction: row; gap: 6px; transition: opacity .3s; }
  .rail-l .r-btn { width: 36px; background: rgba(0, 0, 0, .5); }
  body:not([data-phase="idle"]) .rail-l { opacity: 0; pointer-events: none; }
  .demo-badge { top: 54px; }

  /* dock: compact chips + toggles */
  .dock-label, .fc-nav, .fchip small, .fc-all small { display: none; }
  .fchip { gap: 7px; padding: 4px 10px 4px 4px; border-radius: 13px; }
  .fc-all { padding: 4px 9px; border-radius: 13px; }
  .dock-opts { grid-template-columns: 1fr 1fr; }
  .seg { min-width: 0; }
  .seg span { min-width: 0; padding: 0 4px 0 6px; font-size: 9px; letter-spacing: .1em; white-space: nowrap; }
  .seg button { flex: 1; min-width: 0; height: 32px; padding: 0 4px; white-space: nowrap; }
  .ar-btn { justify-content: center; padding: 7px 12px; }
  /* AR: title + SELESAI on one line, then the tabs, then "acak" + "lepas" side by side */
  .ar-top { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: center; gap: 8px; }
  .ar-title { grid-area: 1 / 1; }
  .ar-tabs { grid-column: 1 / -1; grid-row: 2; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
  .ar-tools { display: contents; }
  #arClose { grid-column: 1 / -1; grid-row: 1; justify-self: end; }
  .ar-tools .btn.ghost { grid-row: 3; height: auto; min-height: 34px; padding: 4px 8px; line-height: 1.15; white-space: normal; }

  /* the printer is a slim status bar while you shoot ... */
  .machine-col { position: sticky; bottom: 0; z-index: 7; }
  body:not([data-phase="printing"]):not([data-phase="done"]) .machine {
    flex: 1; flex-direction: row; align-items: center; gap: 10px; padding: 7px 8px 7px 10px; border-radius: 20px;
    box-shadow: 4px 4px 0 var(--ink), inset 0 2px 0 rgba(255, 255, 255, .9);
  }
  body:not([data-phase="printing"]):not([data-phase="done"]) .flapboard { flex: 1; min-width: 0; max-width: 420px; margin-right: auto; padding: 5px; border-radius: 10px; }
  body:not([data-phase="printing"]):not([data-phase="done"]) :is(.plate, .slot, .paper-out, .m-status, .m-sticker, #btnBack, .g-pill) { display: none; }
  body:not([data-phase="printing"]):not([data-phase="done"]) .glassbar { width: auto; flex: none; }
  body:not([data-phase="printing"]):not([data-phase="done"]) .g-round { width: 42px; height: 42px; }
  body:not([data-phase="printing"]):not([data-phase="done"]) .popover { right: 0; bottom: calc(100% + 12px); }
  .popover { width: min(310px, calc(100vw - 24px)); max-height: min(calc(var(--vh, 1vh) * 70), 560px); max-height: min(70dvh, 560px); overflow-y: auto; }

  /* ... and takes over the screen while it prints */
  body[data-phase="printing"] .machine-col, body[data-phase="done"] .machine-col {
    position: fixed; inset: 0; z-index: 35; display: grid; place-items: center;
    padding: calc(14px + env(safe-area-inset-top)) calc(14px + env(safe-area-inset-right)) calc(14px + env(safe-area-inset-bottom)) calc(14px + env(safe-area-inset-left));
    background: rgba(6, 6, 9, .8); backdrop-filter: blur(14px);
  }
  body[data-phase="printing"] .machine, body[data-phase="done"] .machine {
    flex: none; width: min(360px, 100%); height: min(680px, 100%); padding: 14px; border-radius: 28px;
  }
  body[data-phase="printing"] .m-sticker, body[data-phase="done"] .m-sticker { top: -12px; right: -8px; width: 64px; height: 64px; }

  /* filter sheet: full screen and solid (the camera behind it needs no blur) */
  .sheet {
    position: fixed; inset: 0; z-index: 30; grid-template-columns: minmax(0, 1fr); gap: 10px; border: 0; border-radius: 0; background: #101014;
    padding: calc(8px + env(safe-area-inset-top)) calc(14px + env(safe-area-inset-right)) calc(12px + env(safe-area-inset-bottom)) calc(14px + env(safe-area-inset-left));
  }
  body[data-phase="review"] .phone-wrap { filter: none; transform: none; }
  .sheet-head { align-items: center; gap: 10px; }
  .sheet-head > div:first-child { min-width: 0; }
  .sheet-head .eyebrow { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .sheet-tools { flex: none; }
  .sheet h2 { font-size: 19px; }
  .sheet-tools .pill { height: 34px; }
  .sheet-foot .btn, .caption { height: 46px; }
  /* no hover on a phone: the per-photo tools stay visible (the filter name is in the row below anyway) */
  .pv { container-type: inline-size; }
  .pv > span { display: none; }
  .pv-tools { bottom: 8px; gap: 4px; opacity: 1; transform: translate(-50%, 0); }
  .pv-tools button { padding: 6px 9px; font-size: 11.5px; }
  .pv-num { width: 22px; height: 22px; font-size: 11px; }

  /* result */
  .reveal-bg { position: fixed; background: #060609; }
  .r-close { position: fixed; top: calc(10px + env(safe-area-inset-top)); right: calc(12px + env(safe-area-inset-right)); z-index: 2; }
  .r-panel { padding: 18px; border-radius: 24px; }
  .r-frames .fchip { padding: 9px 12px; }
  .r-all { padding: 8px 6px; margin: -8px -6px; }

  /* gallery */
  .gallery { background: #060609; padding: calc(12px + env(safe-area-inset-top)) calc(14px + env(safe-area-inset-right)) calc(12px + env(safe-area-inset-bottom)) calc(14px + env(safe-area-inset-left)); }
  .gal-head { flex-wrap: wrap; align-items: flex-start; margin-bottom: 14px; }
  .gallery h2 { font-size: 26px; }
  .gal-tools { flex-wrap: wrap; }
  .gal-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 16px 12px; }
  .gal-img { height: 230px; padding: 8px; }
  .gal-img img, .gal-img video { max-height: 212px; }
  .gv-bg { background: #060609; }
  .gv-nav { width: 44px; height: 44px; font-size: 24px; }
  .gv-close { position: fixed; z-index: 3; top: calc(10px + env(safe-area-inset-top)); right: calc(12px + env(safe-area-inset-right)); }
  .gv-panel { gap: 10px; padding: 16px; border-radius: 22px; }
  .gv-panel h3 { font-size: 19px; }

  /* modals */
  .md-card { max-height: calc(calc(var(--vh, 1vh) * 100) - 24px); max-height: calc(100dvh - 24px); }
  .md-head h3 { font-size: 20px; }
  .ev-seg { width: 100%; }
  .intro-card { overflow-x: hidden; }
  .intro-foot { gap: 8px; }
  .intro-foot .btn.go { min-width: 0; padding: 0 18px; }
  .intro-hide { flex-wrap: wrap; }

  /* all frames: full screen, three or more per row */
  .fpk-card {
    width: 100vw; height: calc(var(--vh, 1vh) * 100); height: 100dvh; max-height: none; border: 0; border-radius: 0; background: #101014;
    padding: calc(12px + env(safe-area-inset-top)) calc(14px + env(safe-area-inset-right)) env(safe-area-inset-bottom) calc(14px + env(safe-area-inset-left));
  }
  .fpk-card .md-head { margin-bottom: 10px; }
  .fpk-grid { grid-template-columns: repeat(auto-fill, minmax(98px, 1fr)); gap: 10px 8px; padding: 2px 2px 16px; }
  .fpk-item { padding: 8px 4px; border-radius: 14px; }
  .fpk-item canvas { height: 128px; }
  .fpk-item b { font-size: 10.5px; }
  .fpk-item small { font-size: 10px; }

  /* photo editor: full screen */
  .ed-bg { background: #060609; }
  .ed-card {
    width: 100vw; height: calc(var(--vh, 1vh) * 100); height: 100dvh; overflow-y: auto; border: 0; border-radius: 0; background: #101014;
    padding: calc(12px + env(safe-area-inset-top)) calc(14px + env(safe-area-inset-right)) calc(12px + env(safe-area-inset-bottom)) calc(14px + env(safe-area-inset-left));
  }
  .ed-head h3 { font-size: 18px; }
  .ed-tools { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .ed-zoom { grid-column: 1 / -1; min-width: 0; }
  .ed-tools .btn { min-width: 0; padding: 0 8px; }
  .ed-tools .btn.go { grid-column: 1 / -1; }
  .ed-note { font-size: 11.5px; }

  /* decorate the strip: solid backdrop, compact panel */
  .dc-bg { background: #060609; }
  .deco { gap: 10px; overflow: hidden; padding: calc(10px + env(safe-area-inset-top)) calc(12px + env(safe-area-inset-right)) calc(10px + env(safe-area-inset-bottom)) calc(12px + env(safe-area-inset-left)); }
  .dc-panel { gap: 10px; padding: 14px; border-radius: 22px; overscroll-behavior: contain; }
  .dc-panel h3 { font-size: 19px; }
  .dc-hint { font-size: 11.5px; }
  .dc-row .btn { height: 40px; }
  .dc-foot .btn { height: 46px; }

  .toast { bottom: calc(14px + env(safe-area-inset-bottom)); width: max-content; max-width: calc(100vw - 24px); }
  /* iPhone zooms the whole page into any input under 16px when it is tapped */
  .caption input, .ev-field input:not([type="color"]), .pop-row select { font-size: 16px; }
}
/* small photo cells (6 photos, landscape): the tools keep their icons only */
@container (max-width: 150px) {
  .pv-tools em { display: none; }
  .pv-tools button { padding: 5px 9px; }
}
@supports not (container-type: inline-size) {
  @media (orientation: landscape) and (max-height: 540px) {
    .pv-tools em { display: none; }
    .pv-tools button { padding: 7px 10px; }
  }
}
/* most phones (≤420px): a slightly smaller logo so the top bar fits */
@media (max-width: 420px) {
  .topbar { gap: 8px; padding: 0 10px; }
  .logo-word { font-size: 17px; }
  .logo-serif { font-size: 23px; }
  .top-actions { gap: 5px; }
  .pill { padding: 0 10px; }
}
/* very narrow phones (360px Android): the gallery button keeps its icon + count, drops the word */
@media (max-width: 380px) {
  #btnGallery { font-size: 0; gap: 6px; padding: 0 10px; }
  .logo-serif { font-size: 22px; }
}

/* ---------- portrait phone: viewfinder on top, shutter below, like a camera app ---------- */
@media (orientation: portrait) and (max-width: 1100px) {
  /* rows never shrink below their content (short phones scroll instead of overlapping);
     on tall phones the camera card takes the spare room and the shutter sits in the middle of it */
  .stage {
    grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(max-content, 1fr) max-content max-content;
    grid-template-areas: "cam" "dock" "mach"; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none;
  }
  .stage::-webkit-scrollbar { display: none; }
  #btnFull { display: none; }
  .phone-wrap { container-type: normal; display: flex; flex-direction: column; height: auto; }
  .phone { flex: 1; display: flex; flex-direction: column; }
  .bezel { flex: 1; height: auto; display: flex; flex-direction: column; }
  .screen { flex: 1; height: auto; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .viewfinder { grid-row: 1; width: 100%; height: auto; border-radius: 25px 25px 16px 16px; }

  .rail-r { grid-row: 2; flex-direction: row; padding: 12px 20px 14px; }
  .shoot-col { flex: 1; flex-direction: row-reverse; justify-content: space-between; align-items: center; padding: 0; }
  .shutter { width: 74px; border-width: 4px; padding: 4px; }
  .last-thumb { width: 48px; border-radius: 12px; }
  #btnFlip { width: 46px; }

  .dock { flex-wrap: wrap; gap: 8px; padding: 8px; border-radius: 20px; }
  .dock-frames { flex: 1 1 100%; gap: 6px; }
  .fchip canvas { height: 40px; }
  .dock-opts { flex: 1 1 100%; }
  .ar-btn { flex: 1 1 100%; }
  .ar-panel { flex: 1 1 100%; }

  /* filter sheet: photos, then a scrolling row of filters, then the strip */
  .sheet-body { display: flex; flex-direction: column; gap: 12px; overflow-y: auto; min-height: 0; }
  .preview-wrap { container-type: normal; display: block; flex: none; }
  .preview, .preview.six { width: 100%; }
  .pv.empty small { display: none; }
  .fgrid {
    flex: none; grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: 78px;
    overflow-x: auto; overflow-y: hidden; align-content: start; padding: 4px 2px 6px;
  }
  /* the strip next to its "ganti frame" button */
  .result-prev { flex: none; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: auto 240px; gap: 8px 12px; align-items: center; }
  .rp-label { grid-column: 1 / -1; }
  .rp-box { height: 100%; }
  .rp-btn { padding: 14px 8px; }
  .sheet-foot { flex-wrap: wrap; gap: 8px; }
  .caption { flex: 1 1 100%; }
  #btnRetake { flex: 1; }
  #btnPrint { flex: 1.4; }

  /* result: strip on top, actions below, the whole thing scrolls */
  .reveal { place-items: start center; overflow-y: auto; }
  .reveal-body {
    flex-direction: column; gap: 16px; max-width: 100vw;
    padding: calc(56px + env(safe-area-inset-top)) 16px calc(24px + env(safe-area-inset-bottom));
  }
  .tilt img { max-height: calc(var(--vh, 1vh) * 48); max-height: 48dvh; max-width: 84vw; }
  .r-panel { width: min(440px, 100%); max-height: none; overflow: visible; }

  /* one print, big: picture with the arrows over its edges, details below */
  .gal-view {
    grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(220px, 1fr) auto; gap: 14px; overflow-y: auto;
    padding: calc(62px + env(safe-area-inset-top)) calc(14px + env(safe-area-inset-right)) calc(14px + env(safe-area-inset-bottom)) calc(14px + env(safe-area-inset-left));
  }
  .gv-stage { grid-area: 1 / 1; height: 100%; min-height: 0; padding: 0 30px; }
  .gv-nav { grid-area: 1 / 1; z-index: 2; background: rgba(30, 30, 36, .9); }
  .gv-nav.prev { justify-self: start; }
  .gv-nav.next { justify-self: end; }
  .gv-panel { grid-area: 2 / 1; }

  /* decorate: the strip on top, tools in a compact panel below; stickers scroll sideways */
  .deco { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; }
  .dc-panel { align-self: stretch; max-height: calc(var(--vh, 1vh) * 56); max-height: 56dvh; }
  .dc-panel header { display: none; }
  .dc-emo { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; overscroll-behavior-x: contain; }
  .dc-emo button { flex: none; width: 46px; height: 46px; font-size: 24px; }
  .dc-lbls { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding: 0 3px 3px 0; overscroll-behavior-x: contain; }
  .dc-lbls button { flex: none; }
  .dc-colors { gap: 8px; }
}
/* shorter portrait phones (iPhone SE, 16:9 Androids): tighter camera card and dock so the printer bar fits */
@media (orientation: portrait) and (max-width: 1100px) and (max-height: 700px) {
  .topbar { height: 46px; }
  .stage { gap: 8px; padding-bottom: 8px; }
  .rail-r { padding: 8px 20px 10px; }
  .shutter { width: 64px; }
  .last-thumb { width: 42px; }
  #btnFlip { width: 42px; }
  .dock { gap: 6px; padding: 6px; }
  .fchip canvas { height: 32px; }
  .fc-all svg { width: 15px; height: 15px; }
  .seg button { height: 30px; }
  .ar-btn { padding: 4px 12px; }
  .ar-btn i { font-size: 22px; }
}

/* ---------- landscape phone: the picture fills the height, controls in a side panel ---------- */
@media (orientation: landscape) and (max-height: 540px) {
  .topbar { height: 42px; }
  .stage {
    grid-template-columns: minmax(0, 1fr) clamp(220px, 32vw, 330px); grid-template-rows: minmax(0, 1fr) auto;
    grid-template-areas: "cam dock" "cam mach"; gap: 8px 12px; padding: 0 12px 10px;
  }
  /* camera card: 4:3 picture as big as the cell allows, shutter column on its right */
  .phone-wrap { height: auto; container-type: size; display: grid; place-items: center; }
  .phone { width: auto; }
  .screen { grid-template-columns: auto 78px; grid-template-rows: auto; }
  .viewfinder { height: min(var(--pw-h, 100vh) - 2px, (var(--pw-w, 100vw) - 80px) * .75); height: min(100cqh - 2px, (100cqw - 80px) * .75); border-radius: 25px 14px 14px 25px; }
  .rail-r { padding: 0 6px; }
  .shoot-col { padding: 12px 0; }
  .shutter { width: clamp(54px, calc(var(--cqh, 100vh) * 19 / 100), 66px); width: clamp(54px, 19cqh, 66px); }
  #btnFlip { width: 40px; }
  .last-thumb { width: 42px; }

  .dock { flex-direction: column; align-items: stretch; gap: 8px; padding: 8px; border-radius: 18px; min-height: 0; overflow-y: auto; scrollbar-width: none; }
  .dock-frames { flex: none; gap: 6px; }
  .fchip canvas { height: 34px; }
  /* the side panel is narrow: FOTO and TIMER get a row each so their buttons stay finger-sized */
  .dock-opts { grid-template-columns: minmax(0, 1fr); }
  .ar-btn { align-self: stretch; }
  /* the AR panel keeps its height; the side panel scrolls instead of squashing the items */
  .ar-panel, .ar-items { flex: none; }
  .ar-title small { display: none; }

  /* filter sheet: photos | filters | strip side by side, each scrolls on its own */
  .grabber { display: none; }
  .sheet { grid-template-rows: auto minmax(0, 1fr) auto; gap: 8px; }
  .sheet-head .eyebrow { margin-bottom: 3px; }
  .sheet h2 { font-size: 17px; }
  .sheet-body { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 112px; grid-template-rows: minmax(0, 1fr); grid-auto-rows: auto; overflow: hidden; gap: 12px; }
  .fgrid { align-content: start; }
  .result-prev { grid-column: auto; min-height: 0; }
  .rp-btn { padding: 6px; }
  .sheet-foot .btn, .caption { height: 42px; }
  .pv-tools button { padding: 7px 8px; font-size: 11px; }

  /* gallery: a slimmer header so a whole print + its buttons fit */
  .gal-head { margin-bottom: 8px; }
  .gallery .eyebrow { margin-bottom: 2px; }
  .gallery h2 { font-size: 21px; }
  .gal-note { margin-top: 4px; font-size: 12px; }
  .gal-img { height: 190px; }
  .gal-img img, .gal-img video { max-height: 172px; }

  body[data-phase="printing"] .plate, body[data-phase="done"] .plate { display: none; }
  /* a slimmer printer: smaller flap tiles leave more height for the strip */
  body[data-phase="printing"] .machine, body[data-phase="done"] .machine { width: min(300px, 100%); padding: 10px; }
  body[data-phase="printing"] .m-status, body[data-phase="done"] .m-status { margin: 6px 0; }

  .reveal-body { align-items: flex-start; gap: 16px; max-width: 100vw; padding: 12px 56px 12px 12px; }
  .tilt img { max-height: calc(calc(var(--vh, 1vh) * 100) - 24px); max-height: calc(100dvh - 24px); max-width: 38vw; }
  .r-panel { width: min(360px, 52vw); max-height: calc(calc(var(--vh, 1vh) * 100) - 24px); max-height: calc(100dvh - 24px); overflow-y: auto; }

  /* one print, big: picture in the middle, details on the right */
  .gal-view {
    grid-template-columns: auto minmax(0, 1fr) auto minmax(220px, 280px); grid-template-rows: minmax(0, 1fr); gap: 10px; overflow: hidden;
    padding: calc(10px + env(safe-area-inset-top)) calc(12px + env(safe-area-inset-right)) calc(10px + env(safe-area-inset-bottom)) calc(12px + env(safe-area-inset-left));
  }
  .gv-stage { height: calc(calc(var(--vh, 1vh) * 100) - 20px); height: calc(100dvh - 20px); }
  .gv-panel { grid-column: auto; max-height: calc(calc(var(--vh, 1vh) * 100) - 20px); max-height: calc(100dvh - 20px); overflow-y: auto; gap: 8px; padding: 14px; }
  .gv-panel .eyebrow { margin-right: 44px; }
  .gv-panel .btn.go { height: 46px; font-size: 15px; }
  .gv-close { top: calc(16px + env(safe-area-inset-top)); right: calc(20px + env(safe-area-inset-right)); width: 34px; height: 34px; }

  /* photo editor: picture on the left, tools on the right */
  .ed-card { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-rows: auto auto minmax(0, 1fr); column-gap: 16px; align-content: center; }
  .ed-stage { grid-column: 1; grid-row: 1 / -1; align-self: center; width: min(58vw, (calc(var(--vh, 1vh) * 100) - 24px) * 4 / 3); width: min(58vw, (100dvh - 24px) * 4 / 3); }
  .ed-head, .ed-tools, .ed-note { grid-column: 2; }
  .ed-head { margin-bottom: 10px; }
  .ed-tools { margin-top: 0; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ed-tools .btn { height: 40px; }
  #edRetake { grid-column: 1 / -1; }
  .ed-note { align-self: end; }

  /* decorate: the strip on the left, tools on the right */
  .deco { grid-template-columns: minmax(0, 1fr) minmax(250px, 300px); grid-template-rows: minmax(0, 1fr); }
  .dc-panel { align-self: stretch; max-height: none; min-height: 0; }
  .dc-panel header { display: none; }
  .dc-emo { grid-template-columns: repeat(6, 1fr); }
  .dc-emo button { font-size: 21px; border-radius: 10px; }

  /* how-to: picture beside the text */
  .intro-card { width: min(660px, calc(100vw - 32px)); }
  .intro-step.on { display: grid; grid-template-columns: minmax(0, 38%) minmax(0, 1fr); grid-template-rows: auto auto 1fr; column-gap: 18px; align-items: start; }
  .intro-step .ia { grid-row: 1 / -1; height: 100%; min-height: 150px; }
  .intro-step .eyebrow { margin-top: 4px; }
  .intro-step h3 { font-size: 21px; }
  .intro-step > p:not(.eyebrow) { min-height: 0; font-size: 13.5px; }
  .ia-emo { font-size: 58px; }
  .ia-tag { padding: 4px 8px; font-size: 10px; }

  /* PIN: title on the left, keypad on the right */
  .pin-card { width: min(520px, calc(100vw - 32px)); display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto auto auto 1fr; column-gap: 20px; align-content: center; }
  .pin-card > :not(.pin-pad) { grid-column: 1; }
  .pin-pad { grid-column: 2; grid-row: 1 / -1; grid-template-columns: repeat(3, 56px); gap: 8px 14px; }
  .pin-pad button { width: 56px; height: 56px; font-size: 22px; }

  .fpk-item canvas { height: 112px; }
}


/* ---------- landscape tablets / small displays (iPad Mini 1024×768, Nest Hub 1024×600):
   keep the laptop layout side by side instead of the stacked narrow-window layout ---------- */
@media (orientation: landscape) and (max-width: 1080px) and (min-height: 541px) {
  body { height: calc(var(--vh, 1vh) * 100); height: 100dvh; overflow: hidden; display: flex; flex-direction: column; }
  .topbar, .marquee { flex: none; }
  .stage { flex: 1; min-height: 0; height: auto; grid-template-columns: minmax(0, 1fr) clamp(230px, 26vw, 300px); gap: 18px; padding: 4px 18px 14px; }
  .phone-wrap { flex: 1; height: auto; min-height: 0; }
  .machine-col { height: auto; }
  .dock { gap: 10px; padding: 8px; }
  .dock-label, .fchip small, .fc-all small { display: none; }
  .fchip canvas { height: 38px; }
  .ar-btn small { display: none; }
}
