@import url('https://fonts.googleapis.com/css2?family=Great+Vibes&family=Poppins:wght@300;400;500;600&display=swap');

:root{
  --pink: #e7a2b6;
  --pink-dark: #c96f8c;
  --gold: #d8b05a;
  --cream: #fbf3e7;
  --ink: #4a3a3f;
  --green: #4d6b4a;
}

*{ box-sizing: border-box; }

html,body{
  margin:0; padding:0;
  height:100%;
  font-family:'Poppins', sans-serif;
  color: var(--ink);
  background: var(--cream);
  overflow:auto;
}

.hidden{ display:none !important; }

kbd{
  background:#fff; border:1px solid #ccc; border-bottom-width:2px;
  border-radius:4px; padding:1px 6px; font-size:.8em; font-family:inherit;
}

/* ================= COVER ================= */
#cover{
  height:100%;
  display:flex; align-items:center; justify-content:center;
  background:
    radial-gradient(circle at 20% 20%, rgba(255,255,255,.5), transparent 40%),
    linear-gradient(160deg, #f7d9e3 0%, #f3e3c8 55%, #e9d6a8 100%);
  text-align:center;
  position:relative;
}
.cover-inner{ padding:24px; }
.cover-hearts{ font-size:2rem; margin-bottom:4px; }
.cover-kepada{ font-size:.85rem; letter-spacing:.05em; opacity:.75; margin:0; }
.cover-guest{
  font-family:'Great Vibes', cursive;
  font-size:2.4rem; color:var(--pink-dark);
  margin:2px 0 22px;
}
.envelope-scene{
  position:relative;
  width:220px; height:220px;
  margin:0 auto;
  display:flex; align-items:center; justify-content:center;
}
.envelope{
  width:200px; height:130px;
  position:relative; cursor:pointer;
  filter: drop-shadow(0 10px 18px rgba(0,0,0,.18));
  transition: transform .25s;
}
.envelope:hover{ transform: translateY(-4px); }

