/* BrainKids — azul-teal de aventura, dorado para las recompensas, todo redondeado y grande. */
:root {
  --ink: #0b3d52;
  --ink-2: #3c6677;
  --teal: #12a3b4;
  --teal-d: #0b5f7a;
  --sky-1: #e9f8fb;
  --sky-2: #cfeef4;
  --gold: #f5b324;
  --gold-d: #c47d00;
  --amber: #ff9f1c;
  --card: #ffffff;
  --line: #d6e9ee;
  --shadow: 0 10px 26px rgba(11, 61, 82, .14), 0 2px 6px rgba(11, 61, 82, .08);
  --r: 22px;
  --font: ui-rounded, "SF Pro Rounded", "Nunito", "Varela Round", "Arial Rounded MT Bold", system-ui, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; color: var(--ink); font-family: var(--font); font-size: 18px; line-height: 1.35;
  background:
    radial-gradient(1200px 500px at 85% -10%, #bfeaf2 0%, transparent 60%),
    radial-gradient(900px 500px at -10% 110%, #d8f1e8 0%, transparent 60%),
    linear-gradient(180deg, var(--sky-1), var(--sky-2));
  background-attachment: fixed;
}
svg { display: block; width: 100%; height: 100%; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 4px solid var(--gold); outline-offset: 3px; border-radius: 12px; }

.view { max-width: 1120px; margin: 0 auto; padding: 0 16px 48px; }
.title-xl { font-size: clamp(30px, 6vw, 46px); line-height: 1.05; margin: 8px 0; letter-spacing: -.5px; }
.lead { font-size: 20px; color: var(--ink-2); margin: 4px 0 0; }
.eyebrow { margin: 0; font-weight: 700; color: var(--teal-d); text-transform: uppercase; letter-spacing: 1.5px; font-size: 14px; }

/* ---------- Botones 3D con bote ---------- */
.btn {
  --b: var(--teal); --bd: var(--teal-d);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 0 22px; border: 0; border-radius: 18px; text-decoration: none; font-weight: 800; font-size: 19px;
  color: #fff; background: linear-gradient(180deg, color-mix(in srgb, var(--b) 85%, #fff), var(--b));
  box-shadow: 0 5px 0 var(--bd), 0 10px 18px rgba(11, 61, 82, .18);
  transition: transform .12s, box-shadow .12s, filter .12s;
}
.btn svg { width: 22px; height: 22px; }
.btn:hover { filter: brightness(1.05); }
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--bd), 0 4px 8px rgba(11, 61, 82, .2); animation: bounce .32s; }
.btn:disabled { filter: grayscale(.7) opacity(.55); cursor: default; }
.btn-gold { --b: var(--gold); --bd: var(--gold-d); color: #4a2a00; }
.btn-ghost { --b: #fff; --bd: #b9d6de; color: var(--ink); }
.btn-play { --b: var(--mod, var(--teal)); --bd: color-mix(in srgb, var(--mod, var(--teal)) 70%, #000); flex: 1; }
.btn-soon { --b: #e7eff2; --bd: #c9d8de; color: #7b97a3; box-shadow: none; flex: 1; cursor: default; }
.btn-big { min-height: 64px; font-size: 22px; padding: 0 34px; border-radius: 22px; }
.btn-hint { --b: #fff; --bd: #e5c46b; color: var(--ink); width: 100%; }
@keyframes bounce { 0% { transform: translateY(4px) scale(.97); } 60% { transform: translateY(2px) scale(1.03); } 100% { transform: translateY(4px) scale(1); } }

.icon-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 44px; min-width: 44px; padding: 0 10px; justify-content: center;
  border: 0; border-radius: 14px; background: #fff; box-shadow: 0 3px 0 #c5dde4; text-decoration: none; font-weight: 800;
}
.icon-btn svg { width: 22px; height: 22px; }
.icon-btn:active { transform: translateY(3px); box-shadow: none; }
.icon-btn.lang span { font-size: 14px; }

/* ---------- Barra superior ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 0; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-size: 26px; font-weight: 800; letter-spacing: -.5px; }
.brand b { color: var(--teal); }
.topbar-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pill { display: inline-flex; align-items: center; gap: 6px; height: 44px; padding: 0 12px; border-radius: 999px; background: #fff; box-shadow: 0 3px 0 #c5dde4; font-weight: 800; border: 0; }
.pill svg { width: 24px; height: 24px; }
.pill-player { padding-left: 6px; }
.pill-player span:last-child { max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar { --s: 56px; display: inline-block; width: var(--s); height: var(--s); border-radius: 50%; overflow: hidden; background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--bg) 55%, #fff), var(--bg)); box-shadow: inset 0 -4px 0 rgba(0,0,0,.12); flex: none; }
.avatar img { width: 100%; height: 160%; object-fit: cover; object-position: 50% 0; margin-top: 4%; }

/* ---------- Mascota ---------- */
.mascot { position: relative; display: flex; flex-direction: column; align-items: center; }
.mascot-img { width: 100%; max-width: 180px; height: auto; filter: drop-shadow(0 10px 12px rgba(11, 61, 82, .22)); animation: idle 3.2s ease-in-out infinite; }
.mascot-img.pop { animation: pose-pop .45s cubic-bezier(.3, 1.6, .5, 1), idle 3.2s ease-in-out .45s infinite; }
.bubble { position: relative; background: #fff; border-radius: 20px; padding: 12px 16px; font-weight: 700; font-size: 18px; box-shadow: var(--shadow); margin-bottom: 12px; max-width: 260px; text-align: center; }
.bubble::after { content: ""; position: absolute; left: 50%; bottom: -10px; border: 10px solid transparent; border-top-color: #fff; border-bottom: 0; transform: translateX(-50%); }
.bubble.in { animation: bubble-in .35s cubic-bezier(.3, 1.5, .5, 1); }
@keyframes idle { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes pose-pop { 0% { transform: scale(.88) translateY(8px); } 100% { transform: scale(1); } }
@keyframes bubble-in { from { opacity: 0; transform: scale(.7) translateY(10px); } }

/* ---------- Jugadores ---------- */
.players, .newplayer { text-align: center; }
.players-hero .mascot-img { max-width: 150px; }
.player-grid { display: flex; flex-wrap: wrap; justify-content: center; gap: 18px; margin-top: 18px; }
.player-card {
  width: 170px; padding: 18px 12px 16px; border: 4px solid transparent; border-radius: 28px; background: var(--card); box-shadow: var(--shadow);
  display: flex; flex-direction: column; align-items: center; gap: 12px; animation: card-in .5s cubic-bezier(.2, 1.3, .4, 1) both; animation-delay: calc(var(--i) * 70ms);
  transition: transform .15s, border-color .15s, box-shadow .15s;
}
.player-card:hover, .player-card:focus-visible { transform: translateY(-4px); border-color: var(--gold); box-shadow: 0 0 0 6px rgba(245, 179, 36, .25), var(--shadow); }
.player-card .pname { font-size: 22px; font-weight: 800; }
.player-card.add { border: 4px dashed #a9d3dd; background: rgba(255, 255, 255, .6); box-shadow: none; }
.add-ico { width: 104px; height: 104px; border-radius: 50%; background: #e3f4f7; color: var(--teal); padding: 30px; }
@keyframes card-in { from { opacity: 0; transform: scale(.85) translateY(16px); } }

.hero-pick { --bg: var(--teal); display: flex; justify-content: center; gap: 22px; margin: 20px 0; }
.hero-opt { width: 150px; height: 180px; border-radius: 30px; border: 5px solid transparent; padding: 10px; background: radial-gradient(circle at 50% 35%, color-mix(in srgb, var(--bg) 40%, #fff), var(--bg)); box-shadow: var(--shadow); transition: transform .15s, border-color .15s; }
.hero-opt img { width: 100%; height: 100%; object-fit: contain; }
.hero-opt.on { border-color: var(--gold); transform: scale(1.06); box-shadow: 0 0 0 7px rgba(245, 179, 36, .3), var(--shadow); }
.color-pick { display: flex; justify-content: center; gap: 14px; margin-bottom: 20px; }
.color-opt { width: 48px; height: 48px; border-radius: 50%; border: 4px solid #fff; background: var(--c); box-shadow: 0 3px 0 rgba(0,0,0,.15); }
.color-opt.on { outline: 4px solid var(--ink); outline-offset: 2px; }
.name-field { display: flex; flex-direction: column; gap: 6px; max-width: 360px; margin: 0 auto 24px; font-weight: 800; }
.name-field input { height: 62px; border-radius: 20px; border: 3px solid var(--line); padding: 0 18px; font-size: 26px; text-align: center; background: #fff; }
.name-field input:focus { border-color: var(--teal); outline: none; box-shadow: 0 0 0 5px rgba(18, 163, 180, .2); }

/* ---------- Inicio ---------- */
.hero { display: flex; align-items: center; justify-content: space-between; gap: 16px; background: linear-gradient(135deg, #ffffff 0%, #e4f7fa 100%); border-radius: 32px; padding: 22px 26px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.hero::after { content: ""; position: absolute; right: -60px; top: -60px; width: 240px; height: 240px; border-radius: 50%; background: radial-gradient(circle, rgba(245, 179, 36, .3), transparent 70%); }
.hero .mascot { width: 150px; flex: none; z-index: 1; }
.hero .mascot-img { max-width: 140px; }
.mod-chips { display: flex; gap: 10px; overflow-x: auto; padding: 18px 2px 8px; scrollbar-width: none; }
.chip { flex: none; display: inline-flex; align-items: center; gap: 8px; height: 48px; padding: 0 16px; border-radius: 999px; border: 3px solid transparent; background: #fff; font-weight: 800; color: var(--mod); box-shadow: 0 3px 0 #c5dde4; }
.chip svg { width: 22px; height: 22px; }
.chip.on { background: var(--mod); color: #fff; box-shadow: 0 3px 0 color-mix(in srgb, var(--mod) 65%, #000); }

.act-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; margin-top: 10px; }
.act-card {
  position: relative; display: flex; flex-direction: column; gap: 6px; padding: 16px; border-radius: var(--r); background: var(--card);
  border: 3px solid transparent; box-shadow: var(--shadow); animation: card-in .45s cubic-bezier(.2, 1.3, .4, 1) both; animation-delay: calc(var(--i) * 35ms);
  transition: transform .15s, border-color .2s, box-shadow .2s;
}
.act-card::before { content: ""; position: absolute; inset: 0 0 auto; height: 8px; border-radius: var(--r) var(--r) 0 0; background: var(--mod); }
.act-card:not(.soon):hover { transform: translateY(-4px); border-color: color-mix(in srgb, var(--mod) 60%, #fff); box-shadow: 0 0 0 5px color-mix(in srgb, var(--mod) 18%, transparent), var(--shadow); }
.act-card.soon { opacity: .78; }
.act-top { display: flex; justify-content: space-between; align-items: center; margin-top: 4px; }
.act-ico { width: 52px; height: 52px; padding: 11px; border-radius: 16px; color: #fff; background: linear-gradient(160deg, color-mix(in srgb, var(--mod) 75%, #fff), var(--mod)); box-shadow: 0 4px 0 color-mix(in srgb, var(--mod) 65%, #000); }
.act-min { display: inline-flex; align-items: center; gap: 4px; font-size: 14px; font-weight: 800; color: var(--ink-2); background: #eef6f8; border-radius: 999px; padding: 4px 10px; }
.act-min svg { width: 16px; height: 16px; }
.act-card h3 { margin: 6px 0 0; font-size: 21px; line-height: 1.15; }
.act-card p { margin: 0; color: var(--ink-2); font-size: 16px; flex: 1; }
.act-btns { display: flex; gap: 8px; margin-top: 8px; }
.act-btns .btn-ghost { padding: 0 14px; }

.stars { display: inline-flex; gap: 2px; }
.st { width: 28px; height: 28px; color: #9bb9c4; }
.stars.sm .st { width: 22px; height: 22px; }
.stars.xs .st { width: 12px; height: 12px; }
.stars.lg .st { width: 64px; height: 64px; }
.stars.lg .st.on { animation: star-in .6s cubic-bezier(.3, 1.6, .5, 1) both; animation-delay: calc(.2s + var(--i) * .25s); }
@keyframes star-in { from { transform: scale(0) rotate(-180deg); opacity: 0; } }

.shelf, .printables { margin-top: 34px; }
.shelf h2, .printables h2 { display: flex; align-items: center; gap: 10px; font-size: 28px; margin: 0 0 12px; }
.printables h2 svg { width: 30px; height: 30px; color: var(--teal); }
.badges { display: flex; gap: 12px; flex-wrap: wrap; }
.badge { --b: #9bb9c4; display: flex; align-items: center; gap: 10px; padding: 8px 16px 8px 8px; border-radius: 999px; background: rgba(255, 255, 255, .6); color: #7b97a3; font-weight: 800; }
.badge-ico { width: 44px; height: 44px; padding: 8px; border-radius: 50%; background: #e3edf0; color: #9bb9c4; }
.badge.got { background: #fff; color: var(--ink); box-shadow: var(--shadow); }
.badge.got .badge-ico { background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--b) 40%, #fff), var(--b)); padding: 5px; }
.unlock-anim .badge-ico { animation: badge-unlock 1s cubic-bezier(.3, 1.4, .5, 1) both; }
@keyframes badge-unlock { 0% { transform: rotateY(0) scale(.3); filter: brightness(2); } 60% { transform: rotateY(540deg) scale(1.2); } 100% { transform: rotateY(720deg) scale(1); filter: brightness(1); } }

.print-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.print-card { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 18px; border-radius: var(--r); background: #fff; box-shadow: var(--shadow); text-decoration: none; transition: transform .15s; }
.print-card:hover { transform: translateY(-3px); }
.print-card svg { width: 42px; height: 42px; color: var(--teal); }
.print-card b { font-size: 19px; }
.print-card small { color: var(--ink-2); font-size: 15px; }

/* ---------- Pantalla de juego ---------- */
.play-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.play-head h1 { font-size: clamp(24px, 4.5vw, 34px); margin: 0; flex: 1; min-width: 160px; }
.levels { display: flex; gap: 8px; }
.lvl { position: relative; display: grid; place-items: center; width: 52px; height: 52px; border-radius: 16px; background: #fff; font-weight: 800; font-size: 22px; text-decoration: none; box-shadow: 0 3px 0 #c5dde4; }
.lvl svg { width: 20px; height: 20px; }
.lvl.on { background: var(--mod, var(--teal)); color: #fff; box-shadow: 0 3px 0 color-mix(in srgb, var(--mod, var(--teal)) 65%, #000); }
.lvl.locked { color: #9bb9c4; background: #edf3f5; }
.lvl-st { position: absolute; bottom: -9px; left: 50%; transform: translateX(-50%); }
.timer-btn[aria-pressed="true"] { background: #fff4d6; }
.progress { display: flex; align-items: center; gap: 12px; margin: 18px 0 14px; }
.progress .bar { flex: 1; height: 18px; border-radius: 999px; background: rgba(255, 255, 255, .7); box-shadow: inset 0 2px 4px rgba(11, 61, 82, .12); overflow: hidden; }
.progress .bar i { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--gold), var(--amber)); box-shadow: inset 0 -3px 0 rgba(0,0,0,.08), inset 0 3px 0 rgba(255,255,255,.4); transition: width .6s cubic-bezier(.3, 1.3, .5, 1); }
.progress-label { font-weight: 800; color: var(--ink-2); white-space: nowrap; }
.play-body { display: grid; grid-template-columns: 1fr 220px; gap: 20px; align-items: start; }
.stage { background: rgba(255, 255, 255, .75); border-radius: 30px; padding: 22px; box-shadow: var(--shadow); min-height: 360px; }
.guide { position: sticky; top: 16px; display: flex; flex-direction: column; align-items: center; gap: 12px; }

/* Sudoku */
.sudoku { display: flex; flex-direction: column; align-items: center; gap: 22px; }
.sgrid { display: grid; grid-template-columns: 1fr 1fr 5px 1fr 1fr; grid-template-rows: 1fr 1fr 5px 1fr 1fr; width: min(100%, 420px); aspect-ratio: 1; background: var(--teal-d); border-radius: 22px; padding: 6px; gap: 4px; box-shadow: 0 8px 0 #08485d, var(--shadow); }
.cell { position: relative; border: 0; border-radius: 12px; background: #fff; display: grid; place-items: center; padding: 14%; transition: background .15s; animation: card-in .35s both; animation-delay: calc(var(--i) * 25ms); }
.cell.given { background: #e6f3f6; cursor: default; }
.cell.peer:not(.given) { background: #f3fbfc; }
.cell.sel { background: #fff6dc !important; box-shadow: inset 0 0 0 4px var(--gold); }
.cell.placed > * { animation: place .35s cubic-bezier(.3, 1.7, .5, 1); }
.cell.clash { animation: nudge 1.4s ease-in-out 2; }
.cell.hinted { animation: hint-glow 1.2s ease-in-out 2; }
.num { font-size: clamp(34px, 9vw, 56px); font-weight: 800; color: var(--teal-d); line-height: 1; }
.cell.given .num { color: var(--ink); }
.cell:not(.given) .num { color: var(--teal); }
.palette { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.pal { width: 74px; height: 74px; border: 0; border-radius: 20px; background: #fff; padding: 12px; box-shadow: 0 5px 0 #c5dde4; transition: transform .1s; }
.pal:active { transform: translateY(4px); box-shadow: 0 1px 0 #c5dde4; animation: bounce .3s; }
.pal .num { font-size: 40px; }
.pal.erase { color: #9bb9c4; padding: 20px; }
@keyframes place { from { transform: scale(.2); opacity: 0; } }
@keyframes nudge { 0%, 100% { background: #fff; } 50% { background: #ffe9cf; box-shadow: inset 0 0 0 3px #ffb766; } }
@keyframes hint-glow { 0%, 100% { box-shadow: inset 0 0 0 0 var(--gold); } 50% { box-shadow: inset 0 0 0 6px var(--gold), 0 0 22px rgba(245, 179, 36, .8); } }

/* Criptograma */
.cripto { display: flex; flex-direction: column; gap: 22px; }
.message { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px 26px; }
.word { display: flex; gap: 6px; }
.tile { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 54px; padding: 8px 4px 6px; border: 0; border-radius: 14px; background: #fff; box-shadow: 0 4px 0 #c5dde4; transition: transform .12s, background .2s; }
.tile:active { transform: translateY(3px); }
.tile-code { width: 36px; height: 36px; display: grid; place-items: center; }
.tile-letter { width: 100%; min-height: 34px; border-top: 3px solid #cfe3e8; font-size: 28px; font-weight: 800; color: var(--teal-d); line-height: 34px; }
.tile.sel { background: #fff6dc; box-shadow: 0 4px 0 var(--gold-d), 0 0 0 4px var(--gold); transform: translateY(-3px); }
.tile.ok .tile-letter { color: var(--ink); border-top-color: var(--gold); }
.tile.nudge .tile-letter { color: #e08a2c; animation: soft-blink .9s ease-in-out; }
.tile.hinted { animation: hint-glow 1.2s ease-in-out 2; }
.tile.glow { background: linear-gradient(180deg, #fff8dc, #ffe7a3); box-shadow: 0 4px 0 var(--gold-d), 0 0 18px rgba(245, 179, 36, .7); animation: glow-in .5s cubic-bezier(.3, 1.6, .5, 1); }
.code-num { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--teal-d); color: #fff; font-weight: 800; font-size: 18px; }
.code-g { display: block; width: 34px; height: 34px; }
.lvl-1 .tile { width: 66px; }
.lvl-1 .tile-code, .lvl-1 .code-g { width: 46px; height: 46px; }
.lvl-3 .tile { width: 46px; }
.lvl-3 .tile-code, .lvl-3 .code-g { width: 30px; height: 30px; }
.lvl-3 .tile-letter { font-size: 24px; }
@keyframes soft-blink { 0%, 100% { opacity: 0; } 30%, 60% { opacity: 1; } }
@keyframes glow-in { 50% { transform: translateY(-6px) scale(1.08); } }
.legend { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; padding: 14px; border-radius: 20px; background: #eef7f9; }
.leg { display: flex; align-items: center; gap: 6px; padding: 4px 10px 4px 4px; border-radius: 12px; background: #fff; }
.leg-code { width: 30px; height: 30px; display: grid; place-items: center; }
.leg-code .code-g, .leg-code .code-num { width: 28px; height: 28px; font-size: 14px; }
.leg-letter { min-width: 20px; font-weight: 800; font-size: 20px; color: #b7cdd4; }
.leg-letter:empty::before { content: "?"; }
.leg.ok .leg-letter { color: var(--ink); }
.keyboard { position: sticky; bottom: 10px; z-index: 5; padding: 12px; border-radius: 22px; background: #fff; box-shadow: 0 -4px 30px rgba(11, 61, 82, .2); }
.keyboard.in { animation: kb-in .3s cubic-bezier(.3, 1.4, .5, 1); }
.kb-keys { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.key { width: 52px; height: 56px; border: 0; border-radius: 14px; background: linear-gradient(180deg, #fff, #eef6f8); box-shadow: 0 4px 0 #b9d2da; font-size: 26px; font-weight: 800; }
.key:active { transform: translateY(3px); box-shadow: 0 1px 0 #b9d2da; }
.key.used { opacity: .35; }
.lvl-3 .key { width: 44px; height: 50px; font-size: 22px; }
@keyframes kb-in { from { transform: translateY(30px); opacity: 0; } }

.sparkle { animation: sparkle .8s ease-out; }
@keyframes sparkle { 0% { filter: brightness(1); box-shadow: 0 0 0 0 rgba(245, 179, 36, .9); } 40% { filter: brightness(1.15); box-shadow: 0 0 0 10px rgba(245, 179, 36, .25), 0 0 26px rgba(245, 179, 36, .8); } 100% { box-shadow: 0 0 0 16px rgba(245, 179, 36, 0); } }

/* ---------- Efectos: confeti y estrella ---------- */
#fx { position: fixed; inset: 0; pointer-events: none; z-index: 60; overflow: hidden; }
.confetto { position: absolute; top: -12px; width: 11px; height: 15px; border-radius: 3px; animation: fall linear forwards; }
@keyframes fall { to { transform: translate(var(--dx), 108vh) rotate(var(--rot)); } }
.starburst { position: absolute; left: 50%; top: 40%; width: 180px; height: 180px; margin: -90px; filter: drop-shadow(0 0 30px rgba(245, 179, 36, .9)); animation: starburst 2s cubic-bezier(.3, 1.4, .5, 1) forwards; }
@keyframes starburst { 0% { transform: scale(0) rotate(-200deg); opacity: 0; } 35% { transform: scale(1.1) rotate(0); opacity: 1; } 70% { transform: scale(1) rotate(30deg); opacity: 1; } 100% { transform: scale(.4) rotate(380deg) translateY(-200px); opacity: 0; } }

/* ---------- Ventanas ---------- */
.overlay { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px; background: rgba(11, 61, 82, .45); backdrop-filter: blur(4px); animation: fade .25s; }
@keyframes fade { from { opacity: 0; } }
.result-card, .demo-card { position: relative; width: min(100%, 440px); padding: 24px; border-radius: 34px; background: linear-gradient(180deg, #fff, #eaf8fb); text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,.3); animation: card-in .5s cubic-bezier(.2, 1.3, .4, 1); }
.result-hero { width: 190px; height: auto; margin: -80px auto 0; display: block; filter: drop-shadow(0 10px 14px rgba(11, 61, 82, .3)); }
.result-stars { margin: 6px 0 10px; }
.unlock { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; color: #16855f; background: #e1f7ec; border-radius: 999px; padding: 6px 16px; margin: 0 0 10px; }
.unlock svg { width: 22px; height: 22px; }
.new-badges { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-bottom: 12px; }
.result-btns { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.next-clue { display: flex; align-items: center; gap: 12px; text-align: left; background: #fff7e0; border: 2px dashed #e5c46b; border-radius: 18px; padding: 10px 14px; margin: 0 0 14px; }
.next-clue svg { width: 54px; height: 46px; flex: none; }
.next-clue small { display: block; color: var(--ink-2); font-weight: 700; }

/* Demostraciones sin texto */
.demo-card { padding: 30px 24px 26px; }
.demo-go { width: 96px; height: 96px; padding: 0; border-radius: 50%; margin-top: 20px; }
.demo-go svg { width: 44px; height: 44px; }
.demo-sudoku, .demo-cripto { position: relative; height: 270px; }
.dgrid { display: grid; grid-template-columns: repeat(2, 76px); gap: 6px; justify-content: center; padding: 6px; background: var(--teal-d); border-radius: 18px; width: max-content; margin: 0 auto; }
.dgrid > span { width: 76px; height: 76px; background: #fff; border-radius: 12px; padding: 12px; }
.dtarget { animation: demo-sel 6s infinite; }
.dfill { display: block; width: 100%; height: 100%; animation: demo-fill 6s infinite; }
.dpal { display: flex; gap: 10px; justify-content: center; margin-top: 22px; }
.dpal span { width: 54px; height: 54px; background: #fff; border-radius: 14px; padding: 8px; box-shadow: 0 4px 0 #c5dde4; }
.dpick { animation: demo-pick 6s infinite; }
.dhand { position: absolute; width: 54px; height: 64px; left: 0; top: 0; animation: demo-hand 6s infinite; filter: drop-shadow(0 6px 6px rgba(0,0,0,.25)); }
.demo-sudoku .dhand { --x1: 210px; --y1: 105px; --x2: 268px; --y2: 220px; }
@keyframes demo-hand {
  0% { transform: translate(40px, 250px); opacity: 0; }
  10% { opacity: 1; }
  25% { transform: translate(var(--x1), var(--y1)); }
  30% { transform: translate(var(--x1), var(--y1)) scale(.85); }
  35% { transform: translate(var(--x1), var(--y1)); }
  55% { transform: translate(var(--x2), var(--y2)); }
  60% { transform: translate(var(--x2), var(--y2)) scale(.85); }
  65%, 90% { transform: translate(var(--x2), var(--y2)); opacity: 1; }
  100% { transform: translate(var(--x2), var(--y2)); opacity: 0; }
}
@keyframes demo-sel { 0%, 29% { box-shadow: none; background: #fff; } 30%, 95% { box-shadow: inset 0 0 0 4px var(--gold); background: #fff6dc; } }
@keyframes demo-fill { 0%, 61% { transform: scale(0); } 66% { transform: scale(1.2); } 70%, 95% { transform: scale(1); } 100% { transform: scale(0); } }
@keyframes demo-pick { 0%, 59% { transform: none; } 60% { transform: translateY(4px); box-shadow: 0 0 0 4px var(--gold); } 64%, 100% { transform: none; } }

.dmsg { display: flex; justify-content: center; gap: 6px; }
.dmsg .sp { width: 16px; }
.dt { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 52px; padding: 8px 4px 4px; background: #fff; border-radius: 12px; box-shadow: 0 4px 0 #c5dde4; }
.dt .code-g { width: 34px; height: 34px; }
.dt i { font-style: normal; font-size: 26px; font-weight: 800; border-top: 3px solid #cfe3e8; width: 100%; min-height: 34px; }
.dt.a { animation: demo-sel 6s infinite; }
.dt.a i { animation: demo-letter 6s infinite; }
@keyframes demo-letter { 0%, 61% { color: transparent; } 66%, 95% { color: var(--ink); text-shadow: 0 0 12px rgba(245, 179, 36, .9); } 100% { color: transparent; } }
.dkb { display: flex; gap: 10px; justify-content: center; margin-top: 30px; }
.dkb span { width: 52px; height: 56px; display: grid; place-items: center; background: #fff; border-radius: 14px; box-shadow: 0 4px 0 #b9d2da; font-size: 26px; font-weight: 800; }
.demo-cripto .dhand { --x1: 40px; --y1: 50px; --x2: 200px; --y2: 150px; }

/* ---------- Vista de impresión (pantalla) ---------- */
.print-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 14px; border-radius: 24px; background: #fff; box-shadow: var(--shadow); position: sticky; top: 8px; z-index: 5; }
.print-bar h1 { font-size: 24px; margin: 0; flex: 1; min-width: 160px; }
.opt { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; font-size: 16px; }
.opt select { height: 44px; border-radius: 12px; border: 2px solid var(--line); padding: 0 8px; background: #fff; }
.opt input { width: 22px; height: 22px; accent-color: var(--teal); }
.sheets { display: flex; flex-direction: column; align-items: center; gap: 24px; margin-top: 22px; }
.sheet { width: min(100%, 210mm); aspect-ratio: 210 / 297; background: #fff; color: #10394a; padding: 12mm; box-shadow: var(--shadow); border-radius: 6px; display: flex; flex-direction: column; overflow: hidden; }
.sheets[data-paper="letter"] .sheet { width: min(100%, 216mm); aspect-ratio: 216 / 279; }
.sheets[data-kind="diploma"] .sheet { aspect-ratio: 297 / 210; width: min(100%, 297mm); }
.sh-head { display: flex; align-items: center; gap: 10px; border-bottom: 3px solid var(--teal); padding-bottom: 8px; font-size: 22px; }
.sh-head i { font-style: normal; color: var(--teal); }
.sh-title { flex: 1; text-align: right; font-weight: 800; }
.sh-level { background: var(--teal); color: #fff; border-radius: 999px; padding: 2px 12px; font-size: 15px; font-weight: 800; }
.sh-name { display: flex; justify-content: space-between; gap: 10px; margin: 10px 0; font-size: 14px; flex-wrap: wrap; }
.sh-done { display: inline-flex; align-items: center; gap: 6px; font-weight: 800; }
.sh-done i, .cover-checks i { width: 20px; height: 20px; border: 2.5px solid var(--teal-d); border-radius: 6px; display: inline-block; }
.sh-rule { margin: 4px 0 10px; font-size: 15px; }
.sh-key { display: flex; gap: 10px; justify-content: center; }
.sh-key svg { width: 34px; height: 34px; }
.ps-four { flex: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 9mm; align-content: center; justify-items: center; }
.ps-grid { display: grid; grid-template-columns: repeat(4, 1fr); width: 100%; max-width: 78mm; aspect-ratio: 1; border: 3px solid #10394a; border-radius: 8px; overflow: hidden; }
.ps-grid > span { border: 1px solid #9fbcc6; display: grid; place-items: center; padding: 16%; }
.ps-grid > span.bx { border-right: 3px solid #10394a; }
.ps-grid > span.by { border-bottom: 3px solid #10394a; }
.ps-grid .num { font-size: 34px; color: #10394a; }
.sh-solutions { display: flex; align-items: center; gap: 10px; transform: rotate(180deg); opacity: .7; font-size: 12px; margin-top: 8px; flex-wrap: wrap; }
.ps-grid.mini { max-width: 18mm; border-width: 1.5px; }
.ps-grid.mini .num { font-size: 9px; }
.ps-grid.mini > span { padding: 6%; border-width: .5px; }
.pc-msg { display: flex; padding: 10mm 0 8mm; flex-wrap: wrap; justify-content: center; align-content: center; gap: 8mm 10mm; }
.pc-word { display: flex; gap: 2mm; }
.pc-tile { display: flex; flex-direction: column; align-items: center; gap: 2mm; width: 15mm; }
.pc-tile .code-g, .pc-tile .code-num { width: 12mm; height: 12mm; }
.pc-l1 .pc-tile { width: 19mm; }
.pc-l1 .pc-tile .code-g { width: 15mm; height: 15mm; }
.pc-l3 .pc-tile { width: 12mm; }
.pc-l3 .pc-tile .code-g { width: 9mm; height: 9mm; }
.pc-draw { flex: 1; margin-top: 6mm; border: 2px dashed #9fbcc6; border-radius: 12px; padding: 3mm 4mm; font-size: 14px; color: #3c6677; min-height: 50mm; }
.pc-tile i, .pc-leg i { font-style: normal; width: 100%; min-height: 10mm; border-bottom: 2px solid #10394a; text-align: center; font-size: 22px; font-weight: 800; }
.pc-legend { display: flex; flex-wrap: wrap; gap: 3mm; justify-content: center; padding: 4mm; border: 2px dashed #9fbcc6; border-radius: 10px; }
.pc-leg { display: flex; align-items: center; gap: 2mm; }
.pc-leg .code-g, .pc-leg .code-num { width: 7mm; height: 7mm; font-size: 12px; }
.pc-leg i { width: 8mm; min-height: 8mm; font-size: 16px; }
.cover { align-items: center; justify-content: center; text-align: center; background: radial-gradient(circle at 50% 30%, #e4f7fa, #fff 70%); }
.cover-hero { width: 60%; max-width: 90mm; }
.cover h1 { font-size: 34px; margin: 10px 0; }
.cover-name { font-size: 28px; font-weight: 800; }
.cover-checks { display: flex; gap: 14px; justify-content: center; font-weight: 800; }
.cover-checks span { display: flex; align-items: center; gap: 6px; }
.diploma { padding: 8mm; }
.dip-frame { position: relative; flex: 1; border: 4mm solid var(--gold); border-radius: 14px; outline: 1.5mm solid var(--teal); outline-offset: -7mm; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 10mm; background: radial-gradient(circle at 50% 0, #fff7e0, #fff 60%); }
.dip-brand { display: flex; align-items: center; gap: 8px; font-size: 20px; margin: 0; }
.dip-brand b { color: var(--teal); }
.dip-frame h1 { font-size: 40px; margin: 4px 0; color: var(--teal-d); }
.dip-frame p { margin: 4px 0; }
.dip-who { display: flex; align-items: center; gap: 14px; margin: 6px 0; }
.dip-who b { font-size: 36px; }
.dip-text { font-size: 18px; }
.dip-stats { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 8px; font-weight: 800; }
.dip-stats > span { display: inline-flex; align-items: center; gap: 6px; }
.dip-stats svg { width: 26px; height: 26px; }
.dip-badge { background: #f4f9fa; border-radius: 999px; padding: 3px 12px 3px 4px; }
.dip-date { position: absolute; left: 14mm; bottom: 10mm; font-weight: 700; }
.dip-hero { position: absolute; right: 8mm; bottom: 6mm; width: 30mm; }

/* ---------- Móvil ---------- */
@media (max-width: 760px) {
  body { font-size: 17px; }
  .hero { padding: 18px; }
  .hero .mascot { width: 110px; }
  .play-body { grid-template-columns: 1fr; }
  .guide { position: static; flex-direction: row; order: -1; }
  .guide .mascot { flex-direction: row-reverse; gap: 6px; align-items: flex-end; }
  .guide .mascot { flex: 1; min-width: 0; }
  .guide .bubble { margin: 0; font-size: 14px; padding: 8px 12px; max-width: none; flex: 1; text-align: left; }
  .guide .mascot-img { max-width: 64px; }
  .sgrid { width: min(100%, 420px, 44vh); }
  .progress { margin: 12px 0 10px; }
  .play-head { gap: 8px; }
  .play-head h1 { min-width: 0; }
  .lvl { width: 44px; height: 44px; font-size: 19px; }
  .topbar { padding: 10px 0; }
  .guide .bubble::after { left: auto; right: -10px; bottom: 14px; border: 10px solid transparent; border-left-color: #fff; border-right: 0; transform: none; }
  .guide .btn-hint { width: auto; flex: none; margin-left: auto; }
  .stage { padding: 14px; border-radius: 24px; }
  .palette { gap: 8px; }
  .pal { width: 54px; height: 54px; padding: 9px; }
  .pal .num { font-size: 32px; }
  .pal.erase { padding: 15px; }
  .tile { width: 44px; }
  .lvl-1 .tile { width: 54px; }
  .lvl-1 .tile-code, .lvl-1 .code-g { width: 38px; height: 38px; }
  .lvl-3 .tile { width: 36px; }
  .lvl-3 .tile-code, .lvl-3 .code-g { width: 24px; height: 24px; }
  .tile-letter { font-size: 22px; }
  .message { gap: 10px 16px; }
  .key { width: 44px; height: 50px; font-size: 22px; }
  .lvl-3 .key { width: 36px; height: 44px; font-size: 18px; }
  .topbar .pill-player span:last-child { display: none; }
  .brand span { font-size: 22px; }
  .act-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .act-card { padding: 14px 12px 12px; }
  .act-card h3 { font-size: 18px; }
  .act-card p { font-size: 14px; }
  .act-btns .btn { min-height: 46px; padding: 0 10px; font-size: 16px; }
  .player-card { width: 140px; }
  .hero-opt { width: 130px; height: 160px; }
}
@media (max-width: 420px) {
  .act-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ---------- Impresión ---------- */
@media print {
  body { background: #fff; }
  .topbar, .print-bar, #fx { display: none !important; }
  .view { max-width: none; padding: 0; }
  .sheets { margin: 0; gap: 0; display: block; }
  .sheet { width: 100% !important; aspect-ratio: auto !important; height: auto; min-height: 270mm; box-shadow: none; border-radius: 0; padding: 0; page-break-after: always; break-after: page; }
  .sheets[data-paper="letter"] .sheet { min-height: 255mm; }
  .sheets[data-kind="diploma"] .sheet { min-height: 185mm; }
  .sheet:last-child { page-break-after: auto; break-after: auto; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  body.ink-save .sheet { filter: grayscale(1) contrast(1.15); }
  body.ink-save .sheet, body.ink-save .cover, body.ink-save .dip-frame { background: #fff !important; }
  body.ink-save .sh-level { background: none; color: #000; border: 2px solid #000; }
  body.ink-save .code-num { background: none; color: #000; border: 2px solid #000; }
}
body.ink-save .sheet { filter: grayscale(1); }
