/* ======================================================
   SCRAPBOOK COZY AESTHETIC STYLESHEET
   Theme: Warm Kraft Paper, Pastel Washi Tape, Polaroid Memories
   ====================================================== */

:root {
  /* Color Palette */
  --bg-canvas: #f9f6f0;
  --bg-paper: #ffffff;
  --bg-card: #fefcf9;
  --bg-craft: #efe6d5;
  --text-main: #362f2d;
  --text-muted: #746864;
  --text-light: #9e918c;
  
  --accent-rose: #d68087;
  --accent-sage: #7e9c85;
  --accent-terracotta: #cc7057;
  --accent-honey: #dfa143;
  --accent-sky: #7ba3b8;
  
  --washi-peach: rgba(235, 163, 145, 0.75);
  --washi-sage: rgba(162, 194, 168, 0.75);
  --washi-honey: rgba(240, 206, 133, 0.75);
  --washi-rose: rgba(228, 162, 175, 0.75);
  
  --shadow-sm: 0 2px 8px rgba(54, 47, 45, 0.06);
  --shadow-md: 0 8px 24px rgba(54, 47, 45, 0.08);
  --shadow-polaroid: 0 10px 25px -4px rgba(50, 40, 35, 0.12), 0 4px 10px -2px rgba(50, 40, 35, 0.06);
  --shadow-hover: 0 18px 36px -6px rgba(50, 40, 35, 0.18), 0 8px 16px -4px rgba(50, 40, 35, 0.08);

  /* Fonts */
  --font-handwriting: 'Caveat', cursive;
  --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-scribble: 'Reenie Beanie', cursive;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  color: var(--text-main);
  background-color: var(--bg-canvas);
  background-image: 
    radial-gradient(#e5ddd0 1.2px, transparent 1.2px), 
    radial-gradient(#e8dfd3 1.2px, #f9f6f0 1.2px);
  background-size: 32px 32px;
  background-position: 0 0, 16px 16px;
  line-height: 1.65;
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
  touch-action: manipulation;
}

button, a, input, select, textarea, [role="button"] {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* ======================================================
   TOP CONTROL / NAVIGATION BAR
   ====================================================== */
.top-nav-bar {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid rgba(220, 208, 192, 0.7);
  box-shadow: 0 6px 20px rgba(54, 47, 45, 0.08);
  max-width: 95vw;
}

.music-controller, .action-controller {
  display: flex;
  align-items: center;
  gap: 8px;
}

.volume-slider-wrap {
  display: flex;
  align-items: center;
  width: 70px;
}

.volume-slider-wrap input[type="range"] {
  width: 100%;
  accent-color: var(--accent-terracotta);
  cursor: pointer;
  height: 4px;
}

.music-info-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fbf5ec;
  border: 1px solid #ebd8c2;
  border-radius: 999px;
  padding: 4px 12px;
  max-width: 240px;
  overflow: hidden;
  white-space: nowrap;
}

.music-equalizer {
  display: inline-flex;
  align-items: flex-end;
  gap: 2.5px;
  height: 12px;
  flex-shrink: 0;
}

.music-equalizer span {
  width: 2.5px;
  height: 4px;
  background: var(--accent-terracotta);
  border-radius: 1px;
}

.music-controller.is-playing .music-equalizer span:nth-child(1) {
  animation: eq-bar 0.8s ease-in-out infinite alternate;
}
.music-controller.is-playing .music-equalizer span:nth-child(2) {
  animation: eq-bar 0.5s ease-in-out 0.2s infinite alternate;
}
.music-controller.is-playing .music-equalizer span:nth-child(3) {
  animation: eq-bar 0.9s ease-in-out 0.35s infinite alternate;
}

@keyframes eq-bar {
  0% { height: 3px; }
  100% { height: 12px; }
}

.music-title-marquee {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--accent-terracotta);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  font-family: var(--font-heading);
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
  background: var(--accent-terracotta);
  color: #ffffff;
  white-space: nowrap;
}

.pill-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(204, 112, 87, 0.3);
}

.pill-btn.secondary {
  background: #ffffff;
  color: var(--text-main);
  border: 1px solid #e2d7c7;
}

.pill-btn.secondary:hover {
  background: #fdfaf5;
  border-color: var(--accent-rose);
  box-shadow: 0 4px 10px rgba(54, 47, 45, 0.06);
}

.pill-btn.outline {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid #e2d7c7;
  padding: 6px 10px;
}

.pill-btn.outline:hover {
  background: #efe7d9;
  color: var(--text-main);
}

.hidden {
  display: none !important;
}

.admin-controls-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

/* Edit Mode Activated Visual Indicator */
body.editing-active #editModeBtn {
  background: #27ae60;
  color: #fff;
  border-color: #219653;
  animation: pulse-green 1.5s infinite;
}

