:root{
  --pink-light:#ffd6ea;
  --pink:#ff6fa8;
  --pink-deep:#c2266b;
  --magenta:#9c1856;
  --gold:#e8c26a;
  --ink:#3a0f28;
  --paper:#fff6fa;
  --radius:18px;
  --shadow:0 22px 48px rgba(120,10,64,.5);
}

*{box-sizing:border-box;}
html,body{height:100%;}
body{
  margin:0;
  font-family:'Segoe UI',system-ui,-apple-system,Roboto,Helvetica,Arial,sans-serif;
  color:var(--ink);
  background:
    radial-gradient(circle at 20% 10%, #fff6fa 0%, transparent 50%),
    radial-gradient(circle at 85% 80%, #ffecf5 0%, transparent 55%),
    linear-gradient(160deg,#fff1f8 0%, #ffd9ec 55%, #ffc3df 100%);
  min-height:100%;
  overflow-x:hidden;
}

#app{
  min-height:100svh;
  display:flex;
  flex-direction:column;
}

/* ---------- Top bar ---------- */
.topbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:12px 16px;
  gap:12px;
  position:sticky;
  top:0;
  z-index:50;
  background:rgba(255,255,255,.35);
  backdrop-filter:blur(10px);
  -webkit-backdrop-filter:blur(10px);
}
.brand{display:flex;align-items:center;gap:6px;font-weight:800;}
.brand-logo{
  height:38px;
  width:auto;
  display:block;
  mix-blend-mode:multiply;
}
.topbar-actions{display:flex;align-items:center;gap:8px;}
.page-counter{
  font-size:12px;
  font-weight:700;
  color:var(--magenta);
  background:rgba(255,255,255,.6);
  padding:5px 10px;
  border-radius:999px;
  white-space:nowrap;
}
.icon-btn{
  width:34px;height:34px;
  border-radius:50%;
  border:none;
  background:rgba(255,255,255,.65);
  color:var(--magenta);
  display:flex;align-items:center;justify-content:center;
  cursor:pointer;
  transition:transform .15s ease, background .15s ease;
}
.icon-btn:hover{background:#fff;transform:scale(1.06);}
.icon-btn svg{width:17px;height:17px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;}

/* ---------- Stage / Book ---------- */
.stage{
  flex:1;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:6px;
  padding:10px 6px 4px;
  min-height:0;
}
.nav-btn{
  width:42px;height:42px;
  flex:none;
  border-radius:50%;
  border:none;
  background:rgba(255,255,255,.55);
  color:var(--magenta);
  display:flex;align-items:center;justify-content:center;
  cursor:pointer;
  transition:transform .15s ease, background .15s ease, opacity .2s ease;
}
.nav-btn svg{width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:2.4;stroke-linecap:round;stroke-linejoin:round;}
.nav-btn:hover{background:#fff;transform:scale(1.08);}
.nav-btn:disabled{opacity:.25;cursor:default;pointer-events:none;}

.book{
  position:relative;
  width:min(88vw, 80svh, 560px);
  aspect-ratio:1/1;
  perspective:2600px;
  filter:drop-shadow(var(--shadow));
}
.page-stack{
  position:absolute;
  inset:0;
  transform-style:preserve-3d;
}
.page{
  position:absolute;
  inset:0;
  background:var(--paper);
  border-radius:var(--radius);
  overflow:hidden;
  backface-visibility:hidden;
  transform-origin:left center;
  transform:rotateY(0deg);
  transition:transform .75s cubic-bezier(.45,.08,.2,1);
  cursor:pointer;
  box-shadow:inset 0 0 0 1.5px rgba(255,255,255,.65), 0 0 0 1px rgba(156,24,86,.12);
}
.page > img{
  width:100%;height:100%;
  object-fit:cover;
  display:block;
  pointer-events:none;
  -webkit-user-drag:none;
}
.page .spine{
  position:absolute;
  left:0;top:0;bottom:0;
  width:14px;
  background:linear-gradient(90deg, rgba(0,0,0,.18), rgba(0,0,0,0));
  pointer-events:none;
}
.page .corner-order{
  position:absolute;
  right:10px;bottom:10px;
  background:linear-gradient(135deg,var(--pink),var(--magenta));
  color:#fff;
  font-size:11.5px;
  font-weight:700;
  padding:8px 13px;
  border-radius:999px;
  text-decoration:none;
  box-shadow:0 6px 14px rgba(156,24,86,.45);
  display:flex;align-items:center;gap:5px;
}
.page .corner-order svg{width:13px;height:13px;fill:#fff;}

.hint{
  position:absolute;
  left:50%;bottom:-30px;
  transform:translateX(-50%);
  font-size:11.5px;
  color:rgba(255,255,255,.9);
  text-shadow:0 1px 3px rgba(0,0,0,.25);
  white-space:nowrap;
  pointer-events:none;
  transition:opacity .4s ease;
}

.page-loading{
  display:flex;align-items:center;justify-content:center;
  background:linear-gradient(150deg,#ffd7ec 0%, #ff8fc0 55%, #c2266b 100%);
}
.loading-spinner{
  width:34px;height:34px;
  border-radius:50%;
  border:3px solid rgba(255,255,255,.4);
  border-top-color:#fff;
  animation:spin .8s linear infinite;
}
@keyframes spin{to{transform:rotate(360deg);}}

/* Cover & closing pages */
.cover-page{
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  text-align:center;
  height:100%;
  background:
    radial-gradient(circle at 25% 15%, #fff0f7 0%, transparent 40%),
    linear-gradient(150deg,#ffd7ec 0%, #ff8fc0 55%, #c2266b 100%);
  padding:8% 10%;
  color:#fff;
}
.cover-logo{
  width:min(58%, 260px);
  height:auto;
  mix-blend-mode:multiply;
  filter:drop-shadow(0 6px 16px rgba(0,0,0,.18));
}
.cover-title{
  margin-top:26px;
  font-size:clamp(22px,6vw,32px);
  font-weight:800;
  letter-spacing:.04em;
}
.cover-sub{
  margin-top:8px;
  font-size:clamp(12px,3.2vw,14px);
  opacity:.9;
  max-width:80%;
}
.cover-cta{
  margin-top:34px;
  font-size:12px;
  background:rgba(255,255,255,.2);
  border:1px solid rgba(255,255,255,.55);
  padding:9px 18px;
  border-radius:999px;
  letter-spacing:.05em;
}
.sparkle{position:absolute;color:#fff;opacity:.85;filter:drop-shadow(0 0 4px rgba(255,255,255,.6));}

.closing-page{
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:flex-start;
  height:100%;
  text-align:center;
  background:linear-gradient(150deg,#ffe3f0 0%, #ff9fc8 60%, #b81e63 100%);
  color:#fff;
  padding:7% 9% 10%;
  gap:10px;
  overflow-y:auto;
  -webkit-overflow-scrolling:touch;
}
.closing-title{font-size:clamp(16px,4.6vw,24px);font-weight:800;margin-top:6px;flex:none;}
.closing-sub{font-size:11.5px;opacity:.92;max-width:88%;flex:none;}
.social-list{
  display:flex;flex-direction:column;gap:8px;
  width:100%;max-width:280px;
  margin-top:4px;
  flex:none;
}
.social-link{
  display:flex;align-items:center;gap:10px;
  background:rgba(255,255,255,.18);
  border:1px solid rgba(255,255,255,.5);
  color:#fff;
  text-decoration:none;
  padding:8px 14px;
  border-radius:12px;
  font-size:12.5px;
  font-weight:600;
  text-align:left;
}
.social-link svg{width:18px;height:18px;flex:none;fill:#fff;}
.social-link small{display:block;font-weight:400;opacity:.85;font-size:11px;}

/* ---------- Dots ---------- */
.dots{
  display:flex;
  justify-content:center;
  gap:5px;
  padding:10px 8px 16px;
  flex-wrap:wrap;
}
.dot{
  width:7px;height:7px;border-radius:50%;
  background:rgba(255,255,255,.55);
  border:none;cursor:pointer;
  transition:transform .15s ease, background .15s ease;
}
.dot.active{background:#fff;transform:scale(1.5);}

/* ---------- WhatsApp FAB ---------- */
.fab-wa{
  position:fixed;
  right:18px;bottom:18px;
  width:54px;height:54px;
  border-radius:50%;
  background:#25D366;
  display:flex;align-items:center;justify-content:center;
  box-shadow:0 10px 24px rgba(0,0,0,.3);
  z-index:60;
  text-decoration:none;
}
.fab-wa svg{width:28px;height:28px;fill:#fff;}
.fab-wa:hover{transform:scale(1.06);}

/* ---------- Zoom overlay ---------- */
.zoombox{
  position:fixed;inset:0;
  background:rgba(20,2,12,.92);
  z-index:100;
  display:none;
  align-items:center;justify-content:center;
  flex-direction:column;
}
.zoombox.open{display:flex;}
.zoom-viewport{
  width:min(92vw,92svh);
  height:min(92vw,92svh);
  overflow:hidden;
  border-radius:14px;
  touch-action:none;
  cursor:grab;
}
.zoom-viewport img{
  width:100%;height:100%;
  object-fit:cover;
  transform-origin:center center;
  user-select:none;
  -webkit-user-drag:none;
}
.zoom-hint{color:rgba(255,255,255,.65);font-size:11.5px;margin-top:12px;}
.zoom-close{
  position:absolute;top:16px;right:18px;
  width:38px;height:38px;border-radius:50%;
  border:none;background:rgba(255,255,255,.15);
  color:#fff;font-size:22px;line-height:1;
  cursor:pointer;
}

/* ---------- Grid overlay ---------- */
.gridbox{
  position:fixed;inset:0;
  background:rgba(20,2,12,.92);
  z-index:100;
  display:none;
  flex-direction:column;
  padding:18px;
}
.gridbox.open{display:flex;}
.gridbox-head{
  position:relative;
  color:#fff;
  font-weight:700;
  text-align:center;
  padding-bottom:14px;
  letter-spacing:.05em;
}
.gridbox-grid{
  flex:1;
  overflow-y:auto;
  display:grid;
  grid-template-columns:repeat(auto-fill,minmax(110px,1fr));
  gap:12px;
  padding:4px 2px 30px;
}
.grid-item{
  border-radius:10px;
  overflow:hidden;
  cursor:pointer;
  border:2px solid transparent;
  aspect-ratio:1/1;
  position:relative;
  background:#fff;
}
.grid-item img{width:100%;height:100%;object-fit:cover;display:block;}
.grid-item.current{border-color:var(--gold);}
.grid-item .gi-label{
  position:absolute;left:0;right:0;bottom:0;
  background:linear-gradient(0deg,rgba(0,0,0,.6),transparent);
  color:#fff;font-size:10px;padding:4px 6px;
  overflow:hidden;white-space:nowrap;text-overflow:ellipsis;
}

@media (max-width:520px){
  .topbar{padding:10px 12px;}
  .book{width:92vw;}
  .nav-btn{width:36px;height:36px;}
}
