/* Claude Lessons · CSS mobile-first
   Base = celular. Os @media (min-width) acrescentam o layout de tablet e desktop.
   Regra de ouro do iOS: todo campo editável usa no mínimo 16px de fonte (senão o Safari dá zoom ao focar). */

/* ---------- tokens ---------- */
:root {
  --bg: #f6f7fb; --panel: #ffffff; --ink: #1c1d2b; --muted: #555a72; --line: #dfe2ec;
  --brand: #4f46e5; --brand-ink: #ffffff; --brand-soft: #eceafd;
  --ok: #0c7a45; --ok-soft: #e3f6ec; --bad: #b9302a; --bad-soft: #fdeceb; --warn: #9a5b00; --warn-soft: #fff4de;
  --code-bg: #12131c; --code-ink: #e8e9f5;
  --tk-c: #8a8ea6; --tk-s: #9be29b; --tk-k: #c4a1ff; --tk-n: #ffb86b; --tk-f: #7fd0ff;
  --radius: 12px; --shadow: 0 1px 2px rgba(20,20,40,.06), 0 4px 16px rgba(20,20,40,.05);
  --field: max(1rem, 16px);
  --tabbar: 64px;
  --gutter: 16px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0f1018; --panel: #181924; --ink: #e9eaf4; --muted: #a3a7bf; --line: #2c2e40;
  --brand: #8f88ff; --brand-ink: #10101a; --brand-soft: #25234a;
  --ok: #4ad08a; --ok-soft: #12301f; --bad: #ff7f77; --bad-soft: #3a1b1a; --warn: #ffbf5e; --warn-soft: #3a2b10;
  --code-bg: #0a0b11; --shadow: none;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1018; --panel: #181924; --ink: #e9eaf4; --muted: #a3a7bf; --line: #2c2e40;
    --brand: #8f88ff; --brand-ink: #10101a; --brand-soft: #25234a;
    --ok: #4ad08a; --ok-soft: #12301f; --bad: #ff7f77; --bad-soft: #3a1b1a; --warn: #ffbf5e; --warn-soft: #3a2b10;
    --code-bg: #0a0b11; --shadow: none;
    color-scheme: dark;
  }
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 72px; }
body { margin: 0; min-height: 100vh; min-height: 100dvh; background: var(--bg); color: var(--ink); font: 17px/1.7 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-tap-highlight-color: transparent; overflow-wrap: break-word; }
a { color: var(--brand); text-underline-offset: 2px; }
a, button, summary, label, input, select, textarea { touch-action: manipulation; }
img, svg, video { max-width: 100%; height: auto; }
.skip { position: absolute; left: -999px; top: 8px; } .skip:focus { left: 8px; background: var(--panel); padding: 10px 14px; z-index: 99; border-radius: 8px; }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; border-radius: 4px; }
main:focus { outline: none; }
[hidden] { display: none !important; }

h1 { font-size: 1.6rem; line-height: 1.2; margin: 0 0 8px; letter-spacing: -.01em; }
h2 { font-size: 1.3rem; margin: 32px 0 10px; line-height: 1.3; }
h3 { font-size: 1.08rem; margin: 26px 0 6px; }
p { margin: 0 0 14px; }
.lead { font-size: 1.05rem; color: var(--muted); max-width: 46rem; }
.muted { color: var(--muted); font-size: .94rem; }
.eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: .75rem; font-weight: 700; color: var(--brand); margin: 0 0 4px; }
.mt8 { margin-top: 8px; } .mt12 { margin-top: 12px; }
.loading { padding: 40px 0; text-align: center; }
code { font: .88em ui-monospace, "Cascadia Code", Consolas, monospace; background: var(--brand-soft); padding: 1px 6px; border-radius: 6px; overflow-wrap: anywhere; }
blockquote { margin: 14px 0; padding: 4px 16px; border-left: 4px solid var(--brand); background: var(--panel); border-radius: 0 8px 8px 0; color: var(--muted); }
ul, ol { padding-left: 22px; margin: 0 0 14px; } li { margin: 4px 0; }
hr { border: 0; border-top: 1px solid var(--line); margin: 28px 0; }

