:root { --bg:#fbf9f7; --card:#fff; --mem:#ece6e4; --ink:#1f1b1c; --soft:#5d5557; --ghost:#8f8789; --line:#e4dedc; --red:#b3243b; --ok:#1d6b43; --warn:#8a5a00; color-scheme:light; }
/* tema escuro = o mesmo azul-marinho da tela de jogo */
:root[data-theme=dark] { --bg:#13223a; --card:#1b2e4a; --mem:#24364f; --ink:#e9eff8; --soft:#a7b6ca; --ghost:#6f84a0; --line:#2a405f; --red:#ff6b5b; --ok:#43c487; --warn:#f2c14e; color-scheme:dark; }
:root[data-theme=dark] .primary { background:#3b82c4; border-color:#3b82c4; }
* { box-sizing:border-box; }
/* manipulation: sem zoom no toque duplo (ex.: tocar duas vezes numa letra); o zoom de pinça continua */
html { -webkit-text-size-adjust:100%; touch-action:manipulation; }
body { margin:0; background:var(--bg); color:var(--ink); font:16px/1.45 "Avenir Next","Segoe UI",system-ui,sans-serif; -webkit-tap-highlight-color:transparent; }
h1 { font-size:24px; margin:0; } h2 { font-size:17px; margin:0; } p { margin:0; }
a { color:var(--red); }
.wrap { max-width:820px; margin:0 auto; padding:16px 16px 32px; display:flex; flex-direction:column; gap:16px; }
.brand { font-weight:800; letter-spacing:-.01em; color:var(--ink); font-size:20px; display:inline-flex; align-items:center; gap:8px; }
.brand img { border-radius:7px; display:block; }
.brand b { color:var(--red); margin-left:-8px; }
.top { display:flex; align-items:center; justify-content:space-between; gap:12px; }
.lbl { font-size:13px; color:var(--soft); }
.stack { display:flex; flex-direction:column; gap:12px; }
.row { display:flex; flex-wrap:wrap; gap:8px; align-items:center; }
.card { background:var(--card); border:1px solid var(--line); border-radius:12px; padding:16px; display:flex; flex-direction:column; gap:12px; min-width:0; }

/* botões e campos: alvo de toque de 44px no celular */
button, .btn { touch-action:manipulation; font:inherit; color:var(--ink); background:var(--card); border:1px solid var(--line); border-radius:10px; padding:10px 14px; min-height:44px; cursor:pointer; text-decoration:none; display:inline-flex; align-items:center; justify-content:center; gap:6px; text-align:center; }
button:disabled { cursor:default; opacity:.6; }
.primary { background:#b3243b; border-color:#b3243b; color:#fff; font-weight:700; }
.round { width:40px; min-height:40px; height:40px; padding:0; border-radius:50%; flex:none; }
button[aria-pressed=false].round { color:var(--ghost); }
.small { min-height:36px; padding:6px 10px; font-size:14px; }
input, select, textarea { font:inherit; font-size:16px; color:var(--ink); background:var(--card); border:1px solid var(--line); border-radius:10px; padding:10px 12px; min-height:44px; width:100%; min-width:0; }
textarea { resize:vertical; font-family:inherit; }
fieldset { border:1px solid var(--line); border-radius:10px; padding:10px 12px; margin:0; display:flex; flex-direction:column; gap:8px; min-width:0; }
legend { font-size:14px; color:var(--soft); padding:0 4px; }
.install svg { vertical-align:-4px; }
label { display:flex; flex-direction:column; gap:4px; font-size:14px; color:var(--soft); }
form { display:flex; flex-direction:column; gap:12px; }
:focus-visible { outline:2px solid var(--red); outline-offset:2px; }
.msg { font-size:14px; padding:10px 12px; border-radius:10px; border:1px solid var(--line); }
.msg.bad { color:var(--red); border-color:var(--red); }
.msg.good { color:var(--ok); border-color:var(--ok); }
[hidden] { display:none !important; }

/* navegação: barra embaixo no celular, em cima no computador */
.tabs { position:fixed; left:0; right:0; bottom:0; z-index:5; display:flex; background:var(--card); border-top:1px solid var(--line); padding-bottom:env(safe-area-inset-bottom); }
.tabs a { flex:1; padding:12px 4px; text-align:center; font-size:13px; color:var(--soft); text-decoration:none; }
.tabs a.on { color:var(--red); font-weight:700; }
body.app { padding-bottom:calc(60px + env(safe-area-inset-bottom)); }
body.playing .tabs { display:none; }
body.playing { padding-bottom:0; }
@media (min-width:720px) {
  .tabs { position:sticky; top:0; bottom:auto; border-top:0; border-bottom:1px solid var(--line); justify-content:center; }
  .tabs a { flex:0 0 auto; padding:14px 22px; font-size:15px; }
  body.app { padding-bottom:0; }
}

/* painel */
.tiles { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; }
@media (min-width:640px) { .tiles { grid-template-columns:repeat(4,minmax(0,1fr)); } }
.tile { background:var(--card); border:1px solid var(--line); border-radius:12px; padding:12px; }
.tile b { display:block; font-size:26px; line-height:1.1; }
.tile span { font-size:13px; color:var(--soft); }
.week { display:flex; align-items:flex-end; gap:6px; height:84px; }
.week div { flex:1; display:flex; flex-direction:column; justify-content:flex-end; align-items:center; gap:4px; height:100%; font-size:12px; color:var(--soft); }
.week i { width:100%; max-width:36px; background:var(--red); border-radius:4px 4px 0 0; min-height:2px; }
.chips { display:flex; flex-wrap:wrap; gap:8px; }
.chip[aria-pressed=true] { background:var(--red); border-color:var(--red); color:#fff; }
.chip { border:1px solid var(--line); background:var(--card); color:var(--ink); border-radius:999px; padding:8px 12px; font-size:14px; text-decoration:none; }
.badge { font-size:12px; font-weight:700; padding:2px 8px; border-radius:999px; border:1px solid currentColor; white-space:nowrap; }
.badge.fraco { color:var(--red); } .badge.dominado { color:var(--ok); } .badge.andamento { color:var(--warn); } .badge.novo { color:var(--soft); }
.bar { height:6px; background:var(--mem); border-radius:3px; overflow:hidden; }
.bar i { display:block; height:100%; background:var(--red); }
.tema { display:flex; flex-wrap:wrap; gap:8px; align-items:center; justify-content:space-between; padding-top:12px; border-top:1px solid var(--line); }
.tema > div:first-child { min-width:0; flex:1 1 180px; display:flex; flex-direction:column; gap:4px; align-items:flex-start; }
ol.steps { margin:0; padding-left:20px; display:flex; flex-direction:column; gap:6px; }

/* jogo */
.playhead { display:flex; align-items:center; justify-content:space-between; gap:12px; font-size:13px; color:var(--soft); }
.clue { border:1px solid var(--line); border-radius:12px; padding:10px 14px 14px; text-align:center; background:
  linear-gradient(var(--line) 1px, transparent 1px) 0 0/100% 24px, linear-gradient(90deg, var(--line) 1px, transparent 1px) 0 0/24px 100%; background-color:var(--card); }
.clue .q { font-size:clamp(17px,4.4vw,22px); font-weight:600; color:var(--red); margin-top:4px; overflow-wrap:anywhere; }
.opts { display:grid; grid-template-columns:repeat(auto-fit,minmax(220px,1fr)); gap:8px; }
.opts button { min-height:52px; overflow-wrap:anywhere; }
.opts .ok { border-color:var(--ok); color:var(--ok); font-weight:700; opacity:1; }
.opts .bad { border-color:var(--red); color:var(--red); text-decoration:line-through; opacity:1; }
.fb { display:flex; flex-direction:column; gap:10px; }
@keyframes shake { 25%{transform:translateX(-5px)} 75%{transform:translateX(5px)} }
.result { text-align:center; align-items:center; }
.result b { font-size:56px; line-height:1; }

/* coração 3D: moldura escura como no vídeo, três vistas lado a lado */
.stage3d { position:relative; border-radius:12px; background:#13223a; overflow:hidden; touch-action:pan-y; }
.heart-canvas { display:block; width:100%; height:clamp(260px, 58vw, 460px); cursor:grab; }
.stage3d .views { position:absolute; left:0; right:0; bottom:6px; display:grid; grid-template-columns:.7fr 2fr .7fr; text-align:center; font-size:11px; letter-spacing:.12em; color:#a7b6ca; pointer-events:none; }
.loading3d { position:absolute; inset:0; display:grid; place-items:center; color:#a7b6ca; font-size:14px; padding:16px; text-align:center; }
.ask { text-align:center; font-size:12px; letter-spacing:.12em; color:var(--soft); }

/* durante o jogo e no Atlas: tela azul-marinho, como no modo jogo do vídeo */
body.playing { --bg:#13223a; --card:#1b2e4a; --mem:#24364f; --ink:#e9eff8; --soft:#a7b6ca; --ghost:#6f84a0; --line:#2a405f; --red:#ff6b5b; --ok:#43c487; --warn:#f2c14e; color-scheme:dark; }
body.playing .primary { background:#3b82c4; border-color:#3b82c4; }
body.playing .clue { background:none; border:0; padding:0; }
.hud { display:flex; gap:18px; text-align:center; min-width:0; }
@media (max-width:420px) { .hud { gap:10px; } .hud b { font-size:17px; } .hud span { font-size:9px; letter-spacing:.04em; } }
.hud b { display:block; font-size:20px; font-variant-numeric:tabular-nums; color:var(--ink); line-height:1.1; }
.hud span { font-size:10px; letter-spacing:.1em; color:var(--soft); }
.slots { display:flex; gap:8px 18px; flex-wrap:wrap; justify-content:center; font-family:ui-monospace,Menlo,monospace; font-size:clamp(14px,4.2vw,24px); font-weight:700; cursor:text; padding:6px 0; color:var(--ink); }
.slots .w { display:flex; gap:3px; } /* 4,2vw: "interventricular" (16 letras) cabe num celular de 360px */
.slots s { text-decoration:none; display:inline-block; width:1.05em; text-align:center; border-bottom:2px solid #5b7393; min-height:1.45em; line-height:1.45em; }
.slots s.extra { border-bottom-color:var(--red); }
.slots s.dica { color:var(--ghost); }
.slots.foco s.cur { border-bottom-color:#4fa3e0; animation:pisca 1s steps(2) infinite; }
@keyframes pisca { 50% { border-bottom-color:transparent; } }
.slots.shake { animation:shake .18s; }
.fbw { min-height:1.5em; text-align:center; font-size:15px; }
.fbw.ok { color:var(--ok); } .fbw.quase { color:var(--warn); } .fbw.bad { color:var(--red); }
.tkb { display:flex; flex-direction:column; gap:5px; align-items:center; width:100%; }
.tkb div { display:flex; gap:5px; justify-content:center; width:100%; }
.tkb button { flex:1; max-width:44px; min-width:0; min-height:40px; padding:0; border-radius:6px; font-size:14px; }
.tkb .wide { max-width:120px; flex:3; }
.gameacts { display:flex; gap:8px; justify-content:center; flex-wrap:wrap; }
.hidein { position:absolute; opacity:0; width:1px; height:1px; border:0; padding:0; min-height:0; }
.credit { font-size:12px; color:var(--soft); }

/* admin */
.user { display:flex; flex-direction:column; gap:8px; padding-top:12px; border-top:1px solid var(--line); }
.user .who { display:flex; flex-wrap:wrap; gap:6px 10px; align-items:center; overflow-wrap:anywhere; }
table { border-collapse:collapse; width:100%; font-size:13px; }
td, th { text-align:left; padding:6px 8px; border-bottom:1px solid var(--line); }
.scroll { overflow-x:auto; }

/* ranking e desafios */
.rank { display:flex; align-items:center; gap:10px; padding:10px 0; border-top:1px solid var(--line); }
.rank .pos { width:28px; flex:none; font-weight:800; color:var(--soft); text-align:center; }
.rank .who { flex:1; min-width:0; overflow-wrap:anywhere; }
.rank.eu .who, .rank.eu .pos { color:var(--red); font-weight:800; }
.rank .pts { font-weight:700; white-space:nowrap; }
.seg { display:flex; gap:8px; }

/* boas-vindas */
dialog { border:1px solid var(--line); border-radius:14px; background:var(--card); color:var(--ink); padding:20px; width:min(440px, calc(100vw - 32px)); max-height:calc(100dvh - 32px); overflow:auto; }
dialog::backdrop { background:rgba(0,0,0,.55); }
ul.steps { margin:0; padding-left:20px; display:flex; flex-direction:column; gap:6px; }
.pick { flex-direction:row; align-items:center; gap:10px; font-size:16px; color:var(--ink); min-height:44px; }
.pick input { width:22px; min-height:22px; flex:none; }
@media (max-width:420px) { .tabs a { font-size:12px; padding:12px 2px; } }

/* reportar erro, medalhas */
.report { display:flex; flex-direction:column; gap:8px; align-items:flex-end; }
.report form { width:100%; }
.linkbtn { background:none; border:0; min-height:32px; padding:4px 0; font-size:13px; color:var(--soft); text-decoration:underline; }
.medals { display:grid; grid-template-columns:repeat(auto-fit,minmax(150px,1fr)); gap:10px; }
.medal { border:1px solid var(--line); border-radius:10px; padding:10px; display:flex; flex-direction:column; gap:6px; align-items:flex-start; min-width:0; }
.medal.on { border-color:var(--ok); }
.medal .bar { width:100%; }

/* desenho das medalhas (ranking e conquistas) */
.medalsvg { display:block; flex:none; --rib1:#b3243b; --rib2:#7d1528; }
.medalsvg.gold { --m1:#c9971c; --m2:#f2cf63; --m3:#6b4a00; }
.medalsvg.silver { --m1:#8e98a3; --m2:#dfe5ea; --m3:#3f4850; }
.medalsvg.bronze { --m1:#96592a; --m2:#d99a66; --m3:#4f2a0d; }
.medalsvg.off { --m1:var(--line); --m2:var(--mem); --m3:var(--ghost); --rib1:var(--line); --rib2:var(--mem); }
.rank .pos { width:34px; }
.rank .medalsvg { width:32px; height:40px; }
.medal { align-items:center; text-align:center; }
.sr { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); }

/* painel do admin: menu lateral no computador, abas roláveis no celular; uma seção por vez */
.admtop { display:flex; flex-wrap:wrap; gap:8px 12px; align-items:center; justify-content:space-between; padding:12px 16px; border-bottom:1px solid var(--line); background:var(--card); }
.admwrap { max-width:1240px; margin:0 auto; }
.admnav { display:flex; gap:4px; overflow-x:auto; padding:8px 16px; border-bottom:1px solid var(--line); position:sticky; top:0; background:var(--bg); z-index:4; }
.admnav a { flex:none; padding:10px 12px; border-radius:8px; color:var(--soft); text-decoration:none; font-size:14px; white-space:nowrap; display:flex; gap:6px; align-items:center; }
.admnav a.on { background:var(--ink); color:var(--bg); font-weight:700; }
.admmain { padding:16px; display:flex; flex-direction:column; gap:16px; min-width:0; }
@media (min-width:900px) {
  .admwrap { display:grid; grid-template-columns:210px minmax(0,1fr); align-items:start; }
  .admnav { flex-direction:column; border-bottom:0; border-right:1px solid var(--line); padding:16px 12px; top:0; min-height:calc(100vh - 70px); overflow:visible; }
  .admmain { padding:20px 24px 40px; }
  .adm .tiles { grid-template-columns:repeat(auto-fit,minmax(150px,1fr)); }
}
.count { background:var(--red); color:#fff; border-radius:999px; font-size:12px; font-weight:700; padding:1px 7px; }
.cols { display:grid; grid-template-columns:repeat(auto-fit,minmax(280px,1fr)); gap:16px; }
.toolbar { display:grid; grid-template-columns:repeat(auto-fit,minmax(170px,1fr)); gap:10px; align-items:end; }
/* linha compacta que abre para mostrar as ações */
details.lrow { border-top:1px solid var(--line); }
details.lrow:first-child { border-top:0; }
details.lrow summary { display:grid; grid-template-columns:minmax(0,1.2fr) minmax(0,1.6fr) auto auto; gap:6px 12px; align-items:center; padding:10px 4px; cursor:pointer; list-style:none; }
details.lrow summary::-webkit-details-marker { display:none; }
details.lrow summary > * { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
details.lrow[open] summary { font-weight:700; }
details.lrow .body { display:flex; flex-direction:column; gap:10px; padding:4px 4px 14px; }
@media (max-width:640px) { details.lrow summary { grid-template-columns:minmax(0,1fr) auto; } details.lrow summary .hide-s { display:none; } }
.crow { display:grid; grid-template-columns:auto minmax(0,1fr) auto; gap:10px; align-items:center; padding:10px 4px; border-top:1px solid var(--line); }
.crow:first-child { border-top:0; }
.crow .txt { min-width:0; display:flex; flex-direction:column; gap:2px; }
.crow .txt > * { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.pager { display:flex; flex-wrap:wrap; gap:8px; align-items:center; justify-content:space-between; padding-top:12px; border-top:1px solid var(--line); font-size:13px; color:var(--soft); }
.pager:empty { display:none; }

/* ficha do aluno e números dos avisos, no painel do admin */
.facts { margin:0; display:grid; grid-template-columns:repeat(auto-fit,minmax(200px,1fr)); gap:8px 16px; }
.facts div { min-width:0; }
.facts dt { font-size:12px; color:var(--soft); }
.facts dd { margin:0; font-size:14px; overflow-wrap:anywhere; }
.stats { display:flex; flex-wrap:wrap; gap:6px 16px; margin-top:4px; white-space:normal; }
.stats span { font-size:12px; color:var(--soft); display:flex; flex-direction:column; }
.stats b { font-size:16px; color:var(--ink); }
.crow .txt > .stats { overflow:visible; white-space:normal; }

.cite { font-size:12px; }
.linkbox { display:flex; gap:8px; align-items:center; }
.linkbox input { font-size:13px; font-family:ui-monospace,monospace; }

/* sininho do Início e lista de notificações */
.top { flex-wrap:nowrap; }
.top > div:first-child { flex:1; min-width:0; }
.bell { position:relative; flex:none; width:40px; height:40px; display:grid; place-items:center; border:1px solid var(--line); border-radius:50%; background:var(--card); color:var(--ink); }
.bell .count { position:absolute; top:-6px; right:-8px; }
.note { display:flex; flex-direction:column; gap:2px; padding:10px 0; border-top:1px solid var(--line); color:var(--ink); text-decoration:none; }
.note:first-child { border-top:0; padding-top:0; }
@media (max-width:420px) { .top .brand { font-size:0; gap:0; } }  /* celular estreito: fica só o ícone da marca ao lado do sino */

/* dica que aponta o botão Compartilhar do navegador no iPhone */
.hint { position:fixed; left:12px; right:12px; z-index:50; min-height:0; display:flex; flex-direction:column; align-items:flex-start; gap:4px; text-align:left; padding:12px 14px; border:0; border-radius:14px; background:var(--ink); color:var(--bg); box-shadow:0 8px 30px rgba(0,0,0,.35); animation:hintbob 1.2s ease-in-out infinite; }
.hint span { font-size:13px; opacity:.85; }
.hint::after { content:''; position:absolute; border:10px solid transparent; }
.hint.top { top:10px; } .hint.top::after { top:-18px; right:18px; border-bottom-color:var(--ink); }
.hint.bottom { bottom:calc(72px + env(safe-area-inset-bottom)); } .hint.bottom::after { bottom:-18px; left:50%; margin-left:-10px; border-top-color:var(--ink); }
@keyframes hintbob { 50% { transform:translateY(-4px); } }
