:root {
  --peta-cream: #f1e6cd;
  --peta-cream-soft: rgba(241, 230, 205, 0.9);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: Arial, Helvetica, sans-serif;
}

body {
  min-height: 100vh;
  min-height: 100svh;
  width: 100%;
  padding: max(12px, env(safe-area-inset-top))
    max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom))
    max(12px, env(safe-area-inset-left));
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--peta-cream);
}

/* ===== Kotak captcha (senada tema scrapbook) ===== */
.captcha-box {
  width: min(440px, 94vw);
  background: #ffffff;
  border: 2px solid rgba(168, 54, 74, 0.35);
  border-radius: 14px;
  overflow: hidden;
  box-shadow:
    0 24px 60px rgba(120, 80, 60, 0.28),
    inset 0 0 40px rgba(200, 160, 120, 0.12);
  font-family: Georgia, "Times New Roman", serif;
}

/* Bar atas krem dengan tab rose */
.captcha-top {
  background: #ffffff;
  border-bottom: 1px solid rgba(168, 54, 74, 0.3);
  padding: 8px 10px 0;
  display: flex;
}

.captcha-label {
  background: #ffffff;
  border: 1px solid rgba(168, 54, 74, 0.4);
  border-bottom: none;
  padding: 6px 12px;
  font-size: 12px;
  color: #a8364a;
  border-radius: 3px 3px 0 0;
  margin-bottom: -1px;
  font-weight: bold;
  letter-spacing: 0.5px;
}

/* ===== Area gambar ===== */
.captcha-image {
  padding: 10px;
  text-align: center;
  background: #ffffff;
  user-select: none;
}

#captchaCanvas {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 1px solid rgba(168, 54, 74, 0.3);
  border-radius: 8px;
  background: #fff;
}

/* ===== Bar bawah ===== */
.captcha-bottom {
  border-top: 1px solid rgba(168, 54, 74, 0.3);
  background: #ffffff;
  padding: 10px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.answer-area {
  min-width: 0;
  flex: 1 1 190px;
}

.answer-area label {
  display: block;
  font-size: 11px;
  color: #a4763b;
  margin-bottom: 3px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

#answerInput {
  width: 100%;
  max-width: min(250px, 100%);
  padding: 8px 10px;
  border: 1.5px solid rgba(168, 54, 74, 0.45);
  border-radius: 8px;
  font-size: 14px;
  font-family: Georgia, "Times New Roman", serif;
  background: #fff;
  color: #5a4a3a;
}

#answerInput:focus {
  outline: none;
  border-color: #a8364a;
  box-shadow: 0 0 6px rgba(168, 54, 74, 0.35);
}

/* Brand LOVE CHECK */
.brand {
  text-align: right;
  font-size: 13px;
  font-weight: bold;
  color: #5a4a3a;
  flex: 0 1 auto;
  min-width: 0;
}

.brand .solve {
  color: #a8364a;
}
.brand .media {
  color: #a4763b;
}

.brand-icons {
  margin-top: 6px;
}

.brand-icons button {
  border: 1px solid rgba(168, 54, 74, 0.4);
  background: #fff;
  border-radius: 6px;
  padding: 2px 6px;
  cursor: pointer;
  font-size: 13px;
  margin-left: 4px;
}

.brand-icons button:hover {
  background: rgba(201, 86, 107, 0.15);
}

/* Pesan status */
.message {
  text-align: center;
  padding: 8px;
  font-size: 13px;
  font-weight: bold;
  font-family: Georgia, "Times New Roman", serif;
}

.message.ok {
  color: #5b7a4a;
}
.message.err {
  color: #a8364a;
}

/* ===== Popup intro "Do you have a map?" ===== */
/* ===== Kuis kunci peta (2 pertanyaan) ===== */
.quiz-peta {
  position: fixed;
  inset: 0;
  z-index: 1100; /* di atas popup peta */
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--peta-cream-soft);
  backdrop-filter: blur(2px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
  padding: 16px;
}

.quiz-peta.tampil {
  opacity: 1;
  pointer-events: auto;
}

.quiz-card {
  background: #ffffff;
  border: 2px solid rgba(168, 54, 74, 0.35);
  border-radius: 14px;
  box-shadow:
    0 24px 60px rgba(120, 80, 60, 0.28),
    inset 0 0 40px rgba(200, 160, 120, 0.12);
  padding: 0 28px 26px;
  max-width: 440px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  text-align: center;
  font-family: inherit;
  transform: translateY(16px) scale(0.96);
  transition: transform 0.35s ease;
}

/* tab langkah pertanyaan (senada tab captcha) */
.quiz-steps {
  display: inline-flex;
  gap: 5px;
  align-items: center;
  margin: 10px 0 -1px auto;
}
.quiz-steps i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #f1e6cd;
  border: 1.5px solid rgba(168, 54, 74, 0.45);
  transition: all 0.3s ease;
}
.quiz-steps i.on {
  background: #a8364a;
  border-color: #a8364a;
  box-shadow: 0 0 6px rgba(168, 54, 74, 0.5);
}

/* header quiz = gaya captcha-top, tapi dibuat absolute agar menempel ke atas kartu */
.quiz-card .captcha-top {
  margin: 0 -28px;
  padding: 8px 10px 0;
}
.quiz-card .captcha-top .tab {
  flex: 1;
  border-bottom: 1px solid rgba(168, 54, 74, 0.3);
  align-self: flex-end;
  margin-bottom: 0;
}

/* badge LOVE CHECK di bawah, senada brand captcha */
.quiz-verified {
  margin: 12px 0 2px;
  font-size: 10px;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: #a4763b;
  font-weight: bold;
}

.quiz-brand {
  margin: 0 0 6px;
  padding-top: 8px;
  border-top: 1px dashed rgba(168, 54, 74, 0.35);
  font-size: 10.5px;
  font-weight: bold;
  letter-spacing: 1px;
  color: #a4763b;
  order: -1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
}
.quiz-brand span {
  color: #a8364a;
}

.quiz-peta.tampil .quiz-card {
  transform: translateY(0) scale(1);
}

