/* Bebela Code — casca do app. Tokens visuais + telas.
   css/play.css só USA estes tokens; quem define é este arquivo.
   Estrutura no estilo Duolingo (chapado, cantos 12px, borda 2px, borda inferior 4px,
   botões em MAIÚSCULAS) com paleta própria: violeta + turquesa. */

/* ---------- fonte pixel das brincadeiras (offline, sem CDN) ---------- */
@font-face {
  font-family: "DTM Sans";
  src: url("../fonts/DTM-Sans.otf") format("opentype");
  font-weight: normal; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "DTM Mono";
  src: url("../fonts/DTM-Mono.otf") format("opentype");
  font-weight: normal; font-style: normal; font-display: swap;
}

:root {
  /* superfícies */
  --bg: #ffffff;
  --bg-soft: #faf9ff;
  --card: #ffffff;
  --line: #e6e4f0;
  --disabled: #b4b2c2;

  /* tinta */
  --ink: #3d3a50;
  --muted: #77748a;
  --deep: #1d1a39;

  /* marca */
  --primary: #7c5cff;
  --primary-dark: #5a3fd6;
  --primary-wash: #ebe5ff;

  /* ação secundária / links */
  --blue: #12b5a6;
  --blue-dark: #0d8f83;
  --blue-wash: #dcf6f3;

  /* certo / errado */
  --ok: #2ec27e;
  --ok-dark: #1f9d63;
  --ok-wash: #d9f7e8;
  --danger: #ff5a6e;
  --danger-dark: #e03a50;
  --danger-wash: #ffe1e5;

  /* XP, estrelas, ofensiva */
  --gold: #ffb830;
  --gold-dark: #d9920f;
  --gold-wash: #fff3dc;
  --streak: #ff8a3d;

  /* usado por play.css / temas de mundo */
  --purple: #7c5cff;
  --purple-dark: #5a3fd6;

  --radius: 12px;
  --radius-card: 16px;
  --font: ui-rounded, "SF Pro Rounded", "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --font-game: "DTM Sans", var(--font);
  --mono-game: "DTM Mono", var(--mono);

  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);

  --tab-h: 64px;
}

/* ---------- reset ---------- */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; overflow: hidden; overscroll-behavior: none; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  font-size: 17px;
  font-weight: 500;
  line-height: 1.3;
  -webkit-text-size-adjust: 100%;
  touch-action: manipulation;
}
h1, h2, h3, p, ul, ol { margin: 0; }
h1, h2, h3 { font-weight: 800; letter-spacing: -.02em; }
ul { padding: 0; list-style: none; }
button { font: inherit; color: inherit; margin: 0; }
code, pre, textarea, .mono { font-family: var(--mono); }
[hidden] { display: none !important; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* texto das brincadeiras na fonte pixel (maior, sem negrito sintético) */
.gamefont {
  font-family: var(--font-game);
  font-weight: 400;
  font-size: 19px;
  line-height: 1.35;
  letter-spacing: 0;
}
.gamefont strong, .gamefont b { font-weight: 400; color: var(--primary-dark); }
.gamefont code { font-family: var(--mono-game); font-weight: 400; }

#app {
  position: fixed; inset: 0;
  display: flex; flex-direction: column;
  padding-left: var(--safe-l); padding-right: var(--safe-r);
}
.screen {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
.screen > .view {
  flex: 1 0 auto;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  animation: viewIn .26s ease both;
}
@keyframes viewIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.wrap { max-width: 560px; margin: 0 auto; padding: 16px; width: 100%; min-width: 0; }
.screen > .view, .lesson__body > .step { min-width: 0; }

/* ---------- botões (assinatura: borda inferior de 4px + efeito de apertar) ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 12px 20px;
  border: 0; border-radius: var(--radius);
  background: var(--primary); color: #fff;
  font-family: var(--font);
  font-weight: 700; font-size: 15px; letter-spacing: .053em; text-transform: uppercase;
  box-shadow: 0 4px 0 var(--primary-dark);
  cursor: pointer; user-select: none; -webkit-user-select: none;
  touch-action: manipulation;
  transition: transform .06s ease, box-shadow .06s ease, background .15s ease, opacity .15s ease;
}
.btn:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 0 0 var(--primary-dark); }
.btn:disabled { background: #efeef5; color: var(--disabled); box-shadow: 0 4px 0 #dcdae6; cursor: default; }
.btn--block { width: 100%; }
.btn--blue { background: var(--blue); box-shadow: 0 4px 0 var(--blue-dark); }
.btn--blue:active:not(:disabled) { box-shadow: 0 0 0 var(--blue-dark); }
.btn--ok { background: var(--ok); box-shadow: 0 4px 0 var(--ok-dark); }
.btn--ok:active:not(:disabled) { box-shadow: 0 0 0 var(--ok-dark); }
.btn--danger { background: var(--danger); box-shadow: 0 4px 0 var(--danger-dark); }
.btn--danger:active:not(:disabled) { box-shadow: 0 0 0 var(--danger-dark); }
.btn--gold { background: var(--gold); color: var(--deep); box-shadow: 0 4px 0 var(--gold-dark); }
.btn--gold:active:not(:disabled) { box-shadow: 0 0 0 var(--gold-dark); }
/* contornado: branco, borda 2px, texto turquesa */
.btn--ghost {
  background: var(--card); color: var(--blue-dark);
  border: 2px solid var(--line);
  box-shadow: 0 4px 0 var(--line);
}
.btn--ghost:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 0 0 var(--line); }
.btn--sm { min-height: 44px; padding: 8px 14px; font-size: 14px; }
.btn:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 44px; min-height: 44px; padding: 0 8px;
  background: none; border: 0; border-radius: var(--radius);
  font-size: 22px; color: var(--muted); cursor: pointer;
}
.icon-btn:active { background: var(--primary-wash); }
.icon-btn:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }

/* ---------- topbar ---------- */
.topbar {
  flex: 0 0 auto;
  padding: calc(var(--safe-t) + 12px) 16px 12px;
  background: var(--card);
  border-bottom: 2px solid var(--line);
  z-index: 5;
}
.stats { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.stat {
  display: inline-flex; align-items: center; gap: 6px;
  font-weight: 700; font-size: 17px;
  padding: 4px 8px; border-radius: var(--radius);
}
.stat i { font-style: normal; font-size: 20px; }
.stat--streak { color: var(--streak); }
.stat--xp { color: var(--gold-dark); }
.stat--star { color: var(--primary-dark); }
.goalbar { margin-top: 12px; }
.goalbar__top { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); font-weight: 700; margin-bottom: 4px; }
.bar { height: 12px; background: #efeef5; border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--primary); border-radius: 99px; transition: width .5s cubic-bezier(.2,.8,.2,1); }
.bar--gold > i { background: var(--gold); }

/* ---------- tabbar ---------- */
.tabbar {
  flex: 0 0 auto;
  display: flex;
  background: var(--card);
  border-top: 2px solid var(--line);
  padding-bottom: var(--safe-b);
  z-index: 6;
}
.tab {
  flex: 1; min-height: var(--tab-h);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  background: none; border: 0; border-radius: var(--radius); cursor: pointer;
  color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .053em;
  user-select: none; -webkit-user-select: none;
}
.tab i { font-style: normal; font-size: 24px; line-height: 1; transition: transform .15s ease; }
.tab[aria-current="page"] { color: var(--primary-dark); }
.tab[aria-current="page"] i { transform: scale(1.12); }
.tab:focus-visible { outline: 3px solid var(--blue); outline-offset: -3px; }

/* ---------- onboarding ---------- */
.ob { padding: 24px 20px calc(24px + var(--safe-b)); max-width: 460px; margin: 0 auto; text-align: center; width: 100%; }
.ob__mascot { width: 150px; height: 150px; margin: 8px auto 4px; animation: bob 3s ease-in-out infinite; }
.ob__music { width: auto; min-height: 44px; margin: 0 0 6px auto; padding: 8px 14px; display: flex; align-items: center; gap: 8px; border-radius: 999px; font-size: 13px; font-weight: 800; }
.ob__music svg { width: 19px; height: 19px; }
.ob__mascot svg { width: 100%; height: 100%; }
@keyframes bob { 0%,100% { transform: translateY(0) } 50% { transform: translateY(-8px) } }
.ob h1 { font-size: 30px; }
.ob h2 { font-size: 22px; margin-bottom: 4px; }
.ob p.lead { color: var(--muted); font-size: 16px; margin: 8px 0 24px; }
.field {
  width: 100%; font-size: 18px; font-family: var(--font); font-weight: 700;
  padding: 14px 16px; border: 2px solid var(--line); border-radius: var(--radius);
  background: var(--card); color: var(--ink); text-align: center;
}
.field:focus { outline: none; border-color: var(--primary); }
.ob__note { font-size: 13px; color: var(--muted); margin-top: 12px; font-weight: 700; }

.picker { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin: 16px 0 24px; }
.pick {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  min-height: 96px; padding: 12px;
  background: var(--card); border: 2px solid var(--line); border-bottom-width: 4px; border-radius: var(--radius);
  cursor: pointer; font-weight: 700; font-size: 15px; color: var(--ink);
  transition: transform .08s ease, border-color .15s ease, background .15s ease;
}
.pick svg { width: 54px; height: 54px; }
.pick em { font-style: normal; font-size: 30px; line-height: 1; }
.pick small { display: block; font-size: 12px; color: var(--muted); font-weight: 700; }
.pick[aria-pressed="true"] { border-color: var(--primary); background: var(--primary-wash); color: var(--primary-dark); }
.pick:active { transform: scale(.97); }
.pick:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }

/* ---------- trilha ---------- */
.trail { padding: 16px 16px calc(32px + var(--safe-b)); max-width: 520px; margin: 0 auto; width: 100%; background: var(--bg-soft); flex: 1 0 auto; }
.world { margin-bottom: 24px; }
.world__banner {
  border-radius: var(--radius-card);
  padding: 16px;
  color: #fff;
  display: flex; align-items: center; gap: 12px;
}
.world__banner em { font-style: normal; font-size: 34px; line-height: 1; }
.world__banner h2 { font-size: 19px; }
.world__banner p { font-size: 13px; opacity: .92; font-weight: 700; }
.world__banner b { margin-left: auto; font-size: 13px; background: rgba(255,255,255,.24); padding: 4px 12px; border-radius: 99px; white-space: nowrap; }

