/* ============ Sistema de Estudos do Pepo — estilos ============ */
:root {
  --bg: #fff8f1;
  --bg2: #fff1e3;
  --card: #ffffff;
  --ink: #2b2118;
  --ink2: #6b5d50;
  --line: #f0e2d2;
  --primary: #ff6a1a;
  --primary-d: #e2540a;
  --primary-l: #ffe3d1;
  --blue: #2f6fde;
  --blue-l: #e3edff;
  --good: #1f9d55;
  --good-l: #dcf6e6;
  --bad: #d93a3a;
  --bad-l: #fde3e3;
  --mid: #d98a00;
  --mid-l: #fff1cc;
  --star: #ffb400;
  --radius: 18px;
  --shadow: 0 2px 0 rgba(120, 70, 20, .08), 0 6px 18px rgba(120, 70, 20, .07);
  --font: 'Nunito', 'Segoe UI', system-ui, -apple-system, Roboto, Arial, sans-serif;
  /* margens laterais que respeitam o "entalhe"/cantos arredondados (iPhone/iPad deitado) */
  --side-l: max(16px, env(safe-area-inset-left));
  --side-r: max(16px, env(safe-area-inset-right));
  --safe-b: env(safe-area-inset-bottom, 0px);
  --ses-w: 760px;      /* largura da tela de questões */
  --footer-h: 84px;    /* altura da barra de botões das questões */
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
/* toque: sem zoom de duplo toque nem seleção de texto sem querer nos botões */
a, button, summary, input, textarea, select, label, .chip, .option, .tf-btn, .match-item, .flashcard { touch-action: manipulation; }
button, .btn, .pill, .chip, .option, .tf-btn, .match-item, .avatar-opt, .seg-btn, .check-chip, .topic-btn, .unit-num, .flashcard { -webkit-user-select: none; user-select: none; }
body {
  margin: 0; font-family: var(--font); color: var(--ink); background: var(--bg);
  font-size: 17px; line-height: 1.45; min-height: 100vh;
  background-image: radial-gradient(circle at 10% -10%, #ffe2c8 0, transparent 40%), radial-gradient(circle at 110% 10%, #e3edff 0, transparent 35%);
  background-attachment: fixed;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--blue); }
h1, h2, h3 { line-height: 1.2; margin: 0; }
h1 { font-size: 1.6rem; font-weight: 900; }
h2 { font-size: 1.25rem; font-weight: 800; }
h3 { font-size: 1.08rem; font-weight: 800; }
small { font-size: .82rem; }
.hidden { display: none !important; }
.muted { color: var(--ink2); }
.center { text-align: center; justify-content: center; }
.grow { flex: 1; min-width: 0; }
.pre { white-space: pre-wrap; }
.row-wrap { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.row-end { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; margin-top: 14px; }

/* ---------- estrutura ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: max(10px, env(safe-area-inset-top)) var(--side-r) 10px var(--side-l);
  background: rgba(255, 248, 241, .92); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink); font-weight: 900; }
.brand-owl { font-size: 1.7rem; }
.brand-name { font-size: 1.1rem; }
.top-stats { display: flex; align-items: center; gap: 8px; }
.pill {
  display: inline-flex; align-items: center; gap: 4px; padding: 4px 12px; border-radius: 999px;
  background: var(--card); border: 2px solid var(--line); font-weight: 800; text-decoration: none; color: var(--ink); font-size: .92rem;
}
.pill.streak.on { border-color: #ffb27a; background: #fff0e4; }
.pill.xp { border-color: #ffd970; background: #fff9e0; }
.avatar-btn { font-size: 1.7rem; text-decoration: none; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; background: var(--card); border: 2px solid var(--line); }
.app { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.screen { max-width: 880px; width: 100%; margin: 0 auto; padding: 18px var(--side-r) 80px var(--side-l); flex: 1 0 auto; }
.site-footer {
  text-align: center; padding: 14px var(--side-r) calc(14px + var(--safe-b)) var(--side-l); font-size: .85rem; font-weight: 700;
  color: var(--ink2); border-top: 1px solid var(--line); background: rgba(255, 248, 241, .8);
}
.section-title { margin: 26px 0 10px; }
.section-title.small { font-size: 1rem; margin-top: 16px; }
.back-link { display: inline-block; margin-bottom: 10px; text-decoration: none; font-weight: 800; color: var(--ink2); }
.eyebrow { font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: var(--primary); font-size: .78rem; }

.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; border: 1px solid var(--line); }
.card + .card { margin-top: 12px; }
.card.warn { background: var(--mid-l); border-color: #f5d27a; }

.page-head { display: flex; align-items: center; gap: 14px; margin: 4px 0 16px; }
.page-head.center { justify-content: center; text-align: center; }
.page-icon {
  font-size: 2.3rem; width: 64px; height: 64px; display: grid; place-items: center; flex: none;
  background: var(--card); border-radius: 20px; box-shadow: var(--shadow); border: 2px solid var(--mc, var(--primary));
}
.page-head p { margin: 4px 0 0; }

/* ---------- botões ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; cursor: pointer; text-decoration: none;
  padding: 10px 18px; border-radius: 14px; border: 2px solid var(--line); background: var(--card); color: var(--ink);
  font-weight: 800; box-shadow: 0 3px 0 var(--line); transition: transform .06s, box-shadow .06s, background .15s;
  min-height: 46px; text-align: center;
}
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--line); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn.primary { background: var(--primary); border-color: var(--primary-d); color: #fff; box-shadow: 0 4px 0 var(--primary-d); }
.btn.primary:active { box-shadow: 0 1px 0 var(--primary-d); }
.btn.good { background: var(--good); border-color: #157a41; color: #fff; box-shadow: 0 4px 0 #157a41; }
.btn.bad { background: #fff; border-color: #f2b8b8; color: var(--bad); box-shadow: 0 3px 0 #f2b8b8; }
.btn.ghost { background: transparent; box-shadow: none; }
.btn.big { padding: 13px 24px; font-size: 1.08rem; min-height: 54px; }
.btn.wide { width: 100%; }
.icon-btn { border: none; background: transparent; font-size: 1.3rem; cursor: pointer; width: 42px; height: 42px; border-radius: 12px; color: var(--ink2); flex: none; }
.link-btn { border: none; background: none; color: var(--blue); font-weight: 800; cursor: pointer; padding: 6px 0; text-align: left; }
.link-btn.small { font-size: .85rem; }

/* ---------- progresso, estrelas, notas ---------- */
.progress { height: 14px; background: #f3e6d8; border-radius: 999px; overflow: hidden; flex: 1; }
.progress.small { height: 10px; margin: 8px 0 4px; }
.progress.tiny { height: 7px; margin-top: 6px; max-width: 220px; }
.progress-fill { height: 100%; background: linear-gradient(90deg, #ffb400, var(--primary)); border-radius: 999px; transition: width .4s; }
.progress.low .progress-fill { background: var(--bad); }
.progress.mid .progress-fill { background: var(--mid); }
.progress.good .progress-fill { background: var(--good); }
.stars span { color: #e8dccd; font-size: 1.2rem; }
.stars span.on { color: var(--star); text-shadow: 0 1px 0 #c98a00; }
.grade-chip { display: inline-block; padding: 2px 10px; border-radius: 999px; font-weight: 900; margin: 0 3px; }
.grade-chip.good { background: var(--good-l); color: var(--good); }
.grade-chip.mid { background: var(--mid-l); color: var(--mid); }
.grade-chip.low { background: var(--bad-l); color: var(--bad); }

/* ---------- formulários ---------- */
.text-input {
  width: 100%; padding: 12px 14px; border-radius: 14px; border: 2px solid var(--line); background: #fff; font-size: 1.05rem; outline: none;
}
.text-input:focus { border-color: var(--primary); }
.form-card { display: flex; flex-direction: column; gap: 16px; }
.form-row { display: flex; flex-direction: column; gap: 8px; }
.form-row.inline { flex-direction: row; align-items: center; gap: 10px; cursor: pointer; }
.form-row.inline input { width: 22px; height: 22px; }
.seg { display: flex; flex-wrap: wrap; gap: 8px; }
.seg-btn { padding: 8px 18px; border-radius: 12px; border: 2px solid var(--line); background: #fff; font-weight: 800; cursor: pointer; }
.seg-btn.on { border-color: var(--primary); background: var(--primary-l); color: var(--primary-d); }
.unit-chooser { display: flex; flex-wrap: wrap; gap: 8px; }
.check-chip { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border: 2px solid var(--line); border-radius: 12px; cursor: pointer; font-weight: 700; background: #fff; }
.check-chip input { width: 18px; height: 18px; accent-color: var(--primary); }
.check-chip:has(input:checked) { border-color: var(--primary); background: var(--primary-l); }

/* ---------- início ---------- */
.hero { display: flex; gap: 16px; align-items: center; background: linear-gradient(135deg, #fff, #fff4ea); }
.hero-avatar { font-size: 3.4rem; width: 84px; height: 84px; display: grid; place-items: center; background: var(--primary-l); border-radius: 50%; flex: none; }
.hero-text { flex: 1; min-width: 0; }
.bubble { margin-top: 8px; background: var(--blue-l); padding: 10px 14px; border-radius: 16px; border-top-left-radius: 4px; font-weight: 700; color: #234b94; }
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 14px; }
.stat-row .card + .card { margin-top: 0; }
.stat-top { display: flex; gap: 10px; align-items: center; }
.stat-top b { display: block; }
.stat-top small { color: var(--ink2); }
.stat-icon { font-size: 1.8rem; }
.mission-card.done { background: var(--good-l); border-color: #b7e6c8; }
.module-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.module-grid .card + .card { margin-top: 0; }
.module-card { display: flex; align-items: center; gap: 14px; text-decoration: none; color: var(--ink); border-left: 6px solid var(--mc, var(--primary)); transition: transform .1s; }
.module-card.soon { opacity: .6; border-left-color: #ccc; }
.module-icon { font-size: 2.4rem; }
.module-info { flex: 1; display: flex; flex-direction: column; }
.module-info small { color: var(--ink2); }
.chev { font-size: 2rem; color: var(--ink2); }
.home-links { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 24px; }

.countdown { display: flex; align-items: center; gap: 14px; margin-top: 14px; border: 2px solid #9dbcf5; background: var(--blue-l); }
.countdown.soon { border-color: #ffb27a; background: #fff0e4; }
.countdown b { display: block; font-size: 1.1rem; }
.countdown-num { font-size: 2rem; font-weight: 900; min-width: 64px; height: 64px; border-radius: 18px; background: #fff; display: grid; place-items: center; color: var(--blue); flex: none; }
.countdown.soon .countdown-num { color: var(--primary); }

/* ---------- módulo ---------- */
.action.daily { width: 100%; margin-bottom: 12px; border: 2px solid var(--good); background: linear-gradient(135deg, #f2fff6, #ddf7e7); }
.action.daily .action-icon { background: var(--good); color: #fff; }
.action-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.action-grid .card + .card { margin-top: 0; }
.action { display: flex; gap: 12px; align-items: center; text-decoration: none; color: var(--ink); cursor: pointer; text-align: left; transition: transform .1s; }
.action b { display: block; }
.action small { color: var(--ink2); }
.action-icon { font-size: 2rem; width: 52px; height: 52px; display: grid; place-items: center; background: var(--bg2); border-radius: 16px; flex: none; }
.action.accent { background: linear-gradient(135deg, #ff7a30, var(--primary)); color: #fff; border-color: var(--primary-d); }
.action.accent small { color: #ffe9dc; }
.action.accent .action-icon { background: rgba(255, 255, 255, .25); }
.action.alert { border: 2px solid #ffb27a; }
.unit-trail { display: flex; flex-direction: column; gap: 10px; }
.unit-trail .card + .card { margin-top: 0; }
.unit-card { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); transition: transform .1s; }
.unit-card.disabled { opacity: .55; }
.unit-num { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 54px; height: 54px; flex: none; border-radius: 16px; background: var(--primary); color: #fff; line-height: 1; }
.unit-num small { font-size: .65rem; text-transform: uppercase; font-weight: 800; }
.unit-num b { font-size: 1.4rem; }
.unit-emoji { font-size: 1.9rem; }
.unit-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.unit-info small { color: var(--ink2); }
.unit-side { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }

/* ---------- unidade ---------- */
.unit-head-side { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; text-align: right; }
.lesson-list { display: flex; flex-direction: column; gap: 8px; }
.lesson-list .card + .card { margin-top: 0; }
.lesson-item { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); cursor: pointer; text-align: left; width: 100%; }
.lesson-item b { display: block; }
.lesson-item small { color: var(--ink2); }
.lesson-item.done { background: #f6fff9; border-color: #c9ecd6; }
.lesson-emoji { font-size: 1.7rem; width: 44px; text-align: center; }
.lesson-check { font-size: 1.4rem; color: var(--ink2); }
.vocab-preview { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.vchip { padding: 4px 10px; background: var(--bg2); border-radius: 999px; font-weight: 700; font-size: .92rem; }
.vchip.more { background: var(--primary-l); color: var(--primary-d); }
.train-card .btn.wide { margin-bottom: 12px; }
.small-title { font-weight: 800; margin: 4px 0 8px; font-size: .9rem; }
.topic-buttons { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.topic-btn { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; padding: 10px 14px; border-radius: 14px; border: 2px solid var(--line); background: #fff; cursor: pointer; font-weight: 800; }
.topic-btn small { color: var(--ink2); font-weight: 600; }
.test-card { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; background: linear-gradient(135deg, #fff, #fff4ea); }
.test-card b, .test-card small { display: block; }
.mini-history { margin-top: 10px; display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }

/* ---------- lição ---------- */
.lesson-body { display: flex; flex-direction: column; gap: 14px; }
.lb-text { font-size: 1.05rem; }
.lb-formula { background: var(--blue-l); border: 2px dashed #9dbcf5; padding: 12px 16px; border-radius: 14px; font-size: 1.12rem; text-align: center; font-weight: 700; color: #1d3f86; }
.lb-tip { background: var(--mid-l); padding: 12px 14px; border-radius: 14px; border-left: 5px solid #f5b400; }
.lb-warning { background: var(--bad-l); padding: 12px 14px; border-radius: 14px; border-left: 5px solid var(--bad); }
.lb-sub { font-weight: 800; color: var(--primary-d); margin-bottom: -6px; }
.lb-examples { display: flex; flex-direction: column; gap: 8px; }
.example { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; background: #fffaf5; border-radius: 12px; border: 1px solid var(--line); }
.ex-en { font-weight: 800; font-size: 1.05rem; }
.ex-en strong { color: var(--primary-d); }
.ex-pt { color: var(--ink2); font-size: .95rem; }
.table-wrap { overflow-x: auto; }
.lb-table { border-collapse: collapse; width: 100%; font-size: .98rem; }
.lb-table th, .lb-table td { border: 1px solid var(--line); padding: 7px 10px; text-align: left; }
.lb-table th { background: var(--primary-l); }
.lb-table tr:nth-child(even) td { background: #fffaf5; }
.lesson-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.lesson-modal { max-height: 70vh; max-height: 70dvh; overflow: auto; overscroll-behavior: contain; padding-right: 4px; }

/* ---------- voz ---------- */
.speak-btn {
  border: 2px solid #b9cff7; background: var(--blue-l); border-radius: 12px; cursor: pointer; font-size: 1.15rem;
  width: 42px; height: 42px; display: inline-grid; place-items: center; flex: none; vertical-align: middle; margin-left: 6px;
}
.speak-btn.small { width: 32px; height: 32px; font-size: .95rem; border-radius: 10px; }
.speak-btn.playing, .big-speak.playing { animation: pulse 0.8s infinite; }
.big-speak { font-size: 2.6rem; width: 92px; height: 92px; border-radius: 26px; border: 3px solid #9dbcf5; background: var(--blue-l); cursor: pointer; box-shadow: 0 4px 0 #9dbcf5; }
.listen-row { display: flex; align-items: center; justify-content: center; gap: 14px; margin: 10px 0 16px; }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.08); } }

/* ---------- sessão / questões ---------- */
.session { max-width: var(--ses-w); margin: 0 auto; padding: 12px var(--side-r) calc(170px + var(--safe-b)) var(--side-l); min-height: 100vh; min-height: 100dvh; outline: none; }
.ses-bar { display: flex; align-items: center; gap: 10px; position: sticky; top: 0; background: var(--bg); padding: 8px 0; z-index: 5; }
.ses-count { font-weight: 900; color: var(--ink2); min-width: 46px; text-align: right; }
.ses-timer { font-weight: 800; color: var(--ink2); min-width: 64px; text-align: right; }
.ses-combo { min-width: 46px; font-weight: 900; color: var(--primary); }
.ses-combo.hot { animation: pulse 1s infinite; }
.ses-title { font-weight: 800; color: var(--ink2); margin: 6px 0 12px; font-size: .95rem; }
.question { display: flex; flex-direction: column; gap: 12px; }
.q-head { display: flex; flex-direction: column; gap: 2px; }
.q-type { font-size: .78rem; text-transform: uppercase; font-weight: 900; letter-spacing: .05em; color: var(--primary); }
.q-instruction { font-weight: 800; font-size: 1.05rem; }
.q-emoji { font-size: 4.2rem; text-align: center; line-height: 1.1; }
.q-prompt { font-size: 1.3rem; font-weight: 700; line-height: 1.6; }
.q-prompt strong { color: var(--primary-d); }
.gap { display: inline-block; min-width: 70px; border-bottom: 3px solid var(--primary); margin: 0 4px; text-align: center; color: var(--good); }
.q-hint { color: var(--ink2); font-weight: 700; }
.options { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.options.long { grid-template-columns: 1fr; }
.option {
  display: flex; align-items: center; gap: 10px; padding: 14px; border-radius: 16px; border: 2px solid var(--line); background: #fff;
  cursor: pointer; text-align: left; font-size: 1.12rem; font-weight: 700; box-shadow: 0 3px 0 var(--line); min-height: 58px;
}
.opt-letter { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--bg2); font-weight: 900; font-size: .9rem; flex: none; color: var(--ink2); }
.option.selected { border-color: var(--blue); background: var(--blue-l); box-shadow: 0 3px 0 #9dbcf5; }
.option.selected .opt-letter { background: var(--blue); color: #fff; }
.locked .option, .locked .tf-btn, .locked .chip, .locked .match-item { cursor: default; }
.option.right, .tf-btn.right, .match-item.right { border-color: var(--good) !important; background: var(--good-l) !important; box-shadow: 0 3px 0 #9fd9b6 !important; }
.option.wrong, .tf-btn.wrong, .match-item.wrong { border-color: var(--bad) !important; background: var(--bad-l) !important; box-shadow: 0 3px 0 #f2b8b8 !important; }
.option.right .opt-letter { background: var(--good); color: #fff; }
.option.wrong .opt-letter { background: var(--bad); color: #fff; }
.tf-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tf-btn { padding: 18px; border-radius: 18px; border: 2px solid var(--line); background: #fff; font-size: 1.3rem; font-weight: 900; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 4px; box-shadow: 0 3px 0 var(--line); }
.tf-icon { font-size: 2rem; }
.tf-btn.selected { border-color: var(--blue); background: var(--blue-l); }
.fill-prompt { line-height: 2.2; }
.blank-input {
  font-size: 1.15rem; font-weight: 800; padding: 4px 8px; margin: 0 4px; border: none; border-bottom: 3px solid var(--primary);
  background: #fff3ea; border-radius: 8px 8px 0 0; outline: none; text-align: center; color: var(--blue);
}
.blank-input:focus { background: #ffe6d4; }
.blank-input.right, .write-input.right { border-color: var(--good); background: var(--good-l); color: var(--good); }
.blank-input.wrong, .write-input.wrong { border-color: var(--bad); background: var(--bad-l); color: var(--bad); text-decoration: line-through; }
.fix { display: inline-block; margin: 0 4px; padding: 0 8px; border-radius: 8px; background: var(--good-l); color: var(--good); font-weight: 900; text-decoration: none; }
.write-input { width: 100%; padding: 14px; font-size: 1.2rem; font-weight: 700; border-radius: 16px; border: 2px solid var(--line); background: #fff; outline: none; resize: vertical; }
.write-input:focus { border-color: var(--primary); }
.write-input.single { text-align: center; font-size: 1.4rem; }
.bank-label { font-size: .85rem; color: var(--ink2); font-weight: 700; }
.word-bank, .order-pool { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 9px 14px; border-radius: 12px; border: 2px solid var(--line); background: #fff; font-weight: 800; font-size: 1.1rem; cursor: pointer; box-shadow: 0 3px 0 var(--line); }
.order-line { min-height: 64px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px; border-radius: 16px; border: 2px dashed #e3cdb5; background: #fffdf9; }
.order-line .chip { border-color: var(--blue); background: var(--blue-l); }
.order-line.right { border-style: solid; border-color: var(--good); background: var(--good-l); }
.order-line.wrong { border-style: solid; border-color: var(--bad); background: var(--bad-l); }
.order-placeholder { color: var(--ink2); font-weight: 700; }
.match-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.match-col { display: flex; flex-direction: column; gap: 8px; }
.match-item {
  display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 10px 12px; border-radius: 14px; border: 2px solid var(--line);
  background: #fff; cursor: pointer; font-weight: 800; text-align: left; min-height: 54px; box-shadow: 0 3px 0 var(--line); flex-wrap: wrap;
}
.match-item > span:first-child { flex: 1; min-width: 0; }
.match-item .speak-btn { margin-left: 4px; }
.match-item.selected { outline: 3px solid var(--blue); outline-offset: 1px; }
.match-item .fix { font-size: .85rem; }
.inline-msg { padding: 10px 14px; border-radius: 14px; background: var(--mid-l); font-weight: 800; color: #8a5a00; }
.shake { animation: shake .4s; }
@keyframes shake { 0%, 100% { transform: translateX(0); } 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

.reading-card { background: #fffdf8; border: 2px solid #f1dcc0; border-radius: 16px; padding: 10px 14px; }
.reading-card summary { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 1.05rem; list-style: none; }
.reading-card summary::-webkit-details-marker { display: none; }
.reading-actions { margin-left: auto; display: flex; }
.reading-icon { font-size: 1.3rem; }
.reading-text p { margin: 10px 0; font-size: 1.08rem; line-height: 1.6; }
.reading-pt { background: var(--bg2); padding: 4px 12px; border-radius: 12px; color: var(--ink2); }

.ses-footer {
  position: fixed; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-between; gap: 12px;
  padding: 14px max(var(--side-r), calc(50vw - var(--ses-w) / 2 + 16px)) calc(14px + var(--safe-b)) max(var(--side-l), calc(50vw - var(--ses-w) / 2 + 16px));
  background: rgba(255, 248, 241, .96); border-top: 1px solid var(--line); z-index: 10;
}
.ses-footer .btn.primary { flex: 1; max-width: 420px; margin-left: auto; }
.feedback {
  position: fixed; left: 0; right: 0; bottom: calc(var(--footer-h) + var(--safe-b)); z-index: 9;
  padding: 14px max(var(--side-r), calc(50vw - var(--ses-w) / 2 + 16px)) 14px max(var(--side-l), calc(50vw - var(--ses-w) / 2 + 16px));
  animation: slideUp .25s ease-out; max-height: 55vh; max-height: 55dvh; overflow: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; border-top: 3px solid;
}
.feedback.good { background: #e9fbef; border-color: var(--good); }
.feedback.bad { background: #fff0f0; border-color: var(--bad); }
.fb-title { font-size: 1.3rem; font-weight: 900; }
.feedback.good .fb-title { color: var(--good); }
.feedback.bad .fb-title { color: var(--bad); }
.fb-answer { margin-top: 6px; font-size: 1.15rem; font-weight: 800; white-space: pre-wrap; }
.fb-label { color: var(--ink2); font-weight: 700; }
.fb-explain { margin-top: 8px; font-size: 1.02rem; }
.fb-tip { margin-top: 6px; font-weight: 700; color: #8a5a00; background: var(--mid-l); padding: 6px 10px; border-radius: 10px; display: inline-block; }
@keyframes slideUp { from { transform: translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- resultados ---------- */
.results { max-width: var(--ses-w); margin: 0 auto; padding: 18px var(--side-r) calc(60px + var(--safe-b)) var(--side-l); }
.results-hero { text-align: center; padding: 26px 16px; }
.results-hero.good { background: linear-gradient(135deg, #f0fff5, #e3f9ec); }
.results-hero.mid { background: linear-gradient(135deg, #fffaf0, #fff1cc); }
.results-hero.low { background: linear-gradient(135deg, #fff8f5, #ffe9e0); }
.results-owl { font-size: 3.4rem; }
.grade-big { font-size: 4rem; font-weight: 900; line-height: 1; margin: 6px 0; }
.grade-big small { display: block; font-size: .95rem; color: var(--ink2); font-weight: 800; text-transform: uppercase; }
.stars-big span { font-size: 2.6rem; color: #e8dccd; margin: 0 2px; }
.stars-big span.on { color: var(--star); text-shadow: 0 2px 0 #c98a00; }
.results-msg { font-size: 1.2rem; font-weight: 800; margin: 6px 0 12px; }
.results-stats { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.results-stats span { background: #fff; padding: 6px 12px; border-radius: 999px; font-weight: 800; border: 1px solid var(--line); }
.new-best { background: #fff4c2 !important; }
.results-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin: 16px 0; }
.review-item { border-left: 6px solid var(--good); }
.review-item.bad { border-left-color: var(--bad); }
.ri-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.ri-num { width: 30px; height: 30px; border-radius: 50%; background: var(--bg2); display: grid; place-items: center; font-weight: 900; }
.ri-status { font-weight: 900; }
.ri-topic { margin-left: auto; font-size: .8rem; color: var(--ink2); font-weight: 700; }
.ri-instr { font-weight: 800; color: var(--ink2); font-size: .92rem; }
.ri-prompt { font-weight: 700; font-size: 1.08rem; margin: 2px 0 6px; }
.ri-given { color: var(--bad); }
.ri-answer { color: var(--good); }
.ri-explain { margin-top: 6px; background: var(--bg2); padding: 8px 12px; border-radius: 12px; }

/* ---------- flashcards ---------- */
.flash-stage { max-width: 520px; margin: 14px auto 0; display: flex; flex-direction: column; gap: 12px; align-items: stretch; }
.fc-count { text-align: center; font-weight: 900; color: var(--ink2); }
.flashcard { perspective: 1000px; border: none; background: none; padding: 0; height: 320px; cursor: pointer; }
.fc-inner { position: relative; width: 100%; height: 100%; transition: transform .5s; -webkit-transform-style: preserve-3d; transform-style: preserve-3d; }
.flashcard.flipped .fc-inner { transform: rotateY(180deg); }
.fc-face {
  position: absolute; inset: 0; -webkit-backface-visibility: hidden; backface-visibility: hidden; border-radius: 26px; box-shadow: var(--shadow); border: 3px solid var(--line);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 18px; background: #fff;
}
.fc-back { transform: rotateY(180deg); background: #fffaf3; border-color: #ffc29e; }
.fc-emoji { font-size: 5rem; line-height: 1; }
.fc-word { font-size: 2rem; font-weight: 900; display: flex; align-items: center; }
.fc-word.pt { color: var(--primary-d); }
.fc-trans { font-size: 1.5rem; font-weight: 800; color: var(--primary-d); }
.fc-ex { text-align: center; font-weight: 700; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.fc-ex small { color: var(--ink2); }
.fc-hint { color: var(--ink2); position: absolute; bottom: 12px; }
.fc-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.fc-end { text-align: center; display: flex; flex-direction: column; gap: 10px; align-items: center; }

/* ---------- tabelas, pontos de atenção ---------- */
.hist-table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.hist-table th, .hist-table td { padding: 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.hist-table th { color: var(--ink2); font-size: .82rem; text-transform: uppercase; }
.mistake { display: flex; flex-direction: column; gap: 8px; }
.mk-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: .9rem; }
.mk-prompt { font-weight: 700; font-size: 1.05rem; }
.mk-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mk-wrong, .mk-right { padding: 8px 12px; border-radius: 12px; display: flex; flex-direction: column; }
.mk-wrong { background: var(--bad-l); color: var(--bad); text-decoration: line-through; }
.mk-wrong small, .mk-right small { text-decoration: none; color: var(--ink2); font-weight: 700; display: inline; }
.mk-right { background: var(--good-l); color: var(--good); font-weight: 900; }
.mk-right span { display: flex; align-items: center; }
.mk-why { background: var(--bg2); padding: 8px 12px; border-radius: 12px; }

/* ---------- pais ---------- */
.kpi-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.kpi-row .card + .card { margin-top: 0; }
.kpi { display: flex; flex-direction: column; gap: 4px; }
.kpi small { color: var(--ink2); font-weight: 700; }
.kpi b { font-size: 1.25rem; }
.activity { display: grid; grid-template-columns: repeat(14, 1fr); gap: 6px; height: 140px; align-items: end; }
.act-col { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; }
.act-bar { width: 100%; max-width: 30px; background: linear-gradient(180deg, #ffb400, var(--primary)); border-radius: 6px 6px 2px 2px; min-height: 3px; }
.act-col small { color: var(--ink2); font-size: .7rem; }
.chart { width: 100%; height: auto; }
.chart .grid { stroke: #f0e2d2; stroke-width: 1; }
.chart .grid.strong { stroke: #9fd9b6; stroke-width: 2; stroke-dasharray: 5 4; }
.chart .axis { font-size: 11px; fill: #8c7a69; }
.chart .line { fill: none; stroke: var(--primary); stroke-width: 3; stroke-linejoin: round; }
.chart .dot { stroke: #fff; stroke-width: 2; }
.chart .dot.test { fill: var(--primary); }
.chart .dot.exam { fill: var(--blue); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: .85rem; margin-top: 6px; }
.lg.test { color: var(--primary); font-weight: 800; }
.lg.exam { color: var(--blue); font-weight: 800; }
.topic-bars { display: flex; flex-direction: column; gap: 10px; }
.tbar { display: grid; grid-template-columns: minmax(0, 1fr) 160px 60px; gap: 10px; align-items: center; }
.tbar-label { display: flex; flex-direction: column; }
.tbar-label small { color: var(--ink2); }
.content-info summary { cursor: pointer; font-weight: 800; }

/* ---------- perfis e conquistas ---------- */
.boot { min-height: 70vh; display: grid; place-content: center; text-align: center; color: var(--ink2); font-weight: 800; }
.boot-owl { font-size: 4rem; animation: pulse 1.4s infinite; }
.profile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.profile-grid .card + .card { margin-top: 0; }
.profile-card { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.profile-card.active { border: 3px solid var(--primary); }
.profile-pick { border: none; background: none; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 1.1rem; }
.profile-avatar { font-size: 3.4rem; }
.profile-form { display: flex; flex-direction: column; gap: 10px; }
.profile-form label { font-weight: 800; }
.avatar-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; }
.avatar-opt { font-size: 1.9rem; border: 3px solid transparent; background: var(--bg2); border-radius: 14px; cursor: pointer; aspect-ratio: 1; }
.avatar-opt.on { border-color: var(--primary); background: var(--primary-l); }
.level-hero { display: flex; align-items: center; gap: 16px; }
.level-num { width: 74px; height: 74px; border-radius: 50%; background: linear-gradient(135deg, #ffb400, var(--primary)); color: #fff; font-size: 2rem; font-weight: 900; display: grid; place-items: center; flex: none; }
.level-hero .progress { margin: 8px 0 4px; }
.badge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.badge-grid .card + .card { margin-top: 0; }
.badge { text-align: center; display: flex; flex-direction: column; gap: 4px; align-items: center; opacity: .55; }
.badge.got { opacity: 1; border: 2px solid #ffd970; background: #fffcf0; }
.badge-icon { font-size: 2.6rem; }
.badge small { color: var(--ink2); }
.badge-date { color: var(--good) !important; font-weight: 800; }

/* ---------- diálogos e avisos ---------- */
.overlay { position: fixed; inset: 0; background: rgba(43, 33, 24, .45); display: grid; place-items: center; padding: 16px; z-index: 50; opacity: 0; transition: opacity .2s; }
.overlay.show { opacity: 1; }
.modal { background: #fff; border-radius: 22px; padding: 22px 18px 18px; width: min(460px, 100%); position: relative; box-shadow: 0 20px 60px rgba(0, 0, 0, .25); max-height: 92vh; max-height: 92dvh; overflow: auto; overscroll-behavior: contain; }
.modal.wide { width: min(720px, 100%); }
.modal-close { position: absolute; top: 8px; right: 8px; }
.modal-title { margin: 0 34px 12px 0; }
.confirm p { font-size: 1.08rem; font-weight: 700; margin: 0 0 12px; }
#toast-root { position: fixed; top: calc(70px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); z-index: 60; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: min(440px, calc(100% - 32px)); }
.toast { background: #2b2118; color: #fff; padding: 12px 16px; border-radius: 16px; font-weight: 700; box-shadow: 0 8px 24px rgba(0, 0, 0, .25); opacity: 0; transform: translateY(-10px); transition: all .3s; display: flex; gap: 10px; align-items: center; width: 100%; }
.toast.show { opacity: 1; transform: none; }
.toast.badge { background: linear-gradient(135deg, #ffb400, var(--primary)); }
.toast.good { background: var(--good); }
.toast-icon { font-size: 2rem; }
#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 70; }
.error-card { text-align: center; display: flex; flex-direction: column; gap: 10px; align-items: center; }

/* ---------- nuvem: login, conta, administrador ---------- */
.screen-login, .screen-account { max-width: 520px; }
.auth-card { display: flex; flex-direction: column; gap: 12px; }
.auth-form { display: flex; flex-direction: column; gap: 12px; }
.auth-field { display: flex; flex-direction: column; gap: 4px; font-weight: 800; }
.auth-field .text-input { font-size: max(16px, 1.05rem); }
.auth-or { display: flex; align-items: center; gap: 10px; color: var(--ink2); font-weight: 800; }
.auth-or::before, .auth-or::after { content: ''; flex: 1; border-top: 2px solid var(--line); }
.auth-tabs { justify-content: center; }
.auth-tabs .seg-btn { flex: 1; }
.auth-error { background: var(--bad-l); color: var(--bad); border-radius: 12px; padding: 10px 12px; font-weight: 800; }
.google-btn { background: #fff; border-color: #dadce0; box-shadow: 0 3px 0 #dadce0; }
.g-logo { width: 26px; height: 26px; border-radius: 50%; display: inline-grid; place-items: center; font-weight: 900; color: #fff; background: conic-gradient(#ea4335 0 25%, #fbbc05 0 50%, #34a853 0 75%, #4285f4 0); }
.small-print { font-size: .85rem; margin: 0; }
.cloud-pill { text-decoration: none; padding: 4px 10px; }
.logout-btn { cursor: pointer; font: inherit; font-weight: 800; color: var(--ink); gap: 6px; }
.top-stats .pill, .top-stats .avatar-btn { white-space: nowrap; flex: none; }
@media (max-width: 640px) {
  .logout-txt { display: none; }
  .top-stats { gap: 5px; }
  .top-stats .pill { padding: 4px 8px; }
  .topbar { gap: 6px; }
}
@media (max-width: 370px) {
  .top-stats .pill { padding: 4px 6px; font-size: .85rem; }
  .avatar-btn { width: 40px; height: 40px; font-size: 1.5rem; }
}
.cloud-pill.saving { border-color: #ffd970; }
.cloud-pill.offline, .cloud-pill.error { border-color: #f2b8b8; background: var(--bad-l); }
.adm-invite { text-align: center; }
.adm-code { font-size: 2.4rem; font-weight: 900; letter-spacing: .25em; color: var(--primary-d); margin: 8px 0; font-family: ui-monospace, Menlo, Consolas, monospace; }
.adm-code.off { font-size: 1.1rem; letter-spacing: 0; color: var(--ink2); font-family: inherit; }
.adm-invite .row-wrap { justify-content: center; }
.adm-list { display: flex; flex-direction: column; gap: 12px; }
.adm-list .card + .card { margin-top: 0; }
.adm-user { display: flex; flex-direction: column; gap: 10px; }
.adm-user.blocked { background: #fff6f6; border-color: #f2b8b8; }
.adm-head { display: flex; gap: 10px; align-items: flex-start; }
.adm-head small { display: block; }
.adm-mods { display: flex; flex-wrap: wrap; gap: 8px; }
.check-chip.dim { opacity: .55; }
.adm-toggle { font-weight: 700; }

/* ---------- prova no modelo da escola (folha) ---------- */
.screen-paper { max-width: 960px; }
.exam-model ul { margin: 6px 0 0; padding-left: 20px; }
.exam-model li { margin: 4px 0; }
.paper-sheet { background: #fff; color: #111; border: 1px solid #e3d6c8; border-radius: 10px; box-shadow: var(--shadow); padding: 22px 26px 26px; margin-top: 8px; }
.pp-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.pp-brand { display: flex; align-items: center; gap: 6px; font-weight: 900; color: var(--primary-d); }
.pp-owl { font-size: 1.7rem; }
.pp-title { flex: 1; text-align: center; font-size: 1.45rem; font-weight: 900; }
.pp-gradebox { border: 2px solid #111; border-radius: 8px; min-width: 130px; min-height: 58px; padding: 4px 10px; display: flex; flex-direction: column; font-weight: 800; }
.pp-gradebox b { font-size: 1.7rem; text-align: center; color: var(--primary-d); line-height: 1.1; }
.pp-info { display: flex; gap: 14px; margin: 14px 0 6px; flex-wrap: wrap; align-items: flex-start; }
.pp-id { flex: 1 1 300px; border: 1.5px solid #111; padding: 8px 12px; }
.pp-id div { margin: 2px 0; }
.pp-school { margin-left: 14px; font-weight: 700; }
.pp-grades { border-collapse: collapse; font-size: .95rem; }
.pp-grades th, .pp-grades td { border: 1.5px solid #111; padding: 3px 12px; text-align: center; }
.pp-grade { min-width: 74px; font-weight: 900; color: var(--primary-d); }
.pp-oral .pp-grade { font-size: .72rem; color: var(--ink2); font-weight: 700; }
.pp-total td { font-weight: 900; }
.pp-part { text-align: center; text-decoration: underline; font-size: 1.2rem; margin: 24px 0 8px; }
.pp-section { margin: 18px 0; }
.pp-q { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.pp-score { font-weight: 900; color: var(--primary-d); white-space: nowrap; }
.pp-body { margin-top: 6px; }
.pp-item { margin: 6px 0; line-height: 2.2; overflow-wrap: break-word; }
.pp-eg, .pp-letter { font-weight: 800; }
.pp-letter { margin-right: 2px; }
.pp-filled { display: inline-block; min-width: 110px; border-bottom: 2px solid #111; text-align: center; font-style: italic; color: #555; margin: 0 4px; line-height: 1.5; padding: 0 6px; }
.pp-input {
  font: inherit; font-size: max(16px, 1.02rem); font-weight: 800; color: var(--blue); border: none; border-bottom: 2px solid #111;
  background: #fff8f1; border-radius: 6px 6px 0 0; padding: 2px 8px; width: 11em; max-width: 100%; margin: 0 4px; outline: none; min-height: 40px; vertical-align: middle;
}
.pp-input:focus { background: #ffe6d4; border-bottom-color: var(--primary); }
.pp-input:disabled { opacity: 1; -webkit-text-fill-color: var(--blue); }
.pp-full { line-height: 1.4; }
.pp-full .pp-input { width: 100%; margin: 4px 0 2px; }
.pp-box { border: 2px solid #111; border-radius: 4px; padding: 8px; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 14px; margin: 8px 0 12px; }
.pp-boxword { border: none; background: #fff3ea; border-radius: 10px; padding: 6px 12px; font: inherit; font-weight: 900; letter-spacing: .03em; cursor: pointer; min-height: 40px; color: #111; }
.pp-boxword.used { text-decoration: line-through; opacity: .55; background: none; cursor: default; }
.pp-match { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 22px; line-height: 1.5; }
.pp-mcol { display: flex; flex-direction: column; gap: 4px; }
.pp-ml, .pp-mr { padding: 4px 0; }
.pp-paren { white-space: nowrap; font-weight: 800; }
.pp-paren.filled::before { content: '( '; } .pp-paren.filled::after { content: ' )'; }
.pp-select { font: inherit; font-size: max(16px, 1rem); font-weight: 900; min-width: 58px; min-height: 40px; border-radius: 8px; border: 2px solid #111; background: #fff8f1; text-align: center; color: var(--blue); margin: 0 3px; }
.pp-oddrow { line-height: 1.6; }
.pp-word { border: none; background: none; font: inherit; font-weight: 700; padding: 6px 6px; cursor: pointer; border-radius: 8px; min-height: 40px; color: #111; }
.pp-word.on { text-decoration: underline; text-decoration-thickness: 3px; text-underline-offset: 3px; color: var(--blue); background: var(--blue-l); }
.pp-under { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; }
.pp-tf { display: inline-flex; gap: 6px; margin-left: 6px; vertical-align: middle; }
.pp-tfbtn { border: 2px solid var(--line); background: #fff; border-radius: 10px; padding: 4px 14px; font: inherit; font-weight: 800; min-height: 40px; cursor: pointer; line-height: 1.2; }
.pp-tfbtn.on { border-color: var(--blue); background: var(--blue-l); color: var(--blue); }
.pp-dict { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pp-dict .speak-btn { margin-left: 0; }
.pp-dict .pp-input { flex: 1 1 180px; width: auto; }
.pp-hint { color: var(--ink2); font-size: .9rem; margin: 0 0 4px; }
.pp-reading { border: 1.5px solid #111; border-radius: 8px; padding: 10px 16px; margin: 8px 0 14px; }
.pp-reading h3 { text-align: center; margin: 4px 0 6px; }
.pp-reading p { text-indent: 28px; margin: 8px 0; line-height: 1.7; font-size: 1.04rem; }
.pp-mark { font-weight: 900; margin-left: 6px; }
.pp-mark.ok { color: var(--good); }
.pp-mark.bad { color: var(--bad); }
.pp-fix { color: var(--good); background: var(--good-l); border-radius: 6px; padding: 0 6px; }
.pp-why { display: block; font-weight: 600; color: var(--ink2); font-size: .92rem; line-height: 1.4; }
.pp-submit { display: flex; flex-direction: column; gap: 10px; align-items: center; margin: 18px 0; }
@media (max-width: 640px) {
  .paper-sheet { padding: 14px 12px 18px; }
  .pp-title { font-size: 1.15rem; flex-basis: 100%; order: 3; }
  .pp-gradebox { min-width: 100px; min-height: 48px; }
  .pp-grades { font-size: .85rem; width: 100%; }
  .pp-match { grid-template-columns: 1fr; gap: 10px; }
  .pp-reading { padding: 8px 10px; }
  .pp-reading p { text-indent: 16px; }
  .pp-input { width: 8.5em; }
  .pp-full .pp-input, .pp-dict .pp-input { width: 100%; }
}

/* ---------- celular ---------- */
@media (max-width: 640px) {
  body { font-size: 16px; }
  h1 { font-size: 1.35rem; }
  .brand-name { display: none; }
  .stat-row { grid-template-columns: 1fr; }
  .options { grid-template-columns: 1fr; }
  .q-prompt { font-size: 1.15rem; }
  .hero-avatar { width: 64px; height: 64px; font-size: 2.6rem; }
  .page-icon { width: 54px; height: 54px; font-size: 1.9rem; }
  .unit-emoji { display: none; }
  .tbar { grid-template-columns: 1fr; gap: 4px; }
  .mk-row { grid-template-columns: 1fr; }
  .avatar-grid { grid-template-columns: repeat(6, 1fr); }
  :root { --footer-h: 78px; }
  .feedback { max-height: 45vh; max-height: 45dvh; }
  .grade-big { font-size: 3.2rem; }
  .flashcard { height: 290px; }
  .fc-emoji { font-size: 4rem; }
  .fc-word { font-size: 1.7rem; }
}

/* textos longos (palavras grandes, frases sem espaço) nunca empurram a tela para o lado */
.q-prompt, .q-instruction, .option, .match-item, .chip, .fb-answer, .fb-explain, .mk-prompt, .mk-wrong, .mk-right,
.ri-prompt, .lb-text, .ex-en, .ex-pt, .fc-word, .fc-trans, .fc-ex, .module-info, .unit-info, .lesson-item, .page-head h1 { overflow-wrap: break-word; }

/* ---------- mouse: efeitos de "passar por cima" só onde existe mouse (no toque eles ficam grudados) ---------- */
@media (hover: hover) {
  .back-link:hover { color: var(--primary); }
  .btn:not(.primary):not(.good):not(.bad):not(.ghost):hover { background: #fffaf5; }
  .btn.primary:hover { background: #ff7a30; }
  .icon-btn:hover { background: var(--bg2); }
  .module-card:hover { transform: translateY(-2px); }
  .action:hover { transform: translateY(-2px); }
  .unit-card:hover { transform: translateX(3px); }
  .topic-btn:hover { border-color: var(--primary); }
  .option:hover { border-color: #ffc29e; }
  .chip:hover { border-color: #ffc29e; }
}

/* ---------- toque (iPad, celular): alvos de pelo menos 44 px e resposta visual ao tocar ---------- */
@media (pointer: coarse) {
  body { background-attachment: scroll; }   /* "fixed" é lento/quebrado no Safari do iPad */
  .brand { min-height: 44px; min-width: 44px; }
  .pill { min-height: 42px; padding: 6px 14px; }
  .back-link { display: inline-flex; align-items: center; min-height: 44px; padding-right: 10px; }
  .icon-btn { width: 46px; height: 46px; }
  .speak-btn { width: 46px; height: 46px; }
  .speak-btn.small { width: 42px; height: 42px; font-size: 1.05rem; }
  .link-btn { min-height: 44px; padding: 10px 0; }
  .link-btn.small { font-size: .95rem; }
  .chip { min-height: 48px; padding: 10px 16px; }
  .seg-btn { min-height: 46px; }
  .check-chip { min-height: 46px; padding: 9px 14px; }
  .check-chip input { width: 22px; height: 22px; }
  .topic-btn { min-height: 58px; justify-content: center; }
  .match-item { min-height: 60px; }
  .blank-input { min-height: 44px; }
  .unit-num small { font-size: .78rem; }
  .module-card:active, .action:active, .unit-card:active, .lesson-item:active, .topic-btn:active { transform: scale(.98); }
  .option:active, .chip:active, .tf-btn:active, .match-item:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--line); }
}

/* ---------- iPad (ex.: iPad Air 5: 820x1180 em pé, 1180x820 deitado) ---------- */
@media (min-width: 768px) and (pointer: coarse) {
  body { font-size: 18px; }
  .q-prompt { font-size: 1.42rem; }
  .q-instruction { font-size: 1.12rem; }
  .option { font-size: 1.2rem; min-height: 66px; padding: 16px; }
  .opt-letter { width: 34px; height: 34px; }
  .tf-btn { padding: 22px; font-size: 1.4rem; }
  .chip { font-size: 1.18rem; }
  .write-input, .blank-input { font-size: 1.25rem; }
  .flashcard { height: 380px; }
  .fc-word { font-size: 2.3rem; }
  .avatar-opt { font-size: 2.2rem; }
}
/* tela larga (iPad deitado, notebook): aproveita melhor a largura */
@media (min-width: 1024px) {
  :root { --ses-w: 880px; }
  .screen { max-width: 1000px; }
  .flash-stage { max-width: 600px; }
}

/* ---------- tela baixa (celular deitado): a resposta não cobre mais a questão ---------- */
@media (max-height: 540px) and (orientation: landscape) {
  .topbar { position: static; padding-top: max(6px, env(safe-area-inset-top)); padding-bottom: 6px; }
  .brand-owl, .avatar-btn { font-size: 1.4rem; }
  .avatar-btn { width: 40px; height: 40px; }
  .screen { padding-top: 10px; }
  .session { padding-bottom: calc(96px + var(--safe-b)); }
  .ses-bar { padding: 4px 0; }
  .ses-title { margin: 2px 0 6px; }
  .q-emoji { font-size: 2.6rem; }
  .question { gap: 8px; }
  .ses-footer { padding-top: 8px; padding-bottom: calc(8px + var(--safe-b)); }
  .ses-footer .btn.big { min-height: 46px; padding: 8px 18px; }
  .feedback { position: static; max-height: none; margin-top: 14px; padding: 12px 14px; border: 3px solid; border-radius: 16px; animation: none; }
  .flashcard { height: 230px; }
  .fc-emoji { font-size: 3rem; }
  .fc-word { font-size: 1.6rem; }
  .page-icon { width: 48px; height: 48px; font-size: 1.6rem; }
  .overlay { padding: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media print {
  .topbar, .ses-footer, .feedback, .site-footer { display: none; }
}