.quiz-gif {
  display: none;
}

/* ===== Dekorasi kartu quiz (senada captcha scrapbook) ===== */
.quiz-card {
  background: #ffffff;
  position: relative;
}

.quiz-tape-1,
.quiz-tape-2 {
  display: none;
}

.quiz-seal {
  width: 92px;
  height: 92px;
  margin: 18px auto 0;
  border-radius: 50%;
  border: 3px solid #faf4e6;
  outline: 2px dashed rgba(168, 54, 74, 0.55);
  outline-offset: 3px;
  overflow: hidden;
  box-shadow: 0 4px 14px rgba(120, 80, 60, 0.3);
  transform: rotate(-4deg);
  animation: sealMuncul 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
.quiz-seal img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
@keyframes sealMuncul {
  from {
    transform: rotate(-6deg) scale(0);
    opacity: 0;
  }
  to {
    transform: rotate(-6deg) scale(1);
    opacity: 1;
  }
}

.quiz-head h2 {
  font-size: 21px;
  margin-top: 10px;
  background: linear-gradient(120deg, #a8364a, #c9566b 55%, #a8364a);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: 0.3px;
}
.quiz-head p {
  font-style: italic;
  color: #8a7460;
  transition: color 0.3s ease;
}
.quiz-peta.selesai .quiz-head p {
  color: #2e7d4f;
  font-weight: 700;
}

/* rute perjalanan kecil */
.quiz-route {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin: 10px auto 16px;
  max-width: 240px;
}
.quiz-route i {
  flex: 1;
  height: 0;
  border-top: 2px dashed rgba(168, 54, 74, 0.4);
  position: relative;
}
.quiz-route i::before {
  content: "";
  position: absolute;
  left: -5px;
  top: -7px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #f1e6cd;
  border: 2px solid rgba(168, 54, 74, 0.45);
  transition: all 0.3s ease;
}
.quiz-route i.on::before {
  background: #a8364a;
  border-color: #a8364a;
  box-shadow: 0 0 8px rgba(168, 54, 74, 0.5);
}
.quiz-route-end {
  font-size: 15px;
  margin-left: 4px;
  filter: grayscale(1);
  opacity: 0.4;
  transition: all 0.4s ease;
}
.quiz-peta.selesai .quiz-route-end {
  filter: none;
  opacity: 1;
  animation: bobEmoji 1.6s ease-in-out infinite;
}

.quiz-card h2 {
  margin: 6px 0 4px;
  color: #a8364a;
  font-size: 20px;
}

.quiz-card > p {
  color: #5a4a3a;
  font-size: 13.5px;
  margin: 0 0 16px;
}

.quiz-q {
  display: none;
  text-align: left;
  margin-bottom: 16px;
}

.quiz-q.aktif {
  display: block;
}

.quiz-pertanyaan {
  color: #5a4a3a;
  font-weight: 700;
  font-size: 14px;
  margin: 0 0 8px;
}

.quiz-opsi {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.quiz-q {
  counter-reset: opsi;
}

.quiz-opsi button {
  counter-increment: opsi;
  text-align: left;
  font-family: inherit;
  font-size: 13.5px;
  color: #5a4a3a;
  background: #fffdf8;
  border: 1.5px solid rgba(168, 54, 74, 0.35);
  border-left: 4px solid rgba(168, 54, 74, 0.55);
  border-radius: 8px;
  padding: 10px 14px 10px 42px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
  width: 100%;
  box-shadow: 0 2px 6px rgba(120, 80, 60, 0.08);
}

.quiz-opsi button::before {
  content: counter(opsi, upper-alpha);
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1.5px solid rgba(168, 54, 74, 0.45);
  color: #a8364a;
  font-size: 11px;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #faf4e6;
  transition: all 0.2s ease;
}

.quiz-opsi button:hover {
  border-color: #a8364a;
  background: #f9ede4;
  transform: translateX(4px);
  box-shadow: 0 3px 10px rgba(168, 54, 74, 0.2);
}

.quiz-opsi button.dipilih {
  background: #a8364a;
  border-color: #a8364a;
  border-left-color: #7d2133;
  color: #faf4e6;
  box-shadow: 0 4px 14px rgba(168, 54, 74, 0.45);
}

.quiz-opsi button.dipilih::before {
  background: #faf4e6;
  color: #a8364a;
  border-color: #faf4e6;
}

.quiz-opsi button.dipilih::after {
  content: "✓";
  float: right;
  font-weight: bold;
}

.quiz-opsi button.salah {
  border-color: #b03030;
  border-left-color: #b03030;
  background: #f6dede;
  animation: goyangKuis 0.35s ease;
}

.quiz-opsi button.salah::before {
  border-color: #b03030;
  color: #b03030;
  background: #fbeeee;
}

.quiz-opsi button.salah::after {
  content: "✘";
  float: right;
  font-weight: bold;
  color: #b03030;
}

@keyframes goyangKuis {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-5px);
  }
  75% {
    transform: translateX(5px);
  }
}

.quiz-brand {
  display: none;
}

.quiz-pesan {
  font-size: 13px;
  min-height: 18px;
  margin: 2px 0 10px;
  color: #5a4a3a;
}

.quiz-pesan.ok {
  color: #2e7d4f;
  font-weight: 700;
}
.quiz-pesan.err {
  color: #b03030;
}

#btnBukaPeta {
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  color: #faf4e6;
  background: #a8364a;
  border: none;
  border-radius: 999px;
  padding: 11px 22px;
  cursor: pointer;
  transition: all 0.35s ease;
  box-shadow: 0 6px 18px rgba(168, 54, 74, 0.4);
}

/* disembunyikan selama soal belum selesai semua */
#btnBukaPeta:disabled {
  display: none;
}

#btnBukaPeta:not(:disabled) {
  animation: tombolMuncul 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes tombolMuncul {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

#btnBukaPeta:not(:disabled):hover {
  background: #c9566b;
  transform: translateY(-2px);
}