.path { position: relative; padding: 48px 0 8px; }
.path__links { position: absolute; inset: 0; pointer-events: none; z-index: 0; }
.link {
  position: absolute; height: 8px; border-radius: 99px;
  background: none; border-top: 4px dashed var(--line);
  transform-origin: 0 50%;
}
.link.link--on { background: none; border-color: #d5cdfb; }

.node { position: relative; z-index: 1; display: flex; justify-content: center; margin-bottom: 20px; }
.node { transform: translateX(calc(var(--k, 0) * min(104px, 21vw))); }
.bubble {
  position: relative;
  width: 84px; height: 76px;
  border: 0; border-radius: 50% / 46%;
  background: var(--primary);
  box-shadow: 0 7px 0 var(--primary-dark);
  color: #fff; font-size: 34px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; user-select: none; -webkit-user-select: none;
  transition: transform .08s ease;
}
.bubble:active { transform: translateY(6px); box-shadow: 0 1px 0 var(--primary-dark); }
.bubble:focus-visible { outline: 3px solid var(--blue); outline-offset: 4px; }
.bubble--done { background: var(--gold); box-shadow: 0 7px 0 var(--gold-dark); }
.bubble--locked { background: #efeef5; box-shadow: 0 7px 0 #dcdae6; color: var(--disabled); }
.bubble--current { animation: pulse 1.9s ease-in-out infinite; }
@keyframes pulse {
  0%, 100% { box-shadow: 0 7px 0 var(--primary-dark), 0 0 0 0 rgba(124, 92, 255, .45); }
  50% { box-shadow: 0 7px 0 var(--primary-dark), 0 0 0 16px rgba(124, 92, 255, 0); }
}
.bubble__stars {
  position: absolute; bottom: -12px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 1px; font-size: 13px;
}
.startpop {
  position: absolute; top: -44px; left: 50%; transform: translateX(-50%);
  background: var(--card); color: var(--primary-dark);
  font-family: var(--font-game); font-size: 13px; font-weight: 400; letter-spacing: .04em;
  padding: 8px 12px; border-radius: var(--radius); border: 2px solid var(--line);
  white-space: nowrap; animation: bobx 2s ease-in-out infinite;
}
/* o keyframe precisa repetir o translateX(-50%), senão a animação o sobrescreve */
@keyframes bobx { 0%, 100% { transform: translate(-50%, 0) } 50% { transform: translate(-50%, -6px) } }
.startpop::after {
  content: ""; position: absolute; bottom: -8px; left: 50%; margin-left: -6px;
  border: 6px solid transparent; border-top-color: var(--card);
}
.soon {
  margin-top: 8px; padding: 24px 16px; text-align: center;
  background: var(--card); border: 2px dashed var(--line); border-radius: var(--radius-card);
}
.soon em { font-style: normal; font-size: 32px; }
.soon h3 { font-size: 17px; margin: 8px 0 4px; }
.soon p { font-size: 14px; color: var(--muted); }
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }

/* ---------- bottom sheet ---------- */
.sheet-back {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(29, 26, 57, .45);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fade .2s ease both;
}
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }
.sheet {
  width: 100%; max-width: 520px;
  background: var(--card);
  border-radius: 16px 16px 0 0;
  padding: 12px 20px calc(24px + var(--safe-b));
  animation: up .26s cubic-bezier(.2,.9,.3,1) both;
  max-height: 88vh; overflow-y: auto;
}
@keyframes up { from { transform: translateY(100%) } to { transform: none } }
.sheet__grab { width: 44px; height: 5px; border-radius: 99px; background: var(--line); margin: 4px auto 16px; }
.sheet__emoji { font-size: 40px; text-align: center; }
.sheet h3 { font-size: 21px; text-align: center; margin: 8px 0; }
.sheet p {
  text-align: center; color: var(--muted); margin-bottom: 16px;
  font-family: var(--font-game); font-weight: 400; font-size: 18px; line-height: 1.35;
}
.sheet p strong { font-weight: 400; color: var(--primary-dark); }
.sheet .stars-row { text-align: center; font-size: 22px; margin-bottom: 8px; }
@media (min-width: 720px) {
  .sheet-back { align-items: center; }
  .sheet { border-radius: var(--radius-card); max-width: 440px; padding-bottom: 24px; }
}

