/* ========================================================
   HELLO KITTY PRINCESS BOOK - CLEAN, SMOOTH & GORGEOUS
   Exclusively Crafted for iPhone iOS - Ultra Lightweight
   ======================================================== */

:root {
  --pink-primary: #ff527f;
  --pink-deep: #e6005c;
  --pink-soft: #fff0f5;
  --pink-card: #ffffff;
  --hk-bow: #ff1a4b;
  --gold-accent: #f5af19;
  --gold-border: #ffd700;
  --text-dark: #3d1b2d;
  --text-muted: #8c5b74;
  --font-main: 'Nunito', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-cute: 'Comfortaa', cursive, sans-serif;
  --font-script: 'Caveat', cursive;
  --safe-top: env(safe-area-inset-top, 16px);
  --safe-bottom: env(safe-area-inset-bottom, 16px);
}

/* Base Reset & Performance */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  /* Soft, clean, elegant gradient - zero heavy graphics or lag */
  background: linear-gradient(180deg, #ffeef3 0%, #ffd6e2 50%, #fcaec3 100%);
  font-family: var(--font-main);
  color: var(--text-dark);
  position: fixed;
  inset: 0;
  touch-action: manipulation;
  -webkit-font-smoothing: antialiased;
}

/* App Container */
.app-container {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  padding: calc(var(--safe-top) + 8px) 14px calc(var(--safe-bottom) + 12px);
}

/* Top Header */
.header {
  width: 100%;
  display: flex;
  justify-content: center;
  padding-bottom: 6px;
}

.pill-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.95);
  padding: 6px 18px;
  border-radius: 20px;
  box-shadow: 0 4px 15px rgba(255, 82, 127, 0.15);
  border: 1px solid rgba(255, 182, 193, 0.7);
}

.pill-crown, .pill-bow {
  font-size: 1.1rem;
}

.pill-title {
  font-family: var(--font-cute);
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--pink-deep);
  letter-spacing: 0.5px;
}

/* ========================================================
   BOOK VIEWPORT & PAGES (PERFECT IPHONE PROPORTIONS)
   ======================================================== */
.book-viewport {
  flex: 1;
  width: 100%;
  max-width: 350px;
  max-height: 535px;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  perspective: 1200px;
  -webkit-perspective: 1200px;
}

.book-card {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 22px;
}

/* Individual Pages */
.page {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 22px;
  background: #ffffff;
  overflow: hidden;
  box-shadow: 
    0 10px 25px rgba(210, 40, 95, 0.18),
    0 20px 40px rgba(0, 0, 0, 0.12);
  display: flex;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transform: scale(0.92) rotateY(15deg);
  -webkit-transform: scale(0.92) rotateY(15deg);
  transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1), opacity 0.35s ease;
  will-change: transform, opacity;
}

/* Active Page: Smooth & Crisp */
.page.active {
  opacity: 1;
  pointer-events: auto;
  transform: scale(1) rotateY(0deg);
  -webkit-transform: scale(1) rotateY(0deg);
  z-index: 10;
}

.page.exiting-prev {
  transform: scale(0.92) rotateY(-15deg);
  -webkit-transform: scale(0.92) rotateY(-15deg);
  opacity: 0;
  pointer-events: none;
}

/* ========================================================
   PAGE 1: CAPA DO LIVRO (HELLO KITTY)
   ======================================================== */
.page-cover {
  background: linear-gradient(145deg, #ff7a9f 0%, #ff4777 50%, #dc1e58 100%);
  cursor: pointer;
}

.cover-inner {
  height: 100%;
  padding: 14px 12px;
  position: relative;
}

.cover-frame {
  height: 100%;
  border: 3px solid #ffe885;
  border-radius: 18px;
  padding: 14px 10px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  text-align: center;
  background: radial-gradient(circle at 50% 35%, rgba(255, 255, 255, 0.22) 0%, rgba(255, 255, 255, 0.04) 75%, transparent 100%);
  box-shadow: inset 0 0 12px rgba(255, 215, 0, 0.3);
}

.cover-tiara-box {
  display: flex;
  align-items: center;
  gap: 6px;
}

.main-crown {
  font-size: 2rem;
  filter: drop-shadow(0 2px 5px rgba(0,0,0,0.25));
}

.mini-sparkle {
  color: #ffe885;
  font-size: 1.1rem;
}

.cover-titles .subtitle {
  font-family: var(--font-script);
  font-size: 1.6rem;
  color: #fff9e6;
  font-weight: 700;
  line-height: 1;
}

.cover-titles .title {
  font-family: var(--font-cute);
  font-size: 2.1rem;
  font-weight: 900;
  color: #ffffff;
  letter-spacing: 1px;
  text-shadow: 0 2px 0 #b3003b, 0 4px 10px rgba(0, 0, 0, 0.3);
  line-height: 1.1;
  margin-top: 2px;
}

/* Kitty Avatar Frame */
.kitty-avatar {
  position: relative;
  width: 142px;
  height: 142px;
  border-radius: 50%;
  background: radial-gradient(circle, #ffffff 65%, #ffe6ee 100%);
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: 
    0 8px 20px rgba(0, 0, 0, 0.2),
    0 0 0 5px #ffe57f,
    0 0 0 8px rgba(255, 255, 255, 0.8);
  margin: 2px 0;
}

.avatar-crown {
  position: absolute;
  top: -18px;
  font-size: 1.8rem;
  z-index: 5;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.25));
}