@keyframes pulse-green {
  0% { box-shadow: 0 0 0 0 rgba(39, 174, 96, 0.5); }
  70% { box-shadow: 0 0 0 8px rgba(39, 174, 96, 0); }
  100% { box-shadow: 0 0 0 0 rgba(39, 174, 96, 0); }
}

[contenteditable="true"] {
  outline: 2px dashed var(--accent-rose) !important;
  outline-offset: 4px;
  background-color: rgba(214, 128, 135, 0.06);
  border-radius: 4px;
  padding: 2px 6px;
  cursor: text;
}

/* ======================================================
   ENVELOPE INTRO OVERLAY
   ====================================================== */
.envelope-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: radial-gradient(circle at center, #faf4ec 0%, #ebd9c2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  transition: opacity 0.8s ease, visibility 0.8s ease;
}

.envelope-overlay.opened {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.envelope-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  perspective: 1200px;
}

.floating-badge {
  background: #ffffff;
  padding: 6px 18px;
  border-radius: 999px;
  font-family: var(--font-heading);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--accent-terracotta);
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
  animation: float-gentle 3s ease-in-out infinite;
}

@keyframes float-gentle {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.envelope {
  position: relative;
  width: 320px;
  height: 220px;
  background: #ecd5ba;
  border-radius: 10px;
  box-shadow: 0 20px 45px rgba(80, 50, 30, 0.18);
  cursor: pointer;
  transition: transform 0.4s ease;
}

.envelope:hover {
  transform: translateY(-4px);
}

.envelope-back {
  position: absolute;
  inset: 0;
  background: #e4c7a5;
  border-radius: 10px;
}

.envelope-letter-peek {
  position: absolute;
  left: 20px;
  right: 20px;
  top: 10px;
  height: 190px;
  background: #ffffff;
  border-radius: 6px;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  text-align: center;
  transition: transform 0.6s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

.peek-text {
  font-family: var(--font-handwriting);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--accent-terracotta);
  line-height: 1.4;
}

.envelope-front {
  position: absolute;
  inset: 0;
  border-left: 160px solid #dfbe9a;
  border-right: 160px solid #dfbe9a;
  border-bottom: 120px solid #d4ad85;
  border-top: 100px solid transparent;
  border-radius: 10px;
  pointer-events: none;
}

.envelope-flap {
  position: absolute;
  top: 0;
  left: 0;
  width: 0;
  height: 0;
  border-left: 160px solid transparent;
  border-right: 160px solid transparent;
  border-top: 125px solid #cb9e72;
  transform-origin: top center;
  transition: transform 0.6s ease;
  z-index: 5;
}

/* Wax Seal Button */
.wax-seal {
  position: absolute;
  top: 90px;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 70px;
  height: 70px;
  background: radial-gradient(circle at 35% 35%, #eb5e52 0%, #a82e25 100%);
  border-radius: 50%;
  box-shadow: 
    0 4px 15px rgba(168, 46, 37, 0.4), 
    inset 0 2px 4px rgba(255, 255, 255, 0.4),
    inset 0 -2px 4px rgba(0, 0, 0, 0.3);
  border: none;
  cursor: pointer;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.wax-seal:hover {
  transform: translate(-50%, -50%) scale(1.1);
}

.wax-seal:active {
  transform: translate(-50%, -50%) scale(0.95);
}

.seal-inner {
  font-family: var(--font-heading);
  font-size: 0.75rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: 1px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

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

.envelope.open .wax-seal {
  transform: translate(-50%, -150%) scale(0);
  opacity: 0;
}

.envelope.open .envelope-letter-peek {
  transform: translateY(-80px);
}

.envelope-hint {
  margin-top: 24px;
  font-size: 0.9rem;
  color: var(--text-muted);
  font-family: var(--font-heading);
}

/* ======================================================
   MAIN SCRAPBOOK CANVAS
   ====================================================== */
.scrapbook-canvas {
  max-width: 1020px;
  margin: 90px auto 60px auto;
  padding: 40px 30px;
  background: var(--bg-paper);
  border-radius: 20px;
  box-shadow: 
    0 1px 3px rgba(0,0,0,0.02),
    0 20px 60px rgba(70, 55, 45, 0.08);
  position: relative;
  border: 1px solid #ebd9c5;
}

/* Scrapbook Decorative Stickers */
.bg-tape {
  position: absolute;
  width: 130px;
  height: 36px;
  background: var(--washi-peach);
  opacity: 0.85;
  box-shadow: 0 2px 5px rgba(0,0,0,0.06);
  z-index: 2;
}

.bg-tape.top-left {
  top: -15px;
  left: 40px;
  transform: rotate(-4deg);
}

.bg-tape.top-right {
  top: -15px;
  right: 40px;
  transform: rotate(3deg);
  background: var(--washi-sage);
}

.bg-sticker {
  position: absolute;
  font-size: 1.8rem;
  user-select: none;
  opacity: 0.8;
  pointer-events: none;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.08));
}

.star-1 { top: 60px; right: 24px; transform: rotate(15deg); }
.star-2 { top: 220px; left: 16px; transform: rotate(-10deg); }
.heart-1 { top: 480px; right: 20px; transform: rotate(12deg); }
.coffee-cup { bottom: 180px; left: 18px; transform: rotate(-8deg); }
.plant-leaf { bottom: 60px; right: 30px; transform: rotate(20deg); }

/* ======================================================
   HEADER SECTION
   ====================================================== */
.scrapbook-header {
  text-align: center;
  padding: 20px 10px 40px 10px;
  position: relative;
}

.washi-tape-header {
  display: inline-block;
  background: var(--washi-honey);
  color: #614611;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 2px;
  padding: 4px 18px;
  transform: rotate(-1deg);
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
  margin-bottom: 16px;
}

.main-title {
  font-family: var(--font-heading);
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.25;
  margin-bottom: 12px;
  letter-spacing: -0.5px;
}

.subtitle {
  font-size: 1.15rem;
  color: var(--text-muted);
  max-width: 620px;
  margin: 0 auto 20px auto;
}

.mood-tracker-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #fbf5ea;
  border: 1px dashed #d5be9b;
  padding: 6px 16px;
  border-radius: 999px;
  font-size: 0.85rem;
  color: var(--text-main);
}

.mood-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #27ae60;
  box-shadow: 0 0 6px rgba(39, 174, 96, 0.6);
}