.popup-peta {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--peta-cream-soft);
  backdrop-filter: blur(2px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

.popup-peta.tampil {
  opacity: 1;
  pointer-events: auto;
}

.popup-card {
  background: #ffffff;
  border: 2px solid rgba(168, 54, 74, 0.35);
  border-radius: 14px;
  padding: 0 clamp(20px, 6vw, 40px) clamp(22px, 5vw, 32px);
  text-align: center;
  max-width: min(420px, 92vw);
  margin: 20px;
  box-shadow:
    0 24px 60px rgba(120, 80, 60, 0.28),
    inset 0 0 40px rgba(200, 160, 120, 0.12);
  transform: scale(0.8) translateY(20px);
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.popup-card .captcha-top {
  margin: 0 -40px 8px;
  padding: 8px 10px 0;
}
.popup-card .captcha-top .tab {
  flex: 1;
  border-bottom: 1px solid rgba(168, 54, 74, 0.3);
  align-self: flex-end;
  margin-bottom: 0;
}

/* dekorasi popup = senada quiz */
.popup-card {
  background: #ffffff;
  position: relative;
}
.popup-tape-1,
.popup-tape-2 {
  display: none;
}

/* bulet 3 langkah di kanan atas (verifikasi penuh) */
.popup-steps {
  display: inline-flex;
  gap: 5px;
  align-items: center;
  margin: 10px 0 -1px auto;
}
.popup-steps i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #f1e6cd;
  border: 1.5px solid rgba(168, 54, 74, 0.45);
  transition: all 0.3s ease;
}
.popup-steps i.on {
  background: #a8364a;
  border-color: #a8364a;
  box-shadow: 0 0 6px rgba(168, 54, 74, 0.5);
}

/* hiasan sudut kanan atas: kompas mini + spark */
.popup-corner {
  position: absolute;
  top: 46px;
  right: 14px;
  width: 46px;
  height: 46px;
  border: 2px dashed rgba(168, 54, 74, 0.45);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: #a8364a;
  background: rgba(168, 54, 74, 0.06);
  transform: rotate(8deg);
  animation: sealMuncul 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) both;
  animation-delay: 0.15s;
  animation-fill-mode: both;
  pointer-events: none;
}
.popup-corner::after {
  content: "✨";
  position: absolute;
  top: -8px;
  right: -8px;
  font-size: 12px;
}

.popup-seal {
  width: 92px;
  height: 92px;
  margin: 22px auto 12px;
  border-radius: 50%;
  border: 3px solid #faf4e6;
  outline: 2px dashed rgba(168, 54, 74, 0.55);
  outline-offset: 3px;
  overflow: hidden;
  box-shadow: 0 4px 14px rgba(120, 80, 60, 0.3);
  transform: rotate(-4deg);
  animation: sealMuncul 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
.popup-seal img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.popup-emoji {
  font-size: 34px;
  margin-top: 12px;
}

.popup-peta.tampil .popup-card {
  transform: scale(1) translateY(0);
}

.popup-emoji {
  font-size: 52px;
  display: block;
  margin-bottom: 10px;
  animation: bobEmoji 2s ease-in-out infinite;
}

@keyframes bobEmoji {
  0%,
  100% {
    transform: translateY(0) rotate(-4deg);
  }
  50% {
    transform: translateY(-8px) rotate(4deg);
  }
}

.popup-card h2 {
  font-family: Georgia, serif;
  color: #a8364a;
  margin: 18px 0 8px;
}

.popup-card p {
  font-style: italic;
  color: #6b5560;
  margin: 0 0 22px;
  line-height: 1.5;
  padding-top: 2px;
}

.popup-card button {
  padding: 13px 28px;
  font-size: 16px;
  font-weight: bold;
  border: none;
  border-radius: 30px;
  cursor: pointer;
  background: #c9566b;
  color: #fff;
  box-shadow: 0 6px 18px rgba(201, 86, 107, 0.4);
  transition:
    transform 0.15s,
    box-shadow 0.15s;
}

.popup-card button:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(201, 86, 107, 0.55);
}

.popup-card button:active {
  transform: scale(0.95);
}

/* ===== Overlay animasi pulang ===== */
.anim-overlay {
  position: fixed;
  inset: 0;
  background: #0b1030;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.8s ease;
  z-index: 999;
}

.anim-overlay.tampil {
  opacity: 1;
  pointer-events: auto;
}

#animCanvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* Tombol jalan (tekan & tahan) */
#btnJalan {
  position: absolute;
  bottom: 110px;
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 24px;
min-height: 46px;
  font-size: 15px;
  font-weight: bold;
  border-radius: 999px;
  border: 2px solid rgba(168, 54, 74, 0.5);
  background: rgba(253, 246, 236, 0.92);
  color: #a8364a;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.2);
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.5s ease,
    transform 0.1s ease,
    box-shadow 0.1s ease;
  max-width: min(220px, 85vw);
  width: fit-content;
  white-space: nowrap;
  line-height: 1.25;
  box-sizing: border-box;
}

#btnJalan.tampil {
  opacity: 1;
  pointer-events: auto;
  animation: kedipHint 1.8s ease-in-out infinite;
}

#btnJalan.ditekan {
  transform: translateX(-50%) scale(0.93);
  background: #c9566b;
  color: #fff;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3);
  animation: none;
}

/* Tombol di overlay */
.anim-btns {
  position: absolute;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 12px;
  opacity: 0;
  transition: opacity 0.5s ease;
}

.anim-btns.tampil {
  opacity: 1;
}

.anim-btns button {
  padding: 9px 18px;
  font-size: 14px;
  font-weight: bold;
  border: none;
  border-radius: 18px;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  transition: background 0.2s;
  max-width: min(220px, 80vw);
  width: fit-content;
  box-sizing: border-box;
  white-space: nowrap;
}

.anim-btns button:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* ============================================================
   LOVE LETTER
   ============================================================ */
