:root {
  --cobalt: #1d3fa6;
  --deep: #0f2466;
  --sun: #ffc83d;
  --tomato: #e8432d;
  --tile: #fdfbf3;
  --mint: #1fa37a;
  --ink: #14213d;
  --display: 'Lilita One', 'Arial Rounded MT Bold', system-ui, sans-serif;
  --body: 'Nunito', 'Avenir Next', system-ui, sans-serif;
}
* { box-sizing: border-box; margin: 0; }
html, body { height: 100%; }
body {
  font-family: var(--body); font-weight: 700; color: var(--ink);
  background-color: var(--cobalt);
  background-image:
    radial-gradient(circle at 0 0, var(--sun) 0 7px, transparent 8px),
    radial-gradient(circle at 30px 30px, #ffffff26 0 11px, transparent 12px),
    linear-gradient(45deg, #ffffff12 25%, transparent 25% 75%, #ffffff12 75%);
  background-size: 60px 60px;
}
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
button:focus-visible, input:focus-visible { outline: 4px solid var(--sun); outline-offset: 2px; }

#app {
  max-width: 560px; min-height: 100dvh; margin: 0 auto; background: var(--tile);
  display: flex; flex-direction: column; position: relative; overflow: hidden;
  box-shadow: 0 0 0 6px var(--deep), 0 0 60px #0008;
}
h1, h2, .display { font-family: var(--display); font-weight: 400; letter-spacing: .01em; }
.pad { padding: 16px 18px; }
.grow { flex: 1; }
.center { text-align: center; }
.muted { opacity: .7; font-weight: 500; }

/* Buttons */
.btn {
  display: block; width: 100%; padding: 16px; border-radius: 18px; font-family: var(--display);
  font-size: 1.3rem; background: var(--tile); border: 3px solid var(--deep); box-shadow: 0 5px 0 var(--deep);
  transition: transform .08s, box-shadow .08s;
}
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--deep); }
.btn.primary { background: var(--sun); }
.btn.go { background: var(--mint); color: #fff; }
.btn:disabled { opacity: .4; cursor: default; }
.chip {
  padding: 8px 12px; border-radius: 999px; background: #fff; border: 2px solid var(--deep);
  font-size: .9rem; white-space: nowrap;
}
.chip.on { background: var(--sun); }

/* Title */
.title { background: linear-gradient(#6ec1f0, #ffe7a3 70%); flex: 1; display: flex; flex-direction: column; }
.title .hero { flex: 1; display: grid; place-items: center; text-align: center; padding: 30px 18px 10px; }
.logo { font-family: var(--display); font-size: clamp(3.2rem, 17vw, 5.4rem); line-height: .86; color: var(--tomato);
  text-shadow: 0 4px 0 var(--deep); -webkit-text-stroke: 2px var(--deep); transform: rotate(-3deg); }
.logo span { display: block; color: var(--sun); }
.chase { font-size: 3.4rem; margin-top: 22px; white-space: nowrap; animation: run 1.1s ease-in-out infinite alternate; }
@keyframes run { to { transform: translateX(26px) rotate(3deg); } }
.title .panel { background: var(--tile); border-top: 4px solid var(--deep); border-radius: 26px 26px 0 0; padding: 20px 18px 24px; display: grid; gap: 12px; }
.title input {
  width: 100%; padding: 14px 16px; font: inherit; font-size: 1.15rem; border-radius: 16px;
  border: 3px solid var(--deep); background: #fff; color: var(--ink);
}

/* Map */
.topbar { display: flex; gap: 8px; align-items: center; padding: 12px 14px; background: var(--deep); color: #fff; }
.topbar .rank { font-family: var(--display); font-size: 1.15rem; margin-right: auto; line-height: 1.1; }
.topbar .rank small { display: block; font-family: var(--body); font-size: .75rem; opacity: .8; }
.topbar .chip { color: var(--ink); }
.sea { background: linear-gradient(#2b56c9, var(--cobalt)); padding: 6px 0 4px; }
.swipe { text-align: center; color: #fffc; font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; }
.scroll { overflow-x: auto; padding: 4px 8px; scrollbar-width: thin; }
.map { position: relative; aspect-ratio: 108 / 90; min-width: 780px; }
.map svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.pin {
  position: absolute; transform: translate(-50%, -50%); display: grid; justify-items: center; gap: 1px;
  font-size: .74rem; font-weight: 900; color: var(--ink); z-index: 2;
}
.pin i {
  font-style: normal; width: 36px; height: 36px; display: grid; place-items: center; font-size: .95rem; font-weight: 900;
  border-radius: 50%; background: #fff; border: 3px solid var(--deep); box-shadow: 0 3px 0 var(--deep);
}
.pin b { background: #fffd; border-radius: 6px; padding: 0 4px; }
.pin.done i { background: var(--mint); color: #fff; }
.pin.now { z-index: 3; }
.pin.now i { background: var(--sun); animation: pulse 1s infinite alternate; }
.pin.locked { opacity: .75; }
.pin.locked i { background: #cdd3e3; }
.pin .cat { position: absolute; top: -20px; right: -16px; font-size: 1.3rem; animation: bob 1.2s infinite alternate; }
@keyframes pulse { to { transform: scale(1.18); box-shadow: 0 3px 0 var(--deep), 0 0 0 8px #ffc83d55; } }
@keyframes bob { to { transform: translateY(-5px) rotate(8deg); } }
.below { padding: 14px 16px 18px; display: grid; gap: 12px; }
.next-card { border: 3px solid var(--deep); border-radius: 18px; padding: 12px 14px; background: #fff; }
.next-card h2 { font-size: 1.4rem; color: var(--cobalt); }
.row { display: flex; gap: 10px; }
.row .btn { font-size: 1.05rem; padding: 13px 8px; }
.settings { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }

/* Scene */
.scene {
  position: relative; height: 190px; overflow: hidden; flex: none;
  background: linear-gradient(var(--sky1, #6ec1f0), var(--sky2, #ffe7a3));
  border-bottom: 4px solid var(--deep);
}
.scene::before { content: ''; position: absolute; top: 16px; right: 26px; width: 50px; height: 50px; border-radius: 50%;
  background: #fff6c9; box-shadow: 0 0 0 10px #fff6c955, 0 0 0 22px #fff6c92e; }
.scene::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 34px; background: #e2b770; border-top: 3px solid #b98a45; }
.scene .props { position: absolute; left: 0; right: 0; bottom: 22px; display: flex; justify-content: space-around; align-items: flex-end; font-size: 3.2rem; z-index: 1; }
.scene .props span:nth-child(odd) { font-size: 4.2rem; }
.scene .npc { position: absolute; left: 14px; bottom: 6px; font-size: 4.4rem; z-index: 2; animation: bob 1.4s infinite alternate; filter: drop-shadow(0 4px 0 #0003); }
.scene.talk .props { opacity: .55; }
.bubble {
  position: absolute; left: 104px; right: 12px; top: 14px; z-index: 3; background: #fff; border: 3px solid var(--deep);
  border-radius: 18px 18px 18px 4px; padding: 10px 12px; font-size: 1.1rem; line-height: 1.25; text-align: left;
  box-shadow: 0 4px 0 var(--deep);
}
.bubble small { display: block; font-weight: 500; opacity: .75; margin-top: 4px; font-size: .85rem; }
.bubble .who { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--tomato); }

/* Briefing */
.brief h1 { font-size: 2.3rem; color: var(--cobalt); line-height: 1; }
.brief .skill { display: inline-block; background: var(--sun); border: 2px solid var(--deep); border-radius: 10px; padding: 4px 10px; margin: 10px 0; }
.brief p { font-size: 1.1rem; line-height: 1.4; font-weight: 500; }

/* Play */
.hud { display: flex; align-items: center; gap: 10px; padding: 10px 14px; }
.hud .x { font-size: 1.3rem; width: 36px; height: 36px; border-radius: 50%; }
.bar { flex: 1; height: 16px; border-radius: 999px; background: #e3e0d4; border: 2px solid var(--deep); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--mint); transition: width .3s; }
.stage { flex: 1; display: flex; flex-direction: column; padding: 8px 18px 20px; gap: 14px; }
.ask { font-size: .82rem; text-transform: uppercase; letter-spacing: .08em; color: var(--cobalt); font-weight: 900; }
.prompt { font-family: var(--display); font-size: 1.7rem; line-height: 1.15; }
.big { font-size: 5rem; line-height: 1; text-align: center; }
.es-word { font-family: var(--display); font-size: 2.6rem; color: var(--cobalt); text-align: center; line-height: 1.05; }
.en-word { text-align: center; font-size: 1.3rem; font-weight: 500; }
.speaker {
  width: 64px; height: 64px; border-radius: 50%; background: var(--cobalt); color: #fff; font-size: 1.7rem;
  border: 3px solid var(--deep); box-shadow: 0 4px 0 var(--deep); margin: 0 auto; display: grid; place-items: center;
}
.speaker.huge { width: 110px; height: 110px; font-size: 3rem; }
.speaker:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--deep); }
.card { border: 3px solid var(--deep); border-radius: 22px; background: #fff; padding: 22px 16px; display: grid; gap: 10px; box-shadow: 0 6px 0 var(--deep); animation: pop .25s; }
@keyframes pop { from { transform: scale(.85); } }
.opts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.opt { min-height: 92px; font-size: 1.05rem; line-height: 1.2; }
.opt .e { display: block; font-size: 2rem; }
.opt.right { background: var(--mint); color: #fff; }
.opt.wrong { background: var(--tomato); color: #fff; }

/* Azulejo word tiles — the signature */
.tile, .btn.opt {
  background-color: var(--tile);
  background-image:
    radial-gradient(circle at 0 0, var(--cobalt) 0 7px, transparent 8px),
    radial-gradient(circle at 100% 0, var(--cobalt) 0 7px, transparent 8px),
    radial-gradient(circle at 0 100%, var(--cobalt) 0 7px, transparent 8px),
    radial-gradient(circle at 100% 100%, var(--cobalt) 0 7px, transparent 8px);
}
.btn.opt.right { background: var(--mint); }
.btn.opt.wrong { background: var(--tomato); }
.tile {
  padding: 10px 16px; border-radius: 10px; border: 3px solid var(--cobalt); box-shadow: 0 4px 0 var(--deep);
  font-size: 1.15rem; font-weight: 900; animation: pop .15s;
}
.tile:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--deep); }
.tile.used { visibility: hidden; }
.answer { min-height: 62px; border-bottom: 3px dashed #b9b4a0; display: flex; flex-wrap: wrap; gap: 8px; padding-bottom: 10px; align-content: flex-start; }
.pool { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.typed { width: 100%; padding: 14px; font: inherit; font-size: 1.2rem; border-radius: 14px; border: 3px solid var(--cobalt); background: #fff; color: var(--ink); }

.foot { position: sticky; bottom: 0; padding: 12px 18px 18px; background: linear-gradient(transparent, var(--tile) 22%); margin-top: auto; }
.fb { position: fixed; left: 50%; width: min(100%, 560px); translate: -50% 0; bottom: 0; padding: 16px 18px 20px; border-top: 4px solid var(--deep); z-index: 5; animation: rise .2s; display: grid; gap: 10px; }
.fb.ok { background: #c9f2df; }
.fb.bad { background: #ffd5cc; }
.fb h2 { font-size: 1.5rem; }
.fb p { font-size: 1.1rem; }
.fb p small { display: block; font-weight: 500; opacity: .8; }
@keyframes rise { from { transform: translateY(100%); } }

/* Reward */
.reward { flex: 1; display: flex; flex-direction: column; background: linear-gradient(var(--sky1, #6ec1f0), var(--tile) 55%); }
.stamp {
  width: 190px; height: 190px; margin: 26px auto 8px; border-radius: 50%; border: 6px double var(--tomato); color: var(--tomato);
  display: grid; place-items: center; align-content: center; gap: 2px; text-align: center; background: #fffc; transform: rotate(-12deg);
  font-family: var(--display); animation: stampIn .5s cubic-bezier(.2, 2, .4, 1);
}
.stamp .e { font-size: 3rem; }
.stamp b { font-size: 1.6rem; font-weight: 400; text-transform: uppercase; }
.stamp small { font-family: var(--body); font-size: .7rem; letter-spacing: .15em; }
@keyframes stampIn { from { transform: scale(2.4) rotate(20deg); } }
.stars { font-size: 2.6rem; text-align: center; letter-spacing: 6px; }
.stars .off { filter: grayscale(1); opacity: .3; }
.clue { border: 3px dashed var(--deep); border-radius: 16px; padding: 12px 14px; background: #fff; font-weight: 500; line-height: 1.4; }
.clue b { color: var(--tomato); }

/* Backpack */
.bag { display: grid; gap: 8px; }
.bag h2 { color: var(--cobalt); margin-top: 10px; }
.word { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 10px 12px; border-radius: 12px; background: #fff; border: 2px solid var(--deep); }
.word .e { font-size: 1.5rem; width: 34px; text-align: center; }
.word .t { flex: 1; line-height: 1.2; }
.word .t small { display: block; font-weight: 500; opacity: .75; }
.dots { letter-spacing: 2px; color: var(--mint); font-size: .8rem; }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