/* ======================================================
   HEARTFELT LETTER SECTION
   ====================================================== */
.letter-section {
  position: relative;
  margin: 20px 0 60px 0;
}

.tape-letter {
  position: absolute;
  top: -14px;
  left: 50%;
  transform: translateX(-50%) rotate(1deg);
  width: 140px;
  height: 32px;
  background: var(--washi-rose);
  opacity: 0.85;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
  z-index: 3;
}

.letter-card {
  background: #fffdf9;
  border: 1px solid #ebdccb;
  border-radius: 12px;
  padding: 45px 40px 35px 40px;
  box-shadow: var(--shadow-md);
  position: relative;
  background-image: repeating-linear-gradient(
    transparent,
    transparent 31px,
    #f3e8da 31px,
    #f3e8da 32px
  );
  line-height: 32px;
}

.letter-stamp {
  position: absolute;
  top: 25px;
  right: 30px;
  border: 2px dashed var(--accent-rose);
  padding: 4px 10px;
  text-align: center;
  transform: rotate(8deg);
  opacity: 0.85;
}

.letter-stamp span {
  display: block;
  font-family: var(--font-heading);
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--accent-rose);
  letter-spacing: 1px;
}

.letter-stamp small {
  display: block;
  font-size: 0.6rem;
  color: var(--accent-terracotta);
  font-weight: 700;
}

.letter-salutation {
  font-family: var(--font-handwriting);
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent-terracotta);
  margin-bottom: 20px;
  line-height: 1.2;
}

.letter-body {
  font-size: 1.08rem;
  color: var(--text-main);
}

.letter-body p {
  margin-bottom: 20px;
  text-indent: 1.5rem;
}

.letter-body strong {
  color: var(--accent-terracotta);
  font-weight: 600;
}

.letter-quote {
  font-family: var(--font-handwriting);
  font-size: 1.45rem !important;
  color: #794a3a !important;
  background: #fbf5ec;
  padding: 12px 20px;
  border-left: 4px solid var(--accent-honey);
  border-radius: 0 8px 8px 0;
  margin: 25px 0 !important;
  text-indent: 0 !important;
  line-height: 1.4;
}

.letter-signature {
  margin-top: 35px;
  text-align: right;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.sign-from {
  font-size: 0.95rem;
  color: var(--text-muted);
}

.sender-name {
  font-family: var(--font-handwriting);
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--accent-terracotta);
  margin-top: 4px;
}

/* ======================================================
   POLAROID GALLERY SECTION
   ====================================================== */
.gallery-section {
  margin: 50px 0 60px 0;
}

.section-title-wrap {
  text-align: center;
  margin-bottom: 30px;
}

.washi-tape-mini {
  display: inline-block;
  background: var(--washi-sage);
  color: #274d30;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.75rem;
  letter-spacing: 1.5px;
  padding: 3px 14px;
  transform: rotate(-1.5deg);
  margin-bottom: 10px;
}

.section-heading {
  font-family: var(--font-heading);
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 8px;
}