.letter{
  position:absolute;
  left:14px; right:14px; top:8px;
  height:104px;
  background: linear-gradient(180deg, #fffdf8, #fbeef2);
  border:2px solid var(--gold);
  border-radius:6px;
  display:flex; flex-direction:column; align-items:center; justify-content:center;
  gap:4px;
  z-index:1;
  opacity:0;
  transform: translateY(0) scale(.85);
  transition: transform .1s, opacity .1s;
}
.letter.show{
  opacity:1;
  transform: translateY(-92px) scale(1.04) rotate(-1.5deg);
  transition: transform .65s cubic-bezier(.2,.8,.25,1.15), opacity .35s ease;
}
.letter-monogram{
  font-family:'Great Vibes', cursive;
  font-size:1.9rem; color:var(--pink-dark);
}
.letter-sub{ font-size:.62rem; letter-spacing:.08em; opacity:.6; margin:0; text-transform:uppercase; }

.envelope-pocket{
  position:absolute; inset:0;
  background: linear-gradient(180deg, #fdf6ee, #fbeef2);
  border:2px solid var(--gold);
  border-radius:6px;
  z-index:2;
  box-shadow: inset 0 -2px 6px rgba(0,0,0,.04);
}
/* jahitan tepi bawah pocket, kesan lipatan amplop asli */
.envelope-pocket::after{
  content:"";
  position:absolute; left:6%; right:6%; bottom:8px; height:2px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  opacity:.5;
}
.envelope-flap{
  position:absolute; top:-2px; left:-2px; right:-2px; height:82px;
  background: linear-gradient(160deg, var(--pink) 0%, var(--pink-dark) 100%);
  clip-path: polygon(0 0, 50% 88%, 100% 0);
  border-radius:6px 6px 0 0;
  transform-origin: top center;
  transition: transform .55s cubic-bezier(.4,0,.2,1);
  z-index:3;
  backface-visibility:hidden;
  box-shadow: 0 2px 3px rgba(0,0,0,.08);
}
.envelope.open .envelope-flap{ transform: rotateX(178deg); }

.envelope-seal{
  position:absolute; left:50%; top:66px; transform:translate(-50%,-50%);
  width:34px; height:34px; border-radius:50%;
  background:#fff; border:2px solid var(--gold);
  display:flex; align-items:center; justify-content:center;
  font-size:1rem; z-index:4;
  transition: transform .3s ease, opacity .3s ease;
}
.envelope.open .envelope-seal{
  transform: translate(-50%,-50%) scale(0) rotate(50deg);
  opacity:0;
}

.hearts-burst{
  position:absolute; inset:0; pointer-events:none; z-index:5;
  overflow:visible;
}
.heart-particle{
  position:absolute; left:50%; top:55%;
  font-size:1rem; opacity:0;
  animation: heartFloat 1.1s ease-out forwards;
}
@keyframes heartFloat{
  0%{ opacity:0; transform: translate(-50%,-50%) scale(.4); }
  15%{ opacity:1; }
  100%{ opacity:0; transform: translate(calc(-50% + var(--hx,0px)), calc(-50% - 90px)) scale(1.1) rotate(var(--hr,10deg)); }
}

.cover-hint{ margin-top:18px; font-size:.8rem; opacity:.65; animation: pulse 1.8s infinite; }
@keyframes pulse{ 0%,100%{opacity:.4} 50%{opacity:.9} }
.cover-error{ max-width:280px; margin:0 auto 20px; }
.cover-error p{ font-size:.85rem; margin:4px 0; }
.cover-error .small{ font-size:.75rem; opacity:.75; }
.cover-error a, .cover-make-own a{ color: var(--pink-dark); font-weight:500; }
.cover-make-own{ margin-top:26px; font-size:.72rem; opacity:.8; }

/* ================= GAME SCREEN ================= */
#game-screen{
  height:100%;
  display:flex; flex-direction:column;
  background: linear-gradient(180deg,#dff0e0,#cfe6d4);
}
.topbar{
  display:flex; align-items:center; justify-content:space-between;
  padding:10px 16px;
  background: rgba(255,255,255,.85);
  border-bottom:2px solid var(--gold);
}
.couple-names{
  font-family:'Great Vibes', cursive;
  font-size:1.6rem; color:var(--pink-dark);
}
.couple-names span{ color:var(--gold); margin:0 4px; }
.countdown{ font-size:.75rem; font-weight:500; text-align:center; flex:1; }
.icon-btn{
  border:none; background:none; font-size:1.2rem; cursor:pointer;
}

.stage{
  position:relative;
  flex:1;
  display:flex; align-items:center; justify-content:center;
  overflow:hidden;
  background:#274a2c;
}
#gameCanvas{
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  border:3px solid var(--gold);
  box-shadow:0 6px 20px rgba(0,0,0,.35);
  max-width:100%; max-height:100%;
}
.prompt{
  position:absolute; bottom:14px; left:50%; transform:translateX(-50%);
  background: rgba(0,0,0,.75); color:#fff;
  padding:6px 14px; border-radius:20px; font-size:.8rem;
  pointer-events:none;
}

.howto{
  text-align:center; font-size:.72rem; opacity:.7; margin:6px 0;
}

/* d-pad (mobile) */
.dpad{
  display:none;
  position:relative;
  height:130px;
  margin:0 auto 8px;
  width:230px;
}
.dpad button{
  position:absolute; width:44px; height:44px;
  border-radius:10px; border:none;
  background: rgba(255,255,255,.9); box-shadow:0 2px 5px rgba(0,0,0,.25);
  font-size:1.1rem; color:var(--pink-dark);
}
.dpad button[data-dir="up"]{ top:0; left:68px; }
.dpad button[data-dir="left"]{ top:44px; left:22px; }
.dpad button[data-dir="down"]{ top:88px; left:68px; }
.dpad button[data-dir="right"]{ top:44px; left:114px; }
.dpad .action{
  position:absolute; top:39px; left:174px; width:52px; height:52px;
  border-radius:50%; background:var(--pink-dark); color:#fff; font-size:1.3rem;
  border:none;
}
@media (hover:none) and (pointer:coarse){
  .dpad{ display:block; }
}

.quicknav{
  display:flex; flex-wrap:wrap; gap:6px; justify-content:center;
  padding:8px 10px 14px;
}
.quicknav button{
  border:1px solid var(--gold); background:#fff;
  color:var(--ink); border-radius:16px;
  padding:6px 12px; font-size:.72rem; cursor:pointer;
}
.quicknav button:hover{ background: var(--pink); color:#fff; }

/* ================= MODAL ================= */
.modal-overlay{
  position:fixed; inset:0; background:rgba(30,20,20,.55);
  display:flex; align-items:center; justify-content:center;
  padding:20px; z-index:50;
  animation: fadeIn .2s ease;
}
@keyframes fadeIn{ from{opacity:0} to{opacity:1} }
.modal{
  background: var(--cream);
  border:2px solid var(--gold);
  border-radius:14px;
  max-width:420px; width:100%;
  max-height:86vh; overflow-y:auto;
  padding:26px 22px 22px;
  position:relative;
  box-shadow:0 20px 50px rgba(0,0,0,.35);
}
.modal-close{
  position:absolute; top:10px; right:10px;
  border:none; background:none; font-size:1.1rem; cursor:pointer; color:var(--ink);
}
.modal-content h3{
  font-family:'Great Vibes', cursive; font-size:1.9rem; color:var(--pink-dark);
  margin:0 0 4px;
}
.modal-content p{ font-size:.85rem; line-height:1.55; }
.modal-content .badge{
  display:inline-block; background:var(--pink); color:#fff;
  font-size:.68rem; padding:2px 10px; border-radius:10px; margin-bottom:8px;
}
.timeline{ list-style:none; padding:0; margin:10px 0; }
.timeline li{
  border-left:2px solid var(--gold); padding:2px 0 14px 14px; font-size:.82rem; position:relative;
}
.timeline li::before{
  content:''; position:absolute; left:-6px; top:4px;
  width:9px; height:9px; border-radius:50%; background:var(--pink-dark);
}
.gallery-grid{
  display:grid; grid-template-columns:repeat(3,1fr); gap:6px; margin-top:10px;
}
.gallery-grid div{
  aspect-ratio:1; border-radius:8px;
  display:flex; align-items:center; justify-content:center;
  font-size:1.4rem; color:#fff;
}
form.rsvp{ display:flex; flex-direction:column; gap:10px; margin-top:12px; }
form.rsvp input, form.rsvp select, form.rsvp textarea{
  border:1px solid #d9c6a8; border-radius:8px; padding:8px 10px; font-family:inherit; font-size:.85rem;
}
form.rsvp button{
  background: var(--pink-dark); color:#fff; border:none; border-radius:20px;
  padding:10px; font-weight:500; cursor:pointer;
}
.gift-box{
  background:#fff; border:1px dashed var(--gold); border-radius:10px;
  padding:10px 12px; font-size:.8rem; margin-top:8px;
}
.copy-btn{
  border:1px solid var(--gold); background:#fff; border-radius:14px;
  font-size:.7rem; padding:3px 10px; cursor:pointer; margin-left:6px;
}
.rsvp-list{ margin-top:14px; font-size:.75rem; max-height:110px; overflow-y:auto; }
.rsvp-list div{ padding:4px 0; border-bottom:1px solid #eadfc6; }
.map-embed{
  width:100%; height:160px; border-radius:10px; border:1px solid var(--gold);
  margin-top:8px; overflow:hidden;
}
.map-embed iframe{ width:100%; height:100%; border:0; }

.calendar-btn{
  display:inline-block; margin-top:12px;
  background:var(--gold); color:#4a3a1a; border:none;
  border-radius:20px; padding:10px 18px; font-size:.82rem; font-weight:500; cursor:pointer;
}
.calendar-btn:hover{ opacity:.9; }

/* ================= UCAPAN & DOA (gaya group chat) ================= */
.chat-list{
  display:flex; flex-direction:column; gap:10px; margin-top:10px;
  max-height:360px; overflow-y:auto; padding-right:2px;
}
.chat-bubble{
  background:#fff; border:1px solid #eadfc6; border-radius:12px;
  padding:10px 12px; font-size:.82rem;
  box-shadow:0 2px 6px rgba(0,0,0,.04);
}
.chat-bubble-head{
  display:flex; align-items:center; justify-content:space-between; gap:8px; margin-bottom:3px;
}
.chat-bubble-head strong{ color:var(--pink-dark); }
.chat-attending{
  font-size:.62rem; padding:2px 8px; border-radius:10px; white-space:nowrap;
}
.chat-attending.yes{ background:#e3f5e6; color:#2c7a3d; }
.chat-attending.no{ background:#fbe6e6; color:#a33; }
.chat-bubble p{ margin:2px 0 4px; line-height:1.5; }
.chat-time{ font-size:.66rem; opacity:.5; }

/* ================= LIGHTBOX GALERI ================= */
.lightbox{
  position:fixed; inset:0; background:rgba(0,0,0,.88);
  display:flex; align-items:center; justify-content:center;
  z-index:100; padding:24px;
  animation: fadeIn .15s ease;
}
.lightbox img{
  max-width:100%; max-height:100%; border-radius:8px;
  box-shadow:0 10px 40px rgba(0,0,0,.5);
  touch-action:none; transform-origin:center center;
  transition: transform .1s ease-out;
}
.lightbox-close{
  position:absolute; top:16px; right:20px;
  background:rgba(255,255,255,.15); color:#fff; border:none;
  width:36px; height:36px; border-radius:50%; font-size:1.1rem; cursor:pointer;
}
