:root{
  --bg1:#0b1b5a;
  --bg2:#0a1a46;
  --bg3:#071136;
  --glass: rgba(255,255,255,.10);
  --stroke: rgba(255,255,255,.20);
  --text: #ffffff;
  --muted: rgba(255,255,255,.80);
  --green: #86efac;
  --yellow: #fde68a;
  --cyan: #67e8f9;
  --shadow: 0 24px 70px rgba(0,0,0,.45);
  --r: 24px;
}

*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color: var(--text);
  background: linear-gradient(to bottom, var(--bg1), var(--bg2), var(--bg3));
  overflow-x:hidden;
}

.page{
  min-height: 100vh;
  display:flex;
  align-items:center;
  justify-content:center;
  padding: clamp(12px, 3vw, 20px);
  position:relative;
  overflow:hidden;
}

.container{
  width: min(860px, 100%);
  position:relative;
  z-index:2;
}

.hidden{ display:none !important; }

/* Estrellas */
.stars{
  position:absolute;
  inset:0;
  pointer-events:none;
  z-index:0;
}
.star{
  position:absolute;
  color: rgba(253, 230, 138, .8);
  opacity:.65;
  animation: twinkle 2s ease-in-out infinite;
  user-select:none;
}

/* Confeti */
.confettiLayer{
  position:absolute;
  inset:0;
  pointer-events:none;
  z-index:1;
}
.conf{
  position:absolute;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  top: -20px;
  animation-name: fall;
  animation-timing-function: linear;
  animation-fill-mode: forwards;
}

/* Cards */
.card{
  background: var(--glass);
  backdrop-filter: blur(14px);
  border: 1px solid var(--stroke);
  border-radius: calc(var(--r) + 8px);
  box-shadow: var(--shadow);
  padding: clamp(18px, 4vw, 34px);
}

.intro{
  text-align:center;
}

.playing{
  padding: clamp(16px, 3vw, 26px);
}

.completed{
  border: 2px solid rgba(253, 230, 138, .75);
  background: linear-gradient(135deg, rgba(239,68,68,.25), rgba(34,197,94,.25));
  position:relative;
  overflow:hidden;
}

.h1{
  margin: 10px 0 8px;
  font-weight: 900;
  font-size: clamp(28px, 6.5vw, 44px);
}
.h1.bigShadow{
  text-shadow: 4px 4px 0 rgba(0,0,0,.30);
}
.h2{
  margin: 0 0 8px;
  font-weight: 800;
  font-size: clamp(20px, 4.8vw, 30px);
}
.p{
  margin: 0 0 16px;
  color: var(--muted);
  font-size: clamp(14px, 3.8vw, 18px);
  line-height: 1.4;
}
.lead{ color: rgba(134,239,172,.92); font-size: clamp(16px, 4.2vw, 20px); }

