/* ============================================================
   CheerKid™ — Styles (styles.css)
   Aesthetic: Warm toybox — rounded, bright, toddler-safe UI
   ============================================================ */

/* ── CSS Variables ─────────────────────────────────────────── */
:root {
  --coral:    #FF6B6B;
  --yellow:   #FFE66D;
  --mint:     #4ECDC4;
  --sky:      #74C0FC;
  --lavender: #C9A8FF;
  --peach:    #FFB347;
  --cream:    #FFF5E6;
  --white:    #FFFFFF;
  --dark:     #2D2D2D;
  --mid:      #6B6B6B;

  /* Tile palette */
  --tile-1: #FF6B6B;
  --tile-2: #FFE66D;
  --tile-3: #4ECDC4;
  --tile-4: #74C0FC;
  --tile-5: #C9A8FF;
  --tile-6: #FFB347;
  --tile-7: #A8E6CF;
  --tile-8: #FF8B94;
  --tile-9: #FFC3A0;

  --radius-xl: 2rem;
  --radius-lg: 1.5rem;
  --radius-md: 1rem;
  --radius-sm: 0.5rem;

  --shadow-warm: 0 8px 32px rgba(255, 107, 107, 0.18);
  --shadow-tile: 0 6px 20px rgba(0, 0, 0, 0.15);
  --shadow-deep: 0 16px 48px rgba(0, 0, 0, 0.12);

  --font-round: 'Trebuchet MS', 'Arial Rounded MT Bold', 'Nunito', 'Varela Round', sans-serif;
}

/* ── Reset & Base ──────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  width: 100%;
  overflow: hidden;
  background: var(--cream);
  font-family: var(--font-round);
  user-select: none;
  -webkit-user-select: none;
}

/* ── App Container ─────────────────────────────────────────── */
#app {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 20% 20%, rgba(255, 230, 109, 0.25) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(78, 205, 196, 0.18) 0%, transparent 50%),
    radial-gradient(circle at 60% 10%, rgba(255, 107, 107, 0.12) 0%, transparent 45%),
    var(--cream);
  overflow: hidden;
}

/* ── Screens ───────────────────────────────────────────────── */
.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem 1.25rem;
  opacity: 0;
  transform: scale(0.96);
  pointer-events: none;
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.screen.active {
  opacity: 1;
  transform: scale(1);
  pointer-events: all;
}

/* ── Welcome Screen ────────────────────────────────────────── */
#screen-welcome {
  gap: 1.75rem;
}

.logo-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.logo-icon {
  font-size: clamp(3.5rem, 14vw, 5.5rem);
  line-height: 1;
  animation: bounce-logo 2s ease-in-out infinite;
}

@keyframes bounce-logo {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-10px); }
}

.logo-text {
  font-size: clamp(2.4rem, 9vw, 4rem);
  font-weight: 900;
  color: var(--coral);
  letter-spacing: -0.02em;
  line-height: 1;
  text-shadow: 0 4px 0 rgba(255, 107, 107, 0.25);
}

.logo-tm {
  font-size: 0.45em;
  vertical-align: super;
  opacity: 0.7;
}

.welcome-tagline {
  font-size: clamp(1rem, 4vw, 1.3rem);
  color: var(--mid);
  text-align: center;
  font-weight: 600;
  max-width: 28rem;
}

.age-card {
  background: white;
  border-radius: var(--radius-xl);
  padding: 1.5rem 1.75rem;
  box-shadow: var(--shadow-deep);
  width: 100%;
  max-width: 360px;
}

.age-card-title {
  font-size: clamp(0.85rem, 3.2vw, 1rem);
  color: var(--mid);
  text-align: center;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 1rem;
}

.age-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.age-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border: none;
  border-radius: var(--radius-lg);
  cursor: pointer;
  font-family: var(--font-round);
  font-size: clamp(1rem, 4vw, 1.2rem);
  font-weight: 800;
  color: var(--dark);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  position: relative;
  overflow: hidden;
}

.age-btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.25);
  opacity: 0;
  transition: opacity 0.2s;
}

.age-btn:active::after { opacity: 1; }
.age-btn:active { transform: scale(0.97) !important; }

