:root {
  --blue: #0b3d91; --blue2: #1f56a8; --yel: #ffc72c; --bg: #f4f6fb; --card: #fff;
  --ink: #16213e; --muted: #5b6478; --ok: #1a9e5c; --okbg: #e6f6ee; --bad: #d63031; --badbg: #fdecec;
  --r: 16px; --sh: 0 2px 10px rgba(16, 33, 62, .08);
}
* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--ink); line-height: 1.5; padding-bottom: 80px; }
a { color: var(--blue2); }
header { display: flex; justify-content: space-between; align-items: center; padding: 12px 20px; background: var(--blue); color: #fff; position: sticky; top: 0; z-index: 5; }
.logo { color: #fff; text-decoration: none; font-weight: 800; font-size: 1.2rem; }
.logo span { color: var(--yel); }
.hud { display: flex; gap: 12px; font-size: .9rem; font-weight: 600; }
nav { display: flex; justify-content: center; gap: 4px; background: #fff; box-shadow: var(--sh); padding: 6px; position: sticky; top: 52px; z-index: 4; overflow-x: auto; }
nav a { text-decoration: none; color: var(--ink); padding: 8px 14px; border-radius: 10px; display: flex; gap: 6px; align-items: center; font-weight: 600; white-space: nowrap; }
nav a.on { background: var(--blue); color: #fff; }
main { max-width: 980px; margin: 0 auto; padding: 20px 16px; }
h1, h2, h3 { line-height: 1.2; }
.muted { color: var(--muted); }
.panel { background: var(--card); border-radius: var(--r); box-shadow: var(--sh); padding: 22px; margin-bottom: 18px; }
.narrow { max-width: 560px; margin-left: auto; margin-right: auto; }
.center { text-align: center; }
.row { display: flex; gap: 10px; flex-wrap: wrap; margin: 14px 0; }
.row.center { justify-content: center; }
.between { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.btn { display: inline-block; background: var(--blue); color: #fff; border: 0; border-radius: 12px; padding: 11px 18px; font-weight: 700; font-size: 1rem; cursor: pointer; text-decoration: none; }
.btn:hover { filter: brightness(1.1); }
.btn.big { padding: 15px 24px; font-size: 1.08rem; }
.btn.ghost { background: #fff; color: var(--blue); box-shadow: inset 0 0 0 2px var(--blue); }
.btn.danger { background: var(--bad); }
.btn:disabled { opacity: .5; cursor: default; }
.link { background: none; border: 0; color: var(--blue2); cursor: pointer; font-size: .95rem; padding: 6px 0; display: inline-block; margin-bottom: 8px; }

/* Início */
.hero { display: grid; grid-template-columns: 1.3fr 1fr; gap: 24px; align-items: center; background: linear-gradient(135deg, var(--blue), #164fb5); color: #fff; border-radius: 22px; padding: 34px; margin-bottom: 22px; }
.hero h1 { font-size: 2.3rem; margin: 6px 0 12px; }
.hero h1 span { color: var(--yel); }
.hero .lead { font-size: 1.1rem; opacity: .95; }
.hero .btn { background: var(--yel); color: var(--ink); }
.hero .btn.ghost { background: transparent; color: #fff; box-shadow: inset 0 0 0 2px #fff; }
.tag { display: inline-block; background: rgba(255, 255, 255, .15); padding: 4px 12px; border-radius: 99px; font-size: .85rem; margin: 0; }
.hero-signs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; justify-items: center; }
.hero-signs .sign { background: #fff; border-radius: 18px; padding: 8px; }
.cards3, .grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.card { background: var(--card); border-radius: var(--r); box-shadow: var(--sh); padding: 20px; text-decoration: none; color: var(--ink); display: block; transition: transform .15s; }
a.card:hover { transform: translateY(-3px); }
.card h3 { margin: 6px 0; }
.card p { margin: 0; color: var(--muted); }
.ico { font-size: 2rem; }
.disclaimer { font-size: .82rem; color: var(--muted); text-align: center; margin-top: 26px; }

/* Plano */
label { display: block; font-weight: 600; margin: 14px 0; }
input, select { display: block; width: 100%; margin-top: 6px; padding: 12px; border: 2px solid #d9deea; border-radius: 10px; font-size: 1rem; }
.pill { background: var(--okbg); color: var(--ok); padding: 6px 14px; border-radius: 99px; font-weight: 600; }
.pill.warn { background: #fff4d6; color: #9a6700; }
.tasks { display: grid; gap: 10px; }
.task { display: flex; flex-direction: column; background: var(--bg); padding: 14px 16px; border-radius: 12px; text-decoration: none; color: var(--ink); border-left: 5px solid var(--blue2); }
.task small { color: var(--muted); }
.task.hot { border-left-color: var(--bad); }
.progress-list { display: grid; gap: 12px; }
.prog { text-decoration: none; color: var(--ink); display: grid; gap: 4px; }
.bar { background: #e6eaf3; border-radius: 99px; height: 10px; overflow: hidden; margin: 6px 0 2px; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--ok), #4cd48a); border-radius: 99px; }

/* Lição */
.lessonp .lead { font-size: 1.08rem; }
.points { padding-left: 0; list-style: none; }
.points li { padding: 9px 12px; border-radius: 10px; margin: 6px 0; background: var(--bg); }
.tip { background: #fff8de; border-left: 5px solid var(--yel); padding: 14px; border-radius: 10px; margin: 16px 0; }
.signgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 12px; }
.signgrid figure { margin: 0; text-align: center; font-size: .85rem; }

/* Perguntas */
.qhead { display: flex; justify-content: space-between; color: var(--muted); font-weight: 600; margin-bottom: 8px; }
.q { display: flex; gap: 18px; align-items: center; margin-bottom: 10px; }
.q h3 { margin: 0; font-size: 1.2rem; }
.qsign { flex-shrink: 0; text-align: center; }
.opts { display: grid; gap: 10px; }
.opt { text-align: left; background: #fff; border: 2px solid #d9deea; border-radius: 12px; padding: 13px 14px; font-size: 1rem; cursor: pointer; color: var(--ink); transition: border-color .15s, background .15s; }
.opt:hover:not(:disabled) { border-color: var(--blue2); background: #f0f5ff; }
.opt b { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 7px; background: var(--bg); margin-right: 8px; }
.opt.right { border-color: var(--ok); background: var(--okbg); }
.opt.wrong { border-color: var(--bad); background: var(--badbg); }
.opt.picked { border-color: var(--blue2); background: #e8efff; }
.opt.small { display: block; width: 100%; margin: 6px 0; padding: 10px 12px; }
.fb { padding: 12px 14px; border-radius: 12px; margin: 12px 0; }
.fb.ok { background: var(--okbg); color: #0e5a35; }
.fb.bad { background: var(--badbg); color: #8a1c1c; }
.reforco { border: 2px dashed var(--yel); background: #fffbea; border-radius: 14px; padding: 14px 16px; margin: 12px 0; }
.reforco h4 { margin: 0 0 6px; }
.mini-lesson { margin: 6px 0; }
.rq { font-weight: 700; margin: 6px 0; }
.next { margin-top: 6px; }
.ok { color: var(--ok); font-weight: 700; }
.timer { background: var(--ink); color: #fff; padding: 3px 12px; border-radius: 99px; font-variant-numeric: tabular-nums; }
.big-score { font-size: 3rem; font-weight: 800; margin: 6px 0; color: var(--blue); }
.big-emoji { font-size: 3.4rem; margin: 0; }
.examfacts { display: flex; justify-content: center; gap: 14px; margin: 16px 0; }
.examfacts div { background: var(--bg); border-radius: 14px; padding: 12px 18px; display: grid; }
.examfacts b { font-size: 1.8rem; color: var(--blue); }
.hist { list-style: none; padding: 0; }
.result { text-align: center; }
.result.pass h2 { color: var(--ok); }
.result.fail h2 { color: var(--bad); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 10px 0 16px; }
.chip { background: var(--badbg); color: #8a1c1c; border-radius: 99px; padding: 5px 12px; font-weight: 600; font-size: .9rem; }

/* Jogos */
.game .opts { max-width: 520px; margin: 0 auto; }
.game .opts.row { display: flex; justify-content: center; }
.cross { width: 100%; max-width: 340px; border-radius: 16px; margin: 10px auto; display: block; }
.combo { font-weight: 800; color: #e76f00; min-height: 1.5em; }
.tf { font-size: 1.3rem; min-height: 3em; }
.memory { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; max-width: 560px; margin: 14px auto; }
.mcard { aspect-ratio: 1; border: 0; border-radius: 12px; background: var(--blue); color: #fff; font-size: .8rem; font-weight: 700; cursor: pointer; padding: 6px; display: grid; place-items: center; }
.mcard .front { display: none; }
.mcard.flip { background: #fff; color: var(--ink); box-shadow: inset 0 0 0 2px #d9deea; }
.mcard.flip .front { display: block; }
.mcard.flip .back { display: none; }
.mcard.done { box-shadow: inset 0 0 0 3px var(--ok); background: var(--okbg); }
.back { font-size: 2rem; }

/* Categoria */
.catchip { background: var(--yel); color: var(--ink); text-decoration: none; padding: 2px 10px; border-radius: 99px; font-weight: 800; }
.mute { background: none; border: 0; cursor: pointer; font-size: 1rem; padding: 0; }
.cats { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; margin-top: 18px; }
.catcard { background: var(--bg); border: 3px solid transparent; border-radius: 18px; padding: 18px 12px; cursor: pointer; display: grid; gap: 4px; justify-items: center; font-size: 1rem; color: var(--ink); transition: transform .15s, border-color .15s; }
.catcard:hover { transform: translateY(-4px); border-color: var(--blue2); }
.catcard.on { border-color: var(--yel); background: #fff8de; }
.catcard small { color: var(--muted); }

/* Trilho */
.bar.big { height: 16px; }
.trail { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 24px 0 10px; }
.node { display: flex; flex-direction: column; align-items: center; text-decoration: none; color: var(--ink); transform: translateX(var(--off)); position: relative; }
.bub { width: 84px; height: 84px; border-radius: 50%; display: grid; place-items: center; font-size: 2.4rem; background: #d9deea; box-shadow: 0 7px 0 #b5bdd0; transition: transform .1s; }
.node:active .bub { transform: translateY(5px); box-shadow: 0 2px 0 #b5bdd0; }
.node.done .bub { background: var(--ok); box-shadow: 0 7px 0 #117044; }
.node.cur .bub { background: var(--yel); box-shadow: 0 7px 0 #c99a10; animation: pulse 1.6s infinite; }
.nl { font-weight: 700; margin-top: 10px; font-size: .92rem; text-align: center; max-width: 160px; }
.go { position: absolute; top: -26px; white-space: nowrap; background: var(--blue); color: #fff; font-size: .7rem; font-weight: 800; padding: 3px 9px; border-radius: 8px; letter-spacing: .04em; }
@keyframes pulse { 50% { transform: scale(1.07); } }

/* Lição em cartões */
.lesson-top { display: flex; align-items: center; gap: 12px; }
.lesson-top .link { font-size: 1.4rem; margin: 0; text-decoration: none; color: var(--muted); }
.grow { flex: 1; margin: 0; }
.lcard { background: #fff; border-radius: 22px; box-shadow: var(--sh); padding: 30px 26px; margin: 18px auto; max-width: 620px; text-align: center; animation: slidein .25s ease-out; }
.lcard.wide { max-width: 100%; }
.lcard .lic { font-size: 4rem; line-height: 1.1; }
.lcard .pt { font-size: 1.3rem; line-height: 1.5; }
.lcard .mod { color: var(--blue2); font-weight: 800; text-transform: uppercase; font-size: .8rem; letter-spacing: .05em; }
.lcard.trick { background: #fff8de; }
.lcard #ck { text-align: left; }
.lnav { max-width: 620px; margin: 0 auto; }
@keyframes slidein { from { opacity: 0; transform: translateX(30px); } }
.mindmap { width: 100%; height: auto; display: block; }
.mapcard { page-break-inside: avoid; }

/* Jogos: lista */
.gcard { text-align: center; position: relative; overflow: hidden; }
.gcard.hot { background: linear-gradient(160deg, #fff, #fff4c4); }
.gico { font-size: 3.4rem; transition: transform .2s; }
.gcard:hover .gico { transform: scale(1.2) rotate(-8deg); }
.play { display: inline-block; margin-top: 12px; background: var(--ok); color: #fff; font-weight: 800; padding: 7px 18px; border-radius: 99px; box-shadow: 0 4px 0 #117044; }
.gprompt { background: var(--bg); border-radius: 14px; padding: 10px 14px; margin: 10px 0; min-height: 52px; display: flex; gap: 12px; align-items: center; justify-content: center; font-size: 1.1rem; }
.gp-sign svg { display: block; }
.gameover { text-align: center; padding: 10px; }
.stars { font-size: 2.6rem; margin: 0; letter-spacing: 6px; }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 50; overflow: hidden; }
.confetti i { position: absolute; top: -12px; width: 10px; height: 14px; border-radius: 2px; animation: fall linear forwards; }
@keyframes fall { to { top: 105vh; transform: rotate(720deg); } }
.btn.okb { background: var(--ok); }
.btn.pad { min-width: 110px; font-size: 1.6rem; touch-action: manipulation; }

/* Corrida */
.race-box { position: relative; max-width: 360px; margin: 0 auto; }
.race-box canvas { height: min(560px, 54vh); width: auto; max-width: 100%; aspect-ratio: 360 / 560; display: block; margin: 0 auto; border-radius: 18px; touch-action: manipulation; }
.race-wrap .gprompt { min-height: 90px; }
.overlay { position: absolute; inset: 0; background: rgba(11, 61, 145, .88); color: #fff; border-radius: 18px; display: grid; place-content: center; padding: 20px; }

/* Balões */
.sky { position: relative; height: 440px; border-radius: 18px; overflow: hidden; background: linear-gradient(#8fd3ff, #e6f6ff 70%, #b8e39b 70%); }
.balloon { position: absolute; left: 0; top: 0; width: 100px; height: 122px; border: 0; background: none; cursor: pointer; padding: 0; transition: opacity .25s; }
.balloon span { display: grid; place-items: center; width: 100px; height: 112px; border-radius: 50% 50% 46% 46%; background: radial-gradient(circle at 32% 28%, #ffffff88, transparent 30%), var(--c); color: #fff; font-weight: 800; font-size: .92rem; padding: 10px; text-shadow: 0 1px 2px #0006; box-shadow: inset -8px -10px 0 #0002; }
.balloon::after { content: ''; position: absolute; left: 49px; top: 110px; width: 2px; height: 40px; background: #666; }
.balloon.popped { opacity: 0; transform: scale(1.6) !important; transition: opacity .3s, transform .3s; }
.balloon.bad span { background: #999; }

/* Cruzamento animado */
.cross-box { position: relative; max-width: 360px; margin: 0 auto; }
.cross-box .cross { max-width: 100%; }
.cross .car { cursor: pointer; transition: transform 1s ease-in; }
.cross .car:hover { filter: brightness(1.15) drop-shadow(0 0 4px #ffc72c); }
.boom { position: absolute; left: 50%; top: 50%; font-size: 5rem; transform: translate(-50%, -50%) scale(0); transition: transform .2s; pointer-events: none; }
.boom.on { transform: translate(-50%, -50%) scale(1); }

/* Arruma os sinais */
.tray { min-height: 120px; display: grid; place-items: center; }
.drag { cursor: grab; touch-action: none; user-select: none; animation: bob 1.4s ease-in-out infinite; }
.drag.dragging { cursor: grabbing; animation: none; z-index: 10; position: relative; }
@keyframes bob { 50% { transform: translateY(-6px); } }
.bins { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; margin-top: 10px; }
.bin { min-height: 110px; border: 3px dashed #b5bdd0; border-radius: 16px; background: var(--bg); cursor: pointer; font-size: .95rem; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 6px; color: var(--ink); }
.bin .got { display: flex; flex-wrap: wrap; gap: 3px; justify-content: center; }
.bin.flash-ok { border-color: var(--ok); background: var(--okbg); }
.shake { animation: shake .4s; border-color: var(--bad) !important; }
@keyframes shake { 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }

/* Desliza V/F */
.deck { height: 230px; display: grid; place-items: center; margin: 10px 0; }
.swipe { position: relative; width: min(340px, 90%); min-height: 190px; background: #fff; border-radius: 22px; box-shadow: 0 8px 24px rgba(16, 33, 62, .18); display: grid; place-items: center; padding: 24px; font-size: 1.25rem; font-weight: 700; touch-action: none; cursor: grab; user-select: none; transition: transform .35s, opacity .35s; }
.swipe .lbl { position: absolute; top: 12px; font-weight: 900; font-size: .9rem; padding: 3px 8px; border-radius: 8px; border: 3px solid; opacity: 0; transition: opacity .15s; }
.swipe .lbl.l { left: 12px; color: var(--bad); }
.swipe .lbl.r { right: 12px; color: var(--ok); }
.swipe.to-l .lbl.l, .swipe.to-r .lbl.r { opacity: 1; }

/* Conta e compra */
.acc { color: #fff; text-decoration: none; background: rgba(255, 255, 255, .15); padding: 2px 10px; border-radius: 99px; }
.tabs { display: flex; gap: 6px; background: var(--bg); padding: 5px; border-radius: 12px; }
.tab { flex: 1; border: 0; background: none; padding: 10px; border-radius: 9px; font-weight: 700; font-size: .95rem; cursor: pointer; color: var(--muted); }
.tab.on { background: #fff; color: var(--blue); box-shadow: var(--sh); }
.price { font-size: 2.8rem; font-weight: 900; color: var(--blue); margin: 10px 0; display: grid; }
.price small { font-size: .9rem; font-weight: 600; color: var(--muted); }
.points.left { text-align: left; }
.small { font-size: .82rem; }
.unlock { background: linear-gradient(160deg, #fff, #fff4c4); margin-top: 20px; }
.gcard.locked { filter: grayscale(.7); opacity: .85; }
.gcard.locked .play { background: var(--muted); box-shadow: 0 4px 0 #3b4252; }
.node.locked .bub { background: #e6e9f0; box-shadow: 0 7px 0 #c3c9d6; font-size: 1.8rem; }
.node.locked .nl { color: var(--muted); }

@media print {
  header, nav, .no-print, .lnav, .lesson-top { display: none !important; }
  body { background: #fff; padding: 0; }
  .panel { box-shadow: none; }
}

@media (max-width: 700px) {
  .bub { width: 70px; height: 70px; font-size: 2rem; }
  .node { transform: translateX(calc(var(--off) * .6)); }
  .lcard { padding: 24px 16px; }
  .lcard .pt { font-size: 1.15rem; }
  .sky { height: 400px; }
  .balloon, .balloon span { width: 84px; }
  .balloon::after { left: 41px; }
  .hud .mute { display: none; }
  .hero { grid-template-columns: 1fr; padding: 24px; }
  .hero h1 { font-size: 1.8rem; }
  .hero-signs .sign { width: 64px; height: 64px; }
  nav { position: fixed; top: auto; bottom: 0; left: 0; right: 0; justify-content: space-around; padding: 4px; }
  nav a { flex-direction: column; gap: 0; padding: 6px 6px; font-size: .7rem; }
  nav a { font-size: 1.2rem; }
  nav a span { font-size: .68rem; }
  .q { flex-direction: column; text-align: center; }
  .hud { gap: 8px; font-size: .8rem; }
  .memory { grid-template-columns: repeat(3, 1fr); }
}