.letter-overlay {
  position: fixed;
  inset: 0;
  /* kertas peta krem, senada dengan animasi pulang */
   background: radial-gradient(
    circle at 50% 20%,
    #faf4e6,
    #f1e6cd 75%
  );
  background-size:
    46px 46px,
    100% 100%;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.8s ease;
  z-index: 1000;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.letter-overlay.tampil {
  opacity: 1;
  pointer-events: auto;
}

/* Hati kecil melayang di latar */
.hearts-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.hearts-bg span {
  position: absolute;
  bottom: -40px;
  color: rgba(168, 54, 74, 0.4);
  animation: naikHati linear infinite;
}

@keyframes naikHati {
  to {
    transform: translateY(-110vh) rotate(360deg);
    opacity: 0;
  }
}

/* ===== Amplop ===== */
.envelope-stage {
  text-align: center;
  transition:
    opacity 0.6s ease,
    transform 0.6s ease;
}

.envelope-stage.hilang {
  opacity: 0;
  transform: scale(0.6);
  pointer-events: none;
}

.envelope {
  position: relative;
  width: 280px;
  height: 180px;
  margin: 0 auto;
  cursor: pointer;
  filter: drop-shadow(0 15px 30px rgba(120, 80, 60, 0.35));
  transition: transform 0.3s;
}

.envelope:hover {
  transform: scale(1.05) rotate(-2deg);
}

/* badan amplop — kertas kraft senada peta */
.envelope .pocket {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, #f0dfc0, #e3c69a);
  border: 2px solid rgba(168, 54, 74, 0.35);
  border-radius: 8px;
  clip-path: polygon(0 25%, 50% 65%, 100% 25%, 100% 100%, 0 100%);
  z-index: 2;
}

/* flap (penutup atas) */
.envelope .flap {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, #fdf3dd, #f2dcb8);
  border-radius: 8px;
  clip-path: polygon(0 0, 100% 0, 50% 62%);
  transform-origin: top;
  transition: transform 0.7s cubic-bezier(0.6, -0.3, 0.3, 1.4);
  z-index: 3;
}

.envelope.buka .flap {
  transform: rotateX(180deg);
  z-index: 1;
}

/* segel lilin */
.envelope .seal {
  position: absolute;
  left: 50%;
  top: 55%;
  transform: translate(-50%, -50%);
  width: 52px;
  height: 52px;
  background: radial-gradient(circle at 35% 35%, #d95f73, #a8364a);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 24px;
  box-shadow: 0 4px 10px rgba(120, 40, 50, 0.4);
  z-index: 4;
  transition:
    opacity 0.4s,
    transform 0.4s;
}

/* surat kecil yang menyembul dari dalam amplop */
.surat-muncul {
  position: absolute;
  left: 50%;
  bottom: 12%;
  width: 78%;
  height: 70%;
  transform: translateX(-50%) translateY(40%) scaleY(0);
  transform-origin: bottom;
  background: #fdfbf7;
  border-radius: 4px;
  box-shadow: 0 -4px 12px rgba(120, 80, 60, 0.25);
  padding: 16px 18px;
  z-index: 1;
  transition: transform 0.6s cubic-bezier(0.3, 1.2, 0.4, 1) 0.25s;
}

.envelope.buka .surat-muncul {
  transform: translateX(-50%) translateY(0) scaleY(1);
}

.sm-line {
  height: 5px;
  border-radius: 3px;
  background: rgba(168, 54, 74, 0.3);
  margin-bottom: 8px;
}

.sm-line.pendek {
  width: 60%;
}

.sm-heart {
  color: #a8364a;
  font-size: 18px;
  text-align: center;
  margin-top: 4px;
  animation: kedipHint 1.4s ease-in-out infinite;
}

.envelope.buka .seal {
  opacity: 0;
  transform: translate(-50%, -50%) scale(1.6) rotate(40deg);
}

.hint {
  margin-top: 22px;
  color: #a8364a;
  font-family: Georgia, serif;
  font-style: italic;
  font-size: 16px;
  animation: kedipHint 1.6s ease-in-out infinite;
}

@keyframes kedipHint {
  50% {
    opacity: 0.35;
  }
}

/* ===== Kartu surat ===== */
.letter-card {
  position: absolute;
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  max-width: 92vw;
  width: min(92vw, 860px);
}

.letter-card.tampil {
  display: flex;
  animation: suratNaik 0.8s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}

@keyframes suratNaik {
  from {
    transform: translateY(80px) scale(0.85);
    opacity: 0;
  }
}

/* ============================================================
   SCRAPBOOK "This is our love story"
   ============================================================ */
.scrapbook {
  position: relative;
  /* lebar dibatasi agar tingginya (rasio 3/4) tidak melebihi 82vh */
  width: min(860px, 94vw, 61vh);
  aspect-ratio: 3 / 4;
  max-height: 82vh;
  background: linear-gradient(160deg, #fdf6ec, #f3e8d2);
  border: 2px solid rgba(168, 54, 74, 0.35);
  border-radius: 14px;
  box-shadow:
    0 24px 60px rgba(120, 80, 60, 0.35),
    inset 0 0 60px rgba(200, 160, 120, 0.18);
  overflow: hidden;
}

/* ===== Ornamen peta ===== */
/* kompas mini */
.sb-kompas {
  position: absolute;
  right: 3.5%;
  top: 3%;
  width: 64px;
  height: 64px;
  border: 2px solid rgba(168, 54, 74, 0.6);
  border-radius: 50%;
  background: rgba(253, 246, 236, 0.9);
  box-shadow: 0 4px 10px rgba(120, 80, 60, 0.25);
  z-index: 6;
  animation: kompasGoyang 5s ease-in-out infinite;
}

@keyframes kompasGoyang {
  0%,
  100% {
    transform: rotate(-6deg);
  }
  50% {
    transform: rotate(6deg);
  }
}

.sb-kompas .k-n {
  position: absolute;
  top: 3px;
  left: 50%;
  transform: translateX(-50%);
  font-family: Georgia, serif;
  font-weight: bold;
  font-size: 12px;
  color: #a8364a;
}

.sb-kompas .k-jarum {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 4px;
  height: 26px;
  transform: translate(-50%, -58%);
  background: linear-gradient(#a8364a 50%, #5a4a3a 50%);
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
  border-radius: 2px;
}

/* garis rute putus-putus, seperti jalan di peta */
.sb-rute {
  position: absolute;
  left: 6%;
  bottom: 26%;
  width: 40%;
  height: 34px;
  z-index: 1;
  background: transparent;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 40'%3E%3Cpath d='M5 35 C 40 5, 70 40, 105 20 S 170 5, 195 25' fill='none' stroke='black' stroke-width='6' stroke-linecap='round'/%3E%3C/svg%3E")
    no-repeat center / 100% 100%;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 40'%3E%3Cpath d='M5 35 C 40 5, 70 40, 105 20 S 170 5, 195 25' fill='none' stroke='black' stroke-width='6' stroke-linecap='round'/%3E%3C/svg%3E")
    no-repeat center / 100% 100%;
  animation: ruteJalan 3s linear infinite;
}

@keyframes ruteJalan {
  to {
    background-position: 32px 0;
  }
}

/* prangko pojok kiri atas */
.sb-prangko {
  position: absolute;
  left: 3%;
  top: 3%;
  padding: 6px 8px 4px;
  background: #fdf6ec;
  border: 2px dashed rgba(168, 54, 74, 0.55);
  text-align: center;
  transform: rotate(-5deg);
  z-index: 6;
  box-shadow: 0 4px 10px rgba(120, 80, 60, 0.2);
}

.sb-prangko span {
  font-size: 22px;
  display: block;
}

.sb-prangko i {
  font-family: Georgia, serif;
  font-size: 11px;
  color: #a8364a;
  letter-spacing: 2px;
}

/* cap pos vintage */
.sb-postmark {
  position: absolute;
  right: 4%;
  top: 22%;
  font-family: Georgia, serif;
  font-size: 11px;
  letter-spacing: 2px;
  color: rgba(168, 54, 74, 0.55);
  border: 2px solid rgba(168, 54, 74, 0.4);
  border-radius: 50%;
  padding: 16px 10px;
  transform: rotate(8deg);
  z-index: 1;
  text-transform: uppercase;
}

/* washi tape */
.tape {
  position: absolute;
  width: 110px;
  height: 30px;
  background: rgba(201, 86, 107, 0.35);
  backdrop-filter: blur(1px);
  box-shadow: 0 2px 6px rgba(120, 80, 60, 0.2);
  z-index: 7;
}

.tape-1 {
  left: 10%;
  top: -8px;
  transform: rotate(-4deg);
}

.tape-2 {
  right: 12%;
  bottom: -8px;
  transform: rotate(3deg);
}

/* foto polaroid umum */
.sb-polaroid {
  position: absolute;
  background: #fffdf8;
  padding: 10px 10px 14px;
  box-shadow: 0 12px 30px rgba(120, 80, 60, 0.35);
}

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

.sb-polaroid img.bw {
  filter: grayscale(1) contrast(1.05);
}

/* foto utama besar di kiri */
.sb-polaroid.utama {
  left: 4%;
  top: 6%;
  width: 40%;
  aspect-ratio: 4 / 5;
  transform: rotate(-2deg);
  z-index: 2;
}

/* polaroid dengan caption: gambar memberi ruang untuk teks */
.sb-polaroid.utama img,
.sb-polaroid.kedua img {
  height: calc(100% - 26px);
}

/* kartu blob "Chapter Four: Us" */
.sb-blob {
  position: absolute;
  right: 12%;
  top: 7%;
  width: 48%;
  background: #fffdf8;
  border: 2px solid rgba(168, 54, 74, 0.3);
  border-radius: 46% 54% 52% 48% / 48% 42% 58% 52%;
  box-shadow: 0 12px 30px rgba(120, 80, 60, 0.3);
  padding: 6% 9%;
  text-align: center;
  z-index: 3;
}

.sb-blob h2 {
  font-family: Georgia, serif;
  font-weight: bold;
  font-size: clamp(18px, 3.4vw, 30px);
  color: #5a4a3a;
  line-height: 1.2;
  margin-bottom: 14px;
}

.sb-blob h2 em {
  color: #a8364a;
  font-style: italic;
}

.sb-blob h2::before {
  content: "♡";
  display: block;
  font-size: 0.9em;
  color: #a8364a;
  margin-bottom: 4px;
}

#letterText {
  font-family: Georgia, serif;
  font-size: clamp(10px, 1.35vw, 13px);
  line-height: 1.7;
  color: #5a4a3a;
  white-space: pre-wrap;
  text-align: center;
  min-height: 110px;
  max-width: 68%;
  margin: 0 auto;
}

.sb-blob .ttd {
  margin-top: 16px;
  font-family: Georgia, serif;
  font-size: clamp(14px, 2.2vw, 20px);
  color: #a8364a;
  letter-spacing: 2px;
}

/* polaroid kedua hitam putih di bawah tengah */
.sb-polaroid.kedua {
  left: 8%;
  bottom: 3%;
  width: 32%;
  aspect-ratio: 5 / 4;
  transform: rotate(-6deg);
  z-index: 4;
}

/* strip photo booth di kanan */
.sb-strip {
  position: absolute;
  right: 2%;
  bottom: 4%;
  width: 13%;
  background: #fffdf8;
  padding: 7px 7px 10px;
  box-shadow: 0 12px 30px rgba(120, 80, 60, 0.35);
  display: flex;
  flex-direction: column;
  gap: 5px;
  transform: rotate(3deg);
  z-index: 2;
}

.sb-strip img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  filter: grayscale(1) contrast(1.05);
}

/* caption handwritten polaroid */
.sb-caption {
  display: block;
  font-family: Georgia, serif;
  font-style: italic;
  font-size: clamp(9px, 1.2vw, 13px);
  color: #a8364a;
  margin-top: 6px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sb-strip-cap {
  font-family: Georgia, serif;
  font-style: italic;
  font-size: clamp(7px, 0.9vw, 10px);
  line-height: 1.35;
  color: #a8364a;
  text-align: center;
  margin-top: 3px;
}

/* hati kecil dekoratif */
.sb-heart {
  position: absolute;
  z-index: 5;
  filter: drop-shadow(0 3px 6px rgba(120, 80, 60, 0.35));
  animation: kedipHint 2.4s ease-in-out infinite;
}

.sb-h1 {
  left: 40%;
  top: 26%;
  font-size: 26px;
}
.sb-h2 {
  left: 4%;
  top: 52%;
  font-size: 20px;
  transform: rotate(-12deg);
}
.sb-h3 {
  left: 68%;
  top: 6%;
  font-size: 22px;
  transform: rotate(10deg);
  animation-delay: 0.8s;
}
.sb-h4 {
  left: 62%;
  bottom: 34%;
  font-size: 24px;
  animation-delay: 1.4s;
}

/* Tombol tutup surat */
#btnTutupLetter {
  padding: 10px 24px;
  font-size: 14px;
  font-weight: bold;
  font-family: Georgia, serif;
  border: 2px solid rgba(168, 54, 74, 0.5);
  border-radius: 25px;
  cursor: pointer;
  background: rgba(253, 246, 236, 0.92);
  color: #a8364a;
  box-shadow: 0 6px 18px rgba(120, 80, 60, 0.25);
  transition:
    transform 0.15s,
    box-shadow 0.15s;
}

#btnTutupLetter:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(120, 80, 60, 0.35);
}

/* Responsif: layar sempit → scrapbook bisa discroll */
@media (max-width: 600px) {
  .letter-card {
    max-height: 92vh;
    overflow-y: auto;
  }
  .scrapbook {
    width: min(94vw, 61vh);
  }
  .sb-blob h2 {
    font-size: clamp(16px, 4.5vw, 22px);
    margin-bottom: 8px;
  }
  .sb-blob {
    max-height: 90%;
    padding: 5% 7%;
  }
  #letterText {
    font-size: clamp(9px, 2.5vw, 11px);
    min-height: 0;
    max-width: 100%;
    max-height: 52vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .sb-caption {
    font-size: clamp(8px, 2.2vw, 11px);
  }
  .sb-strip-cap {
    font-size: clamp(7px, 1.7vw, 9px);
  }
  .sb-postmark {
    padding: 10px 6px;
    font-size: 9px;
  }
  .sb-kompas {
    width: 46px;
    height: 46px;
  }
  .sb-kompas .k-jarum {
    height: 18px;
  }
  .tape {
    width: 70px;
    height: 20px;
  }
}

/* ============================================================
   TRANSISI MASUK RUMAH (zoom ke pintu)
   ============================================================ */
#animCanvas {
  will-change: transform;
}

