@font-face {
  font-family: "Zalando Sans Expanded";
  src: url("/fonts/zalando-sans-expanded-semibold.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Lora";
  src: url("/fonts/lora.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

/* Palet theheirloom.id: arang, perunggu, gading. Booth berdiri di lobi yang hangat dan
   redup, jadi layar gelap dan sampul gading yang terang jadi satu-satunya titik fokus. */
:root {
  --bg: oklch(0.244 0.006 1); /* #231f20 */
  --bar: oklch(0.213 0.005 355);
  --surface: oklch(0.279 0.008 4);
  --surface-hover: oklch(0.315 0.009 8);
  --ivory: oklch(0.971 0.02 65); /* #fff3e8 */
  --text-2: oklch(0.8 0.018 62);
  --text-3: oklch(0.64 0.016 58);
  --bronze: oklch(0.622 0.066 52); /* #a77c62 */
  --bronze-light: oklch(0.758 0.052 59); /* #caa990, untuk teks kecil di atas arang */
  --brown: oklch(0.543 0.057 55); /* #8a6750, teks perunggu di atas gading */
  --ink-on-ivory: oklch(0.36 0.012 20);
  --line: oklch(0.971 0.02 65 / 0.13);
  --line-strong: oklch(0.971 0.02 65 / 0.28);
  --rec: oklch(0.7 0.15 30);

  --display: "Zalando Sans Expanded", "Helvetica Neue", Arial, sans-serif;
  --serif: "Lora", Georgia, "Times New Roman", serif;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --bar-h: 64px;
  --pad-x: clamp(16px, 4vw, 64px);
  --pad-y: clamp(16px, 3.2vh, 40px);
  --panel-w: 400px;
  --gap: clamp(40px, 6vw, 104px);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  min-height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr;
  background: var(--bg);
  color: var(--ivory);
  font: 400 16px/1.55 var(--serif);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

button,
input,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: default;
}

:focus-visible {
  outline: 2px solid var(--bronze-light);
  outline-offset: 3px;
}

svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

#announcer {
  position: fixed;
  top: 0;
  left: 0;
}

/* ---------- Bilah atas ---------- */

.topbar {
  height: var(--bar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 0 var(--pad-x);
  padding-top: env(safe-area-inset-top);
  box-sizing: content-box;
  background: var(--bar);
  border-bottom: 1px solid var(--line);
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 20px;
  min-width: 0;
}

.topbar-logo {
  display: block;
  height: 26px;
  width: auto;
}

.topbar-label {
  padding-left: 20px;
  border-left: 1px solid var(--line-strong);
  font: 600 10px/1.6 var(--display);
  letter-spacing: 0.26em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--text-2);
}

/* Alat panitia, gaya navigasi theheirloom.id */
.topbar-tools {
  display: flex;
  align-items: center;
  gap: 4px 28px;
}

.tool {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 10px 0;
  border: 0;
  background: none;
  font: 600 10px/1 var(--display);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  white-space: nowrap;
  text-decoration: none;
  color: var(--text-2);
  transition: color 0.2s var(--ease-out), opacity 0.2s var(--ease-out);
}

.tool svg {
  width: 17px;
  height: 17px;
}

.tool:not(:disabled):hover {
  color: var(--ivory);
}

.tool:disabled {
  opacity: 0.35;
}

[data-device="guest"] [data-kiosk-only] {
  display: none !important;
}

/* ---------- Tata letak ---------- */

.booth {
  display: grid;
  grid-template-columns: auto minmax(300px, var(--panel-w));
  align-items: center;
  justify-content: center;
  column-gap: var(--gap);
  padding: var(--pad-y) var(--pad-x);
  padding-bottom: max(var(--pad-y), env(safe-area-inset-bottom));
}

.stage {
  display: grid;
  place-items: center;
}

.cover {
  --h: min(
    calc(100dvh - var(--bar-h) - 1px - var(--pad-y) * 2),
    1200px,
    calc((100vw - var(--panel-w) - 2 * var(--pad-x) - var(--gap)) * 1.5)
  );
  position: relative;
  height: var(--h);
  aspect-ratio: 2 / 3;
  overflow: hidden;
  background: var(--ivory);
  container-type: inline-size;
  border-radius: 2px;
  box-shadow:
    0 1px 2px oklch(0.1 0.01 20 / 0.4),
    0 18px 40px -18px oklch(0.1 0.01 20 / 0.6),
    0 60px 120px -40px oklch(0.1 0.01 20 / 0.75);
}

/* Lapisan sampul, bawah ke atas: video | latar kamera (kanvas) | logo | orang | tulisan | hasil */
.cover video,
.cover .bg,
.cover .layer,
.cover .person,
.cover .still {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.cover .layer,
.cover .person,
.cover .bg {
  pointer-events: none;
  user-select: none;
}

/* Geser kiri/kanan di sampul = ganti bingkai; gulir tegak tetap milik peramban */
.cover {
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
}

/* Nama bingkai yang muncul sekilas saat berganti */
.cover-toast {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 6%;
  margin: 0;
  text-align: center;
  font: 600 clamp(9px, 2.6cqw, 12px) / 1 var(--display);
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--ivory);
  text-shadow: 0 1px 10px oklch(0.15 0.01 20 / 0.8);
  opacity: 0;
  pointer-events: none;
}

.cover-toast.is-on {
  animation: toast 1.8s var(--ease-out);
}

@keyframes toast {
  0% { opacity: 0; transform: translateY(6px); }
  15%, 70% { opacity: 1; transform: none; }
  100% { opacity: 0; }
}

/* Sebelum pemisah siap (atau bila gagal): video polos, logo & tulisan di atasnya.
   Setelah siap: latar dan orang digambar ke kanvas dari bingkai yang sama. */
.cover:not([data-seg="on"]) :is(.bg, .person) {
  display: none;
}

.cover[data-seg="on"] video {
  opacity: 0;
}

.cover video {
  object-fit: cover;
  background: var(--ivory);
  transition: opacity 0.3s var(--ease-out);
}

.cover.is-mirrored video {
  transform: scaleX(-1);
}

.cover .still {
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.5s var(--ease-out) 0.08s, visibility 0s 0.6s;
}

.booth:is([data-state="review"], [data-state="sending"], [data-state="done"]) .still {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.5s var(--ease-out) 0.08s, visibility 0s;
}

.booth:is([data-state="review"], [data-state="sending"], [data-state="done"]) :is(video, .bg, .layer, .person) {
  opacity: 0;
}

/* Pesan di tengah sampul: memuat, izin ditolak, tanpa kamera */
.cover-note {
  position: absolute;
  left: 50%;
  top: 50%;
  translate: -50% -50%;
  width: 56%;
  text-align: center;
  display: grid;
  justify-items: center;
  gap: 0.7em;
  font-size: clamp(13px, 3.1cqw, 16px);
  transition: opacity 0.25s var(--ease-out);
}

.booth:not([data-state="boot"], [data-state="camera-error"]) .cover-note {
  opacity: 0;
  pointer-events: none;
}

/* Selama kamera belum menyala, tulisan frame disembunyikan supaya pesan di tengah terbaca */
.booth:is([data-state="boot"], [data-state="camera-error"]) .cover .layer {
  opacity: 0;
}

.cover-note p {
  margin: 0;
}

.cover-note-title {
  font: 600 clamp(12px, 3.3cqw, 16px) / 1.3 var(--display);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--brown);
}

.cover-note-body {
  color: var(--ink-on-ivory);
  line-height: 1.5;
  text-wrap: pretty;
}

.cover-note-body code {
  font: 600 0.82em var(--display);
  letter-spacing: 0.02em;
  background: oklch(0.244 0.006 1 / 0.07);
  padding: 0.1em 0.4em;
  border-radius: 2px;
}

.booth[data-state="boot"] .cover-note-title::after {
  content: "";
  display: block;
  width: 48px;
  height: 2px;
  margin: 16px auto 0;
  background: var(--bronze);
  transform-origin: left;
  animation: loading 1.4s var(--ease-out) infinite;
}

@keyframes loading {
  0% { transform: scaleX(0); opacity: 1; }
  70% { transform: scaleX(1); opacity: 1; }
  100% { transform: scaleX(1); opacity: 0; }
}

/* Hitungan mundur: besar untuk dibaca dari jarak kios, tapi sedikit di bawah tengah
   supaya wajah (sepertiga atas sampul) tetap terlihat saat berpose. */
.countdown {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding-top: 18%;
  pointer-events: none;
}

.countdown span {
  grid-area: 1 / 1;
  font: 600 40cqw / 1 var(--display);
  color: var(--ivory);
  text-shadow: 0 0.03em 0.2em oklch(0.15 0.01 20 / 0.5);
  animation: tick 1s var(--ease-out) forwards;
}

@keyframes tick {
  0% { opacity: 0; transform: scale(1.18); }
  22% { opacity: 1; transform: scale(1); }
  78% { opacity: 1; transform: scale(0.985); }
  100% { opacity: 0; transform: scale(0.94); }
}

.flash {
  position: absolute;
  inset: 0;
  background: var(--ivory);
  opacity: 0;
  pointer-events: none;
}

.flash.is-on {
  animation: flash 0.7s var(--ease-out);
}

@keyframes flash {
  0% { opacity: 1; }
  100% { opacity: 0; }
}

/* ---------- Panel ---------- */

/* Panel setinggi sampul dan rata atas: judul tidak melompat antar-layar.
   Supported by selalu di dasar panel. */
.panel {
  align-self: stretch;
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding-top: clamp(0px, 3vh, 40px);
}

.view {
  display: grid;
  align-content: start;
}

.view:not([hidden]) {
  animation: view-in 0.35s var(--ease-out);
}

/* Saat hitung mundur, semua mata ke sampul */
.booth[data-state="countdown"] .view[data-view="live"] > :not(.shutter-row),
.booth[data-state="countdown"] .credit {
  opacity: 0.3;
  transition: opacity 0.3s var(--ease-out);
}

@keyframes view-in {
  from { opacity: 0; transform: translateY(6px); }
}

.title {
  margin: 0;
  font: 600 30px/1.22 var(--display);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  text-wrap: balance;
  outline: none;
}

.title em {
  font-style: normal;
  color: var(--bronze-light);
}

/* Garis perunggu pendek di bawah judul, seperti di theheirloom.id */
.title::after {
  content: "";
  display: block;
  width: 48px;
  height: 2px;
  margin-top: 20px;
  background: var(--bronze);
}

.lede {
  margin: 20px 0 0;
  max-width: 36ch;
  color: var(--text-2);
  font-size: 16px;
  line-height: 1.65;
  text-wrap: pretty;
}

.label {
  font: 600 10.5px/1 var(--display);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ivory);
}

