:root {
  --paper: #f7f4ef;
  --paper-dark: #fffdf7;
  --gold: #c9a227;
  --gold-soft: #e8d9a8;
  --maroon: #7a1220;
  --navy: #1f3b5c;
  --ink: #2b2b2b;
  --shadow: 0 10px 30px rgba(0,0,0,0.15);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100svh;
  background: var(--paper);
  font-family: 'EB Garamond', serif;
  color: var(--ink);
  display: flex;
  justify-content: center;
}

.booth {
  width: 100%;
  max-width: 480px;
  min-height: 100svh;
  padding: 24px 20px 40px;
  display: flex;
  flex-direction: column;
}

.step { display: none; flex: 1; flex-direction: column; }
.step.active { display: flex; }

.booth-title {
  font-family: 'Playfair Display', serif;
  font-weight: 600;
  font-size: 26px;
  color: var(--maroon);
  text-align: center;
  margin: 8px 0 2px;
}

.booth-sub {
  text-align: center;
  color: var(--navy);
  font-style: italic;
  margin-bottom: 20px;
}

.slot-progress {
  text-align: center;
  color: var(--maroon);
  font-family: 'Playfair Display', serif;
  font-weight: 600;
  letter-spacing: 1px;
  margin: 0 0 12px;
}

.captured-thumbs {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 14px 2px 4px;
}

.thumb-item {
  position: relative;
  flex: 0 0 auto;
  width: 64px;
  height: 64px;
  border-radius: 10px;
  overflow: hidden;
  border: 1.5px solid var(--gold-soft);
}

.thumb-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.thumb-delete {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: none;
  background: rgba(122, 18, 32, 0.85);
  color: #fff;
  font-size: 12px;
  line-height: 20px;
  text-align: center;
  padding: 0;
  cursor: pointer;
}

/* ===== FRAME LIST ===== */
.frame-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  overflow-y: auto;
}

.frame-item {
  background: var(--paper-dark);
  border: 1.5px solid var(--gold-soft);
  border-radius: 16px;
  padding: 10px;
  cursor: pointer;
  text-align: center;
  transition: border-color .2s;
}

.frame-item:active,
.frame-item.selected {
  border-color: var(--gold);
}

.frame-item img {
  width: 100%;
  aspect-ratio: 1/1;
  object-fit: contain;
  border-radius: 10px;
  background: #eee;
}

.frame-item span {
  display: block;
  margin-top: 6px;
  font-size: 14px;
  color: var(--maroon);
}

/* ===== CAMERA ===== */
.camera-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1/1;
  border-radius: 20px;
  overflow: hidden;
  background: #000;
  box-shadow: var(--shadow);
}

.camera-wrap video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1); /* preview mirror buat kamera depan */
}

.frame-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.camera-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 24px;
}

.btn-capture {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  border: 4px solid var(--gold);
  background: var(--paper-dark);
  cursor: pointer;
}

.btn-capture:active { background: var(--gold-soft); }

.btn-ghost {
  background: none;
  border: 1px solid var(--gold-soft);
  color: var(--navy);
  font-family: 'EB Garamond', serif;
  padding: 10px 16px;
  border-radius: 999px;
  cursor: pointer;
}

/* ===== PREVIEW ===== */
.preview-wrap {
  border-radius: 20px;
  overflow: hidden;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}

.preview-wrap canvas { width: 100%; display: block; }

.input-name {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--gold);
  border-radius: 12px;
  font-family: 'EB Garamond', serif;
  font-size: 15px;
  margin-bottom: 14px;
  background: #fff;
}

.voice-box { text-align: center; margin-bottom: 18px; }

.btn-record {
  background: var(--paper-dark);
  border: 1.5px solid var(--maroon);
  color: var(--maroon);
  padding: 10px 20px;
  border-radius: 999px;
  font-family: 'EB Garamond', serif;
  cursor: pointer;
}

.btn-record.recording {
  background: var(--maroon);
  color: #fff;
}

.hidden { display: none !important; }

.preview-actions {
  display: flex;
  gap: 12px;
  margin-top: auto;
}

.btn-primary {
  flex: 1;
  text-align: center;
  background: linear-gradient(135deg, var(--gold-soft), var(--gold));
  color: var(--maroon);
  font-family: 'Playfair Display', serif;
  font-weight: 600;
  letter-spacing: 1px;
  border: 1px solid var(--gold);
  padding: 12px;
  border-radius: 999px;
  cursor: pointer;
  text-decoration: none;
}

.btn-secondary-full {
  width: 100%;
  text-align: center;
  background: none;
  color: var(--navy);
  font-family: 'EB Garamond', serif;
  border: 1px solid var(--gold-soft);
  padding: 10px;
  border-radius: 999px;
  margin-top: 10px;
  cursor: pointer;
}

/* ===== DONE ===== */
.final-photo {
  width: 100%;
  border-radius: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 18px;
}

.link-gallery {
  display: block;
  text-align: center;
  margin-top: 16px;
  color: var(--navy);
  font-style: italic;
}

.error-msg {
  color: #a33;
  text-align: center;
  font-size: 14px;
  margin-top: 12px;
}
