/* mte — more than English. Visual calmo e acolhedor (estilo Headspace): creme quente, laranja, lavanda, cantos bem redondos, botões grandes para o toque. */
/* Nunito (licença OFL) hospedada aqui: o app não depende do Google Fonts e funciona sem internet. */
@font-face { font-family: "Nunito"; font-style: normal; font-weight: 200 1000; font-display: swap; src: url("../fonts/nunito-latin-ext.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Nunito"; font-style: normal; font-weight: 200 1000; font-display: swap; src: url("../fonts/nunito-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --ink: #2b2a4c;
  --ink-soft: #66657f;
  --paper: #fff5e8;
  --paper-2: #ffe9d2;
  --cream: #fffaf4;
  --white: #ffffff;
  --line: #f0e1cf;
  --gold: #ff7a2f;      /* laranja principal (nome antigo mantido: o JS usa var(--gold-2), var(--rose)...) */
  --gold-2: #c94e0f;    /* laranja escuro: texto sobre fundo claro */
  --navy: #2b2a4c;
  --navy-2: #211f3b;
  --lav: #ece8ff;       /* lavanda: ações secundárias */
  --lav-2: #5a49d6;
  --sun: #ffc940;
  --sage: #2e9e7a;
  --rose: #d6435a;
  --ok: #17835b;
  --warn: #a86b00;
  --shadow: 0 8px 28px rgba(43, 42, 76, 0.08);
  --r-lg: 24px;
  --r-md: 16px;
  --r-sm: 12px;
  --serif: "Nunito", "Segoe UI", system-ui, sans-serif;
  --sans: "Nunito", "Segoe UI", system-ui, sans-serif;
  --tab-h: 68px;
  --glow: rgba(255, 122, 47, 0.32);
  --brand-grad: linear-gradient(155deg, #ffb066 0%, #ff8a5c 58%, #f07ab0 130%);
  --hero-grad: linear-gradient(135deg, #5a49d6 0%, #7d6cf0 100%);
  --hero-shadow: rgba(90, 73, 214, 0.28);
  --bar-grad: linear-gradient(90deg, #ffb347, #ff7a2f);
}

/* Três padrões de cores, escolhidos em "Minha conta". O padrão é o Sol (as variáveis acima). */
html[data-theme="mar"] {
  --paper: #eaf6f7; --paper-2: #d5eef0; --cream: #f5fbfc; --line: #cfe6e8;
  --gold: #34c3c9; --gold-2: #0b6f78;
  --lav: #e2ecff; --lav-2: #2f56d0; --sun: #ffd166;
  --glow: rgba(52, 195, 201, 0.35);
  --brand-grad: linear-gradient(155deg, #8fe6e6 0%, #6cc4f2 60%, #9aa8f7 130%);
  --hero-grad: linear-gradient(135deg, #0b6f78 0%, #16909b 100%);
  --hero-shadow: rgba(11, 111, 120, 0.28);
  --bar-grad: linear-gradient(90deg, #7fe0e0, #34c3c9);
}
html[data-theme="uva"] {
  --paper: #f6f0ff; --paper-2: #eadfff; --cream: #fbf8ff; --line: #e5daf5;
  --gold: #b08cff; --gold-2: #6b3fd0;
  --lav: #ffe3f0; --lav-2: #b02470; --sun: #ffc940;
  --glow: rgba(176, 140, 255, 0.4);
  --brand-grad: linear-gradient(155deg, #dccbff 0%, #f3aedd 60%, #ffbf98 130%);
  --hero-grad: linear-gradient(135deg, #6b3fd0 0%, #a25bd6 100%);
  --hero-shadow: rgba(107, 63, 208, 0.28);
  --bar-grad: linear-gradient(90deg, #d0b8ff, #b08cff);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--sans);
  background: var(--paper);
  color: var(--ink);
  min-height: 100vh;
  font-size: 16px;
  line-height: 1.5;
  -webkit-tap-highlight-color: transparent;
}
body.no-scroll { overflow: hidden; }
h1, h2, h3, h4 { line-height: 1.2; }
h3 { font-size: 19px; font-weight: 800; margin: 0 0 8px; }
a { color: var(--lav-2); }
button, input, select, textarea { font-family: inherit; }
:focus-visible { outline: 3px solid var(--lav-2); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

.app { display: none; min-height: 100vh; }
.app.visible { display: block; min-height: 100vh; }
.hidden { display: none !important; }

/* ---------- Botões ---------- */
.btn {
  border: 0;
  cursor: pointer;
  min-height: 46px;
  padding: 10px 22px;
  border-radius: 999px;
  background: var(--lav);
  color: var(--lav-2);
  font-size: 16px;
  font-weight: 800;
  line-height: 1.2;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform .12s, box-shadow .12s, background .12s;
}
.btn:hover { filter: brightness(0.96); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: default; transform: none; }
.btn.gold { background: var(--gold); color: var(--ink); box-shadow: 0 6px 16px var(--glow); }
.btn.ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 2px var(--line); }
.btn.ghost:hover { background: var(--cream); box-shadow: inset 0 0 0 2px var(--paper-2); }
.btn.small { min-height: 36px; padding: 5px 16px; font-size: 14px; white-space: nowrap; }

/* ---------- Campos ---------- */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 14px; font-weight: 700; margin-bottom: 6px; color: var(--ink); }
.field input, .field select, .field textarea,
.lib-search, .qbox input:not([type=radio]):not([type=checkbox]), .qbox select, .qbox textarea {
  width: 100%;
  border: 2px solid var(--line);
  border-radius: var(--r-md);
  background: var(--white);
  padding: 12px 16px;
  min-height: 48px;
  font-size: 16px; /* 16px evita o zoom automático do iPhone */
  color: var(--ink);
}
.field input:focus, .field select:focus, .field textarea:focus, .lib-search:focus,
.qbox input:focus, .qbox select:focus, .qbox textarea:focus { border-color: var(--lav-2); outline: 0; }
.lib-search { flex: 1; min-width: 180px; width: auto; }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 0.9fr; background: var(--cream); }
.login-brand {
  position: relative;
  overflow: hidden;
  background: var(--brand-grad);
  color: var(--ink);
  padding: 64px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.login-brand::before, .login-brand::after { content: ""; position: absolute; border-radius: 50%; background: rgba(255, 255, 255, 0.16); }
.login-brand::before { width: 420px; height: 420px; right: -140px; bottom: -120px; }
.login-brand::after { width: 200px; height: 200px; left: -60px; top: 42%; background: rgba(255, 201, 64, 0.35); }
.login-brand > * { position: relative; z-index: 1; }
.login-brand h1 { font-weight: 800; font-size: 52px; line-height: 1.05; margin: 8px 0 16px; }
.login-brand .slogan { font-weight: 800; font-size: 15px; letter-spacing: 0.04em; opacity: 0.95; }
.logo { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; font-size: 26px; margin-bottom: 28px; }
.logo i { width: 40px; height: 40px; border-radius: 50%; background: var(--sun); display: grid; place-items: center; color: var(--ink); font-style: normal; font-size: 18px; }
.login-brand p.lead { max-width: 420px; font-size: 18px; line-height: 1.5; opacity: 0.95; }
.login-panel { padding: 56px; display: flex; flex-direction: column; justify-content: center; max-width: 560px; width: 100%; margin: 0 auto; }
.login-panel h2 { font-size: 32px; font-weight: 800; margin: 0 0 20px; }
.login-panel .hint { color: var(--ink-soft); }
.script { margin-top: 28px; padding-top: 20px; border-top: 2px dashed var(--line); font-size: 14px; color: var(--ink-soft); }
.script ol { padding-left: 20px; }

/* ---------- Estrutura: menu lateral, conteúdo e barra de baixo ---------- */
.sidebar {
  background: var(--white);
  color: var(--ink);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0; top: 0; bottom: 0;
  width: 264px;
  z-index: 8;
  overflow: auto;
  box-shadow: 4px 0 24px rgba(43, 42, 76, 0.05);
}
.brand-mark { font-size: 30px; font-weight: 800; margin: 0 8px; display: flex; align-items: center; gap: 10px; }
.brand-mark::before { content: "m"; width: 38px; height: 38px; border-radius: 50%; background: var(--gold); color: var(--ink); display: grid; place-items: center; font-size: 20px; }
.brand-mark small { display: none; }
nav { margin-top: 28px; display: grid; gap: 4px; }
nav button {
  display: flex; align-items: center; gap: 12px;
  text-align: left;
  background: transparent;
  color: var(--ink-soft);
  border: 0;
  border-radius: 14px;
  padding: 11px 14px;
  min-height: 44px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}
nav button:hover { background: var(--cream); color: var(--ink); }
nav button.active { background: var(--paper-2); color: var(--gold-2); }
.ico { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sidebar .who { margin-top: auto; font-size: 14px; color: var(--ink-soft); padding: 12px 14px; background: var(--cream); border-radius: var(--r-md); }
.sidebar .who b { color: var(--ink); }
.sidebar .btn { width: 100%; margin-top: 8px; }
.main { padding: 36px 44px 72px; margin-left: 264px; max-width: 1180px; }
.topbar { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 26px; gap: 16px; flex-wrap: wrap; }
.topbar h2 { font-size: 32px; font-weight: 800; margin: 0; }
.topbar p { margin: 6px 0 0; color: var(--ink-soft); }

.tabbar { display: none; }
.sheet-bg { position: fixed; inset: 0; background: rgba(43, 42, 76, .45); z-index: 25; display: flex; align-items: flex-end; }
.sheet { background: var(--white); width: 100%; border-radius: 28px 28px 0 0; padding: 18px 16px calc(20px + env(safe-area-inset-bottom)); max-height: 82vh; overflow: auto; }
.sheet .grip { width: 44px; height: 5px; border-radius: 9px; background: var(--line); margin: 0 auto 14px; }
.sheet-who { padding: 0 8px 12px; color: var(--ink-soft); }
.sheet-who b { color: var(--ink); font-size: 18px; }
.sheet-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.sheet-grid button { display: flex; align-items: center; gap: 10px; min-height: 56px; padding: 10px 14px; border: 0; border-radius: var(--r-md); background: var(--cream); color: var(--ink); font-size: 15px; font-weight: 700; text-align: left; cursor: pointer; }
.sheet-grid button.active { background: var(--paper-2); color: var(--gold-2); }
.sheet .row { margin-top: 12px; }
.sheet .row .btn { flex: 1; }

/* ---------- Componentes ---------- */
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-2 { display: grid; grid-template-columns: 1.3fr 0.7fr; gap: 16px; }
.cards { display: grid; gap: 12px; }
.card { background: var(--white); border-radius: var(--r-lg); padding: 22px; box-shadow: var(--shadow); }
.stat { font-size: 34px; font-weight: 800; margin: 0; }
.muted { color: var(--ink-soft); font-size: 14px; }
.tag {
  display: inline-flex;
  align-items: center;
  align-self: center;
  line-height: 1.2;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
  border-radius: 999px;
  padding: 4px 12px;
  color: var(--ink-soft);
  background: var(--paper);
}
.tag.ok { color: var(--ok); background: #e2f6ec; }
.tag.warn { color: var(--warn); background: #fff1cc; }
.tag.late { color: var(--rose); background: #fde5e8; }
.tag.gold { color: var(--gold-2); background: var(--paper-2); }

table { width: 100%; border-collapse: collapse; font-size: 15px; }
th { text-align: left; font-size: 13px; font-weight: 800; color: var(--ink-soft); padding: 8px 10px; border-bottom: 2px solid var(--line); }
td { padding: 12px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }

.lesson-now {
  position: relative;
  overflow: hidden;
  background: var(--hero-grad);
  color: #fff;
  border-radius: var(--r-lg);
  padding: 28px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: center;
  box-shadow: 0 12px 32px var(--hero-shadow);
}
.lesson-now::after { content: ""; position: absolute; width: 220px; height: 220px; border-radius: 50%; background: rgba(255, 255, 255, 0.1); right: -60px; top: -80px; }
.lesson-now > * { position: relative; z-index: 1; }
.lesson-now h3 { font-size: 26px; font-weight: 800; margin: 0 0 6px; }
.lesson-now p { margin: 0; opacity: 0.92; }

.list-item { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.stack { display: grid; gap: 14px; align-content: start; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.click-row { cursor: pointer; }
.click-row:hover { background: var(--cream); }

.exercise q { font-size: 20px; font-weight: 800; display: block; margin: 8px 0 16px; }
.feedback { background: var(--lav); border-radius: var(--r-md); padding: 14px 16px; margin-top: 12px; }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--lav); color: var(--lav-2); display: grid; place-items: center; font-size: 14px; font-weight: 800; }
.modal-bg { position: fixed; inset: 0; background: rgba(43, 42, 76, .45); display: grid; place-items: center; z-index: 20; padding: 20px; }
.modal { max-width: 520px; width: 100%; max-height: 90vh; overflow: auto; }
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 999px; font-weight: 700; max-width: calc(100vw - 32px); text-align: center;
  opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 60;
}
.toast.show { opacity: 1; }

.cal-week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.cal-col { background: var(--white); border-radius: var(--r-md); min-height: 120px; padding: 10px; box-shadow: var(--shadow); }
.cal-col.today, .cal-cell.today { outline: 3px solid var(--gold); }
.cal-pill { display: block; width: 100%; text-align: left; background: var(--paper-2); border: 0; border-radius: 10px; padding: 8px 10px; margin-top: 6px; cursor: pointer; font-size: 13px; font-weight: 700; color: var(--ink); }
.cal-month-head, .cal-month { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-month-head { margin-bottom: 6px; text-align: center; font-size: 13px; font-weight: 700; color: var(--ink-soft); }
.cal-cell { background: var(--white); border-radius: 12px; min-height: 72px; padding: 6px; font-size: 12px; }
.cal-dot { background: var(--paper-2); border-radius: 6px; margin-top: 4px; padding: 2px 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.type-block h4 { margin: 0 0 8px; font-size: 14px; font-weight: 800; color: var(--ink-soft); }
.type-block { margin-top: 20px; }
.qedit { border: 2px solid var(--line); border-radius: var(--r-md); padding: 14px; margin-bottom: 12px; background: var(--cream); }
.lesson-video { position: relative; padding-top: 56.25%; border-radius: var(--r-md); overflow: hidden; }
.lesson-video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.w-wrong { background: #fde5e8; border-bottom: 2px solid var(--rose); }
.w-missing { background: #fff1cc; border-bottom: 2px dotted var(--warn); }
.pulse { animation: mte-pulse 1.6s ease-in-out infinite; }
@keyframes mte-pulse { 0%, 100% { box-shadow: 0 0 0 0 var(--glow); } 50% { box-shadow: 0 0 0 10px transparent; } }

/* ---------- Perguntas (aula, formulário e modo uma-por-vez) ---------- */
.qbox { border-top: 2px solid var(--line); padding-top: 14px; margin-top: 14px; }
.qbox label {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  margin: 8px 0;
  padding: 14px 16px;
  min-height: 54px;
  border: 2px solid var(--line);
  border-radius: var(--r-md);
  background: var(--white);
  cursor: pointer;
  font-weight: 700;
}
.qbox label:hover { border-color: var(--paper-2); background: var(--cream); }
.qbox label:has(input:checked) { border-color: var(--gold); background: var(--paper-2); }
.qbox label input { width: 22px; height: 22px; margin: 0; accent-color: var(--gold); flex: none; }
.qbox .row select { width: auto; flex: 1; }
.order-out { min-height: 60px; border: 2px dashed var(--line); border-radius: var(--r-md); padding: 8px; margin-bottom: 10px; }
.order button { border-radius: 999px; min-height: 44px; font-size: 16px; }

/* Interesses do aluno (chips): toque alterna gosto → evitar → limpar */
.interests .chip { border: 2px solid var(--line); border-radius: 999px; background: var(--white); color: var(--ink); padding: 8px 16px; font-size: 15px; font-weight: 700; cursor: pointer; min-height: 40px; }
.interests .chip[data-pref="gosto"] { background: #e2f6ec; border-color: #9fdcbf; color: var(--ok); }
.interests .chip[data-pref="gosto"]::before { content: "✓ "; }
.interests .chip[data-pref="evitar"] { background: #fde5e8; border-color: #f3b3bd; color: var(--rose); text-decoration: line-through; }
.interests .chip[data-pref="evitar"]::before { content: "✕ "; }
.interests input[data-intnew] { padding: 8px 14px; border: 2px solid var(--line); border-radius: 999px; background: var(--white); font-size: 16px; }

/* Níveis do aluno: cabeçalhos que abrem e fecham */
.fold { display: flex; justify-content: space-between; align-items: center; gap: 12px; width: 100%; padding: 14px 0; min-height: 48px; background: transparent; border: 0; border-bottom: 2px solid var(--line); color: var(--ink); font-size: 16px; font-weight: 700; text-align: left; cursor: pointer; }
.fold:hover { color: var(--gold-2); }
.fold.big { font-size: 22px; font-weight: 800; }

/* Livros: leitor com áudio */
.book-par { min-width: 0; } /* sem isso a linha recolhida (sem quebra) alarga a página */
.book-par.done { border-left: 5px solid var(--ok); }
.book-par.playing { outline: 3px solid var(--gold); background: var(--paper-2); }
.book-play { flex: none; width: 48px; height: 48px; min-height: 0; padding: 0; border-radius: 50%; font-size: 20px; line-height: 1; background: var(--gold); color: var(--ink); box-shadow: 0 4px 12px var(--glow); }
.book-play:disabled { background: var(--paper-2); box-shadow: none; }
.book-text { margin: 0; font-size: 19px; line-height: 1.7; }
.book-foot { justify-content: space-between; flex-wrap: nowrap; margin-top: 12px; }
.book-tools { margin-top: 12px; padding-top: 12px; border-top: 2px dashed var(--line); }
.bw.lit { background: var(--glow); box-shadow: 0 0 0 2px var(--glow); border-radius: 4px; }
.book-speedctl { display: flex; align-items: center; gap: 4px; flex-shrink: 0; margin-left: auto; }
.book-speedctl .btn { min-width: 44px; min-height: 44px; padding: 0; font-size: 22px; line-height: 1; }
.book-speedctl span { min-width: 54px; text-align: center; font-size: 15px; font-variant-numeric: tabular-nums; color: var(--ink-soft); }

/* ---------- Modo uma pergunta por vez (exercícios e formulários) ---------- */
.ex-start { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; background: var(--cream); border-radius: var(--r-md); padding: 14px 16px; }
.player { position: fixed; inset: 0; z-index: 40; background: var(--cream); display: flex; flex-direction: column; }
.player-top { display: flex; align-items: center; gap: 14px; padding: calc(14px + env(safe-area-inset-top)) 18px 10px; max-width: 700px; width: 100%; margin: 0 auto; }
.player-x { flex: none; width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--white); color: var(--ink-soft); font-size: 20px; cursor: pointer; box-shadow: var(--shadow); }
.pbar { flex: 1; height: 14px; border-radius: 999px; background: var(--paper-2); overflow: hidden; }
.pbar i { display: block; height: 100%; border-radius: 999px; background: var(--bar-grad); transition: width .4s ease; }
.pcount { flex: none; font-weight: 800; color: var(--ink-soft); font-size: 14px; min-width: 42px; text-align: right; }
.player-body { flex: 1; overflow: auto; padding: 8px 20px 24px; }
.player-inner { max-width: 640px; margin: 0 auto; }
.player .qbox { border: 0; padding: 0; margin: 0; }
.player .qbox > .muted:first-child { font-weight: 800; font-size: 13px; color: var(--gold-2); text-transform: uppercase; letter-spacing: .06em; }
.player .qbox > p { font-size: 24px; font-weight: 800; line-height: 1.3; margin: 8px 0 18px; }
.player .qbox [data-lessonsend] { display: none; }
.player .qbox textarea { min-height: 160px; }
.player-foot { background: var(--white); box-shadow: 0 -6px 24px rgba(43, 42, 76, 0.07); padding: 14px 20px calc(14px + env(safe-area-inset-bottom)); }
.player-foot-in { max-width: 640px; margin: 0 auto; display: flex; gap: 12px; align-items: center; }
.player-foot .btn.gold { flex: 1; min-height: 54px; font-size: 17px; }
.player-foot .btn.ghost { min-height: 54px; }
.pfb { border-radius: var(--r-md); padding: 16px 18px; margin-top: 16px; font-weight: 700; }
.pfb b { display: block; font-size: 19px; margin-bottom: 2px; }
.pfb.ok { background: #e2f6ec; color: #0f6a49; }
.pfb.no { background: #fde5e8; color: #a52d42; }
.pfb span { font-weight: 600; }
.player-done { text-align: center; padding-top: 24px; }
.score-ring { width: 150px; height: 150px; border-radius: 50%; margin: 0 auto 18px; display: grid; place-items: center; font-size: 40px; font-weight: 800; color: var(--ink); background: conic-gradient(var(--gold) calc(var(--p) * 1%), var(--paper-2) 0); position: relative; }
.score-ring::before { content: ""; position: absolute; inset: 14px; background: var(--cream); border-radius: 50%; }
.score-ring span { position: relative; }
.player-done h2 { font-size: 28px; font-weight: 800; margin: 0 0 6px; }
.player-list { text-align: left; margin: 22px 0 0; display: grid; gap: 8px; }
.player-list div { display: flex; gap: 10px; align-items: flex-start; background: var(--white); border-radius: var(--r-md); padding: 12px 14px; box-shadow: var(--shadow); font-weight: 600; }
.player-list b { flex: none; width: 24px; }
.player-list .yes b { color: var(--ok); }
.player-list .miss b { color: var(--rose); }

/* ---------- Celular e tablet ---------- */
@media (max-width: 900px) {
  .login-wrap, .grid-3, .grid-2, .lesson-now { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .main { padding: 18px 16px calc(var(--tab-h) + 32px + env(safe-area-inset-bottom)); margin-left: 0; }
  .topbar h2 { font-size: 26px; }
  .card { padding: 18px; border-radius: 20px; overflow-x: auto; }
  .lesson-now { padding: 22px; }
  .lesson-now .btn { width: 100%; }
  .login-brand { padding: 28px 24px 56px; }
  .login-brand h1 { font-size: 32px; margin-bottom: 4px; }
  .login-brand p.lead { display: none; }
  .logo { margin-bottom: 14px; }
  .login-panel { padding: 28px 22px 40px; margin-top: -28px; background: var(--cream); border-radius: 28px 28px 0 0; position: relative; max-width: none; }
  .script { display: none; }
  .tabbar {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    position: fixed; left: 0; right: 0; bottom: 0;
    z-index: 9;
    height: calc(var(--tab-h) + env(safe-area-inset-bottom));
    padding: 6px 4px env(safe-area-inset-bottom);
    background: var(--white);
    box-shadow: 0 -4px 22px rgba(43, 42, 76, 0.09);
  }
  .tabbar button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; border: 0; background: transparent; color: var(--ink-soft); font-size: 11px; font-weight: 800; border-radius: 14px; cursor: pointer; padding: 0; }
  .tabbar button .ico { width: 26px; height: 26px; }
  .tabbar button.active { color: var(--gold-2); }
  .tabbar button.active .ico { stroke: var(--gold-2); }
  .modal-bg { align-items: end; padding: 0; }
  .modal { max-width: none; border-radius: 28px 28px 0 0; padding-bottom: calc(22px + env(safe-area-inset-bottom)); }
  .toast { bottom: calc(var(--tab-h) + 16px + env(safe-area-inset-bottom)); }
  .cal-week { grid-template-columns: 1fr; }
  .cal-col { min-height: 0; }
  .cal-cell { min-height: 52px; padding: 3px; }
  .row .btn { flex: 0 1 auto; }
  .sheet-grid { grid-template-columns: 1fr 1fr; }
  table { font-size: 14px; }
}

/* Escala 1–5: cinco botões lado a lado */
.qbox .row label { flex: 1; min-width: 56px; justify-content: center; margin: 4px 0; }

/* Selects soltos (fora de formulários) */
select { border: 2px solid var(--line); border-radius: 12px; background: var(--white); padding: 8px 12px; color: var(--ink); font-size: 15px; }

/* ---------- Escolha de cores (Minha conta) ---------- */
.themes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 12px; }
.theme-opt { display: grid; gap: 10px; justify-items: center; padding: 14px 8px; border: 3px solid var(--line); border-radius: var(--r-md); background: var(--white); cursor: pointer; font-size: 15px; font-weight: 800; color: var(--ink); }
.theme-opt:hover { border-color: var(--paper-2); }
.theme-opt.on { border-color: var(--gold); background: var(--paper-2); }
.theme-opt .sw { display: flex; }
.theme-opt .sw i { width: 30px; height: 30px; border-radius: 50%; border: 3px solid var(--white); margin-left: -8px; }
.theme-opt .sw i:first-child { margin-left: 0; }

/* ---------- Escolher arquivo: área grande que também aceita arrastar e soltar ---------- */
.filepick { position: relative; display: flex; align-items: center; gap: 14px; padding: 14px 16px; border: 2px dashed var(--line); border-radius: var(--r-md); background: var(--cream); cursor: pointer; transition: border-color .12s, background .12s; }
.filepick:hover, .filepick.drag { border-color: var(--gold); background: var(--paper-2); }
.filepick.has { border-style: solid; border-color: var(--gold); background: var(--paper-2); }
.filepick:has(input:focus-visible) { outline: 3px solid var(--lav-2); outline-offset: 2px; }
.filepick > input[type=file], .qbox .filepick > input[type=file], .field .filepick > input[type=file] { position: absolute; inset: 0; width: 100%; height: 100%; min-height: 0; padding: 0; border: 0; opacity: 0; cursor: pointer; }
.fp-ico { flex: none; width: 46px; height: 46px; border-radius: 50%; background: var(--gold); color: var(--ink); display: grid; place-items: center; }
.fp-ico .ico { width: 22px; height: 22px; }
.fp-txt { display: grid; min-width: 0; }
.fp-txt b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fp-txt small { color: var(--ink-soft); font-size: 13px; }

/* Tarefas dos materiais, passo a passo */
.work-step { padding-top: 8px; }
.work-kicker { font-weight: 800; font-size: 13px; color: var(--gold-2); text-transform: uppercase; letter-spacing: .06em; margin: 0; }
.work-prompt { font-size: 24px; font-weight: 800; line-height: 1.3; margin: 8px 0 18px; }
.work-step textarea, .work-step input:not([type=file]) { width: 100%; border: 2px solid var(--line); border-radius: var(--r-md); background: var(--white); padding: 12px 16px; min-height: 48px; font-size: 16px; color: var(--ink); }
.work-step textarea { min-height: 170px; }
.work-step textarea:focus, .work-step input:focus { border-color: var(--lav-2); outline: 0; }
.pfb.tip { background: var(--lav); color: var(--lav-2); }
.player-list small { font-weight: 600; }

/* Microfone nos campos de recado e teoria */
.voice { margin-top: 8px; }
.voice audio { margin-top: 6px; }
.voice .muted { margin: 6px 0 0; }

/* Cartões de números (frequência, tarefas, nível) lado a lado no celular */
@media (max-width: 900px) {
  .grid-3:has(.stat) { grid-template-columns: repeat(3, 1fr); gap: 10px; }
  .grid-3:has(.stat) .card { padding: 14px; }
  .grid-3:has(.stat) .stat { font-size: 26px; }
}

/* Caixas de texto soltas (fora de .field) */
textarea { width: 100%; border: 2px solid var(--line); border-radius: var(--r-md); background: var(--white); padding: 10px 14px; color: var(--ink); font-size: 16px; }
textarea:focus { border-color: var(--lav-2); outline: 0; }

/* Reabrindo a sessão (app instalado): não mostra o login por um instante */
html.restoring #login { visibility: hidden; }
/* Convite para instalar o app */
.nudge { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; background: var(--paper-2); box-shadow: none; }

/* Botão com texto longo (ex.: título de aula): quebra em linhas em vez de estourar o cartão */
.btn.wrap { white-space: normal; max-width: 100%; text-align: center; line-height: 1.25; padding-top: 8px; padding-bottom: 8px; }

/* Leitor de livros: navegação entre parágrafos */
.book-nav { display: flex; gap: 10px; margin-top: 14px; }
.book-nav .btn { flex: 1; min-height: 52px; }

/* Resumo da leitura dos alunos (professora) */
.sum-bar { height: 10px; border-radius: 99px; background: var(--paper-2); overflow: hidden; margin-top: 12px; }
.sum-bar i { display: block; height: 100%; background: var(--ok); border-radius: 99px; }
.sum-par { padding: 12px 14px; border-radius: 14px; background: var(--cream); }
.sum-par.done { border-left: 4px solid var(--ok); }