.hint {
  margin: 12px 0 0;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-2);
}

/* Pilihan bingkai */
.picker {
  margin: 26px 0 0;
  padding: 0;
  border: 0;
  min-width: 0;
}

.lede + .picker {
  margin-top: 36px;
}

.picker-head {
  float: left;
  width: 100%;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 0;
  margin-bottom: 14px;
}

.picker-head + * {
  clear: both;
}

.picker-value {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  color: var(--text-2);
}

/* Miniatur sampul berjajar seperti majalah di rak */
.frames {
  display: flex;
  gap: 14px;
  padding: 5px;
  margin: -5px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}

.frame-opt {
  position: relative;
  flex: none;
  width: 60px;
  aspect-ratio: 2 / 3;
  scroll-snap-align: start;
}

.frame-opt input {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.frame-opt img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 1px;
  outline: 1px solid var(--line);
  outline-offset: 0;
  opacity: 0.72;
  transition: opacity 0.2s var(--ease-out), outline-color 0.2s var(--ease-out), outline-offset 0.2s var(--ease-out);
}

.frame-opt:hover img {
  opacity: 1;
}

.frame-opt input:checked + img {
  opacity: 1;
  outline: 1.5px solid var(--ivory);
  outline-offset: 3px;
}

.frame-opt input:focus-visible + img {
  outline: 2px solid var(--bronze-light);
  outline-offset: 3px;
}