.anim-overlay.zoom #animCanvas {
  transition: transform 1.5s cubic-bezier(0.55, 0, 0.9, 0.45);
  transform: scale(16);
}

/* tombol masuk rumah — gaya sama dgn btnJalan */
#btnMasukRumah {
  position: absolute;
  bottom: 110px;
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 24px;
min-height: 46px;
  font-size: 15px;
  font-weight: bold;
  font-family: Georgia, serif;
  border-radius: 999px;
  border: 2px solid rgba(168, 54, 74, 0.5);
  background: rgba(253, 246, 236, 0.92);
  color: #a8364a;
  cursor: pointer;
  user-select: none;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.2);
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.5s ease,
    transform 0.15s;
  z-index: 5;
  max-width: min(220px, 85vw);
  width: fit-content;
  white-space: nowrap;
  line-height: 1.25;
  box-sizing: border-box;
}

#btnMasukRumah.tampil {
  opacity: 1;
  pointer-events: auto;
  animation: kedipHint 1.8s ease-in-out infinite;
}

#btnMasukRumah:hover {
  transform: translateX(-50%) scale(1.05);
}

/* flash hangat saat menembus pintu */
.anim-flash {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 50%, #fff8ea, #ffd9a8 70%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.45s ease;
  z-index: 10;
}