/* tabelas: rolam dentro da própria caixa, nunca a página */
.table-wrap { overflow-x: auto; margin: 14px 0; -webkit-overflow-scrolling: touch; border-radius: 10px; }
table { border-collapse: collapse; width: 100%; min-width: 30rem; font-size: .88rem; background: var(--panel); }
th, td { border: 1px solid var(--line); padding: 8px 10px; text-align: left; vertical-align: top; overflow-wrap: normal; }
th { background: var(--brand-soft); }
td code, th code { white-space: nowrap; }

/* código */
.codeblock { position: relative; margin: 14px 0; }
pre { margin: 0; background: var(--code-bg); color: var(--code-ink); padding: 14px 12px; border-radius: 10px; overflow-x: auto; -webkit-overflow-scrolling: touch; font: 13.5px/1.6 ui-monospace, "Cascadia Code", Consolas, monospace; tab-size: 2; }
pre code { background: none; padding: 0; font: inherit; color: inherit; overflow-wrap: normal; }
.copy { position: absolute; right: 6px; top: 6px; font: 600 12px system-ui, sans-serif; padding: 6px 10px; min-height: 32px; border-radius: 7px; border: 1px solid #ffffff33; background: #2a2c3d; color: #e3e4f2; cursor: pointer; opacity: .9; }
.tk-c { color: var(--tk-c); font-style: italic; } .tk-s { color: var(--tk-s); } .tk-k { color: var(--tk-k); } .tk-n { color: var(--tk-n); } .tk-f { color: var(--tk-f); }

/* ---------- topo e navegação (celular: abas embaixo) ---------- */
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 8px; padding: max(8px, env(safe-area-inset-top)) max(var(--gutter), env(safe-area-inset-right)) 8px max(var(--gutter), env(safe-area-inset-left)); background: var(--panel); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--ink); text-decoration: none; min-height: 44px; min-width: 0; }
.brand-t { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand small { color: var(--muted); font-weight: 500; display: none; }
.logo { background: var(--brand); color: var(--brand-ink); border-radius: 9px; padding: 2px 8px; font: 700 15px ui-monospace, Consolas, monospace; flex: none; }
.sync-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); flex: none; opacity: .8; }
.sync-dot[data-s="saving"] { background: var(--brand); animation: pulse 1s infinite alternate; }
.sync-dot[data-s="offline"] { background: var(--warn); }
.sync-dot[data-s="error"] { background: var(--bad); }
@keyframes pulse { to { opacity: .25; } }
.tools { display: flex; gap: 4px; margin-left: auto; flex: none; }
.icon-btn { font: inherit; font-size: 15px; font-weight: 600; color: var(--ink); background: none; border: 1px solid transparent; border-radius: 10px; min-width: 44px; min-height: 44px; padding: 0 10px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; cursor: pointer; }
.icon-btn:hover { background: var(--brand-soft); }
.icon-btn i { font-style: normal; font-size: 17px; line-height: 1; }
.readbar { position: absolute; left: 0; right: 0; bottom: -1px; height: 3px; }
.readbar i { display: block; height: 100%; width: 0; background: var(--brand); transition: width .1s linear; }

