/* ¡Vamos! Spanish. Baloo 2 is served from JuegaPop itself (OFL, see
   _pop/fuentes/OFL.txt), so the game asks no other site for anything. */
@font-face {
  font-family: "Baloo 2";
  font-weight: 400 800;
  font-display: swap;
  src: url(../_pop/fuentes/baloo2-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212, U+FEFF;
}
@font-face {
  font-family: "Baloo 2";
  font-weight: 400 800;
  font-display: swap;
  src: url(../_pop/fuentes/baloo2-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02FF, U+1E00-1EFF;
}

:root {
  --ink: #23194a;
  --soft: #6b6390;
  --bg: #fff6e8;
  --card: #ffffff;
  --line: #eadfcd;
  --red: #ff5a5f;
  --yellow: #ffcf3a;
  --green: #2bb673;
  --blue: #3a7bff;
  --violet: #7a4dff;
  --world: #ff5a5f;
  --font: "Baloo 2", ui-rounded, "Trebuchet MS", system-ui, sans-serif;
  --emoji: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
  --r: 20px;
  --shadow: 0 4px 0 #00000014, 0 10px 24px #3b2a0a14;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 8%, #ffe2a8 0 90px, transparent 91px),
    radial-gradient(circle at 92% 18%, #ffd0d1 0 70px, transparent 71px),
    radial-gradient(circle at 80% 96%, #cfe3ff 0 110px, transparent 111px),
    var(--bg);
  overflow-x: hidden;
  user-select: none;
  -webkit-user-select: none;
}
button { font: inherit; color: inherit; cursor: pointer; }
.emoji { font-family: var(--emoji); line-height: 1; }

#app { max-width: 980px; margin: 0 auto; padding: 12px 14px 28px; min-height: 100%; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 8px 20px; border: 0; border-radius: 999px;
  background: var(--blue); color: #fff; font-weight: 800; font-size: 18px;
  box-shadow: 0 4px 0 #00000026; transition: transform .08s;
}
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #00000026; }
.btn.go { background: var(--green); }
.btn.red { background: var(--red); }
.btn.gold { background: var(--yellow); color: var(--ink); }
.btn.ghost { background: #fff; color: var(--ink); box-shadow: 0 3px 0 var(--line); border: 2px solid var(--line); }
.btn.small { min-height: 40px; padding: 4px 14px; font-size: 16px; }
.btn.big { min-height: 60px; font-size: 22px; padding: 10px 28px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; align-items: center; }
.ibtn {
  width: 44px; height: 44px; border-radius: 50%; border: 2px solid var(--line); background: #fff;
  font-size: 20px; display: grid; place-items: center; box-shadow: 0 3px 0 var(--line);
}
.ibtn.off { opacity: .45; }

/* ---------- Top bar ---------- */
.top { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.top .grow { flex: 1; }
.logo { font-weight: 800; font-size: clamp(26px, 6vw, 40px); line-height: 1; letter-spacing: -.5px; }
.logo b { color: var(--red); }
.logo small { display: block; font-size: 14px; font-weight: 700; color: var(--soft); letter-spacing: 0; }
.coins { white-space: nowrap; flex-shrink: 0;
  display: inline-flex; align-items: center; gap: 4px; padding: 4px 12px; border-radius: 999px;
  background: #fff3c4; border: 2px solid #ffe08a; font-weight: 800; font-size: 18px;
}
.coins.bump { animation: bump .4s; }
@keyframes bump { 40% { transform: scale(1.18); } }

/* ---------- Avatar ---------- */
.avatar {
  position: relative; display: inline-grid; place-items: center; flex: none;
  width: 52px; height: 52px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 3px 0 #0000001f;
  background: var(--av, #ffd23f); font-size: 30px;
}
.avatar .hat { position: absolute; top: -18%; left: 50%; transform: translateX(-50%) rotate(-8deg); font-size: .62em; }
.avatar.xl { width: 120px; height: 120px; font-size: 72px; border-width: 5px; }

/* ---------- Home ---------- */
.menu { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 6px 0 14px; }
.menu button {
  border: 0; border-radius: var(--r); padding: 10px 6px; background: #fff; box-shadow: var(--shadow);
  font-weight: 800; font-size: 16px; display: grid; justify-items: center; gap: 2px; line-height: 1.1;
}
.menu button .emoji { font-size: 30px; }
.menu button small { font-weight: 600; color: var(--soft); font-size: 12px; }
.menu .reto { background: linear-gradient(160deg, #fff4c9, #ffe08a); }
.menu .team { background: linear-gradient(160deg, #e3efff, #c4dcff); }
.menu .review { background: linear-gradient(160deg, #e6fff1, #bff0d4); }

.worlds { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 10px; scrollbar-width: none; }
.worlds::-webkit-scrollbar { display: none; }
.wtab {
  flex: 1 0 auto; min-width: 128px; border: 3px solid transparent; border-radius: 18px; padding: 8px 12px;
  background: #fff; box-shadow: var(--shadow); text-align: left; line-height: 1.1;
}
.wtab b { display: block; font-size: 17px; }
.wtab small { color: var(--soft); font-weight: 700; font-size: 13px; }
.wtab .emoji { float: right; font-size: 26px; margin-left: 6px; }
.wtab.on { border-color: var(--wc); background: color-mix(in srgb, var(--wc) 12%, #fff); }

.whead {
  position: relative; overflow: hidden; border-radius: 24px; padding: 16px 18px; margin: 4px 0 12px; color: #fff;
  background: linear-gradient(120deg, var(--world), color-mix(in srgb, var(--world) 60%, #ffcf3a));
  box-shadow: var(--shadow);
}
.whead h2 { margin: 0; font-size: clamp(24px, 5vw, 34px); line-height: 1.05; }
.whead p { margin: 2px 0 0; font-weight: 700; opacity: .95; }
.whead .big { position: absolute; right: 10px; bottom: -14px; font-size: 92px; opacity: .35; transform: rotate(-10deg); }
.whead .pill { display: inline-block; background: #ffffff33; padding: 0 10px; border-radius: 999px; font-size: 14px; font-weight: 800; }

.units { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.ucard {
  position: relative; border: 0; border-radius: var(--r); background: #fff; box-shadow: var(--shadow);
  padding: 12px 12px 10px; text-align: left; display: grid; grid-template-columns: 56px 1fr; gap: 2px 10px; align-items: center;
  transition: transform .1s;
}
.ucard:active { transform: scale(.98); }
.ucard .ic {
  grid-row: span 3; width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; font-size: 32px;
  background: color-mix(in srgb, var(--world) 16%, #fff);
}
.ucard b { font-size: 18px; line-height: 1.1; }
.ucard small { color: var(--soft); font-weight: 700; line-height: 1.1; }
.stars { color: #e7dcc6; font-size: 16px; letter-spacing: 1px; }
.stars i { font-style: normal; color: #ffb800; }
.ucard .num { position: absolute; top: 8px; right: 10px; font-size: 13px; font-weight: 800; color: var(--soft); }
.ucard.next::after {
  content: "Next!"; position: absolute; top: -8px; right: 10px; background: var(--red); color: #fff; font-weight: 800;
  font-size: 12px; padding: 0 8px; border-radius: 999px; animation: bob 1.4s infinite;
}
@keyframes bob { 50% { transform: translateY(-3px); } }
.foot { margin-top: 16px; color: var(--soft); font-size: 14px; text-align: center; font-weight: 600; }

/* ---------- Learn (word cards) ---------- */
.screen-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.screen-head h2 { margin: 0; font-size: clamp(22px, 5vw, 30px); line-height: 1.05; }
.screen-head small { display: block; font-size: 15px; color: var(--soft); }
.screen-head .grow { flex: 1; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin-bottom: 14px; }
.wcard {
  border: 0; border-radius: 18px; background: #fff; box-shadow: var(--shadow); padding: 10px 8px 8px;
  display: grid; justify-items: center; gap: 2px; text-align: center; line-height: 1.1;
}
.wcard .p { height: 64px; display: grid; place-items: center; }
.wcard b { font-size: 18px; }
.wcard small { color: var(--soft); font-weight: 600; }
.wcard.say { animation: pulse .5s; }
@keyframes pulse { 40% { transform: scale(1.07); } }
.tip {
  background: #fff; border-radius: 16px; padding: 10px 14px; margin: 0 0 12px; box-shadow: var(--shadow);
  font-weight: 600; color: var(--soft);
}
.tip b { color: var(--ink); }

/* ---------- Pictures ---------- */
.pic { display: inline-grid; place-items: center; }
.pic.e { font-family: var(--emoji); line-height: 1; }
.pic.sw { border-radius: 50%; border: 3px solid #0000001a; box-shadow: inset 0 -6px 0 #00000014; }
.pic.num {
  font-weight: 800; color: #fff; background: var(--violet); border-radius: 18px; padding: 0 .3em; min-width: 1.4em;
  box-shadow: inset 0 -5px 0 #0000002a;
}
.pic.eur { font-weight: 800; color: #1c6b3b; background: #d8f7e4; border: 3px dashed #57c487; border-radius: 14px; padding: 0 .3em; }
.pic.flag svg, .pic.clock svg { display: block; width: 100%; height: 100%; }
.pic.flag svg { border-radius: 6px; box-shadow: 0 2px 6px #0003; }
.pic.txt { font-weight: 800; color: var(--ink); text-align: center; line-height: 1.05; }

/* ---------- Lesson ---------- */
.lesson { display: flex; flex-direction: column; min-height: calc(100vh - 40px); }
.lbar { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.prog { flex: 1; height: 16px; background: #f1e6d2; border-radius: 999px; overflow: hidden; }
.prog i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--green), #7be495); border-radius: 999px; transition: width .35s; }
.hearts { font-size: 20px; letter-spacing: -2px; }
.hearts .lost { opacity: .25; }
.qbox {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 14px;
  background: #fff; border-radius: 26px; padding: 18px 14px 20px; box-shadow: var(--shadow);
}
.qtitle { font-weight: 800; color: var(--soft); font-size: 17px; text-align: center; }
.qprompt { display: grid; justify-items: center; gap: 6px; text-align: center; }
.qprompt .es { font-size: clamp(30px, 7vw, 52px); font-weight: 800; line-height: 1.05; color: var(--ink); }
.qprompt .en { font-size: clamp(20px, 4.5vw, 28px); font-weight: 700; color: var(--soft); line-height: 1.1; }
.speak {
  width: 96px; height: 96px; border-radius: 50%; border: 0; background: var(--blue); color: #fff; font-size: 46px;
  box-shadow: 0 6px 0 #1f4fbf; display: grid; place-items: center;
}
.speak.small { width: 46px; height: 46px; font-size: 22px; box-shadow: 0 3px 0 #1f4fbf; }
.speak.slow { background: #8a7bff; box-shadow: 0 3px 0 #5a49d6; }
.speak.on { animation: talk .6s infinite; }
@keyframes talk { 50% { transform: scale(1.06); } }
.opts { display: grid; gap: 10px; width: 100%; max-width: 620px; grid-template-columns: repeat(2, 1fr); }
.opt {
  border: 3px solid var(--line); border-radius: 20px; background: #fff; min-height: 96px; padding: 8px;
  display: grid; place-items: center; font-weight: 800; font-size: clamp(20px, 4.4vw, 28px); line-height: 1.1; text-align: center;
  box-shadow: 0 4px 0 var(--line); transition: transform .08s;
}
.opt:active { transform: translateY(2px); }
.opt.txt { min-height: 70px; }
.opt.ok { border-color: var(--green); background: #e3fbec; box-shadow: 0 4px 0 #9fe2bb; animation: pop .35s; }
.opt.bad { border-color: var(--red); background: #ffe6e7; box-shadow: 0 4px 0 #ffb3b5; animation: shake .35s; }
.opt.dim { opacity: .4; }
@keyframes pop { 40% { transform: scale(1.06); } }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.tf { display: flex; gap: 14px; }
.tf .opt { min-width: 130px; min-height: 76px; }
.msg { min-height: 34px; font-weight: 800; font-size: 20px; text-align: center; }
.msg.ok { color: var(--green); }
.msg.bad { color: var(--red); }
.msg small { display: block; color: var(--soft); font-weight: 700; font-size: 16px; }

/* Spell and build: tiles */
.slots { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; min-height: 58px; max-width: 640px; }
.slot {
  width: 46px; height: 54px; border-radius: 12px; border: 3px dashed #d9ccb3; display: grid; place-items: center;
  font-size: 28px; font-weight: 800; background: #fffdf8;
}
.slot.full { border-style: solid; border-color: var(--blue); background: #eef4ff; }
.slot.gap { border: 0; width: 14px; background: none; }
.tiles { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; max-width: 640px; }
.tile {
  min-width: 50px; height: 54px; padding: 0 12px; border-radius: 14px; border: 0; background: var(--yellow);
  font-size: 26px; font-weight: 800; box-shadow: 0 4px 0 #d9a400;
}
.tile.word { background: #fff; border: 3px solid var(--line); box-shadow: 0 4px 0 var(--line); font-size: 22px; }
.tile.used { visibility: hidden; }
.answer {
  display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; align-items: center; min-height: 66px; width: 100%; max-width: 680px;
  border-bottom: 3px solid var(--line); padding: 6px 4px 10px;
}
.answer .tile.word { background: #eef4ff; border-color: #b9cffc; box-shadow: 0 4px 0 #b9cffc; }
.answer.ok .tile.word { background: #e3fbec; border-color: #9fe2bb; box-shadow: 0 4px 0 #9fe2bb; }
.answer.bad { animation: shake .35s; }

/* Match up */
.match { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; max-width: 620px; }
.match .col { display: grid; gap: 10px; }
.match .opt { min-height: 72px; }
.match .opt.sel { border-color: var(--blue); background: #eef4ff; box-shadow: 0 4px 0 #b9cffc; }
.match .opt.gone { visibility: hidden; }

/* Order */
.seq { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; max-width: 640px; }
.seq .opt { min-width: 120px; min-height: 64px; padding: 6px 14px; position: relative; }
.seq .opt .n { position: absolute; top: -10px; left: -6px; background: var(--green); color: #fff; width: 28px; height: 28px; border-radius: 50%; font-size: 16px; display: grid; place-items: center; }

/* Keypad */
.typed { font-size: 46px; font-weight: 800; min-width: 160px; min-height: 64px; text-align: center; border-bottom: 4px solid var(--line); }
.pad { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; width: 100%; max-width: 420px; }
.pad button { height: 56px; border-radius: 14px; border: 0; background: #fff; box-shadow: 0 4px 0 var(--line); border: 2px solid var(--line); font-size: 26px; font-weight: 800; }
.pad .ok { background: var(--green); color: #fff; border-color: transparent; box-shadow: 0 4px 0 #1b8a55; }
.pad .del { background: #ffe6e7; }

/* Timer (Reto and class game) */
.tbar { width: 100%; max-width: 620px; height: 10px; border-radius: 999px; background: #f1e6d2; overflow: hidden; }
.tbar i { display: block; height: 100%; width: 100%; background: var(--yellow); transform-origin: left; }

/* ---------- Overlays ---------- */
#ov {
  position: fixed; inset: 0; z-index: 20; background: #23194acc; display: grid; place-items: center; padding: 16px;
  animation: fade .2s;
}
@keyframes fade { from { opacity: 0; } }
.card {
  width: min(520px, 100%); max-height: calc(100vh - 32px); overflow: auto; background: #fff; border-radius: 28px;
  padding: 22px 20px 20px; text-align: center; box-shadow: 0 20px 60px #0006; animation: rise .3s;
}
@keyframes rise { from { transform: translateY(30px) scale(.96); opacity: 0; } }
.card h2 { margin: 4px 0 6px; font-size: 30px; line-height: 1.05; }
.card p { margin: 6px 0; font-weight: 600; color: var(--soft); }
.card .big { font-size: 64px; line-height: 1; }
.bigstars { font-size: 48px; letter-spacing: 4px; }
.bigstars .off { filter: grayscale(1); opacity: .3; }
.res { display: flex; gap: 10px; justify-content: center; margin: 10px 0; }
.res div { background: #fff6e8; border-radius: 14px; padding: 6px 14px; font-weight: 700; color: var(--soft); line-height: 1.1; }
.res b { display: block; font-size: 24px; color: var(--ink); }
.fact {
  text-align: left; background: linear-gradient(140deg, #fff7d6, #ffe9a8); border-radius: 18px; padding: 12px 14px; margin: 12px 0;
  font-weight: 600; color: #5b4300;
}
.fact b { display: block; color: #8a5a00; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin: 6px 0; }
.chips span { background: #ffe6e7; color: #b3262b; border-radius: 999px; padding: 2px 10px; font-weight: 800; }
.card .row { margin-top: 14px; }

/* ---------- Shop ---------- */
.shopgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; margin-bottom: 16px; }
.sitem {
  border: 3px solid transparent; border-radius: 18px; background: #fff; box-shadow: var(--shadow); padding: 8px 4px;
  display: grid; justify-items: center; gap: 0; line-height: 1.1;
}
.sitem .emoji { font-size: 40px; height: 48px; display: grid; place-items: center; }
.sitem b { font-size: 15px; }
.sitem small { color: var(--soft); font-weight: 600; font-size: 12px; }
.sitem .price { margin-top: 4px; font-weight: 800; font-size: 14px; color: #8a5a00; }
.sitem.sel { border-color: var(--green); }
.sitem.locked { opacity: .75; }
.sitem.locked .emoji { filter: grayscale(.8); }
.swatches { display: flex; gap: 10px; justify-content: center; margin-bottom: 16px; }
.swatches button { width: 44px; height: 44px; border-radius: 50%; border: 4px solid #fff; box-shadow: 0 2px 6px #0003; }
.swatches button.sel { outline: 4px solid var(--green); }
h3.sec { margin: 6px 0 8px; font-size: 20px; }
.preview { display: grid; justify-items: center; gap: 4px; margin: 4px 0 14px; }

/* ---------- Class game ---------- */
.teamset { display: grid; gap: 12px; }
.teamset .box { background: #fff; border-radius: var(--r); box-shadow: var(--shadow); padding: 12px 14px; }
.teamset h3 { margin: 0 0 8px; font-size: 19px; }
.seg { display: flex; gap: 8px; flex-wrap: wrap; }
.seg button { border: 3px solid var(--line); background: #fff; border-radius: 14px; padding: 6px 14px; font-weight: 800; font-size: 17px; }
.seg button.on { border-color: var(--blue); background: #eef4ff; }
.pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 6px; }
.pick label { display: flex; align-items: center; gap: 8px; background: #fff6e8; border-radius: 12px; padding: 6px 10px; font-weight: 700; cursor: pointer; }
.pick input { width: 20px; height: 20px; accent-color: var(--green); }
.pick .wl { grid-column: 1 / -1; font-weight: 800; color: var(--soft); margin-top: 4px; }
.scores { display: flex; gap: 8px; width: 100%; max-width: 860px; }
.score {
  flex: 1; border-radius: 16px; padding: 6px 8px; background: #fff; border: 4px solid transparent; text-align: center; line-height: 1;
  box-shadow: var(--shadow); transition: transform .2s;
}
.score .emoji { font-size: 26px; }
.score b { display: block; font-size: clamp(22px, 4vw, 34px); }
.score small { font-weight: 700; color: var(--soft); font-size: 13px; }
.score.turn { border-color: var(--tc); transform: translateY(-4px) scale(1.04); background: color-mix(in srgb, var(--tc) 14%, #fff); }
.turnlabel { font-size: clamp(22px, 4.5vw, 34px); font-weight: 800; color: var(--tc); text-align: center; }
.podium { display: flex; align-items: flex-end; justify-content: center; gap: 8px; margin: 10px 0; }
.podium div { width: 92px; border-radius: 14px 14px 0 0; color: #fff; font-weight: 800; padding-top: 6px; display: grid; justify-items: center; }
.podium .emoji { font-size: 34px; }

/* Toast and confetti */
#toast {
  position: fixed; left: 50%; top: 14px; transform: translateX(-50%) translateY(calc(-100% - 24px)); z-index: 30;
  background: var(--ink); color: #fff; font-weight: 800; padding: 8px 18px; border-radius: 999px; transition: transform .3s;
  pointer-events: none; max-width: 92vw; text-align: center;
}
#toast.on { transform: translateX(-50%) translateY(0); }
.confetti { position: fixed; top: -20px; width: 10px; height: 14px; z-index: 40; pointer-events: none; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); } }

/* Whiteboard: big and roomy */
body.board #app { max-width: 1200px; }
body.board .opt { min-height: 130px; font-size: clamp(26px, 3.6vw, 40px); }
body.board .qprompt .es { font-size: clamp(40px, 6vw, 72px); }

@media (max-width: 520px) {
  #app { padding: 10px 10px 24px; }
  .menu button { font-size: 14px; }
  .menu button .emoji { font-size: 26px; }
  .opt { min-height: 84px; border-radius: 16px; }
  .units { grid-template-columns: 1fr; }
  .tf .opt { min-width: 110px; }
  .slot { width: 38px; height: 48px; font-size: 24px; }
  .tile { min-width: 42px; height: 48px; font-size: 22px; padding: 0 9px; }
  .tile.word { font-size: 19px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
