:root {
  --navy:#243b62;
  --navy-dark:#142540;
  --purple:#604b82;
  --purple-dark:#3c315b;
  --gold:#e7ad3f;
  --gold-dark:#a86922;
  --orange:#ef7d2e;
  --green:#478767;
  --cream:#fff8e9;
  --ink:#243852;
  --shadow:0 18px 48px rgba(25,38,67,.22);
}

* { box-sizing:border-box; }
html,body,#app { width:100%; min-height:100%; margin:0; }
body { color:var(--ink); background:#e8e2d8; font-family:"Nunito","Trebuchet MS",sans-serif; overscroll-behavior:none; }
button { font:inherit; -webkit-tap-highlight-color:transparent; }
button:focus-visible { outline:4px solid #ffe088; outline-offset:3px; }
.screen { display:none; min-height:100vh; }
.screen.active { display:block; }
.circle-button { width:46px; height:46px; border:0; border-radius:50%; color:var(--navy); background:white; box-shadow:0 4px 15px #1b30472b; font-size:20px; cursor:pointer; }
.primary-button { border:0; border-radius:17px; padding:16px 24px; color:white; background:linear-gradient(#f7b649,#e17a2d); box-shadow:0 6px 0 #a95723,0 13px 26px #9d481e3d; font-weight:900; letter-spacing:.03em; cursor:pointer; transition:.15s transform,.15s box-shadow; }
.primary-button:hover { transform:translateY(-2px); }
.primary-button:active { transform:translateY(4px); box-shadow:0 2px 0 #a95723; }
.chapter-tag { display:block; width:max-content; padding:7px 11px; border-radius:999px; color:#74511c; background:#ffefb5; font-size:9px; font-weight:900; letter-spacing:.13em; }
.legal-copy { margin:25px auto 0; color:#6f776f; font-size:10px; font-weight:700; text-align:center; }

/* Tela inicial */
.home-screen { padding:9px 16px 25px; background:linear-gradient(180deg,#fffdf7,#eee7d9); }
.brand-bar { max-width:1160px; height:68px; margin:auto; display:flex; align-items:center; gap:12px; }
.mini-logo { width:48px; height:48px; overflow:hidden; border:3px solid white; border-radius:50%; box-shadow:0 4px 13px #27475b28; }
.mini-logo img { width:100%; height:100%; object-fit:cover; }
.brand-copy { display:flex; flex-direction:column; }
.brand-copy strong { color:var(--navy); font-size:18px; font-weight:900; }
.brand-copy small { color:#7b7d72; font-size:8px; font-weight:900; letter-spacing:.14em; }
.brand-bar .circle-button { margin-left:auto; }
.hero-panel { position:relative; max-width:1160px; min-height:535px; margin:auto; overflow:hidden; border:6px solid white; border-radius:35px; background:#b69d70 url("assets/background-babilonia.png") center/cover no-repeat; box-shadow:var(--shadow); }
.hero-shade { position:absolute; inset:0; background:linear-gradient(90deg,rgba(255,251,237,.98) 0 49%,rgba(255,246,220,.62) 62%,rgba(40,39,62,.07)); }
.hero-copy { position:relative; z-index:5; width:61%; padding:49px 0 43px 55px; }
.hero-copy h1 { margin:17px 0; color:var(--navy); font-size:clamp(39px,4.8vw,64px); line-height:.98; letter-spacing:-.045em; }
.hero-copy h1 em { color:#9b6230; font-style:normal; }
.hero-copy>p { max-width:585px; margin:0; color:#526372; font-size:16px; font-weight:700; line-height:1.55; }
.age-label { margin:22px 0 8px; color:#6b6e67; font-size:10px; font-weight:900; letter-spacing:.12em; }
.age-options { display:flex; flex-wrap:wrap; gap:7px; margin-bottom:21px; }
.age-options button { border:2px solid white; border-radius:999px; padding:8px 12px; color:#535d49; background:#ffffffd4; font-size:11px; font-weight:900; cursor:pointer; }
.age-options button.selected { color:white; border-color:var(--purple-dark); background:var(--purple-dark); }
.home-hint { display:block; margin:13px 0 0 8px; color:#6b746d; font-size:10px; font-weight:800; }
.hero-characters { position:absolute; z-index:3; inset:0 0 0 56%; }
.daniel-preview { position:absolute; z-index:4; left:0; bottom:7px; width:195px; height:390px; display:block; background:url("assets/daniel-sprites.png") 0 0/400% 100% no-repeat; filter:drop-shadow(0 11px 7px #4b321f55); }
.lion-preview { position:absolute; z-index:3; bottom:18px; font-size:135px; line-height:1; filter:drop-shadow(0 10px 7px #33231b55); }
.lion-one { right:112px; }
.lion-two { right:-10px; transform:scale(.82); }
.hero-bubble { position:absolute; z-index:6; right:21px; top:29px; width:238px; padding:14px 17px; border-radius:20px; color:var(--navy); background:white; box-shadow:0 8px 22px #204f662b; text-align:center; font-size:13px; font-weight:900; }
.hero-bubble::after { content:""; position:absolute; left:34px; bottom:-13px; border:14px solid transparent; border-top-color:white; border-left:0; }
.benefit-row { max-width:1080px; margin:20px auto 0; display:grid; grid-template-columns:repeat(3,1fr); gap:12px; }
.benefit-row article { display:flex; align-items:center; gap:12px; padding:10px 16px; }
.benefit-row article>span { width:52px; height:52px; flex:0 0 auto; display:grid; place-items:center; border-radius:17px; background:white; box-shadow:0 5px 17px #173b5715; font-size:28px; }
.benefit-row strong,.benefit-row small { display:block; }
.benefit-row strong { color:var(--navy); font-size:16px; font-weight:900; }
.benefit-row small { color:#747e83; font-size:10px; font-weight:800; }

/* Introdução */
.intro-screen { position:relative; overflow:hidden; background:#111; }
.intro-screen.active { display:grid; place-items:end center; }
.classroom { position:absolute; inset:0; width:100%; height:100%; object-fit:cover; object-position:center; }
.story-shade { position:absolute; inset:0; background:linear-gradient(transparent 25%,rgba(15,31,55,.84)); }
.story-card { position:relative; z-index:2; width:min(920px,calc(100% - 32px)); min-height:195px; margin:0 auto 35px; display:grid; grid-template-columns:180px 1fr; align-items:end; border:5px solid white; border-radius:28px; background:#fffdf4ed; box-shadow:0 20px 50px #00000054; backdrop-filter:blur(8px); }
.sprite { display:block; background-repeat:no-repeat; background-position:0 0; }
.tio-sprite { background-image:url("assets/animations/tio-calvino-talk-v2.png"); background-size:400% 100%; }
.story-tio { width:126px; height:282px; align-self:end; margin:-92px auto 0; filter:drop-shadow(0 7px 5px #4025112e); }
.tio-sprite.talking { animation:spriteFour .95s linear infinite; }
.story-card>div { padding:22px 28px 23px; }
.speaker { color:#bd642d; font-size:9px; font-weight:900; letter-spacing:.18em; }
.story-card p { margin:7px 0 18px; color:var(--navy); font-size:18px; line-height:1.48; font-weight:800; }
.story-card .primary-button { padding:12px 18px; font-size:11px; }

/* Jogo */
.game-screen { padding-bottom:112px; background:#eee8de; }
.game-header { position:relative; z-index:20; height:72px; display:flex; align-items:center; gap:13px; padding:9px clamp(11px,3vw,36px); background:white; box-shadow:0 5px 18px #12334829; }
.game-header .circle-button { background:#edf1eb; box-shadow:none; }
.game-title { display:flex; flex-direction:column; }
.game-title small { color:#a76a2f; font-size:8px; font-weight:900; letter-spacing:.16em; }
.game-title strong { color:var(--navy); font-size:15px; font-weight:900; }
.score { margin-left:auto; display:flex; align-items:center; gap:5px; padding:7px 11px; border-radius:99px; color:#8d6212; background:#fff5ca; }
.score span { font-size:18px; }
.score strong { font-size:12px; }
.progress { display:flex; align-items:center; gap:8px; }
.progress>span { color:#467c63; font-size:11px; font-weight:900; }
.progress>div { width:min(16vw,165px); height:10px; overflow:hidden; border-radius:99px; background:#e0e5dc; }
.progress i { display:block; width:0; height:100%; border-radius:99px; background:linear-gradient(90deg,#5f8c79,#e7ad3f); transition:.35s; }
.world { position:relative; height:min(58vh,535px); min-height:370px; overflow:hidden; border-bottom:8px solid #735037; outline:0; background:#b99e6e url("assets/background-babilonia.png") center 70%/cover no-repeat; }
.world.phase-1 { filter:saturate(.96) brightness(1.05); }
.world.phase-2 { background-position:center 54%; filter:saturate(.86) sepia(.08); }
.world.phase-3 { background-position:center 35%; filter:saturate(.8) brightness(.96); }
.world.phase-4 { background-position:center 84%; filter:saturate(.65) brightness(.78) hue-rotate(8deg); }
.world.phase-5 { background-image:url("assets/background-cova-leoes.png"); background-position:center; filter:none; border-bottom-color:#3b3148; }
.scene-tint { position:absolute; inset:0; pointer-events:none; background:linear-gradient(transparent 60%,rgba(52,39,30,.16)); }
.phase-4 .scene-tint { background:linear-gradient(rgba(30,35,65,.16),rgba(33,29,50,.32)); }
.phase-5 .scene-tint { background:linear-gradient(transparent 52%,rgba(24,19,39,.16)); }
.object-layer,.obstacle-layer { position:absolute; inset:0; }
.mission-object { position:absolute; bottom:34px; min-width:78px; display:grid; justify-items:center; padding:8px; border:0; background:transparent; cursor:pointer; transform:translateX(-50%); transition:.25s transform,.25s opacity; }
.mission-object>span { width:62px; height:62px; display:grid; place-items:center; border:4px solid #fff; border-radius:21px; background:#fff8d2; box-shadow:0 8px 17px #3a2c1d42; font-size:37px; }
.mission-object small { margin-top:5px; padding:4px 8px; border-radius:99px; color:white; background:#243b62d9; font-size:8px; font-weight:900; white-space:nowrap; }
.mission-object.near>span { animation:pulse 1s infinite; box-shadow:0 0 0 8px #ffe17c66,0 8px 17px #3a2c1d42; }
.mission-object.collected { opacity:0; pointer-events:none; transform:translate(-50%,-75px) scale(.45); }
.obstacle { position:absolute; bottom:24px; width:72px; text-align:center; font-size:58px; filter:drop-shadow(0 7px 4px #3b2d204f); transform:translateX(-50%); }
.obstacle small { display:block; margin-top:-9px; color:#513b28; font-size:8px; font-weight:900; }
.player { position:absolute; z-index:8; left:6%; bottom:20px; width:118px; height:235px; margin-left:-59px; transform-origin:center bottom; transition:.12s left; filter:drop-shadow(0 8px 5px #3c2b2047); }
.player.left { transform:scaleX(-1); }
.player.right { transform:scaleX(1); }
.player.jumping { animation:jump .62s ease-in-out; }
.daniel-sprite { width:100%; height:100%; display:block; background:url("assets/daniel-sprites.png") 0 0/400% 100% no-repeat; }
.player.walking .daniel-sprite { animation:danielWalk .58s steps(1) infinite; }
.player>i { position:absolute; z-index:-1; left:17%; right:17%; bottom:-4px; height:14px; border-radius:50%; background:#2b243842; }
.lion-group { position:absolute; z-index:4; right:2%; bottom:24px; width:350px; height:175px; display:flex; align-items:flex-end; justify-content:center; letter-spacing:-28px; filter:drop-shadow(0 10px 6px #17112380); }
.lion-group[hidden] { display:none; }
.lion-group span { display:block; font-size:118px; line-height:1; transition:.5s transform,.5s filter; }
.lion-group span:nth-child(2) { position:relative; z-index:2; font-size:138px; }
.lion-group.sleeping span { transform:translateY(13px) rotate(-4deg) scaleY(.78); filter:saturate(.72) brightness(.92); }
.nearby-button { position:absolute; z-index:14; left:50%; bottom:22px; padding:10px 15px; border:3px solid white; border-radius:99px; color:white; background:var(--orange); box-shadow:0 5px 12px #52351f47; font-size:10px; font-weight:900; transform:translateX(-50%); cursor:pointer; }
.nearby-button[hidden] { display:none; }
.mission-area { display:grid; grid-template-columns:1fr 1.25fr; gap:12px; padding:11px clamp(10px,3vw,35px); background:#f7f1e8; }
.dialog-box { min-height:78px; display:flex; align-items:center; gap:10px; padding:8px 12px; border:3px solid white; border-radius:18px; background:#fffaf0; box-shadow:0 5px 15px #30384b12; }
.dialog-tio { width:30px; height:67px; flex:0 0 auto; }
.dialog-box p { flex:1; margin:0; font-size:12px; line-height:1.4; font-weight:700; }
.listen-button { width:37px; height:37px; flex:0 0 auto; border:0; border-radius:50%; background:#e8edf4; cursor:pointer; }
.quest-list { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:7px; }
.quest-list article { min-width:0; display:flex; align-items:center; gap:7px; padding:7px 8px; border:2px solid white; border-radius:14px; background:#eeeae2; }
.quest-list article>span { font-size:22px; }
.quest-list article>div { min-width:0; flex:1; }
.quest-list strong,.quest-list small { display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.quest-list strong { color:#4f5867; font-size:9px; }
.quest-list small { color:#7c8287; font-size:7px; }
.quest-list b { color:#a9ada8; }
.quest-list article.done { background:#e1f1e7; }
.quest-list article.done b { color:#3b8c60; }
.quest-list article.done b::after { content:"✓"; }
.quest-list article.done b { font-size:0; }
.quest-list article.done b::after { font-size:14px; }
.touch-controls { position:fixed; z-index:30; left:0; right:0; bottom:0; height:96px; display:flex; justify-content:center; align-items:center; gap:12px; padding:8px 18px max(8px,env(safe-area-inset-bottom)); background:#243b62f2; box-shadow:0 -7px 22px #15263b3b; }
.touch-controls button { width:61px; height:61px; border:3px solid #ffffff80; border-radius:20px; color:white; background:#3e567a; box-shadow:0 5px 0 #172943; font-size:23px; font-weight:900; cursor:pointer; touch-action:none; }
.touch-controls .action,.touch-controls .jump { width:78px; height:78px; border-radius:25px; background:#d57a33; }
.touch-controls .action { background:#5a8d70; }
.touch-controls span,.touch-controls small { display:block; }
.touch-controls small { margin-top:1px; font-size:7px; letter-spacing:.08em; }

/* Desafios */
.modal[hidden] { display:none; }
.modal { position:fixed; z-index:70; inset:0; display:grid; place-items:center; padding:18px; background:rgba(16,25,46,.78); backdrop-filter:blur(7px); }
.modal-card { width:min(550px,100%); max-height:calc(100vh - 36px); overflow:auto; padding:27px; border:5px solid white; border-radius:28px; background:#fffaf0; box-shadow:0 22px 70px #0007; text-align:center; }
.modal-card .chapter-tag { margin:auto; }
.quiz-icon { width:72px; height:72px; margin:-4px auto 13px; display:grid; place-items:center; border-radius:23px; background:#eee5ff; font-size:40px; }
.modal-card h2 { margin:12px 0 8px; color:var(--navy); font-size:30px; }
.modal-card>p { color:#5c6975; line-height:1.45; font-weight:700; }
.answer-options,.puzzle-options { display:grid; gap:9px; margin-top:18px; }
.answer-options button,.puzzle-options button { border:2px solid #ded7ca; border-radius:14px; padding:13px 15px; color:var(--navy); background:white; font-weight:900; cursor:pointer; }
.answer-options button:hover,.puzzle-options button:hover { border-color:#9b83bd; transform:translateY(-1px); }
.answer-options button.correct { color:white; border-color:#3f8a61; background:#4e9b70; }
.answer-options button.wrong { color:#923d34; border-color:#e8a89e; background:#ffe0da; }
.puzzle-options button.used { opacity:.42; pointer-events:none; }
.puzzle-track { min-height:46px; margin:13px 0 0; padding:10px; border-radius:14px; color:#5b4b7c; background:#eee7f7; font-size:12px; font-weight:900; }
.feedback { min-height:22px; margin:12px 0 0; color:#7b5d20!important; font-size:12px; }
.light-meter { position:relative; height:39px; margin:21px 0; overflow:hidden; border:5px solid white; border-radius:99px; background:linear-gradient(90deg,#513f70 0 40%,#f2c454 40% 60%,#513f70 60%); box-shadow:inset 0 0 0 2px #ddd2bb; }
.light-meter i { position:absolute; inset:0; background:linear-gradient(90deg,transparent,#ffffff35,transparent); }
.light-meter b { position:absolute; left:0; top:-7px; width:10px; height:48px; border-radius:6px; background:white; box-shadow:0 0 14px #fff; }
.phase-card .quiz-icon { background:#e4f4e9; }

/* Final */
.finish-screen { position:relative; padding:45px 18px 75px; overflow:hidden; background:radial-gradient(circle at 50% 22%,#fff7ca,#cebde7 45%,#48537b); }
.finish-screen.active { display:grid; place-items:center; }
.stars { position:absolute; top:6%; color:#fff1a2; font-size:52px; letter-spacing:8vw; opacity:.8; animation:floatStars 2.4s ease-in-out infinite; }
.finish-card { position:relative; z-index:2; width:min(590px,100%); padding:31px; border:6px solid white; border-radius:34px; background:#fffaf2ee; box-shadow:0 24px 70px #17213b5c; text-align:center; backdrop-filter:blur(8px); }
.medal { font-size:65px; }
.finish-card .chapter-tag { margin:4px auto; }
.finish-card h2 { margin:14px 0 8px; color:var(--navy); font-size:36px; }
.finish-card>p { color:#596675; line-height:1.5; font-weight:700; }
.finish-card blockquote { margin:18px 0; padding:15px; border-radius:16px; color:#f9f1ff; background:var(--purple-dark); font-size:14px; font-weight:800; }
.finish-card cite { display:block; margin-top:6px; color:#f1c862; font-size:9px; font-style:normal; letter-spacing:.12em; }
.final-score { margin:14px auto; }
.final-score small,.final-score strong { display:block; }
.final-score small { color:#7c7b77; font-size:8px; font-weight:900; letter-spacing:.14em; }
.final-score strong { color:#8b6119; font-size:17px; }
.badge { width:max-content; max-width:100%; margin:14px auto 22px; padding:9px 17px; display:flex; align-items:center; gap:11px; border:2px solid #b9a2d3; border-radius:17px; background:#f0eafb; text-align:left; }
.badge>span { font-size:36px; }
.badge small,.badge strong { display:block; }
.badge small { color:#6d5a8d; font-size:7px; font-weight:900; letter-spacing:.13em; }
.badge strong { color:#4f3c70; }
.finish-card .primary-button { margin-right:7px; padding:13px 19px; font-size:11px; }
.secondary-button { border:0; padding:13px 16px; color:#5b6d76; background:transparent; font-size:10px; font-weight:900; cursor:pointer; }
.finish-legal { position:absolute; bottom:12px; left:15px; right:15px; color:#eef0fb; }

@keyframes spriteFour { 0%,24%{background-position:0 0} 25%,49%{background-position:33.333% 0} 50%,74%{background-position:66.666% 0} 75%,100%{background-position:100% 0} }
@keyframes danielWalk { 0%,49%{background-position:0 0} 50%,100%{background-position:33.333% 0} }
@keyframes pulse { 50%{transform:translateY(-8px) scale(1.05)} }
@keyframes jump { 0%,100%{bottom:20px} 50%{bottom:135px} }
@keyframes floatStars { 50%{transform:translateY(12px); opacity:1} }

@media (max-width:850px) {
  .home-screen { padding:5px 9px 24px; }
  .brand-bar { height:59px; padding:0 5px; }
  .mini-logo { width:43px; height:43px; }
  .brand-copy strong { font-size:16px; }
  .hero-panel { min-height:760px; border-width:4px; border-radius:26px; }
  .hero-shade { background:linear-gradient(180deg,rgba(255,250,235,.98) 0 58%,rgba(255,246,220,.38) 73%,rgba(40,39,62,.04)); }
  .hero-copy { width:100%; padding:32px 22px 385px; text-align:center; }
  .hero-copy .chapter-tag { margin:auto; }
  .hero-copy>p { margin-left:auto; margin-right:auto; }
  .age-options { justify-content:center; }
  .hero-characters { inset:auto 0 0; height:380px; }
  .daniel-preview { left:13%; width:165px; height:330px; }
  .lion-preview { bottom:24px; font-size:115px; }
  .lion-one { right:18%; }
  .lion-two { right:2%; }
  .hero-bubble { right:5%; top:-4px; width:210px; font-size:11px; }
  .benefit-row { grid-template-columns:1fr; gap:1px; padding:0 10px; }
  .benefit-row article { padding:6px 12px; }
  .story-card { grid-template-columns:120px 1fr; margin-bottom:18px; }
  .story-tio { width:83px; height:185px; }
  .story-card>div { padding:15px 14px; }
  .story-card p { font-size:14px; }
  .game-header { height:63px; gap:7px; }
  .game-header .circle-button { width:39px; height:39px; font-size:17px; }
  .game-title strong { max-width:180px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:11px; }
  .score { padding:5px 7px; }
  .progress>span { display:none; }
  .progress>div { width:65px; }
  .world { height:51vh; min-height:365px; }
  .player { width:89px; height:178px; margin-left:-44px; }
  .lion-group { width:274px; height:159px; }
  .lion-group span { font-size:94px; }
  .lion-group span:nth-child(2) { font-size:110px; }
  .mission-object>span { width:53px; height:53px; font-size:31px; }
  .obstacle { font-size:48px; }
  .mission-area { grid-template-columns:1fr; gap:7px; padding:9px; }
  .dialog-box { min-height:62px; padding:6px 9px; }
  .dialog-tio { width:23px; height:51px; }
  .dialog-box p { font-size:10px; }
  .quest-list { gap:4px; }
  .quest-list article { padding:4px; }
  .quest-list small { display:none; }
}

@media (max-width:520px) {
  .hero-copy h1 { font-size:37px; }
  .hero-copy { padding-bottom:340px; }
  .hero-panel { min-height:735px; }
  .daniel-preview { left:0; width:143px; height:285px; }
  .lion-preview { font-size:96px; }
  .lion-one { right:13%; }
  .lion-two { right:-5%; }
  .hero-bubble { right:6px; width:190px; }
  .world { min-height:340px; }
  .player { width:74px; height:148px; margin-left:-37px; }
  .lion-group { width:210px; height:122px; }
  .lion-group span { font-size:72px; }
  .lion-group span:nth-child(2) { font-size:84px; }
  .game-title strong { max-width:120px; }
  .score span { display:none; }
  .mission-object { min-width:58px; }
  .mission-object>span { width:45px; height:45px; font-size:27px; }
  .mission-object small { font-size:7px; }
  .obstacle { font-size:41px; }
  .quest-list strong { display:none; }
  .quest-list article { justify-content:center; }
  .quest-list article>div { display:none; }
  .touch-controls { gap:7px; padding:7px 9px; }
  .touch-controls button { width:51px; height:51px; }
  .touch-controls .action,.touch-controls .jump { width:63px; height:63px; }
  .modal-card { padding:22px 18px; }
  .modal-card h2 { font-size:26px; }
  .finish-card .primary-button { margin:0 0 7px; }
  .finish-legal { font-size:8px; }
}

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