.frame-opt input:disabled,
.frame-opt input:disabled + img {
  cursor: default;
}

.frame-opt input:disabled:not(:checked) + img {
  opacity: 0.35;
}

/* Tombol rana */
.shutter-row {
  display: flex;
  align-items: center;
  gap: 22px;
  margin-top: 34px;
}

.shutter {
  width: 88px;
  height: 88px;
  flex: none;
  padding: 7px;
  border-radius: 50%;
  border: 1.5px solid var(--ivory);
  background: transparent;
  transition: border-color 0.2s var(--ease-out), opacity 0.2s var(--ease-out);
}

.shutter span {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--ivory);
  transition: transform 0.25s var(--ease-out), background 0.2s var(--ease-out), border-radius 0.25s var(--ease-out);
}

.shutter:not(:disabled):hover span {
  background: var(--bronze-light);
  transform: scale(0.95);
}

.shutter:not(:disabled):active span {
  transform: scale(0.86);
}

.shutter:disabled {
  opacity: 0.3;
}

.booth[data-state="countdown"] .shutter {
  opacity: 1;
  border-color: var(--bronze);
}

.booth[data-state="countdown"] .shutter span {
  background: var(--bronze);
  transform: scale(0.4);
  border-radius: 3px;
}

.booth[data-state="countdown"] .shutter:hover span {
  transform: scale(0.46);
}