.section-sub {
  font-size: 1rem;
  color: var(--text-muted);
}

.photo-controls-bar {
  text-align: center;
  margin-bottom: 25px;
}

.helper-text {
  font-size: 0.85rem;
  color: var(--text-light);
}

/* Polaroid Grid */
.polaroid-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 36px 28px;
  padding: 20px 10px;
}

/* Individual Polaroid Card */
.polaroid-card {
  background: #ffffff;
  padding: 16px 16px 24px 16px;
  border-radius: 4px;
  box-shadow: var(--shadow-polaroid);
  position: relative;
  transition: all 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
  display: flex;
  flex-direction: column;
  cursor: pointer;
  border: 1px solid rgba(0, 0, 0, 0.05);
}

/* Dynamic tilts for realistic scrapbook look */
.polaroid-card:nth-child(6n + 1) { transform: rotate(-2.5deg); }
.polaroid-card:nth-child(6n + 2) { transform: rotate(1.8deg); }
.polaroid-card:nth-child(6n + 3) { transform: rotate(-1.5deg); }
.polaroid-card:nth-child(6n + 4) { transform: rotate(2.2deg); }
.polaroid-card:nth-child(6n + 5) { transform: rotate(-2deg); }
.polaroid-card:nth-child(6n + 6) { transform: rotate(1.4deg); }

.polaroid-card:hover {
  transform: scale(1.03) rotate(0deg) !important;
  box-shadow: var(--shadow-hover);
  z-index: 10;
}

/* Decorative Washi Tape on each polaroid */
.polaroid-card::before {
  content: '';
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%) rotate(-1deg);
  width: 90px;
  height: 24px;
  background: var(--washi-peach);
  opacity: 0.8;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  z-index: 2;
}

.polaroid-card:nth-child(even)::before {
  background: var(--washi-sage);
  transform: translateX(-50%) rotate(1.5deg);
}

.polaroid-card:nth-child(3n)::before {
  background: var(--washi-honey);
}

/* Photo Image Frame */
.polaroid-img-box {
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #f0ebe1;
  overflow: hidden;
  border-radius: 2px;
  position: relative;
}

.polaroid-img-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
  display: block;
}

.polaroid-card:hover .polaroid-img-box img {
  transform: scale(1.05);
}

/* Polaroid Action Overlay */
.polaroid-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.polaroid-card:hover .polaroid-overlay {
  opacity: 1;
}

.overlay-btn {
  background: rgba(255, 255, 255, 0.9);
  border: none;
  border-radius: 999px;
  padding: 6px 12px;
  font-family: var(--font-heading);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  transition: all 0.2s ease;
}

.overlay-btn:hover {
  background: #ffffff;
  color: var(--accent-terracotta);
  transform: scale(1.05);
}

/* Sisi Penerima (Non-Admin): Tombol Ganti dan Hapus disembunyikan sepenuhnya */
body:not(.is-admin) .polaroid-overlay .replace-btn,
body:not(.is-admin) .polaroid-overlay .delete-btn {
  display: none !important;
}

body:not(.is-admin) .polaroid-overlay {
  background: rgba(0, 0, 0, 0.22);
}

/* Polaroid Text area */
.polaroid-caption-area {
  padding-top: 14px;
  text-align: center;
}

.polaroid-title {
  font-family: var(--font-handwriting);
  font-size: 1.55rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 2px;
  line-height: 1.2;
}

.polaroid-sub {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.4;
  margin-top: 4px;
}

.polaroid-date {
  font-family: var(--font-scribble);
  font-size: 1.2rem;
  color: var(--text-light);
  margin-top: 6px;
  display: block;
}

/* ======================================================
   AFFIRMATION TOPLES SECTION (DAILY KINDNESS JAR)
   ====================================================== */
.affirmation-section {
  margin: 50px 0;
}

