/* ============================================================
   HER 19TH BIRTHDAY UNIVERSE — CSS
   Mobile-first. Container principal cresce até 430px no desktop.
   ============================================================ */

:root {
  --bg: #fff7f2;
  --card: #ffffff;
  --primary: #ff8fab;
  --primary-dark: #d94f7b;
  --secondary: #ffd6e0;
  --lavender: #cdb4db;
  --text: #3a2d32;
  --muted: #7a6a70;
  --gold: #f6c177;

  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 10px;
  --shadow-soft: 0 10px 30px rgba(217, 79, 123, 0.12);
  --shadow-card: 0 6px 18px rgba(217, 79, 123, 0.10);

  --font-serif: 'Playfair Display', Georgia, serif;
  --font-sans: 'Poppins', system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100dvh;
  background: linear-gradient(160deg, #fff7f2 0%, #ffe8ef 45%, #efe3f5 100%);
  background-attachment: fixed;
  font-family: var(--font-sans);
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
}

body {
  overflow-x: hidden;
}

/* ---------- Fundo decorativo (estrelas/corações flutuantes) ---------- */
.bg-decor {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.deco {
  position: absolute;
  color: var(--gold);
  opacity: 0.5;
  animation: float 7s ease-in-out infinite;
}
.deco.heart { color: var(--primary); opacity: 0.35; }
.s1 { top: 6%;  left: 10%; font-size: 20px; animation-delay: 0s; }
.s2 { top: 14%; right: 12%; font-size: 16px; animation-delay: 1.2s; }
.s3 { bottom: 20%; left: 8%; font-size: 18px; animation-delay: 2.4s; }
.s4 { bottom: 8%;  right: 10%; font-size: 22px; animation-delay: 0.6s; }
.h1 { top: 30%; right: 6%; font-size: 22px; animation-delay: 0.8s; }
.h2 { bottom: 35%; left: 5%; font-size: 18px; animation-delay: 1.8s; }

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

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

/* ---------- Container principal (mobile-first, "app" no desktop) ---------- */
.app-shell {
  position: relative;
  z-index: 1;
  max-width: 430px;
  margin: 0 auto;
  min-height: 100dvh;
  padding: 28px 18px 40px;
}

@media (min-width: 431px) {
  body {
    display: flex;
    justify-content: center;
  }
  .app-shell {
    box-shadow: 0 0 60px rgba(217, 79, 123, 0.10);
    background: linear-gradient(180deg, rgba(255,255,255,0.35), rgba(255,255,255,0));
  }
}

/* ---------- Navegação entre "páginas" (SPA) ---------- */
.page {
  display: none;
  animation: fadeIn 0.5s ease;
}
.page.active { display: block; }

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

/* ---------- Tipografia ---------- */
.title-serif {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: clamp(26px, 7vw, 34px);
  line-height: 1.2;
  margin: 0 0 8px;
  color: var(--primary-dark);
}

.subtitle {
  font-size: 15px;
  color: var(--muted);
  margin: 0 0 4px;
  line-height: 1.5;
}

.body-text {
  font-size: 15.5px;
  line-height: 1.7;
  color: var(--text);
}

.page-header { margin-bottom: 20px; text-align: center; }

/* ---------- Cards ---------- */
.card {
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: 26px 20px;
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(6px);
}

/* ---------- Botões ---------- */
.btn {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 15.5px;
  border: none;
  border-radius: 999px;
  padding: 15px 22px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
  min-height: 50px;
}
.btn:active { transform: scale(0.97); }
.btn-full { width: 100%; margin-top: 10px; }

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  box-shadow: 0 8px 20px rgba(217, 79, 123, 0.30);
}
.btn-primary:hover { box-shadow: 0 10px 24px rgba(217, 79, 123, 0.40); }

.btn-secondary {
  background: var(--secondary);
  color: var(--primary-dark);
}

.btn-back {
  background: none;
  border: none;
  color: var(--primary-dark);
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 14.5px;
  padding: 8px 4px;
  margin-bottom: 10px;
  cursor: pointer;
}

/* ---------- Inputs ---------- */
.text-input {
  width: 100%;
  font-family: var(--font-sans);
  font-size: 16px;
  padding: 15px 16px;
  border: 2px solid var(--secondary);
  border-radius: var(--radius-md);
  background: #fff;
  color: var(--text);
  margin: 18px 0 6px;
  outline: none;
  transition: border-color 0.2s ease;
}
.text-input:focus { border-color: var(--primary); }

/* ---------- Tela de acesso ---------- */
.lock-card {
  margin-top: 12vh;
  text-align: center;
}
.lock-icon { font-size: 44px; margin-bottom: 10px; }
.lock-message {
  min-height: 22px;
  font-size: 14.5px;
  font-weight: 500;
  margin-top: 12px;
  color: var(--primary-dark);
}
.lock-message.error { color: #c1436a; }
.lock-message.success { color: #3d8f5f; }

/* ---------- Menu principal / grid de cards ---------- */
.menu-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin-bottom: 16px;
}

.menu-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  gap: 4px;
  background: var(--card);
  border: none;
  border-radius: var(--radius-md);
  padding: 18px 18px;
  box-shadow: var(--shadow-card);
  cursor: pointer;
  font-family: var(--font-sans);
  color: var(--text);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  position: relative;
}
.menu-card:active { transform: scale(0.98); }
.menu-icon { font-size: 24px; margin-bottom: 4px; }
.menu-card-title { font-weight: 600; font-size: 16px; color: var(--primary-dark); display: flex; align-items: center; gap: 6px; }
.menu-card-desc { font-size: 13.5px; color: var(--muted); }
.check { font-size: 14px; }
.check.done::after { content: "✓"; color: #3d8f5f; }

/* ---------- Galeria ---------- */
.gallery-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 18px;
}
.gallery-item {
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  aspect-ratio: 1 / 1;
  cursor: pointer;
  border: none;
  padding: 0;
  background: var(--secondary);
}
.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.25s ease;
}
.gallery-item:active img { transform: scale(1.05); }

