/* Gestarin Kids · estilos. Pensado primero para tablet; se adapta a móvil y ordenador. */
:root {
  --ink: #23202b;
  --ink-soft: #5b5670;
  --paper: #fffdf7;
  --card: #ffffff;
  --line: #e7e1d3;
  --primary: #ff7b54;
  --primary-ink: #ffffff;
  --primary-dark: #e2603a;
  --sea: #2bb5a8;
  --dino: #5cc46a;
  --sand: #f6d68b;
  --sky: #5a5fb0;
  --gold: #f5b700;
  --ok: #2fa84f;
  --danger: #d6453d;
  --radius: 22px;
  --shadow: 0 6px 0 rgba(35, 32, 43, .12), 0 12px 28px rgba(35, 32, 43, .10);
  --font: ui-rounded, "SF Pro Rounded", "Segoe UI Rounded", "Arial Rounded MT Bold", "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
  --tap: 64px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font); color: var(--ink); background: var(--paper);
  -webkit-tap-highlight-color: transparent; overscroll-behavior: none;
  background-image: radial-gradient(circle at 12% 18%, #ffe9c7 0 90px, transparent 91px), radial-gradient(circle at 88% 82%, #d8f3ee 0 140px, transparent 141px);
  background-attachment: fixed;
}
button { font-family: inherit; color: inherit; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 4px solid #4d96ff; outline-offset: 3px; }
h1, h2 { margin: 0; line-height: 1.15; }
h1:focus { outline: none; }
.boot, .noscript { padding: 40px; text-align: center; font-size: 1.3rem; }

#app { min-height: 100%; }
.screen { min-height: 100vh; min-height: 100dvh; padding: max(12px, env(safe-area-inset-top)) 16px 24px; max-width: 1180px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }

/* ---------- Botones ---------- */
.btn { border: 0; border-radius: 999px; padding: 14px 26px; font-size: 1.1rem; font-weight: 800; background: #efeae0; cursor: pointer; box-shadow: 0 4px 0 rgba(0,0,0,.12); transition: transform .1s; min-height: 52px; touch-action: manipulation; }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0,0,0,.12); }
.btn.primary { background: var(--primary); color: var(--primary-ink); box-shadow: 0 5px 0 var(--primary-dark); }
.btn.big { font-size: 1.25rem; padding: 16px 30px; min-height: var(--tap); }
.btn.huge { font-size: clamp(1.5rem, 4vw, 2.1rem); padding: 20px 56px; min-height: 84px; align-self: center; }
.btn.ghost { background: transparent; box-shadow: none; text-decoration: underline; text-underline-offset: 4px; }
.btn.danger { background: var(--danger); color: #fff; box-shadow: 0 4px 0 #9e2d27; }
.icon-btn { width: var(--tap); height: var(--tap); border-radius: 50%; border: 0; background: var(--card); box-shadow: var(--shadow); display: grid; place-items: center; cursor: pointer; flex: none; touch-action: manipulation; }
.icon-btn svg { width: 34px; height: 34px; }
.icon-btn:active { transform: translateY(2px); }
.icon-btn.hint { color: #c99000; }
.icon-btn.hint.used { opacity: .45; }
.wiggle { animation: wiggle 1s ease-in-out infinite; }
@keyframes wiggle { 0%,100% { transform: rotate(0); } 25% { transform: rotate(-12deg) scale(1.08); } 75% { transform: rotate(12deg) scale(1.08); } }
.bounce { animation: bounce 2.2s ease-in-out infinite; }
@keyframes bounce { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }

/* ---------- Barra superior ---------- */
.topbar { display: flex; align-items: center; gap: 12px; }
.topbar h1 { flex: 1; font-size: clamp(1.3rem, 3.2vw, 2rem); text-align: center; }
.topbar-right { display: flex; gap: 10px; align-items: center; }
.profile-chip { display: flex; align-items: center; gap: 8px; border: 0; background: var(--card); border-radius: 999px; padding: 6px 12px 6px 6px; box-shadow: var(--shadow); cursor: pointer; min-height: var(--tap); }
.chip-name { font-weight: 800; max-width: 9em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar { display: inline-grid; place-items: center; width: 96px; height: 96px; border-radius: 50%; background: #fff4dc; }
.avatar svg { width: 84%; height: 84%; }
.avatar.sm { width: 48px; height: 48px; }
.avatar.big { width: 140px; height: 140px; flex: none; }
.stars-pill { display: inline-flex; align-items: center; gap: 4px; background: #fff3c4; color: #7a5a00; border-radius: 999px; padding: 4px 10px; font-weight: 800; }
.stars-pill svg { width: 20px; height: 20px; color: var(--gold); }

/* ---------- Inicio ---------- */
.splash { align-items: center; justify-content: center; text-align: center; gap: 20px; }
.splash-guides { display: flex; gap: 8px; justify-content: center; }
.splash-guides .guide-svg { width: clamp(130px, 22vw, 210px); height: auto; animation: bounce 3s ease-in-out infinite; }
.splash-guides .guide-svg:last-child { animation-delay: -1.5s; }
.logo { font-size: clamp(2.6rem, 9vw, 5rem); letter-spacing: -.02em; display: flex; gap: .25em; flex-wrap: wrap; justify-content: center; }
.logo-a { color: var(--sea); } .logo-b { color: var(--primary); }
.tagline { font-size: 1.25rem; color: var(--ink-soft); margin: 0; }
.adult-link { display: inline-flex; gap: 8px; align-items: center; background: none; border: 0; color: var(--ink-soft); font-size: 1rem; cursor: pointer; padding: 12px; margin-top: 12px; }
.adult-link svg { width: 22px; height: 22px; }

/* ---------- Perfiles ---------- */
.profile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 18px; }
.profile-card { border: 0; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 12px; display: flex; flex-direction: column; align-items: center; gap: 10px; cursor: pointer; border-bottom: 8px solid var(--dino); }
.profile-card.band-mayores { border-bottom-color: var(--sky); }
.profile-card .name { font-weight: 800; font-size: 1.2rem; }
.profile-card.add { border: 4px dashed var(--line); box-shadow: none; background: transparent; }
.avatar.plus { background: #f1ede4; } .avatar.plus svg { width: 46px; height: 46px; color: var(--ink-soft); }
.wizard { display: flex; flex-direction: column; gap: 18px; align-items: center; }
.steps { display: flex; gap: 8px; } .steps i { width: 40px; height: 10px; border-radius: 9px; background: var(--line); } .steps i.on { background: var(--primary); }
.lead { font-size: 1.4rem; font-weight: 800; margin: 0; display: block; }
.avatar-grid { display: grid; grid-template-columns: repeat(3, minmax(90px, 160px)); gap: 18px; }
.avatar-pick { aspect-ratio: 1; border: 0; border-radius: 50%; background: #fff4dc; box-shadow: var(--shadow); cursor: pointer; padding: 10px; }
.avatar-pick svg { width: 100%; height: 100%; }
.band-pick { display: grid; grid-template-columns: repeat(2, minmax(150px, 300px)); gap: 20px; }
.band-card { border: 0; border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; align-items: center; gap: 6px; cursor: pointer; box-shadow: var(--shadow); font-size: 1rem; }
.band-card .guide-svg { width: 70%; height: auto; }
.band-card strong { font-size: 1.6rem; }
.band-card.dino { background: linear-gradient(#d8f6e0, #b7ecc4); }
.band-card.aventura { background: linear-gradient(#dfe2ff, #c3c7f5); }
.alias-row { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; justify-content: center; }
.alias-input { font: inherit; font-size: 1.6rem; font-weight: 800; padding: 12px 18px; border-radius: 16px; border: 3px solid var(--line); width: min(100%, 340px); background: #fff; }
.help { color: var(--ink-soft); font-size: .95rem; max-width: 40ch; }
.form-error { color: var(--danger); font-weight: 700; min-height: 1.2em; margin: 4px 0; }

/* ---------- Mundos ---------- */
.worlds { display: grid; grid-template-columns: repeat(2, 1fr); gap: 22px; flex: 1; align-content: center; }
.world-card { position: relative; border: 0; border-radius: 32px; padding: 18px 18px 22px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 4px; box-shadow: var(--shadow); overflow: hidden; transition: transform .15s; }
.world-card:hover { transform: translateY(-3px); }
.world-card.dino { background: linear-gradient(#bff0f5, #8ddde8); }
.world-card.aventura { background: linear-gradient(#2c2f6b, #4a4f9d); color: #fff; }
.world-card .world-svg { width: 100%; height: auto; }
.world-card strong { font-size: clamp(1.4rem, 3.4vw, 2.1rem); }
.world-card .ages { font-weight: 700; opacity: .85; }
.world-guide { position: absolute; left: 10px; bottom: 54px; width: 26%; }
.world-guide svg { width: 100%; height: auto; }
.world-card.recommended { outline: 6px solid var(--gold); outline-offset: -6px; }
.ribbon { position: absolute; top: 16px; right: -36px; transform: rotate(35deg); background: var(--gold); color: var(--ink); font-weight: 800; padding: 6px 44px; }
.badge-row { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.badge { display: inline-flex; align-items: center; gap: 6px; background: #fff3c4; border-radius: 999px; padding: 6px 14px; font-weight: 700; }
.badge svg { width: 18px; height: 18px; color: var(--gold); }

.theme-dino { --accent: var(--dino); }
.theme-aventura { --accent: var(--sky); }
.world-screen.theme-dino, .levels-screen.theme-dino, .challenge-screen.theme-dino { background: linear-gradient(180deg, #e3f8fb 0, transparent 360px); }
.world-screen.theme-aventura, .levels-screen.theme-aventura, .challenge-screen.theme-aventura { background: linear-gradient(180deg, #e6e7ff 0, transparent 360px); }
.screen.world-screen, .screen.levels-screen, .screen.challenge-screen { max-width: none; }
.world-screen > *, .levels-screen > *, .challenge-screen > * { width: 100%; max-width: 1180px; margin-left: auto; margin-right: auto; }
.levels-screen > .btn.huge { width: auto; }

.guide-bubble { display: flex; align-items: center; gap: 12px; }
.guide-bubble .guide-svg { width: 110px; height: auto; flex: none; }
.guide-bubble p { position: relative; background: #fff; border-radius: 22px; padding: 14px 20px; margin: 0; font-size: 1.25rem; font-weight: 700; box-shadow: var(--shadow); }
.guide-bubble p::before { content: ""; position: absolute; left: -12px; top: 50%; border: 12px solid transparent; border-right-color: #fff; border-left: 0; transform: translateY(-50%); }
.guide-bubble.small .guide-svg { width: 84px; }
.guide-bubble.small p { font-size: 1.15rem; }

.portals { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 18px; }
.portal { position: relative; border: 0; background: var(--card); border-radius: 28px; padding: 18px 14px; display: flex; flex-direction: column; align-items: center; gap: 8px; box-shadow: var(--shadow); cursor: pointer; border-bottom: 8px solid var(--accent); text-align: center; font-size: 1.05rem; }
.portal-art { width: 110px; height: 110px; border-radius: 50%; background: #f6f2ea; display: grid; place-items: center; }
.portal-art svg { width: 78%; height: 78%; }
.portal strong { font-size: 1.15rem; }
.portal-progress { display: inline-flex; gap: 4px; align-items: center; font-weight: 800; color: #7a5a00; }
.portal-progress svg { width: 20px; height: 20px; color: var(--gold); }
.portal.locked { cursor: default; opacity: .62; filter: grayscale(.5); border-bottom-color: var(--line); }
.soon { display: inline-flex; gap: 6px; align-items: center; font-weight: 700; color: var(--ink-soft); }
.soon svg { width: 18px; height: 18px; }

/* ---------- Niveles ---------- */
.level-path { list-style: none; margin: 0; padding: 10px 0 40px; display: grid; grid-template-columns: repeat(5, 1fr); gap: 56px 12px; justify-items: center; }
.level-path li { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
.level-path li:nth-child(even) { transform: translateY(26px); }
.level-node { width: 86px; height: 86px; border-radius: 50%; border: 0; font-size: 2rem; font-weight: 900; background: #fff; box-shadow: var(--shadow); cursor: pointer; display: grid; place-items: center; border: 5px solid var(--accent); }
.level-node svg { width: 46px; height: 46px; }
.level-node.done { background: #fff3c4; color: var(--gold); border-color: var(--gold); }
.level-node.next { animation: glowpulse 1.6s ease-in-out infinite; background: var(--accent); color: #fff; }
.level-node:disabled { background: #eee9de; color: #b5ad9c; border-color: #ddd5c4; cursor: default; box-shadow: none; }
.level-title { font-size: .9rem; font-weight: 700; color: var(--ink-soft); max-width: 12ch; }
@keyframes glowpulse { 0%,100% { box-shadow: 0 0 0 0 rgba(245,183,0,.7), var(--shadow); } 50% { box-shadow: 0 0 0 14px rgba(245,183,0,0), var(--shadow); } }

/* ---------- Escenario de juego ---------- */
.stage { flex: 1; background: var(--card); border-radius: 32px; box-shadow: var(--shadow); padding: clamp(14px, 3vw, 32px); display: flex; flex-direction: column; gap: 26px; align-items: center; justify-content: center; touch-action: none; user-select: none; -webkit-user-select: none; }
.seq-row { display: flex; flex-wrap: wrap; gap: clamp(6px, 1.4vw, 14px); justify-content: center; align-items: center; }
.tile, .slot { width: clamp(64px, 10vw, 104px); height: clamp(64px, 10vw, 104px); border-radius: 20px; display: grid; place-items: center; background: #f8f5ee; }
.tile svg, .slot svg, .option svg { width: 100%; height: 100%; }
.slot { border: 5px dashed #c9bfa8; background: #fffaf0; transition: transform .15s, border-color .15s; }
.slot.over { border-color: var(--ok); transform: scale(1.08); background: #eaf8ee; }
.slot.filled { border: 5px solid var(--ok); background: #eaf8ee; animation: pop .35s; }
.slot.nope { animation: shake .4s; }
@keyframes pop { 50% { transform: scale(1.15); } }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.glow { box-shadow: 0 0 0 5px var(--gold); animation: glowpulse 1.6s infinite; }
.tray { display: flex; flex-wrap: wrap; gap: clamp(12px, 2.4vw, 24px); justify-content: center; padding: 16px; background: #f3efe6; border-radius: 26px; }
.option { width: clamp(82px, 12vw, 120px); height: clamp(82px, 12vw, 120px); border-radius: 24px; border: 0; background: #fff; box-shadow: var(--shadow); cursor: grab; padding: 6px; touch-action: none; }
.option.dragging { opacity: .35; }
.option.faded { opacity: .2; pointer-events: none; }
.option.pulse { animation: bounce 0.9s ease-in-out infinite; box-shadow: 0 0 0 5px var(--gold), var(--shadow); }
.drag-ghost { position: fixed; z-index: 50; pointer-events: none; transform: scale(1.1); box-shadow: 0 16px 30px rgba(0,0,0,.25); margin: 0; }
.drag-ghost.return { transition: left .3s ease, top .3s ease; }

.num-card { position: relative; min-width: clamp(64px, 9vw, 96px); height: clamp(64px, 9vw, 96px); padding: 0 10px; border-radius: 18px; background: #eef0ff; display: grid; place-items: center; font-size: clamp(1.6rem, 3.6vw, 2.4rem); font-weight: 900; }
.slot-num { border: 5px dashed #9ea3d9; background: #fff; }
.slot-num.filled { border: 5px solid var(--ok); background: #eaf8ee; animation: pop .35s; }
.show-diffs .num-card[data-diff]::before { content: attr(data-diff); position: absolute; top: -30px; left: -18px; font-size: 1rem; background: var(--gold); color: var(--ink); padding: 2px 8px; border-radius: 999px; }
.seq-row.nums { margin-top: 26px; }
.keypad { display: flex; flex-direction: column; gap: 10px; align-items: center; }
.kp-display { min-width: 160px; text-align: center; font-size: 2.2rem; font-weight: 900; background: #f8f5ee; border-radius: 16px; padding: 6px 16px; }
.kp-keys { display: grid; grid-template-columns: repeat(3, 72px); gap: 10px; }
.kp { height: 64px; border-radius: 18px; border: 0; background: #fff; box-shadow: 0 4px 0 #d9d2c2; font-size: 1.7rem; font-weight: 900; cursor: pointer; display: grid; place-items: center; touch-action: manipulation; }
.kp svg { width: 32px; height: 32px; }
.kp.ok { background: var(--ok); color: #fff; box-shadow: 0 4px 0 #1e7a37; }
.kp:active { transform: translateY(3px); box-shadow: none; }
.choices { display: flex; gap: 12px; } .choice { font-size: 1.5rem; }
.grid3 { display: grid; grid-template-columns: repeat(3, auto); gap: 10px; }
.split { display: flex; gap: 30px; align-items: center; justify-content: center; flex-wrap: wrap; width: 100%; }
.deduction { align-items: flex-start; }
.clues-box { flex: 1 1 280px; max-width: 420px; }
.clues-box h2 { font-size: 1.3rem; margin-bottom: 8px; }
.clues { margin: 0; padding-left: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; font-size: 1.15rem; }
.clues li { background: #f8f5ee; border-radius: 14px; padding: 10px 14px; }
.clues li.lit { background: #fff3c4; }
.left-count { font-weight: 700; color: var(--ink-soft); }
.num-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; flex: 1 1 320px; max-width: 460px; }
.num-cell { aspect-ratio: 1; min-height: 48px; border-radius: 14px; border: 0; background: #eef0ff; font-size: 1.35rem; font-weight: 900; cursor: pointer; position: relative; touch-action: manipulation; }
.num-cell.crossed { background: #f1ede4; color: #b5ad9c; }
.num-cell.crossed::after { content: ""; position: absolute; left: 18%; right: 18%; top: 50%; height: 4px; background: var(--danger); transform: rotate(-35deg); border-radius: 4px; opacity: .7; }
.num-cell.found { background: var(--ok); color: #fff; animation: pop .4s; }

/* ---------- Celebración y pausa ---------- */
.celebrate, .modal { position: fixed; inset: 0; background: rgba(35,32,43,.45); display: grid; place-items: center; z-index: 40; padding: 16px; animation: fade .25s; }
@keyframes fade { from { opacity: 0; } }
.celebrate-card, .modal-card { background: #fff; border-radius: 32px; padding: 26px; max-width: 520px; width: 100%; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 12px; box-shadow: var(--shadow); }
.celebrate-card .guide-svg { width: 140px; height: auto; animation: bounce 1.4s ease-in-out infinite; }
.celebrate-card h2 { font-size: 2rem; }
.star-earned { display: inline-flex; align-items: center; gap: 8px; font-size: 1.3rem; font-weight: 800; color: #7a5a00; margin: 0; }
.star-earned svg { width: 42px; height: 42px; color: var(--gold); animation: pop .6s; }
.celebrate-actions, .modal-actions { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 45; overflow: hidden; }
.confetti i { position: absolute; top: -20px; width: 12px; height: 18px; border-radius: 3px; animation: fall 1.8s ease-in forwards; }
@keyframes fall { to { top: 105%; transform: rotate(720deg); } }

/* ---------- Adultos ---------- */
.adult .card { background: #fff; border-radius: 22px; padding: 22px; box-shadow: 0 2px 10px rgba(0,0,0,.06); }
.card.narrow { max-width: 460px; margin: 20px auto; display: flex; flex-direction: column; gap: 12px; }
.card.center { text-align: center; margin: 40px auto; max-width: 480px; display: flex; flex-direction: column; gap: 14px; }
.adult .card h2 { margin-bottom: 10px; }
.switch { display: flex; align-items: center; gap: 12px; padding: 8px 0; font-size: 1.05rem; }
.switch input { width: 26px; height: 26px; }
.field select { font: inherit; padding: 6px 10px; border-radius: 10px; }
.report-head { display: flex; align-items: center; gap: 16px; }
.report-head .avatar { width: 72px; height: 72px; flex: none; }
.report-head p { margin: 4px 0 0; color: var(--ink-soft); }
.table-wrap { overflow-x: auto; margin: 10px 0 16px; }
table { border-collapse: collapse; width: 100%; font-size: .98rem; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--ink-soft); font-weight: 700; }
.help-card p { color: var(--ink-soft); }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 140%); background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 999px; z-index: 60; transition: transform .3s; max-width: 92vw; text-align: center; }
.toast.show { transform: translate(-50%, 0); }

/* ---------- Móvil ---------- */
@media (max-width: 720px) {
  :root { --tap: 56px; }
  .worlds { grid-template-columns: 1fr; }
  .level-path { grid-template-columns: repeat(3, 1fr); }
  .level-path li:nth-child(even) { transform: none; }
  .guide-bubble .guide-svg, .guide-bubble.small .guide-svg { width: 64px; }
  .guide-bubble p { font-size: 1.05rem; padding: 10px 14px; }
  .chip-name { display: none; }
  .avatar-grid { grid-template-columns: repeat(3, 1fr); gap: 12px; }
  .band-pick { grid-template-columns: 1fr 1fr; gap: 10px; }
  .band-card strong { font-size: 1.2rem; }
  .topbar { gap: 8px; }
  .topbar-right { gap: 6px; }
  .portals { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .portal-art { width: 80px; height: 80px; }
  .tile, .slot { width: min(52px, calc((100vw - 96px) / 8)); height: min(52px, calc((100vw - 96px) / 8)); border-radius: 12px; }
  .seq-row { gap: 5px; }
  .seq-row.nums .num-card { min-width: 0; width: min(54px, calc((100vw - 100px) / 6)); padding: 0; font-size: 1.15rem; }
  .level-path { gap: 22px 8px; }
  .slot { border-width: 4px; }
  .num-card { min-width: 52px; height: 56px; font-size: 1.4rem; }
  .kp-keys { grid-template-columns: repeat(3, 64px); }
  .stage { padding: 14px 10px; gap: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