.jar-card {
  background: linear-gradient(135deg, #fbf7ee 0%, #f4eada 100%);
  border: 2px dashed #dacab5;
  border-radius: 16px;
  padding: 35px 30px;
  text-align: center;
  position: relative;
}

.tape-center {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  width: 120px;
  height: 28px;
  background: var(--washi-sage);
  opacity: 0.85;
}

.jar-icon {
  font-size: 2.2rem;
  display: block;
  margin-bottom: 10px;
}

.jar-header h2 {
  font-family: var(--font-heading);
  font-size: 1.6rem;
  color: var(--text-main);
  margin-bottom: 6px;
}

.jar-header p {
  color: var(--text-muted);
  font-size: 0.95rem;
  max-width: 500px;
  margin: 0 auto 20px auto;
}

.affirmation-box {
  background: #ffffff;
  border-radius: 12px;
  padding: 24px;
  max-width: 600px;
  margin: 0 auto 24px auto;
  box-shadow: var(--shadow-sm);
  border: 1px solid #ebd9c5;
  min-height: 110px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  transition: transform 0.3s ease;
}

.affirmation-box.popping {
  animation: pop-bounce 0.5s ease;
}

@keyframes pop-bounce {
  0% { transform: scale(0.92); opacity: 0.6; }
  50% { transform: scale(1.04); }
  100% { transform: scale(1); opacity: 1; }
}

.affirmation-text {
  font-family: var(--font-handwriting);
  font-size: 1.65rem;
  font-weight: 700;
  color: var(--accent-terracotta);
  line-height: 1.35;
  margin-bottom: 8px;
}

.affirmation-tag {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent-sage);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.draw-btn {
  background: var(--accent-terracotta);
  color: #fff;
  border: none;
  padding: 12px 28px;
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(204, 112, 87, 0.35);
  transition: all 0.25s ease;
}

.draw-btn:hover {
  background: #b85c45;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(204, 112, 87, 0.45);
}

/* ======================================================
   SELF CARE CHECKLIST
   ====================================================== */
.self-care-section {
  margin: 50px 0;
}

.checklist-card {
  background: #fffdf9;
  border: 1px solid #e9d9c6;
  border-radius: 14px;
  padding: 30px;
  box-shadow: var(--shadow-sm);
  position: relative;
  max-width: 650px;
  margin: 0 auto;
}

.pin-drop {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  width: 22px;
  height: 22px;
  background: radial-gradient(circle at 35% 35%, #e74c3c 0%, #962d22 100%);
  border-radius: 50%;
  box-shadow: 0 3px 6px rgba(0,0,0,0.25);
}

.checklist-card h3 {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  color: var(--text-main);
  text-align: center;
  margin-bottom: 4px;
}

.checklist-sub {
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.checklist-items {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.check-item {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  font-size: 0.95rem;
  user-select: none;
  padding: 6px 10px;
  border-radius: 6px;
  transition: background 0.2s ease;
}

.check-item:hover {
  background: #fbf5eb;
}

.check-item input[type="checkbox"] {
  display: none;
}

.checkmark {
  width: 20px;
  height: 20px;
  border: 2px solid #d5be9b;
  border-radius: 4px;
  position: relative;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.check-item input:checked ~ .checkmark {
  background: var(--accent-sage);
  border-color: var(--accent-sage);
}

.check-item input:checked ~ .checkmark::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}

.check-item input:checked ~ .text {
  text-decoration: line-through;
  color: var(--text-light);
}

/* ======================================================
   FOOTER
   ====================================================== */
.scrapbook-footer {
  text-align: center;
  padding-top: 30px;
  border-top: 1px dashed #e5d5be;
  margin-top: 50px;
  position: relative;
}

.footer-love {
  font-family: var(--font-handwriting);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent-terracotta);
  margin-bottom: 6px;
}

.footer-tip {
  font-size: 0.8rem;
  color: var(--text-light);
}

/* ======================================================
   LIGHTBOX MODAL
   ====================================================== */
.lightbox-modal {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.lightbox-modal.active {
  opacity: 1;
  visibility: visible;
}

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(30, 24, 22, 0.75);
  backdrop-filter: blur(8px);
}

.lightbox-content {
  position: relative;
  z-index: 1;
  max-width: 520px;
  width: 90vw;
}

.lightbox-close {
  position: absolute;
  top: -40px;
  right: 0;
  background: transparent;
  border: none;
  font-size: 2.2rem;
  color: #ffffff;
  cursor: pointer;
}

.lightbox-polaroid {
  background: #ffffff;
  padding: 18px 18px 24px 18px;
  border-radius: 6px;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.35);
  text-align: center;
  animation: zoom-in 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

@keyframes zoom-in {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.lightbox-img-wrapper {
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: #eee;
  border-radius: 3px;
}

.lightbox-img-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.lightbox-details {
  padding-top: 16px;
}

.lightbox-date {
  font-family: var(--font-scribble);
  font-size: 1.3rem;
  color: var(--text-light);
}

.lightbox-caption {
  font-family: var(--font-handwriting);
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--accent-terracotta);
  margin: 2px 0 6px 0;
}

.lightbox-note {
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ======================================================
   CUSTOM MODAL (ADD PHOTO)
   ====================================================== */
.custom-modal {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.custom-modal.active {
  opacity: 1;
  visibility: visible;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(30, 24, 22, 0.6);
  backdrop-filter: blur(5px);
}

.modal-card {
  position: relative;
  z-index: 1;
  background: #ffffff;
  border-radius: 16px;
  padding: 30px;
  max-width: 480px;
  width: 90vw;
  box-shadow: 0 20px 40px rgba(0,0,0,0.2);
}

.modal-close {
  position: absolute;
  top: 15px;
  right: 18px;
  background: transparent;
  border: none;
  font-size: 1.8rem;
  color: var(--text-light);
  cursor: pointer;
}

.modal-card h3 {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  color: var(--text-main);
  margin-bottom: 6px;
}

.modal-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.modal-form .form-group {
  margin-bottom: 16px;
}

.modal-form label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 6px;
}

.modal-form input[type="text"],
.modal-form textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #dcd1c2;
  border-radius: 8px;
  font-family: var(--font-body);
  font-size: 0.9rem;
  background: #fbf9f5;
  transition: border-color 0.2s ease;
}

.modal-form input[type="text"]:focus,
.modal-form textarea:focus {
  outline: none;
  border-color: var(--accent-terracotta);
  background: #ffffff;
}

.file-dropzone {
  border: 2px dashed #d5c7b3;
  border-radius: 8px;
  padding: 20px;
  text-align: center;
  background: #faf6f0;
  cursor: pointer;
  position: relative;
}

.file-dropzone:hover {
  border-color: var(--accent-terracotta);
  background: #fbf2ea;
}

.file-dropzone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.dropzone-icon {
  font-size: 1.8rem;
  display: block;
  margin-bottom: 4px;
}

.preview-wrap {
  margin-top: 10px;
  text-align: center;
}

.preview-wrap.hidden {
  display: none;
}

.preview-wrap img {
  max-width: 100%;
  max-height: 160px;
  border-radius: 6px;
  object-fit: cover;
  border: 2px solid #ebd9c5;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
}

/* ======================================================
   TOAST NOTIFICATION
   ====================================================== */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: #362f2d;
  color: #fff;
  padding: 10px 22px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 500;
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
  transition: transform 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28);
  z-index: 4000;
  pointer-events: none;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
}

/* ======================================================
   FOOTER ADMIN LINK & LOGIN MODAL
   ====================================================== */
.footer-admin-area {
  margin-top: 14px;
}

.admin-toggle-link {
  background: transparent;
  border: 1px dashed rgba(160, 140, 125, 0.45);
  color: var(--text-light);
  font-size: 0.8rem;
  padding: 5px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.25s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-heading);
}

