/* Atlas — prévia. Sistema visual.
   UI na fonte do sistema (SF no iPhone, Roboto no Android) para parecer app nativo.
   Instrument Serif só em títulos editoriais e capas. */

:root {
  --ui: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: "Instrument Serif", "Times New Roman", serif;

  --ink: #111214;
  --ink-2: #3C3F46;
  --ink-3: #6B707A;
  --line: #E7E6E2;
  --paper: #FFFFFF;
  --fog: #F3F2EE;
  --fog-2: #E9E8E3;

  --brand: #D13B22;
  --brand-soft: #FBEAE6;

  --ok: #1A7A30;
  --ok-bg: #E8F4EA;
  --bad: #C2321B;
  --bad-bg: #FBEAE6;
  --ios-green: #34C759;

  --night: #0B0B0D;
  --night-2: #17181B;
  --night-3: #24262B;
  --on-night: #F4F4F1;
  --on-night-2: #A6ABB5;

  --c-hist: #D13B22;
  --c-arte: #7A45D1;
  --c-ciencia: #2D5BE3;
  --c-geo: #0B7A96;
  --c-din: #F2A10F;
  --c-br: #1A7A30;

  --top: 47px;      /* área do relógio/notch dentro da moldura */
  --bottom: 22px;   /* barra de início do iPhone */
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: #E4E2DC;
  font-family: var(--ui);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button { font-family: inherit; color: inherit; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
img { display: block; max-width: 100%; }

/* ---------- Palco: mapa de telas + aparelho ---------- */
.stage { min-height: 100dvh; display: flex; justify-content: center; align-items: center; gap: 36px; padding: 24px; }
.map {
  width: 300px; height: 844px; overflow: hidden; background: #fff; border-radius: 22px;
  display: flex; flex-direction: column;
}
.map-h { padding: 20px 18px 12px; border-bottom: 1px solid var(--line); }
.map-h b { font-family: var(--serif); font-size: 30px; font-weight: 400; display: block; line-height: 1; }
.map-h span { font-size: 13px; color: var(--ink-3); }
.map-h input { margin-top: 12px; width: 100%; height: 38px; border-radius: 10px; border: 0; background: var(--fog); padding: 0 12px; font: 15px var(--ui); }
.map-l { overflow-y: auto; padding: 6px 8px 20px; flex: 1; }
.map-g { font-size: 12px; font-weight: 700; color: var(--ink-3); padding: 16px 10px 6px; text-transform: none; }
.map-i { display: flex; gap: 10px; align-items: baseline; width: 100%; text-align: left; border: 0; background: none; padding: 7px 10px; border-radius: 8px; cursor: pointer; font-size: 14px; color: var(--ink); }
.map-i:hover { background: var(--fog); }
.map-i.on { background: var(--ink); color: #fff; }
.map-i code { font: 600 11px ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--ink-3); min-width: 30px; }
.map-i.on code { color: #C9CCD2; }
.map-fab { display: none; }

.device {
  width: 390px; height: 844px; border-radius: 52px; overflow: hidden; position: relative; background: var(--paper);
  box-shadow: 0 0 0 11px #121214, 0 0 0 12px #2A2B2F, 0 40px 90px rgba(0,0,0,.28);
}
.device::before { /* ilha do iPhone, só na moldura do computador */
  content: ""; position: absolute; top: 11px; left: 50%; transform: translateX(-50%);
  width: 122px; height: 35px; border-radius: 20px; background: #000; z-index: 50; pointer-events: none;
}
.app { position: absolute; inset: 0; }

@media (max-width: 760px) {
  :root { --top: env(safe-area-inset-top, 20px); --bottom: env(safe-area-inset-bottom, 0px); }
  body { background: #000; }
  .stage { display: block; padding: 0; }
  .map { display: none; position: fixed; inset: 0; width: auto; height: auto; border-radius: 0; z-index: 100; }
  .map.open { display: flex; }
  .device { width: 100vw; height: 100dvh; border-radius: 0; box-shadow: none; }
  .device::before { display: none; }
  /* Aba fina na borda esquerda, no meio da altura: no canto de baixo ela cobria botões de 24 telas */
  .map-fab {
    display: block; position: fixed; left: 0; top: 50%; z-index: 90;
    width: 18px; height: 64px; padding: 0; border-radius: 0 10px 10px 0; border: 0; background: rgba(17,18,20,.72); color: #fff;
    font: 600 10px var(--ui); letter-spacing: .02em; writing-mode: vertical-rl; transform: translateY(-50%) rotate(180deg);
  }
}

/* ---------- Tela ---------- */
.scr { position: absolute; inset: 0; display: flex; flex-direction: column; background: var(--paper); overflow: hidden; padding-top: var(--top); }
.scr.full { padding-top: 0; }
.scr.dark { background: var(--night); color: var(--on-night); }
.scr.grouped { background: var(--fog); }
.body { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; }
.body.nopad-b { padding-bottom: 0; }
.pad { padding-left: 20px; padding-right: 20px; }
.foot { padding: 12px 20px calc(12px + var(--bottom)); display: flex; flex-direction: column; gap: 8px; }
.grow { flex: 1; }
.stack { display: flex; flex-direction: column; }
.row-f { display: flex; align-items: center; }
.gap4 { gap: 4px; } .gap8 { gap: 8px; } .gap12 { gap: 12px; } .gap16 { gap: 16px; } .gap20 { gap: 20px; }
.mt8 { margin-top: 8px; } .mt16 { margin-top: 16px; } .mt24 { margin-top: 24px; } .mt32 { margin-top: 32px; }
.center { text-align: center; }
.muted { color: var(--ink-3); }
.dark .muted { color: var(--on-night-2); }
.small { font-size: 13px; line-height: 1.4; }
.hidden { display: none !important; }

/* ---------- Tipografia ---------- */
.lt { font-size: 34px; font-weight: 700; letter-spacing: -0.025em; line-height: 1.1; margin: 0; }
.h1 { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; margin: 0; }
.h2 { font-size: 22px; font-weight: 700; letter-spacing: -0.015em; line-height: 1.2; margin: 0; }
.h3 { font-size: 17px; font-weight: 600; line-height: 1.3; margin: 0; }
.p { font-size: 17px; line-height: 1.5; margin: 0; }
.p2 { font-size: 15px; line-height: 1.45; margin: 0; }
.disp { font-family: var(--serif); font-weight: 400; letter-spacing: -0.01em; line-height: 0.98; margin: 0; }
.disp em { font-style: italic; }
.d64 { font-size: 64px; } .d52 { font-size: 52px; } .d44 { font-size: 44px; } .d36 { font-size: 36px; } .d30 { font-size: 30px; }
.reader { font-family: Georgia, "Times New Roman", serif; line-height: 1.62; color: var(--ink); }
.reader p { margin: 0 0 1em; }
.kicker { font-size: 13px; font-weight: 600; color: var(--ink-3); }
.dark .kicker { color: var(--on-night-2); }

/* ---------- Barra de navegação ---------- */
.nav { height: 48px; display: flex; align-items: center; padding: 0 6px; flex-shrink: 0; position: relative; z-index: 5; }
.nav .t { flex: 1; text-align: center; font-size: 17px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav.tr { position: absolute; left: 0; right: 0; top: var(--top); }
.ib {
  width: 44px; height: 44px; border: 0; background: none; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 22px; cursor: pointer; color: inherit; flex-shrink: 0; padding: 0; text-decoration: none;
}
.ib.glass { background: rgba(0,0,0,.42); color: #fff; backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.ib.soft { background: var(--fog); }

/* ---------- Barra de abas ---------- */
.tabs {
  display: flex; flex-shrink: 0; height: calc(54px + var(--bottom)); padding-bottom: var(--bottom);
  background: rgba(255,255,255,.94); border-top: 0.5px solid #D9D8D3;
  backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
}
.tabs a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 10px; font-weight: 500; color: #8A8F98; text-decoration: none; cursor: pointer; }
.tabs a.on { color: var(--ink); }
.tabs.dk { background: rgba(11,11,13,.94); border-top-color: #23252A; }
.tabs.dk a { color: #7D828C; }
.tabs.dk a.on { color: #fff; }

/* ---------- Botões ---------- */
.btn {
  appearance: none; border: 0; height: 52px; padding: 0 20px; border-radius: 14px;
  font: 600 17px/1 var(--ui); display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  cursor: pointer; text-decoration: none; white-space: nowrap; flex-shrink: 0;
}
.btn.full { width: 100%; }
.btn.sm { height: 40px; font-size: 15px; padding: 0 14px; border-radius: 12px; }
.btn.ink { background: var(--ink); color: #fff; }
.btn.brand { background: var(--brand); color: #fff; }
.btn.light { background: #fff; color: var(--ink); }
.btn.soft { background: var(--fog); color: var(--ink); }
.dark .btn.soft { background: var(--night-3); color: var(--on-night); }
.btn.ghost { background: transparent; box-shadow: inset 0 0 0 1.5px currentColor; }
.btn.text { background: none; height: 44px; font-weight: 500; color: var(--ink-3); }
.dark .btn.text { color: var(--on-night-2); }
.btn:disabled { opacity: .35; cursor: default; }
.btn.g { box-shadow: 0 4px 0 rgba(0,0,0,.22); transition: transform .06s, box-shadow .06s; }
.btn.g:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0,0,0,.22); }

/* ---------- Opções (quiz, escolhas) ---------- */
.opt {
  width: 100%; min-height: 56px; display: flex; align-items: center; gap: 12px; padding: 14px 16px;
  border-radius: 14px; background: var(--fog); border: 2px solid transparent; font: 500 17px/1.3 var(--ui);
  text-align: left; color: var(--ink); cursor: pointer;
}
.opt .ol { flex: 1; }
.opt.on { border-color: var(--ink); background: #fff; }
.opt.ok { border-color: var(--ok); background: var(--ok-bg); }
.opt.bad { border-color: var(--bad); background: var(--bad-bg); }
.opt.dim { opacity: .45; }
.opt:disabled { cursor: default; }
.dark .opt { background: var(--night-2); color: var(--on-night); }
.dark .opt.on { border-color: #fff; background: var(--night-3); }
.dark .opt.ok { border-color: #3DBA5B; background: #12301A; }
.dark .opt.bad { border-color: #F0614A; background: #3A1610; }
.optg { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.optg .opt { min-height: 72px; justify-content: center; text-align: center; }

/* ---------- Chips ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips.rail { flex-wrap: nowrap; }
.chip {
  height: 40px; padding: 0 16px; border-radius: 20px; background: var(--fog); border: 0;
  font: 500 15px var(--ui); color: var(--ink); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0;
}
.chip.on { background: var(--ink); color: #fff; }
.dark .chip { background: var(--night-3); color: var(--on-night); }
.dark .chip.on { background: #fff; color: var(--ink); }

/* ---------- Listas (estilo iOS) ---------- */
.list { margin: 0 16px; background: #fff; border-radius: 14px; overflow: hidden; }
.list.flat { margin: 0; border-radius: 0; background: transparent; }
.dark .list { background: var(--night-2); }
.lrow { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 10px 16px; position: relative; width: 100%; border: 0; background: none; text-align: left; font: 17px var(--ui); color: inherit; text-decoration: none; cursor: pointer; }
.lrow + .lrow::before { content: ""; position: absolute; left: 16px; right: 0; top: 0; height: 0.5px; background: #D9D8D3; }
.dark .lrow + .lrow::before { background: #2A2C31; }
.lrow .lt2 { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.lrow .lt2 b { font-weight: 500; font-size: 17px; }
.lrow .lt2 span { font-size: 14px; color: var(--ink-3); }
.dark .lrow .lt2 span { color: var(--on-night-2); }
.lrow .chev { color: #B4B6BB; }
.lhead { font-size: 13px; color: var(--ink-3); padding: 22px 32px 7px; }
.lfoot { font-size: 13px; color: var(--ink-3); padding: 7px 32px 0; line-height: 1.4; }
.ico-sq { width: 30px; height: 30px; border-radius: 7px; display: flex; align-items: center; justify-content: center; color: #fff; flex-shrink: 0; }

/* ---------- Seções e trilhos ---------- */
.sh { display: flex; justify-content: space-between; align-items: baseline; padding: 26px 20px 12px; }
.sh h3 { font-size: 22px; font-weight: 700; letter-spacing: -0.015em; margin: 0; }
.sh a, .sh button { font-size: 15px; color: var(--brand); text-decoration: none; background: none; border: 0; cursor: pointer; font-weight: 500; }
.dark .sh a, .dark .sh button { color: #FF7A5C; }
.rail { display: flex; gap: 12px; overflow-x: auto; padding: 0 20px; scroll-snap-type: x mandatory; scrollbar-width: none; }
.rail::-webkit-scrollbar { display: none; }
.rail > * { scroll-snap-align: start; flex-shrink: 0; }

/* ---------- Mídia ---------- */
.media { position: relative; overflow: hidden; background: #222; }
.media > img { width: 100%; height: 100%; object-fit: cover; }
.scrim::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0,0,0,0) 35%, rgba(0,0,0,.78) 100%); pointer-events: none; }
.scrim-top::before { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0,0,0,.45) 0%, rgba(0,0,0,0) 30%); pointer-events: none; z-index: 1; }
.over { position: absolute; left: 0; right: 0; bottom: 0; padding: 20px; color: #fff; z-index: 2; }
.credit { font-size: 11px; color: var(--ink-3); }
.dark .credit, .over .credit { color: rgba(255,255,255,.7); }
.r12 { border-radius: 12px; } .r16 { border-radius: 16px; } .r20 { border-radius: 20px; }

/* Capa de série */
.poster { width: 132px; aspect-ratio: 2 / 3; border-radius: 10px; overflow: hidden; position: relative; background: #1B1C20; cursor: pointer; border: 0; padding: 0; text-align: left; }
.poster > img { width: 100%; height: 100%; object-fit: cover; }
.poster .pt { position: absolute; left: 10px; right: 10px; bottom: 10px; z-index: 2; color: #fff; font-family: var(--serif); font-size: 26px; line-height: .95; }
.poster .pk { position: absolute; left: 10px; top: 10px; z-index: 2; color: #fff; font-size: 10px; font-weight: 700; letter-spacing: .06em; background: rgba(0,0,0,.5); padding: 3px 6px; border-radius: 4px; }
.poster.wide { width: 260px; aspect-ratio: 16 / 10; }

/* Capa de livro tipográfica (capas próprias, nunca a capa da editora) */
.cover {
  width: 104px; aspect-ratio: 2 / 3; border-radius: 3px 7px 7px 3px; padding: 12px 10px 10px; flex-shrink: 0;
  display: flex; flex-direction: column; justify-content: space-between; color: #fff; position: relative; overflow: hidden;
  box-shadow: inset 5px 0 0 rgba(0,0,0,.14), 0 8px 18px rgba(0,0,0,.16);
}
.cover .ct { font-family: var(--serif); font-size: 21px; line-height: .98; }
.cover .ca { font-size: 9.5px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; opacity: .9; }
.cover .cm { position: absolute; right: -18px; bottom: 26px; width: 70px; height: 70px; border-radius: 50%; opacity: .22; background: #fff; }
.cover.lg { width: 150px; }
.cover.lg .ct { font-size: 30px; }
.cover.lg .ca { font-size: 11px; }

/* ---------- Progresso, toggles, campos ---------- */
.bar { height: 4px; background: var(--fog-2); border-radius: 2px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--ink); border-radius: 2px; transition: width .3s; }
.dark .bar { background: #2B2D33; }
.dark .bar > i { background: #fff; }
.seg { display: flex; gap: 4px; }
.seg > i { flex: 1; height: 3px; border-radius: 2px; background: rgba(255,255,255,.3); }
.seg > i.on { background: #fff; }
.tg { width: 51px; height: 31px; border-radius: 16px; background: #E3E3E6; position: relative; border: 0; cursor: pointer; flex-shrink: 0; padding: 0; transition: background .2s; }
.tg::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 2px 5px rgba(0,0,0,.2); transition: left .2s; }
.tg.on { background: var(--ios-green); }
.tg.on::after { left: 22px; }
.field { width: 100%; height: 54px; border-radius: 14px; border: 1.5px solid var(--fog-2); background: #fff; padding: 0 16px; font: 17px var(--ui); color: var(--ink); }
.field:focus { border-color: var(--ink); outline: none; }
.check { display: flex; gap: 12px; align-items: flex-start; font-size: 15px; line-height: 1.4; cursor: pointer; }
.check input { width: 22px; height: 22px; margin: 0; accent-color: var(--ink); flex-shrink: 0; }
.seg-c { display: flex; background: var(--fog); border-radius: 10px; padding: 2px; }
.seg-c button { flex: 1; height: 34px; border: 0; background: none; border-radius: 8px; font: 500 14px var(--ui); cursor: pointer; color: var(--ink); }
.seg-c button.on { background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.12); font-weight: 600; }
.dark .seg-c { background: var(--night-3); }
.dark .seg-c button { color: var(--on-night-2); }
.dark .seg-c button.on { background: #45484F; color: #fff; }

/* ---------- Avisos ---------- */
.toast { position: absolute; left: 16px; right: 16px; bottom: calc(76px + var(--bottom)); background: var(--ink); color: #fff; border-radius: 14px; padding: 14px 16px; font-size: 15px; line-height: 1.4; z-index: 30; animation: up .25s ease-out; }
.sheet-bg { position: absolute; inset: 0; background: rgba(0,0,0,.42); display: flex; align-items: flex-end; z-index: 40; animation: fade .2s; }
.sheet { background: #fff; color: var(--ink); width: 100%; border-radius: 18px 18px 0 0; padding: 10px 20px calc(20px + var(--bottom)); animation: up .25s ease-out; }
.sheet .grab { width: 36px; height: 5px; border-radius: 3px; background: #D5D4CF; margin: 0 auto 14px; }
.pill { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: 8px; font-size: 13px; font-weight: 600; background: var(--fog); color: var(--ink); }
.pill.dk { background: rgba(0,0,0,.55); color: #fff; }
.pill.brand { background: var(--brand-soft); color: #9E2A16; }
.badge-ia { display: inline-flex; font-size: 10px; font-weight: 700; letter-spacing: .04em; padding: 2px 6px; border-radius: 4px; background: rgba(255,255,255,.88); color: var(--ink); }

/* ---------- Animações ---------- */
@keyframes up { from { transform: translateY(16px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes kbA { from { transform: scale(1.04) translate(0, 0); } to { transform: scale(1.2) translate(-4%, -3%); } }
@keyframes kbB { from { transform: scale(1.2) translate(3%, 2%); } to { transform: scale(1.04) translate(0, 0); } }
@keyframes kbC { from { transform: scale(1.1) translate(-3%, 0); } to { transform: scale(1.1) translate(3%, 0); } }
.kbA { animation: kbA 8s ease-out forwards; }
.kbB { animation: kbB 8s ease-out forwards; }
.kbC { animation: kbC 8s linear forwards; }
@keyframes pop { 0% { transform: scale(.6); opacity: 0; } 70% { transform: scale(1.06); } 100% { transform: scale(1); opacity: 1; } }
.pop { animation: pop .35s ease-out; }
@media (prefers-reduced-motion: reduce) { .kbA, .kbB, .kbC, .pop, .toast, .sheet { animation: none !important; } }

/* Categorias do jogo */
.bg-hist { background: var(--c-hist); color: #fff; }
.bg-arte { background: var(--c-arte); color: #fff; }
.bg-ciencia { background: var(--c-ciencia); color: #fff; }
.bg-geo { background: var(--c-geo); color: #fff; }
.bg-din { background: var(--c-din); color: var(--ink); }
.bg-br { background: var(--c-br); color: #fff; }
