@font-face { font-family: 'Pixelify Sans'; src: url('./vendor/fonts/PixelifySans-latin.woff2') format('woff2'); font-display: swap; font-weight: 400 700; }
@font-face { font-family: 'DotGothic16'; src: url('./vendor/fonts/DotGothic16-latin.woff2') format('woff2'); font-display: swap; }

:root {
  --fundo: #2a2242; --painel1: rgba(32, 38, 84, 0.93); --painel2: rgba(14, 16, 40, 0.93);
  --borda: #e8c476; --texto: #fff4de; --texto2: #bdb6de; --destaque: #ffd84a; --verde: #8fffa8;
  --titulo: 'DotGothic16', system-ui, sans-serif; --logo: 'Pixelify Sans', 'DotGothic16', system-ui, sans-serif; --corpo: 'DotGothic16', 'Pixelify Sans', system-ui, sans-serif;
  --seguro-t: env(safe-area-inset-top, 0px); --seguro-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--fundo); color: var(--texto); font-family: var(--corpo); font-size: 16px; -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; }
#jogo { position: fixed; inset: 0; width: 100vw; height: 100vh; height: 100dvh; display: block; touch-action: none; }
.vinheta { position: fixed; inset: 0; pointer-events: none; background: radial-gradient(ellipse at 50% 45%, transparent 55%, rgba(6, 6, 20, 0.55) 100%); }
[hidden] { display: none !important; }
canvas.pixel, #retrato, .retrato-grande, .retrato-guia { image-rendering: pixelated; image-rendering: crisp-edges; }