.admin-toggle-link:hover {
  color: var(--accent-terracotta);
  border-color: var(--accent-terracotta);
  background: #ffffff;
  box-shadow: var(--shadow-sm);
}

.admin-login-card {
  max-width: 440px;
}

.admin-modal-header {
  text-align: center;
  margin-bottom: 16px;
}

.admin-badge-icon {
  font-size: 2.2rem;
  display: block;
  margin-bottom: 6px;
}

.pin-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 6px;
}

.login-error {
  background: #fdf2f2;
  border: 1px solid #f8d7da;
  color: #c0392b;
  font-size: 0.82rem;
  padding: 8px 12px;
  border-radius: 6px;
  margin-bottom: 14px;
  text-align: center;
}

/* ======================================================
   PRINT STYLES (PDF / Cetak Kenangan)
   ====================================================== */
@media print {
  .top-nav-bar,
  .envelope-overlay,
  .photo-controls-bar,
  .affirmation-section,
  .self-care-section,
  .custom-modal,
  .lightbox-modal,
  .toast,
  .polaroid-overlay {
    display: none !important;
  }

  body {
    background: #ffffff !important;
    color: #000000 !important;
  }

  .scrapbook-canvas {
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    box-shadow: none !important;
    border: none !important;
  }

  .polaroid-card {
    break-inside: avoid;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1) !important;
    transform: none !important;
  }
}

/* ======================================================
   RESPONSIVE DESIGN (TABLET & SMARTPHONES)
   ====================================================== */