.age-btn:nth-child(1) { background: var(--coral); box-shadow: 0 6px 0 #e55454, var(--shadow-tile); }
.age-btn:nth-child(2) { background: var(--yellow); box-shadow: 0 6px 0 #d4b800, var(--shadow-tile); }
.age-btn:nth-child(3) { background: var(--mint);   box-shadow: 0 6px 0 #35b8b0, var(--shadow-tile); }

.age-btn:hover { transform: translateY(-2px); }

.age-btn .btn-label { display: flex; flex-direction: column; }
.age-btn .btn-years { font-size: 0.72em; font-weight: 600; opacity: 0.7; }
.age-btn .btn-tiles { font-size: 1.4em; line-height: 1; }

/* ── Puzzle Screen ─────────────────────────────────────────── */
#screen-puzzle {
  justify-content: flex-start;
  align-items: stretch;
  gap: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.puzzle-header {
  width: 100%;
  padding: 0.55rem 1rem 0.45rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 0 0 auto;
  background: rgba(255,245,230,0.92);
  backdrop-filter: blur(6px);
  border-bottom: 1.5px solid rgba(0,0,0,0.05);
  z-index: 10;
}

.puzzle-theme-label {
  font-size: clamp(0.85rem, 3.8vw, 1.05rem);
  font-weight: 900;
  color: var(--coral);
  white-space: nowrap;
}

.progress-track {
  flex: 1;
  height: 11px;
  background: rgba(0,0,0,0.08);
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--coral), var(--peach));
  border-radius: 999px;
  transition: width 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  width: 0%;
}

.star-counter {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: clamp(0.85rem, 3.2vw, 1rem);
  font-weight: 800;
  color: var(--dark);
  flex-shrink: 0;
}

@keyframes star-pop {
  0%   { transform: scale(0); }
  60%  { transform: scale(1.3); }
  100% { transform: scale(1); }
}

/* ── Puzzle Canvas Area — top half ──────────────────────────── */
.puzzle-canvas-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  /* Exactly 48% of vh — leaves bottom 44% for pieces + 8% for header */
  flex: 0 0 48vh;
  min-height: 0;
  padding: 0.5rem 1rem 0.4rem;
  overflow: hidden;
}

#puzzle-main-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

#puzzle-canvas {
  border-radius: 12px;
  box-shadow: var(--shadow-deep);
  max-width: 100%;
  max-height: 100%;
  touch-action: none;
  display: block;
  background: white;
}

/* ── Tile Bank — bottom half, all pieces in grid ────────────── */
.tile-bank-wrap {
  flex: 1 1 0;          /* fills all remaining space */
  min-height: 0;
  width: 100%;
  padding: 0.5rem 0.75rem 0.6rem;
  background: rgba(255,255,255,0.65);
  border-top: 2px solid rgba(0,0,0,0.07);
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  overflow: hidden;
}

.tile-bank-label {
  font-size: clamp(0.6rem, 2.4vw, 0.75rem);
  font-weight: 700;
  color: var(--mid);
  text-transform: uppercase;
  letter-spacing: 0.09em;
  padding-left: 0.2rem;
  flex-shrink: 0;
  line-height: 1;
}

/* Grid — all pieces visible, no scroll ever */
#tile-bank {
  flex: 1 1 0;
  min-height: 0;
  display: grid;
  /* columns set inline by JS: grid-template-columns */
  gap: 6px;
  padding: 2px;
  overflow: hidden;      /* never scroll */
  align-content: center;
  justify-content: center;
}

.tile-piece {
  border-radius: 8px;
  box-shadow: var(--shadow-tile);
  cursor: grab;
  transition: box-shadow 0.12s ease, opacity 0.18s ease;
  touch-action: none;
  overflow: hidden;
  border: 3px solid rgba(255,255,255,0.9);
  position: relative;
  user-select: none;
  -webkit-user-select: none;
  /* width/height set by JS to fill grid cell exactly */
  width: 100%;
  height: 100%;
}

.tile-piece.dragging {
  opacity: 0.3;
  box-shadow: none;
  border-color: rgba(255,107,107,0.4);
}

.tile-piece.placed {
  opacity: 0.18;
  cursor: not-allowed;
  pointer-events: none;
  filter: grayscale(0.5);
}

.tile-piece canvas {
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* ── Drag Ghost ─────────────────────────────────────────────── */
#drag-ghost {
  position: fixed;
  pointer-events: none;
  z-index: 999;
  border-radius: 8px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.3), 0 0 0 3px var(--coral);
  overflow: hidden;
  border: 3px solid var(--coral);
  transform: scale(1.08);
  opacity: 0.93;
  display: none;
}

#drag-ghost canvas { display: block; width: 100%; height: 100%; }

/* ── Slot highlight while dragging ──────────────────────────── */
.slot-hover {
  background: rgba(78, 205, 196, 0.22) !important;
  border-color: var(--mint) !important;
  border-style: solid !important;
}

/* ── Completion Screen ──────────────────────────────────────── */
#screen-complete {
  gap: 1.25rem;
  background: transparent;
}