/* ---------- painéis e botões ---------- */
.painel, .caixa, #painel-sabrina, #placar {
  background: linear-gradient(180deg, var(--painel1), var(--painel2));
  border: 2px solid var(--borda); border-radius: 4px;
  box-shadow: 0 0 0 2px #0b0c1e, inset 0 0 0 1px rgba(255, 255, 255, 0.06), 0 10px 22px rgba(0, 0, 0, 0.45);
}
.bt {
  font-family: var(--titulo); font-size: 16px; font-weight: 400; letter-spacing: 0.02em; color: #2a1a08; cursor: pointer;
  background: linear-gradient(#ffe39a, #f0b64e); border: 2px solid #7a4a12; border-radius: 4px;
  padding: 10px 18px; min-height: 44px; min-width: 44px; box-shadow: 0 4px 0 #7a4a12; transition: transform 0.06s;
}
.bt:active { transform: translateY(3px); box-shadow: 0 1px 0 #7a4a12; }
.bt.sec { background: linear-gradient(#3b4380, #262c5c); color: var(--texto); border-color: #9aa3e0; box-shadow: 0 4px 0 #11143a; }
.bt:focus-visible, .bt-icone:focus-visible, .bt-link:focus-visible, select:focus-visible, input:focus-visible { outline: 3px solid #8fffa8; outline-offset: 2px; }
.bt-link { background: none; border: 0; color: var(--texto2); font-family: var(--corpo); font-size: 15px; text-decoration: underline; cursor: pointer; min-height: 44px; padding: 8px 12px; }
.bt-icone { width: 44px; height: 44px; border-radius: 50%; border: 2px solid var(--borda); background: var(--painel2); color: var(--texto); cursor: pointer; display: grid; place-items: center; padding: 0; }
.bt-icone svg { width: 20px; height: 20px; fill: currentColor; stroke: currentColor; }
.bt-icone.mudo .onda { display: none; }
.botoes { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.botoes.coluna { flex-direction: column; }

/* ---------- telas ---------- */
.tela { position: fixed; inset: 0; display: grid; place-items: center; padding: 16px; background: rgba(8, 9, 24, 0.55); z-index: 20; overflow-y: auto; }
#tela-abertura, #tela-resultado { background: linear-gradient(180deg, rgba(8, 9, 24, 0.05), rgba(8, 9, 24, 0.45)); }
@media (min-aspect-ratio: 1/1) and (min-width: 701px) { #tela-abertura { place-items: center start; padding-left: 28px; } #tela-abertura .caixa { max-width: min(600px, 48vw); } #tela-abertura .abertura { grid-template-columns: 112px 1fr; gap: 14px; align-items: start; } #tela-abertura .retrato-grande { width: 112px; height: 168px; margin-top: 40px; } #tela-abertura h1 { font-size: clamp(34px, 4.2vw, 52px); } }
.caixa { max-width: min(760px, calc(100vw - 32px)); padding: 18px 22px; }
.caixa h1 { font-family: var(--logo); font-size: clamp(36px, 6vw, 60px); margin: 4px 0 8px; color: var(--destaque); text-shadow: 3px 3px 0 #7a3a12, 6px 6px 0 rgba(0, 0, 0, 0.35); line-height: 1; }
.caixa h2 { font-family: var(--titulo); font-size: 32px; font-weight: 400; margin: 0 0 10px; color: var(--destaque); }
.selo { font-size: 13px; color: var(--texto2); margin: 0; letter-spacing: 0.04em; }
.sub { font-size: 17px; line-height: 1.5; margin: 6px 0 4px; }
.aviso-ficcao, .nota { font-size: 13px; color: var(--texto2); line-height: 1.45; }
.recorde-abertura { font-family: var(--titulo); color: var(--verde); margin: 12px 0 0; min-height: 1.2em; }
.abertura, .resultado { display: grid; grid-template-columns: auto 1fr; gap: 20px; align-items: center; }
.retrato-grande { width: 160px; height: 240px; }
.pisca { animation: pisca 1s steps(2) infinite; font-family: var(--titulo); font-size: 20px; margin: 0; }
@keyframes pisca { 50% { opacity: 0.35; } }

/* guia */
.guia { display: grid; grid-template-columns: auto 1fr; gap: 18px; align-items: start; width: min(720px, calc(100vw - 32px)); }
.retrato-guia { width: 128px; height: 192px; margin-top: 8px; }
.cartoes .passo { margin: 0; color: var(--texto2); font-size: 13px; }
.cartoes .texto { font-size: 17px; line-height: 1.5; min-height: 3em; margin: 8px 0 0; }
.figura { background: #0e1128; border: 2px solid #3b4380; border-radius: 4px; min-height: 150px; display: grid; place-items: center; padding: 10px; gap: 8px; }
.figura .fila { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; align-items: center; }
.figura-clipe { display: flex; gap: 12px; align-items: center; width: 100%; }
.clipe-caixa { position: relative; flex: none; }
.figura-clipe .clipe { display: block; width: auto; height: min(34vh, 260px); aspect-ratio: 336 / 480; border: 2px solid #5a63a8; border-radius: 4px; background: #0e1128; }
.bt-tocar { position: absolute; inset: 0; margin: auto; width: 56px; height: 56px; border-radius: 50%; border: 2px solid var(--borda); background: rgba(20, 22, 50, 0.85); color: var(--texto); font-size: 22px; cursor: pointer; }
.figura-extra { flex: 1; display: grid; gap: 8px; place-items: center; }
@media (max-aspect-ratio: 1/1), (max-width: 700px) { .figura-clipe { flex-direction: row; } .figura-clipe .clipe { height: min(26vh, 200px); } .figura-extra .fila { gap: 6px; } .figura-extra .tecla { min-width: 30px; height: 30px; font-size: 13px; } .figura-extra .gesto .tela-mini { width: 44px; height: 70px; } }
.tecla { display: inline-grid; place-items: center; min-width: 38px; height: 38px; padding: 0 8px; border: 2px solid #c9c2e6; border-bottom-width: 5px; border-radius: 5px; font-family: var(--titulo); font-size: 16px; background: #262c5c; }
.gesto { display: inline-flex; flex-direction: column; align-items: center; font-size: 13px; color: var(--texto2); gap: 4px; }
.gesto .tela-mini { width: 70px; height: 110px; border: 2px solid #9aa3e0; border-radius: 8px; display: grid; grid-template-columns: 1fr 1fr; overflow: hidden; }
.gesto .tela-mini i { display: block; }
.gesto .tela-mini i.on { background: rgba(143, 255, 168, 0.4); }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px; border-radius: 4px; background: #262c5c; border: 1px solid #5a63a8; font-size: 14px; }
.chip canvas { width: 24px; height: 24px; image-rendering: pixelated; }

/* opções, recordes */
.opcoes { display: grid; gap: 14px; min-width: min(360px, 80vw); }
.opcoes label { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: 16px; }
.opcoes input[type=range] { width: 180px; accent-color: var(--destaque); }
.opcoes input[type=checkbox] { width: 24px; height: 24px; accent-color: var(--destaque); }
.opcoes select { font-family: var(--corpo); font-size: 15px; padding: 8px; background: #262c5c; color: var(--texto); border: 2px solid #9aa3e0; border-radius: 4px; min-height: 44px; }
#lista-recordes { font-family: var(--titulo); font-size: 20px; padding-left: 28px; min-width: min(360px, 80vw); }
#lista-recordes li { margin: 6px 0; }
#lista-recordes .vazio { font-family: var(--corpo); font-size: 16px; color: var(--texto2); list-style: none; margin-left: -28px; }
.sobre p { line-height: 1.5; max-width: 60ch; }

/* resultado */
.resultado .grande { font-family: var(--logo); font-size: 40px; margin: 0; color: var(--destaque); }
.destaque { font-family: var(--titulo); color: var(--verde); font-size: 22px; margin: 4px 0; animation: pisca 0.8s steps(2) 4; }
.res-lista { padding-left: 20px; line-height: 1.7; }
.fala { font-style: italic; color: var(--texto2); }
#res-bairros-icones span { display: inline-block; width: 12px; height: 12px; margin-right: 3px; border: 1px solid #0006; vertical-align: -1px; }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 10; }
#hud button, #hud #bt-lancar { pointer-events: auto; }
#placar { position: fixed; right: 16px; top: 72px; width: clamp(200px, 19vw, 270px); padding: 10px 14px; font-family: var(--titulo); }
#placar .rotulo { color: var(--texto2); font-family: var(--corpo); font-size: 13px; margin-right: 8px; }
.linha-pontos b { font-family: var(--logo); font-size: 32px; color: var(--destaque); display: block; line-height: 1.1; }
.linha-pontos b.pop { animation: pop 0.25s; }
@keyframes pop { 40% { transform: scale(1.15); } }
.linha-bolas, .linha-recorde, .linha-mult { font-size: 18px; margin-top: 4px; }
#hud-mult { font-family: var(--logo); color: var(--texto2); }
#hud-mult.ativo { color: #ff9f5a; text-shadow: 0 0 8px rgba(255, 159, 90, 0.6); }
#hud-bolas i { display: inline-block; width: 14px; height: 14px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fff, #c4cbdb 40%, #6d7489); margin-right: 4px; vertical-align: -2px; border: 1px solid #0008; }
#hud-bolas i.usada { opacity: 0.2; }
#hud-bairros { display: flex; gap: 5px; margin-top: 8px; flex-wrap: wrap; }
#hud-bairros span { width: 18px; height: 18px; border: 2px solid #0008; border-radius: 3px; background: #2a2f55; position: relative; }
#hud-bairros span.aceso { box-shadow: 0 0 8px currentColor; }
#hud-salva { margin-top: 8px; color: #9fdcff; font-size: 15px; font-family: var(--corpo); display: flex; gap: 6px; align-items: center; }
#hud-salva .escudo { width: 14px; height: 16px; background: #9fdcff; clip-path: polygon(50% 0, 100% 20%, 90% 70%, 50% 100%, 10% 70%, 0 20%); }
#hud-multibola { margin-top: 8px; color: #ff9f5a; font-size: 14px; font-family: var(--corpo); animation: pisca 0.6s steps(2) infinite; }

#painel-sabrina { position: fixed; left: 16px; top: 50%; transform: translateY(-50%); width: clamp(250px, 25vw, 340px); padding: 12px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
#retrato { width: 128px; height: 192px; }
#painel-sabrina .coluna { width: 100%; }
#painel-sabrina .nome { font-family: var(--titulo); font-size: 17px; margin: 0 0 6px; color: var(--destaque); text-align: center; }
#painel-sabrina .ficcao { font-family: var(--corpo); font-size: 11px; color: var(--texto2); border: 1px solid #5a63a8; border-radius: 3px; padding: 0 4px; vertical-align: 2px; }
#balao { position: relative; background: #fff4de; color: #2a2238; border-radius: 6px; padding: 8px 10px; font-size: 15px; line-height: 1.4; min-height: 3.2em; border: 2px solid #2a2238; }
#balao::before { content: ''; position: absolute; left: 50%; top: -10px; transform: translateX(-50%); border: 8px solid transparent; border-bottom-color: #2a2238; border-top: 0; }
#missao { margin-top: 8px; }
#missao-nome { font-family: var(--titulo); font-size: 16px; margin: 0 0 6px; color: var(--texto); }
#missao-pontos { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
#missao-pontos li { display: flex; align-items: center; gap: 5px; padding: 3px 7px 3px 4px; border-radius: 4px; background: #262c5c; border: 2px solid var(--cor, #5a63a8); font-size: 14px; }
#missao-pontos li canvas { width: 24px; height: 24px; image-rendering: pixelated; }
#missao-pontos li.feito { background: #1d4a33; border-color: #8fffa8; }
#missao-pontos li.feito .n::after { content: ' ✓'; color: #8fffa8; }
#missao-pontos li.pulsa { animation: pop 0.35s; }

#topo-botoes { position: fixed; right: 16px; top: 16px; display: flex; gap: 8px; }
#aviso { position: fixed; left: 50%; top: 22%; transform: translate(-50%, -50%); font-family: var(--titulo); font-size: clamp(26px, 4.5vw, 46px); color: var(--destaque); text-shadow: 3px 3px 0 #5a1a12, 0 0 14px rgba(255, 180, 60, 0.6); text-align: center; white-space: nowrap; pointer-events: none; opacity: 0; }
#aviso.mostra { animation: aviso 1.8s ease-out forwards; }
@keyframes aviso { 0% { opacity: 0; transform: translate(-50%, -30%) scale(0.7); } 12% { opacity: 1; transform: translate(-50%, -50%) scale(1.08); } 20% { transform: translate(-50%, -50%) scale(1); } 80% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -60%); } }
#aviso small { display: block; font-size: 0.45em; color: var(--texto); }

#dica { position: fixed; left: 0; top: 0; transform: translate(-50%, calc(-100% - 18px)); background: #fff4de; color: #2a2238; border: 2px solid #2a2238; border-radius: 6px; padding: 8px 12px; font-size: 16px; max-width: min(320px, 80vw); text-align: center; line-height: 1.35; box-shadow: 0 6px 14px rgba(0, 0, 0, 0.4); animation: bob 1.2s ease-in-out infinite; }
#dica .seta { position: absolute; left: 50%; bottom: -12px; transform: translateX(-50%); border: 10px solid transparent; border-top-color: #2a2238; border-bottom: 0; }
#dica kbd { font-family: var(--titulo); border: 1px solid #2a2238; border-bottom-width: 3px; border-radius: 3px; padding: 0 5px; background: #fff; }
@keyframes bob { 50% { margin-top: -5px; } }

#bt-lancar { position: fixed; right: 16px; bottom: calc(16px + var(--seguro-b)); width: 96px; height: 96px; border-radius: 50%; border: 3px solid var(--borda); background: radial-gradient(circle at 40% 35%, #ffb15a, #c4521f); color: #fff; font-family: var(--titulo); font-size: 16px; display: grid; place-content: center; text-shadow: 1px 1px 0 #5a1a08; cursor: pointer; overflow: hidden; touch-action: none; }
#bt-lancar small { font-family: var(--corpo); font-size: 10px; font-weight: 400; }
#bt-lancar i { position: absolute; left: 0; bottom: 0; width: 100%; height: 0; background: rgba(255, 255, 255, 0.35); }
#zonas-toque { display: none; }
body.toque.tutorial-palhetas #zonas-toque { display: flex; position: fixed; left: 0; right: 0; bottom: calc(10px + var(--seguro-b)); justify-content: space-between; padding: 0 12px; pointer-events: none; }
#zonas-toque .zona span { font-family: var(--titulo); font-size: 15px; background: rgba(20, 22, 50, 0.8); border: 2px dashed #8fffa8; border-radius: 6px; padding: 6px 10px; animation: pisca 1s steps(2) infinite; }

/* ---------- retrato (celular em pé) ---------- */
@media (max-aspect-ratio: 1/1), (max-width: 700px) {
  #placar { left: 8px; right: 8px; top: calc(8px + var(--seguro-t)); width: auto; padding: 6px 10px; display: grid; grid-template-columns: 1fr auto auto auto; gap: 2px 12px; align-items: center; padding-right: 108px; }
  .linha-pontos b { font-size: 24px; display: inline; }
  .linha-pontos .rotulo { display: none; }
  .linha-bolas, .linha-recorde { font-size: 14px; margin: 0; }
  .linha-recorde { display: none; }
  .linha-mult { font-size: 14px; margin: 0; }
  .linha-mult .rotulo { display: none; }
  #hud-bairros { grid-column: 1 / -1; margin-top: 2px; gap: 4px; }
  #hud-bairros span { width: 14px; height: 14px; }
  #hud-salva, #hud-multibola { grid-column: 1 / -1; margin-top: 2px; font-size: 13px; }
  #topo-botoes { top: calc(12px + var(--seguro-t)); right: 14px; }
  .bt-icone { width: 44px; height: 44px; }
  #painel-sabrina { left: 8px; right: 8px; top: calc(86px + var(--seguro-t)); transform: none; width: auto; flex-direction: row; align-items: flex-start; padding: 6px 8px; gap: 8px; }
  #retrato { width: 48px; height: 72px; flex: none; }
  #painel-sabrina .nome { display: none; }
  #balao { font-size: 13px; padding: 5px 8px; min-height: 2.2em; }
  #balao::before { left: -10px; top: 12px; transform: none; border: 7px solid transparent; border-right-color: #2a2238; border-left: 0; }
  #missao { margin-top: 5px; }
  #missao-nome { display: none; }
  #missao-pontos li { font-size: 12px; padding: 2px 5px 2px 2px; gap: 3px; }
  #missao-pontos li canvas { width: 20px; height: 20px; }
  #bt-lancar { width: 84px; height: 84px; right: 10px; }
  .abertura, .resultado, .guia { grid-template-columns: 1fr; justify-items: center; text-align: left; }
  .retrato-grande { width: 96px; height: 144px; }
  .retrato-guia { width: 64px; height: 96px; margin: 0; }
  .caixa { padding: 14px 14px; }
  .caixa h1 { font-size: 34px; }
  .sub { font-size: 15px; }
  .bt { font-size: 16px; padding: 9px 14px; }
  .figura { min-height: 120px; }
  .cartoes .texto { font-size: 15px; }
  #aviso { top: 30%; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
