/* ==========================================================================
   COMPILA WORLD — identidade visual "Pixel Adventure / Neon Dark"
   Camada de redesign carregada em cima do CSS de cada página.
   Não remove nenhuma classe/id usado pelo JS — só reskina.
   ========================================================================== */

:root {
  /* Paleta "Pixel Adventure" — navy + verde natural + céu + amarelo em
     destaque, roxo só como detalhe. Menos neon/cyberpunk, mais mundo de
     jogo. --cyan/--blue continuam existindo (são usadas em dezenas de
     lugares no HTML), só mudam de tom pra um azul-céu mais suave. */
  --bg-dark: #070c1a !important;
  --bg-surface: #0a1224 !important;
  --bg-surface-elevated: #0d1830 !important;
  --bg-glass: rgba(13, 24, 48, 0.85) !important;
  --border-subtle: rgba(148, 178, 150, 0.14) !important;
  --border-medium: rgba(79, 195, 247, 0.24) !important;
  --border-glow: rgba(255, 201, 60, 0.5) !important;

  --cyan: #4fc3f7 !important;
  --blue: #4fc3f7 !important;
  --purple: #9b87c4 !important;
  --magenta: #c17fd6;
  --green: #3ddc84 !important;
  --amber: #ffc93c !important;
  --orange: #ffb238 !important;
  --red: #ff6b6b !important;
  --cta: linear-gradient(135deg, #ffc93c, #ff9d3c);

  --font-display: 'Space Grotesk', -apple-system, sans-serif;
  --font-body: 'Plus Jakarta Sans', -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --font-pixel: 'Press Start 2P', var(--font-mono);
  --font-pixel-heading: 'Silkscreen', var(--font-pixel);
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg-dark);
  position: relative;
}

/* ---------- Fundo vivo: nebulosa + estrelas + grid sutil ---------- */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -3;
  pointer-events: none;
  transform: translateZ(0);
  will-change: transform;
  background:
    radial-gradient(ellipse 60% 45% at 15% 8%, rgba(124, 58, 237, 0.22), transparent 60%),
    radial-gradient(ellipse 55% 40% at 88% 18%, rgba(79, 195, 247, 0.14), transparent 60%),
    radial-gradient(ellipse 50% 45% at 50% 95%, rgba(217, 70, 239, 0.10), transparent 60%),
    var(--bg-dark);
}
/* Estrelas agora estáticas: nada de animar background-position em uma
   camada fixed cobrindo a tela inteira (isso força o navegador a repintar
   tudo a cada frame, sem parar, em toda página do site — era a maior
   causa de lag geral). Visualmente ainda parece um céu estrelado, só não
   fica "andando" para sempre. */