.hk-img {
  width: 112px;
  height: 112px;
  object-fit: contain;
  filter: drop-shadow(0 4px 8px rgba(220, 30, 88, 0.2));
}

.avatar-bow {
  position: absolute;
  bottom: -10px;
  font-size: 1.6rem;
  z-index: 6;
}

.cute-divider {
  color: #ffe066;
  font-size: 0.95rem;
  letter-spacing: 3px;
}

.open-book-btn {
  background: linear-gradient(135deg, #ffe57f 0%, #ffc107 50%, #ffa000 100%);
  color: #5c2600;
  font-family: var(--font-cute);
  font-weight: 800;
  font-size: 0.95rem;
  padding: 12px 22px;
  border-radius: 25px;
  border: 2px solid #ffffff;
  box-shadow: 0 5px 16px rgba(255, 193, 7, 0.45), 0 3px 0 #b36b00;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: transform 0.15s ease;
}

.open-book-btn:active {
  transform: scale(0.95);
}

.tap-hint {
  font-size: 0.75rem;
  color: #fff2f6;
  font-weight: 600;
  opacity: 0.95;
}

.bookmark-ribbon {
  position: absolute;
  bottom: -16px;
  right: 30px;
  width: 22px;
  height: 38px;
  background: linear-gradient(180deg, #ff1a4b 0%, #cc0033 100%);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 80%, 0 100%);
  z-index: 10;
}

/* ========================================================
   PAGE 2: A CARTINHA SURPRESA (EXACT USER TEXTS)
   ======================================================== */
.page-letter {
  background: #ffffff;
}

.page-inner {
  height: 100%;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background: #ffffff;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* Envelope Container */
.envelope-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.envelope-container.is-hidden {
  display: none;
}

.envelope-hint {
  font-family: var(--font-cute);
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--pink-deep);
  margin-bottom: 14px;
  text-align: center;
}

.envelope {
  position: relative;
  width: 235px;
  height: 165px;
  background: #ffb8cc;
  border-radius: 12px;
  box-shadow: 0 10px 24px rgba(230, 0, 92, 0.22);
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: transform 0.2s ease;
}

.envelope:active {
  transform: scale(0.96);
}

.envelope-flap {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 88px;
  background: linear-gradient(180deg, #ff7a9f 0%, #ff527f 100%);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  display: flex;
  justify-content: center;
  align-items: flex-end;
  padding-bottom: 8px;
}

.envelope-seal {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #ff4d6d 0%, #cc0033 80%);
  color: white;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 2px dashed #ffe57f;
  box-shadow: 0 4px 10px rgba(153, 0, 38, 0.4);
}

.seal-icon {
  font-size: 1.2rem;
  line-height: 1;
}

.seal-text {
  font-family: var(--font-cute);
  font-size: 0.54rem;
  font-weight: 800;
  color: #fff9e6;
}

.envelope-stamp {
  position: absolute;
  bottom: 10px;
}

.stamp-img {
  width: 56px;
  height: 56px;
  object-fit: contain;
}

/* Unfolded Letter Sheet */
.letter-sheet {
  display: none;
  width: 100%;
  animation: letterFade 0.4s ease forwards;
}

.letter-sheet.is-visible {
  display: block;
}

@keyframes letterFade {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.letter-card {
  background: #ffffff;
  border-radius: 14px;
  padding: 14px 10px 12px;
  border: 2px dashed #ff99bb;
  box-shadow: 0 6px 20px rgba(220, 60, 110, 0.12);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
}

.letter-stamp-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.25rem;
}

.crown-stamp {
  font-size: 1.55rem;
}

/* EXACT PHRASE 1 */
.message-block.intro-block {
  background: #fff5f8;
  border-left: 3px solid var(--hk-bow);
  padding: 8px 10px;
  border-radius: 10px;
  width: 100%;
}

.exact-text {
  font-family: var(--font-cute);
  font-size: 0.95rem;
  font-weight: 700;
  color: #c91249;
  line-height: 1.4;
}

.letter-sep {
  color: #ff80a5;
  font-size: 0.85rem;
  letter-spacing: 4px;
}

/* EXACT PHRASE 2 */
.message-block.highlight-block {
  background: linear-gradient(135deg, #fff0f5 0%, #ffe4ec 100%);
  border: 1.5px solid #ffb3c6;
  padding: 10px 8px;
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(255, 51, 102, 0.08);
  width: 100%;
}

.exact-text.highlight-text {
  font-size: 1.02rem;
  font-weight: 800;
  color: #3d1b2d;
  line-height: 1.45;
}

/* EXACT SIGNATURE BLOCK */
.signature-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  margin-top: 2px;
}

.sig-teamo {
  font-family: var(--font-script);
  font-size: 1.7rem;
  font-weight: 700;
  color: var(--pink-deep);
  line-height: 1;
}

.sig-name {
  font-family: var(--font-cute);
  font-size: 0.86rem;
  font-weight: 700;
  color: #593043;
  line-height: 1.3;
}

.sig-icons {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 1.25rem;
  margin-top: 2px;
}

/* Hug Action Button */
.hug-button {
  margin-top: 4px;
  background: linear-gradient(135deg, #ff4071 0%, #e6005c 100%);
  color: white;
  border: none;
  font-family: var(--font-cute);
  font-size: 0.8rem;
  font-weight: 700;
  padding: 10px 14px;
  border-radius: 20px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(230, 0, 92, 0.28);
  display: flex;
  align-items: center;
  gap: 5px;
  width: 100%;
  justify-content: center;
  transition: background 0.2s ease, transform 0.15s ease;
}

.hug-button:active {
  transform: scale(0.96);
}

.hug-feedback {
  font-family: var(--font-cute);
  font-size: 0.78rem;
  font-weight: 700;
  color: #d1124d;
  min-height: 16px;
}

/* ========================================================
   PAGE 3: GALERIA HELLO KITTY
   ======================================================== */
.gallery-inner {
  justify-content: space-between;
  text-align: center;
}

.gallery-title {
  font-family: var(--font-cute);
  font-size: 1.15rem;
  font-weight: 800;
  color: #3d1b2d;
}

.gallery-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.polaroid-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  width: 100%;
  margin: 8px 0;
}

.polaroid-item {
  background: #ffffff;
  border-radius: 10px;
  padding: 6px 6px 8px;
  box-shadow: 0 4px 12px rgba(220, 60, 110, 0.15);
  position: relative;
}

.polaroid-item:nth-child(1) { transform: rotate(-2deg); }
.polaroid-item:nth-child(2) { transform: rotate(2deg); }

.pin {
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.85rem;
}

.polaroid-photo {
  width: 100%;
  height: 115px;
  background: #fff0f5;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  margin-bottom: 4px;
}

.polaroid-photo img {
  width: 88%;
  height: 88%;
  object-fit: contain;
}

.polaroid-caption {
  font-family: var(--font-cute);
  font-size: 0.7rem;
  font-weight: 700;
  color: #613349;
}

.final-love-banner {
  background: #fff0f5;
  border: 1.5px dashed #ff99bb;
  padding: 10px;
  border-radius: 12px;
  font-family: var(--font-cute);
  font-size: 0.86rem;
  font-weight: 800;
  color: var(--pink-deep);
  width: 100%;
}

/* ========================================================
   BOTTOM CONTROLS (IPHONE THUMB NAVIGATION)
   ======================================================== */
.bottom-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 350px;
  padding: 0 4px;
}

.ctrl-btn {
  background: rgba(255, 255, 255, 0.95);
  border: 1.5px solid #ffccd8;
  color: var(--pink-deep);
  font-family: var(--font-cute);
  font-size: 0.82rem;
  font-weight: 700;
  padding: 8px 16px;
  border-radius: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  box-shadow: 0 3px 10px rgba(255, 82, 127, 0.15);
  transition: all 0.15s ease;
}

.ctrl-btn:disabled {
  opacity: 0.35;
  pointer-events: none;
}

.ctrl-btn.next-btn {
  background: linear-gradient(135deg, #ff527f, #e6005c);
  color: white;
  border-color: #e6005c;
}

.ctrl-btn:active {
  transform: scale(0.94);
}

.dots-wrapper {
  display: flex;
  gap: 6px;
}

.dots-wrapper .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ffb6c1;
  transition: all 0.25s ease;
}

.dots-wrapper .dot.active {
  width: 20px;
  border-radius: 10px;
  background: var(--pink-deep);
}