/* Tablets & Mobile Devices (<= 768px) */
@media (max-width: 768px) {
  html, body {
    overflow-x: hidden;
  }

  /* Top Navigation Bar */
  .top-nav-bar {
    width: calc(100% - 20px);
    max-width: 520px;
    top: max(10px, env(safe-area-inset-top, 10px));
    padding: 6px 10px;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: space-between;
  }

  .volume-slider-wrap {
    display: none;
  }

  .music-info-pill {
    max-width: 140px;
    padding: 3px 8px;
  }

  .music-title-marquee {
    font-size: 0.72rem;
  }

  .pill-btn {
    padding: 6px 10px;
    font-size: 0.78rem;
  }

  /* Admin Toolbar on Mobile: Horizontal scrollable pill bar */
  .admin-controls-wrap {
    width: 100%;
    justify-content: flex-start;
    overflow-x: auto;
    padding-top: 6px;
    margin-top: 4px;
    border-top: 1px dashed rgba(220, 208, 192, 0.7);
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .admin-controls-wrap::-webkit-scrollbar {
    display: none;
  }

  /* Scrapbook Canvas */
  .scrapbook-canvas {
    margin: calc(env(safe-area-inset-top, 0px) + 74px) 10px 30px 10px;
    padding: 24px 14px 28px 14px;
    border-radius: 16px;
  }

  /* Washi Tapes */
  .bg-tape {
    width: 80px;
    height: 24px;
    top: -10px;
  }
  .bg-tape.top-left { left: 16px; }
  .bg-tape.top-right { right: 16px; }

  /* Subtle Stickers (Resized & repositioned so they don't cover text) */
  .bg-sticker {
    font-size: 1.25rem;
    opacity: 0.45;
  }
  .star-1 { top: 30px; right: 10px; }
  .star-2 { top: 180px; left: 8px; }
  .heart-1 { top: 400px; right: 10px; }
  .coffee-cup { bottom: 120px; left: 8px; }
  .plant-leaf { bottom: 40px; right: 12px; }

  /* Header Section */
  .scrapbook-header {
    padding: 10px 4px 28px 4px;
  }

  .washi-tape-header {
    font-size: 0.72rem;
    padding: 3px 12px;
    margin-bottom: 10px;
  }

  .main-title {
    font-size: 1.68rem;
    line-height: 1.28;
    margin-bottom: 8px;
    word-break: break-word;
  }

  .subtitle {
    font-size: 0.92rem;
    line-height: 1.5;
    margin-bottom: 14px;
  }

  .mood-tracker-badge {
    font-size: 0.78rem;
    padding: 5px 12px;
    white-space: normal;
    text-align: center;
  }

  /* Handwritten Letter */
  .letter-section {
    margin: 15px 0 45px 0;
  }

  .tape-letter {
    width: 100px;
    height: 24px;
    top: -10px;
  }

  .letter-card {
    padding: 26px 16px 22px 16px;
    line-height: 28px;
    background-size: 100% 28px;
  }

  .letter-stamp {
    position: static;
    float: right;
    margin: 0 0 8px 10px;
    padding: 2px 8px;
    transform: rotate(4deg) scale(0.9);
  }

  .letter-salutation {
    font-size: 1.55rem;
    margin-bottom: 12px;
  }

  .letter-body {
    font-size: 0.98rem;
    clear: both;
  }

  .letter-body p {
    margin-bottom: 16px;
    text-indent: 1rem;
  }

  .letter-quote {
    font-size: 1.15rem !important;
    padding: 10px 14px;
    margin: 18px 0 !important;
    border-left-width: 3px;
  }

  .letter-signature {
    margin-top: 24px;
  }

  .sender-name {
    font-size: 1.45rem;
  }

  /* Polaroid Gallery */
  .gallery-section {
    margin: 35px 0 45px 0;
  }

  .section-title-wrap {
    margin-bottom: 20px;
  }

  .section-heading {
    font-size: 1.55rem;
    line-height: 1.3;
  }

  .section-sub {
    font-size: 0.88rem;
  }

  .polaroid-grid {
    grid-template-columns: 1fr;
    gap: 24px;
    padding: 10px 2px;
  }

  /* Subtle tilts on mobile to prevent clipping */
  .polaroid-card:nth-child(odd) {
    transform: rotate(-0.8deg) !important;
  }
  .polaroid-card:nth-child(even) {
    transform: rotate(0.8deg) !important;
  }
  .polaroid-card:active {
    transform: scale(1.01) rotate(0deg) !important;
  }

  .polaroid-card {
    padding: 12px 12px 18px 12px;
  }

  .polaroid-card::before {
    width: 70px;
    height: 18px;
    top: -9px;
  }

  .polaroid-title {
    font-size: 1.35rem;
  }

  .polaroid-sub {
    font-size: 0.82rem;
    line-height: 1.45;
  }

  .polaroid-date {
    font-size: 1.05rem;
  }

  /* Touch overlay behavior for Admin mode on mobile */
  body.is-admin .polaroid-overlay {
    opacity: 1;
    background: linear-gradient(to top, rgba(0,0,0,0.68) 0%, rgba(0,0,0,0.2) 60%, transparent 100%);
    align-items: flex-end;
    padding-bottom: 8px;
  }

  body.is-admin .polaroid-overlay .overlay-btn {
    padding: 6px 10px;
    font-size: 0.72rem;
  }

  /* Affirmation Jar */
  .affirmation-section {
    margin: 35px 0;
  }

  .jar-card {
    padding: 24px 14px;
    border-radius: 14px;
  }

  .tape-center {
    width: 90px;
    height: 22px;
    top: -10px;
  }

  .jar-icon {
    font-size: 1.8rem;
    margin-bottom: 4px;
  }

  .jar-header h2 {
    font-size: 1.35rem;
  }

  .jar-header p {
    font-size: 0.85rem;
    margin-bottom: 14px;
  }

  .affirmation-box {
    padding: 16px 12px;
    min-height: 85px;
    margin-bottom: 18px;
  }

  .affirmation-text {
    font-size: 1.28rem;
    line-height: 1.35;
  }

  .draw-btn {
    width: 100%;
    padding: 12px 16px;
    font-size: 0.9rem;
  }

  /* Self Care Checklist */
  .self-care-section {
    margin: 35px 0;
  }

  .checklist-card {
    padding: 22px 14px;
  }

  .checklist-card h3 {
    font-size: 1.18rem;
  }

  .checklist-sub {
    font-size: 0.8rem;
    margin-bottom: 14px;
  }

  .check-item {
    min-height: 44px;
    padding: 8px 10px;
    font-size: 0.88rem;
    gap: 10px;
    border-radius: 8px;
  }

  .checkmark {
    width: 22px;
    height: 22px;
  }

  /* Footer */
  .scrapbook-footer {
    margin-top: 35px;
    padding-top: 24px;
  }

  .footer-love {
    font-size: 1.25rem;
  }

  .admin-toggle-link {
    font-size: 0.78rem;
    padding: 6px 14px;
  }

  /* Lightbox Modal on Mobile */
  .lightbox-content {
    width: calc(100vw - 28px);
    max-width: 380px;
  }

  .lightbox-close {
    top: 8px;
    right: 8px;
    width: 36px;
    height: 36px;
    background: rgba(30, 24, 22, 0.7);
    border-radius: 50%;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    z-index: 10;
  }

  .lightbox-polaroid {
    padding: 12px 12px 16px 12px;
  }

  .lightbox-caption {
    font-size: 1.4rem;
  }

  .lightbox-note {
    font-size: 0.88rem;
  }

  /* Form & Modals on Mobile */
  .modal-card {
    width: calc(100vw - 28px);
    max-width: 400px;
    padding: 20px 14px;
    max-height: 88vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Prevent iOS Safari auto-zooming on focus: min font-size 16px */
  .modal-form input[type="text"],
  .modal-form input[type="password"],
  .modal-form textarea {
    font-size: 16px !important;
  }

  .modal-actions {
    flex-direction: column-reverse;
    gap: 8px;
  }

  .modal-actions .pill-btn {
    width: 100%;
    justify-content: center;
    padding: 10px 14px;
  }

  .file-dropzone {
    padding: 14px;
  }

  /* Toast notification */
  .toast {
    width: auto;
    max-width: 90vw;
    text-align: center;
    font-size: 0.82rem;
    padding: 9px 18px;
    bottom: 18px;
  }
}

/* Small Smartphone Screens (e.g. iPhone 12/13/14 Mini, SE, Galaxy / <= 480px) */
@media (max-width: 480px) {
  .envelope-container {
    transform: scale(0.92);
    transform-origin: center center;
  }

  .envelope-hint {
    font-size: 0.85rem;
    padding: 0 16px;
    text-align: center;
  }

  .music-info-pill {
    max-width: 120px;
  }

  .music-title-marquee {
    max-width: 90px;
  }

  .scrapbook-canvas {
    margin-top: calc(env(safe-area-inset-top, 0px) + 68px);
    margin-left: 6px;
    margin-right: 6px;
    padding: 20px 12px 24px 12px;
  }

  .main-title {
    font-size: 1.55rem;
  }

  .letter-salutation {
    font-size: 1.45rem;
  }

  .sender-name {
    font-size: 1.35rem;
  }
}

/* Extra Small Smartphones (<= 380px) */
@media (max-width: 380px) {
  .envelope-container {
    transform: scale(0.84);
    transform-origin: center center;
  }

  .envelope-hint {
    font-size: 0.8rem;
    padding: 0 10px;
  }

  .top-nav-bar {
    padding: 5px 6px;
  }

  .music-info-pill {
    max-width: 95px;
    padding: 2px 6px;
  }

  .music-title-marquee {
    font-size: 0.68rem;
  }

  .main-title {
    font-size: 1.4rem;
  }

  .letter-card {
    padding: 22px 12px 18px 12px;
  }

  .letter-salutation {
    font-size: 1.35rem;
  }

  .letter-quote {
    font-size: 1.08rem !important;
    padding: 8px 12px;
  }

  .polaroid-title {
    font-size: 1.25rem;
  }
}

/* Very Narrow Devices (<= 330px) */
@media (max-width: 330px) {
  .envelope-container {
    transform: scale(0.76);
    transform-origin: center center;
  }

  .main-title {
    font-size: 1.28rem;
  }
}