.anim-flash.nyala {
  opacity: 1;
}

/* ============================================================
   SCENE "DI DALAM RUMAH" — visual novel
   ============================================================ */
.house-overlay {
  position: fixed;
  inset: 0;
  z-index: 998;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.9s ease;
  overflow: hidden;
}

.house-overlay.tampil {
  opacity: 1;
  pointer-events: auto;
}

#houseCanvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* tombol lewati */
#btnSkipDialog {
  position: absolute;
  top: 18px;
  right: 18px;
  padding: 8px 18px;
  font-family: Georgia, serif;
  font-size: 13px;
  font-weight: bold;
  color: #a8364a;
  background: rgba(253, 246, 236, 0.9);
  border: 2px solid rgba(168, 54, 74, 0.45);
  border-radius: 20px;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.5s,
    transform 0.15s;
  z-index: 6;
}

#btnSkipDialog.tampil {
  opacity: 1;
  pointer-events: auto;
}

#btnSkipDialog:hover {
  transform: scale(1.06);
}

/* ===== Wrapper dialog (potret + kotak) ===== */
.dialog-wrap {
  position: absolute;
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%);
  width: min(780px, 94vw);
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.5s ease,
    transform 0.5s ease;
  transform: translateX(-50%) translateY(40px);
  z-index: 5;
}