.complete-emoji {
  font-size: clamp(4rem, 18vw, 7rem);
  animation: complete-bounce 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes complete-bounce {
  0%   { transform: scale(0) rotate(-15deg); }
  100% { transform: scale(1) rotate(0deg); }
}

.complete-title {
  font-size: clamp(1.8rem, 8vw, 3rem);
  font-weight: 900;
  color: var(--coral);
  text-align: center;
  line-height: 1.1;
  text-shadow: 0 4px 0 rgba(255, 107, 107, 0.2);
}

.complete-stars {
  display: flex;
  gap: 0.5rem;
  font-size: clamp(1.5rem, 7vw, 2.5rem);
}

.complete-stars span {
  animation: star-rain 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.complete-stars span:nth-child(1) { animation-delay: 0.1s; }
.complete-stars span:nth-child(2) { animation-delay: 0.25s; }
.complete-stars span:nth-child(3) { animation-delay: 0.4s; }

@keyframes star-rain {
  0%   { transform: translateY(-30px) scale(0); opacity: 0; }
  100% { transform: translateY(0)     scale(1); opacity: 1; }
}

.complete-btns {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: 100%;
  max-width: 300px;
}

.btn-primary {
  padding: 1.1rem 2rem;
  border: none;
  border-radius: var(--radius-lg);
  background: var(--coral);
  color: white;
  font-family: var(--font-round);
  font-size: clamp(1rem, 4.5vw, 1.25rem);
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 6px 0 #e55454, var(--shadow-tile);
  transition: transform 0.15s, box-shadow 0.15s;
  letter-spacing: 0.02em;
}

.btn-primary:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 #e55454;
}

.btn-secondary {
  padding: 0.9rem 2rem;
  border: 3px solid var(--coral);
  border-radius: var(--radius-lg);
  background: white;
  color: var(--coral);
  font-family: var(--font-round);
  font-size: clamp(0.9rem, 4vw, 1.1rem);
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.15s, background 0.15s;
}

.btn-secondary:active { transform: scale(0.97); background: var(--cream); }

/* ── Confetti ───────────────────────────────────────────────── */
.confetti-container {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 200;
  overflow: hidden;
}

.confetti-piece {
  position: absolute;
  top: -20px;
  width: 10px;
  height: 14px;
  border-radius: 2px;
  animation: confetti-fall linear forwards;
}

@keyframes confetti-fall {
  to {
    transform: translateY(110vh) rotate(720deg);
    opacity: 0;
  }
}

/* ── Video Overlay (FPLS Clip Player) ───────────────────────── */
#video-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
}

#video-overlay.visible {
  opacity: 1;
  pointer-events: all;
}

