/* Fonte do jogo (Press Start 2P, licença OFL) — incluída no pacote para funcionar sem internet */
@font-face { font-family: "Press Start 2P"; font-style: normal; font-weight: 400; font-display: swap;
  src: url(../fonts/press-start-2p-latin-400-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Press Start 2P"; font-style: normal; font-weight: 400; font-display: swap;
  src: url(../fonts/press-start-2p-latin-ext-400-normal.woff2) format("woff2"); unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
.app .back, .app .help { display: none !important; }
html, body { margin: 0; height: 100%; background: #0b0814; color: #e8dcff; font-family: monospace; }
#wrap { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 100%; padding: 12px; box-sizing: border-box; gap: 10px; }
canvas {
  width: min(100%, calc((100vh - 100px) * 16 / 9)); aspect-ratio: 16 / 9;
  image-rendering: pixelated; image-rendering: crisp-edges;
  background: #000; border: 2px solid #3b2a5c; border-radius: 6px; box-shadow: 0 0 30px #5b3b9a55; outline: none;
}
/* Qualidade Média/Alta: o canvas já tem a resolução da tela — ajuste fino suave, sem serrilhar o texto */
canvas.hd { image-rendering: auto; }
.help { font-size: 12px; opacity: .8; text-align: center; line-height: 1.9; max-width: 980px; }
kbd { background: #2a1f44; border: 1px solid #4d3a7a; border-radius: 3px; padding: 0 5px; color: #fff; }
.back { width: min(100%, 960px); color: #c48bff; text-decoration: none; font-size: 13px; }
.back:hover { color: #ffe066; }
/* Modo embutido no site (iframe) */
.embed body { background: #06050f; }
.embed #wrap { padding: 0; gap: 0; }
.embed .back, .embed .help { display: none; }
.embed canvas { width: min(100%, calc(100vh * 16 / 9)); border: 0; border-radius: 0; box-shadow: none; }

/* ============================================================
   VERSÃO MOBILE (ativada automaticamente em telas de toque)
   ============================================================ */
html.touch, html.touch body { height: 100%; overflow: hidden; overscroll-behavior: none; touch-action: none;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
html.touch #wrap { padding: 0; gap: 0; min-height: 100%; height: 100%; }
html.touch .back, html.touch .help { display: none; }
html.touch canvas { width: min(100vw, calc(100vh * 16 / 9)); width: min(100vw, calc(100dvh * 16 / 9));
  border: 0; border-radius: 0; box-shadow: none; }

#touch { position: fixed; inset: 0; z-index: 10; pointer-events: none; font-family: "Press Start 2P", monospace; }
#touch.hide { display: none; }
#touch button { pointer-events: auto; touch-action: none; font: inherit; color: #fff; cursor: pointer;
  -webkit-appearance: none; appearance: none; padding: 0; margin: 0; }

/* barra de cima (lado direito, onde o HUD do PC ficaria) */
.tc-top { position: absolute; top: max(6px, env(safe-area-inset-top), var(--sa-t, 0px)); right: max(8px, env(safe-area-inset-right), var(--sa-r, 0px));
  display: flex; gap: 5px; align-items: center; }
.tb { height: 38px; min-width: 40px; padding: 0 7px !important; border-radius: 10px; border: 2px solid rgba(155,120,255,.55);
  background: rgba(14,9,32,.72); display: flex; align-items: center; justify-content: center; gap: 4px; font-size: 9px !important; }
.tb b { font-size: 14px; font-weight: normal; line-height: 1; }
.tb b.pot { display: inline-block; width: 13px; height: 22px; background: url(../img/itens/pocao-rosa.png) center / contain no-repeat; filter: drop-shadow(0 0 3px rgba(255, 110, 160, 0.8)); }
.tb span { font-size: 9px; color: #ffe066; }
.tb.sm { min-width: 30px; font-size: 10px !important; }
.tb.spell { min-width: 112px; max-width: 150px; justify-content: flex-start; }
.tb.spell i { flex: none; width: 14px; height: 14px; border-radius: 50%; background: #c48bff; box-shadow: 0 0 6px currentColor; }
.tb.spell span { color: #fff; font-size: 7px; line-height: 1.3; text-align: left; white-space: normal; }
.tb.on, .ab.on { background: rgba(255,224,102,.35); border-color: #ffe066; transform: scale(.94); }
.tb.tmp { border-color: rgba(255,211,74,.8); } .tb.tmp b { color: #ffd34a; }
@media (max-width: 700px) { .tc-top { gap: 3px; } .tb { min-width: 34px; padding: 0 5px !important; } .tb.spell { min-width: 92px; max-width: 112px; } }
.tb.crd { opacity: .55; } .tb.crd.ready { opacity: 1; border-color: #ff9af0; } .tb.crd b { font-size: 12px; }

/* direcional */
.tc-pad { position: absolute; left: max(14px, env(safe-area-inset-left), var(--sa-l, 0px)); bottom: max(12px, env(safe-area-inset-bottom), var(--sa-b, 0px));
  width: 150px; height: 150px; border-radius: 50%; pointer-events: none; touch-action: none; opacity: .35; transition: opacity .2s;
  background: radial-gradient(circle, rgba(30,20,60,.35) 0 40%, rgba(14,9,32,.55) 41%); border: 2px solid rgba(155,120,255,.45); }
/* direcional flutuante: nasce onde o polegar esquerdo tocar (metade esquerda da tela) */
.tc-top, .tc-act { z-index: 2; }
.tc-zone { position: absolute; left: 0; top: 0; bottom: 0; width: 50%; pointer-events: auto; touch-action: none; }
.tc-pad.float { opacity: 1; transition: none; bottom: auto; }
.tc-pad .ar { position: absolute; color: rgba(255,255,255,.55); font-size: 16px; line-height: 1; }
.tc-pad .l { left: 12px; top: 50%; transform: translateY(-50%); } .tc-pad .r { right: 12px; top: 50%; transform: translateY(-50%); }
.tc-pad .u { top: 10px; left: 50%; transform: translateX(-50%); font-size: 12px; } .tc-pad .d { bottom: 10px; left: 50%; transform: translateX(-50%); font-size: 12px; }
.tc-pad.L .l, .tc-pad.R .r, .tc-pad.U .u, .tc-pad.D .d { color: #ffe066; text-shadow: 0 0 8px #ffe066; }
.tc-pad .knob { position: absolute; left: 50%; top: 50%; width: 56px; height: 56px; margin: -28px 0 0 -28px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, rgba(220,200,255,.6), rgba(100,70,190,.55)); border: 2px solid rgba(255,255,255,.35);
  transition: transform .06s; pointer-events: none; }

/* botões de ação (polegar direito) */
.tc-act { position: absolute; right: max(10px, env(safe-area-inset-right), var(--sa-r, 0px)); bottom: max(8px, env(safe-area-inset-bottom), var(--sa-b, 0px)); width: 240px; height: 190px; }
.ab { position: absolute; border-radius: 50%; border: 2px solid rgba(255,255,255,.4); background: rgba(14,9,32,.6);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; }
.ab b { font-size: 22px; font-weight: normal; line-height: 1; }
.ab small { font-size: 6px; opacity: .85; }
.ab.magic { --sc: #c48bff; --ch: 0; width: 86px; height: 86px; right: 4px; bottom: 76px; border-color: var(--sc);
  background: conic-gradient(var(--sc) calc(var(--ch) * 360deg), rgba(14,9,32,.62) 0); }
.ab.magic b { color: #fff; text-shadow: 0 0 10px var(--sc); }
.ab.magic.full { animation: tcpulse .25s infinite alternate; }
@keyframes tcpulse { to { box-shadow: 0 0 24px #fff; } }
.ab.jump { width: 82px; height: 82px; right: 96px; bottom: 6px; border-color: #7dffb0; }
.ab.shield { width: 66px; height: 66px; right: 110px; bottom: 102px; border-color: #8fe3ff; } .ab.shield small { font-size: 5px; }
.ab.dash { width: 52px; height: 52px; right: 14px; bottom: 6px; border-color: #ffe066; }
.ab.dash b { font-size: 18px; }
.ab.shield { border-color: #ffb3ff; } .ab.shield b { color: #ffb3ff; } .ab.shield.dim { opacity: .55; }
/* Visão Arcana: pequena, ao lado do ESPECIAL (perto do polegar) */
.ab.vis { width: 44px; height: 44px; right: 184px; bottom: 112px; border-color: #7fe0ff; }
.ab.vis b { font-size: 17px; } .ab.vis span { position: absolute; top: -4px; right: -4px; min-width: 15px; height: 15px; border-radius: 8px; background: #7fe0ff; color: #0e0920; font-size: 8px; line-height: 15px; font-weight: bold; }
#touch.in-hub .ab.vis { display: none; }
.ab.sombra { width: 46px; height: 46px; right: 182px; bottom: 58px; border-color: #c8a0ff; } .ab.sombra b { font-size: 17px; color: #c8a0ff; } .ab.sombra.dim { opacity: .5; } #touch.in-hub .ab.sombra { display: none; }
.ab em { position: absolute; bottom: -14px; font-style: normal; font-size: 7px; color: #ffe066; }
.tb.spell span { white-space: pre-line; }


/* Torre e Salão dos Portais: sem a barra de combate em cima (ela tapava o nome da Torre,
   o familiar e o MAPAS). No lugar, botões pequenos acima dos botões de ação. */
.tc-hub { display: none; position: absolute; right: max(10px, env(safe-area-inset-right), var(--sa-r, 0px)); bottom: calc(max(8px, env(safe-area-inset-bottom), var(--sa-b, 0px)) + 196px);
  gap: 6px; z-index: 2; }
#touch.in-hub .tc-top { display: none; }
#touch.in-hub .tc-hub { display: flex; }
.hb { height: 34px; padding: 0 9px !important; border-radius: 10px; border: 2px solid rgba(255,224,102,.6); background: rgba(14,9,32,.78);
  display: flex; align-items: center; gap: 5px; }
.hb b { font-size: 13px; font-weight: normal; line-height: 1; }
.hb span { font-size: 7px; color: #ffe066; }
.hb.on { background: rgba(255,224,102,.35); transform: scale(.94); }
@media (max-height: 360px) { .tc-hub { bottom: calc(max(8px, env(safe-area-inset-bottom), var(--sa-b, 0px)) + 170px); } .hb { height: 30px; } }

/* telas menores (celulares pequenos) */
@media (max-height: 360px) {
  .tc-pad { width: 128px; height: 128px; } .tc-pad .knob { width: 48px; height: 48px; margin: -24px 0 0 -24px; }
  .tc-act { transform: scale(.86); transform-origin: right bottom; }
  .tb { height: 32px; } .tb.spell { min-width: 96px; }
}

/* celular em pé: pede para girar */
#rotate { display: none; }
@media (orientation: portrait) {
  html.touch #rotate { display: flex; position: fixed; inset: 0; z-index: 50; align-items: center; justify-content: center;
    background: #0b0814; color: #ffe066; text-align: center; font: 14px/1.8 "Press Start 2P", monospace; }
  #rotate b { display: block; font-size: 56px; font-weight: normal; animation: tcrot 1.6s ease-in-out infinite; }
  @keyframes tcrot { 50% { transform: rotate(90deg); } }
}

/* ============================================================
   ABERTURA (vídeo da história)
   ============================================================ */
#intro { position: fixed; inset: 0; z-index: 100; background: #000; display: flex; align-items: center; justify-content: center;
  font-family: "Press Start 2P", monospace; transition: opacity .4s; }
#intro.out { opacity: 0; pointer-events: none; }
#intro video { width: 100%; height: 100%; object-fit: contain; background: #000; }
#intro button { position: absolute; font: inherit; color: #fff; cursor: pointer; -webkit-appearance: none; appearance: none;
  border: 2px solid rgba(255,224,102,.7); background: rgba(14,9,32,.75); border-radius: 10px; }
#intro .in-skip { right: max(14px, env(safe-area-inset-right), var(--sa-r, 0px)); bottom: max(14px, env(safe-area-inset-bottom), var(--sa-b, 0px));
  padding: 10px 14px; font-size: 10px; opacity: .8; }
#intro .in-skip:hover { opacity: 1; color: #ffe066; }
#intro .in-play { display: none; left: 50%; bottom: 13%; transform: translateX(-50%); padding: 18px 26px; font-size: 13px;
  color: #ffe066; box-shadow: 0 0 24px rgba(255,190,90,.45); animation: inpulse 1.6s ease-in-out infinite; }
#intro.wait .in-play { display: block; }
@keyframes inpulse { 50% { box-shadow: 0 0 40px rgba(255,190,90,.8); } }

/* WebView antiga demais (aviso do index.html) */
#oldwv { position: fixed; inset: 0; z-index: 200; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  padding: 24px; background: #0b0814; color: #e8dcff; font: 14px/1.7 sans-serif; text-align: center; }
#oldwv b { color: #ffe066; font-size: 18px; }