/* Ganti kamera di samping rana: hanya tata letak HP (layar lebar memakainya di bilah atas) */
.flip {
  display: none;
  place-items: center;
  width: 48px;
  height: 48px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--ivory);
  transition: background 0.2s var(--ease-out), opacity 0.2s var(--ease-out);
}

.flip svg {
  width: 21px;
  height: 21px;
}

.flip:not(:disabled):active {
  background: var(--surface-hover);
}

.flip:disabled {
  opacity: 0.35;
}

.shutter-text {
  display: grid;
  gap: 8px;
  justify-items: start;
}

.shutter-label {
  font: 600 13px/1.2 var(--display);
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.shutter-sub {
  font-size: 14px;
  color: var(--text-2);
}

kbd {
  font: 600 9.5px/1 var(--display);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 4px 6px 3px;
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: 3px;
  color: var(--ivory);
  vertical-align: 1px;
}

@media (hover: none) {
  .shutter-sub { display: none; }
}

.link {
  padding: 4px 0;
  border: 0;
  background: none;
  font-size: 15px;
  color: var(--ivory);
  text-decoration: underline;
  text-underline-offset: 5px;
  text-decoration-color: var(--line-strong);
}

.link:hover {
  text-decoration-color: currentColor;
}

/* Supported by Bukujanji, di dasar panel */
.credit {
  margin-top: auto;
  padding-top: 28px;
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font: 600 9px/1 var(--display);
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--text-3);
  text-decoration: none;
  transition: color 0.2s var(--ease-out);
}

.credit img {
  display: block;
  height: 17px;
  width: auto;
}

a.credit:hover {
  color: var(--text-2);
}

/* ---------- Formulir tinjau ---------- */

.field {
  margin-top: 28px;
}

.view .lede + .field {
  margin-top: 36px;
}

.field-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 12px;
}