.clip-card {
  background: white;
  border-radius: var(--radius-xl);
  padding: 2.25rem 2rem 2rem;
  width: min(88vw, 340px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.9rem;
  box-shadow: 0 24px 80px rgba(0,0,0,0.35);
  transform: scale(0.8);
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#video-overlay.visible .clip-card {
  transform: scale(1);
}

.clip-emoji-wrap {
  width: clamp(80px, 22vw, 110px);
  height: clamp(80px, 22vw, 110px);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(2.5rem, 9vw, 3.5rem);
  animation: clip-pulse 0.6s ease infinite alternate;
  flex-shrink: 0;
}

@keyframes clip-pulse {
  from { transform: scale(1); }
  to   { transform: scale(1.07); }
}

.clip-sender {
  font-size: clamp(0.85rem, 3.5vw, 1rem);
  font-weight: 700;
  color: var(--mid);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.clip-message {
  font-size: clamp(1.3rem, 5.5vw, 1.65rem);
  font-weight: 900;
  color: var(--dark);
  text-align: center;
  line-height: 1.3;
}

.clip-progress-bar {
  width: 100%;
  height: 6px;
  background: rgba(0,0,0,0.08);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 0.25rem;
}

.clip-progress-fill {
  height: 100%;
  border-radius: 999px;
  width: 0%;
  transition: width linear;
}

/* ── Correct Tile Flash ─────────────────────────────────────── */
@keyframes correct-flash {
  0%   { filter: brightness(1.5) drop-shadow(0 0 10px rgba(78, 205, 196, 0.9)); }
  100% { filter: brightness(1) drop-shadow(none); }
}

.correct-flash {
  animation: correct-flash 0.5s ease forwards;
}

/* ── Wrong Tile Shake ───────────────────────────────────────── */
@keyframes wrong-shake {
  0%   { transform: translateX(0); }
  20%  { transform: translateX(-8px); }
  40%  { transform: translateX(8px); }
  60%  { transform: translateX(-6px); }
  80%  { transform: translateX(6px); }
  100% { transform: translateX(0); }
}

.wrong-shake {
  animation: wrong-shake 0.4s ease;
}

/* ── Floating +1 Text ───────────────────────────────────────── */
.float-text {
  position: fixed;
  font-size: 2rem;
  font-weight: 900;
  color: var(--coral);
  pointer-events: none;
  z-index: 300;
  text-shadow: 0 2px 8px rgba(0,0,0,0.2);
  animation: float-up 0.9s ease forwards;
}

@keyframes float-up {
  0%   { opacity: 1; transform: translateY(0) scale(1); }
  60%  { opacity: 1; transform: translateY(-40px) scale(1.2); }
  100% { opacity: 0; transform: translateY(-70px) scale(0.9); }
}

/* ── Responsive Layout ──────────────────────────────────────── */
@media (min-height: 700px) {
  .puzzle-header { padding: 0.8rem 1.25rem 0.5rem; }
}

@media (min-width: 480px) {
  .puzzle-header { padding: 0.8rem 1.5rem 0.5rem; }
  .puzzle-canvas-wrap { padding: 0.5rem 1.5rem 0.25rem; }
  /* Do NOT override tile-bank-wrap height here */
}

/* ── Landscape: shrink bank slightly ────────────────────────── */
@media (orientation: landscape) and (max-height: 500px) {
  .puzzle-header { padding: 0.3rem 0.75rem; }
  .tile-bank-wrap { height: 100px; flex: 0 0 100px; }
  .puzzle-canvas-wrap { padding: 0.2rem 0.75rem 0; }
}

/* ════════════════════════════════════════════════════════════
   PARENT LOCK SYSTEM
   ════════════════════════════════════════════════════════════ */

/* ── Base overlay ───────────────────────────────────────────── */
.parent-overlay {
  position: fixed;
  inset: 0;
  z-index: 800;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s ease;
}

.parent-overlay.open {
  opacity: 1;
  pointer-events: all;
}

/* ── Modal card ─────────────────────────────────────────────── */
.parent-modal {
  background: white;
  border-radius: 1.75rem;
  padding: 1.75rem 1.5rem 1.4rem;
  width: min(88vw, 340px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  box-shadow: 0 24px 80px rgba(0,0,0,0.35);
  transform: scale(0.88) translateY(20px);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.parent-overlay.open .parent-modal {
  transform: scale(1) translateY(0);
}

.parent-modal-icon {
  font-size: 2.2rem;
  line-height: 1;
  margin-bottom: 0.15rem;
}

.parent-modal-title {
  font-size: 1.25rem;
  font-weight: 900;
  color: var(--dark);
}

.parent-modal-sub {
  font-size: 0.82rem;
  color: var(--mid);
  font-weight: 600;
  margin-bottom: 0.5rem;
  text-align: center;
}

/* ── PIN dots ───────────────────────────────────────────────── */
.pin-dots {
  display: flex;
  gap: 0.9rem;
  margin: 0.5rem 0 0.2rem;
}

.pin-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(0,0,0,0.1);
  border: 2.5px solid rgba(0,0,0,0.18);
  transition: background 0.15s, transform 0.15s;
}

.pin-dot.filled {
  background: var(--coral);
  border-color: var(--coral);
  transform: scale(1.15);
}

/* ── PIN error message ──────────────────────────────────────── */
.pin-error {
  font-size: 0.78rem;
  color: var(--coral);
  font-weight: 700;
  height: 1.1em;
  text-align: center;
}

@keyframes error-shake {
  0%,100% { transform: translateX(0); }
  20%     { transform: translateX(-8px); }
  40%     { transform: translateX(8px); }
  60%     { transform: translateX(-6px); }
  80%     { transform: translateX(4px); }
}

.pin-dots.shake {
  animation: error-shake 0.4s ease;
}

/* ── PIN numpad ─────────────────────────────────────────────── */
.pin-pad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.55rem;
  width: 100%;
  margin: 0.4rem 0 0.3rem;
}

.pin-key {
  aspect-ratio: 1;
  border: none;
  border-radius: 0.85rem;
  background: #F5F5F5;
  font-family: var(--font-round);
  font-size: clamp(1.2rem, 5vw, 1.5rem);
  font-weight: 800;
  color: var(--dark);
  cursor: pointer;
  transition: background 0.1s, transform 0.1s;
  box-shadow: 0 3px 0 rgba(0,0,0,0.1);
  -webkit-tap-highlight-color: transparent;
}

.pin-key:active {
  background: #E8E8E8;
  transform: scale(0.94) translateY(2px);
  box-shadow: none;
}

.pin-key-clear { background: #FFE5E5; color: var(--coral); }
.pin-key-back  { background: #FFF3E0; color: #E65100; }

/* ── Cancel link ────────────────────────────────────────────── */
.pin-cancel {
  border: none;
  background: none;
  font-family: var(--font-round);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--mid);
  cursor: pointer;
  padding: 0.4rem 1rem;
  margin-top: 0.2rem;
  border-radius: 2rem;
  transition: color 0.15s, background 0.15s;
}

.pin-cancel:active { background: #F0F0F0; color: var(--dark); }

/* ── Long-press ring on ⭐ ───────────────────────────────────── */
#longpress-ring {
  position: fixed;
  pointer-events: none;
  z-index: 600;
  width: 44px;
  height: 44px;
  opacity: 0;
  transition: opacity 0.15s;
}

#longpress-ring.visible { opacity: 1; }

#longpress-arc {
  transition: stroke-dashoffset 3s linear;
}

/* ── Star button in header gets subtle hint styling ─────────── */
.star-counter {
  cursor: pointer;
  border-radius: 8px;
  padding: 2px 4px;
  transition: background 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.star-counter:active { background: rgba(255,107,107,0.12); }

/* ── Complete screen trophy long-press ──────────────────────── */
.complete-emoji {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  display: inline-block;
}

/* Tiny subtle parent hint — visible to reading adults, ignored by toddlers */
.parent-hint {
  position: absolute;
  bottom: 1.2rem;
  font-size: 0.65rem;
  color: rgba(0,0,0,0.18);
  font-weight: 600;
  letter-spacing: 0.04em;
  pointer-events: none;
  user-select: none;
}

/* ════════════════════════════════════════════════════════════
   VIDEO OVERLAY — video-mode (Phase 2 real clip)
   ════════════════════════════════════════════════════════════ */

/* Hide placeholder card in video mode */
#video-overlay.video-mode .clip-card {
  display: none;
}

/* Hide video wrap in placeholder mode */
.fpls-video-wrap {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  width: 100%;
  padding: 1rem;
}

#video-overlay.video-mode .fpls-video-wrap {
  display: flex;
}

/* Sender label above video */
.fpls-sender-label {
  color: white;
  font-size: clamp(1rem, 4vw, 1.25rem);
  font-weight: 900;
  text-shadow: 0 2px 12px rgba(0,0,0,0.6);
  letter-spacing: 0.02em;
}

/* Video frame container — circular portrait */
#fpls-video-frame {
  position: relative;
  width: min(72vw, 320px);
  height: min(72vw, 320px);
  border-radius: 50%;
  overflow: hidden;
  box-shadow: 0 0 0 6px rgba(255,255,255,0.9), 0 0 0 12px var(--coral), 0 20px 60px rgba(0,0,0,0.45);
  background: #000;
  animation: fpls-pop-in 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes fpls-pop-in {
  from { transform: scale(0.6); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

/* The actual video element — fills the circle */
#fpls-video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;   /* fills circle, crops edges — face stays centered */
  background: #000;
}

/* Tap hint below */
.fpls-tap-hint {
  color: rgba(255,255,255,0.55);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* ════════════════════════════════════════════════════════════
   PARENT MENU
   ════════════════════════════════════════════════════════════ */

.parent-menu-modal {
  gap: 0.75rem;
}

.parent-menu-btns {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  width: 100%;
  margin-top: 0.4rem;
}

.parent-menu-btn {
  width: 100%;
  padding: 0.85rem 1rem;
  background: #F7F7F7;
  border: none;
  border-radius: 1rem;
  font-family: var(--font-round);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--dark);
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  transition: background 0.12s;
  box-shadow: 0 2px 0 rgba(0,0,0,0.07);
}

.parent-menu-btn span { font-size: 1.3em; }
.parent-menu-btn:active { background: #EFEFEF; }

/* ════════════════════════════════════════════════════════════
   IMPORT SCREEN  (Phase 2 — parent / dev tool)
   ════════════════════════════════════════════════════════════ */

#screen-import {
  background: #F8F4FF;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.import-header {
  flex: 0 0 auto;
  background: white;
  border-bottom: 1.5px solid rgba(0,0,0,0.07);
  padding: 0.85rem 1rem 0.7rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.import-back-btn {
  border: none;
  background: none;
  font-family: var(--font-round);
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--coral);
  cursor: pointer;
  padding: 0.3rem 0.6rem;
  border-radius: 8px;
  transition: background 0.12s;
  flex-shrink: 0;
}
.import-back-btn:active { background: #FFE5E5; }

.import-title {
  font-size: 1rem;
  font-weight: 900;
  color: var(--dark);
  flex: 1;
}

.import-sync-btn {
  border: 2px solid var(--coral);
  background: none;
  font-family: var(--font-round);
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--coral);
  cursor: pointer;
  padding: 0.3rem 0.7rem;
  border-radius: 99px;
  flex-shrink: 0;
  transition: background 0.12s;
}
.import-sync-btn:active { background: #FFE5E5; }
.import-sync-btn.spinning { opacity: 0.5; pointer-events: none; }

.import-subtitle {
  font-size: 0.68rem;
  color: var(--mid);
  font-weight: 600;
  background: #EDE7FF;
  color: #6B46C1;
  padding: 0.2rem 0.5rem;
  border-radius: 99px;
}

/* Scrollable body */
.import-body {
  flex: 1 1 0;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  -webkit-overflow-scrolling: touch;
}

.import-section {
  background: white;
  border-radius: 1rem;
  padding: 1rem;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.import-section-title {
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--mid);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* Clip list rows */
.import-clip-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.import-cat-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.3rem;
  border-bottom: 1px solid rgba(0,0,0,0.05);
}

.import-cat-label {
  flex: 1;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--dark);
}

.import-cat-count {
  font-size: 0.8rem;
  font-weight: 700;
  color: #4CAF50;
  background: #E8F5E9;
  padding: 0.15rem 0.55rem;
  border-radius: 99px;
}

.import-cat-none {
  font-size: 0.75rem;
  color: var(--mid);
  font-style: italic;
}

.import-cat-clear {
  border: none;
  background: #FFF0F0;
  color: var(--coral);
  font-family: var(--font-round);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  cursor: pointer;
}

.import-loading {
  color: var(--mid);
  font-size: 0.85rem;
  padding: 0.5rem 0;
}

/* File input */
#import-file-input {
  display: none;
}

.import-file-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  padding: 1.1rem;
  border: 2.5px dashed rgba(0,0,0,0.14);
  border-radius: 1rem;
  cursor: pointer;
  text-align: center;
  transition: border-color 0.15s, background 0.15s;
  font-family: var(--font-round);
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--dark);
}

