/* ====== FONDO ANIMADO PARA TODA LA PÁGINA (sin bordes blancos) ====== */
:root{
  --bg1:#ff9a9e;   /* rosa */
  --bg2:#fad0c4;   /* rosa claro */
  --bg3:#a1c4fd;   /* celeste */
  --bg4:#c2e9fb;   /* celeste claro */
  --primary:#ff6b6b;
  --accent:#3b5998;
  --ok:#16a34a;
  --warn:#f59e0b;
  --text:#1f2937;
  --card:#ffffff;
  --muted:#6b7280;
}

*{box-sizing:border-box}
html,body{height:100%}

body{
  margin:0;
  font-family:'Nunito',system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;
  color:var(--text);
  /* Degradado multicolor en movimiento */
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(255,255,255,.35), transparent 70%),
    radial-gradient(1200px 600px at 100% 0%, rgba(255,255,255,.35), transparent 70%),
    linear-gradient(135deg, var(--bg1), var(--bg2), var(--bg3), var(--bg4));
  background-size: 200% 200%;
  animation: bgMove 16s ease-in-out infinite;
}

/* Animación del fondo */
@keyframes bgMove{
  0%{background-position: 0% 50%;}
  50%{background-position: 100% 50%;}
  100%{background-position: 0% 50%;}
}

/* ====== ELEMENTOS FLOTANTES EN LOS LADOS ====== */
.bg-scene{
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  /* sutil patrón de puntos */
  background-image:
    radial-gradient(rgba(255,255,255,.25) 1px, transparent 1px);
  background-size: 24px 24px;
  opacity: 0.55;
}
.floater{
  position: absolute;
  font-size: clamp(22px, 3vw, 38px);
  filter: drop-shadow(0 4px 8px rgba(0,0,0,.15));
  animation: floatUp linear infinite;
  opacity: .9;
}
@keyframes floatUp{
  0%{ transform: translateY(30vh) rotate(0deg); }
  100%{ transform: translateY(-120vh) rotate(30deg); }
}
/* Distribución en lados para que no tapen el centro */
.f1{ left: 4%;  animation-duration: 16s; }
.f2{ right: 6%; animation-duration: 19s; animation-delay: 1s;}
.f3{ left: 9%;  animation-duration: 21s; animation-delay: .5s;}
.f4{ right: 10%; animation-duration: 18s; animation-delay: 1.5s;}
.f5{ left: 2%;  animation-duration: 23s; animation-delay: 2s;}
.f6{ right: 3%; animation-duration: 20s; animation-delay: .2s;}
.f7{ left: 12%; animation-duration: 17s; animation-delay: .8s;}
.f8{ right: 14%; animation-duration: 22s; animation-delay: 1.2s;}

/* ====== CABECERA Y CONTENEDORES ====== */
h1,h2{margin:0 0 .5rem}
h1 span{font-family:'Baloo 2', cursive; color:var(--primary); font-size:1.2em}

.app-header{
  position: sticky; top:0; z-index: 2;
  padding:1rem clamp(.5rem,2vw,1.5rem);
  display:grid; gap:.75rem;
  background: linear-gradient(90deg,#fff8, #fff8), linear-gradient(90deg,#ffe4e6,#e0f2fe);
  backdrop-filter: blur(6px);
  border-bottom:1px solid #0001;
}

.toolbar{display:flex; gap:.5rem; flex-wrap:wrap; align-items:center}
.btn{
  border:0; padding:.6rem .9rem; border-radius:999px;
  background:linear-gradient(180deg,#fff,#f3f4f6);
  color:var(--text); font-weight:800; box-shadow:0 4px 12px #0002; cursor:pointer;
  transition:transform .15s ease, box-shadow .2s ease, filter .2s ease;
  z-index: 2;
}
.btn:hover{transform:translateY(-2px); box-shadow:0 6px 16px #0003}
.btn.icon{font-size:1.1rem}
.btn.success{background:linear-gradient(180deg,#dcfce7,#86efac); color:#065f46}
.btn.warn{background:linear-gradient(180deg,#fff7ed,#fed7aa); color:#9a3412}
.picker{display:flex; gap:.4rem; align-items:center; font-weight:700; color:var(--muted)}
.picker input[type=color]{width:40px; height:32px; padding:0; border-radius:8px; border:1px solid #0002}
.picker input[type=range]{width:120px}

/* Layout centrado pero con fondo ocupando toda la pantalla */
.layout{
  position: relative;
  z-index: 1;
  display:grid; grid-template-columns: 1.2fr .8fr; gap:1rem;
  padding:1rem; max-width:1200px; margin:0 auto;
}

.card{
  background:var(--card);
  border-radius:22px; padding:1rem;
  box-shadow:0 12px 24px #0001, inset 0 1px 0 #fff9;
}

.letter-card .letter{
  font-family:'Baloo 2', cursive;
  font-size: clamp(80px, 12vw, 140px);
  line-height:1; color:var(--primary);
  text-shadow: 4px 4px 0 #ffd1d1, 8px 8px 0 #ffc4c4;
  text-align:center;
}
.letter-card .sub{display:flex; gap:.5rem; justify-content:center; color:var(--muted); font-weight:800}

.canvas-card{display:grid; place-items:center; position:relative; overflow:hidden}
#canvas{
  width:100%; max-width:420px; aspect-ratio:1/1; background:#fff;
  border:8px solid var(--primary); border-radius:24px; box-shadow:0 10px 30px #ff6b6b66;
  touch-action:none;
}
.canvas-hint{position:absolute; bottom:.6rem; background:#0007; color:#fff; padding:.35rem .6rem; border-radius:999px; font-size:.9rem}

.feedback{min-height:52px; font-weight:800; font-size:1.1rem; text-align:center}

.progress-card{display:grid; gap:.5rem; text-align:center}
.progress-bar{height:14px; border-radius:999px; background:#0001; overflow:hidden}
.bar{height:100%; width:0%; background:linear-gradient(90deg,#86efac,#34d399)}
.stars{filter:drop-shadow(0 4px 8px #0002); font-size:1.4rem}
.streak{color:var(--muted); font-weight:800}

.right .card{height:fit-content}
.quiz h2{font-size:1.2rem}
.options{display:grid; grid-template-columns: repeat(3, 1fr); gap:.5rem; margin-top:.5rem}
.option{
  border:2px dashed #0002; border-radius:18px; padding:.6rem;
  text-align:center; cursor:pointer; background:#f8fafc; font-weight:800;
  transition: transform .15s ease, box-shadow .2s ease, background .2s ease;
}
.option:hover{transform:translateY(-2px); box-shadow:0 6px 16px #0002}
.option.correct{background:#dcfce7; border-color:#22c55e}
.option.wrong{background:#fee2e2; border-color:#ef4444}

.stickers h2{font-size:1.2rem}
.sticker-wall{display:flex; gap:.5rem; flex-wrap:wrap; min-height:44px; font-size:1.6rem}

.app-footer{
  position: relative;
  z-index: 1;
  padding:1rem; text-align:center; color:var(--muted)
}

dialog::backdrop{background:rgba(0,0,0,.45)}
dialog{border:0; border-radius:22px; padding:0}
.reward{padding:1.2rem; text-align:center}
.reward-sticker{font-size:4rem; margin:.5rem 0}

@media (max-width: 900px){
  .layout{grid-template-columns:1fr}
  .options{grid-template-columns: repeat(2, 1fr)}
}