.count {
  font-size: 13px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

textarea {
  display: block;
  width: 100%;
  min-height: 96px;
  resize: vertical;
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 0;
  background: var(--surface);
  font-size: 16px;
  line-height: 1.5;
  transition: border-color 0.2s var(--ease-out), box-shadow 0.2s var(--ease-out);
}

textarea::placeholder {
  color: var(--text-3);
}

textarea:hover {
  border-color: oklch(0.971 0.02 65 / 0.42);
}

textarea:focus {
  outline: none;
  border-color: var(--bronze-light);
  box-shadow: 0 0 0 3px oklch(0.622 0.066 52 / 0.3);
}

textarea:disabled {
  opacity: 0.6;
}

/* Pesan suara */
.voice {
  min-height: 56px;
}

.voice > * {
  display: none;
}

.voice[data-voice="idle"] .voice-start,
.voice[data-voice="pending"] .voice-start,
.voice[data-voice="unsupported"] .voice-unsupported {
  display: flex;
}

.voice[data-voice="recording"] .voice-rec,
.voice[data-voice="ready"] .voice-ready {
  display: flex;
}

.voice-start {
  width: 100%;
  height: 56px;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  border: 1px dashed var(--line-strong);
  background: transparent;
  font-size: 15px;
  text-align: left;
  transition: border-color 0.2s var(--ease-out), background 0.2s var(--ease-out);
}

.voice-start svg {
  color: var(--bronze-light);
  width: 20px;
  height: 20px;
}

.voice-start:disabled {
  color: var(--text-2);
}

.voice-start:not(:disabled):hover {
  border-style: solid;
  border-color: oklch(0.971 0.02 65 / 0.42);
  background: var(--surface);
}

.voice-rec,
.voice-ready {
  height: 56px;
  align-items: center;
  gap: 12px;
  padding: 0 8px 0 14px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
}

.voice-ready {
  padding-left: 8px;
}

.voice-rec {
  border-color: oklch(0.7 0.15 30 / 0.55);
}

.rec-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--rec);
  flex: none;
  animation: pulse 1.2s ease-in-out infinite;
}

@keyframes pulse {
  50% { opacity: 0.25; }
}

.rec-label {
  font: 600 10px/1 var(--display);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--rec);
}

.wave {
  flex: 1;
  min-width: 0;
  height: 30px;
}

.time {
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  color: var(--text-2);
  min-width: 2.6em;
  text-align: right;
}

.round {
  width: 40px;
  height: 40px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 0;
  background: transparent;
  color: var(--text-2);
  transition: background 0.2s var(--ease-out), color 0.2s var(--ease-out);
}

.round:hover {
  background: var(--surface-hover);
  color: var(--ivory);
}

.round-ink {
  background: var(--ivory);
  color: var(--bg);
}

.round-ink:hover {
  background: var(--bronze-light);
  color: var(--bg);
}

.round-ink svg {
  fill: currentColor;
  stroke: none;
}

.round:disabled {
  opacity: 0.5;
}

#voicePlay .i-pause,
#voicePlay.is-playing .i-play {
  display: none;
}

#voicePlay.is-playing .i-pause {
  display: block;
}

.voice-unsupported {
  margin: 0;
  font-size: 14px;
  color: var(--text-2);
}

/* Persetujuan tampil di layar lobi: kotak centang bawaan, warna tema */
.consent {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-top: 24px;
  font-size: 15px;
  line-height: 1.45;
  color: var(--text-2);
  cursor: pointer;
}

.consent input {
  flex: none;
  width: 20px;
  height: 20px;
  margin: 1px 0 0;
  accent-color: var(--bronze-light);
  cursor: pointer;
}

.consent:hover {
  color: var(--ivory);
}

/* Bagikan ke Instagram tamu (HP) */
.share-ig {
  margin-top: 28px;
}

.share-ig .label {
  display: block;
  margin: 0 0 12px;
}

.share-ig-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.share-ig-tip {
  margin-top: 12px;
  text-wrap: pretty;
}

.share-ig-tip strong {
  font-weight: 400;
  color: var(--ivory);
}