.dialog-wrap.tampil {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

/* potret karakter ala visual novel */
.portrait {
  position: absolute;
  bottom: 100%;
  width: clamp(70px, 11vw, 104px);
  aspect-ratio: 1;
  border-radius: 50%;
  border: 4px solid #fdf6ec;
  box-shadow: 0 8px 20px rgba(120, 80, 60, 0.4);
  overflow: hidden;
  background: #e8a0b4;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    transform 0.3s,
    filter 0.3s,
    box-shadow 0.3s;
  margin-bottom: 6px;
}

.portrait span {
  font-size: 40px;
}

.portrait img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.port-hyein {
  right: 4%;
  left: auto;
}
.port-martin {
  left: 4%;
  right: auto;
}

/* pemilik giliran bicara: menyala; yang lain: redup */
.portrait.nonaktif {
  filter: grayscale(0.8) brightness(0.7);
  transform: scale(0.84);
}

.portrait.aktif {
  transform: scale(1.08);
  box-shadow:
    0 8px 26px rgba(168, 54, 74, 0.55),
    0 0 0 3px rgba(201, 86, 107, 0.6);
}

.portrait.happy {
  animation: potretSenang 0.5s ease;
}

@keyframes potretSenang {
  0% {
    transform: scale(1.08);
  }
  30% {
    transform: scale(1.2) rotate(-3deg);
  }
  60% {
    transform: scale(1.05) rotate(2deg);
  }
  100% {
    transform: scale(1.08);
  }
}

/* ===== Kotak dialog ===== */
.dialog-box {
  position: relative;
  background: linear-gradient(160deg, #fdf6ec, #f3e8d2);
  border: 2px solid rgba(168, 54, 74, 0.45);
  border-radius: 16px;
  padding: 22px 26px 30px;
  min-height: 110px;
  box-shadow: 0 16px 40px rgba(120, 80, 60, 0.35);
  cursor: pointer;
  user-select: none;
  overflow-wrap: anywhere;
}

.nama-tag {
  position: absolute;
  top: -16px;
  left: 22px;
  padding: 4px 18px;
  font-family: Georgia, serif;
  font-weight: bold;
  font-size: 15px;
  letter-spacing: 1px;
  color: #fff;
  border-radius: 14px;
  background: #c9566b;
  box-shadow: 0 4px 10px rgba(120, 40, 50, 0.35);
  transition: background 0.25s;
}

.nama-tag.martin {
  background: #a4763b;
}

#dialogText {
  margin: 6px 0 0;
  font-family: Georgia, serif;
  font-style: italic;
  font-size: clamp(15px, 2.4vw, 19px);
  line-height: 1.65;
  color: #5a4a3a;
  min-height: 62px;
}

.next-ind {
  position: absolute;
  right: 20px;
  bottom: 8px;
  font-family: Georgia, serif;
  font-size: 12px;
  color: rgba(168, 54, 74, 0.8);
  animation: kedipHint 1.2s ease-in-out infinite;
}

.next-ind.sembunyi {
  visibility: hidden;
}

/* ===== Pilihan jawaban ===== */
.pilihan {
  position: absolute;
  left: 50%;
  bottom: 200px;
  transform: translateX(-50%);
  display: none;
  flex-direction: column;
  gap: 12px;
  width: min(560px, 90vw);
  z-index: 6;
}

.pilihan.tampil {
  display: flex;
}

.pilihan button {
  padding: 13px 20px;
  font-family: Georgia, serif;
  font-weight: bold;
  font-size: 15px;
  color: #a8364a;
  background: rgba(253, 246, 236, 0.94);
  border: 2px solid rgba(168, 54, 74, 0.5);
  border-radius: 14px;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(120, 80, 60, 0.3);
  opacity: 0;
  transform: translateY(16px);
  animation: pilihanMuncul 0.45s cubic-bezier(0.3, 1.4, 0.5, 1) forwards;
  transition:
    transform 0.15s,
    box-shadow 0.15s,
    background 0.15s;
  overflow-wrap: anywhere;
}

.pilihan button:nth-child(2) {
  animation-delay: 0.12s;
}
.pilihan button:nth-child(3) {
  animation-delay: 0.24s;
}

@keyframes pilihanMuncul {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.pilihan button:hover {
  background: #c9566b;
  color: #fff;
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 12px 26px rgba(168, 54, 74, 0.45);
}

/* ===== Tombol akhir scene ===== */
.house-final {
  position: absolute;
  left: 50%;
  bottom: 30px;
  transform: translateX(-50%);
  display: none;
  gap: 14px;
  z-index: 6;
}

.house-final.tampil {
  display: flex;
  animation: houseFinalMuncul 0.5s ease forwards;
}

@keyframes houseFinalMuncul {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

.house-final button {
  padding: 9px 16px;
  font-family: Georgia, serif;
  font-weight: bold;
  font-size: 13px;
  color: #a8364a;
  background: rgba(253, 246, 236, 0.94);
  border: 2px solid rgba(168, 54, 74, 0.5);
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(120, 80, 60, 0.3);
  transition:
    transform 0.15s,
    box-shadow 0.15s;
  width: fit-content;
  min-width: 0;
  max-width: 180px;
  white-space: nowrap;
  box-sizing: border-box;
}

.house-final button:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 26px rgba(168, 54, 74, 0.45);
}

/* layar sempit */
@media (max-width: 600px) {
  .dialog-box {
    min-height: 96px;
    padding: 18px 18px 26px;
  }
  #dialogText {
    min-height: 52px;
  }
  .pilihan {
    bottom: 170px;
  }
  #btnJalan,
  #btnMasukRumah {
    bottom: 84px;
    padding: 12px 22px;
    font-size: 14px;
  }
  .anim-btns {
    bottom: 26px;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
    width: 92vw;
  }
  .anim-btns button {
    padding: 9px 16px;
    font-size: 13px;
  }
  .pilihan button {
    font-size: 13px;
    padding: 11px 14px;
  }
  .house-final {
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    width: max-content;
    max-width: calc(100vw - 28px);
    bottom: 20px;
  }
  .house-final button {
    width: auto;
    max-width: 160px;
    min-width: 0;
    box-sizing: border-box;
    font-size: 12px;
    padding: 9px 14px;
    text-align: center;
  }
  .dialog-wrap {
    width: 94vw;
    bottom: 18px;
  }
  .portrait {
    width: clamp(54px, 16vw, 80px);
    border-width: 3px;
  }
  .nama-tag {
    font-size: 13px;
    padding: 3px 14px;
    top: -14px;
  }
  #btnSkipDialog {
    top: 12px;
    right: 12px;
    padding: 6px 14px;
    font-size: 12px;
  }
}