.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(30, 15, 22, 0.92);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 24px;
}
.lightbox.open { display: flex; }
.lightbox-content { max-width: 430px; width: 100%; text-align: center; }
.lightbox-content img {
  width: 100%;
  border-radius: var(--radius-md);
  box-shadow: 0 12px 40px rgba(0,0,0,0.4);
}
.lightbox-caption { color: #fff; margin-top: 14px; font-size: 15px; }
.lightbox-count { color: var(--secondary); font-size: 13px; margin-top: 4px; }
.lightbox-close {
  position: absolute;
  top: 20px; right: 20px;
  background: rgba(255,255,255,0.15);
  color: #fff;
  border: none;
  width: 40px; height: 40px;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
}

/* ---------- Cards de jogos ---------- */
.game-card { margin-bottom: 16px; }
.game-message {
  min-height: 20px;
  text-align: center;
  font-weight: 500;
  font-size: 14.5px;
  color: var(--primary-dark);
  margin-top: 14px;
}

/* ---------- Caça-palavras ---------- */
.wordsearch-grid {
  display: grid;
  gap: 3px;
  margin-bottom: 18px;
  touch-action: none;
  user-select: none;
}
.ws-cell {
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  border-radius: 6px;
  font-weight: 600;
  font-size: clamp(11px, 3.4vw, 15px);
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.ws-cell.selected { background: var(--secondary); }
.ws-cell.found { background: var(--primary); color: #fff; }

.word-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 10px;
  font-size: 13.5px;
}
.word-list li { color: var(--muted); transition: color 0.2s ease; }
.word-list li::before { content: "♡ "; color: var(--primary); }
.word-list li.found { color: var(--primary-dark); font-weight: 600; text-decoration: line-through; }
.word-list li.found::before { content: "✓ "; color: #3d8f5f; }

/* ---------- Wordle ---------- */
.wordle-board {
  display: grid;
  grid-template-rows: repeat(6, 1fr);
  gap: 6px;
  margin-bottom: 20px;
}
.wordle-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.wordle-tile {
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--secondary);
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: clamp(16px, 5.5vw, 22px);
  text-transform: uppercase;
  color: var(--text);
  background: var(--bg);
  transition: background 0.3s ease, border-color 0.3s ease, color 0.3s ease, transform 0.2s ease;
}
.wordle-tile.filled { border-color: var(--lavender); transform: scale(1.03); }
.wordle-tile.correct { background: #7bb98f; border-color: #7bb98f; color: #fff; }
.wordle-tile.present { background: var(--gold); border-color: var(--gold); color: #fff; }
.wordle-tile.absent  { background: #d8cfd2; border-color: #d8cfd2; color: #fff; }

.wordle-keyboard {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.wordle-kb-row { display: flex; gap: 5px; justify-content: center; }
.wordle-key {
  flex: 1;
  min-width: 0;
  max-width: 34px;
  height: 44px;
  border: none;
  border-radius: 8px;
  background: var(--secondary);
  color: var(--primary-dark);
  font-weight: 600;
  font-size: 13px;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}
.wordle-key.wide { max-width: 56px; font-size: 11px; }
.wordle-key.correct { background: #7bb98f; color: #fff; }
.wordle-key.present { background: var(--gold); color: #fff; }
.wordle-key.absent { background: #d8cfd2; color: #fff; }

/* ---------- Cruzadinhas (versão em blocos por pista) ---------- */
.crossword-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-bottom: 6px;
}
.crossword-clue { }
.crossword-clue-text {
  font-size: 14px;
  color: var(--muted);
  margin: 0 0 8px;
}
.crossword-clue-num {
  color: var(--primary-dark);
  font-weight: 700;
  margin-right: 4px;
}
.crossword-boxes {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.cw-box {
  width: 30px;
  height: 38px;
  border: 2px solid var(--secondary);
  border-radius: 6px;
  text-align: center;
  font-size: 16px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text);
  background: var(--bg);
  outline: none;
  padding: 0;
}
.cw-box:focus { border-color: var(--primary); }
.cw-box.correct { border-color: #7bb98f; background: #eaf6ee; }
.cw-box.wrong { border-color: #d9878f; background: #fbecee; }

/* ---------- Poema ---------- */
.poem-card {
  position: relative;
  background: linear-gradient(180deg, #ffffff, #fff7f2);
}
.poem-text {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 16px;
  line-height: 1.9;
  color: var(--text);
  white-space: pre-line;
  margin: 0;
}
.poem-heart {
  text-align: center;
  color: var(--primary);
  font-size: 22px;
  margin-top: 18px;
}

/* ---------- Final ---------- */
.final-card { text-align: center; margin-top: 6vh; }
.confetti-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 50;
  overflow: hidden;
}
.confetti-piece {
  position: absolute;
  top: -20px;
  font-size: 16px;
  animation: fall linear forwards;
}
@keyframes fall {
  to { transform: translateY(110vh) rotate(360deg); opacity: 0.6; }
}

/* ---------- Scroll horizontal de segurança para grelhas largas ---------- */
.wordsearch-grid, .wordle-board {
  max-width: 100%;
}