.view[data-view="done"] .share-ig + .actions {
  margin-top: 14px;
}

/* Bawa pulang (kios): QR menuju halaman sampul ini */
.take-home {
  display: flex;
  align-items: center;
  gap: 22px;
  margin-top: 28px;
  padding: 18px;
  border: 1px solid var(--line);
}

.take-home-qr {
  flex: none;
  width: 148px;
  aspect-ratio: 1;
  background: var(--ivory);
  color: var(--bg);
}

.take-home-qr svg {
  display: block;
  width: 100%;
  height: 100%;
  fill: currentColor;
  stroke: none;
}

.take-home .label {
  display: block;
  line-height: 1.6;
}

.take-home-body {
  margin: 10px 0 0;
  font-size: 15px;
  line-height: 1.5;
  color: var(--text-2);
  text-wrap: pretty;
}

.error {
  margin: 10px 0 0;
  font-size: 14px;
  color: var(--rec);
  line-height: 1.45;
}

/* Tombol aksi */
.actions {
  display: grid;
  grid-template-columns: 1fr 1.6fr;
  gap: 10px;
  margin-top: 32px;
}

.actions-single {
  grid-template-columns: 1fr;
  max-width: 280px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 52px;
  padding: 0 22px;
  border-radius: 0;
  font: 600 11px/1 var(--display);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  white-space: nowrap;
  transition: background 0.2s var(--ease-out), border-color 0.2s var(--ease-out), color 0.2s var(--ease-out), opacity 0.2s var(--ease-out);
}

.btn svg {
  width: 17px;
  height: 17px;
}

.btn-primary {
  border: 1px solid var(--ivory);
  background: var(--ivory);
  color: var(--bg);
}

.btn-primary:not(:disabled):hover {
  background: var(--bronze-light);
  border-color: var(--bronze-light);
}

.btn-ghost {
  border: 1px solid var(--bronze);
  background: transparent;
  color: var(--bronze-light);
}

.btn-ghost:not(:disabled):hover {
  border-color: var(--bronze-light);
  color: var(--ivory);
}

/* Di atas sampul gading */
.btn-dark {
  border: 1px solid var(--bg);
  background: var(--bg);
  color: var(--ivory);
}

.btn-dark:not(:disabled):hover {
  background: var(--surface-hover);
}

.btn:disabled {
  opacity: 0.45;
}

.btn-sm {
  height: 42px;
  padding: 0 18px;
  margin-top: 8px;
}

.btn[aria-busy="true"]::after {
  content: "";
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1.5px solid currentColor;
  border-right-color: transparent;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(1turn); }
}

/* Layar lebar tapi pendek (laptop 1440x900): dengan pilihan bingkai, panel tidak muat
   setinggi sampul. Pengantar dikorbankan; judul dan tombol sudah cukup menjelaskan. */
@media (min-width: 861px) and (max-height: 980px) {
  .booth[data-frames="multi"] .view[data-view="live"] .lede {
    display: none;
  }
}

/* ---------- HP & tablet tegak: tata letak aplikasi kamera ----------
   Sampul mengisi layar, kontrol di bawah dalam jangkauan jempol, tanpa menggulir.
   Tinjau & selesai boleh bergulir, dengan tombol aksi menempel di bawah. */