.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; justify-content: space-around; background: var(--panel); border-top: 1px solid var(--line); padding: 4px max(4px, env(safe-area-inset-right)) max(6px, env(safe-area-inset-bottom)) max(4px, env(safe-area-inset-left)); box-shadow: 0 -4px 16px rgba(20,20,40,.08); }
.tabs a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 56px; padding: 6px 2px; color: var(--ink); text-decoration: none; font-size: 11.5px; line-height: 1.15; text-align: center; border-radius: 10px; position: relative; }
.tabs a i { font-style: normal; font-size: 20px; line-height: 1; }
.tabs a.on { background: var(--brand-soft); color: var(--brand); font-weight: 700; }
.badge { background: var(--bad); color: #fff; border-radius: 99px; padding: 0 6px; font-size: 11px; line-height: 18px; min-width: 18px; text-align: center; position: absolute; top: 2px; right: calc(50% - 26px); }
.is-auth .tabs, .is-auth .sync-dot, .is-auth .foot { display: none; }
.is-auth .tools { margin-left: auto !important; }

main { max-width: 1400px; margin: 0 auto; padding: 18px max(var(--gutter), env(safe-area-inset-right)) 24px max(var(--gutter), env(safe-area-inset-left)); }
.is-auth main { padding-bottom: calc(32px + env(safe-area-inset-bottom)); }
.foot { text-align: center; color: var(--muted); font-size: 13px; padding: 8px var(--gutter) calc(var(--tabbar) + 28px + env(safe-area-inset-bottom)); max-width: 760px; margin: 0 auto; }
.narrow { max-width: 760px; margin: 0 auto; }

/* ---------- botões e campos ---------- */
.btn { font: inherit; font-size: 15px; font-weight: 600; padding: 10px 16px; min-height: 44px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-align: center; }
.btn:hover { border-color: var(--brand); }
.btn:active, .opt:active:not([disabled]), .lrow:active { transform: scale(.985); }
.btn.primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); } .btn.primary:hover { filter: brightness(1.08); }
.btn.danger { background: var(--bad); color: #fff; border-color: var(--bad); }
.btn.small { min-height: 40px; padding: 6px 14px; font-size: 14px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row .btn { flex: 1 1 auto; }

/* 16px+ em TODO campo editável: sem zoom automático no iOS */
input, select, textarea, .field, .editor, textarea.free { font-size: var(--field); }
.field { width: 100%; min-height: 48px; padding: 10px 12px; font-family: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; }
.field:focus { border-color: var(--brand); outline: 3px solid color-mix(in srgb, var(--brand) 30%, transparent); outline-offset: 0; }
.field[aria-invalid="true"] { border-color: var(--bad); }
.fieldset { margin: 0 0 16px; }
.fieldset label { display: block; font-weight: 600; font-size: .94rem; margin-bottom: 6px; }
.fieldset small { display: block; margin-top: 6px; font-size: .85rem; }
.pw { position: relative; }
.pw .field { padding-right: 92px; }
.pw .reveal { position: absolute; right: 4px; top: 4px; bottom: 4px; min-width: 76px; border: 0; border-radius: 8px; background: var(--brand-soft); color: var(--brand); font: 600 14px system-ui, sans-serif; cursor: pointer; }
.form-msg { min-height: 1.5em; font-size: .94rem; font-weight: 600; margin: 0 0 12px; }
.form-msg.bad { color: var(--bad); } .form-msg.ok { color: var(--ok); }
.inline-form { display: grid; gap: 0; }

/* ---------- cartões ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); margin: 16px 0; }
.card-title { margin: 4px 0 10px; font-size: 1.2rem; }
.danger-zone { border-color: color-mix(in srgb, var(--bad) 40%, var(--line)); }
.sync-line { font-size: .9rem; font-weight: 600; color: var(--ok); }
.sync-line[data-s="saving"] { color: var(--brand); } .sync-line[data-s="offline"] { color: var(--warn); } .sync-line[data-s="error"] { color: var(--bad); }

/* ---------- início ---------- */
.hero { display: grid; gap: 14px; margin: 18px 0 24px; }
.hero .card { margin: 0; }
.bar { height: 10px; background: var(--brand-soft); border-radius: 99px; overflow: hidden; margin-top: 10px; } .bar > i { display: block; height: 100%; background: var(--brand); transition: width .3s; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; text-align: center; }
.stats b { display: block; font-size: 1.35rem; line-height: 1.1; font-variant-numeric: tabular-nums; } .stats span { font-size: 12px; color: var(--muted); }
details.unit { margin: 12px 0; }
details.unit > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 12px; padding: 14px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); min-height: 64px; }
details.unit > summary::-webkit-details-marker { display: none; }
details.unit > summary::after { content: "▾"; color: var(--muted); transition: transform .2s; }
details.unit:not([open]) > summary::after { transform: rotate(-90deg); }
details.unit[open] > summary { margin-bottom: 8px; }
.unit .u-t { min-width: 0; flex: 1; }
.unit .u-t b { display: block; font-size: 1.02rem; line-height: 1.3; }
.unit .u-t small { color: var(--muted); font-size: .84rem; display: block; line-height: 1.45; margin-top: 2px; }
.unit .u-n { font-size: 13px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.unit .u-bar { display: block; height: 4px; background: var(--brand-soft); border-radius: 99px; overflow: hidden; margin-top: 8px; }
.unit .u-bar i { display: block; height: 100%; background: var(--ok); }
.lrow { display: flex; align-items: center; gap: 10px; padding: 12px; min-height: 64px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; margin: 6px 0; text-decoration: none; color: var(--ink); }
.lrow:hover { border-color: var(--brand); }
.lrow .dot { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; font-size: 13px; flex: none; color: var(--brand-ink); font-weight: 700; }
.lrow.done .dot { background: var(--ok); border-color: var(--ok); color: #fff; } .lrow.part .dot { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }
.lrow .t { flex: 1; min-width: 0; } .lrow .t b { display: block; line-height: 1.35; } .lrow .t small { color: var(--muted); font-size: .84rem; display: block; line-height: 1.45; }
.lrow .meta { display: none; color: var(--muted); font-size: 13px; white-space: nowrap; }
.tag { display: inline-block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; padding: 1px 8px; border-radius: 99px; background: var(--warn-soft); color: var(--warn); margin-left: 6px; vertical-align: middle; }

/* ---------- lição ---------- */
.lesson-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 36px; }
.lesson-body, .lesson-layout > *, .codeblock, .ex, .act { min-width: 0; max-width: 100%; }
.lesson-body { max-width: 760px; }
@media (min-width: 1100px) { .lesson-body { max-width: 960px; } }
.lesson-head .crumb { font-size: 14px; color: var(--muted); }
.lesson-head .tldr { font-size: 1.05rem; color: var(--muted); margin: 6px 0 12px; }
.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pill { display: inline-block; font-size: 13px; padding: 2px 10px; border-radius: 99px; background: var(--brand-soft); color: var(--brand); }
.toc { display: none; }
.toc-m { margin: 14px 0; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.toc-m summary { cursor: pointer; padding: 12px 16px; font-weight: 600; min-height: 48px; display: flex; align-items: center; }
.toc-m a { display: block; padding: 12px 16px; border-top: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.lesson-foot { display: flex; flex-direction: column-reverse; gap: 10px; margin-top: 36px; }
.lesson-foot .btn { width: 100%; }
.src { font-size: 14px; color: var(--muted); margin-top: 24px; }

.callout { border-radius: var(--radius); padding: 12px 16px; margin: 18px 0; border: 1px solid var(--line); background: var(--panel); border-left-width: 5px; }
.callout > :last-child { margin-bottom: 0; }
.callout-title { font-weight: 700; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; margin-bottom: 4px; }
.callout.tip { border-left-color: var(--ok); } .callout.tip .callout-title { color: var(--ok); }
.callout.warn { border-left-color: var(--warn); background: var(--warn-soft); } .callout.warn .callout-title { color: var(--warn); }
.callout.key { border-left-color: var(--brand); background: var(--brand-soft); } .callout.key .callout-title { color: var(--brand); }
.callout.why { border-left-color: var(--muted); } .callout.try { border-left-color: var(--ok); }

/* atividades */
.act { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin: 22px 0; box-shadow: var(--shadow); }
.act > h4 { margin: 0 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .07em; color: var(--brand); }
textarea.free { width: 100%; min-height: 84px; font-family: inherit; line-height: 1.5; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--ink); resize: vertical; }
.answer { margin-top: 12px; padding: 10px 14px; border-radius: 10px; background: var(--ok-soft); border: 1px solid var(--ok); }
.answer > :last-child { margin-bottom: 0; }
.answer:focus { outline: none; }
.q { padding: 12px 0; border-top: 1px solid var(--line); } .act > .q:first-of-type { border-top: 0; }
.q .qt { font-weight: 600; margin-bottom: 8px; }
.opt { display: block; width: 100%; min-height: 48px; text-align: left; font: inherit; font-size: 16px; line-height: 1.45; padding: 10px 14px; margin: 6px 0; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; color: var(--ink); cursor: pointer; }
.opt:hover:not([disabled]) { border-color: var(--brand); }
.opt.ok { background: var(--ok-soft); border-color: var(--ok); } .opt.bad { background: var(--bad-soft); border-color: var(--bad); }
.opt[disabled] { cursor: default; color: var(--ink); opacity: 1; }
.why { font-size: .94rem; margin: 4px 0 0; color: var(--muted); }
.chk { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; min-height: 44px; cursor: pointer; }
.chk input { margin-top: 4px; width: 22px; height: 22px; flex: none; accent-color: var(--brand); }
.chk.on span { color: var(--muted); text-decoration: line-through; }
.hint { margin: 8px 0; padding: 8px 14px; border-radius: 10px; background: var(--warn-soft); border: 1px solid var(--warn); font-size: .95rem; } .hint > :last-child { margin-bottom: 0; }
.hint b.n { color: var(--warn); }

/* exercício */
.ex { border: 2px solid var(--line); border-radius: var(--radius); background: var(--panel); margin: 28px 0; overflow: hidden; }
.ex.passed { border-color: var(--ok); }
.ex-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 6px 10px; padding: 10px 14px; background: var(--brand-soft); font-weight: 700; }
.ex-badge { font-size: 13px; font-weight: 600; }
.ex.passed .ex-head { background: var(--ok-soft); }
.ex-body { padding: 4px 14px 14px; }
.ex .editor { width: 100%; min-height: 220px; display: block; font-family: ui-monospace, "Cascadia Code", Consolas, monospace; line-height: 1.5; background: var(--code-bg); color: var(--code-ink); border: 0; border-radius: 10px; padding: 12px; resize: vertical; tab-size: 2; white-space: pre; overflow: auto; -webkit-overflow-scrolling: touch; }
.ex .actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; align-items: center; }
.ex .actions .btn { flex: 1 1 auto; }
.ex .kbd { display: none; color: var(--muted); font-size: 13px; }
.results { margin: 8px 0; padding: 0; list-style: none; }
.results li { padding: 6px 12px; border-radius: 8px; margin: 4px 0; font-size: .94rem; }
.results li.ok { background: var(--ok-soft); } .results li.ok::before { content: "✓ "; color: var(--ok); font-weight: 700; }
.results li.bad { background: var(--bad-soft); } .results li.bad::before { content: "✗ "; color: var(--bad); font-weight: 700; }
.results li small { display: block; color: var(--muted); font-family: ui-monospace, Consolas, monospace; font-size: 13px; margin-top: 2px; white-space: pre-wrap; overflow-x: auto; }
.banner { padding: 10px 14px; border-radius: 10px; margin: 8px 0; font-weight: 600; }
.banner.ok { background: var(--ok-soft); color: var(--ok); } .banner.bad { background: var(--bad-soft); color: var(--bad); }
.console { background: var(--code-bg); color: var(--code-ink); border-radius: 10px; padding: 10px 14px; font: 13.5px/1.5 ui-monospace, Consolas, monospace; white-space: pre-wrap; margin: 8px 0; max-height: 220px; overflow: auto; -webkit-overflow-scrolling: touch; }
.console b { color: var(--tk-c); font-weight: 500; }
.preview { margin: 10px 0; border: 1px dashed var(--line); border-radius: 10px; overflow: hidden; background: #fff; }
.preview iframe { width: 100%; height: 300px; border: 0; display: block; background: #fff; }
.explain { margin-top: 12px; }

/* revisão / progresso */
.empty { text-align: center; padding: 36px 16px; color: var(--muted); }
.notes-list article { margin: 10px 0; padding: 10px 14px; background: var(--panel); border-radius: 10px; border: 1px solid var(--line); white-space: pre-wrap; font-size: .95rem; }
.notes-list article a { text-decoration: none; }

/* ---------- login / cadastro ---------- */
.auth { display: grid; gap: 20px; max-width: 980px; margin: 0 auto; padding-top: 8px; }
.auth-logo { display: inline-block; background: var(--brand); color: var(--brand-ink); border-radius: 14px; padding: 6px 14px; font: 700 22px ui-monospace, Consolas, monospace; margin-bottom: 14px; }
.auth h1 { font-size: 1.7rem; }
.auth-feats { list-style: none; padding: 0; margin: 0; display: none; }
.auth-feats li { padding-left: 28px; position: relative; margin: 8px 0; }
.auth-feats li::before { content: "✓"; position: absolute; left: 0; top: 0; color: var(--ok); font-weight: 700; }
.auth-card { margin: 0; padding: 18px 16px; }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 18px; }
.seg button { font: inherit; font-size: 15px; font-weight: 600; min-height: 44px; border: 0; border-radius: 9px; background: none; color: var(--muted); cursor: pointer; }
.seg button.on { background: var(--panel); color: var(--ink); box-shadow: var(--shadow); }
.auth-switch { text-align: center; font-size: .94rem; margin: 16px 0 6px; }
.privacy { font-size: .8rem; color: var(--muted); text-align: center; margin: 0; }

/* ---------- diálogo e aviso ---------- */
.dlg { border: 1px solid var(--line); border-radius: 16px; padding: 20px; width: min(28rem, calc(100vw - 32px)); background: var(--panel); color: var(--ink); box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.dlg::backdrop { background: rgba(10,10,20,.5); }
.dlg h2 { margin: 0 0 8px; font-size: 1.15rem; }
.dlg .field { margin: 6px 0 4px; }
.dlg-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; flex-wrap: wrap; }
.dlg-actions .btn { flex: 1 1 8rem; }
.toast { position: fixed; left: 50%; bottom: calc(var(--tabbar) + 18px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); opacity: 0; pointer-events: none; z-index: 60; background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-size: .94rem; font-weight: 600; max-width: calc(100vw - 32px); transition: opacity .2s, transform .2s; box-shadow: 0 8px 24px rgba(0,0,0,.25); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.is-auth .toast { bottom: calc(24px + env(safe-area-inset-bottom)); }

/* ---------- telas maiores ---------- */
@media (min-width: 480px) {
  .brand small { display: inline; }
}
@media (min-width: 600px) {
  :root { --gutter: 24px; }
  h1 { font-size: 2rem; }
  .card { padding: 18px 20px; }
  .act { padding: 16px 20px; }
  .ex-body { padding: 4px 20px 16px; }
  .lrow { padding: 12px 16px; gap: 12px; }
  .lrow .meta { display: block; }
  pre { padding: 16px; font-size: 14px; }
  .lesson-foot { flex-direction: row; justify-content: space-between; flex-wrap: wrap; }
  .lesson-foot .btn { width: auto; }
  .auth-card { padding: 24px; }
  .preview iframe { height: 260px; }
}
@media (min-width: 760px) {
  /* abas sobem para o cabeçalho */
  :root { --tabbar: 0px; }
  .top { padding-top: max(10px, env(safe-area-inset-top)); padding-bottom: 10px; gap: 12px; background: color-mix(in srgb, var(--panel) 92%, transparent); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
  .tabs { position: static; margin-left: auto; padding: 0; border: 0; box-shadow: none; background: none; gap: 2px; justify-content: flex-end; }
  .tabs a { flex: none; flex-direction: row; gap: 6px; min-height: 44px; padding: 8px 12px; font-size: 15px; }
  .tabs a i { display: none; }
  .badge { position: static; margin-left: 2px; }
  .tools { margin-left: 4px; }
  main { padding-top: 28px; padding-bottom: 40px; }
  .foot { padding-bottom: calc(40px + env(safe-area-inset-bottom)); }
  .toast { bottom: 24px; }
  .hero { grid-template-columns: 1.4fr 1fr; gap: 20px; }
  .ex .kbd { display: inline; }
  .ex .actions .btn { flex: none; }
  .row .btn { flex: none; }
  .copy { opacity: 0; transition: opacity .15s; }
  .codeblock:hover .copy, .copy:focus-visible { opacity: 1; }
  .auth { grid-template-columns: 1.1fr 1fr; align-items: center; gap: 48px; padding-top: 40px; min-height: calc(100dvh - 160px); }
  .auth h1 { font-size: 2.3rem; }
  .auth-feats { display: block; }
  .inline-form { grid-template-columns: 1fr auto; gap: 12px; align-items: end; }
  .inline-form .btn { margin-bottom: 16px; }
}
@media (hover: none) { .copy { opacity: .9 !important; } }
@media (min-width: 1000px) {
  .lesson-layout { grid-template-columns: minmax(0, 1fr) 220px; }
  .toc { display: block; position: sticky; top: 84px; align-self: start; font-size: 14px; max-height: calc(100vh - 110px); overflow: auto; }
  .toc b { display: block; margin-bottom: 6px; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
  .toc a { display: block; padding: 4px 0 4px 10px; color: var(--muted); text-decoration: none; border-left: 2px solid var(--line); line-height: 1.4; }
  .toc a:hover { color: var(--brand); border-color: var(--brand); }
  .toc-m { display: none; }
  .lesson-head .tldr { font-size: 1.15rem; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
@media print {
  .top, .tabs, .foot, .toast, .toc, .toc-m, .lesson-foot, .copy { display: none !important; }
  main { padding: 0; }
}