/* layar pendek (hp landscape / laptop kecil) */
@media (max-height: 500px) {
  #btnJalan,
  #btnMasukRumah {
    bottom: 60px;
    padding: 10px 18px;
    font-size: 13px;
  }
  .anim-btns {
    bottom: 14px;
  }
  .dialog-wrap {
    bottom: 12px;
  }
  .pilihan {
    bottom: 120px;
  }
  .dialog-box {
    min-height: 78px;
    padding: 14px 16px 24px;
  }
  #dialogText {
    min-height: 40px;
    font-size: 15px;
  }
  .portrait {
    width: 52px;
  }
}

/* tablet — dialog lebih lega */
@media (min-width: 601px) and (max-width: 1024px) {
  .dialog-wrap {
    width: 92vw;
  }
  .pilihan {
    width: min(520px, 88vw);
  }
}

/* ============================================================
   RESPONSIVE TAMBAHAN — mobile, tablet, hp landscape
   ============================================================ */

/* HP kecil & sedang (≤480px) */
@media (max-width: 480px) {
  /* captcha */
  .captcha-top {
    padding: 6px 8px 0;
  }
  .captcha-label {
    font-size: 11px;
    padding: 5px 10px;
  }
  .captcha-image {
    padding: 8px;
  }
  .captcha-bottom {
    padding: 8px;
    gap: 8px;
  }
  .answer-area {
    flex-basis: 100%;
  }
  #answerInput {
    max-width: none;
  }
  .brand {
    width: 100%;
    font-size: 12px;
    text-align: right;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
    gap: 4px;
  }
  .brand-icons {
    margin-top: 0;
    display: flex;
    align-items: center;
  }
  .message {
    font-size: 12px;
  }

  /* popup intro */
  .popup-card {
    margin: 14px;
    border-radius: 16px;
  }
  .popup-emoji {
    font-size: 40px;
  }
  .popup-card h2 {
    font-size: 20px;
  }
  .popup-card p {
    font-size: 14px;
  }
  .popup-card button {
    font-size: 14px;
    padding: 12px 22px;
  }

  /* amplop — skala ikut lebar layar */
  .envelope {
    width: min(280px, 76vw);
    height: min(180px, 49vw);
  }
  .envelope .seal {
    width: 44px;
    height: 44px;
    font-size: 20px;
  }
  .hint {
    font-size: 14px;
    margin-top: 14px;
  }
  .letter-card {
    gap: 10px;
    padding: 0 8px;
  }
  #btnTutupLetter {
    padding: 9px 18px;
    font-size: 13px;
  }

  /* tombol jalan & masuk — jangan lebih lebar dari layar */
  #btnJalan,
  #btnMasukRumah {
    max-width: min(180px, 80vw);
    white-space: nowrap;
    padding: 10px 16px;
    font-size: 13px;
  }
}

/* HP kecil banget (≤360px) */
@media (max-width: 360px) {
  #btnJalan,
  #btnMasukRumah {
    font-size: 12px;
    padding: 10px 14px;
  }
  .anim-btns button {
    font-size: 12px;
    padding: 8px 12px;
  }
  .popup-card h2 {
    font-size: 18px;
  }
  .sb-blob h2 {
    font-size: 14px;
  }
  #letterText {
    font-size: 9px;
  }
}

/* Tablet portrait: beri ruang cukup sebelum kontrol turun baris. */
@media (min-width: 481px) and (max-width: 700px) {
  .captcha-bottom {
    align-items: center;
  }

  .answer-area {
    flex-basis: 220px;
  }
}

/* jarak aman untuk HP ber-notch (home bar) */
@supports (padding: env(safe-area-inset-bottom)) {
  #btnJalan,
  #btnMasukRumah {
    margin-bottom: env(safe-area-inset-bottom);
  }
}

/* perangkat touch: matikan efek hover yang bikin "nyangkut" */
@media (hover: none) {
  #btnJalan:hover,
  #btnMasukRumah:hover,
  .anim-btns button:hover,
  .pilihan button:hover,
  .house-final button:hover,
  #btnTutupLetter:hover,
  .popup-card button:hover,
  #btnSkipDialog:hover {
    transform: none;
  }
  .envelope:hover {
    transform: none;
  }
  .pilihan button:active {
    transform: scale(0.97);
  }
  .house-final button:active {
    transform: scale(0.97);
  }
}

/* tablet portrait — scrapbook & dialog sedikit lebih lega */
@media (min-width: 601px) and (max-width: 1024px) {
  .scrapbook {
    width: min(860px, 90vw, 68vh);
  }
  .sb-blob h2 {
    font-size: clamp(18px, 2.6vw, 26px);
  }
  #letterText {
    font-size: clamp(11px, 1.8vw, 14px);
  }
  .envelope {
    width: 300px;
    height: 193px;
  }
}

/* landscape pendek di layar sempit (hp diputar) */
@media (max-width: 920px) and (max-height: 480px) {
  .scrapbook {
    /* ikut batasi berdasar tinggi agar tidak terpotong */
    width: min(80vw, 58vh);
  }
  .letter-card {
    max-height: 94vh;
    overflow-y: auto;
  }
  .envelope {
    width: min(220px, 40vh);
    height: min(140px, 26vh);
  }
  .hint {
    margin-top: 8px;
    font-size: 13px;
  }
  #btnJalan,
  #btnMasukRumah {
    bottom: 46px;
    padding: 9px 16px;
    font-size: 12px;
  }
  .anim-btns {
    bottom: 10px;
  }
  .dialog-wrap {
    bottom: 10px;
    width: 90vw;
  }
  .dialog-box {
    min-height: 70px;
    padding: 12px 14px 22px;
  }
  #dialogText {
    min-height: 36px;
    font-size: 14px;
  }
  .pilihan {
    bottom: 100px;
    gap: 8px;
  }
  .pilihan button {
    padding: 9px 12px;
    font-size: 12px;
  }
  .portrait {
    width: 48px;
  }
  .house-final {
    bottom: 12px;
  }
}

/* layar besar — jaga agar scrapbook tidak terlalu raksasa */
@media (min-width: 1600px) {
  .scrapbook {
    width: 860px;
  }
}
