:root {
  --ink: #26143f;
  --ink-soft: #665777;
  --primary: #7c3aed;
  --primary-2: #d946ef;
  --accent: #ff8ab6;
  --cyan: #4cc9f0;
  --sun: #ffd166;
  --success: #1f9d72;
  --danger: #be3144;
  --surface: rgba(255,255,255,.90);
  --surface-solid: #fff;
  --line: rgba(84, 45, 125, .14);
  --shadow: 0 22px 70px rgba(62, 34, 93, .14);
  --sidebar: 118px;
  --topbar: 92px;
  --radius-xl: 32px;
  --radius-lg: 24px;
  --radius-md: 18px;
  --font: Inter, ui-rounded, "Avenir Next", "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; background: #fbf8ff; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 5%, rgba(255, 174, 210, .34), transparent 27%),
    radial-gradient(circle at 88% 10%, rgba(112, 211, 255, .25), transparent 25%),
    linear-gradient(145deg, #fff9fc 0%, #faf6ff 52%, #f2fbff 100%);
}
button, input, select, textarea { font: inherit; }
button { color: inherit; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 4px solid rgba(124,58,237,.20);
  outline-offset: 3px;
}
img { max-width: 100%; display: block; }
a { color: inherit; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar);
  z-index: 50;
  display: grid;
  grid-template-rows: auto 1fr auto;
  align-items: start;
  gap: 22px;
  padding: 18px 14px 24px;
  background: linear-gradient(180deg, #ffffff 0%, #fff8fd 50%, #f6f2ff 100%);
  border-right: 1px solid var(--line);
  box-shadow: 12px 0 38px rgba(56, 27, 82, .08);
}
.brand-mark {
  width: 86px;
  height: 78px;
  margin: 0 auto;
  display: grid;
  place-items: center;
  border-radius: 24px;
  background: white;
  box-shadow: 0 12px 32px rgba(89, 49, 112, .15);
  overflow: hidden;
}
.brand-mark img { width: 82px; height: 72px; object-fit: contain; }
.sidebar-nav { display: flex; flex-direction: column; gap: 8px; align-self: center; }
.nav-item {
  border: 0;
  background: transparent;
  min-height: 76px;
  width: 88px;
  border-radius: 25px;
  cursor: pointer;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 4px;
  transition: transform .18s ease, background .18s ease, box-shadow .18s ease, color .18s ease;
}
.nav-item span { font-size: 27px; line-height: 1; }
.nav-item small { font-weight: 850; font-size: 12px; }
.nav-item:hover { transform: translateY(-2px); background: rgba(124,58,237,.08); }
.nav-item.is-active {
  color: white;
  background: linear-gradient(145deg, var(--primary), var(--primary-2));
  box-shadow: 0 16px 30px rgba(139, 54, 206, .28);
}
.parent-nav { align-self: end; margin: 0 auto; }

.app-shell { min-height: 100vh; margin-left: var(--sidebar); }
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  min-height: var(--topbar);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 16px clamp(24px, 4vw, 58px);
  background: rgba(255, 250, 253, .83);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--line);
}
.brand-copy { display: grid; gap: 2px; }
.brand-copy strong { font-size: clamp(24px, 2.4vw, 38px); letter-spacing: -.04em; }
.brand-copy span { color: var(--ink-soft); font-weight: 700; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.child-chip, .icon-button, .donate-button {
  border: 1px solid var(--line);
  background: rgba(255,255,255,.86);
  box-shadow: 0 10px 28px rgba(74,45,98,.08);
  cursor: pointer;
}
.child-chip { border-radius: 999px; padding: 11px 17px; font-weight: 850; display: flex; gap: 9px; align-items: center; }
.icon-button { width: 48px; height: 48px; border-radius: 16px; font-size: 20px; }
.donate-button { border-radius: 999px; padding: 11px 17px; font-weight: 900; display: inline-flex; gap: 8px; align-items: center; color: #8b245d; background: linear-gradient(135deg, #fff, #fff0f7); border-color: rgba(217,70,139,.24); }
.donate-button:hover { transform: translateY(-2px); box-shadow: 0 14px 30px rgba(160,47,111,.15); }
.support-card { margin-top: 28px; padding: clamp(22px, 3vw, 36px); display: flex; align-items: center; justify-content: space-between; gap: 24px; background: linear-gradient(135deg, rgba(255,255,255,.96), rgba(255,239,247,.94) 52%, rgba(235,249,255,.94)); border-color: rgba(232,105,167,.25); }
.support-card h2 { margin: 7px 0 8px; font-size: clamp(27px, 3vw, 42px); letter-spacing: -.04em; }
.support-card p { margin: 0; color: var(--ink-soft); font-size: 17px; line-height: 1.55; max-width: 850px; }
.support-button { flex: 0 0 auto; }
.donate-options { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 11px; margin-top: 22px; }
.donate-options button { min-height: 54px; }
.donate-dialog { width: min(680px, calc(100vw - 30px)); }
.support-settings-card { background: linear-gradient(145deg, rgba(255,255,255,.96), rgba(255,242,248,.93)); border-color: rgba(232,105,167,.22); }

main#app { padding: 34px clamp(24px, 4vw, 58px) 90px; max-width: 1680px; margin: 0 auto; }
.page { animation: pageIn .25s ease both; }
@keyframes pageIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.page-heading { margin-bottom: 24px; }
.page-heading h1 { margin: 3px 0 8px; font-size: clamp(36px, 5vw, 68px); letter-spacing: -.055em; line-height: .98; }
.page-heading p { margin: 0; color: var(--ink-soft); font-size: clamp(17px, 1.4vw, 21px); font-weight: 650; max-width: 860px; line-height: 1.55; }
.eyebrow { display: inline-block; font-size: 12px; font-weight: 950; letter-spacing: .12em; text-transform: uppercase; color: var(--primary); }
.muted { color: var(--ink-soft); }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}
.card-pad { padding: clamp(20px, 2.4vw, 34px); }
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.hero {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: 1.22fr .78fr;
  min-height: 450px;
  background:
    radial-gradient(circle at 22% 12%, rgba(255,255,255,.95), transparent 31%),
    linear-gradient(135deg, rgba(255,236,246,.94), rgba(244,239,255,.94) 52%, rgba(224,249,255,.94));
}
.hero::before, .hero::after { content: ""; position: absolute; border-radius: 50%; filter: blur(3px); opacity: .58; }
.hero::before { width: 180px; height: 180px; background: #ffd5e8; left: -60px; bottom: -58px; }
.hero::after { width: 210px; height: 210px; background: #cbeeff; right: -70px; top: -70px; }
.hero-copy { padding: clamp(28px, 4vw, 58px); z-index: 2; display: flex; flex-direction: column; justify-content: center; }
.hero-copy h1 { margin: 8px 0 14px; max-width: 880px; font-size: clamp(42px, 5.3vw, 82px); line-height: .96; letter-spacing: -.06em; }
.hero-copy p { font-size: clamp(18px, 1.55vw, 23px); color: var(--ink-soft); line-height: 1.5; font-weight: 680; max-width: 760px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }
.hero-art { position: relative; min-height: 360px; display: grid; place-items: end center; z-index: 1; }
.hero-art img { width: min(94%, 620px); max-height: 430px; object-fit: contain; filter: drop-shadow(0 24px 30px rgba(62,30,78,.18)); }

.button, .button-ghost, .button-soft {
  border: 0;
  border-radius: 16px;
  padding: 13px 21px;
  font-weight: 900;
  cursor: pointer;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  transition: transform .17s ease, box-shadow .17s ease, opacity .17s ease;
}
.button { color: white; background: linear-gradient(135deg, var(--primary), var(--primary-2)); box-shadow: 0 13px 26px rgba(129,54,200,.25); }
.button:hover, .button-ghost:hover, .button-soft:hover { transform: translateY(-2px); }
.button-ghost { background: white; border: 1px solid var(--line); }
.button-soft { background: rgba(124,58,237,.09); color: var(--primary); }
.button-danger { background: linear-gradient(135deg, #d64b68, #a61c3c); }
.button-small { padding: 9px 13px; font-size: 13px; border-radius: 13px; }
.button-wide { width: 100%; margin-top: 18px; }
button:disabled { cursor: not-allowed; opacity: .45; transform: none !important; }

.stat-strip { margin-top: 22px; grid-template-columns: repeat(4, 1fr); }
.stat-card { padding: 22px; display: grid; gap: 6px; }
.stat-card strong { font-size: 30px; letter-spacing: -.04em; }
.stat-card span { color: var(--ink-soft); font-weight: 720; }

.section-title { display: flex; justify-content: space-between; align-items: end; gap: 16px; margin: 34px 0 16px; }
.section-title h2 { margin: 0; font-size: clamp(26px, 3vw, 40px); letter-spacing: -.04em; }
.section-title p { margin: 4px 0 0; color: var(--ink-soft); }

.mission-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.mission-card { padding: 20px; cursor: pointer; min-height: 150px; display: grid; align-content: space-between; gap: 16px; transition: transform .2s ease, border-color .2s ease; }
.mission-card:hover { transform: translateY(-5px); border-color: rgba(124,58,237,.35); }
.mission-card .icon { font-size: 34px; }
.mission-card strong { font-size: 17px; line-height: 1.25; }
.mission-card small { color: var(--ink-soft); font-weight: 700; }

.progress-track { height: 12px; background: #eee5fb; border-radius: 999px; overflow: hidden; }
.progress-bar { height: 100%; min-width: 0; background: linear-gradient(90deg, var(--primary), var(--primary-2), var(--cyan)); border-radius: inherit; transition: width .35s ease; }

.level-tabs { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 24px; }
.level-tab { border: 1px solid var(--line); background: white; border-radius: 999px; padding: 12px 18px; font-weight: 900; cursor: pointer; }
.level-tab.is-active { color: white; background: var(--ink); border-color: var(--ink); }
.subject-grid { grid-template-columns: repeat(3, minmax(0,1fr)); }
.subject-card { position: relative; overflow: hidden; padding: 24px; cursor: pointer; min-height: 226px; display: grid; align-content: space-between; transition: transform .2s ease, box-shadow .2s ease; }
.subject-card:hover { transform: translateY(-6px); box-shadow: 0 26px 70px rgba(62,34,93,.20); }
.subject-icon { width: 58px; height: 58px; border-radius: 19px; display: grid; place-items: center; font-size: 31px; background: linear-gradient(145deg, rgba(124,58,237,.12), rgba(217,70,239,.12)); }
.subject-card h3 { margin: 16px 0 6px; font-size: 24px; }
.subject-card p { margin: 0; color: var(--ink-soft); line-height: 1.45; }
.subject-meta { display: flex; justify-content: space-between; margin-top: 20px; color: var(--ink-soft); font-weight: 800; font-size: 13px; }

.breadcrumbs { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; color: var(--ink-soft); font-weight: 740; margin-bottom: 20px; }
.breadcrumbs button { border: 0; background: none; color: var(--primary); font-weight: 900; cursor: pointer; padding: 0; }
.subject-header { display: grid; grid-template-columns: 1fr auto; gap: 18px; align-items: center; padding: 26px; margin-bottom: 20px; }
.subject-header h1 { margin: 6px 0; font-size: clamp(34px, 4vw, 54px); letter-spacing: -.05em; }
.lesson-list { display: grid; gap: 14px; }
.lesson-row { display: grid; grid-template-columns: auto 1fr auto; gap: 16px; align-items: center; padding: 18px 20px; }
.lesson-index { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 15px; background: #f1eafd; color: var(--primary); font-weight: 950; }
.lesson-row h3 { margin: 0 0 4px; }
.lesson-row p { margin: 0; color: var(--ink-soft); }
.lesson-complete { color: var(--success); font-weight: 900; }

.lesson-layout { grid-template-columns: minmax(0, 1.15fr) minmax(320px, .85fr); align-items: start; }
.lesson-content { padding: 30px; }
.lesson-content h1 { font-size: clamp(34px, 4vw, 56px); letter-spacing: -.05em; margin: 6px 0 18px; }
.lesson-content h2 { margin-top: 30px; }
.lesson-content p, .lesson-content li { line-height: 1.68; font-size: 17px; }
.objective-box, .example-box { border-radius: 20px; padding: 20px; margin: 18px 0; }
.objective-box { background: linear-gradient(135deg, #f6efff, #fff5fa); border: 1px solid #e8d9fb; }
.example-box { background: #eefaff; border: 1px solid #cceef7; }
.exercise-panel { position: sticky; top: calc(var(--topbar) + 20px); padding: 24px; }
.exercise-card { padding: 20px; border: 1px solid var(--line); border-radius: 20px; background: white; margin: 14px 0; }
.exercise-card h4 { margin: 0 0 12px; line-height: 1.4; }
.choice-list { display: grid; gap: 9px; }
.choice-button { border: 1px solid var(--line); background: #fff; padding: 12px 14px; border-radius: 14px; text-align: left; cursor: pointer; font-weight: 750; }
.choice-button:hover { border-color: rgba(124,58,237,.48); background: #faf7ff; }
.choice-button.is-correct { border-color: #4bb894; background: #e9fbf5; }
.choice-button.is-wrong { border-color: #e1788b; background: #fff1f4; }
.solution { margin-top: 12px; padding: 12px 14px; border-radius: 14px; background: #f7f4fb; color: var(--ink-soft); line-height: 1.5; }
.text-answer { width: 100%; min-height: 72px; border: 1px solid var(--line); border-radius: 14px; padding: 12px; resize: vertical; }

.story-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.story-card { overflow: hidden; cursor: pointer; transition: transform .2s ease; }
.story-card:hover { transform: translateY(-5px); }
.story-card img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; object-position: center; background: #faf7ff; }
.story-card-body { padding: 20px; }
.story-card h3 { margin: 0 0 8px; font-size: 22px; }
.story-card p { color: var(--ink-soft); line-height: 1.5; }
.story-tags { display: flex; gap: 8px; flex-wrap: wrap; }
.tag { padding: 7px 10px; border-radius: 999px; background: #f3ecfc; color: #6f35a8; font-size: 12px; font-weight: 900; }
.generator { padding: 26px; margin-bottom: 26px; }
.form-grid { display: grid; gap: 16px; }
.two-cols { grid-template-columns: repeat(2, minmax(0,1fr)); }
.three-cols { grid-template-columns: repeat(3, minmax(0,1fr)); }
label { display: grid; gap: 7px; font-weight: 820; }
input, select, textarea {
  width: 100%;
  border: 1px solid rgba(73,42,99,.18);
  background: rgba(255,255,255,.92);
  border-radius: 15px;
  padding: 13px 14px;
  color: var(--ink);
}
textarea { resize: vertical; min-height: 108px; }
.form-help { color: var(--ink-soft); font-size: 13px; line-height: 1.5; }
.form-error { color: var(--danger); font-weight: 800; min-height: 1.2em; }

.reader-page { max-width: 1280px; margin: 0 auto; }
.reader-top { display: flex; justify-content: space-between; gap: 14px; align-items: center; margin-bottom: 18px; }
.reader-progress { flex: 1; }
.reader-stage { overflow: hidden; }
.reader-visual { position: relative; background: white; min-height: 460px; }
.reader-visual img { width: 100%; height: 460px; object-fit: contain; background: linear-gradient(135deg,#fff9fc,#f3f8ff); }
.reader-page-number { position: absolute; right: 20px; top: 18px; background: rgba(255,255,255,.92); padding: 10px 15px; border-radius: 999px; font-weight: 950; box-shadow: 0 8px 20px rgba(0,0,0,.08); }
.reader-text { padding: 30px clamp(25px, 5vw, 68px) 38px; background: white; font-size: clamp(24px, 2.7vw, 39px); line-height: 1.55; letter-spacing: .015em; }
.reader-text.school-font { font-family: var(--school-font, "Segoe Print", cursive); }
.reader-text .spoken { background: #fff1a8; border-radius: 5px; }
.reader-controls { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; padding: 14px; margin-top: 14px; }
.reader-controls button { min-height: 52px; }

.game-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.game-card { padding: 24px; min-height: 210px; display: grid; align-content: space-between; }
.game-card .icon { font-size: 38px; }
.game-card h3 { margin: 12px 0 6px; font-size: 24px; }
.game-card p { color: var(--ink-soft); line-height: 1.45; }
.game-stage { max-width: 900px; margin: 0 auto; padding: 30px; }
.game-question { font-size: clamp(28px, 4vw, 50px); margin: 16px 0 28px; letter-spacing: -.035em; }
.game-options { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.game-options button { min-height: 76px; font-size: 20px; }
.canvas-wrap { background: #fff; border: 1px solid var(--line); border-radius: 20px; overflow: hidden; }
#drawingCanvas { width: 100%; height: 340px; touch-action: none; display: block; }

.badge-grid { grid-template-columns: repeat(4, minmax(0,1fr)); }
.badge { padding: 22px; text-align: center; }
.badge-icon { font-size: 48px; filter: grayscale(1); opacity: .35; }
.badge.is-earned .badge-icon { filter: none; opacity: 1; }
.badge strong { display: block; margin-top: 8px; }

.parent-grid { grid-template-columns: 1fr 1fr; align-items: start; }
.settings-card { padding: 24px; }
.settings-card h2 { margin-top: 0; }
.sync-status { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 999px; background: #f1edf7; font-weight: 850; font-size: 13px; }
.sync-status.ok { background: #e9fbf5; color: #167454; }
.sync-status.warn { background: #fff6dc; color: #8a6000; }
.danger-zone { border-color: rgba(190,49,68,.22); }

.dialog {
  border: 0;
  border-radius: 28px;
  width: min(760px, calc(100vw - 30px));
  padding: 0;
  color: var(--ink);
  box-shadow: 0 30px 120px rgba(34,16,52,.32);
}
.dialog::backdrop { background: rgba(32,16,45,.55); backdrop-filter: blur(7px); }
.dialog form { padding: 30px; }
.dialog h2 { margin: 6px 0 9px; font-size: 32px; }
.dialog p { color: var(--ink-soft); line-height: 1.5; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.onboarding-dialog { width: min(860px, calc(100vw - 30px)); }

.toast-stack { position: fixed; right: 22px; bottom: 22px; z-index: 100; display: grid; gap: 10px; max-width: min(420px, calc(100vw - 44px)); }
.toast { background: #26143f; color: white; padding: 14px 17px; border-radius: 15px; box-shadow: 0 16px 40px rgba(25,14,38,.28); animation: toastIn .2s ease; }
.toast.success { background: #166d52; }
.toast.error { background: #9d273a; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } }

.install-banner {
  position: fixed;
  z-index: 70;
  left: 16px;
  right: 16px;
  bottom: calc(82px + env(safe-area-inset-bottom));
  background: rgba(255,255,255,.97);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: 0 20px 55px rgba(44,22,64,.24);
  padding: 15px;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  align-items: center;
}
.install-banner[hidden] { display: none; }
.install-banner > div:first-child { display: grid; gap: 3px; }
.install-banner span { color: var(--ink-soft); font-size: 13px; }
.install-actions { display: flex; gap: 7px; }
.mobile-nav { display: none; }
.empty-state { text-align: center; padding: 55px 22px; }
.empty-state .icon { font-size: 60px; }

@media (max-width: 1200px) {
  .mission-grid { grid-template-columns: repeat(3, 1fr); }
  .subject-grid, .story-grid, .game-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-4, .badge-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 820px) {
  :root { --topbar: 76px; }
  body { padding-bottom: calc(80px + env(safe-area-inset-bottom)); }
  .sidebar { display: none; }
  .app-shell { margin-left: 0; }
  .topbar { padding: 10px 15px; }
  .brand-copy strong { font-size: 21px; }
  .brand-copy span { font-size: 12px; }
  .child-chip { padding: 9px 12px; }
  .donate-button { padding: 9px 11px; }
  .donate-button span:last-child { display: none; }
  .support-card { flex-direction: column; align-items: stretch; }
  .support-button { width: 100%; }
  .child-chip span:last-child { max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  main#app { padding: 20px 15px 34px; }
  .mobile-nav {
    position: fixed;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 60;
    padding: 8px 7px calc(7px + env(safe-area-inset-bottom));
    background: rgba(255,255,255,.95);
    border-top: 1px solid var(--line);
    backdrop-filter: blur(16px);
  }
  .mobile-nav .nav-item { width: auto; min-height: 59px; border-radius: 18px; gap: 2px; }
  .mobile-nav .nav-item span { font-size: 21px; }
  .mobile-nav .nav-item small { font-size: 10px; }
  .hero { grid-template-columns: 1fr; min-height: auto; }
  .hero-copy { padding: 28px 23px 8px; }
  .hero-copy h1 { font-size: clamp(39px, 12vw, 58px); }
  .hero-art { min-height: 250px; }
  .hero-art img { max-height: 285px; }
  .grid-2, .grid-3, .grid-4, .stat-strip, .mission-grid, .subject-grid, .story-grid, .game-grid, .badge-grid, .parent-grid, .lesson-layout { grid-template-columns: 1fr; }
  .two-cols, .three-cols { grid-template-columns: 1fr; }
  .exercise-panel { position: static; }
  .subject-header { grid-template-columns: 1fr; }
  .lesson-row { grid-template-columns: auto 1fr; }
  .lesson-row > :last-child { grid-column: 1 / -1; }
  .reader-visual, .reader-visual img { min-height: 280px; height: 280px; }
  .reader-text { font-size: 25px; padding: 24px 22px 30px; }
  .reader-controls { grid-template-columns: repeat(2, 1fr); }
  .reader-controls button:last-child { grid-column: 1 / -1; }
  .game-options { grid-template-columns: 1fr; }
  .install-banner { flex-direction: column; align-items: stretch; }
  .install-actions { justify-content: flex-end; }
  .dialog form { padding: 24px 20px; }
}

@media (max-width: 480px) {
  .topbar-actions .icon-button { display: none; }
  .donate-options { grid-template-columns: 1fr; }
  .brand-copy strong { font-size: 18px; }
  .hero-actions { display: grid; }
  .hero-actions .button, .hero-actions .button-ghost { width: 100%; }
  .page-heading h1 { font-size: 42px; }
  .lesson-index { width: 40px; height: 40px; }
}

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


/* v24 — layout editorial premium aprovado */
:root { --sidebar: 242px; --sidebar-deep: #1d103d; --sidebar-mid: #32145f; }
.sidebar {
  padding: 24px 16px 20px;
  gap: 20px;
  color: #fff;
  background:
    radial-gradient(circle at 12% 8%, rgba(239,102,193,.24), transparent 24%),
    linear-gradient(180deg, var(--sidebar-deep) 0%, var(--sidebar-mid) 58%, #231146 100%);
  border-right: 0;
  box-shadow: 16px 0 46px rgba(31,14,63,.18);
}
.brand-mark { width: 100%; height: 116px; border-radius: 26px; background: rgba(255,255,255,.97); box-shadow: 0 16px 38px rgba(8,2,25,.30); }
.brand-mark img { width: 190px; height: 104px; }
.sidebar-nav { width: 100%; align-self: start; gap: 8px; }
.nav-item { width: 100%; min-height: 62px; grid-template-columns: 42px 1fr; place-items: center start; align-content: center; padding: 8px 14px; border-radius: 18px; color: rgba(255,255,255,.86); }
.nav-item span { font-size: 25px; justify-self: center; }
.nav-item small { font-size: 14px; text-align: left; }
.nav-item:hover { color: white; background: rgba(255,255,255,.10); }
.nav-item.is-active { color: white; background: linear-gradient(135deg, #8f38e8, #ec3f9d); box-shadow: 0 14px 32px rgba(235,60,157,.28); }
.sidebar-footer { width: 100%; align-self: end; display: grid; gap: 12px; }
.parent-nav { margin: 0; align-self: auto; }
.sidebar-support { border: 1px solid rgba(255,255,255,.13); border-radius: 24px; padding: 18px 16px; display: grid; gap: 7px; text-align: left; color: white; cursor: pointer; background: linear-gradient(145deg, rgba(237,64,157,.90), rgba(155,48,215,.88)); box-shadow: 0 18px 38px rgba(8,2,25,.27); }
.sidebar-support:hover { transform: translateY(-2px); }
.sidebar-support-icon { font-size: 28px; }
.sidebar-support strong { font-size: 20px; }
.sidebar-support small { color: rgba(255,255,255,.86); line-height: 1.4; font-weight: 700; }
.topbar { min-height: 104px; padding-inline: clamp(28px,4vw,68px); background: rgba(255,250,253,.91); }
.brand-copy strong { font-size: clamp(27px,2.35vw,42px); }
main#app { max-width: 1900px; padding-inline: clamp(28px,4vw,68px); }

.reading-club-heading { display: flex; justify-content: space-between; gap: 30px; align-items: center; margin-bottom: 22px; }
.reading-club-heading h1 { margin: 4px 0 9px; font-size: clamp(39px,4.7vw,68px); line-height: 1; letter-spacing: -.055em; }
.reading-club-heading p { margin: 0; max-width: 920px; color: var(--ink-soft); font-size: 18px; line-height: 1.55; font-weight: 650; }
.story-count-card { min-width: 210px; padding: 20px 22px; border: 1px solid rgba(124,58,237,.16); border-radius: 24px; background: linear-gradient(145deg,#fff,#f6edff); box-shadow: var(--shadow); display: grid; text-align: center; }
.story-count-card strong { font-size: 44px; line-height: 1; color: var(--primary); }
.story-count-card span { font-weight: 900; margin-top: 5px; }
.story-count-card small { color: var(--ink-soft); margin-top: 4px; }
.story-toolbar { padding: 16px; margin-bottom: 22px; display: grid; gap: 14px; }
.story-search { display: flex; align-items: center; gap: 10px; padding: 0 14px; border: 1px solid var(--line); border-radius: 18px; background: #fff; }
.story-search input { border: 0; background: transparent; padding-inline: 0; outline: 0; }
.story-filter-row { display: flex; gap: 9px; overflow-x: auto; padding-bottom: 3px; scrollbar-width: thin; }
.story-filter { border: 1px solid var(--line); background: white; border-radius: 999px; padding: 10px 14px; font-weight: 850; cursor: pointer; white-space: nowrap; }
.story-filter.is-active { color: white; background: var(--ink); border-color: var(--ink); }
.story-grid { grid-template-columns: repeat(auto-fill, minmax(275px, 1fr)); gap: 18px; }
.story-card { cursor: default; display: flex; flex-direction: column; min-height: 100%; }
.story-cover-wrap { position: relative; overflow: hidden; }
.story-card img { aspect-ratio: 4/3; transition: transform .32s ease; }
.story-card:hover img { transform: scale(1.025); }
.story-favourite { position: absolute; top: 12px; right: 12px; width: 42px; height: 42px; border: 0; border-radius: 50%; background: rgba(255,255,255,.92); color: #b8578a; font-size: 25px; cursor: pointer; box-shadow: 0 8px 22px rgba(37,15,55,.18); }
.story-favourite.is-active { color: #e62d87; }
.story-complete-badge { position: absolute; left: 12px; top: 12px; padding: 8px 11px; border-radius: 999px; color: #12684e; background: rgba(234,255,247,.94); font-size: 12px; font-weight: 950; }
.story-card-body { display: flex; flex-direction: column; flex: 1; }
.story-card-body p { flex: 1; }
.story-card-footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: var(--ink-soft); font-size: 12px; font-weight: 800; }
.empty-story-results { padding: 42px; text-align: center; }
.empty-story-results div { font-size: 50px; }
.empty-story-results h2 { margin: 8px 0; }
.reading-club-note { margin-top: 24px; padding: 22px; display: grid; grid-template-columns: auto 1fr auto; gap: 16px; align-items: center; background: linear-gradient(135deg,#fff4fa,#f5efff 58%,#effbff); }
.reading-club-note > span { font-size: 38px; }
.reading-club-note strong { font-size: 21px; }
.reading-club-note p { margin: 4px 0 0; color: var(--ink-soft); }
.reflection-card { margin-top: 16px; padding: clamp(24px,4vw,42px); background: linear-gradient(145deg,#fff,#fff5fa 58%,#f2fbff); }
.reflection-card h2 { margin: 7px 0 15px; font-size: clamp(26px,3vw,40px); }
.reflection-card li { margin: 10px 0; font-size: 18px; line-height: 1.5; }
.reflection-card p { color: var(--ink-soft); }

@media (min-width: 1500px) { .story-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 1050px) and (min-width: 821px) { :root { --sidebar: 194px; } .brand-mark img { width: 155px; } .nav-item { grid-template-columns: 36px 1fr; padding-inline: 10px; } .sidebar-support small { display:none; } }
@media (max-width: 820px) {
  :root { --sidebar: 0px; }
  .reading-club-heading { align-items: stretch; flex-direction: column; }
  .story-count-card { min-width: 0; grid-template-columns: auto 1fr; align-items: center; text-align: left; column-gap: 12px; }
  .story-count-card strong { grid-row: 1 / 3; }
  .reading-club-note { grid-template-columns: auto 1fr; }
  .reading-club-note .button { grid-column: 1 / -1; width: 100%; }
  .story-grid { grid-template-columns: 1fr; }
}

/* v25 — plano adaptativo, perfis, competências, acessibilidade e leitura premium */
.skip-link { position: fixed; left: 12px; top: -80px; z-index: 200; padding: 12px 18px; border-radius: 12px; background: #fff; color: #1d103d; font-weight: 900; box-shadow: var(--shadow); }
.skip-link:focus { top: 12px; }
.section-title.compact { margin: 0 0 18px; align-items: center; }
.section-title.compact h2 { font-size: clamp(23px,2.5vw,34px); }
.button-row { display: flex; flex-wrap: wrap; gap: 9px; align-items: center; }
.check-label { display: flex; grid-template-columns: none; gap: 11px; align-items: center; padding: 12px 14px; border: 1px solid var(--line); border-radius: 15px; background: rgba(255,255,255,.7); }
.check-label input { width: 20px; height: 20px; flex: 0 0 auto; }
.four-cols { grid-template-columns: repeat(4,minmax(0,1fr)); }

.weekly-plan-grid { grid-template-columns: repeat(5,minmax(0,1fr)); }
.weekly-plan-card { min-height: 238px; padding: 20px; display: flex; flex-direction: column; align-items: flex-start; gap: 9px; position: relative; overflow: hidden; }
.weekly-plan-card::after { content:""; position:absolute; width:100px; height:100px; border-radius:50%; right:-40px; top:-40px; background:radial-gradient(circle,rgba(217,70,239,.16),transparent 68%); }
.weekly-plan-card.is-complete { background: linear-gradient(145deg,#effcf7,#fff); }
.weekly-day { font-size: 12px; font-weight: 950; color: var(--primary); text-transform: uppercase; letter-spacing: .08em; }
.weekly-icon { font-size: 34px; }
.weekly-plan-card h3 { font-size: 20px; margin: 0; line-height: 1.15; }
.weekly-plan-card p { margin: 0 0 auto; color: var(--ink-soft); line-height: 1.4; }

.competency-preview { padding: 10px 22px; }
.competency-row { display: grid; grid-template-columns: 38px minmax(160px,1fr) minmax(180px,2fr) 52px; gap: 14px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--line); }
.competency-row:last-child { border-bottom: 0; }
.competency-row > div:nth-child(2) { display: grid; gap: 3px; }
.competency-row small { color: var(--ink-soft); font-weight: 700; }
.competency-icon { width: 38px; height: 38px; display: grid; place-items:center; border-radius: 13px; background:#f5effd; font-size: 21px; }
.recommendation-card img { width:100%; border-radius:22px; aspect-ratio:16/10; object-fit:cover; }
.recommendation-card h2 { font-size:clamp(29px,3vw,44px); margin:14px 0 8px; }
.recommendation-card p { color:var(--ink-soft); font-size:18px; line-height:1.55; }

.competency-map-card { display:grid; grid-template-columns:minmax(0,1.6fr) minmax(280px,.8fr); gap:24px; align-items:start; }
.competency-map-list { display:grid; gap:10px; }
.competency-map-item { display:grid; grid-template-columns:42px minmax(150px,1fr) minmax(160px,1.4fr) 48px; gap:12px; align-items:center; padding:12px; border-radius:17px; background:#faf8fd; }
.competency-map-item > div:nth-child(2) { display:grid; gap:2px; }
.competency-map-item small { color:var(--ink-soft); }
.report-summary { padding:22px; border-radius:22px; color:white; background:linear-gradient(145deg,#271348,#4b1f84); box-shadow:0 18px 35px rgba(37,15,65,.22); }
.report-summary .eyebrow { color:#ffc7e5; }
.report-summary h3 { line-height:1.45; }
.report-summary dl { display:grid; grid-template-columns:repeat(3,1fr); gap:8px; }
.report-summary dl div { padding:12px 8px; background:rgba(255,255,255,.1); border-radius:13px; text-align:center; }
.report-summary dt { font-size:11px; opacity:.8; }
.report-summary dd { margin:4px 0 0; font-size:22px; font-weight:950; }
.report-summary p { line-height:1.45; color:rgba(255,255,255,.88); }

.profiles-manager { margin-bottom:20px; }
.profiles-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(190px,1fr)); gap:13px; }
.profile-card { position:relative; border:1px solid var(--line); border-radius:20px; background:#fff; overflow:hidden; }
.profile-card.is-active { border-color:#d946ef; box-shadow:0 0 0 3px rgba(217,70,239,.12); }
.profile-select { width:100%; border:0; background:transparent; padding:17px; cursor:pointer; display:grid; gap:5px; text-align:left; }
.profile-avatar { width:52px; height:52px; border-radius:18px; display:grid; place-items:center; font-size:30px; background:linear-gradient(145deg,#fde8f4,#eee8ff); }
.profile-select strong { font-size:19px; }
.profile-select small,.profile-select span:last-child { color:var(--ink-soft); font-weight:700; }
.profile-remove { position:absolute; right:8px; top:8px; width:30px; height:30px; border:0; border-radius:50%; background:#fff0f3; color:#a61c3c; cursor:pointer; font-size:19px; }
.profile-create-form { margin-top:18px; padding:18px; border-radius:20px; background:#f8f4fd; }
.parent-report-card { grid-column:1/-1; }
.mini-competencies { display:grid; gap:10px; }
.mini-competencies > div { display:grid; grid-template-columns:28px minmax(130px,1fr) minmax(140px,2fr) 46px; align-items:center; gap:10px; }
.report-highlights { display:flex; flex-wrap:wrap; gap:10px; margin-top:15px; }
.report-highlights span { display:grid; min-width:105px; padding:12px; border-radius:15px; background:#f6f0fd; color:var(--ink-soft); }
.report-highlights strong { font-size:24px; color:var(--ink); }
.privacy-promise { display:flex; gap:12px; align-items:flex-start; padding:15px; border-radius:16px; background:#eefaf5; border:1px solid #cdeedf; }
.privacy-promise span { font-size:28px; }
.privacy-promise p { margin:0; line-height:1.5; color:#25584a; }
.import-button { cursor:pointer; }

.reader-controls-premium { grid-template-columns: repeat(7,minmax(0,1fr)); align-items:center; }
.reader-speed { display:grid; grid-template-columns:1fr; gap:3px; font-size:11px; color:var(--ink-soft); }
.reader-speed select { padding:8px 10px; border-radius:12px; }
.reader-vocabulary { margin-top:16px; padding:24px; }
.vocab-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(210px,1fr)); gap:12px; }
.vocab-card { border:1px solid var(--line); border-radius:18px; background:#fff; text-align:left; padding:16px; display:grid; gap:6px; cursor:pointer; }
.vocab-card:hover { border-color:rgba(124,58,237,.45); transform:translateY(-2px); }
.vocab-card strong { font-size:20px; color:var(--primary); }
.vocab-card span { line-height:1.45; }
.vocab-card small { color:var(--ink-soft); line-height:1.4; }
.vocab-word { display:inline; border:0; border-bottom:3px dotted #d946ef; background:#fff3fa; border-radius:5px; color:inherit; padding:0 2px; cursor:pointer; font:inherit; }
.vocab-word:hover { background:#ffdcef; }
.vocab-example { padding:14px; border-radius:14px; background:#f8f4fd; font-style:italic; }

body.high-contrast { --ink:#0b0610; --ink-soft:#2e2434; --line:rgba(0,0,0,.28); background:#fff; }
body.high-contrast .card, body.high-contrast .topbar { background:#fff; border-color:#171019; }
body.high-contrast .button-soft, body.high-contrast .tag { color:#2b0756; border:1px solid #2b0756; }
body.large-text { font-size:118%; }
body.large-text .reader-text { font-size:clamp(30px,3.2vw,46px); }
body.reduced-motion *, body.reduced-motion *::before, body.reduced-motion *::after { animation-duration:.01ms!important; transition-duration:.01ms!important; scroll-behavior:auto!important; }
body.reading-guide .reader-text { background-image:linear-gradient(to bottom,transparent 0,transparent calc(1.55em - 2px),rgba(124,58,237,.09) calc(1.55em - 2px),rgba(124,58,237,.09) 1.55em); background-size:100% 1.55em; }

@media (max-width: 1350px) {
  .weekly-plan-grid { grid-template-columns:repeat(3,minmax(0,1fr)); }
  .reader-controls-premium { grid-template-columns:repeat(4,minmax(0,1fr)); }
}
@media (max-width: 1050px) {
  .competency-map-card { grid-template-columns:1fr; }
  .four-cols { grid-template-columns:repeat(2,minmax(0,1fr)); }
}
@media (max-width: 820px) {
  .weekly-plan-grid { grid-template-columns:1fr; }
  .weekly-plan-card { min-height:180px; }
  .competency-row,.competency-map-item,.mini-competencies > div { grid-template-columns:38px 1fr 48px; }
  .competency-row .progress-track,.competency-map-item .progress-track,.mini-competencies .progress-track { grid-column:2/-1; }
  .reader-controls-premium { grid-template-columns:repeat(2,1fr); }
  .reader-controls-premium #readerNext { grid-column:1/-1; }
  .four-cols { grid-template-columns:1fr; }
  .parent-report-card { grid-column:auto; }
}
.diagnostics-result { display:grid; gap:8px; margin-top:15px; }
.diagnostic-line { display:grid; grid-template-columns:28px 1fr auto; gap:9px; align-items:center; padding:10px 12px; border-radius:13px; background:#f7f4fb; }
.diagnostic-line span { width:25px; height:25px; display:grid; place-items:center; border-radius:50%; font-weight:950; }
.diagnostic-line.ok span { color:#12684e; background:#dff8ed; }
.diagnostic-line.fail span { color:#9d273a; background:#ffe5e9; }
.diagnostic-line small { color:var(--ink-soft); }

/* v26 — programa pedagógico, Inglês, relatórios, offline e inclusão */
.parents-premium .parent-grid{align-items:start}.parents-premium fieldset{border:1px solid var(--line,#e7ddf7);border-radius:18px;padding:14px}.parents-premium legend{font-weight:900;padding:0 8px}.priority-subjects{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}.compact-check{padding:8px 10px;border:1px solid #eadff8;border-radius:12px;background:#fff}.english-settings-card{background:linear-gradient(145deg,#fff 0%,#f2f7ff 60%,#fff3fa 100%)}.english-settings-card h2:before{content:'🇬🇧 ';}.remote-profiles-list{display:grid;gap:8px;margin-top:12px}.remote-profiles-list>div{display:grid;grid-template-columns:auto 1fr auto;gap:10px;align-items:center;padding:10px 12px;border:1px solid #e6dcf5;border-radius:14px;background:#fff}.sync-conflicts{padding:12px 14px;border-radius:14px;background:#fff2e8;border:1px solid #ffc58f;margin:12px 0}.offline-card{background:linear-gradient(145deg,#f9f6ff,#eef9ff)}.report-highlights{display:grid!important;grid-template-columns:repeat(auto-fit,minmax(95px,1fr));gap:8px}.report-highlights span{min-width:0}.button-row{display:flex;flex-wrap:wrap;gap:10px;align-items:center}.form-grid code{background:#f2ecff;padding:2px 6px;border-radius:6px}.english-subject-card{border-color:#bad5ff!important;background:linear-gradient(145deg,#ffffff,#edf5ff)!important}.english-tag{background:#e8f2ff;color:#1757a6}.english-hero{background:linear-gradient(135deg,#25245f,#4c3b95 55%,#d83a9b);color:white;overflow:hidden}.english-hero p,.english-hero small{color:#f0edff}.english-lab{display:grid;gap:18px}.english-vocab-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(170px,1fr));gap:12px}.english-vocab-card{padding:14px;border:1px solid #d9e8ff;border-radius:16px;background:#fff;display:grid;gap:8px}.english-vocab-card strong{font-size:1.15rem}.dialogue-box,.phonics-box,.lesson-mastery-summary,.hint-box{border-radius:16px;padding:14px;background:#f6f2ff;border:1px solid #e5d9fa}.dialogue-box{background:#eef7ff;border-color:#cde4ff}.phonics-box{background:#fff8e8;border-color:#ffe0a1}.exercise-actions{display:flex;flex-wrap:wrap;gap:8px;margin-top:10px}.lesson-status{display:inline-flex;align-items:center;gap:6px;padding:6px 10px;border-radius:999px;font-weight:800;background:#f1ecfb}.mastery-ring{width:66px;height:66px;border-radius:50%;display:grid;place-items:center;background:conic-gradient(#8b39dd calc(var(--mastery,0)*1%),#eee5f7 0);position:relative}.mastery-ring:before{content:'';position:absolute;inset:7px;border-radius:50%;background:white}.mastery-ring strong{position:relative;z-index:1}.routine-banner{display:grid;grid-template-columns:1fr auto;gap:16px;align-items:center}.routine-dots{display:flex;gap:5px}.routine-dots span{width:16px;height:16px;border-radius:50%;background:#e5ddf2}.routine-dots span.active{background:#31ae70}.english-home-card{background:linear-gradient(145deg,#fff,#edf5ff);border:1px solid #cce0ff}.review-notebook,.english-passport{display:grid;gap:12px}.review-list{display:grid;gap:8px}.review-item{display:grid;grid-template-columns:1fr auto;gap:10px;padding:12px;border:1px solid #eadff8;border-radius:14px;background:#fff}.passport-words{display:flex;flex-wrap:wrap;gap:8px}.passport-words span{padding:7px 10px;border-radius:999px;background:#edf5ff;border:1px solid #cde2ff}.game-session-progress{display:flex;justify-content:space-between;align-items:center;margin-bottom:12px}.drawing-toolbar{display:flex;flex-wrap:wrap;gap:10px;align-items:center}.drawing-gallery{display:grid;grid-template-columns:repeat(3,1fr);gap:8px;margin-top:12px}.drawing-gallery img{width:100%;border-radius:12px;border:1px solid #ddd}.low-stimulus *{animation:none!important;transition:none!important}.low-stimulus .card,.low-stimulus .button,.low-stimulus .sidebar-support{box-shadow:none!important}.low-stimulus body,.low-stimulus .page{background:#faf9fc!important}.dyslexia-friendly{letter-spacing:.025em;word-spacing:.08em}.dyslexia-friendly p,.dyslexia-friendly li,.dyslexia-friendly input,.dyslexia-friendly button{line-height:1.75}.dyslexia-friendly .reader-text{font-family:Arial,Verdana,sans-serif!important;max-width:70ch}.parents-premium input[type=month]{width:100%;margin:8px 0 14px}.profiles-manager{scroll-margin-top:100px}#support{scroll-margin-top:100px}
@media(max-width:720px){.priority-subjects{grid-template-columns:1fr}.remote-profiles-list>div{grid-template-columns:auto 1fr}.remote-profiles-list small{grid-column:2}.routine-banner{grid-template-columns:1fr}.drawing-gallery{grid-template-columns:1fr 1fr}}
.diagnostic-form{display:grid;gap:14px}.diagnostic-question{padding:18px}.diagnostic-question legend{display:flex;align-items:center;gap:10px;font-weight:900;color:#351654}.diagnostic-question legend span{display:grid;place-items:center;width:30px;height:30px;border-radius:50%;background:#e83a9c;color:#fff}.diagnostic-choice{display:flex;gap:10px;align-items:center;padding:11px 13px;border:1px solid #e4d8f4;border-radius:14px;background:#fff;cursor:pointer}.diagnostic-choice:has(input:checked){border-color:#8a35d6;background:#f4ebff}.diagnostic-choice input{width:20px;height:20px}.diagnostic-submit{position:sticky;bottom:18px;z-index:3}.diagnostic-results{max-width:900px;margin:auto}.diagnostic-results .mini-competencies>div{grid-template-columns:minmax(150px,1fr) minmax(180px,2fr) auto}
.reading-mode-note{padding:14px 18px;background:#fff8e8;border:1px solid #ffe0a2;margin-bottom:14px}.reader-mode-calm .reader-stage{max-width:1050px;margin-inline:auto}.reader-mode-calm .reader-text{font-size:clamp(1.45rem,2.3vw,2rem);line-height:1.8}.reader-mode-calm .reader-vocabulary,.reader-mode-calm .reflection-card{box-shadow:none}.story-sequence-card{margin-top:18px}.sequence-items{display:grid;gap:10px;margin:14px 0}.sequence-item{display:grid;grid-template-columns:1fr 110px;gap:14px;align-items:center;padding:12px;border:1px solid #e4d8f4;border-radius:14px;background:#fff}.sequence-item select{margin:0}.story-sequence-card .solution{margin-top:12px;padding:12px;border-radius:12px;background:#f3edff}.reader-controls-premium{flex-wrap:wrap}@media print{.sidebar,.topbar,.mobile-nav,.reader-top,.reader-controls,.reader-vocabulary,.reflection-card,.story-sequence-card,.install-banner{display:none!important}.app-shell{margin:0!important}.reader-page{padding:0!important}.reader-stage{box-shadow:none!important;border:none!important}.reader-visual img{max-height:52vh;object-fit:contain}.reader-text{font-size:18pt!important;line-height:1.6!important}.page{background:#fff!important}}@media(max-width:700px){.sequence-item{grid-template-columns:1fr}}
.certificate-card{display:flex;align-items:center;justify-content:space-between;gap:20px;padding:22px;background:linear-gradient(135deg,#fff9e6,#f6edff);border:1px solid #ead495}.print-certificate{display:none}@media print{body>.print-certificate{display:flex!important;position:fixed;inset:0;z-index:99999;background:#fff;align-items:center;justify-content:center;flex-direction:column;text-align:center;padding:60px;border:18px double #5b238a;color:#351654}body>.print-certificate img{width:170px;margin-bottom:25px}body>.print-certificate span{font-size:20pt;text-transform:uppercase;letter-spacing:.15em}body>.print-certificate h1{font-size:44pt;margin:25px 0 5px;color:#d93493}body>.print-certificate p{font-size:16pt;max-width:700px}body>.print-certificate div{font-size:18pt;margin:28px}body>.print-certificate small{margin-top:50px;font-size:11pt}body:has(>.print-certificate)>.sidebar,body:has(>.print-certificate)>.app-shell,body:has(>.print-certificate)>.mobile-nav{display:none!important}}@media(max-width:700px){.certificate-card{align-items:flex-start;flex-direction:column}}

/* v31 — leitura escolar, instalação PWA e refinamentos premium */
:root {
  --school-font: "Edu NSW ACT Cursive", "Edu SA Beginner", "Segoe Print", "Bradley Hand", "Chalkboard SE", cursive;
}

.install-quick {
  border: 1px solid rgba(124,58,237,.22);
  border-radius: 999px;
  padding: 11px 16px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg,#fff,#f2ebff);
  color: #5f279f;
  box-shadow: 0 10px 28px rgba(74,45,98,.08);
  font-weight: 900;
  cursor: pointer;
}
.install-quick:hover { transform: translateY(-2px); box-shadow: 0 14px 30px rgba(94,48,143,.16); }
.install-quick[hidden] { display: none; }

.reader-text {
  text-align: justify;
  text-align-last: left;
  text-justify: inter-word;
  hyphens: auto;
  -webkit-hyphens: auto;
  overflow-wrap: break-word;
  word-break: normal;
  text-wrap: pretty;
  font-kerning: normal;
}
.reader-text.school-font {
  font-family: var(--school-font);
  font-weight: 500;
  letter-spacing: .006em;
  word-spacing: .025em;
  line-height: 1.62;
  font-synthesis: none;
}
.reader-text.school-font .vocab-word { font-family: inherit; font-weight: inherit; }
#readerFont.is-active {
  color: #fff;
  background: linear-gradient(135deg,#7c3aed,#d946ef);
  border-color: transparent;
  box-shadow: 0 10px 24px rgba(124,58,237,.22);
}

.install-dialog { width: min(720px, calc(100vw - 28px)); }
.install-dialog form { padding: 0; overflow: hidden; }
.install-dialog-hero {
  display: grid;
  grid-template-columns: 112px 1fr;
  gap: 20px;
  align-items: center;
  padding: 28px 30px 22px;
  background: linear-gradient(135deg,#fff4fa,#f4efff 58%,#edfaff);
  border-bottom: 1px solid var(--line);
}
.install-dialog-hero img { width: 104px; height: 104px; object-fit: contain; border-radius: 25px; box-shadow: 0 14px 34px rgba(54,26,80,.15); background:#fff; }
.install-dialog-hero h2 { margin: 5px 0 8px; font-size: clamp(28px,4vw,40px); }
.install-dialog-hero p { margin: 0; }
.install-platform { margin: 22px 30px 0; padding: 14px 16px; border: 1px solid #ded0f3; border-radius: 16px; background: #faf7ff; font-weight: 800; }
.install-steps { margin: 18px 30px 0; padding-left: 28px; display: grid; gap: 12px; color: var(--ink-soft); line-height: 1.5; }
.install-steps li::marker { color: var(--primary); font-weight: 950; }
.install-status { margin: 16px 30px 0; min-height: 24px; color: #166d52 !important; font-weight: 800; }
.install-dialog .dialog-actions { padding: 0 30px 28px; }

.update-banner {
  position: fixed;
  z-index: 75;
  right: 22px;
  bottom: 22px;
  width: min(480px, calc(100vw - 44px));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px;
  border-radius: 20px;
  background: rgba(38,20,63,.97);
  color: #fff;
  box-shadow: 0 24px 65px rgba(35,17,54,.34);
}
.update-banner[hidden] { display: none; }
.update-banner > div { display: grid; gap: 3px; }
.update-banner span { color: rgba(255,255,255,.76); font-size: 13px; line-height: 1.4; }

@media (max-width: 1000px) {
  .install-quick span:last-child { display: none; }
  .install-quick { width: 46px; height: 46px; padding: 0; justify-content: center; }
}
@media (max-width: 820px) {
  .reader-text { text-align: left; text-wrap: pretty; }
  .reader-text.school-font { line-height: 1.68; }
  .update-banner { left: 14px; right: 14px; bottom: calc(86px + env(safe-area-inset-bottom)); width: auto; }
}
@media (max-width: 560px) {
  .install-dialog-hero { grid-template-columns: 72px 1fr; padding: 22px 20px 18px; gap: 14px; }
  .install-dialog-hero img { width: 68px; height: 68px; border-radius: 18px; }
  .install-dialog-hero h2 { font-size: 27px; }
  .install-platform, .install-steps, .install-status { margin-left: 20px; margin-right: 20px; }
  .install-dialog .dialog-actions { padding: 0 20px 22px; display: grid; grid-template-columns: 1fr; }
  .install-dialog .dialog-actions button { width: 100%; }
  .update-banner { align-items: stretch; flex-direction: column; }
}

body.dyslexia-friendly .reader-text { text-align: left !important; hyphens: none; }

/* v31 — portefólio extensivo, dificuldade ajustável e sebentas premium */
.workbook-premium-card{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:24px;align-items:center;padding:28px;margin:22px 0;background:linear-gradient(135deg,#fff,#f7efff 52%,#eefaff);border:1px solid #ddcef4;overflow:hidden;position:relative}.workbook-premium-card:after{content:'📘';position:absolute;right:20px;bottom:-24px;font-size:110px;opacity:.055;transform:rotate(-8deg)}.workbook-premium-copy h2{margin:6px 0 8px;font-size:clamp(26px,3vw,40px)}.workbook-premium-copy p{margin:0;color:var(--ink-soft);line-height:1.55;max-width:850px}.workbook-feature-tags{display:flex;flex-wrap:wrap;gap:8px;margin-top:15px}.workbook-feature-tags span{padding:7px 10px;border-radius:999px;background:#fff;border:1px solid #e5d8f6;font-size:12px;font-weight:850}.workbook-premium-actions{display:grid;gap:10px;min-width:245px;position:relative;z-index:1}.subject-portfolio-count,.lesson-bank-count{display:block;margin-top:8px;color:#7a2ca9;font-weight:900;font-size:12px}.subject-bank-summary{padding:10px 12px;border-radius:14px;background:rgba(255,255,255,.72);border:1px solid rgba(255,255,255,.35);max-width:720px}.exercise-badges,.game-stage-meta{display:flex;flex-wrap:wrap;gap:7px;align-items:center;margin-bottom:11px}.difficulty-badge,.challenge-type-badge{display:inline-flex;align-items:center;gap:5px;padding:6px 9px;border-radius:999px;font-size:11px;font-weight:950;border:1px solid transparent}.difficulty-initiation{background:#eaf8ef;color:#17643a;border-color:#bde4ca}.difficulty-easy{background:#eef7ff;color:#215f93;border-color:#cce5fb}.difficulty-medium{background:#fff7df;color:#8a5b00;border-color:#f0d98d}.difficulty-hard{background:#fff0e8;color:#a24414;border-color:#f2c4a8}.difficulty-challenge{background:#f4eaff;color:#6d24a0;border-color:#dac0f3}.challenge-type-badge{background:#f3f0f7;color:#55475f;border-color:#ded5e6}.difficulty-control-panel{display:grid;grid-template-columns:1fr 1fr;gap:12px;padding:16px;margin:14px 0 12px;border-radius:18px;background:linear-gradient(145deg,#f8f4ff,#eef9ff);border:1px solid #ded4ef}.difficulty-control-panel label{font-size:12px;font-weight:900;color:var(--ink-soft)}.difficulty-control-panel select{margin-top:5px}.effective-difficulty{grid-column:1/-1;display:grid;grid-template-columns:auto 1fr;gap:2px 12px;padding:12px;border-radius:14px;background:#fff;border:1px solid #e4daf2}.effective-difficulty>span{grid-row:1/3;align-self:center;font-size:11px;text-transform:uppercase;letter-spacing:.08em;color:var(--ink-soft);font-weight:900}.effective-difficulty strong{font-size:17px}.effective-difficulty small{color:var(--ink-soft)}.difficulty-control-actions{grid-column:1/-1;display:flex;flex-wrap:wrap;gap:8px}.workbook-builder-layout{grid-template-columns:minmax(0,1.35fr) minmax(310px,.65fr);align-items:start}.workbook-builder-form{padding:26px}.subject-checkboxes{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:9px;margin:20px 0;border:1px solid var(--line);border-radius:18px;padding:16px}.subject-checkboxes legend{padding:0 8px;font-weight:950}.workbook-builder-summary{padding:26px;position:sticky;top:124px;background:linear-gradient(145deg,#fff,#f6efff)}.workbook-builder-summary h2{margin-top:4px}.workbook-stat{display:grid;grid-template-columns:72px 1fr;gap:12px;align-items:center;padding:12px 0;border-bottom:1px solid #e7def0}.workbook-stat strong{font-size:28px;color:#7d2eb3}.workbook-stat span{font-size:13px;color:var(--ink-soft);font-weight:750}.official-footer-preview{display:grid;grid-template-columns:58px 1fr;gap:10px;align-items:center;margin-top:22px;padding:12px;border-radius:14px;background:#fff;border:1px solid #ddd3e8;font-size:10px;line-height:1.4}.official-footer-preview img{width:58px;height:42px;object-fit:contain}.games-difficulty-picker{display:grid;grid-template-columns:1fr minmax(230px,300px);gap:22px;align-items:end;padding:22px;margin-bottom:20px;background:linear-gradient(135deg,#fff,#f5edff 60%,#eef9ff)}.games-difficulty-picker h2{margin:3px 0 6px}.games-difficulty-picker p{margin:0;color:var(--ink-soft)}.game-card-meta{display:flex;flex-wrap:wrap;gap:7px;margin-top:14px}.game-card-meta span{padding:6px 8px;border-radius:999px;background:#f3eef9;color:#5d4e69;font-size:11px;font-weight:850}.game-session-header{display:flex;justify-content:space-between;align-items:flex-start;gap:14px;margin-bottom:14px}.game-stage .game-question{margin-top:14px}.game-options{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}.game-options button{min-height:58px;text-align:left}.game-next-row{display:flex;justify-content:flex-end;margin-top:18px}
@media(max-width:1000px){.workbook-premium-card,.workbook-builder-layout{grid-template-columns:1fr}.workbook-premium-actions{min-width:0;grid-template-columns:1fr 1fr}.workbook-builder-summary{position:static}.games-difficulty-picker{grid-template-columns:1fr}.subject-checkboxes{grid-template-columns:1fr 1fr}}
@media(max-width:700px){.workbook-premium-card{padding:20px}.workbook-premium-actions,.subject-checkboxes,.difficulty-control-panel,.game-options{grid-template-columns:1fr}.difficulty-control-panel label,.effective-difficulty,.difficulty-control-actions{grid-column:1}.workbook-builder-form,.workbook-builder-summary{padding:18px}.game-session-header{align-items:stretch;flex-direction:column}.game-session-header .button-ghost{width:100%}}

.print-document-footer{display:none}
@media print{.print-document-footer{display:grid!important;position:fixed;left:18mm;right:18mm;bottom:5mm;grid-template-columns:18mm 1fr auto;gap:4mm;align-items:center;padding-top:2mm;border-top:.3mm solid #d7cce2;background:#fff;color:#39254b;font-family:Arial,sans-serif;font-size:7.5pt;z-index:999999}.print-document-footer img{width:18mm;height:11mm;object-fit:contain}.print-document-footer strong{display:block}.print-document-footer .print-page-number:after{content:'Página ' counter(page)}.reader-page{padding-bottom:24mm!important}}
.empty-filter-result{padding:18px;border-radius:16px;background:#fff8e8;border:1px solid #f0d89a;color:#5b4315}.empty-filter-result p{margin:6px 0 0;color:#765f2e}

/* v31.1 — varrimento visual, tipografia escolar e módulos profissionais */
:root {
  --school-font: "Edu TAS Beginner", "Edu NSW ACT Cursive", "Segoe Print", "Chalkboard SE", cursive;
  --radius-xl: 26px;
  --radius-lg: 21px;
  --radius-md: 15px;
}

/* Proteção contra texto fora de cartões, grelhas, modais e controlos */
.card, .card *, .grid > *, .topbar *, .dialog *, .lesson-row *, .subject-header *,
.document-subject-card *, .badge-card *, .points-hero-card * { min-width: 0; }
.card p, .card small, .card strong, .dialog p, .dialog label, .lesson-row p,
.subject-header p, .document-theme-chip, .document-generator-summary {
  overflow-wrap: anywhere;
  word-break: normal;
}

/* Escala editorial mais compacta */
main#app { padding-top: 26px; }
.page-heading { margin-bottom: 20px; }
.page-heading h1 { font-size: clamp(32px, 3.8vw, 54px); line-height: 1.04; letter-spacing: -.045em; }
.page-heading p { font-size: clamp(15px, 1.15vw, 18px); line-height: 1.5; }
.section-title { margin: 28px 0 14px; }
.section-title h2 { font-size: clamp(24px, 2.35vw, 34px); }
.section-title p { font-size: 14px; line-height: 1.45; }
.card-pad { padding: clamp(18px, 2vw, 28px); }
.button, .button-ghost, .button-soft { padding: 11px 17px; border-radius: 14px; }
.button-small { padding: 8px 11px; font-size: 12px; }
input, select, textarea { padding: 11px 12px; border-radius: 13px; }

/* Barra lateral: sete áreas sem cortes verticais */
.sidebar { grid-template-rows: auto minmax(0,1fr) auto; gap: 14px; padding-top: 18px; padding-bottom: 14px; }
.brand-mark { height: 106px; }
.brand-mark img { height: 94px; }
.sidebar-nav { gap: 5px; overflow-y: auto; scrollbar-width: thin; padding-right: 2px; }
.sidebar .nav-item { min-height: 52px; padding-block: 6px; border-radius: 16px; }
.sidebar .nav-item span { font-size: 22px; }
.sidebar .nav-item small { font-size: 13px; }
.sidebar-footer { gap: 8px; }
.sidebar-support { padding: 13px 14px; border-radius: 19px; gap: 4px; }
.sidebar-support-icon { font-size: 23px; }
.sidebar-support strong { font-size: 17px; }
.sidebar-support small { font-size: 11px; line-height: 1.28; }

/* Topo com pontos sempre visíveis, mas sem esmagar ações */
.topbar { min-height: 92px; padding-block: 12px; }
.brand-copy strong { font-size: clamp(25px, 2.05vw, 36px); }
.brand-copy span { font-size: 14px; }
.topbar-actions { gap: 9px; }
.points-chip {
  min-width: 176px;
  border: 1px solid rgba(124,58,237,.18);
  border-radius: 18px;
  padding: 8px 11px;
  display: grid;
  grid-template-columns: 34px minmax(0,1fr);
  gap: 8px;
  align-items: center;
  background: linear-gradient(145deg,#fff,#f4edff);
  box-shadow: 0 10px 28px rgba(74,45,98,.09);
  cursor: pointer;
  text-align: left;
}
.points-chip:hover { transform: translateY(-2px); box-shadow: 0 14px 32px rgba(92,42,139,.15); }
.points-chip-icon { width: 34px; height: 34px; border-radius: 12px; display:grid; place-items:center; background:#fff; font-size:20px; }
.points-chip-copy { display:grid; gap:1px; }
.points-chip-copy strong { font-size: 13px; line-height:1.2; white-space:nowrap; }
.points-chip-copy small { font-size: 10px; color:var(--ink-soft); font-weight:800; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.points-chip-copy i { height:4px; margin-top:3px; border-radius:999px; overflow:hidden; background:#e7ddf3; }
.points-chip-copy i b { display:block; width:0; height:100%; border-radius:inherit; background:linear-gradient(90deg,var(--primary),var(--primary-2),var(--cyan)); transition:width .3s ease; }

/* Cabeçalho de disciplina: progresso e botão em linhas independentes */
.subject-header {
  grid-template-columns: minmax(0,1fr) minmax(190px, 244px);
  align-items: center;
  padding: 24px 28px;
  gap: 24px;
}
.subject-header h1 { font-size: clamp(32px, 3.5vw, 48px); line-height:1.04; }
.subject-actions { display:grid; grid-template-columns: 1fr; justify-items:stretch; align-content:center; gap:10px; width:100%; }
.subject-actions .mastery-ring { justify-self:center; flex:0 0 auto; }
.subject-actions .button, .subject-actions .button-soft, .subject-actions .button-ghost { width:100%; white-space:normal; text-align:center; }
.mastery-ring { width:62px; height:62px; }

/* Linhas de lição e cartões com densidade profissional */
.lesson-row { padding: 15px 17px; gap: 13px; }
.lesson-row h3 { font-size: 16px; line-height:1.3; }
.lesson-row p { font-size: 14px; line-height:1.4; }
.lesson-index { width:42px; height:42px; }
.subject-card { min-height: 204px; padding: 21px; }
.subject-card h3 { font-size: 21px; }
.subject-card p { font-size: 14px; }

/* Modais dimensionados pelo conteúdo, nunca fora do ecrã */
.dialog {
  width: min(620px, calc(100vw - 32px));
  max-height: min(82vh, 720px);
  border-radius: 22px;
  overflow: hidden;
}
.dialog form { padding: 22px 24px; max-height: min(82vh, 720px); overflow-y:auto; overscroll-behavior:contain; }
.dialog h2 { font-size: clamp(23px, 2.4vw, 29px); line-height:1.12; margin:4px 0 7px; }
.dialog p { font-size:14px; line-height:1.45; }
.dialog label { font-size:13px; }
.dialog-actions { margin-top:16px; gap:8px; position:sticky; bottom:-22px; padding:12px 0 2px; background:linear-gradient(180deg,rgba(255,255,255,0),#fff 30%); }
.onboarding-dialog { width:min(720px,calc(100vw - 32px)); }
.donate-dialog { width:min(560px,calc(100vw - 32px)); }
.install-dialog { width:min(600px,calc(100vw - 32px)); }
.install-dialog-hero { grid-template-columns:78px 1fr; gap:15px; padding:20px 22px 17px; }
.install-dialog-hero img { width:72px; height:72px; border-radius:19px; }
.install-dialog-hero h2 { font-size:clamp(23px,2.5vw,30px); }
.install-platform { margin:16px 22px 0; padding:11px 13px; font-size:13px; }
.install-steps { margin:14px 22px 0; gap:8px; font-size:13px; }
.install-status { margin:12px 22px 0; font-size:13px; }
.install-dialog .dialog-actions { padding:0 22px 20px; }

/* Letra escolar: traço simples, tamanho legível e configuração estável */
.reader-text {
  font-size: clamp(21px, 1.85vw, 30px);
  line-height: 1.62;
  letter-spacing: .002em;
  padding: 26px clamp(28px,4vw,56px) 32px;
}
.reader-text.school-font {
  font-family: var(--school-font);
  font-weight: 500;
  font-size: clamp(23px, 2vw, 31px);
  line-height: 1.68;
  letter-spacing: .003em;
  word-spacing: .018em;
  font-variant-ligatures: none;
  font-synthesis: none;
}
.reader-text.school-font p, .reader-text.school-font span { font-family:inherit; }
.reader-controls { grid-template-columns:repeat(5,minmax(0,1fr)); }
.reader-controls button { min-height:46px; padding:10px 11px; font-size:13px; white-space:normal; }

/* Jornada e pontos premium */
.points-hero-card {
  margin-top:20px;
  padding:22px 24px;
  display:grid;
  grid-template-columns:70px minmax(0,1fr) auto;
  align-items:center;
  gap:18px;
  background:linear-gradient(135deg,#241044,#5b2494 58%,#b52d93);
  color:#fff;
  overflow:hidden;
  position:relative;
}
.points-hero-card:after { content:'✦'; position:absolute; right:20%; top:-55px; font-size:150px; opacity:.06; }
.points-hero-icon { width:66px; height:66px; border-radius:21px; display:grid; place-items:center; font-size:34px; background:rgba(255,255,255,.13); border:1px solid rgba(255,255,255,.18); }
.points-hero-copy h2 { margin:4px 0; font-size:clamp(23px,2.3vw,34px); }
.points-hero-copy p { margin:0 0 10px; color:rgba(255,255,255,.78); font-size:13px; }
.points-hero-card .eyebrow { color:#f0c8ff; }
.points-level-track { height:8px; border-radius:999px; background:rgba(255,255,255,.18); overflow:hidden; }
.points-level-track div { height:100%; border-radius:inherit; background:linear-gradient(90deg,#ffd166,#ff8ab6,#7de7ff); }
.points-hero-total { display:grid; text-align:center; min-width:92px; }
.points-hero-total strong { font-size:36px; line-height:1; }
.points-hero-total span { margin-top:4px; font-size:12px; font-weight:850; color:rgba(255,255,255,.8); }
.badges-grid { grid-template-columns:repeat(auto-fit,minmax(280px,1fr)); gap:14px; }
.badge-card { padding:17px; display:grid; grid-template-columns:52px minmax(0,1fr); gap:13px; align-items:start; min-height:148px; }
.badge-card-icon { width:52px; height:52px; border-radius:17px; display:grid; place-items:center; font-size:28px; background:linear-gradient(145deg,#f5edff,#fff3f8); }
.badge-card.is-locked { box-shadow:0 12px 35px rgba(61,34,86,.08); }
.badge-card.is-locked .badge-card-icon { filter:grayscale(1); opacity:.48; }
.badge-card.is-unlocked { border-color:rgba(203,149,33,.35); background:linear-gradient(145deg,#fffdf5,#fff7e4); }
.badge-card-copy { display:grid; gap:5px; }
.badge-card-copy strong { font-size:16px; line-height:1.25; }
.badge-card-copy p { margin:0; color:var(--ink-soft); font-size:12px; line-height:1.38; }
.badge-progress-row { display:grid; grid-template-columns:minmax(0,1fr) auto; align-items:center; gap:8px; margin-top:4px; }
.badge-progress-row .progress-track { height:7px; }
.badge-progress-row b { font-size:11px; }
.badge-card-copy small { font-size:10px; font-weight:900; color:var(--primary); text-transform:uppercase; letter-spacing:.05em; }

/* Módulo Documentos */
.documents-heading { display:flex; justify-content:space-between; gap:20px; align-items:center; }
.documents-bank-pill { flex:0 0 auto; min-width:180px; padding:14px 17px; border-radius:19px; border:1px solid #ded1ee; background:linear-gradient(145deg,#fff,#f4edff); display:grid; text-align:center; }
.documents-bank-pill strong { font-size:24px; color:var(--primary); }
.documents-bank-pill span { font-size:11px; color:var(--ink-soft); font-weight:850; }
.document-feature-grid { grid-template-columns:repeat(3,minmax(0,1fr)); }
.document-feature-card { padding:21px; display:grid; align-content:start; gap:9px; min-height:200px; }
.document-feature-card > span { width:48px; height:48px; border-radius:16px; display:grid; place-items:center; background:#f2eaff; font-size:25px; }
.document-feature-card h2, .document-feature-card h3 { margin:4px 0 0; font-size:21px; }
.document-feature-card p { margin:0; color:var(--ink-soft); font-size:13px; line-height:1.45; }
.document-subject-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
.document-subject-card { padding:20px; display:grid; gap:13px; }
.document-subject-head { display:grid; grid-template-columns:47px minmax(0,1fr) auto; align-items:center; gap:11px; }
.document-subject-head > span { width:47px; height:47px; display:grid; place-items:center; border-radius:15px; background:#f2eaff; font-size:24px; }
.document-subject-head h3 { margin:0 0 2px; font-size:18px; }
.document-subject-head small { color:var(--ink-soft); font-size:11px; }
.document-subject-count { font-size:12px; padding:6px 8px; border-radius:999px; background:#f4eff9; white-space:nowrap; }
.document-theme-list { display:flex; flex-wrap:wrap; gap:6px; }
.document-theme-chip { padding:5px 8px; border-radius:999px; border:1px solid #e4d9f0; background:#fff; font-size:10px; color:var(--ink-soft); font-weight:800; }
.document-subject-card .button { width:100%; }
.document-generator-card { padding:24px; scroll-margin-top:110px; }
.document-generator-head { display:flex; align-items:start; justify-content:space-between; gap:18px; margin-bottom:18px; }
.document-generator-head h2 { margin:4px 0 5px; font-size:clamp(24px,2.4vw,34px); }
.document-generator-head p { margin:0; color:var(--ink-soft); font-size:14px; }
.document-minimum { padding:7px 10px; border-radius:999px; background:#efe5ff; color:#6925a0; font-size:11px; font-weight:950; white-space:nowrap; }
.four-cols { grid-template-columns:repeat(4,minmax(0,1fr)); }
.document-generator-fields label { font-size:12px; }
.document-generator-fields .check-label { align-content:center; }
.document-subject-selector, .document-theme-selector { margin:18px 0 0; padding:15px; border:1px solid var(--line); border-radius:17px; }
.document-subject-selector legend, .document-theme-selector legend { padding:0 7px; font-weight:950; font-size:13px; }
.document-theme-groups { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; }
.document-theme-group { padding:12px; border-radius:14px; background:#faf7fd; border:1px solid #ece4f3; }
.document-theme-group strong { display:block; margin-bottom:8px; font-size:13px; }
.document-theme-options { display:grid; gap:7px; }
.check-label { display:flex; align-items:flex-start; gap:8px; font-size:12px; font-weight:750; }
.check-label input { width:17px; height:17px; margin:1px 0 0; flex:0 0 auto; }
.document-generator-summary { margin-top:15px; padding:12px 14px; border-radius:14px; background:#eef9ff; border:1px solid #cfe8f4; color:#31556b; font-size:12px; font-weight:800; line-height:1.45; }
.document-archive-grid { grid-template-columns:repeat(3,minmax(0,1fr)); }
.archive-document { padding:15px; display:grid; grid-template-columns:38px minmax(0,1fr) auto; gap:10px; align-items:center; text-decoration:none; box-shadow:0 10px 30px rgba(62,34,93,.08); }
.archive-document > span { width:38px; height:38px; display:grid; place-items:center; border-radius:12px; background:#f2eaff; }
.archive-document div { display:grid; gap:2px; }
.archive-document strong { font-size:13px; line-height:1.25; }
.archive-document small { color:var(--ink-soft); font-size:10px; }

/* Jogos: perguntas e cartões sem gigantismo */
.game-card { min-height:195px; padding:20px; }
.game-card h3 { font-size:20px; }
.game-card p { font-size:13px; }
.game-stage { padding:24px; }
.game-question { font-size:clamp(24px,3vw,38px); line-height:1.15; margin:13px 0 20px; }
.game-options button { min-height:54px; font-size:16px; }

@media (max-width: 1280px) {
  .topbar-actions .points-chip { min-width:145px; }
  .points-chip-copy small { display:none; }
  .four-cols { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .document-feature-grid, .document-archive-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
}

@media (max-width: 1050px) and (min-width: 821px) {
  .topbar-actions .donate-button span:last-child, .topbar-actions .install-quick span:last-child { display:none; }
  .topbar-actions .donate-button, .topbar-actions .install-quick { width:44px; height:44px; padding:0; justify-content:center; }
  .points-chip { min-width:128px; grid-template-columns:30px 1fr; }
  .points-chip-icon { width:30px; height:30px; }
}

@media (max-width: 820px) {
  :root { --topbar:72px; }
  body { padding-bottom:calc(76px + env(safe-area-inset-bottom)); }
  .topbar { min-height:72px; padding:8px 11px; }
  .brand-copy strong { font-size:18px; }
  .brand-copy span { display:none; }
  .topbar-actions { gap:6px; }
  .points-chip { min-width:82px; padding:6px 8px; grid-template-columns:25px 1fr; border-radius:14px; }
  .points-chip-icon { width:25px; height:25px; font-size:15px; border-radius:9px; }
  .points-chip-copy strong { font-size:10px; }
  .points-chip-copy small, .points-chip-copy i { display:none; }
  .child-chip { padding:7px 9px; font-size:12px; }
  .install-quick { width:38px; height:38px; padding:0; justify-content:center; }
  .donate-button { display:none; }
  .mobile-nav { grid-template-columns:repeat(6,minmax(64px,1fr)); overflow-x:auto; overflow-y:hidden; padding-inline:5px; scrollbar-width:none; }
  .mobile-nav::-webkit-scrollbar { display:none; }
  .mobile-nav .nav-item { min-height:56px; min-width:64px; }
  .mobile-nav .nav-item small { font-size:9px; }
  main#app { padding:17px 13px 28px; }
  .page-heading h1 { font-size:clamp(30px,9vw,42px); }
  .subject-header { grid-template-columns:1fr; padding:20px; gap:14px; }
  .subject-actions { grid-template-columns:62px minmax(0,1fr); align-items:center; }
  .subject-actions .mastery-ring { grid-row:1 / span 2; }
  .subject-actions > *:not(.mastery-ring) { grid-column:2; }
  .reader-text, .reader-text.school-font { text-align:left; text-align-last:auto; hyphens:none; font-size:clamp(21px,6vw,27px); line-height:1.62; padding:22px 19px 28px; }
  .reader-controls { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .points-hero-card { grid-template-columns:52px minmax(0,1fr); padding:18px; gap:12px; }
  .points-hero-icon { width:52px; height:52px; border-radius:16px; font-size:27px; }
  .points-hero-total { grid-column:1/-1; grid-template-columns:auto 1fr; justify-content:start; align-items:baseline; text-align:left; gap:7px; }
  .points-hero-total strong { font-size:28px; }
  .badges-grid, .document-subject-grid, .document-feature-grid, .document-archive-grid, .document-theme-groups, .four-cols { grid-template-columns:1fr; }
  .documents-heading { align-items:stretch; flex-direction:column; }
  .documents-bank-pill { min-width:0; grid-template-columns:auto 1fr; align-items:center; text-align:left; gap:9px; }
  .document-generator-card { padding:18px; }
  .document-generator-head { flex-direction:column; }
  .dialog { width:min(560px,calc(100vw - 20px)); max-height:88vh; border-radius:18px; }
  .dialog form { padding:18px 16px; max-height:88vh; }
  .dialog h2 { font-size:23px; }
  .dialog-actions { bottom:-18px; display:grid; grid-template-columns:1fr 1fr; }
  .dialog-actions > * { width:100%; }
}

@media (max-width: 520px) {
  .topbar-actions .icon-button { display:none; }
  .points-chip { min-width:72px; }
  .points-chip-copy strong { max-width:42px; overflow:hidden; text-overflow:ellipsis; }
  .brand-copy strong { max-width:180px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
  .subject-actions { grid-template-columns:1fr; }
  .subject-actions .mastery-ring { grid-row:auto; justify-self:start; }
  .subject-actions > *:not(.mastery-ring) { grid-column:auto; }
  .badge-card { grid-template-columns:44px minmax(0,1fr); padding:14px; }
  .badge-card-icon { width:44px; height:44px; font-size:23px; border-radius:14px; }
  .dialog-actions { grid-template-columns:1fr; }
}
.document-card-footer { display:flex; justify-content:space-between; align-items:center; gap:10px; padding-top:2px; }
.document-card-footer strong { font-size:12px; color:var(--primary); }
.document-card-footer .button-soft { margin-left:auto; }
.document-facts { display:flex; flex-wrap:wrap; gap:7px; margin-top:12px; }
.document-facts span { padding:6px 8px; border-radius:999px; background:#f7f2fc; border:1px solid #e9def4; font-size:10px; font-weight:850; }
.annual-workbook-card { grid-column:span 2; background:linear-gradient(135deg,#fff,#f7efff 56%,#edfaff); }
.assessment-card { background:linear-gradient(145deg,#fff,#fff6e9); }
.document-theme-group { margin:9px 0; padding:0; border:1px solid #ece4f3; border-radius:14px; background:#faf7fd; overflow:hidden; }
.document-theme-group summary { display:flex; justify-content:space-between; gap:12px; align-items:center; padding:11px 13px; cursor:pointer; font-weight:900; font-size:13px; }
.document-theme-group summary small { color:var(--ink-soft); font-size:10px; }
.document-theme-group .document-theme-options { padding:0 13px 13px; display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:7px; }
.compact-check { padding:7px 8px; border-radius:10px; background:#fff; border:1px solid #ece4f3; }
@media(max-width:820px){.annual-workbook-card{grid-column:auto}.document-card-footer{align-items:stretch;flex-direction:column}.document-card-footer .button-soft{width:100%;margin:0}.document-theme-group .document-theme-options{grid-template-columns:1fr}}
/* Caligrafia escolar: preservar ligações e alternâncias contextuais do tipo cursivo */
:root { --school-font: "Edu NSW ACT Cursive", "Edu TAS Beginner", "Segoe Print", "Chalkboard SE", cursive; }
.reader-text.school-font {
  letter-spacing: 0;
  word-spacing: .015em;
  font-variant-ligatures: common-ligatures contextual;
  font-feature-settings: "liga" 1, "clig" 1, "calt" 1, "kern" 1;
  font-kerning: normal;
}
.points-detail-grid { margin-top:16px; align-items:start; }
.points-rules-card h2, .points-history-card h2 { margin:5px 0 7px; font-size:23px; }
.points-rules-card > p { margin:0 0 13px; color:var(--ink-soft); font-size:13px; line-height:1.45; }
.points-rules-list, .points-history-list { display:grid; gap:8px; }
.points-rules-list > div { display:grid; grid-template-columns:35px minmax(0,1fr) auto; gap:9px; align-items:center; padding:9px 10px; border:1px solid #ece3f4; border-radius:13px; background:#fff; }
.points-rules-list > div > span { width:35px; height:35px; display:grid; place-items:center; border-radius:11px; background:#f3ecfb; }
.points-rules-list div div, .points-history-list div div { display:grid; gap:2px; }
.points-rules-list strong, .points-history-list strong { font-size:12px; line-height:1.3; }
.points-rules-list small, .points-history-list small { color:var(--ink-soft); font-size:9px; line-height:1.3; }
.points-rules-list b { color:var(--primary); font-size:12px; white-space:nowrap; }
.points-history-list > div { display:grid; grid-template-columns:48px minmax(0,1fr); gap:10px; align-items:center; padding:10px; border-bottom:1px solid #eee6f4; }
.points-history-list > div > span { width:46px; height:35px; display:grid; place-items:center; border-radius:11px; background:#eafaf4; color:#167454; font-size:12px; font-weight:950; }
.mastery-summary { display:grid; justify-items:center; gap:4px; }
.mastery-summary > small { color:var(--ink-soft); font-size:10px; font-weight:850; text-transform:uppercase; letter-spacing:.05em; }
.subject-actions .mastery-summary { justify-self:center; }
@media(max-width:820px){.subject-actions .mastery-summary{grid-row:1 / span 2}.subject-actions > *:not(.mastery-summary){grid-column:2}}
@media(max-width:520px){.subject-actions .mastery-summary{grid-row:auto;justify-self:start}.subject-actions > *:not(.mastery-summary){grid-column:auto}}
@media(max-width:820px){.subject-actions .mastery-summary{grid-column:1}.subject-actions .mastery-ring{grid-row:auto}.subject-actions > .button,.subject-actions > .button-soft,.subject-actions > .button-ghost{grid-column:2}}
@media(max-width:520px){.subject-actions .mastery-summary,.subject-actions > .button,.subject-actions > .button-soft,.subject-actions > .button-ghost{grid-column:auto}}
@media (max-width:1050px) and (min-width:821px) {
  .topbar-actions .icon-button { display:none; }
  .topbar-actions .child-chip { width:44px; height:44px; padding:0; justify-content:center; }
  .topbar-actions .child-chip span:last-child { display:none; }
}

/* v31 — navegação móvel robusta, incluindo Android em modo "site para computador" */
html, body { max-width: 100%; overflow-x: hidden; }
.app-shell, main#app, .page, .page > *, .grid, .grid > *, .card { min-width: 0; }

/* O navegador pode anunciar uma largura de desktop num telemóvel em paisagem.
   Nestes casos, a combinação ecrã baixo + ponteiro tátil força a navegação móvel. */
@media (max-width: 1024px),
       (hover: none) and (pointer: coarse) and (max-height: 720px),
       (any-hover: none) and (any-pointer: coarse) and (max-height: 720px) {
  :root {
    --sidebar: 0px;
    --topbar: 64px;
    --mobile-nav-height: 64px;
  }

  html, body { width: 100%; max-width: 100%; overflow-x: hidden; }
  body {
    padding-bottom: calc(var(--mobile-nav-height) + env(safe-area-inset-bottom));
    overscroll-behavior-x: none;
  }

  .sidebar { display: none !important; }
  .app-shell {
    width: 100%;
    max-width: 100%;
    margin-left: 0 !important;
    overflow-x: clip;
  }

  .topbar {
    min-height: var(--topbar);
    padding: 7px 10px;
    gap: 8px;
  }
  .brand-copy {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
  }
  .brand-copy strong {
    display: block;
    max-width: min(42vw, 360px);
    font-size: clamp(16px, 4vw, 21px);
    line-height: 1.08;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .brand-copy span { display: none !important; }

  .topbar-actions {
    flex: 0 0 auto;
    min-width: 0;
    gap: 5px;
  }
  .points-chip {
    min-width: 68px !important;
    max-width: 78px;
    min-height: 40px;
    padding: 5px 7px;
    grid-template-columns: 24px minmax(0, 1fr);
    gap: 5px;
    border-radius: 13px;
  }
  .points-chip-icon {
    width: 24px;
    height: 24px;
    border-radius: 8px;
    font-size: 14px;
  }
  .points-chip-copy strong {
    max-width: 42px;
    font-size: 9px;
    line-height: 1.05;
    white-space: normal;
    overflow-wrap: normal;
  }
  .points-chip-copy small,
  .points-chip-copy i { display: none !important; }

  .child-chip {
    width: 40px;
    height: 40px;
    padding: 0;
    justify-content: center;
    border-radius: 14px;
  }
  .child-chip span:last-child { display: none !important; }
  .donate-button { display: none !important; }
  .install-quick {
    width: 40px;
    height: 40px;
    padding: 0;
    justify-content: center;
    border-radius: 14px;
  }
  .install-quick span:last-child { display: none !important; }
  .topbar-actions .icon-button {
    width: 40px;
    height: 40px;
    border-radius: 14px;
    font-size: 17px;
  }

  main#app {
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 15px 12px 26px;
    overflow-x: clip;
  }

  .mobile-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 80;
    display: grid !important;
    grid-template-columns: repeat(6, minmax(0, 1fr)) !important;
    width: 100%;
    max-width: 100%;
    min-height: var(--mobile-nav-height);
    padding: 5px max(4px, env(safe-area-inset-left)) calc(5px + env(safe-area-inset-bottom)) max(4px, env(safe-area-inset-right));
    overflow: visible !important;
    background: rgba(255, 255, 255, .97);
    border-top: 1px solid var(--line);
    box-shadow: 0 -10px 30px rgba(38, 20, 63, .10);
    backdrop-filter: blur(18px);
  }
  .mobile-nav .nav-item {
    width: 100%;
    min-width: 0 !important;
    min-height: 53px;
    padding: 4px 1px;
    border-radius: 14px;
    grid-template-columns: 1fr;
    place-items: center;
    align-content: center;
    gap: 1px;
  }
  .mobile-nav .nav-item span {
    justify-self: center;
    font-size: 19px;
    line-height: 1;
  }
  .mobile-nav .nav-item small {
    display: block;
    width: 100%;
    min-width: 0;
    padding-inline: 1px;
    font-size: clamp(7px, 2.1vw, 9px);
    line-height: 1.05;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .hero {
    grid-template-columns: 1fr !important;
    min-height: auto;
  }
  .hero-copy { padding: 21px 18px 10px; }
  .hero-copy h1 {
    max-width: 100%;
    margin-block: 6px 10px;
    font-size: clamp(32px, 8vw, 48px);
    line-height: 1.02;
    letter-spacing: -.045em;
    overflow-wrap: anywhere;
  }
  .hero-copy p { font-size: 16px; line-height: 1.45; }
  .hero-art { min-height: 200px; }
  .hero-art img { max-height: 240px; }

  .grid-2, .grid-3, .grid-4,
  .stat-strip, .mission-grid, .subject-grid, .story-grid,
  .game-grid, .badge-grid, .badges-grid, .parent-grid,
  .lesson-layout, .document-feature-grid, .document-subject-grid,
  .document-archive-grid, .document-theme-groups, .four-cols,
  .workbook-builder-layout, .weekly-plan-grid {
    grid-template-columns: 1fr !important;
  }

  .reading-club-heading, .documents-heading, .support-card,
  .document-generator-head, .game-session-header {
    align-items: stretch;
    flex-direction: column;
  }

  .subject-header { grid-template-columns: 1fr !important; padding: 18px; gap: 13px; }
  .subject-header h1 { font-size: clamp(29px, 7vw, 40px); }
  .subject-actions { grid-template-columns: 1fr !important; }
  .subject-actions > *, .subject-actions .mastery-summary,
  .subject-actions > .button, .subject-actions > .button-soft,
  .subject-actions > .button-ghost { grid-column: auto !important; }

  .reader-visual, .reader-visual img { min-height: 260px; height: 260px; }
  .reader-text, .reader-text.school-font {
    text-align: left;
    text-align-last: auto;
    hyphens: none;
    font-size: clamp(20px, 5vw, 26px);
    line-height: 1.62;
    padding: 21px 18px 27px;
  }
  .reader-controls { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .reader-controls button:last-child { grid-column: 1 / -1; }

  .dialog {
    width: calc(100vw - 16px) !important;
    max-width: calc(100vw - 16px) !important;
    max-height: calc(100dvh - 16px) !important;
    margin: auto;
    border-radius: 17px;
  }
  .dialog form {
    max-height: calc(100dvh - 16px) !important;
    padding: 17px 14px;
  }
  .dialog-actions {
    grid-template-columns: 1fr 1fr;
    bottom: -17px;
  }

  input, select, textarea { font-size: 16px; }
  button, .button, .button-soft, .button-ghost { touch-action: manipulation; }
}

/* Fallback por JavaScript para navegadores móveis que mascaram as media queries
   quando o utilizador ativa "site para computador". */
html.touch-compact, html.touch-compact body { max-width: 100%; overflow-x: hidden; }
html.touch-compact body { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
html.touch-compact .sidebar { display: none !important; }
html.touch-compact .app-shell { width: 100%; max-width: 100%; margin-left: 0 !important; overflow-x: clip; }
html.touch-compact .topbar { min-height: 64px; padding: 7px 10px; gap: 8px; }
html.touch-compact .brand-copy { flex: 1 1 auto; min-width: 0; overflow: hidden; }
html.touch-compact .brand-copy strong { display: block; max-width: min(42vw, 360px); font-size: clamp(16px, 4vw, 21px); line-height: 1.08; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
html.touch-compact .brand-copy span { display: none !important; }
html.touch-compact .topbar-actions { flex: 0 0 auto; min-width: 0; gap: 5px; }
html.touch-compact .points-chip { min-width: 68px !important; max-width: 78px; min-height: 40px; padding: 5px 7px; grid-template-columns: 24px minmax(0,1fr); gap: 5px; border-radius: 13px; }
html.touch-compact .points-chip-icon { width: 24px; height: 24px; border-radius: 8px; font-size: 14px; }
html.touch-compact .points-chip-copy strong { max-width: 42px; font-size: 9px; line-height: 1.05; white-space: normal; }
html.touch-compact .points-chip-copy small,
html.touch-compact .points-chip-copy i { display: none !important; }
html.touch-compact .child-chip { width: 40px; height: 40px; padding: 0; justify-content: center; border-radius: 14px; }
html.touch-compact .child-chip span:last-child,
html.touch-compact .donate-button { display: none !important; }
html.touch-compact .install-quick { width: 40px; height: 40px; padding: 0; justify-content: center; border-radius: 14px; }
html.touch-compact .install-quick span:last-child { display: none !important; }
html.touch-compact .topbar-actions .icon-button { width: 40px; height: 40px; border-radius: 14px; font-size: 17px; }
html.touch-compact main#app { width: 100%; max-width: 100%; margin: 0; padding: 15px 12px 26px; overflow-x: clip; }
html.touch-compact .mobile-nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 80; display: grid !important; grid-template-columns: repeat(6,minmax(0,1fr)) !important; width: 100%; max-width: 100%; min-height: 64px; padding: 5px max(4px,env(safe-area-inset-left)) calc(5px + env(safe-area-inset-bottom)) max(4px,env(safe-area-inset-right)); overflow: visible !important; background: rgba(255,255,255,.97); border-top: 1px solid var(--line); box-shadow: 0 -10px 30px rgba(38,20,63,.10); backdrop-filter: blur(18px); }
html.touch-compact .mobile-nav .nav-item { width: 100%; min-width: 0 !important; min-height: 53px; padding: 4px 1px; border-radius: 14px; grid-template-columns: 1fr; place-items: center; align-content: center; gap: 1px; }
html.touch-compact .mobile-nav .nav-item span { justify-self: center; font-size: 19px; line-height: 1; }
html.touch-compact .mobile-nav .nav-item small { display: block; width: 100%; min-width: 0; padding-inline: 1px; font-size: clamp(7px,2.1vw,9px); line-height: 1.05; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
html.touch-compact .hero { grid-template-columns: 1fr !important; min-height: auto; }
html.touch-compact .hero-copy { padding: 21px 18px 10px; }
html.touch-compact .hero-copy h1 { max-width: 100%; margin-block: 6px 10px; font-size: clamp(32px,8vw,48px); line-height: 1.02; letter-spacing: -.045em; overflow-wrap: anywhere; }
html.touch-compact .hero-copy p { font-size: 16px; line-height: 1.45; }
html.touch-compact .hero-art { min-height: 200px; }
html.touch-compact .hero-art img { max-height: 240px; }
html.touch-compact .grid-2,
html.touch-compact .grid-3,
html.touch-compact .grid-4,
html.touch-compact .stat-strip,
html.touch-compact .mission-grid,
html.touch-compact .subject-grid,
html.touch-compact .story-grid,
html.touch-compact .game-grid,
html.touch-compact .badge-grid,
html.touch-compact .badges-grid,
html.touch-compact .parent-grid,
html.touch-compact .lesson-layout,
html.touch-compact .document-feature-grid,
html.touch-compact .document-subject-grid,
html.touch-compact .document-archive-grid,
html.touch-compact .document-theme-groups,
html.touch-compact .four-cols,
html.touch-compact .workbook-builder-layout,
html.touch-compact .weekly-plan-grid { grid-template-columns: 1fr !important; }
html.touch-compact .subject-header { grid-template-columns: 1fr !important; padding: 18px; gap: 13px; }
html.touch-compact .reader-visual,
html.touch-compact .reader-visual img { min-height: 260px; height: 260px; }
html.touch-compact .reader-text,
html.touch-compact .reader-text.school-font { text-align: left; text-align-last: auto; hyphens: none; font-size: clamp(20px,5vw,26px); line-height: 1.62; padding: 21px 18px 27px; }
html.touch-compact .reader-controls { grid-template-columns: repeat(2,minmax(0,1fr)) !important; }
html.touch-compact .reader-controls button:last-child { grid-column: 1 / -1; }
html.touch-compact .dialog { width: calc(100vw - 16px) !important; max-width: calc(100vw - 16px) !important; max-height: calc(100dvh - 16px) !important; margin: auto; border-radius: 17px; }
html.touch-compact .dialog form { max-height: calc(100dvh - 16px) !important; padding: 17px 14px; }
html.touch-compact input,
html.touch-compact select,
html.touch-compact textarea { font-size: 16px; }

@media (orientation: landscape) and (max-height: 560px),
       (hover: none) and (pointer: coarse) and (orientation: landscape) and (max-height: 650px) {
  :root { --topbar: 56px; --mobile-nav-height: 56px; }
  body { padding-bottom: calc(56px + env(safe-area-inset-bottom)); }
  .topbar { min-height: 56px; padding-block: 5px; }
  .brand-copy strong { max-width: min(36vw, 300px); font-size: 16px; }
  .points-chip, .child-chip, .install-quick, .topbar-actions .icon-button { min-height: 36px; height: 36px; }
  .mobile-nav { min-height: 56px; padding-top: 3px; padding-bottom: calc(3px + env(safe-area-inset-bottom)); }
  .mobile-nav .nav-item { min-height: 48px; }
  .mobile-nav .nav-item span { font-size: 17px; }
  .mobile-nav .nav-item small { font-size: 7px; }
  main#app { padding-top: 10px; }
  .hero-copy { padding: 16px 16px 8px; }
  .hero-copy h1 { font-size: clamp(28px, 6vw, 40px); }
  .hero-art { min-height: 160px; }
  .hero-art img { max-height: 190px; }
}

/* v32 — revisão editorial, escala tipográfica, contraste e contenção */
:root {
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
}
body { font-size: 15.5px; }
.brand-copy strong { font-size: clamp(22px, 2vw, 32px); line-height: 1.08; }
.brand-copy span { font-size: 15px; }
main#app { padding-top: 28px; }
.page-heading h1 { font-size: clamp(31px, 4vw, 50px); line-height: 1.04; letter-spacing: -.045em; }
.page-heading p { font-size: clamp(15.5px, 1.2vw, 18px); line-height: 1.5; }
.hero { min-height: 390px; }
.hero-copy { padding: clamp(26px, 3.4vw, 48px); }
.hero-copy h1 { font-size: clamp(38px, 4.5vw, 64px); line-height: 1.01; letter-spacing: -.05em; }
.hero-copy p { font-size: clamp(16px, 1.35vw, 20px); line-height: 1.48; }
.hero-art { min-height: 320px; }
.hero-art img { max-height: 390px; }
.section-title { margin-top: 30px; }
.section-title h2 { font-size: clamp(24px, 2.45vw, 34px); line-height: 1.08; }
.section-title p { font-size: 15.5px; line-height: 1.45; }
.support-card h2 { font-size: clamp(24px, 2.5vw, 34px); }
.support-card p { font-size: 15.5px; }
.subject-header { padding: 23px; }
.subject-header h1 { font-size: clamp(30px, 3.3vw, 44px); line-height: 1.04; }
.subject-header p { line-height: 1.48; }
.lesson-content { padding: 26px; }
.lesson-content h1 { font-size: clamp(30px, 3.4vw, 44px); line-height: 1.05; }
.lesson-content h2 { font-size: clamp(22px, 2vw, 29px); }
.lesson-content p, .lesson-content li { font-size: 16px; line-height: 1.62; }
.subject-card { min-height: 208px; padding: 21px; text-align: left; }
.subject-card > span { min-width: 0; }
.subject-card h3 { margin-top: 13px; font-size: 21px; line-height: 1.15; overflow-wrap: break-word; }
.subject-card p { font-size: 15px; line-height: 1.42; }
.subject-icon { width: 52px; height: 52px; border-radius: 17px; font-size: 27px; }
.subject-meta { margin-top: 16px; font-size: 12px; }
.curriculum-note { padding: 18px 20px; }
.curriculum-note strong { display: block; margin-bottom: 5px; font-size: 16px; }
.curriculum-note p { margin: 0; font-size: 15px; line-height: 1.5; }
.lesson-row h3 { font-size: 18px; line-height: 1.25; }
.lesson-row p { font-size: 14.5px; line-height: 1.42; }
.exercise-panel { padding: 21px; }
.exercise-panel > h2 { font-size: 25px; margin: 5px 0 12px; }
.exercise-card { padding: 17px; border-radius: 17px; }
.exercise-card h4 { font-size: 15.5px; line-height: 1.45; overflow-wrap: break-word; }
.choice-button { font-size: 15px; line-height: 1.35; }
.difficulty-control-panel { padding: 14px; }
.effective-difficulty strong { font-size: 16px; }
.weekly-plan-grid { gap: 15px; }
.weekly-plan-card { min-width: 0; padding: 19px; }
.weekly-plan-card h3 { font-size: 19px; line-height: 1.15; overflow-wrap: break-word; }
.weekly-plan-card p { font-size: 14.5px; line-height: 1.42; }
.stat-strip { gap: 15px; }
.stat-card { padding: 18px 20px; }
.stat-card strong { font-size: 27px; }
.routine-banner { padding: 19px 22px; min-width: 0; }
.routine-banner > div { min-width: 0; }
.routine-banner h2 { margin: 5px 0 4px; font-size: 24px; line-height: 1.15; }
.routine-banner p { margin: 0; font-size: 15px; line-height: 1.45; overflow-wrap: break-word; }
.routine-dots { flex-wrap: wrap; justify-content: flex-end; max-width: 170px; }
.routine-dots span { width: 15px; height: 15px; }

/* Conteúdo sempre contido nos cartões e diálogos. */
.card, .dialog, .dialog form, .subject-header, .lesson-row, .exercise-card,
.document-feature-card, .document-subject-card, .weekly-plan-card { min-width: 0; }
.card h1, .card h2, .card h3, .card h4, .card p, .card strong, .card small,
.dialog h1, .dialog h2, .dialog h3, .dialog p, .dialog label, .dialog span {
  max-width: 100%;
  overflow-wrap: break-word;
}
.dialog { width: min(620px, calc(100vw - 32px)); max-height: min(86dvh, 760px); }
.dialog form { max-height: min(86dvh, 760px); overflow-y: auto; padding: 24px; }
.dialog h2 { font-size: clamp(24px, 3vw, 31px); line-height: 1.1; }
.dialog p { font-size: 15px; line-height: 1.48; }
.dialog label { font-size: 14px; }
.dialog-actions { gap: 10px; }

/* Inglês: contraste WCAG e botões de áudio inequívocos. */
.english-hero { color: #fff; }
.english-hero h1, .english-hero h2, .english-hero .subject-icon { color: #fff; }
.english-hero .muted, .english-hero > div > p:not(.subject-bank-summary),
.english-hero .mastery-summary > small { color: #f7f3ff !important; }
.english-hero .subject-bank-summary {
  color: #28163f !important;
  background: rgba(255,255,255,.96) !important;
  border-color: rgba(255,255,255,.78) !important;
  font-size: 14px;
  line-height: 1.42;
}
.english-hero .subject-bank-summary strong { color: #5d238c !important; }
.english-hero .english-resource-row .tag,
.english-hero .english-resource-row .button-soft,
.english-hero .subject-actions .button {
  background: #fff !important;
  color: #32174d !important;
  border: 1px solid rgba(255,255,255,.9) !important;
  box-shadow: 0 8px 20px rgba(24,14,53,.18);
}
.english-hero .subject-actions .button:hover,
.english-hero .english-resource-row .button-soft:hover { background: #f7efff !important; }
.english-hero .mastery-ring { background: conic-gradient(#fff calc(var(--mastery,0)*1%),rgba(255,255,255,.28) 0); }
.english-hero .mastery-ring::before { background: #fff; }
.english-hero .mastery-ring strong { color: #32174d; }
.english-lab-header { align-items: center; }
.english-lab-header h2 { margin: 4px 0 0; font-size: 24px; line-height: 1.15; }
.english-word, .speak-line {
  border: 1px solid #d7c9ec;
  background: #f7f2ff;
  color: #2b1645;
  font-weight: 850;
  border-radius: 12px;
  cursor: pointer;
}
.english-word { min-height: 38px; padding: 8px 11px; text-align: left; }
.speak-line { width: 34px; height: 34px; padding: 0; }
[data-speak-english].is-speaking {
  background: #1f704f !important;
  color: #fff !important;
  border-color: #1f704f !important;
  box-shadow: 0 8px 20px rgba(31,112,79,.22);
}
.english-vocab-card strong { font-size: 17px; }
.english-vocab-card small { font-size: 13.5px; line-height: 1.4; }

/* Centro de documentos sem etiquetas promocionais supérfluas. */
.documents-entry-card { padding: 24px; }
.workbook-premium-copy h2 { font-size: clamp(25px, 2.6vw, 35px); line-height: 1.08; }
.workbook-premium-copy p { font-size: 15.5px; }
.document-feature-card h2, .document-generator-card h2 { font-size: clamp(23px, 2.4vw, 32px); }
.document-feature-card p, .document-generator-card p { font-size: 15px; line-height: 1.46; }

@media (max-width: 1100px) and (min-width: 821px) {
  .subject-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .weekly-plan-grid { grid-template-columns: repeat(3, minmax(0,1fr)); }
  .lesson-layout { grid-template-columns: minmax(0,1fr); }
  .exercise-panel { position: static; }
}

@media (max-width: 820px) {
  body { font-size: 15px; }
  .page-heading h1 { font-size: clamp(28px, 8vw, 38px); }
  .hero-copy h1 { font-size: clamp(30px, 8.5vw, 42px); }
  .hero-copy p { font-size: 15.5px; }
  .section-title h2 { font-size: clamp(23px, 7vw, 31px); }
  .subject-header h1 { font-size: clamp(27px, 8vw, 37px); }
  .lesson-content h1 { font-size: clamp(27px, 8vw, 38px); }
  .dialog { width: calc(100vw - 18px) !important; max-width: calc(100vw - 18px) !important; }
  .dialog form { padding: 18px 15px; }
  .dialog h2 { font-size: 25px; }
  .routine-banner { grid-template-columns: 1fr; padding: 17px; }
  .routine-dots { justify-content: flex-start; max-width: none; }
  .english-lab-header { align-items: stretch; flex-direction: column; }
  .english-lab-header .button { width: 100%; }
}

@media (max-width: 520px) {
  .subject-card { padding: 18px; min-height: 0; }
  .subject-card h3 { font-size: 20px; }
  .lesson-row { grid-template-columns: auto minmax(0,1fr); }
  .lesson-row > button { grid-column: 1 / -1; width: 100%; }
  .exercise-panel { padding: 16px; }
  .exercise-card { padding: 15px; }
}

/* ===== V33 refinements: mobile header, stories, dialogs, typography ===== */
:root {
  --school-font: "Edu TAS Beginner", "Edu NSW ACT Cursive", "Segoe Print", "Bradley Hand", "Chalkboard SE", cursive;
}

.topbar-logo {
  display: none;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: rgba(255,255,255,.9);
  border: 1px solid rgba(124,58,237,.12);
  box-shadow: 0 12px 30px rgba(51,24,79,.08);
}
.topbar-logo img {
  width: 44px;
  height: 44px;
  object-fit: contain;
}

.story-toolbar { gap: 16px; }
.story-filter-row {
  display: flex;
  flex-wrap: wrap;
  overflow: visible;
  gap: 10px;
  padding-bottom: 0;
}
.story-filter {
  min-height: 40px;
  padding: 9px 14px;
  line-height: 1.2;
}
.story-count-card span { font-size: 15px; }
.story-count-card small { font-size: 12px; line-height: 1.35; }
.story-card h3 {
  line-height: 1.18;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.story-card p {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.document-theme-list,
.document-theme-options,
.subject-checkboxes,
.document-facts,
.story-tags,
.english-resource-row,
.button-row,
.dialog-actions,
.form-grid,
.topbar-actions {
  flex-wrap: wrap;
}

.dialog {
  width: min(700px, calc(100vw - 28px));
  max-height: min(88dvh, 780px);
  border-radius: 24px;
}
.dialog form {
  max-height: min(88dvh, 780px);
  overflow-y: auto;
  padding: 24px 22px;
  overscroll-behavior: contain;
}
.dialog h2 { line-height: 1.12; }
.dialog p, .dialog label { overflow-wrap: anywhere; }
.dialog .form-grid {
  display: grid;
  gap: 14px;
}
.dialog .form-grid.two-cols { grid-template-columns: repeat(2, minmax(0,1fr)); }
.dialog input,
.dialog select,
.dialog textarea,
.dialog button {
  min-height: 46px;
}
.dialog-actions {
  position: sticky;
  bottom: -22px;
  background: linear-gradient(180deg, rgba(255,255,255,0), #fff 32%);
  padding-top: 12px;
}

.check-label,
.compact-check,
.document-theme-chip,
.story-filter,
.tag,
.level-tab {
  white-space: normal;
  text-align: left;
}

.reader-text.school-font,
.reader-text.school-font .vocab-word,
body.school-font-active .reader-text,
body.school-font-active .exercise-card,
body.school-font-active .example-box,
body.school-font-active .story-card p {
  font-family: var(--school-font);
}

@media (max-width: 900px) {
  .topbar {
    gap: 10px;
    align-items: center;
  }
  .topbar-logo { display: inline-flex; }
  .brand-copy {
    display: none !important;
  }
  .topbar-actions {
    gap: 6px;
    justify-content: flex-end;
    margin-left: auto;
  }
  .story-count-card {
    min-width: 0;
    width: 100%;
    grid-template-columns: auto 1fr;
    text-align: left;
    column-gap: 12px;
    row-gap: 2px;
  }
  .story-count-card strong {
    grid-row: 1 / 4;
    align-self: center;
    font-size: clamp(36px, 10vw, 44px);
  }
  .story-toolbar {
    padding: 16px;
  }
  .dialog .form-grid.two-cols,
  .dialog .form-grid.four-cols {
    grid-template-columns: 1fr;
  }
  .dialog-actions {
    display: grid;
    grid-template-columns: 1fr;
  }
  .dialog-actions > * { width: 100%; }
}

@media (max-width: 640px) {
  .topbar {
    min-height: 60px;
    padding: 6px 10px;
  }
  .topbar-logo {
    width: 44px;
    height: 44px;
    border-radius: 13px;
  }
  .topbar-logo img {
    width: 34px;
    height: 34px;
  }
  .story-filter-row {
    gap: 8px;
  }
  .story-filter {
    padding: 8px 12px;
    font-size: 12px;
  }
  .story-card-body,
  .document-feature-card,
  .document-generator-card,
  .document-subject-card {
    min-width: 0;
  }
  .document-theme-chip,
  .compact-check {
    font-size: 12px;
  }
  .dialog {
    width: calc(100vw - 14px) !important;
    max-width: calc(100vw - 14px) !important;
    max-height: calc(100dvh - 14px) !important;
    border-radius: 18px;
  }
  .dialog form {
    max-height: calc(100dvh - 14px) !important;
    padding: 18px 14px;
  }
  .dialog h2 {
    font-size: 23px;
  }
}