@media (orientation: portrait) and (max-width: 1100px), (max-width: 600px) {
  :root {
    --bar-h: 48px;
    --pad-x: 14px;
  }

  .topbar-logo {
    height: 18px;
  }

  .topbar-brand {
    gap: 12px;
  }

  .topbar-label {
    padding-left: 12px;
    font-size: 8.5px;
    letter-spacing: 0.22em;
  }

  .topbar-tools {
    gap: 2px;
    margin-right: -10px;
  }

  .tool {
    padding: 10px;
  }

  .tool-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  /* Ganti kamera pindah ke samping tombol foto */
  .tool-camera {
    display: none !important;
  }

  .booth {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
    height: calc(100dvh - var(--bar-h) - env(safe-area-inset-top));
    padding: 12px var(--pad-x) max(10px, env(safe-area-inset-bottom));
  }

  .stage {
    flex: 1 1 0;
    min-height: 0;
    container-type: size;
  }

  .cover {
    --h: auto;
    height: auto;
    width: min(100cqw, 100cqh * 2 / 3);
  }

  .panel {
    flex: none;
    padding-top: 0;
  }

  .booth:is([data-state="review"], [data-state="sending"], [data-state="done"]) {
    height: auto;
    min-height: calc(100dvh - var(--bar-h) - env(safe-area-inset-top));
  }

  .booth:is([data-state="review"], [data-state="sending"], [data-state="done"]) .stage {
    flex: none;
    height: min(56dvh, (100vw - 2 * var(--pad-x)) * 1.5);
  }

  .view[data-view="live"] .title,
  .view[data-view="live"] .lede,
  .view[data-view="live"] .hint,
  .view[data-view="review"] .lede {
    display: none;
  }

  /* Kontrol: miniatur bingkai, lalu (rana) [kamera] */
  .view[data-view="live"] {
    grid-template-columns: 1fr auto 1fr;
    grid-template-areas:
      "frames frames frames"
      ". shutter flip";
    align-items: center;
    gap: 14px 12px;
  }

  #framePicker {
    grid-area: frames;
    margin: 0;
  }

  .picker-head {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }

  .frames {
    justify-content: center;
    gap: 12px;
  }

  .frame-opt {
    width: 36px;
  }

  .shutter-row {
    display: contents;
  }

  .shutter {
    grid-area: shutter;
    width: 76px;
    height: 76px;
    padding: 6px;
  }

  .shutter-text {
    display: none;
  }

  /* HP dipegang sejengkal dari wajah: angka kecil di sepertiga bawah, wajah bebas */
  .countdown {
    place-items: end center;
    padding: 0 0 16%;
  }

  .countdown span {
    font-size: 24cqw;
  }

  .flip {
    grid-area: flip;
    justify-self: end;
    display: grid;
  }

  .credit {
    align-self: center;
    padding-top: 14px;
    gap: 10px;
    font-size: 8px;
  }

  .credit img {
    height: 14px;
  }

  .title {
    font-size: 22px;
  }

  .title::after {
    margin-top: 14px;
  }

  .view .lede + .field {
    margin-top: 26px;
  }

  /* Kirim/Ulangi selalu terjangkau saat mengisi catatan */
  .view[data-view="review"] .actions {
    position: sticky;
    bottom: 0;
    z-index: 2;
    margin-top: 20px;
    padding: 16px 0 max(12px, env(safe-area-inset-bottom));
    background: linear-gradient(to bottom, oklch(0.244 0.006 1 / 0), var(--bg) 18px);
  }

  .actions-single {
    max-width: none;
  }
}

/* Bilah atas yang memuat banyak alat (album panitia): di HP sempit, label teks mengalah
   supaya ikon tidak membuat halaman bisa digeser ke samping. */
@media (max-width: 480px) {
  .topbar:has(.topbar-tools > :nth-child(3)) .topbar-label {
    display: none;
  }
}

/* HP mendatar: tetap berdampingan, semua dirapatkan supaya muat setinggi layar */
@media (orientation: landscape) and (max-height: 540px) {
  :root {
    --bar-h: 40px;
    --pad-y: 10px;
    --panel-w: 340px;
  }

  .topbar-logo {
    height: 16px;
  }

  .view[data-view="live"] .title,
  .view[data-view="live"] .lede,
  .view[data-view="live"] .hint {
    display: none;
  }

  .picker {
    margin-top: 12px;
  }

  .frame-opt {
    width: 36px;
  }

  .shutter-row {
    margin-top: 16px;
  }

  .shutter {
    width: 68px;
    height: 68px;
  }

  .credit {
    padding-top: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .countdown span {
    animation: none;
  }
}
