/* Layout: a calculadora ocupa a primeira tela do celular; aulas e texto vêm abaixo. */
@font-face { font-family: Archivo; src: url(/assets/archivo.e3a28eade2.woff2) format('woff2'); font-weight: 100 900; font-stretch: 62% 125%; font-display: swap }
@font-face { font-family: 'Martian Mono'; src: url(/assets/martian-mono.d0be3a78a8.woff2) format('woff2'); font-weight: 100 800; font-display: swap }
/* escuro é o padrão; o botão de tema põe data-theme="light" (projetor). Laranja e azul ficam só nas teclas f e g. */
:root { color-scheme: dark; --bg: #141312; --panel: #211f1d; --ink: #f1ece2; --muted: #aaa396; --line: #3b3834; --accent: #dcc48a; --title: #dcc48a; --now: #e8b84d; --on-now: #1b1409; --go: #e8b84d; --on-go: #1b1409; --mid: #3a352c; --on-mid: #f1e3bd; --mid-line: #6f6242; --run: #dcc48a; --on-run: #1b1409; --ui: "Archivo", "Helvetica Neue", Arial, sans-serif; --lcd: "Martian Mono", "SFMono-Regular", Menlo, monospace }
:root[data-theme="light"] { color-scheme: light; --bg: #f1f0ec; --panel: #fff; --ink: #1b1917; --muted: #5d5850; --line: #d5d1c7; --accent: #6b4e0c; --title: #1b1917; --now: #1b1917; --on-now: #fff; --go: #f0b429; --on-go: #1b1917; --mid: #efe4c8; --on-mid: #1b1917; --mid-line: #b7a477; --run: #1b1917; --on-run: #f3e6c2 }
* { box-sizing: border-box }
html, body { margin: 0 }
body { background: var(--bg); color: var(--ink); font: 400 1.02rem/1.6 var(--ui); -webkit-text-size-adjust: 100% }
button { font: inherit; color: inherit; touch-action: manipulation; -webkit-tap-highlight-color: transparent }
a { color: var(--accent); text-underline-offset: 3px }
:focus-visible { outline: 3px solid var(--now); outline-offset: 2px }
h1, h2, h3, p { margin: 0 } h1, h2, h3 { line-height: 1.15; text-wrap: balance; letter-spacing: -.015em }
/* área segura: --st/--sb/--sl/--sr vêm do aparelho (recorte, barra de gestos); --pt/--pb são a folga do layout */
:root { --st: env(safe-area-inset-top, 0px); --sb: env(safe-area-inset-bottom, 0px); --sl: env(safe-area-inset-left, 0px); --sr: env(safe-area-inset-right, 0px); --pt: 14px; --pb: 48px; --gap-x: 16px }
.page { padding: calc(var(--pt) + var(--st)) calc(var(--gap-x) + var(--sr)) calc(var(--pb) + var(--sb)) calc(var(--gap-x) + var(--sl)); display: grid; gap: 28px; max-width: 1000px; margin: 0 auto; grid-template-columns: minmax(0, 1fr) }
.main { display: grid; gap: 36px; min-width: 0; grid-template-columns: minmax(0, 1fr) }
.stage { display: flex; flex-direction: column; gap: 10px; min-width: 0 }
.head { display: flex; align-items: center; justify-content: space-between; gap: 12px }
.head h1, .brand { font-size: 1.15rem; font-weight: 800 } .head small { display: block; font-size: .8rem; font-weight: 500; color: var(--muted); letter-spacing: 0 }
.brand { color: inherit; text-decoration: none }
.acts { display: flex; gap: 8px; align-items: center }
.pill { border: 1px solid var(--line); background: var(--panel); color: inherit; border-radius: 999px; padding: 8px 14px; font-size: .84rem; font-weight: 600; cursor: pointer; min-height: 40px; text-decoration: none; display: inline-flex; align-items: center }
.pill:hover { border-color: var(--accent) }
.below { display: grid; gap: 36px; grid-template-columns: minmax(0, 1fr) }
.sec, .intro { display: grid; gap: 12px; min-width: 0; grid-template-columns: minmax(0, 1fr) } .sec h2 { font-size: 1.45rem; font-weight: 800 } .intro h1 { font-size: clamp(1.6rem, 5vw, 2.3rem); font-weight: 800 }
.sec > p, .intro > p, .sec li { max-width: 66ch } .sec ul, .sec ol { margin: 0; padding-left: 1.2em; display: grid; gap: 6px }
.lessons { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap: 0 28px } .lessons a { display: block; padding: 12px 0; border-top: 1px solid var(--line); text-decoration: none; color: inherit } .lessons b { display: block; color: var(--title) } .lessons a:hover b { text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 3px } .lessons span { color: var(--muted); font-size: .92rem }
.seq { display: flex; flex-wrap: wrap; gap: 6px } kbd { font: 600 .8rem var(--lcd); border: 1px solid var(--line); background: var(--panel); border-radius: 6px; padding: 4px 8px } kbd.now { background: var(--now); color: var(--on-now); border-color: var(--now) }
.run { justify-self: start; background: var(--run); color: var(--on-run); border: 0; border-radius: 999px; padding: 11px 20px; font-weight: 700; cursor: pointer; min-height: 46px }
.out { font: 600 1rem var(--lcd); color: var(--accent) }
.tbl { overflow-x: auto } table { border-collapse: collapse; width: 100%; font-size: .94rem } td, th { text-align: left; padding: 8px 12px 8px 0; border-top: 1px solid var(--line); vertical-align: top } th { white-space: nowrap }
.site-foot { border-top: 1px solid var(--line); padding-top: 18px; color: var(--muted); font-size: .88rem; display: grid; gap: 8px } .talk { color: var(--ink); font-size: .95rem } .site-foot nav { display: flex; gap: 18px; flex-wrap: wrap }
[hidden] { display: none !important }
dialog { border: 1px solid var(--line); border-radius: 12px; background: var(--panel); color: var(--ink); padding: 20px 22px; max-width: min(92vw, 380px) } dialog::backdrop { background: rgba(0,0,0,.6) } dialog h2 { font-size: 1.2rem } dialog ol { padding-left: 1.2em }
dialog.ask { max-width: min(94vw, 520px); padding: 16px 18px } .ask p { margin: 6px 0 14px; font-size: .94rem; line-height: 1.45 } .ask h2 { outline: 0 } .opts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px } .opts .pill { justify-content: center; text-align: center; min-height: 46px; line-height: 1.2; font-size: .95rem; font-weight: 700; border-color: var(--accent) } .opts .go { background: var(--go); border-color: var(--go); color: var(--on-go); min-height: 54px } .opts .go:hover, .opts .mid:hover, .run:hover { filter: brightness(1.07) } .opts .mid { background: var(--mid); border-color: var(--mid-line); color: var(--on-mid) }
.no-ads { display: block; margin: 4px auto -8px; padding: 0 14px; min-height: 44px; border: 0; background: none; color: var(--ink); font-size: .84rem; text-decoration: underline; text-underline-offset: 3px; cursor: pointer }
@media (max-width: 560px) { dialog.ask { margin-bottom: calc(12px + var(--sb)) } .opts { grid-template-columns: minmax(0, 1fr) } }
body.app #full { display: none }
@media (max-width: 760px) { body.can-install #full { display: none } }
.theme { padding: 0; width: 40px; justify-content: center; flex: none } .theme svg { width: 18px; height: 18px; display: block } .theme .moon, [data-theme="light"] .theme .sun { display: none } [data-theme="light"] .theme .moon { display: block }
.skip { position: absolute; left: 8px; top: -60px; z-index: 9; background: var(--run); color: var(--on-run); padding: 10px 16px; border-radius: 8px; font-weight: 700 } .skip:focus { top: calc(8px + var(--st)) }
.lost { display: grid; gap: 14px; justify-items: center; text-align: center; padding: clamp(10px, 6vh, 60px) 0 10px } .lost .glass { width: min(100%, 420px); padding: 10px 18px; border-width: 10px; border-color: #c9b98c; border-radius: 12px } .lost .x { --xm: clamp(1.8rem, 9vw, 2.6rem); font-size: clamp(1.8rem, 9vw, 2.6rem) } .lost h1 { font-size: clamp(1.6rem, 5vw, 2.3rem); font-weight: 800 } .lost p { max-width: 46ch; color: var(--muted) } .go-on { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center } .go-on .pill { color: var(--ink) } .go-on a { text-decoration: none; display: inline-flex; align-items: center }
.crumb { font-size: .9rem }
.turn { display: none }
.ad { margin-top: 110px; min-height: 118px; text-align: center; font-size: .75rem; color: var(--muted) } .ad ins { vertical-align: top } .rail { display: none }
@media (min-width: 1660px) { .rail { display: block; position: absolute; top: calc(76px + var(--pt) + var(--st)); width: 160px; margin: 0 } .rail.l { right: calc(50% + 650px) } .rail.r { left: calc(50% + 650px) } }
.below > .inlist { margin: 30px 0 }
.more { display: none } @media (max-width: 950px) { .below > .more { display: block; margin: 0; min-height: 268px } }
body.focus .rail { display: none !important }
@media (max-width: 350px) { .acts { gap: 4px !important } .acts .pill:not(.theme) { padding: 6px 8px !important } .head { gap: 6px } }
/* ao rolar até a calculadora (aulas), o visor para abaixo do recorte da câmera */
#calc { scroll-margin-top: calc(var(--st) + 8px) }
.calc { background: linear-gradient(#2b2724, #1b1917); color: #f1ece2; border-radius: 12px; display: flex; flex-direction: column; flex: 1; min-height: 0; overflow: hidden; border: 1px solid #0d0c0b; container-type: inline-size }
.top { background: linear-gradient(175deg, #d8c9a3, #b7a477 55%, #cbbb92); padding: 8px 10px; display: flex; flex-direction: column; gap: 6px; border-bottom: 2px solid #6f6242 }
.glass { background: #c8c9b8; color: #161d12; border: 2px solid #4a4332; border-radius: 6px; padding: 4px 10px; font-family: var(--lcd); min-width: 0; box-shadow: inset 0 2px 5px rgba(0,0,0,.28) }
.stack, .status { font-size: .7rem; color: #48473a; min-height: 1.4em; white-space: nowrap; overflow: hidden; display: flex; justify-content: space-between; gap: 10px; font-variant-numeric: tabular-nums }
.glass { --w: calc(100cqw - 54px) }
.stack { justify-content: flex-end; white-space: pre; --sm: .7rem; font-size: min(var(--sm), calc(var(--w) / var(--n, 30) / .7)); height: 1.5em; min-height: calc(var(--sm) * 1.4) }
/* o número usa o maior tamanho que couber: --xm é o teto, --n os caracteres, .7em a largura de cada um */
.x { --xm: 2.4rem; font-size: min(var(--xm), calc(var(--w) / var(--n, 9) / .7)); height: calc(var(--xm) * 1.16); line-height: calc(var(--xm) * 1.16); font-weight: 600; text-align: right; overflow: hidden; white-space: nowrap; font-variant-numeric: tabular-nums }
.pf { font-weight: 600; color: #161d12 }
.tools { display: flex; gap: 6px }
.tools button { flex: 1; min-width: 0; background: rgba(255,255,255,.28); color: #2a2415; border: 1px solid #7d6f49; border-radius: 6px; padding: 3px; font-size: .74rem; font-weight: 600; cursor: pointer; min-height: 30px; white-space: nowrap }
.pad { flex: 1; min-height: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: minmax(0, 1fr); gap: 4px; padding: 5px }
.half { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); grid-template-rows: repeat(4, minmax(0, 1fr)); gap: 4px; min-height: 0; min-width: 0 }
.k { background: none; border: 0; padding: 0; margin: 0; color: #f4efe6; cursor: pointer; display: flex; flex-direction: column; min-width: 0; min-height: 0; text-align: center; font-family: var(--ui); font-stretch: 75% }
.k .fl { height: 1.25em; line-height: 1.25em; font-size: clamp(7px, 1.35cqw, 13px); font-weight: 700; color: #e6a646; white-space: nowrap; overflow: visible; display: flex; justify-content: center; flex: none }
.k .cap { flex: 1; min-height: 0; display: flex; flex-direction: column; background: linear-gradient(#3a3531, #171513); border: 1px solid #060505; border-radius: 4px; box-shadow: inset 0 1px 0 rgba(255,255,255,.18), 0 2px 0 #050404; overflow: hidden }
.k .mn { flex: 1; min-height: 0; display: grid; place-items: center; font-weight: 700; font-size: clamp(11px, 2.1cqw, 22px); line-height: 1; white-space: nowrap }
.k .gl { flex: none; height: 1.45em; line-height: 1.45em; font-size: clamp(7px, 1.3cqw, 13px); font-weight: 700; color: #7cc4ee; background: rgba(0,0,0,.35); white-space: nowrap }
.k.num .mn { font-size: clamp(15px, 2.7cqw, 28px) }
.k.kf .cap { background: linear-gradient(#f0b04d, #c57f1d); color: #1a1208 }
.k.kg .cap { background: linear-gradient(#78c2ee, #2f86bd); color: #061420 }
.k.enter { grid-row: span 2 }
.k.enter .mn { writing-mode: vertical-rl; text-orientation: upright; letter-spacing: -.05em; font-size: clamp(11px, 1.9cqw, 19px) }
.k:active .cap, .k.hit .cap { transform: translateY(2px); box-shadow: none; filter: brightness(1.35) }
.k.on .cap { outline: 2px solid #fff; outline-offset: -2px }
.k:focus-visible { outline: 3px solid #fff; outline-offset: -1px; border-radius: 4px }
.calc.big .pad { grid-template-columns: minmax(0, 1fr); gap: 6px }
.calc.big .k .fl, .calc.big .k .gl { font-size: clamp(9px, 2.5cqw, 14px) }
.calc.big .k .mn { font-size: clamp(13px, 4cqw, 24px) }
.calc.big .k.num .mn { font-size: clamp(17px, 5cqw, 30px) }
body.focus { overflow: hidden }
body.focus .head, body.focus .below, body.focus .site-foot, body.focus .intro, body.focus .ad { display: none }
body.focus .page { grid-template-columns: minmax(0, 1fr); max-width: none; --pt: 10px; --pb: 10px }
body.focus .stage { width: 100%; max-width: 1400px; margin-inline: auto; min-height: 0; height: calc(100dvh - var(--pt) - var(--pb) - var(--st) - var(--sb)) }
.exit { display: none }
body.focus .exit { display: block }
@media (max-width: 760px) {
  :root { --pt: 8px; --pb: 40px }
  .stage { height: calc(100dvh - 8px - var(--pt) - var(--st) - var(--sb)); min-height: 440px }
  .stage .head small { display: none }
  .stage .head h1 { font-size: 1rem }
  .pill { padding: 6px 11px; font-size: .78rem } .acts { gap: 6px } .acts .pill { white-space: nowrap } .acts .theme { padding: 0 } .head h1, .brand { line-height: 1.1 }
  .calc { margin-inline: -12px }
  .pad { padding: 4px 3px; gap: 3px } .half { gap: 3px 2px }
}
/* em pé: sobra espaço para o aviso de deitar e, se ligado, o anúncio na primeira tela; deitado a calculadora ocupa tudo */
@media (max-width: 760px) and (orientation: portrait) {
  .turn { display: block; text-align: center; font-size: .86rem; font-weight: 600; line-height: 1.3; padding-top: 16px }
  body:not(.focus) .stage:not(:has(.calc.big)) { height: calc(100dvh - 254px - var(--pt) - var(--st) - var(--sb)); min-height: 380px }
  body.tall-ad:not(.focus) .stage:not(:has(.calc.big)) { height: calc(100dvh - 404px - var(--pt) - var(--st) - var(--sb)) } .tall-ad .turn + .ad { min-height: 268px }
  body.focus .turn { display: none }
  .stage + .ad, .turn + .ad { margin-top: 0 } .ad { min-height: 118px }
  .turn:has(+ .ad) { min-height: 110px; display: grid; place-items: center; padding: 0 }
  .main > .turn, .main > .ad { margin-top: -36px }
}
@media (orientation: landscape) and (max-height: 520px) {
  :root { --pt: 4px; --pb: 32px }
  .stage .head { display: none }
  .stage { height: calc(100dvh - 4px - var(--pt) - var(--st) - var(--sb)); min-height: 220px }
  .calc { margin-inline: 0 }
  .top { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); padding: 4px 8px }
  .glass { padding: 1px 10px } .x { --xm: 2.1rem } .glass { --w: calc((100cqw - 22px) * 2 / 3 - 26px) }
  .status { font-size: .62rem; min-height: 0 } .stack { --sm: .62rem; min-height: 0 }
  .calc.big .pad { grid-template-columns: repeat(2, minmax(0, 1fr)) }
  .calc.big .k .mn { font-size: clamp(11px, 2.1cqw, 22px) } .calc.big .k.num .mn { font-size: clamp(15px, 2.7cqw, 28px) }
  .calc.big .k .fl, .calc.big .k .gl { font-size: clamp(7px, 1.3cqw, 13px) }
  #t-big { display: none }
  body.focus .page { --pt: 4px; --pb: 4px }
}
@media (min-width: 761px) and (min-height: 521px) {
  .stage { max-width: 900px; width: 100%; margin-inline: auto }
  .calc { min-height: 524px } .x { --xm: 3.25rem } .status { font-size: .78rem } .stack { --sm: .78rem }
  body.focus .calc { min-height: 0 }
  body.focus .status { font-size: .95rem } body.focus .stack { --sm: .95rem }
  body.focus .x { --xm: 4.4rem }
}
@media (prefers-reduced-motion: reduce) { .k:active .cap, .k.hit .cap { transform: none } }
@media (max-width: 760px) and (orientation: portrait) and (min-height: 720px) { .x { --xm: 2.9rem } }
/* app instalado: mais folga no topo, já que não há barra do navegador separando */
@media (display-mode: standalone), (display-mode: fullscreen), (display-mode: minimal-ui) {
  :root { --pt: 24px }
  @media (max-width: 760px) { :root { --pt: 18px } }
  @media (orientation: landscape) and (max-height: 520px) { :root { --pt: 10px } }
}
