:root {
  --cream: #fff3d6;
  --cream-2: #f8e5b8;
  --paper: #fffaf0;
  --ink: #2b1e18;
  --muted: #765f50;
  --forest: #1f6b4f;
  --forest-dark: #144c39;
  --orange: #f47b20;
  --orange-dark: #d95c12;
  --gold: #efb62e;
  --rust: #aa341f;
  --red: #c93b27;
  --green: #2f8b55;
  --line: rgba(69, 47, 31, .17);
  --shadow: 0 18px 45px rgba(38, 28, 19, .22);
  --radius: 26px;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: #f4dfb8; color: var(--ink); }
body {
  font-family: ui-rounded, "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
  min-height: 100dvh;
  background:
    radial-gradient(circle at 82% 14%, rgba(239,182,46,.22), transparent 28%),
    linear-gradient(135deg, #f7e8c6, #edd3a0);
  overflow-x: hidden;
}
button, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }

.desktop-portrait {
  display: none;
}

.app-shell {
  width: min(100%, 480px);
  min-height: 100dvh;
  margin: 0 auto;
  background: var(--cream);
  position: relative;
  overflow: hidden;
}

.app-shell::after {
  content: "";
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: max(10px, env(safe-area-inset-bottom));
  pointer-events: none;
  background: transparent;
}

.screen {
  min-height: 100dvh;
  padding: calc(18px + env(safe-area-inset-top)) 18px calc(22px + env(safe-area-inset-bottom));
  background:
    radial-gradient(circle at 14% 12%, rgba(255,255,255,.75), transparent 28%),
    linear-gradient(180deg, #fff4d9 0%, #f8e4b7 100%);
  position: relative;
  animation: enter .25s ease-out;
}

@keyframes enter { from { opacity: .2; transform: translateY(7px);} to {opacity:1; transform:none;} }

.pattern-strip {
  height: 24px;
  margin: 18px -18px -22px;
  background:
    linear-gradient(45deg, transparent 38%, #1c6049 39% 61%, transparent 62%) 0 0/32px 18px,
    linear-gradient(-45deg, transparent 38%, #e76f24 39% 61%, transparent 62%) 16px 0/32px 18px,
    #efb62e;
  border-top: 4px solid #2c241e;
}

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.back-btn, .icon-btn {
  border: 0; width: 42px; height: 42px; border-radius: 50%;
  background: rgba(255,255,255,.62); color: var(--ink); font-weight: 900; font-size: 20px;
  box-shadow: 0 5px 16px rgba(60,40,24,.12); cursor: pointer;
}
.kicker { color: var(--muted); font-size: 13px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }

.home-screen { padding-top: calc(24px + env(safe-area-inset-top)); }
.crown { font-size: 42px; line-height: 1; text-align: center; margin-top: 2px; filter: drop-shadow(0 2px 0 rgba(111,67,19,.18)); }
.brand { text-align: center; margin: 4px auto 10px; line-height: .95; }
.brand strong { display: block; font-family: Georgia, serif; font-size: clamp(38px, 11vw, 52px); letter-spacing: -2px; }
.brand span { display: block; font-family: Georgia, serif; font-style: italic; font-size: 21px; margin-top: 7px; }
.quiz-word { text-align: center; letter-spacing: .33em; font-weight: 900; margin: 10px 0 16px; }

.hero-card {
  height: 310px;
  border-radius: 28px;
  overflow: hidden;
  position: relative;
  box-shadow: var(--shadow);
  background: #d59c49 url('assets/hero_girl.jpg') center 31%/cover no-repeat;
  border: 1px solid rgba(72,47,27,.18);
}
.hero-card::after {
  content: ""; position: absolute; inset: 55% 0 0;
  background: linear-gradient(180deg, transparent, rgba(20,76,57,.94));
}
.hero-message {
  position: absolute; z-index: 1; left: 18px; right: 18px; bottom: 18px;
  color: #fff8e7; text-align: center; font-weight: 800; font-size: 14px;
}

.btn {
  width: 100%; border: 0; border-radius: 999px; min-height: 52px; padding: 12px 18px;
  font-weight: 900; cursor: pointer; transition: .16s ease; box-shadow: 0 8px 20px rgba(83,48,19,.12);
}
.btn:active { transform: translateY(2px) scale(.995); }
.btn-primary { color: white; background: linear-gradient(180deg, #ff8a25, var(--orange)); border: 1px solid #c94f0f; }
.btn-secondary { color: white; background: linear-gradient(180deg, #466f38, #2f5829); border: 1px solid #21421e; }
.btn-ghost { background: rgba(255,255,255,.6); color: var(--ink); border: 1px solid rgba(70,45,28,.35); box-shadow: none; }
.btn-danger { background: #a93827; color: #fff; }
.home-actions { display: grid; gap: 10px; margin-top: 16px; }
.home-footer { text-align: center; color: var(--forest-dark); font-size: 13px; font-weight: 800; margin: 14px 0 0; }

.section-title { margin: 0; font-size: 27px; line-height: 1.05; }
.section-subtitle { margin: 4px 0 18px; color: var(--muted); font-size: 14px; }
.chapter-list { display: grid; gap: 9px; }
.chapter-card {
  display: grid; grid-template-columns: 46px 1fr auto; align-items: center; gap: 11px;
  padding: 11px 12px; border: 1px solid rgba(151,101,40,.18); border-radius: 16px;
  background: linear-gradient(90deg, rgba(255,255,255,.76), rgba(255,226,171,.7));
  box-shadow: 0 5px 15px rgba(82,52,29,.08); cursor: pointer;
}
.chapter-icon { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: #f0bd55; font-size: 23px; }
.chapter-card h3 { margin: 0; font-size: 15px; }
.chapter-card p { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
.chapter-meta { text-align: right; min-width: 70px; }
.stars { color: #cf8a00; letter-spacing: 1px; font-size: 12px; white-space: nowrap; }
.best { color: var(--forest-dark); font-size: 11px; font-weight: 800; margin-top: 2px; }

.special-card {
  margin-top: 12px; padding: 14px; border-radius: 18px; display: grid; grid-template-columns: 46px 1fr auto; gap: 10px; align-items: center;
  background: linear-gradient(135deg, #f5bb48, #ef8a2e); color: #3b2419; border: 1px solid rgba(89,53,24,.3); box-shadow: 0 8px 20px rgba(91,54,27,.15); cursor: pointer;
}
.special-card.review { background: linear-gradient(135deg, #f8ead0, #f5d1a5); }
.special-card strong { display: block; }
.special-card small { display: block; margin-top: 2px; }

.stats-bar { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0 16px; }
.stat { background: rgba(255,255,255,.62); border: 1px solid var(--line); border-radius: 14px; padding: 9px; text-align: center; }
.stat b { display: block; font-size: 18px; color: var(--forest-dark); }
.stat span { display: block; font-size: 10px; color: var(--muted); margin-top: 2px; }

.quiz-screen { background: linear-gradient(180deg, #fff2d3 0%, #fae7c2 100%); }
.quiz-header { text-align: center; flex: 1; }
.quiz-header h2 { margin: 0; font-size: 18px; }
.quiz-header p { margin: 2px 0 0; font-size: 12px; color: var(--muted); }
.progress-wrap { margin: 7px 0 8px; }
.progress-label { text-align: center; font-size: 12px; font-weight: 800; margin-bottom: 7px; }
.progress { height: 7px; border-radius: 999px; background: rgba(52,47,39,.16); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: inherit; background: var(--forest); transition: width .25s ease; }
.question-photo { width: 100%; height: 166px; object-fit: cover; border-radius: 14px; border: 1px solid rgba(64,43,26,.2); box-shadow: 0 5px 14px rgba(63,44,27,.12); }
.photo-caption { font-size: 10px; color: var(--muted); margin: 4px 4px 10px; }
.question-text { font-size: 20px; line-height: 1.2; margin: 10px 0 13px; font-weight: 900; }
.answers { display: grid; gap: 8px; }
.answer {
  width: 100%; display: grid; grid-template-columns: 33px 1fr; align-items: center; gap: 8px; text-align: left;
  min-height: 49px; padding: 7px 11px; background: rgba(255,255,255,.8); color: var(--ink);
  border: 1px solid rgba(89,65,45,.26); border-radius: 11px; cursor: pointer; box-shadow: 0 3px 8px rgba(77,50,30,.06);
}
.answer-letter { width: 27px; height: 27px; display: grid; place-items: center; border-radius: 50%; border: 1px solid rgba(50,42,34,.35); font-weight: 900; font-size: 13px; }
.answer span:last-child { font-size: 14px; font-weight: 700; line-height: 1.18; }
.answer.selected { background: #e7f1eb; border-color: var(--forest); }
.answer.correct { background: #2f8b55; color: white; border-color: #1f6d40; }
.answer.wrong { background: #c94a36; color: white; border-color: #9f2c1d; }
.quiz-scoreline { display: flex; justify-content: space-between; margin-top: 12px; font-size: 12px; color: var(--muted); font-weight: 800; }

.feedback-screen { color: #fff; display: flex; align-items: stretch; }
.feedback-screen.good { background: linear-gradient(180deg, #176d4a, #2d874f); }
.feedback-screen.bad { background: linear-gradient(180deg, #a92c20, #ce4b28); }
.feedback-card {
  width: 100%; align-self: center; margin: auto; background: #fff8e9; color: var(--ink); border-radius: 28px; padding: 21px 17px;
  box-shadow: var(--shadow); position: relative; text-align: center;
}
.feedback-icon { width: 74px; height: 74px; margin: -57px auto 9px; border-radius: 50%; display: grid; place-items: center; color: white; font-size: 42px; font-weight: 900; border: 8px solid #fff8e9; }
.good .feedback-icon { background: #318c4d; }
.bad .feedback-icon { background: #c13825; }
.feedback-card h2 { margin: 6px 0; font-size: 27px; }
.good .feedback-card h2 { color: #267445; }
.bad .feedback-card h2 { color: #b92e20; }
.feedback-card .correct-answer { font-weight: 900; margin: 8px 0; }
.feedback-card p { line-height: 1.38; margin: 8px 0 14px; }
.feedback-photo { width: 100%; height: 170px; object-fit: cover; border-radius: 12px; }
.fact-card { margin: 14px 0 0; padding: 12px; border: 1px solid rgba(116,83,48,.15); border-radius: 14px; background: #fff1ce; text-align: left; font-size: 12px; line-height: 1.35; }
.fact-card b { color: #835514; }

.result-hero { text-align: center; padding: 8px 0 10px; }
.result-medal { font-size: 64px; }
.result-hero h1 { margin: 2px 0 5px; font-size: 28px; }
.big-score { font-size: 44px; font-weight: 950; color: var(--forest-dark); }
.result-box { background: rgba(255,255,255,.7); border: 1px solid var(--line); border-radius: 18px; padding: 14px; margin: 12px 0; }
.result-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 7px 0; border-bottom: 1px dashed rgba(70,50,35,.15); }
.result-row:last-child { border: 0; }
.result-row span { font-size: 13px; }
.result-row b { color: var(--forest-dark); }
.wrong-review { margin: 10px 0; }
.wrong-item { background: rgba(255,255,255,.65); border-left: 4px solid var(--red); border-radius: 10px; padding: 10px; margin: 8px 0; font-size: 12px; line-height: 1.35; }

.badge-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px; margin: 12px 0 18px; }
.badge { border-radius: 16px; padding: 12px; background: rgba(255,255,255,.65); border: 1px solid var(--line); text-align: center; }
.badge .emoji { font-size: 28px; display: block; }
.badge strong { font-size: 12px; display: block; margin-top: 5px; }
.badge.locked { filter: grayscale(1); opacity: .46; }

.about-card { background: rgba(255,255,255,.68); border: 1px solid var(--line); border-radius: 18px; padding: 15px; margin: 10px 0; line-height: 1.5; font-size: 14px; }
.about-card h3 { margin: 0 0 6px; }
.about-card ul { padding-left: 20px; margin: 8px 0; }
.setting-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.setting-row:last-child { border-bottom: 0; }
.switch { width: 50px; height: 28px; border-radius: 999px; background: #bba98f; padding: 3px; cursor: pointer; border: 0; }
.switch::after { content:""; display: block; width: 22px; height: 22px; border-radius: 50%; background: white; transition: transform .2s; }
.switch.on { background: var(--forest); }
.switch.on::after { transform: translateX(22px); }

.toast { position: fixed; z-index: 20; left: 50%; bottom: 20px; transform: translate(-50%, 30px); opacity: 0; background: #2c241e; color: white; padding: 10px 15px; border-radius: 999px; font-weight: 800; font-size: 12px; transition: .25s; pointer-events: none; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.install-note { padding: 12px; margin: 10px 0; border-radius: 14px; background: #fff0c9; border: 1px solid rgba(138,92,30,.18); font-size: 13px; line-height: 1.4; }

@media (min-width: 800px) {
  body { padding: 28px 0; min-height: 100vh; }
  .app-shell { min-height: calc(100vh - 56px); height: calc(100vh - 56px); border-radius: 34px; border: 7px solid #2d271f; box-shadow: 0 30px 80px rgba(60,37,17,.32); overflow-y: auto; scrollbar-width: none; }
  .app-shell::-webkit-scrollbar { display:none; }
  .screen { min-height: 100%; }
  .desktop-portrait { display:block; position: fixed; left: max(20px, calc(50vw - 565px)); top: 6vh; width: 300px; height: 88vh; border-radius: 34px; background: url('assets/portrait.jpg') center 22%/cover no-repeat; opacity: .92; filter: saturate(.95); box-shadow: var(--shadow); }
  .app-shell { margin-left: calc(50% - 110px); }
}

@media (min-width: 1180px) {
  .app-shell { margin-left: calc(50% - 70px); }
  .desktop-portrait { width: 360px; left: calc(50% - 600px); }
}

/* v1.1.0 — cadastro e sincronização */
.onboarding-screen { background: linear-gradient(180deg, #fff1d2 0%, #f7ddb0 100%); }
.onboarding-card {
  margin-top: 10px; padding: 16px; border-radius: 24px; background: rgba(255,248,231,.94);
  border: 1px solid rgba(95,60,29,.18); box-shadow: var(--shadow);
}
.onboarding-illustration {
  height: 150px; border-radius: 18px; margin-bottom: 14px;
  background: linear-gradient(180deg, rgba(22,94,66,.06), rgba(243,126,27,.14)), url('assets/children.jpg') center 45%/cover no-repeat;
  border: 1px solid rgba(73,52,31,.14);
}
.onboarding-card h1 { margin: 0 0 5px; font-size: 25px; color: var(--forest-dark); }
.onboarding-card > p { margin: 0 0 14px; color: var(--muted); font-size: 13px; line-height: 1.4; }
.profile-form { display: grid; gap: 12px; }
.profile-form label { display: grid; gap: 6px; font-size: 12px; font-weight: 900; color: var(--ink); }
.profile-form input[type="text"], .profile-form input[type="email"] {
  width: 100%; min-height: 48px; box-sizing: border-box; border-radius: 13px; border: 1px solid rgba(81,57,37,.3);
  background: rgba(255,255,255,.9); padding: 10px 12px; font: inherit; font-size: 15px; outline: none;
}
.profile-form input[type="text"]:focus, .profile-form input[type="email"]:focus { border-color: var(--forest); box-shadow: 0 0 0 3px rgba(31,107,79,.12); }
.consent-box { grid-template-columns: 22px 1fr !important; align-items: start; gap: 8px !important; font-weight: 700 !important; line-height: 1.35; color: var(--muted) !important; }
.consent-box input { width: 18px; height: 18px; accent-color: var(--forest); margin-top: 1px; }
.privacy-note { margin: 12px 2px 0 !important; padding: 10px; border-radius: 12px; background: #eef5ec; color: #365b48 !important; font-size: 11px !important; }
.player-pill { display:flex; align-items:center; justify-content:space-between; gap:8px; margin: 12px 1px 2px; padding: 8px 11px; border-radius: 999px; background: rgba(255,255,255,.64); border: 1px solid var(--line); font-size: 11px; font-weight: 900; }
.cloud-status { color: #8b6f51; white-space: nowrap; }
.cloud-status.ok { color: var(--forest-dark); }
.mini-btn { border: 1px solid rgba(66,54,42,.25); border-radius: 999px; padding: 7px 10px; background: #fff5dc; color: var(--forest-dark); font-weight: 900; cursor:pointer; }
button:disabled { opacity: .62; cursor: wait; }