/* ---------- lição ---------- */
.lesson { flex: 1 1 auto; min-height: 0; }
.lesson__top {
  flex: 0 0 auto; display: flex; align-items: center; gap: 12px;
  padding: calc(var(--safe-t) + 8px) 12px 8px;
  background: var(--card); border-bottom: 2px solid var(--line);
}
.lesson__top .bar { flex: 1; }
.lesson__body { flex: 1 1 auto; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.lesson__body > .step { padding: 16px 16px 24px; max-width: 620px; margin: 0 auto; animation: viewIn .22s ease both; }
.lesson__foot {
  flex: 0 0 auto; position: relative;
  padding: 12px 16px calc(12px + var(--safe-b));
  background: var(--card); border-top: 2px solid var(--line);
}
.lesson__foot .row { display: flex; gap: 12px; align-items: center; max-width: 620px; margin: 0 auto; }
.lesson__foot .row .btn { flex: 1; }

.step h2 {
  font-family: var(--font-game); font-weight: 400; letter-spacing: 0;
  font-size: 20px; line-height: 1.35; margin-bottom: 16px; color: var(--ink);
}
.step h2 strong { font-weight: 400; color: var(--primary-dark); }
.step h2 code, .step .prompt code { font-family: var(--mono-game); }
.step .prompt {
  font-family: var(--font-game); font-weight: 400;
  font-size: 19px; line-height: 1.35; margin-bottom: 16px;
}
.step .prompt strong { font-weight: 400; color: var(--primary-dark); }
.step .prompt code, .bubbletext code, .opt code, .fb code, .notice code, .sheet p code {
  background: var(--primary-wash); color: var(--primary-dark);
  border-radius: 6px; padding: 1px 5px; font-family: var(--mono-game); font-size: .95em;
}
pre.code {
  background: var(--deep); color: #e9e6ff;
  border-radius: var(--radius); padding: 12px 14px; margin: 0 0 16px;
  font-family: var(--mono-game); font-size: 15px; line-height: 1.6;
  overflow-x: auto; white-space: pre;
}
pre.code .cmt { color: #9a95c7; }

/* info */
.info-card { display: flex; gap: 12px; align-items: flex-end; margin-bottom: 16px; }
.info-card .mascot { flex: 0 0 auto; width: 86px; }
.info-card .mascot svg { width: 100%; height: auto; }
.bubbletext {
  position: relative; flex: 1;
  background: var(--card); border: 2px solid var(--line); border-radius: var(--radius-card);
  padding: 14px 16px;
  font-family: var(--font-game); font-weight: 400; font-size: 19px; line-height: 1.35;
}
.bubbletext strong { font-weight: 400; color: var(--primary-dark); }
.bubbletext::after {
  content: ""; position: absolute; left: -9px; bottom: 16px;
  border: 8px solid transparent; border-right-color: var(--card);
}
.bubbletext::before {
  content: ""; position: absolute; left: -13px; bottom: 16px;
  border: 8px solid transparent; border-right-color: var(--line);
}

/* choice */
.opts { display: flex; flex-direction: column; gap: 12px; }
.opt {
  display: flex; align-items: center; gap: 12px;
  min-height: 56px; padding: 12px 16px; text-align: left;
  background: var(--card); border: 2px solid var(--line); border-bottom-width: 4px; border-radius: var(--radius);
  font-family: var(--font-game); font-weight: 400; font-size: 19px; line-height: 1.3;
  cursor: pointer; color: var(--ink);
  transition: transform .07s ease, border-color .15s, background .15s;
}
.opt strong { font-weight: 400; color: var(--primary-dark); }
.opt:active { transform: scale(.985); }
.opt[aria-pressed="true"] { border-color: var(--primary); background: var(--primary-wash); color: var(--primary-dark); }
.opt.is-right { border-color: var(--ok); background: var(--ok-wash); color: var(--ok-dark); }
.opt.is-wrong { border-color: var(--danger); background: var(--danger-wash); color: var(--danger-dark); }
.opt:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
.opt__k {
  flex: 0 0 auto; width: 26px; height: 26px; border-radius: 8px; border: 2px solid var(--line);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font); font-size: 13px; font-weight: 700; color: var(--muted);
}

/* order */
.slot-area {
  min-height: 108px; padding: 8px; margin-bottom: 16px;
  border: 2px dashed var(--line); border-radius: var(--radius); background: var(--card);
  display: flex; flex-direction: column; gap: 8px;
}
.slot-area:empty::after {
  content: "Toque nas linhas abaixo para montar o programa";
  color: var(--muted); font-size: 14px; font-weight: 700; padding: 16px 8px; text-align: center;
}
.bank { display: flex; flex-direction: column; gap: 8px; }
.line-chip {
  display: block; width: 100%; text-align: left;
  min-height: 46px; padding: 12px;
  background: var(--card); border: 2px solid var(--line); border-bottom-width: 4px; border-radius: var(--radius);
  font-family: var(--mono-game); font-size: 15px; white-space: pre; overflow-x: auto;
  cursor: pointer; color: var(--ink); transition: transform .07s ease;
}
.line-chip:active { transform: scale(.985); }
.line-chip:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
.slot-area .line-chip { background: var(--primary-wash); border-color: #d5cdfb; color: var(--primary-dark); }

/* fill */
.fill-code {
  background: var(--deep); color: #e9e6ff; border-radius: var(--radius);
  padding: 16px; margin-bottom: 16px; font-family: var(--mono-game);
  font-size: 16px; line-height: 2.1; white-space: pre-wrap; word-break: break-word;
}
.blank {
  display: inline-block; min-width: 72px; min-height: 36px; padding: 2px 10px;
  margin: 0 2px; vertical-align: middle; text-align: center;
  background: #332f57; border: 2px dashed #6f69a5; border-radius: 8px;
  color: #e9e6ff; font-family: var(--mono-game); font-size: 16px; cursor: pointer;
}
.blank.is-filled { background: var(--primary); border: 2px solid var(--primary-dark); color: #fff; }
.blank:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.chips { display: flex; flex-wrap: wrap; gap: 12px; }
.chip {
  min-height: 46px; padding: 12px 16px;
  background: var(--card); border: 2px solid var(--line); border-bottom-width: 4px; border-radius: var(--radius);
  font-family: var(--mono-game); font-size: 16px; color: var(--ink); cursor: pointer;
}
.chip:active { transform: scale(.96); }
.chip:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }

/* maze / code */
.play-head { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 12px; }
.play-head .prompt { margin: 0; flex: 1; }
.play-grid { display: grid; gap: 12px; grid-template-columns: 1fr; align-items: start; }
@media (min-width: 900px) {
  /* O tabuleiro fica acima do código também no laptop: não encolher a missão. */
  .lesson__body > .step.step--play { max-width: 1120px; }
  .step--play .mz-grid {
    max-width: min(100%, calc(var(--mz-cols, 7) * 112px), calc(68vh * var(--mz-cols, 7) / var(--mz-rows, 6)));
  }
}
/* .maze-box / .ed-box são só contêineres: BebelaMazeView e BebelaEditor (play.css)
   trazem o próprio fundo, borda e cantos. */
.maze-box, .ed-box, .play-grid > * { min-width: 0; }
.maze-description {
  max-width: 100%; margin-top: 12px; padding: 10px 14px;
  border: 2px solid var(--line); border-radius: var(--radius);
  background: var(--card); color: var(--ink);
}
.maze-description summary { cursor: pointer; font-weight: 700; }
.maze-description summary:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }
.maze-text-map {
  max-height: 260px; overflow: auto; margin: 12px 0 0;
  white-space: pre-wrap; overflow-wrap: anywhere;
  font: 14px/1.6 var(--font); color: var(--ink);
}
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 12px 0; }
.toolbar .btn { flex: 0 0 auto; }
.speed {
  min-height: 44px; padding: 8px 12px; border-radius: var(--radius);
  border: 2px solid var(--line); border-bottom-width: 4px; background: var(--card);
  font-weight: 700; font-size: 14px; cursor: pointer; color: var(--muted);
}
.speed[aria-pressed="true"] { border-color: var(--primary); color: var(--primary-dark); background: var(--primary-wash); }
.variant-tag {
  display: inline-block; font-size: 13px; font-weight: 700; color: var(--primary-dark);
  background: var(--primary-wash); border-radius: 99px; padding: 4px 12px; margin-bottom: 8px;
}
.console {
  background: var(--deep); color: #e9e6ff; border-radius: var(--radius); padding: 12px; margin-top: 12px;
  font-family: var(--mono-game); font-size: 15px; white-space: pre-wrap; word-break: break-word;
  max-height: 180px; overflow-y: auto;
}
.console b {
  display: block; color: #9a95c7; font-family: var(--font); font-size: 11px;
  text-transform: uppercase; letter-spacing: .053em; margin-bottom: 4px;
}
.diff { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.diff > div {
  background: var(--deep); border-radius: var(--radius); padding: 12px;
  font-family: var(--mono-game); font-size: 14px; color: #e9e6ff; white-space: pre-wrap;
}
.diff b { display: block; font-family: var(--font); font-size: 11px; text-transform: uppercase; letter-spacing: .053em; margin-bottom: 4px; }
.diff .want b { color: #8ee0b6; }
.diff .got b { color: #ffb3bd; }

.notice {
  margin-top: 12px; padding: 12px 16px; border-radius: var(--radius);
  border: 2px solid var(--line); background: var(--card);
  font-family: var(--font-game); font-weight: 400; font-size: 18px; line-height: 1.35;
}
.notice b { display: block; font-weight: 400; margin-bottom: 4px; }
.notice strong { font-weight: 400; }
.notice--bad { border-color: var(--danger); background: var(--danger-wash); color: var(--danger-dark); }
.notice--good { border-color: var(--ok); background: var(--ok-wash); color: var(--ok-dark); }
.notice--hint { border-color: var(--gold); background: var(--gold-wash); color: #8a5c00; }
.badge-lean {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 12px;
  background: var(--gold); color: var(--deep); font-weight: 700; font-size: 14px;
  padding: 8px 16px; border-radius: 99px;
  animation: pop .4s cubic-bezier(.2,1.4,.4,1) both;
}
@keyframes pop { from { transform: scale(.5); opacity: 0 } to { transform: scale(1); opacity: 1 } }

/* feedback */
.fb {
  position: absolute; left: 0; right: 0; bottom: 100%;
  padding: 16px;
  background: var(--ok-wash); border-top: 2px solid var(--ok);
  transform: translateY(100%); opacity: 0; pointer-events: none;
  transition: transform .25s cubic-bezier(.2,.9,.3,1), opacity .2s ease;
}
.fb.is-open { transform: translateY(0); opacity: 1; pointer-events: auto; }
.fb__in { max-width: 620px; margin: 0 auto; display: flex; gap: 12px; align-items: flex-start; }
.fb__ico { font-size: 26px; line-height: 1.1; }
.fb strong {
  display: block; font-family: var(--font-game); font-weight: 400;
  font-size: 20px; line-height: 1.3; color: var(--ok-dark);
}
.fb span { font-family: var(--font-game); font-weight: 400; font-size: 18px; line-height: 1.35; color: var(--ok-dark); }
.fb span strong { display: inline; font-size: inherit; }
.fb--bad { background: var(--danger-wash); border-top-color: var(--danger); }
.fb--bad strong, .fb--bad span { color: var(--danger-dark); }

/* ---------- fim de lição ---------- */
.done { text-align: center; padding: 32px 20px calc(32px + var(--safe-b)); max-width: 460px; margin: 0 auto; width: 100%; }
.done__mascot { width: 160px; margin: 0 auto 8px; animation: bob 2.4s ease-in-out infinite; }
.done__mascot svg { width: 100%; height: auto; }
.done h1 {
  font-family: var(--font-game); font-weight: 400; letter-spacing: 0;
  font-size: 26px; line-height: 1.3; color: var(--primary-dark);
}
.done .stars-row { font-size: 44px; letter-spacing: 6px; margin: 12px 0 4px; }
.done .stars-row em { font-style: normal; display: inline-block; animation: pop .5s cubic-bezier(.2,1.4,.4,1) both; }
.done .stars-row em:nth-child(2) { animation-delay: .15s }
.done .stars-row em:nth-child(3) { animation-delay: .3s }
.done > p.muted { font-family: var(--font-game); font-weight: 400; font-size: 18px; line-height: 1.35; }
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 24px 0; }
.tile { background: var(--card); border: 2px solid var(--line); border-bottom-width: 4px; border-radius: var(--radius); padding: 12px 4px; }
.tile b { display: block; font-size: 22px; font-weight: 800; letter-spacing: -.02em; }
.tile small { font-size: 11px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .053em; }
.tile--xp b { color: var(--gold-dark); }
.tile--streak b { color: var(--streak); }
.tile--star b { color: var(--primary-dark); }
.done .newbadge { margin: 0 0 16px; }

#fx-root { position: fixed; inset: 0; pointer-events: none; z-index: 60; overflow: hidden; }
.confetti { position: absolute; width: 10px; height: 14px; border-radius: 2px; will-change: transform; }

/* ---------- ateliê ---------- */
.seg { display: flex; gap: 4px; background: #f2f1f8; padding: 4px; border-radius: var(--radius); margin-bottom: 16px; }
.seg button {
  flex: 1; min-height: 44px; border: 0; background: none; border-radius: 8px;
  font-weight: 700; font-size: 15px; color: var(--muted); cursor: pointer;
}
.seg button[aria-selected="true"] { background: var(--card); color: var(--primary-dark); }
.hero-row { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 8px; margin-bottom: 12px; }
.hero-row .pick { flex: 0 0 96px; min-height: 84px; font-size: 13px; }
.hero-row .pick svg { width: 40px; height: 40px; }

/* ---------- perfil ---------- */
.profile { padding: 20px 16px calc(32px + var(--safe-b)); max-width: 560px; margin: 0 auto; width: 100%; }
.profile__head { text-align: center; margin-bottom: 24px; }
.profile__av { width: 110px; margin: 0 auto; }
.profile__av svg { width: 100%; height: auto; }
.profile__head h1 { font-size: 25px; }
.profile__head p { color: var(--muted); font-size: 14px; font-weight: 700; }
.sec-title { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .053em; color: var(--muted); margin: 24px 0 8px; }
.grid2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.stat-card { background: var(--card); border: 2px solid var(--line); border-bottom-width: 4px; border-radius: var(--radius); padding: 12px 16px; display: flex; align-items: center; gap: 12px; }
.stat-card em { font-style: normal; font-size: 26px; }
.stat-card b { display: block; font-size: 19px; font-weight: 800; letter-spacing: -.02em; }
.stat-card small { font-size: 12px; color: var(--muted); font-weight: 700; }
.ach { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 12px; }
.ach__it {
  background: var(--card); border: 2px solid var(--line); border-bottom-width: 4px; border-radius: var(--radius);
  padding: 12px 4px; text-align: center; font-size: 12px; font-weight: 700; color: var(--muted);
}
.ach__it em { font-style: normal; display: block; font-size: 30px; filter: grayscale(1); opacity: .35; margin-bottom: 4px; }
.ach__it.is-on { border-color: var(--gold); background: var(--gold-wash); color: #8a5c00; }
.ach__it.is-on em { filter: none; opacity: 1; }
.rows { background: var(--card); border: 2px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.row-item {
  display: flex; align-items: center; gap: 12px; width: 100%;
  min-height: 56px; padding: 12px 16px; background: none; border: 0;
  border-bottom: 2px solid var(--line); font-size: 16px; font-weight: 700; text-align: left; cursor: pointer;
}
.row-item:last-child { border-bottom: 0; }
.row-item em { font-style: normal; font-size: 22px; }
.row-item .right { margin-left: auto; color: var(--muted); font-size: 14px; font-weight: 700; }
.row-item.is-danger { color: var(--danger-dark); }
.switch { margin-left: auto; width: 52px; height: 30px; border-radius: 99px; background: #dcdae6; position: relative; transition: background .2s; flex: 0 0 auto; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform .2s; }
[aria-checked="true"] .switch { background: var(--primary); }
[aria-checked="true"] .switch::after { transform: translateX(22px); }

/* ---------- utilidades ---------- */
.spacer { height: 12px; }
.center { text-align: center; }
.muted { color: var(--muted); font-size: 14px; font-weight: 700; }
.warnbox {
  margin: 16px; padding: 16px; border-radius: var(--radius);
  background: var(--gold-wash); border: 2px solid var(--gold); color: #8a5c00;
  font-size: 14px; font-weight: 700;
}

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

/* =============================================================================
   Bebela Code — visual refresh
   Missão: deixar o app com cara de "mesa de jogo de lógica": contraste firme,
   cartões úteis e trilha que comunica avanço. Este bloco só sobrescreve
   apresentação; os seletores, IDs e a estrutura que o JavaScript usa continuam
   exatamente os mesmos.
   ========================================================================== */

:root {
  --bg: #f7f6fc;
  --bg-soft: #efedf8;
  --card: #ffffff;
  --line: #d8d3e7;
  --disabled: #9891aa;
  --ink: #27233f;
  --muted: #6c6680;
  --deep: #27233f;
  --primary: #7c5cff;
  --primary-dark: #5338c9;
  --primary-wash: #eeeaff;
  --blue: #12b5a6;
  --blue-dark: #087f75;
  --blue-wash: #dff7f3;
  --ok: #25ad78;
  --ok-dark: #14734d;
  --ok-wash: #dcf6e9;
  --danger: #ec5f70;
  --danger-dark: #ba354c;
  --danger-wash: #ffe6ea;
  --gold: #f7b23b;
  --gold-dark: #b87408;
  --gold-wash: #fff2d9;
  --streak: #e9783d;
  --radius: 12px;
  --radius-card: 12px;
  --tab-h: 68px;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-size: 16px;
  font-weight: 600;
}

.wrap { max-width: 640px; padding: 20px 16px; }

/* Controles com relevo mecânico — a principal assinatura tátil do app. */
.btn {
  min-height: 52px;
  border: 2px solid var(--primary-dark);
  border-bottom-width: 5px;
  border-radius: var(--radius);
  box-shadow: none;
  letter-spacing: .045em;
}
.btn:active:not(:disabled) { transform: translateY(3px); border-bottom-width: 2px; box-shadow: none; }
.btn--blue { border-color: var(--blue-dark); box-shadow: none; }
.btn--blue:active:not(:disabled) { box-shadow: none; }
.btn--ok { border-color: var(--ok-dark); box-shadow: none; }
.btn--ok:active:not(:disabled) { box-shadow: none; }
.btn--danger { border-color: var(--danger-dark); box-shadow: none; }
.btn--danger:active:not(:disabled) { box-shadow: none; }
.btn--gold { border-color: var(--gold-dark); box-shadow: none; }
.btn--gold:active:not(:disabled) { box-shadow: none; }
.btn--ghost { border-color: var(--line); border-bottom-width: 5px; box-shadow: none; }
.btn--ghost:active:not(:disabled) { border-bottom-width: 2px; box-shadow: none; }
.btn:disabled { border-color: #dedbe8; border-bottom-width: 5px; box-shadow: none; }

.topbar {
  padding: calc(var(--safe-t) + 12px) 16px 10px;
  background: var(--card);
  border-bottom: 2px solid var(--line);
}
.stat { min-height: 36px; padding: 5px 8px; border: 2px solid transparent; }
.stat--streak { background: #fff0e7; border-color: #ffd5c2; }
.stat--xp { background: var(--gold-wash); border-color: #f7deb1; }
.stat--star { background: var(--primary-wash); border-color: #d9cffd; }
.bar { height: 10px; border-radius: 6px; background: #dfdbe9; }
.bar > i { border-radius: 4px; }

.tabbar { border-top: 2px solid var(--line); background: var(--card); }
.tab { position: relative; min-height: var(--tab-h); font-size: 11px; letter-spacing: .06em; }
.tab[aria-current="page"]::before {
  content: ""; position: absolute; top: 0; width: 36px; height: 4px;
  background: var(--blue); border-radius: 0 0 4px 4px;
}

/* Trilha: o mapa deixa de ser uma coluna vazia; banners e nós formam uma
   sequência física, como casas de um jogo de tabuleiro. */
.trail { max-width: 640px; padding: 20px 16px calc(40px + var(--safe-b)); background: var(--bg-soft); }
.world { margin-bottom: 32px; }
.world__banner {
  min-height: 94px; aspect-ratio: 4 / 1; padding: 16px; border: 2px solid rgba(39,35,63,.18);
  border-bottom-width: 5px; border-radius: var(--radius-card);
}
.world__banner em { font-size: 38px; }
.world__banner h2 { font-size: 21px; letter-spacing: -.03em; }
.world__banner p { margin-top: 2px; font-size: 13px; }
.world__banner b { padding: 6px 10px; border: 2px solid rgba(255,255,255,.34); border-radius: 8px; }
.path { padding: 58px 0 10px; }
.link { height: 0; background: none; border-top: 4px dashed var(--line); border-radius: 0; }
.link.link--on { background: none; border-color: #b9acf5; }
.node { margin-bottom: 28px; }
.bubble {
  width: 94px; height: 82px; border: 2px solid var(--primary-dark); border-bottom-width: 6px;
  border-radius: 22px; box-shadow: none; font-size: 30px;
}
.bubble:active { transform: translateY(4px); border-bottom-width: 2px; box-shadow: none; }
.bubble--done { background: var(--blue); border-color: var(--blue-dark); box-shadow: none; }
.bubble--locked { background: #e7e3ef; color: #958ea6; border-color: #ccc5da; box-shadow: none; }
.bubble--current { background: var(--primary); animation: pulse 1.9s ease-in-out infinite; }
@keyframes pulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(124,92,255,.28); }
  55% { box-shadow: 0 0 0 12px rgba(124,92,255,0); }
}
.bubble__stars { bottom: -16px; font-size: 12px; letter-spacing: 1px; }
.startpop { top: -50px; border: 2px solid var(--primary-dark); border-bottom-width: 4px; border-radius: 8px; color: var(--primary-dark); }

/* Lição: leitura prioritária, respostas táteis e feedback sem poluição. */
.lesson__top { padding: calc(var(--safe-t) + 10px) 14px 10px; border-bottom: 2px solid var(--line); }
.lesson__body > .step { max-width: 680px; padding: 24px 16px 32px; }
.lesson__foot { border-top: 2px solid var(--line); padding: 12px 16px calc(14px + var(--safe-b)); }
.step h2 { font-size: 22px; line-height: 1.4; margin-bottom: 20px; }
.step .prompt { font-size: 20px; line-height: 1.42; margin-bottom: 20px; }
pre.code { border: 2px solid #171427; border-bottom-width: 5px; border-radius: var(--radius); padding: 14px 16px; }
.info-card { align-items: center; gap: 14px; }
.info-card .mascot { width: 96px; }
.bubbletext { border: 2px solid var(--line); border-bottom-width: 4px; border-radius: var(--radius); padding: 14px 16px; }
.opt { min-height: 60px; border-color: var(--line); border-bottom-width: 5px; border-radius: var(--radius); padding: 13px 16px; }
.opt:active { transform: translateY(3px); border-bottom-width: 2px; }
.opt[aria-pressed="true"] { border-color: var(--primary-dark); background: var(--primary-wash); }
.slot-area { border: 2px dashed #bdb5cf; border-radius: var(--radius); background: #fbfaff; }
.line-chip { border-bottom-width: 5px; border-radius: var(--radius); }
.line-chip:active { transform: translateY(3px); border-bottom-width: 2px; }
.notice, .warnbox { border-bottom-width: 4px; border-radius: var(--radius); }
.fb { border-top-width: 2px; }

.seg { border: 2px solid var(--line); padding: 3px; background: #e9e6f2; border-radius: var(--radius); }
.seg button[aria-selected="true"] { border: 2px solid var(--primary-dark); background: var(--card); }
.profile { max-width: 640px; padding: 28px 16px calc(40px + var(--safe-b)); }
.profile__head { padding: 20px 16px; margin: 0 -16px 22px; background: var(--primary-wash); border-bottom: 2px solid #d5cafa; }
.profile__av { width: 118px; }
.stat-card, .ach__it, .tile { border-bottom-width: 5px; border-radius: var(--radius); }
.rows { border-radius: var(--radius); }

@media (min-width: 720px) {
  .wrap, .trail, .profile { max-width: 700px; }
  .trail { padding-top: 28px; }
  .path { padding-left: 36px; padding-right: 36px; }
  .lesson__body > .step { padding-left: 28px; padding-right: 28px; }
}

/* =============================================================================
   Bebela Code — trilha de missões
   Ritmo de aprendizagem curto + apresentação editorial de produto.
   ========================================================================== */

:root {
  --navy: #111b3a;
  --navy-2: #17254d;
  --paper: #f5f7fb;
  --cyan: #12b5d0;
  --cyan-dark: #087f98;
  --cyan-wash: #e5f8fb;
}

body { background: var(--paper); }
.bb-sprite { display: block; width: 100%; height: 100%; object-fit: contain; }
.ui-icon { display: block; width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.ui-icon-wrap { display: inline-flex; width: 22px; height: 22px; flex: 0 0 auto; }
.inline-icon { display: inline-flex; width: 18px; height: 18px; margin-right: 7px; vertical-align: -3px; }
.eyebrow { color: var(--primary-dark); font-size: 12px; line-height: 1.2; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }

/* Cabeçalho compacto: progresso visível sem disputar espaço com a lição. */
.topbar { padding: calc(var(--safe-t) + 10px) 16px 10px; background: #fff; }
.topbar__inner { width: 100%; max-width: 980px; margin: 0 auto; }
.topbar__main { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: inline-flex; align-items: center; gap: 7px; color: var(--navy); font-size: 14px; letter-spacing: .1em; white-space: nowrap; }
.brand__mark { display: inline-flex; width: 28px; height: 28px; padding: 5px; border-radius: 8px; background: var(--navy); color: #fff; }
.brand strong { font-size: 15px; }
.brand span { color: var(--cyan-dark); font-weight: 800; }
.stats { justify-content: flex-end; gap: 6px; }
.stat { min-height: 36px; border-color: var(--line); background: #fff; color: var(--navy); }
.stat .ui-icon-wrap { width: 18px; height: 18px; color: var(--primary); }
.stat small { color: var(--muted); font-size: 10px; font-weight: 800; text-transform: uppercase; }
.stat--streak, .stat--xp, .stat--star { background: #fff; border-color: var(--line); color: var(--navy); }
.stat--streak .ui-icon-wrap { color: var(--streak); }
.stat--xp .ui-icon-wrap { color: var(--gold-dark); }
.goalbar { margin-top: 9px; }
.goalbar__top { font-size: 11px; }

/* Navegação por ícones vetoriais, sem emojis do sistema. */
.tab__icon { display: inline-flex; width: 24px; height: 24px; }
.tab span { line-height: 1; }

/* Abertura de missão: composição espacial simples, sem gradiente ou vidro. */
.trail { max-width: 980px; padding: 18px 16px calc(40px + var(--safe-b)); background: transparent; }
.home-intro {
  position: relative; min-height: 164px; overflow: hidden;
  display: grid; grid-template-columns: minmax(0, 1fr) 126px; align-items: center; gap: 10px;
  padding: 24px; border: 2px solid #22325d; border-bottom-width: 5px; border-radius: var(--radius);
  background: var(--navy); color: #fff;
}
.home-intro::before, .home-intro::after { content: ""; position: absolute; border-radius: 50%; pointer-events: none; }
.home-intro::before { width: 180px; height: 180px; right: 26px; top: 58px; border: 2px solid rgba(18,181,208,.28); }
.home-intro::after { width: 5px; height: 5px; left: 56%; top: 28px; background: #fff; box-shadow: 54px 34px 0 #12b5d0, 108px 2px 0 #fff, 188px 46px 0 #7c5cff; }
.home-intro__copy { position: relative; z-index: 1; }
.home-intro .eyebrow { color: #73d8e7; margin-bottom: 7px; }
.home-intro h1 { max-width: 650px; color: #fff; font-size: clamp(26px, 5vw, 42px); line-height: 1.02; letter-spacing: -.045em; }
.home-intro__lead { margin-top: 8px; color: #c8d3ef; font-size: 15px; }
.home-intro__mascot { position: relative; z-index: 1; width: 126px; height: 126px; object-fit: contain; }

.resume-card { margin-top: 14px; padding: 18px; border: 2px solid #d8ddea; border-bottom-width: 5px; border-radius: var(--radius); background: #fff; }
.resume-card__top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.resume-card__course { color: var(--primary-dark); font-size: 13px; font-weight: 800; }
.resume-card__time { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; font-weight: 800; }
.resume-card__time .ui-icon-wrap { width: 17px; height: 17px; }
.resume-card__body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(220px, .68fr); gap: 18px; align-items: stretch; }
.resume-card__copy h2 { margin-top: 5px; color: var(--navy); font-size: clamp(22px, 3.7vw, 31px); line-height: 1.12; }
.resume-card__copy > p:last-child { max-width: 600px; margin-top: 7px; color: var(--muted); font-size: 14px; }
.resume-card__code { display: flex; flex-direction: column; justify-content: center; gap: 5px; min-height: 106px; padding: 15px; border: 2px solid #22325d; border-bottom-width: 4px; border-radius: var(--radius); background: #101a34; color: #8ce6cf; font: 13px/1.35 var(--mono); }
.resume-card__code span:first-child { color: #75d9f2; }
.resume-card__cta { width: 100%; margin-top: 16px; background: var(--cyan); border-color: var(--cyan-dark); }
.resume-card__cta .ui-icon-wrap { width: 20px; height: 20px; }

.trail-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 34px 2px 14px; }
.trail-heading h2 { margin-top: 3px; color: var(--navy); font-size: 25px; }
.trail-heading > span { padding: 7px 10px; border: 2px solid var(--line); border-radius: 9px; background: #fff; color: var(--muted); font-size: 12px; font-weight: 800; white-space: nowrap; }

.world { margin-bottom: 26px; }
.world__banner {
  position: relative;
  display: grid; grid-template-columns: 72px minmax(0, 1fr) auto; align-items: center; gap: 14px;
  min-height: 106px; padding: 14px 18px; overflow: hidden;
  border-color: #22325d; background: var(--navy); color: #fff;
}
.world__banner::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 7px; background: var(--world-accent); }
.world__mascot { width: 72px; height: 72px; object-fit: contain; }
.world__copy > span { color: #7edbe8; font-size: 10px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.world__banner .world__copy h2 { color: #fff; font-size: 21px; }
.world__banner .world__copy p { color: #bcc8e5; font-size: 13px; }
.world__progress { min-width: 68px; padding: 8px 9px; border: 2px solid #34466f; border-radius: 9px; text-align: center; background: #19274d; }
.world__progress b, .world__progress small { display: block; }
.world__progress b { margin: 0; padding: 0; border: 0; border-radius: 0; background: transparent; color: #fff; font-size: 16px; }
.world__progress small { margin-top: 1px; color: #9daccc; font-size: 9px; text-transform: uppercase; letter-spacing: .08em; }

/* Cartões substituem os círculos: título e propósito continuam legíveis bloqueados. */
.path { display: grid; gap: 10px; padding: 12px 0 0; }
.node { width: 100%; margin: 0; transform: none !important; }
.bubble {
  position: relative; width: 100%; height: auto; min-height: 98px;
  display: grid; grid-template-columns: 54px minmax(0, 1fr) 58px; align-items: center; gap: 14px;
  padding: 14px 16px; overflow: visible; text-align: left;
  border-radius: var(--radius); border: 2px solid #d8ddea; border-bottom-width: 5px;
  background: #fff; color: var(--navy); font-size: 16px;
}
.bubble:active { transform: translateY(3px); border-bottom-width: 2px; }
.mission-index { display: inline-flex; align-items: center; justify-content: center; width: 52px; height: 52px; border: 2px solid #d7dcea; border-radius: 12px; background: #f5f6fa; color: var(--navy); font: 800 17px/1 var(--mono); }
.mission-copy { min-width: 0; }
.mission-copy strong { display: block; color: inherit; font-size: 17px; line-height: 1.18; }
.mission-copy small { display: block; max-width: 620px; margin-top: 5px; color: var(--muted); font-size: 13px; font-weight: 600; line-height: 1.3; }
.mission-state { justify-self: end; display: flex; flex-direction: column; align-items: center; gap: 3px; color: var(--muted); }
.mission-state .ui-icon-wrap { width: 26px; height: 26px; }
.mission-state small { font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.bubble--current { border-color: var(--cyan); background: var(--cyan-wash); animation: none; }
.bubble--current .mission-index { border-color: var(--cyan); background: var(--cyan); color: #fff; }
.bubble--current .mission-state { color: var(--cyan-dark); }
.bubble--done { border-color: #b7e1d7; background: #f5fbf9; color: var(--navy); }
.bubble--done .mission-index { border-color: var(--blue); background: var(--blue); color: #fff; }
.bubble--done .mission-state { color: var(--blue-dark); }
.bubble--locked { border-color: #e0e2ea; background: #f4f5f8; color: #747b91; }
.bubble--locked .mission-index { color: #858ba0; }
.startpop { top: -11px; right: 14px; left: auto; transform: none; padding: 5px 8px; border-color: var(--cyan-dark); background: var(--cyan); color: #072b35; font-size: 9px; }
.startpop::after { display: none; }
.path__links, .link, .bubble__stars { display: none; }
.soon { display: flex; align-items: center; gap: 14px; padding: 18px; border: 2px dashed #c8ccda; border-radius: var(--radius); color: var(--muted); text-align: left; }
.soon__icon { display: inline-flex; width: 42px; height: 42px; padding: 9px; border-radius: 10px; background: var(--primary-wash); color: var(--primary-dark); }
.soon h3 { color: var(--navy); font-size: 16px; }
.soon p { margin-top: 3px; font-size: 13px; }

/* Componentes atualizados para os sprites e ícones próprios. */
.ob__mascot .bb-sprite, .profile__av .bb-sprite, .done__mascot .bb-sprite, .info-card .mascot .bb-sprite, .sheet__mascot .bb-sprite { object-fit: contain; }
.pick > span { display: block; width: 58px; height: 58px; }
.picker .bb-sprite, .picker .bb-mascot-frame { width: 58px; height: 58px; }
.pick__icon { display: inline-flex; width: 28px; height: 28px; color: var(--primary); }
.sheet__mascot { width: 112px; height: 112px; margin: 0 auto 5px; }
.sheet__icon { display: flex; width: 58px; height: 58px; margin: 4px auto 10px; padding: 13px; border-radius: 12px; background: var(--primary-wash); color: var(--primary-dark); }
.fb__ico { display: flex; width: 32px; height: 32px; color: var(--ok-dark); }
.fb--bad .fb__ico { color: var(--danger-dark); }
.stars-row { display: flex; justify-content: center; gap: 8px; }
.result-star { display: inline-flex; width: 40px; height: 40px; color: #cfd2dc; }
.result-star.is-on { color: var(--gold-dark); fill: var(--gold); }
.tile { display: grid; grid-template-columns: 26px 1fr; align-items: center; column-gap: 5px; }
.tile__icon { grid-row: 1 / 3; display: inline-flex; width: 25px; height: 25px; }
.tile--streak .tile__icon { color: var(--streak); }
.tile--star .tile__icon { color: var(--gold-dark); }
.stat-card__icon { display: inline-flex; width: 28px; height: 28px; color: var(--primary-dark); }
.ach__icon { display: flex; width: 30px; height: 30px; margin: 0 auto 7px; color: #a7aabd; }
.ach__it.is-on .ach__icon { color: var(--gold-dark); }
.row-item__icon { display: inline-flex; width: 23px; height: 23px; color: var(--primary-dark); }
.row-item.is-danger .row-item__icon { color: var(--danger-dark); }

/* Celular estreito: nenhuma informação crítica depende de miniaturas ou hover. */
@media (max-width: 520px) {
  .brand span, .stat small { display: none; }
  .brand { gap: 5px; }
  .brand__mark { width: 26px; height: 26px; }
  .stats { gap: 4px; }
  .stat { padding: 4px 6px; font-size: 14px; }
  .goalbar { margin-top: 7px; }
  .trail { padding-left: 12px; padding-right: 12px; }
  .home-intro { min-height: 150px; grid-template-columns: minmax(0, 1fr) 94px; padding: 19px 16px; }
  .home-intro h1 { font-size: 27px; }
  .home-intro__lead { font-size: 13px; }
  .home-intro__mascot { width: 94px; height: 94px; }
  .resume-card { padding: 15px; }
  .resume-card__body { grid-template-columns: 1fr; }
  .resume-card__code { display: none; }
  .trail-heading { align-items: flex-start; margin-top: 28px; }
  .trail-heading h2 { font-size: 21px; }
  .trail-heading > span { font-size: 10px; }
  .world__banner { grid-template-columns: 58px minmax(0, 1fr) auto; gap: 10px; min-height: 94px; padding: 12px 12px 12px 15px; }
  .world__mascot { width: 58px; height: 58px; }
  .world__banner .world__copy h2 { font-size: 18px; }
  .world__banner .world__copy p { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .world__progress { min-width: 54px; padding: 6px; }
  .bubble { grid-template-columns: 46px minmax(0, 1fr) 42px; min-height: 90px; gap: 10px; padding: 12px; }
  .mission-index { width: 44px; height: 44px; font-size: 15px; }
  .mission-copy strong { font-size: 15px; }
  .mission-copy small { display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 2; font-size: 12px; }
  .mission-state small { display: none; }
  .startpop { right: 9px; }
  .grid2 { gap: 8px; }
  .stat-card { padding: 11px; gap: 8px; }
  .stat-card small { font-size: 10px; }
  .info-card { display: block; }
  .info-card .mascot { width: 94px; height: 94px; margin: 0 auto 12px; }
  .bubbletext { width: 100%; font-size: 17px; line-height: 1.45; }
}

/* Desktop: mesma experiência, com navegação lateral inspirada no painel NEXO. */
@media (min-width: 1080px) {
  #app:has(> .tabbar:not([hidden])) { padding-left: 212px; }
  .tabbar:not([hidden]) {
    position: fixed; inset: 0 auto 0 0; width: 212px; height: 100%;
    display: flex; flex-direction: column; justify-content: flex-start; gap: 8px;
    padding: 92px 14px 18px; border: 0; border-right: 2px solid #22325d;
    background: var(--navy); color: #fff;
  }
  .tab { flex: 0 0 auto; min-height: 54px; flex-direction: row; justify-content: flex-start; gap: 13px; padding: 0 15px; border-radius: 10px; color: #aebbd8; font-size: 13px; }
  .tab[aria-current="page"] { background: #20345f; color: #fff; }
  .tab[aria-current="page"]::before { top: 12px; left: 0; width: 4px; height: 30px; border-radius: 0 4px 4px 0; background: var(--cyan); }
  .tab__icon { width: 22px; height: 22px; }
  .trail { padding-top: 24px; }
  .home-intro { min-height: 184px; grid-template-columns: minmax(0, 1fr) 170px; padding: 30px; }
  .home-intro__mascot { width: 160px; height: 160px; }
  .resume-card { padding: 22px; }
  .path { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bubble { min-height: 112px; }
  .profile { max-width: 820px; }
}

/* -------------------------------------------------------------------------
   CENÁRIOS E MISSÕES ILUSTRADAS
   A interface continua limpa; profundidade e narrativa ficam concentradas
   nos fundos e nas miniaturas das missões.
   ------------------------------------------------------------------------- */
.home-intro {
  background-color: var(--navy);
  background-image: none;
  background-size: cover;
  background-position: center;
}
.home-intro::before, .home-intro::after { z-index: 0; }
.home-intro__mascot { filter: drop-shadow(0 8px 0 rgba(7, 15, 39, .22)); }

.resume-card__code {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  background-color: #101a34;
  background-image: none;
  background-size: cover, cover;
  background-position: center, center;
}
.resume-card__code::before { content: "MISSÃO EM DESTAQUE"; position: absolute; right: 12px; bottom: 10px; color: #d9faff; font: 800 9px/1 var(--font); letter-spacing: .1em; }
.resume-card__code span { position: relative; z-index: 1; }

.world__banner {
  background-color: var(--navy);
  background-image: none;
  background-size: cover;
  background-position: center;
}
.world__banner > * { position: relative; z-index: 1; }
.world__banner::before { z-index: 2; }

.bubble { grid-template-columns: 54px 74px minmax(0, 1fr) 58px; }
.mission-art {
  display: block;
  width: 74px;
  height: 74px;
  border: 2px solid #25375f;
  border-radius: 12px;
  background-color: #162348;
  background-repeat: no-repeat;
  background-size: 300% 300%;
  box-shadow: 0 3px 0 #ccd4e8;
}
.bubble--current .mission-art { border-color: var(--cyan-dark); box-shadow-color: #94dce6; }
.bubble--done .mission-art { border-color: var(--blue-dark); }
.bubble--locked .mission-art { filter: grayscale(1) opacity(.42); }

.lesson__world-art {
  flex: 0 0 76px;
  position: relative;
  overflow: hidden;
  border-bottom: 2px solid #23355e;
  background-color: var(--navy);
  background-image: none;
  background-size: cover;
  background-position: center;
}
.lesson__world-art::after { content: ""; position: absolute; inset: 0; border-bottom: 5px solid var(--blue); }

@media (max-width: 520px) {
  .bubble { grid-template-columns: 44px 58px minmax(0, 1fr) 42px; gap: 8px; }
  .mission-art { width: 58px; height: 58px; border-radius: 10px; }
  .lesson__world-art { flex-basis: 58px; }
}

/* Série de aventuras: capa, capítulo e missão compartilham a mesma linguagem.
   As imagens são atribuídas aqui para substituir os gradientes inline legados. */
:root {
  --paper: #f6f4ff;
  --bg: #f6f4ff;
  --bg-soft: #eeeaff;
  --navy: #201b3f;
  --navy-2: #30265c;
  --cyan: #12b5a6;
  --cyan-dark: #087f75;
  --cyan-wash: #dff7f3;
  --line: #d6d0e8;
}

[style*="world-w1.png"] { --scene-image: url("../img/world-w1.png"); }
[style*="world-w2.png"] { --scene-image: url("../img/world-w2.png"); }
[style*="world-w3.png"] { --scene-image: url("../img/world-w3.png"); }
[style*="world-w4.png"] { --scene-image: url("../img/world-w4.png"); }
[style*="world-w5.png"] { --scene-image: url("../img/world-w5.png"); }
[style*="world-w6.png"] { --scene-image: url("../img/world-w6.png"); }
[style*="world-w7.png"] { --scene-image: url("../img/world-w7.png"); }
[style*="world-w8.png"] { --scene-image: url("../img/world-w8.png"); }
[style*="thumbs-w1.png"] { --thumb-image: url("../img/thumbs-w1.png"); }
[style*="thumbs-w2.png"] { --thumb-image: url("../img/thumbs-w2.png"); }
[style*="thumbs-w3.png"] { --thumb-image: url("../img/thumbs-w3.png"); }
[style*="thumbs-w4.png"] { --thumb-image: url("../img/thumbs-w4.png"); }
[style*="thumbs-w5.png"] { --thumb-image: url("../img/thumbs-w5.png"); }
[style*="thumbs-w6.png"] { --thumb-image: url("../img/thumbs-w6.png"); }
[style*="thumbs-w7.png"] { --thumb-image: url("../img/thumbs-w7.png"); }
[style*="thumbs-w8.png"] { --thumb-image: url("../img/thumbs-w8.png"); }
.home-intro, .world__banner, .lesson__world-art {
  background-image: var(--scene-image, none) !important;
  background-color: var(--navy);
}
.resume-card__code { background-image: var(--thumb-image, none) !important; }

.home-intro {
  min-height: 194px;
  border-color: var(--navy-2);
  border-left: 8px solid var(--blue);
  background-position: center right;
}
.home-intro::before, .home-intro::after { display: none; }
.home-intro__copy {
  max-width: 650px;
  width: fit-content;
  padding: 16px 20px;
  border-radius: 10px;
  background: var(--navy);
}
.home-intro .eyebrow { color: #73e5d7; }
.home-intro h1 { font-family: var(--font-game); font-weight: 400; letter-spacing: 0; line-height: 1.2; }
.home-intro__lead { color: #e4ddff; }
.home-intro__mascot { filter: none; }
.resume-card { border-color: var(--line); background: #fff; }
.resume-card__top { padding-bottom: 12px; border-bottom: 2px solid var(--line); }
.resume-card__course { color: var(--primary-dark); }
.resume-card__copy h2 { font-family: var(--font-game); font-weight: 400; letter-spacing: 0; line-height: 1.3; }
.resume-card__code { border-color: var(--navy-2); background-color: var(--navy); color: #9ae8d9; }
.resume-card__code span { width: fit-content; padding: 2px 5px; border-radius: 3px; background: var(--navy); }
.resume-card__code::before { color: #a9a1d1; }
.resume-card__cta { background: var(--blue); border-color: var(--blue-dark); }
.trail-heading { border-bottom: 2px solid var(--line); padding-bottom: 12px; }
.trail-heading h2 { font-family: var(--font-game); font-weight: 400; letter-spacing: 0; }

.world__banner { aspect-ratio: auto; border-color: var(--navy-2); background-position: center right; }
.world__banner::before { background: var(--blue); }
.world__copy { min-width: 0; padding: 7px 10px; border-radius: 8px; background: var(--navy); }
.world__copy > span { color: #73e5d7; }
.world__banner .world__copy h2 { font-family: var(--font-game); font-weight: 400; line-height: 1.25; }
.world__banner .world__copy p { color: #e4ddff; }
.world__progress { background: var(--navy); border-color: #8a79c5; }
.world__progress small { color: #d9d0f4; }
.bubble { border-color: var(--line); }
.bubble:hover:not(.bubble--locked) { border-color: var(--primary); }
.bubble--current { border-color: var(--primary); background: var(--primary-wash); }
.bubble--current .mission-index { border-color: var(--primary-dark); background: var(--primary); }
.bubble--current .mission-state { color: var(--primary-dark); }
.bubble--done { border-color: #a7ded5; }
.mission-art { box-shadow: none; }
.startpop { background: var(--primary); border-color: var(--primary-dark); color: #fff; animation: none; }
.soon { border-color: var(--line); }

/* Passos curtos, escolhas claras e resultado que continua a narrativa. */
.lesson__top { gap: 8px; }
.lesson__top .bar { height: 14px; border: 2px solid var(--line); background: var(--primary-wash); }
.lesson__top .bar > i { background: var(--blue); border-radius: 3px; }
.lesson__world-art { background-position: center 43%; }
.lesson__body > .step { padding-top: clamp(20px, 4vw, 32px); }
.step h2 { color: var(--navy); }
.step .prompt { color: var(--ink); }
.blank { min-height: 44px; padding-block: 6px; }
.opt:hover:not([aria-pressed="true"]) { border-color: var(--primary); background: #fcfbff; }
.opt[aria-pressed="true"] .opt__k { border-color: var(--primary); color: var(--primary-dark); }
.fb { border-top-width: 4px; }
.fb.is-open { animation: feedback-in .2s ease-out both; }
@keyframes feedback-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
.done { max-width: 520px; }
.done h1 { color: var(--primary-dark); }
.done .stars-row { padding: 12px 0; border-block: 2px solid var(--line); }
.tile { min-height: 92px; }

/* Entrada na aventura e superfícies futuras do narrador. */
.ob { padding-top: clamp(28px, 7vh, 72px); }
.ob__mascot { width: 168px; height: 168px; }
.ob h1, .ob h2 { font-family: var(--font-game); font-weight: 400; letter-spacing: 0; line-height: 1.3; color: var(--primary-dark); }
.ob p.lead { color: var(--ink); line-height: 1.5; }
.field { min-height: 52px; }
.field:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }
.pick:hover { border-color: var(--primary); }
.pick[aria-pressed="true"] { border-color: var(--primary-dark); border-bottom-color: var(--primary-dark); }
.story-panel { padding: clamp(16px, 3vw, 24px); border: 2px solid var(--line); border-bottom-width: 5px; border-radius: var(--radius); background: var(--card); color: var(--ink); }
.story-panel { display: grid; grid-template-columns: 84px minmax(0, 1fr) auto; align-items: center; gap: 16px; }
.story-panel__hero { width: 84px; height: 84px; }
.story-panel__copy { min-width: 0; }
.story-panel__label { color: var(--primary-dark); font-size: 11px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; }
.story-panel__copy h3 { margin: 5px 0 7px; color: var(--navy); font-family: var(--font-game); font-size: 21px; font-weight: 400; line-height: 1.3; }
.story-panel__eyebrow, .story-panel__meta { color: var(--primary-dark); font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.story-panel__title { margin-block: 6px 10px; font-family: var(--font-game); font-weight: 400; font-size: clamp(20px, 3vw, 28px); line-height: 1.3; }
.story-panel__body, .story-panel__text { font-family: var(--font-game); font-weight: 400; font-size: 18px; line-height: 1.5; }
.story-panel__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 16px; }
.story-panel__progress { height: 10px; margin-top: 14px; overflow: hidden; border-radius: 6px; background: var(--primary-wash); }
.story-panel__progress > * { display: block; height: 100%; background: var(--blue); }
.voice-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-width: 44px; min-height: 44px; padding: 8px 14px; border: 2px solid var(--primary-dark); border-bottom-width: 4px; border-radius: var(--radius); background: var(--primary); color: #fff; font: 700 14px/1.2 var(--font); cursor: pointer; }
.voice-btn:empty::before { content: ""; width: 0; height: 0; border-block: 8px solid transparent; border-left: 12px solid currentColor; margin-left: 5px; }
.voice-btn.is-playing, .voice-btn[aria-pressed="true"], .voice-btn[data-playing="true"], .story-panel:has(.bb-mascot-frame.is-speaking) .voice-btn { background: var(--blue); border-color: var(--blue-dark); }
.voice-btn.is-playing::before, .voice-btn[aria-pressed="true"]::before, .voice-btn[data-playing="true"]::before, .story-panel:has(.bb-mascot-frame.is-speaking) .voice-btn::before { content: ""; width: 12px; height: 16px; margin-left: 0; border: 0; border-inline: 4px solid currentColor; }
.voice-btn.is-playing .ui-icon-wrap, .voice-btn[aria-pressed="true"] .ui-icon-wrap, .voice-btn[data-playing="true"] .ui-icon-wrap, .story-panel:has(.bb-mascot-frame.is-speaking) .voice-btn .ui-icon-wrap { display: none; }
.voice-btn:disabled { background: #e7e3ef; border-color: #c6c0d6; color: var(--muted); cursor: default; }
.voice-btn .ui-icon-wrap { width: 20px; height: 20px; }
.voice-btn:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }
.music-toggle { flex: 0 0 44px; min-width: 44px; min-height: 44px; border: 2px solid var(--line); border-bottom-width: 4px; background: var(--card); color: var(--muted); }
.music-toggle__on, .music-toggle__off { width: 22px; height: 22px; flex: 0 0 22px; }
.music-toggle__on { display: none; }
.music-toggle__off { display: inline-flex; }
.music-toggle[aria-pressed="true"] .music-toggle__on { display: inline-flex; }
.music-toggle[aria-pressed="true"] .music-toggle__off { display: none; }
.music-toggle[aria-pressed="true"] { border-color: var(--primary-dark); background: var(--primary-wash); color: var(--primary-dark); }
.music-toggle:active { transform: translateY(2px); border-bottom-width: 2px; }
.music-controls { display: inline-flex; align-items: center; gap: 6px; position: relative; z-index: 8; }
.music-menu { position: relative; }
.music-menu > summary { display: grid; place-items: center; width: 44px; height: 44px; border: 2px solid var(--line); border-bottom-width: 4px; border-radius: var(--radius); background: var(--card); color: var(--primary-dark); font: 800 24px/1 var(--font); cursor: pointer; list-style: none; }
.music-menu > summary::-webkit-details-marker { display: none; }
.music-menu > summary:focus-visible, .music-menu input:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }
.music-menu__panel { position: absolute; z-index: 20; top: calc(100% + 8px); right: 0; width: min(270px, calc(100vw - 32px)); padding: 15px; border: 2px solid #a9a2cc; border-radius: 14px; background: #fff; color: #252542; box-shadow: 0 16px 36px #12142b55; }
.music-menu__heading { display: flex; justify-content: space-between; gap: 10px; font-weight: 800; font-size: 14px; }
.music-menu__panel input[type="range"] { display: block; width: 100%; margin: 16px 0 10px; accent-color: #6e54ea; cursor: pointer; }
.music-menu__panel small { display: block; color: #55546b; font-size: 12px; line-height: 1.35; }
.scene-music-controls { display: flex; justify-content: flex-end; padding: 12px clamp(16px, 4vw, 42px) 0; }
.ob-shell .music-menu > summary, .realm__music .music-menu > summary, .atlas__sound .music-menu > summary { background: #252448; border-color: #9e94cf; color: #fff; }
.ob-shell .ob__music { background: transparent; border: 0; padding: 0; }
.ob-shell .ob__music .music-toggle { background: #1b2348; border-color: #a9eede; color: #c8fff3; }
.ob-shell .ob__music .music-toggle[aria-pressed="true"] { background: #8ef1df; border-color: #50c7b4; color: #17374b; }
.resume-card__top .resume-card__course { flex: 1 1 auto; }
.lesson__top .bar { min-width: 48px; }
.bb-mascot-frame.is-speaking { animation: speaking-presence .45s ease-in-out infinite alternate; transform-origin: 50% 85%; }
@keyframes speaking-presence { from { transform: translateY(0) rotate(-1deg); } to { transform: translateY(-2px) rotate(1deg); } }
.fb__mascot { flex: 0 0 56px; width: 56px; height: 56px; animation: character-reaction .5s cubic-bezier(.2,1.2,.3,1) both; }
.fb--bad .fb__mascot { animation-name: character-think; }
@keyframes character-reaction { from { transform: translateY(12px) scale(.8); opacity: 0; } to { transform: translateY(0) scale(1); opacity: 1; } }
@keyframes character-think { from { transform: rotate(-8deg) scale(.9); opacity: 0; } to { transform: rotate(0) scale(1); opacity: 1; } }
.done__mascot { animation: character-reaction .7s cubic-bezier(.2,1.2,.3,1) both; }
.done .result-star.is-on { animation: star-land .55s cubic-bezier(.2,1.5,.3,1) both; }
.done .result-star:nth-child(2) { animation-delay: .18s; }
.done .result-star:nth-child(3) { animation-delay: .36s; }
@keyframes star-land { from { transform: translateY(18px) scale(.25) rotate(-30deg); opacity: 0; } to { transform: translateY(0) scale(1) rotate(0); opacity: 1; } }
.done .tile { animation: feedback-in .45s ease-out both; }
.done .tile:nth-child(2) { animation-delay: .13s; }
.done .tile:nth-child(3) { animation-delay: .26s; }

:where(button, input, textarea, select, [role="button"]):focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }
.tabbar .tab:focus-visible { outline-offset: -4px; }
.speed:focus-visible, .seg button:focus-visible, .row-item:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
@media (max-width: 520px) {
  .home-intro { grid-template-columns: minmax(0, 1fr) 72px; min-height: 176px; padding: 12px; }
  .home-intro__copy { padding: 12px; }
  .home-intro h1 { font-size: clamp(20px, 6vw, 27px); }
  .home-intro__mascot { width: 72px; height: 72px; }
  .world__banner { grid-template-columns: 54px minmax(0, 1fr) auto; }
  .world__copy { padding: 5px 7px; }
  .world__banner .world__copy p { white-space: normal; }
  .world__progress { min-width: 54px; }
  .mission-copy strong { font-size: 15px; }
  .ob__mascot { width: 140px; height: 140px; }
  .story-panel__actions > * { flex: 1 1 auto; }
  .story-panel { grid-template-columns: 64px minmax(0, 1fr); gap: 10px; }
  .story-panel__hero { width: 64px; height: 64px; }
  .story-panel > .voice-btn { grid-column: 1 / -1; width: 100%; }
}
@media (max-width: 390px) {
  .brand strong { font-size: 12px; }
  .topbar { padding-inline: 10px; }
  .stat { padding-inline: 4px; }
  .trail-heading { flex-wrap: wrap; }
  .world__banner { grid-template-columns: 44px minmax(0, 1fr) 50px; gap: 5px; padding: 8px 6px 8px 12px; }
  .world__mascot { width: 44px; height: 44px; }
  .world__banner .world__copy h2 { font-size: 16px; }
  .world__banner .world__copy p { font-size: 11px; }
  .world__progress { min-width: 50px; padding: 4px; }
  .bubble { grid-template-columns: 38px 46px minmax(0, 1fr) 32px; gap: 6px; padding: 9px; }
  .mission-index { width: 38px; height: 44px; }
  .mission-art { width: 46px; height: 46px; }
  .mission-state .ui-icon-wrap { width: 20px; height: 20px; }
}
@media (prefers-reduced-motion: reduce) {
  .bb-mascot-frame.is-speaking, .fb.is-open, .fb__mascot, .done__mascot, .done .result-star, .done .tile { animation: none !important; }
}

/* Projetos prometidos desde a entrada, e recompensa jogável ao fechar cada mundo. */
.ob__promise { margin: -8px 0 22px; padding: 12px 8px; border: 2px solid var(--line); border-radius: var(--radius); background: var(--primary-wash); color: var(--primary-dark); font: 13px/1.4 var(--font-game); }
.reward-showcase { margin-top: 20px; padding: 20px; border: 2px solid var(--line); border-bottom-width: 5px; border-radius: var(--radius-card); background: #fff; }
.reward-showcase__heading { display: flex; justify-content: space-between; align-items: end; gap: 12px; }
.reward-showcase__heading h2 { margin-top: 3px; font: 25px/1.25 var(--font-game); color: var(--navy); }
.reward-showcase__heading > span { flex: none; color: var(--primary-dark); font-size: 12px; font-weight: 900; }
.reward-showcase__intro { margin: 7px 0 15px; color: var(--muted); font-size: 14px; }
.reward-showcase__list { display: grid; grid-auto-columns: minmax(175px, 1fr); grid-auto-flow: column; gap: 10px; overflow-x: auto; padding: 2px 2px 8px; scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; }
.reward-preview { min-height: 154px; display: grid; grid-template-rows: 46px 1fr auto; gap: 5px; padding: 12px; text-align: left; scroll-snap-align: start; border: 2px solid var(--line); border-bottom-width: 4px; border-radius: var(--radius); background: #f9f8fd; color: var(--navy); cursor: pointer; }
.reward-preview.is-open { border-color: var(--blue); background: var(--blue-wash); }
.reward-preview__icon { font-size: 34px; line-height: 1; }
.reward-preview__copy small, .reward-preview__copy strong, .reward-preview__copy em { display: block; }
.reward-preview__copy small { color: var(--primary-dark); font-size: 10px; font-weight: 900; letter-spacing: .08em; }
.reward-preview__copy strong { margin-top: 3px; font: 15px/1.25 var(--font-game); }
.reward-preview__copy em { margin-top: 3px; font-size: 11px; font-style: normal; color: var(--muted); }
.reward-preview__status { justify-self: end; color: var(--blue-dark); font-size: 11px; font-weight: 900; }
.world-reward { width: 100%; display: grid; grid-template-columns: 54px minmax(0,1fr) auto; align-items: center; gap: 12px; margin-top: 10px; padding: 12px 14px; text-align: left; border: 2px solid #dbcafa; border-bottom-width: 4px; border-radius: var(--radius); background: #f6f1ff; color: var(--navy); cursor: pointer; }
.world-reward.is-open { border-color: #97dfc9; background: #e8faf2; }
.world-reward__icon { font-size: 35px; line-height: 1; }
.world-reward__copy { min-width: 0; }
.world-reward__copy small, .world-reward__copy strong, .world-reward__copy em { display: block; }
.world-reward__copy small { color: var(--primary-dark); font-size: 10px; font-weight: 900; letter-spacing: .08em; }
.world-reward__copy strong { margin-top: 2px; font: 16px/1.25 var(--font-game); }
.world-reward__copy em { margin-top: 3px; color: var(--muted); font-size: 12px; font-style: normal; }
.world-reward__action { color: var(--primary-dark); font-size: 12px; font-weight: 900; white-space: nowrap; }
.done-reward { display: flex; align-items: center; gap: 14px; margin: 18px 0 14px; padding: 15px; text-align: left; border: 2px solid var(--gold); border-bottom-width: 5px; border-radius: var(--radius); background: var(--gold-wash); }
.done-reward__icon { font-size: 40px; }
.done-reward small { color: #8d5c03; font-size: 10px; font-weight: 900; letter-spacing: .08em; }
.done-reward h2 { font: 20px/1.3 var(--font-game); color: var(--navy); }
.done-reward p { color: var(--muted); font-size: 13px; }
.arcade-screen { width: 100%; }
.arcade-screen__inner { max-width: 900px; margin: 0 auto; padding: 16px 16px calc(36px + var(--safe-b)); }
.arcade-screen__back { min-height: 44px; padding: 6px 0; border: 0; background: transparent; color: var(--primary-dark); font: 800 14px var(--font); cursor: pointer; }
.arcade-screen__intro { display: flex; align-items: center; gap: 14px; margin-top: 6px; padding: 18px; border: 2px solid var(--navy-2); border-bottom-width: 5px; border-radius: var(--radius-card); background: var(--navy); color: #fff; }
.arcade-screen__icon { font-size: 50px; line-height: 1; }
.arcade-screen__intro .eyebrow { color: #7de5d8; }
.arcade-screen__intro h1 { font: clamp(22px,4vw,32px)/1.25 var(--font-game); color: #fff; }
.arcade-screen__intro p:last-child { margin-top: 5px; color: #e4ddff; font-size: 14px; }
.arcade-screen__concept { margin: 12px 0 16px; padding: 12px 14px; border-left: 4px solid var(--blue); background: var(--blue-wash); border-radius: 7px; font-size: 13px; line-height: 1.45; }
.arcade-screen__afterword { max-width: 680px; margin: 12px auto 0; color: var(--muted); font-size: 12px; line-height: 1.45; text-align: center; }
.arcade-screen__locked { padding: 30px 18px; text-align: center; border: 2px solid var(--line); border-radius: var(--radius); background: #fff; }
.arcade-screen__locked > span { font-size: 48px; }
.arcade-screen__locked h2 { margin: 8px 0; color: var(--navy); }
.arcade-screen__locked p { margin: 0 auto 20px; max-width: 420px; color: var(--muted); }
@media (max-width: 520px) {
  .reward-showcase { padding: 14px; }
  .reward-showcase__heading h2 { font-size: 21px; }
  .reward-showcase__list { grid-auto-columns: minmax(165px, 58%); }
  .world-reward { grid-template-columns: 42px minmax(0,1fr); gap: 8px; }
  .world-reward__icon { font-size: 29px; }
  .world-reward__action { grid-column: 2; }
  .arcade-screen__icon { font-size: 38px; }
}

/* Presença em todas as aparições: o corpo se mexe e os olhos piscam, mas a
   expressão da boca não muda sem fala real. */
.bb-mascot-frame {
  --idle-delay: 0s;
  --blink-left: 39%;
  --blink-top: 35%;
  --blink-color: #20312a;
  transform-origin: 50% 82%;
  animation: mascot-idle 6.8s ease-in-out var(--idle-delay) infinite;
}
.bb-mascot-frame[data-hero="robot"] { --idle-delay: -1.7s; --blink-left: 38%; --blink-top: 38%; --blink-color: #a5f8ff; }
.bb-mascot-frame[data-hero="inventor"] { --idle-delay: -3.1s; --blink-left: 43%; --blink-top: 32%; --blink-color: #3b241f; }
.bb-mascot-frame[data-hero="cat"] { --idle-delay: -4.4s; --blink-left: 42%; --blink-top: 42%; --blink-color: #332b3f; }
.bb-mascot-frame:not(.bb-mascot-frame--party)::after {
  content: "";
  position: absolute;
  z-index: 1;
  left: var(--blink-left);
  top: var(--blink-top);
  width: 27%;
  height: 2.8%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--blink-color) 0 37%, transparent 37% 63%, var(--blink-color) 63% 100%);
  opacity: 0;
  pointer-events: none;
  animation: mascot-blink 6.8s linear var(--idle-delay) infinite;
}
.done__mascot { position: relative; isolation: isolate; }
.done__mascot::before {
  content: "";
  position: absolute;
  z-index: -1;
  left: 24%;
  bottom: 3%;
  width: 52%;
  height: 9%;
  border-radius: 50%;
  background: rgba(30, 27, 65, .16);
  animation: victory-shadow 2.9s ease-in-out infinite;
}
.done__mascot .bb-mascot-frame {
  transform-origin: 50% 87%;
  animation: victory-hop 2.9s cubic-bezier(.22,.7,.32,1) infinite;
}
.done .stars-row { gap: clamp(8px, 2vw, 20px); }
.done .result-star { display: block; width: clamp(64px, 18vw, 82px); height: clamp(64px, 18vw, 82px); flex: none; }
.done .result-star svg { display: block; width: 100%; height: 100%; overflow: visible; }
.reward-star__depth { fill: #d2cbdc; stroke: #aaa2b9; stroke-width: 3; stroke-linejoin: round; }
.reward-star__face { fill: #f1edf7; stroke: #aaa2b9; stroke-width: 3.5; stroke-linejoin: round; }
.reward-star__shine, .reward-star__spark { opacity: 0; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.result-star.is-on .reward-star__depth { fill: #d37d15; stroke: #aa5f11; }
.result-star.is-on .reward-star__face { fill: #ffd34d; stroke: #a86412; }
.result-star.is-on .reward-star__shine { opacity: 1; stroke: #fff5bd; stroke-width: 5; animation: star-shimmer 3.3s ease-in-out infinite; }
.result-star.is-on .reward-star__spark { opacity: 1; stroke: #f4ac2d; stroke-width: 3; }
.done__momentum { margin: 18px 0 12px !important; color: var(--primary-dark) !important; }
.done-next { margin: 12px 0 14px; padding: 16px 18px; text-align: left; border: 2px solid #b9e5dc; border-left: 6px solid var(--blue); border-bottom-width: 5px; border-radius: var(--radius); background: #f0fffc; }
.done-next small { color: var(--blue-dark); font-size: 11px; font-weight: 900; letter-spacing: .08em; }
.done-next h2 { margin: 5px 0 7px; color: var(--navy); font: 23px/1.3 var(--font-game); }
.done-next p { color: var(--ink); font-size: 14px; line-height: 1.45; }
.done-next__promise { margin-top: 9px; color: var(--primary-dark) !important; font-weight: 700; }
@keyframes mascot-idle {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  18% { transform: translateY(-3%) rotate(-2deg); }
  34% { transform: translateY(-1%) rotate(1deg); }
  53% { transform: translateY(-4%) rotate(2deg); }
  72% { transform: translateY(0) rotate(-1deg); }
}
@keyframes mascot-blink {
  0%, 43%, 46%, 100% { opacity: 0; }
  44%, 45% { opacity: 1; }
}
@keyframes victory-hop {
  0%, 11%, 76%, 100% { transform: translateY(0) rotate(0deg) scale(1); }
  18% { transform: translateY(5px) scale(1.08, .91); }
  34% { transform: translateY(-38px) rotate(-5deg) scale(.97, 1.07); }
  46% { transform: translateY(-42px) rotate(4deg) scale(.98, 1.06); }
  58% { transform: translateY(0) rotate(0deg) scale(1.1, .89); }
  67% { transform: translateY(-8px) scale(.99, 1.02); }
}
@keyframes victory-shadow {
  0%, 11%, 76%, 100% { transform: scale(1); opacity: .65; }
  34%, 46% { transform: scale(.57); opacity: .24; }
  58% { transform: scale(1.18); opacity: .8; }
}
@keyframes star-shimmer {
  0%, 40%, 100% { opacity: .55; }
  48% { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .bb-mascot-frame, .bb-mascot-frame::after { animation: none !important; }
  .done__mascot::before { animation: none !important; }
  .result-star.is-on .reward-star__shine { animation: none !important; }
}

/* Janela da missão: uma amostra do cenário antes de entrar no desafio. */
.mission-preview {
  min-height: 112px;
  margin: 6px 0 14px;
  display: flex;
  align-items: flex-end;
  padding: 12px;
  border: 2px solid var(--navy-2);
  border-radius: var(--radius);
  background-color: var(--navy);
  background-size: cover;
  background-position: center;
}
.mission-preview span {
  padding: 6px 9px;
  border-radius: 7px;
  background: var(--navy);
  color: #b1f4e7;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .08em;
}

/* A porta de entrada é uma pequena mostra dos jogos que a criança vai criar. */
.ob-view {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  color: #fff;
  background:
    radial-gradient(ellipse 55% 60% at 85% 5%, #4a397a 0%, transparent 74%),
    radial-gradient(ellipse 48% 48% at 0% 90%, #24515d 0%, transparent 77%),
    #161936;
}
.ob-view::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: .6;
  pointer-events: none;
  background-image:
    radial-gradient(circle at 12% 17%, #ffffff 0 1px, transparent 2px),
    radial-gradient(circle at 76% 12%, #a2fff1 0 1px, transparent 2px),
    radial-gradient(circle at 88% 70%, #ffffff 0 1px, transparent 2px),
    radial-gradient(circle at 24% 82%, #ffd58d 0 1px, transparent 2px);
  background-size: 330px 280px, 420px 360px, 480px 390px, 560px 440px;
  animation: ob-stars 24s linear infinite alternate;
}
.ob-shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(320px, 455px) minmax(0, 680px);
  align-items: center;
  gap: clamp(24px, 4vw, 64px);
  width: min(100%, 1250px);
  min-height: 100vh;
  margin: 0 auto;
  padding: clamp(32px, 5vh, 62px) clamp(18px, 4vw, 60px) calc(40px + var(--safe-b));
}
.ob-shell > .ob {
  max-width: none;
  margin: 0;
  padding: 26px clamp(22px, 3vw, 36px) 34px;
  text-align: left;
  border: 1px solid #9b8cca99;
  border-bottom: 5px solid #6756a0;
  border-radius: 25px;
  background: linear-gradient(145deg, #302a5bf5, #242443f5);
  box-shadow: 0 25px 65px #090b2299, inset 0 1px #ffffff29;
  animation: ob-card-enter .7s cubic-bezier(.18,.75,.24,1) both;
}
.ob-shell .ob__music {
  margin: 0 0 25px auto;
  border-color: #a9eede;
  background: #1b2348;
  color: #c8fff3;
}
.ob-shell .ob__music[aria-pressed="true"] { background: #8ef1df; border-color: #50c7b4; color: #17374b; }
.ob__chapter { margin: 0 0 12px; color: #b8f4e5; font-size: 11px; font-weight: 900; letter-spacing: .15em; }
.ob__stages { display: flex; gap: 6px; width: 100%; margin-bottom: 22px; }
.ob__stages span { flex: 1; height: 5px; border-radius: 99px; background: #ffffff30; }
.ob__stages span.is-on { background: #82e9d3; box-shadow: 0 0 13px #82e9d388; }
.ob-shell .ob__mascot { width: 118px; height: 118px; margin: 0 0 5px; }
.ob-shell .ob h1 { margin: 0; color: #fff; font-size: clamp(35px, 3vw, 49px); line-height: 1.1; }
.ob-shell .ob h2 { margin: 0; color: #fff; font-size: clamp(24px, 2.4vw, 34px); line-height: 1.25; }
.ob__tagline { margin-top: 10px; color: #ffe4a9; font: 400 clamp(18px, 1.7vw, 22px)/1.4 var(--font-game); }
.ob-shell .ob p.lead { margin: 15px 0 26px; color: #e8e4fa; font-size: 15px; line-height: 1.55; }
.ob-shell .ob .btn { min-height: 56px; font-size: 16px; }
.ob-shell .ob .field { text-align: left; padding-inline: 18px; }
.ob-shell .ob__note { color: #b9b1d5; }
.ob-shell .picker { gap: 9px; }
.ob-shell .pick { min-height: 100px; }
.ob-shell .pick[aria-pressed="true"] { background: #dcfff5; color: #153f45; }
.ob-showcase { min-width: 0; animation: ob-showcase-enter .8s .16s ease-out both; }
.ob-showcase__heading { margin: 0 0 19px; }
.ob-showcase__heading > span { display: block; color: #93f3dd; font-size: 11px; font-weight: 900; letter-spacing: .18em; }
.ob-showcase__heading > strong { display: block; max-width: 620px; margin-top: 8px; color: #fff; font: 400 clamp(29px, 3.7vw, 50px)/1.14 var(--font-game); text-wrap: balance; }
.ob-showcase__heading > p { margin-top: 8px; color: #d8d0ed; font-size: 15px; }
.ob-showcase__grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.ob-project {
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: end;
  min-width: 0;
  min-height: 195px;
  overflow: hidden;
  padding: 18px;
  border: 1px solid #d9d4ff75;
  border-bottom: 4px solid #8375b6;
  border-radius: 20px;
  background-color: #273252;
  background-size: cover;
  background-position: center;
  box-shadow: 0 18px 32px #0a0d2880;
}
.ob-project--w1 { grid-column: 1 / -1; min-height: 250px; background-image: url("../img/world-w1.png"); background-position: center 52%; }
.ob-project--w2 { background-image: url("../img/world-w2.png"); background-position: 60% 50%; }
.ob-project--w8 { background-image: url("../img/world-w8.png"); background-position: 67% 50%; }
.ob-project::before { content: ""; position: absolute; z-index: 0; inset: 0; background: linear-gradient(90deg, #111935e8 0%, #11193599 49%, #1119351c 100%), linear-gradient(0deg, #0c123ad9, transparent 65%); }
.ob-project__copy { position: relative; z-index: 2; max-width: 75%; text-shadow: 0 2px 8px #090d23; }
.ob-project__copy small { display: block; color: #98f5e0; font-size: 10px; font-weight: 900; letter-spacing: .16em; }
.ob-project__copy strong { display: block; margin-top: 5px; color: #fff; font: 400 clamp(18px, 1.9vw, 27px)/1.22 var(--font-game); }
.ob-project__copy span { display: block; margin-top: 5px; color: #e4eaff; font-size: 12px; line-height: 1.35; }
.ob-project__code { position: absolute; z-index: 2; top: 14px; left: 15px; padding: 6px 9px; border: 1px solid #b2fff199; border-radius: 8px; background: #152c43d9; color: #adffe6; font: 12px/1.2 var(--mono-game); box-shadow: 0 5px 14px #080c2599; animation: ob-code-in .65s .5s ease-out both; }
.ob-project__sprite { position: absolute; z-index: 1; right: 4%; bottom: 6%; width: 105px; height: 105px; filter: drop-shadow(0 10px 12px #080d2cbb); animation: ob-hero-float 3.8s ease-in-out infinite; }
.ob-project--w1 .ob-project__sprite { right: 11%; width: 150px; height: 150px; animation-name: ob-hero-walk; }
.ob-project--w8 .ob-project__sprite { animation-delay: -1.2s; }
.ob-project__sprite .bb-mascot-frame, .ob-project__sprite .bb-sprite { display: block; width: 100%; height: 100%; object-fit: contain; }
@keyframes ob-stars { from { transform: translateY(0); opacity: .35; } to { transform: translateY(-28px); opacity: .7; } }
@keyframes ob-card-enter { from { opacity: 0; transform: translateY(24px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes ob-showcase-enter { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: none; } }
@keyframes ob-code-in { from { opacity: 0; transform: translateY(-9px); } to { opacity: 1; transform: none; } }
@keyframes ob-hero-float { 0%, 100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-12px) rotate(4deg); } }
@keyframes ob-hero-walk { 0%, 100% { transform: translate(0, 0) rotate(-3deg); } 45% { transform: translate(-24px, -14px) rotate(4deg); } 65% { transform: translate(-28px, -10px) rotate(-2deg); } }
@media (max-width: 830px) {
  .ob-shell { grid-template-columns: minmax(0, 1fr); max-width: 620px; min-height: 0; gap: 34px; padding-top: 24px; }
  .ob-shell > .ob { max-width: 100%; }
  .ob-showcase__heading > strong { font-size: 34px; }
}
@media (max-width: 520px) {
  .ob-shell { padding: 14px 14px calc(28px + var(--safe-b)); gap: 28px; }
  .ob-shell > .ob { padding: 20px 18px 27px; border-radius: 20px; }
  .ob-shell .ob__music { margin-bottom: 18px; }
  .ob-shell .ob__mascot { width: 98px; height: 98px; }
  .ob-shell .ob h1 { font-size: 36px; }
  .ob-project--w1 { min-height: 180px; }
  .ob-project:not(.ob-project--w1) { min-height: 156px; padding: 12px; }
  .ob-project__copy { max-width: 84%; }
  .ob-project__copy span { display: none; }
  .ob-project__sprite { width: 72px; height: 72px; right: 2%; }
  .ob-project--w1 .ob-project__sprite { width: 104px; height: 104px; right: 4%; }
}
@media (prefers-reduced-motion: reduce) {
  .ob-view::before, .ob-shell > .ob, .ob-showcase, .ob-project__sprite, .ob-project__code { animation: none !important; }
}
.ob-shell .music-controls.ob__music { width: auto; padding: 0; border: 0; background: transparent; color: inherit; }
.ob-shell .ob__music .music-toggle { margin: 0; }