/* Botones */
.btn{
  border: 0;
  cursor:pointer;
  font-weight: 900;
  border-radius: 999px;
  padding: 14px 22px;
  font-size: clamp(16px, 4.2vw, 22px);
  box-shadow: 0 14px 30px rgba(0,0,0,.25);
  transition: transform .12s ease;
  min-height: 48px; /* cómodo para dedo */
}
.btn:active{ transform: scale(.98); }
.btn.primary{
  color:#fff;
  background: linear-gradient(to right, #ef4444, #22c55e);
}
.btn.secondary{
  color:#fff;
  background: linear-gradient(to right, #3b82f6, #9333ea);
  border: 4px solid rgba(255,255,255,.9);
  font-size: clamp(16px, 4.2vw, 20px);
}

/* Header playing */
.header{
  text-align:center;
  margin-bottom: 12px;
}
.counter{
  color: rgba(253, 230, 138, .95);
  font-weight: 800;
  font-size: clamp(14px, 3.8vw, 18px);
}

/* Mensaje flotante */
.toast{
  position: fixed;
  left: 50%;
  top: 25%;
  transform: translate(-50%, -50%);
  z-index: 50;
  animation: popIn .3s ease-out forwards;
}
.toastInner{
  background:#fff;
  border-radius: 18px;
  padding: 18px 18px;
  width: min(340px, 86vw);
  border: 4px solid #facc15;
  text-align:center;
  box-shadow: 0 22px 60px rgba(0,0,0,.35);
}
.toastEmoji{
  font-size: 52px;
  margin-bottom: 10px;
}
.toastText{
  margin:0;
  color:#1f2937;
  font-weight: 900;
  font-size: 22px;
}

/* Escena del árbol */
.scene{
  position:relative;
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,.18);
  background: linear-gradient(to bottom, rgba(56,189,248,.12), rgba(34,197,94,.10));
  padding: 14px;
  height: clamp(380px, 70vh, 520px); /* responsivo */
  overflow:hidden;
}

.tree{
  position:absolute;
  left: 50%;
  top: 10%;
  transform: translateX(-50%);
  text-align:center;
}
.treeStar{
  font-size: 52px;
  margin-bottom: 4px;
}
.treeLayers .layer{
  line-height: 0.9;
  user-select:none;
}
.layer.l1{ font-size: 64px; }
.layer.l2{ font-size: 76px; margin-top:-18px; }
.layer.l3{ font-size: 92px; margin-top:-26px; }
.trunk{
  width: 48px;
  height: 28px;
  background: #92400e;
  border-radius: 4px;
  margin: 4px auto 0;
}

/* Luces */
.lights{ position:absolute; inset:0; }
.light{
  position:absolute;
  font-size: 22px;
  animation: twinkle 2s ease-in-out infinite;
  user-select:none;
}

/* Regalos (posiciones en %) para móvil) */
.gift{
  position:absolute;
  border:0;
  background: transparent;
  cursor:pointer;
  transform: translateX(-50%);
  transition: transform .25s ease, opacity .25s ease;
  padding:0;
}
.gift[disabled]{ cursor: default; }
.gift.hide{
  opacity: 0;
  transform: translateX(-50%) scale(0);
  pointer-events:none;
}
.giftBox{
  position:relative;
  border-radius: 12px;
  padding: 14px;
  border: 4px solid rgba(255,255,255,.25);
  box-shadow: 0 16px 34px rgba(0,0,0,.25);
}
.giftIcon{ font-size: 46px; }
.bow{
  position:absolute;
  left:50%;
  top:-12px;
  transform: translateX(-50%);
  font-size: 28px;
}

.grad.red{ background: linear-gradient(135deg, #ef4444, #b91c1c); }
.grad.blue{ background: linear-gradient(135deg, #3b82f6, #1d4ed8); }
.grad.green{ background: linear-gradient(135deg, #22c55e, #15803d); }

/* Ubicaciones bajo el árbol */
.g1{ left: 22%; bottom: 10%; }
.g2{ left: 50%; bottom: 8.5%; }
.g3{ left: 78%; bottom: 9.5%; }

.gift:hover:not([disabled]){ transform: translateX(-50%) scale(1.08); }

/* Nieve */
.snow{
  position:absolute;
  left:0; right:0; bottom:0;
  height: 64px;
  background: linear-gradient(to top, rgba(255,255,255,.30), transparent);
}

/* Completed */
.content{
  position:relative;
  z-index:2;
  text-align:center;
}
.panel{
  background: rgba(255,255,255,.18);
  border: 2px solid rgba(255,255,255,.35);
  border-radius: 18px;
  padding: 16px;
  margin: 14px 0 14px;
}
.list{
  display:flex;
  flex-direction:column;
  gap: 10px;
  margin-bottom: 14px;
}
.item{
  background: linear-gradient(to right, rgba(37,99,235,.45), rgba(147,51,234,.45));
  border: 1px solid rgba(255,255,255,.25);
  border-radius: 14px;
  padding: 12px;
  color:#fff;
  font-weight: 800;
  font-size: clamp(15px, 4vw, 18px);
  display:flex;
  justify-content:center;
  gap: 10px;
  align-items:center;
}
.item .e{ font-size: 26px; }

.finalMessage{
  border-radius: 14px;
  padding: 16px;
  border: 2px solid rgba(253, 230, 138, .85);
  background: linear-gradient(to right, rgb(34 75 187 / 65%), rgb(87 68 239 / 65%));
}
.finalTitle{
  margin: 0 0 10px;
  color: rgba(253, 230, 138, .98);
  font-weight: 900;
  font-size: clamp(18px, 4.6vw, 26px);
}
.finalBody{
  margin: 0 0 10px;
  font-size: clamp(14px, 3.9vw, 18px);
  line-height: 1.45;
}
.cyanBold{ color: rgba(103,232,249,.98); font-weight: 900; }
.finalFooter{
  margin:0;
  color: rgba(134,239,172,.95);
  font-weight: 800;
  font-size: clamp(13px, 3.6vw, 16px);
}

.emoji{ user-select:none; }
.emoji.big{ font-size: 72px; }
.emoji.huge{ font-size: 86px; }
.emojiRow{ font-size: 44px; margin: 12px 0 16px; }
.hint{
  text-align:center;
  margin: 10px 0 0;
  color: rgba(103,232,249,.92);
  font-size: 13px;
  animation: pulse 1.8s ease-in-out infinite;
}

/* Decoración del completed */
.decor{
  position:absolute;
  inset:0;
  opacity:.18;
  pointer-events:none;
  z-index:1;
}
.decor .d{
  position:absolute;
  font-size: 34px;
  animation: bounce 1.2s ease-in-out infinite;
  user-select:none;
}

/* Animaciones */
@keyframes fall {
  from { transform: translateY(0); }
  to   { transform: translateY(110vh); }
}
@keyframes twinkle {
  0%, 100% { opacity: .35; transform: scale(1); }
  50%      { opacity: 1; transform: scale(1.2); }
}
@keyframes float {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50%      { transform: translateX(-50%) translateY(-10px); }
}
@keyframes popIn {
  0%   { opacity:0; transform: translate(-50%,-50%) scale(.5); }
  100% { opacity:1; transform: translate(-50%,-50%) scale(1); }
}
@keyframes pulse {
  0%,100%{ opacity:.65; }
  50%{ opacity:1; }
}
@keyframes bounce {
  0%,100%{ transform: translateY(0); }
  50%{ transform: translateY(-6px); }
}

.float{ animation: float 2s ease-in-out infinite; }
.pulse{ animation: pulse 1.6s ease-in-out infinite; }
.bounce{ animation: bounce 1.2s ease-in-out infinite; }

/* Ajustes extra para pantallas muy chicas */
@media (max-width: 360px){
  .btn{ width: 100%; }
  .giftIcon{ font-size: 42px; }
  .giftBox{ padding: 12px; }
}