.pixel-grid-overlay,
body::after {
  transform: translateZ(0);
  will-change: transform;
}
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  opacity: 0.55;
  background-image:
    radial-gradient(1.5px 1.5px at 8% 12%, #fff, transparent),
    radial-gradient(1px 1px at 22% 68%, #fff, transparent),
    radial-gradient(1.5px 1.5px at 38% 24%, var(--cyan), transparent),
    radial-gradient(1px 1px at 52% 82%, #fff, transparent),
    radial-gradient(1.5px 1.5px at 66% 14%, #fff, transparent),
    radial-gradient(1px 1px at 78% 58%, var(--magenta), transparent),
    radial-gradient(1.5px 1.5px at 91% 30%, #fff, transparent),
    radial-gradient(1px 1px at 96% 76%, #fff, transparent),
    radial-gradient(1px 1px at 12% 90%, var(--cyan), transparent),
    radial-gradient(1.5px 1.5px at 60% 46%, #fff, transparent);
  background-repeat: repeat;
  background-size: 620px 620px;
}

/* pixel-grid muito sutil por cima de tudo, só textura */
.pixel-grid-overlay {
  position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: 0.35;
  background-image: linear-gradient(rgba(79, 195, 247,0.035) 1px, transparent 1px),
                     linear-gradient(90deg, rgba(79, 195, 247,0.035) 1px, transparent 1px);
  background-size: 34px 34px;
}

/* ---------- Tipografia ----------------------------------------------------
   A fonte de pixel é uma VOZ, não a tipografia do site.

   Ela tem altura-x enorme, contraste zero e nenhuma diferenciação entre
   caracteres parecidos — ótima em rótulo curto de duas ou três palavras
   maiúsculas, péssima em título de três linhas e em qualquer coisa que alguém
   precise ler rápido. Antes ela estava em TODO h1 e h2 com `!important`, e era
   por isso que o site parecia menos profissional do que é.

   Regra: fonte de pixel só em rótulo, selo e tela de celebração. Título de
   verdade usa a fonte de display.
   ------------------------------------------------------------------------ */

.pixel-eyebrow, .hero-tag, .mission-tag,
.chip-pixel, .badge-pixel {
  font-family: var(--font-pixel) !important;
  letter-spacing: 0.03em;
  /* Em fonte de pixel, entrelinha apertada embola as formas. */
  line-height: 1.6;
}

section h2, .profile-id h1, .brief-panel h1, .result-title, .plano-card h3,
.trilha-card h3, .dash-id strong, .profile-hero .profile-id h1, .hero h1 {
  font-family: var(--font-display), system-ui, sans-serif;
  letter-spacing: -0.02em;
  /* Sombra sutil, só para descolar do fundo — sem o relevo de três camadas
     que borrava o texto. */
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.45);
}

/* O título "blocado" continua de pixel: ele aparece em telas de comemoração,
   onde é uma frase curta e o efeito de jogo é justamente o ponto. */
.pixel-block-title {
  font-family: var(--font-pixel-heading), var(--font-pixel) !important;
  color: var(--text-white);
  text-shadow: 3px 3px 0 rgba(0,0,0,0.6), 5px 5px 0 rgba(124,58,237,0.35), 0 0 24px rgba(79, 195, 247,0.3);
  letter-spacing: 0.02em;
  line-height: 1.55;
}

/* ---------- Header / Nav de jogo ---------- */
header {
  background: rgba(5, 8, 22, 0.88) !important;
  border-bottom: 1px solid rgba(79, 195, 247, 0.18) !important;
  box-shadow: 0 1px 0 rgba(124,58,237,0.15), 0 12px 30px -18px rgba(79, 195, 247,0.4);
}
.logo-box {
  background: linear-gradient(135deg, var(--cyan), var(--purple)) !important;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.15), 0 0 16px rgba(79, 195, 247,0.55) !important;
  border-radius: 6px !important;
}
.logo { position: relative; }
.header-links a {
  position: relative;
  padding-bottom: 3px;
  transition: color 0.2s ease, filter 0.2s ease;
}
.header-links a:not(.btn-nav-cta):not(.wnav-pill)::after {
  content: '';
  position: absolute; left: 0; right: 100%; bottom: -3px; height: 2px;
  background: linear-gradient(90deg, var(--cyan), var(--magenta));
  box-shadow: 0 0 6px var(--cyan);
  transition: right 0.25s var(--ease-smooth, ease);
}
.header-links a:not(.btn-nav-cta):not(.wnav-pill):hover::after,
.header-links a.wnav-active::after { right: 0; }
.header-links a.wnav-active { color: var(--text-white); }
.header-links .btn-nav-cta, .btn-nav-cta {
  background: var(--cta) !important;
  color: #201200 !important;
  box-shadow: 0 4px 0 #b5730f, 0 8px 16px rgba(255,178,56,0.25) !important;
}

/* Pílula de XP/nível no header, quando há perfil salvo */
.wnav-pill {
  display: flex; align-items: center; gap: 6px;
  font-family: var(--font-mono); font-size: 11.5px; color: var(--text-main);
  background: rgba(79, 195, 247, 0.08); border: 1px solid var(--border-medium);
  padding: 5px 10px 5px 6px; border-radius: 999px; white-space: nowrap;
}
.wnav-pill .wnav-avatar {
  width: 20px; height: 20px; border-radius: 50%; image-rendering: pixelated;
  border: 1px solid rgba(255,255,255,0.4);
}
.wnav-pill .wnav-lvl { color: var(--amber); font-weight: 700; }
@media (max-width: 760px) { .wnav-pill { margin-top: 4px; } }

/* ---------- Botões estilo arcade ---------- */
.btn, #runBtn, .btn-pill, .accessory-btn {
  position: relative;
  border-radius: 10px !important;
}
.btn-cyan, #runBtn, .btn-pill.primary {
  background: var(--cta) !important;
  color: #201200 !important;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.12) inset, 0 6px 0 #b5730f, 0 12px 24px rgba(255,178,56,0.22) !important;
}
.btn-cyan:hover, #runBtn:hover:not(:disabled), .btn-pill.primary:hover {
  filter: brightness(1.06);
  box-shadow: 0 0 0 1px rgba(255,255,255,0.16) inset, 0 4px 0 #b5730f, 0 10px 22px rgba(255,178,56,0.3) !important;
}
.btn-cyan:active, #runBtn:active:not(:disabled) { box-shadow: 0 0 0 1px rgba(255,255,255,0.12) inset, 0 1px 0 #b5730f !important; }
.btn-ghost, .btn-pill.ghost {
  border: 1px solid var(--border-medium) !important;
  background: rgba(124,58,237,0.06) !important;
}
.btn-ghost:hover, .btn-pill.ghost:hover { background: rgba(79, 195, 247,0.08) !important; border-color: var(--cyan) !important; }

/* ---------- Cards vidro-neon reutilizados (trilhas, tutor, playground, planos) ---------- */
.trilha-card, .tutor-panel, .plano-card, .playground-panel, .plano-form,
.achv-card, .skill-tree, .side-panel, .brief-panel, .editor-window, .dash-bar {
  background: linear-gradient(180deg, rgba(124,58,237,0.05), rgba(79, 195, 247,0.02)), var(--bg-glass) !important;
  border: 1px solid var(--border-subtle) !important;
  position: relative;
}
.trilha-card:hover, .plano-card:hover, .achv-card:hover {
  border-color: rgba(79, 195, 247,0.45) !important;
  box-shadow: 0 0 0 1px rgba(79, 195, 247,0.15), 0 18px 38px rgba(0,0,0,0.5) !important;
}
.plano-card.selected {
  border-color: var(--cyan) !important;
  box-shadow: 0 0 0 1px var(--cyan), 0 0 24px rgba(79, 195, 247,0.3) !important;
}

/* cantinho "pixel" decorativo nos cards principais */
.trilha-card::before, .plano-card::before {
  content: '';
  position: absolute; top: 0; left: 0; width: 10px; height: 10px;
  border-top: 2px solid var(--cyan); border-left: 2px solid var(--cyan);
  opacity: 0.7;
}
.trilha-card::after, .plano-card::after {
  content: '';
  position: absolute; bottom: 0; right: 0; width: 10px; height: 10px;
  border-bottom: 2px solid var(--magenta); border-right: 2px solid var(--magenta);
  opacity: 0.7;
}

/* ---------- Barras de XP com glow ---------- */
.dash-xp-fill, .profile-xp-fill { background: linear-gradient(90deg, var(--green), var(--cyan)) !important; box-shadow: 0 0 10px rgba(57,255,136,0.5); }
.dash-xp-bar, .profile-xp-bar { background: rgba(0,0,0,0.5) !important; border-color: rgba(79, 195, 247,0.2) !important; }

/* ==========================================================================
   HERO — cena de mundo em pixel/SVG (substitui a screenshot antiga)
   ========================================================================== */
.world-scene {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3.1;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid rgba(79, 195, 247,0.28);
  background:
    radial-gradient(ellipse 90% 70% at 50% 15%, rgba(124,58,237,0.35), transparent 65%),
    radial-gradient(ellipse 60% 50% at 80% 80%, rgba(217,70,239,0.18), transparent 60%),
    linear-gradient(180deg, #0b1022 0%, #050816 100%);
  box-shadow: 0 30px 60px -20px rgba(0,0,0,0.75), 0 0 0 1px rgba(255,255,255,0.03) inset;
  animation: floatArt 6s ease-in-out infinite;
}
.world-scene .ws-stars {
  position: absolute; inset: 0;
  background-image: radial-gradient(1.5px 1.5px at 10% 20%, #fff, transparent),
    radial-gradient(1px 1px at 30% 70%, #fff, transparent),
    radial-gradient(1.5px 1.5px at 60% 15%, var(--cyan), transparent),
    radial-gradient(1px 1px at 80% 40%, #fff, transparent),
    radial-gradient(1.5px 1.5px at 92% 75%, #fff, transparent),
    radial-gradient(1px 1px at 45% 90%, var(--magenta), transparent);
  background-size: 100% 100%;
  animation: wsTwinkle 3.5s ease-in-out infinite alternate;
}
@keyframes wsTwinkle { from { opacity: 0.5; } to { opacity: 1; } }

.ws-portal {
  position: absolute; left: 50%; top: 40%; transform: translate(-50%, -50%);
  width: 34%; aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(circle, rgba(79, 195, 247,0.9) 0%, rgba(124,58,237,0.55) 45%, transparent 72%);
  box-shadow: 0 0 60px 20px rgba(79, 195, 247,0.45), 0 0 120px 40px rgba(124,58,237,0.25);
  animation: wsPortalPulse 3.2s ease-in-out infinite;
  display: flex; align-items: center; justify-content: center;
}
.ws-portal span {
  font-family: var(--font-pixel-heading), monospace; font-weight: 700;
  font-size: clamp(20px, 3vw, 30px); color: #fff; text-shadow: 0 0 14px rgba(79, 195, 247,0.9);
}
@keyframes wsPortalPulse { 0%, 100% { box-shadow: 0 0 60px 16px rgba(79, 195, 247,0.4), 0 0 110px 34px rgba(124,58,237,0.22); } 50% { box-shadow: 0 0 76px 26px rgba(79, 195, 247,0.6), 0 0 140px 46px rgba(124,58,237,0.32); } }

.ws-island {
  position: absolute; display: flex; flex-direction: column; align-items: center; gap: 6px;
  animation: wsFloat 5s ease-in-out infinite;
}
.ws-island .ws-chip {
  width: 46px; height: 46px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-weight: 700; font-size: 13px;
  color: #04101a; box-shadow: 0 6px 0 rgba(0,0,0,0.35), 0 12px 18px rgba(0,0,0,0.45);
}
.ws-island .ws-rock {
  width: 64px; height: 14px; border-radius: 50%;
  background: linear-gradient(180deg, #1b2340, #0b1022);
  box-shadow: 0 6px 14px rgba(0,0,0,0.5);
}
.ws-island .ws-label { font-family: var(--font-mono); font-size: 9.5px; color: var(--text-dim); }
@keyframes wsFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }

.ws-path { position: absolute; inset: 0; }
.ws-path svg { width: 100%; height: 100%; }
.ws-path path { fill: none; stroke: rgba(79, 195, 247,0.35); stroke-width: 2; stroke-dasharray: 3 7; }

.ws-crystal {
  position: absolute; width: 16px; height: 22px;
  background: linear-gradient(160deg, var(--magenta), var(--purple));
  clip-path: polygon(50% 0%, 100% 35%, 78% 100%, 22% 100%, 0% 35%);
  filter: drop-shadow(0 0 6px rgba(217,70,239,0.7));
  animation: wsFloat 4s ease-in-out infinite;
}

@media (max-width: 900px) { .world-scene { aspect-ratio: 4/3.4; } }

/* ---------- Seção "Como funciona" (trilha de checkpoints) ---------- */
.how-trail {
  display: flex; flex-wrap: wrap; gap: 0; align-items: stretch; counter-reset: step;
}
.how-step {
  flex: 1 1 160px; min-width: 150px; position: relative; text-align: center; padding: 20px 14px;
}
.how-step .how-num {
  width: 44px; height: 44px; margin: 0 auto 14px; border-radius: 12px;
  background: var(--bg-surface-elevated); border: 2px solid var(--border-medium);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-pixel); font-size: 13px; color: var(--cyan);
  box-shadow: 0 0 14px rgba(79, 195, 247,0.25);
}
.how-step h4 { font-family: var(--font-display); font-size: 13.5px; color: var(--text-white); margin-bottom: 6px; letter-spacing: 0.02em; }
.how-step p { font-size: 12px; color: var(--text-dim); line-height: 1.5; }
.how-step:not(:last-child)::after {
  content: '›'; position: absolute; right: -4px; top: 34px; color: var(--border-medium); font-size: 20px;
  display: none;
}
@media (min-width: 700px) { .how-step:not(:last-child)::after { display: block; } }

/* ---------- Toast de conquista ---------- */
.achv-toast {
  position: fixed; left: 50%; top: 26px; transform: translate(-50%, -140%);
  background: linear-gradient(180deg, rgba(11,16,34,0.97), rgba(5,8,22,0.99));
  border: 1px solid var(--cyan); border-radius: 14px; padding: 14px 22px; text-align: center;
  z-index: 999; box-shadow: 0 0 30px rgba(79, 195, 247,0.35), 0 20px 40px rgba(0,0,0,0.6);
  transition: transform 0.45s cubic-bezier(0.16,1,0.3,1); pointer-events: none;
}
.achv-toast.show { transform: translate(-50%, 0); }
.achv-toast .achv-toast-title { font-family: var(--font-pixel); font-size: 10px; color: var(--amber); margin-bottom: 6px; }
.achv-toast .achv-toast-name { font-family: var(--font-display); font-size: 14px; color: var(--text-white); }

@media (prefers-reduced-motion: reduce) {
  .world-scene, .ws-island, .ws-crystal, .ws-portal, body::after { animation: none !important; }
}

/* ==========================================================================
   HERO v2 — cena "overworld": paisagem + trilha + personagem andando
   ========================================================================== */
.overworld {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid rgba(79, 195, 247,0.28);
  background: url('mapa-bg.jpg') center / cover no-repeat, var(--bg-dark);
  box-shadow: 0 30px 60px -20px rgba(0,0,0,0.75), 0 0 0 1px rgba(255,255,255,0.03) inset;
}
.overworld .ow-vignette {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(5,8,22,0.15) 0%, rgba(5,8,22,0.25) 55%, rgba(5,8,22,0.9) 100%);
}
.overworld .ow-ground {
  position: absolute; left: 0; right: 0; bottom: 0; height: 34%;
  background: linear-gradient(180deg, #0d1f16 0%, #081109 100%);
  border-top: 3px solid rgba(57,255,136,0.25);
}
.overworld .ow-ground::before {
  content: '';
  position: absolute; inset: 0;
  background-image: linear-gradient(90deg, rgba(57,255,136,0.06) 1px, transparent 1px);
  background-size: 26px 100%;
  opacity: 0.5;
}
.overworld .ow-path {
  position: absolute; left: 6%; right: 8%; bottom: 10%; height: 14px;
  border-bottom: 4px dashed rgba(255,212,59,0.55);
}
.overworld .ow-signpost {
  position: absolute; bottom: 12%; display: flex; flex-direction: column; align-items: center; gap: 4px;
  animation: wsFloat 4s ease-in-out infinite;
}
.overworld .ow-signpost .ws-chip {
  width: 40px; height: 40px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-weight: 700; font-size: 11px; color: #04101a;
  box-shadow: 0 4px 0 rgba(0,0,0,0.35), 0 8px 14px rgba(0,0,0,0.45);
}
.overworld .ow-signpost .ow-post { width: 4px; height: 16px; background: #5b4632; margin-top: -2px; }
.overworld .ow-signpost .ws-label { font-family: var(--font-mono); font-size: 8.5px; color: var(--text-dim); background: rgba(5,8,22,0.6); padding: 1px 5px; border-radius: 3px; }

.overworld .ow-player {
  position: absolute; bottom: 13%; left: 42%; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center;
  animation: playerIdleHero 1.4s ease-in-out infinite;
  z-index: 3;
}
.overworld .ow-player img { width: 56px; height: 56px; image-rendering: pixelated; filter: drop-shadow(0 8px 8px rgba(0,0,0,0.55)); }
.overworld .ow-player .ow-shadow { width: 30px; height: 8px; border-radius: 50%; background: rgba(0,0,0,0.5); filter: blur(1px); margin-top: -6px; }
@keyframes playerIdleHero { 0%, 100% { transform: translateX(-50%) translateY(0); } 50% { transform: translateX(-50%) translateY(-6px); } }

.overworld .ow-portal-far {
  position: absolute; right: 6%; top: 20%; width: 70px; height: 70px; border-radius: 50%;
  background: radial-gradient(circle, rgba(79, 195, 247,0.85), rgba(124,58,237,0.4) 55%, transparent 75%);
  box-shadow: 0 0 40px 14px rgba(79, 195, 247,0.4);
  animation: wsPortalPulse 3.2s ease-in-out infinite;
}
.overworld .ow-caption {
  position: absolute; left: 16px; bottom: 14px; font-family: var(--font-mono); font-size: 10.5px;
  color: var(--text-dim); background: rgba(5,8,22,0.55); padding: 4px 9px; border-radius: 6px;
  border: 1px solid var(--border-subtle);
}
@media (max-width: 900px) { .overworld { aspect-ratio: 4/3.3; } }
@media (prefers-reduced-motion: reduce) { .overworld .ow-player, .overworld .ow-signpost, .overworld .ow-portal-far { animation: none !important; } }

/* ---------- Personagem pixel — moldura + sombra + idle bob ----------
   Aplica-se a qualquer avatar do site (dashboard do mapa, preview do
   perfil) sem precisar duplicar CSS em cada página. Referência de
   estilo: editor de personagem pixel-art tipo Codédex (moldura colorida,
   sombra elíptica no chão, personagem sempre de frente). */
.dash-avatar, .avatar-big, .skin-preview {
  position: relative !important;
  border-radius: 14px !important;
  border: 2px solid rgba(255,255,255,0.85) !important;
  box-shadow: 0 5px 0 rgba(0,0,0,0.35), 0 9px 16px rgba(0,0,0,0.4) !important;
  overflow: visible !important;
}
.dash-avatar::after, .avatar-big::after, .skin-preview::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -7px;
  transform: translateX(-50%);
  width: 55%;
  height: 7px;
  background: rgba(0,0,0,0.4);
  border-radius: 50%;
  filter: blur(1px);
  z-index: 0;
}
.dash-avatar .avatar-sprite,
.avatar-big .avatar-sprite,
.skin-preview .avatar-sprite {
  position: relative;
  z-index: 1;
  animation: pixelIdleBob 1.8s ease-in-out infinite;
}
@keyframes pixelIdleBob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}
@media (prefers-reduced-motion: reduce) {
  .dash-avatar .avatar-sprite, .avatar-big .avatar-sprite, .skin-preview .avatar-sprite { animation: none !important; }
}