.import-file-label:active { background: #F0F0F0; }

.import-file-icon { font-size: 1.8rem; line-height: 1; }

.import-file-hint {
  font-size: 0.7rem;
  color: var(--mid);
  font-weight: 600;
}

/* Form fields */
.import-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.import-field-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--mid);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.import-input,
.import-select {
  width: 100%;
  padding: 0.7rem 0.85rem;
  border: 2px solid rgba(0,0,0,0.1);
  border-radius: 0.75rem;
  font-family: var(--font-round);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--dark);
  background: white;
  outline: none;
  transition: border-color 0.15s;
  box-sizing: border-box;
}

.import-input:focus,
.import-select:focus {
  border-color: var(--coral);
}

/* Status message */
.import-status {
  font-size: 0.82rem;
  font-weight: 600;
  min-height: 1.2em;
  padding: 0 0.2rem;
}

.import-status.error   { color: var(--coral); }
.import-status.success { color: #2e7d32; }
.import-status.info    { color: #1565C0; }

/* Save button */
.import-save-btn {
  width: 100%;
  padding: 0.9rem;
  background: var(--coral);
  color: white;
  border: none;
  border-radius: 1rem;
  font-family: var(--font-round);
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
  box-shadow: 0 4px 0 rgba(0,0,0,0.15);
}

.import-save-btn:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 rgba(0,0,0,0.12);
}

.import-save-btn:disabled {
  opacity: 0.38;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* ── Import screen test button ──────────────────────────────── */
.import-cat-test {
  border: none;
  background: #E8F5E9;
  color: #2e7d32;
  font-family: var(--font-round);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  cursor: pointer;
}
.import-cat-test:active { background: #C8E6C9; }

/* ── Onboarding screen ──────────────────────────────────────── */
#screen-onboard {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  justify-content: flex-start;
  padding-top: 1.5rem;
  padding-bottom: 2.5rem;
  align-items: center;
}

.onboard-card {
  background: white;
  border-radius: 1.5rem;
  padding: 1.25rem 1.25rem;
  width: calc(100% - 2rem);
  max-width: 380px;
  margin: 0 auto;
  box-shadow: 0 8px 40px rgba(0,0,0,0.12);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.onboard-title {
  font-size: 1.2rem;
  font-weight: 900;
  color: var(--coral);
  text-align: center;
}

.onboard-sub {
  font-size: 0.82rem;
  color: #888;
  text-align: center;
  margin-top: -0.25rem;
}

.onboard-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.onboard-label {
  font-size: 0.72rem;
  font-weight: 800;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.onboard-hint {
  font-weight: 600;
  color: #aaa;
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.68rem;
}

.onboard-input {
  width: 100%;
  padding: 0.6rem 0.9rem;
  border: 2px solid rgba(0,0,0,0.1);
  border-radius: 0.75rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: #2D2D2D;
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.15s;
}

.onboard-input:focus { border-color: var(--coral); }

.onboard-pin {
  letter-spacing: 0.5em;
  text-align: center;
  font-size: 1.2rem;
}

.onboard-error {
  font-size: 0.82rem;
  color: var(--coral);
  font-weight: 700;
  min-height: 1.1em;
  text-align: center;
}

.onboard-btn {
  width: 100%;
  padding: 0.85rem;
  background: var(--coral);
  color: white;
  border: none;
  border-radius: 1rem;
  font-size: 1rem;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 4px 0 rgba(0,0,0,0.15);
  transition: transform 0.1s, box-shadow 0.1s;
}

.onboard-btn:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 rgba(0,0,0,0.12);
}

.onboard-btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* Family code display */
.onboard-code-box {
  background: #FFF8F0;
  border: 2.5px solid var(--coral);
  border-radius: 1rem;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.onboard-code-label {
  font-size: 0.72rem;
  font-weight: 800;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.onboard-code {
  font-size: 2rem;
  font-weight: 900;
  color: var(--coral);
  letter-spacing: 0.15em;
  font-family: 'Courier New', monospace;
}

.onboard-copy-btn {
  background: none;
  border: 2px solid var(--coral);
  color: var(--coral);
  border-radius: 99px;
  padding: 0.3rem 1rem;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
}

.onboard-copy-btn:active { background: #FFF0F0; }

/* Instructions */
.onboard-instructions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.onboard-instr-item {
  font-size: 0.82rem;
  color: #555;
  font-weight: 600;
  background: #F8F4FF;
  border-radius: 0.6rem;
  padding: 0.5rem 0.75rem;
}

/* ── Family code box in management screen ───────────────────── */
.import-family-code {
  background: #FFF8F0;
  border: 2px solid var(--coral);
  border-radius: 1rem;
  padding: 0.9rem 1.1rem;
  margin: 0 0 0.75rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
}

.import-code-label {
  font-size: 0.7rem;
  font-weight: 800;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  text-align: center;
}

.import-code-value {
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--coral);
  letter-spacing: 0.18em;
  font-family: 'Courier New', monospace;
}

.import-copy-code {
  background: none;
  border: 1.5px solid var(--coral);
  color: var(--coral);
  border-radius: 99px;
  padding: 0.2rem 0.85rem;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
}

/* ── Child selector screen ─────────────────────────────────── */
.child-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
  padding: 0 1.5rem;
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
}

.child-card {
  flex: 1 1 140px;
  max-width: 180px;
  background: white;
  border: 3px solid rgba(0,0,0,0.08);
  border-radius: 1.25rem;
  padding: 1.5rem 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}

.child-card:active {
  transform: scale(0.96);
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  border-color: var(--coral);
}

.child-card-emoji { font-size: 3rem; line-height: 1; }

.child-card-name {
  font-size: 1.1rem;
  font-weight: 900;
  color: var(--dark);
}

.child-card-age {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--mid);
  background: #F0F0F0;
  padding: 0.2rem 0.6rem;
  border-radius: 99px;
}

.child-add-btn {
  margin-top: 1rem;
  padding: 0.75rem 2rem;
  background: white;
  border: 2.5px dashed rgba(0,0,0,0.15);
  border-radius: 99px;
  font-family: var(--font, inherit);
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--mid, #888);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}

.child-add-btn:active { border-color: var(--coral); color: var(--coral); }

/* ── PIN input field (replaces numpad) ─────────────────────── */
.pin-text-input {
  width: 100%;
  padding: 1rem;
  border: 2.5px solid rgba(0,0,0,0.1);
  border-radius: 1rem;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.4em;
  text-align: center;
  outline: none;
  color: var(--dark, #2D2D2D);
  background: white;
  transition: border-color 0.15s;
  margin: 0.5rem 0;
}

.pin-text-input:focus { border-color: var(--coral, #FF6B6B); }

.pin-submit-btn {
  width: 100%;
  padding: 0.85rem;
  background: var(--coral, #FF6B6B);
  color: white;
  border: none;
  border-radius: 0.85rem;
  font-family: var(--font, inherit);
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  margin-top: 0.25rem;
}

/* ── Child selector screen ──────────────────────────────────── */
.child-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
  padding: 0 1rem;
  width: 100%;
  max-width: 420px;
}

.child-card {
  background: white;
  border: none;
  border-radius: 1.25rem;
  padding: 1.5rem 1.25rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0,0,0,0.10);
  flex: 0 0 calc(50% - 0.5rem);
  max-width: 160px;
  transition: transform 0.15s, box-shadow 0.15s;
  font-family: inherit;
}

.child-card:active {
  transform: scale(0.96);
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.child-card-emoji {
  font-size: 3rem;
  line-height: 1;
}

.child-card-name {
  font-size: 1rem;
  font-weight: 900;
  color: var(--dark);
  text-align: center;
}

.child-add-btn {
  margin-top: 0.5rem;
  background: none;
  border: 2.5px dashed rgba(0,0,0,0.15);
  border-radius: 1rem;
  padding: 0.75rem 1.75rem;
  font-size: 0.95rem;
  font-weight: 800;
  color: #888;
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.15s, color 0.15s;
}
.child-add-btn:active { border-color: var(--coral); color: var(--coral); }

/* ── PIN input field (replaces numpad) ──────────────────────── */
.pin-text-input {
  width: 100%;
  padding: 0.9rem;
  border: 2.5px solid rgba(0,0,0,0.12);
  border-radius: 1rem;
  font-size: 1.6rem;
  letter-spacing: 0.5em;
  text-align: center;
  font-weight: 700;
  outline: none;
  transition: border-color 0.15s;
  margin-bottom: 0.25rem;
}
.pin-text-input:focus { border-color: var(--coral); }

.pin-submit-btn {
  width: 100%;
  padding: 0.85rem;
  background: var(--coral);
  color: white;
  border: none;
  border-radius: 1rem;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 0 rgba(0,0,0,0.15);
}

/* ── Sync toast ──────────────────────────────────────────────── */
.sync-toast {
  position: fixed;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%) translateY(-80px);
  background: #2D2D2D;
  color: white;
  padding: 0.6rem 1.25rem;
  border-radius: 99px;
  font-size: 0.85rem;
  font-weight: 700;
  transition: transform 0.4s cubic-bezier(.34,1.56,.64,1);
  z-index: 999;
  white-space: nowrap;
  pointer-events: none;
}
.sync-toast.show { transform: translateX(-50%) translateY(0); }

/* ── Child Selector Screen ────────────────────────────────── */
.children-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
  padding: 0 1rem;
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
}

.child-card {
  background: white;
  border-radius: 1.25rem;
  padding: 1.5rem 1rem;
  width: calc(50% - 0.5rem);
  max-width: 160px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  box-shadow: 0 4px 20px rgba(0,0,0,0.1);
  cursor: pointer;
  border: 3px solid transparent;
  transition: border-color 0.15s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
}
.child-card:active { transform: scale(0.96); }
.child-card:hover  { border-color: var(--coral); }

.child-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--coral), var(--yellow));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  font-weight: 900;
  color: white;
}

.child-name {
  font-size: 1rem;
  font-weight: 900;
  color: var(--dark);
  text-align: center;
}

.child-age-badge {
  font-size: 0.72rem;
  font-weight: 700;
  color: #888;
  background: #F0F0F0;
  border-radius: 99px;
  padding: 0.15rem 0.6rem;
}

.add-child-btn {
  margin-top: 0.5rem;
  padding: 0.75rem 1.75rem;
  background: none;
  border: 2.5px dashed rgba(0,0,0,0.2);
  border-radius: 99px;
  font-family: var(--font, system-ui);
  font-size: 0.9rem;
  font-weight: 800;
  color: #888;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.add-child-btn:hover { border-color: var(--coral); color: var(--coral); }

.import-reset-sync {
  width: 100%;
  padding: .45rem;
  background: none;
  border: 1.5px dashed rgba(0,0,0,.15);
  border-radius: .65rem;
  font-family: var(--font-round);
  font-size: .75rem;
  font-weight: 700;
  color: #999;
  cursor: pointer;
  margin-bottom: .25rem;
}
.import-reset-sync:active { background: #f5f5f5; }

/* ── Forgot PIN link ─────────────────────────────────────── */
.pin-forgot-link {
  background: none;
  border: none;
  font-family: var(--font-round);
  font-size: 0.82rem;
  font-weight: 700;
  color: #999;
  cursor: pointer;
  margin-top: 0.1rem;
  text-decoration: underline;
  padding: 0;
}
.pin-forgot-link:hover { color: var(--coral); }

/* ── Forgot PIN overlay inputs ───────────────────────────── */
.pin-text-input {
  width: 100%;
  padding: 0.7rem 1rem;
  border: 2px solid rgba(0,0,0,0.12);
  border-radius: 0.75rem;
  font-family: var(--font-round);
  font-size: 1rem;
  font-weight: 700;
  outline: none;
  box-sizing: border-box;
}
.pin-text-input:focus { border-color: var(--coral); }
