/* =========================================================
   FORCA DAS DESCOBERTAS — IK EDUCA
   Estilos mobile-first, com variáveis de tema centralizadas.
   ========================================================= */

:root {
  /* Paleta principal */
  --primary: #5B4FE9;
  --primary-dark: #4437C9;
  --primary-light: #EFEDFF;
  --secondary: #FF8A3D;
  --success: #2FBF71;
  --success-dark: #1F9B58;
  --warning: #FFB800;
  --warning-dark: #E5A200;
  --danger: #FF5C7A;
  --danger-dark: #E23F5F;
  --purple: #9B5DE5;

  --background: #F6F5FF;
  --surface: #FFFFFF;
  --text: #2B2340;
  --text-soft: #6B6480;
  --border: #E7E4FA;

  /* Tipografia */
  --font-display: 'Baloo 2', 'Nunito', system-ui, sans-serif;
  --font-body: 'Nunito', system-ui, sans-serif;

  /* Espaçamento / raio */
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-pill: 999px;
  --shadow-soft: 0 4px 14px rgba(91, 79, 233, 0.10);
  --shadow-card: 0 8px 24px rgba(91, 79, 233, 0.14);
  --shadow-btn: 0 6px 0 var(--primary-dark);

  --safe-bottom: env(safe-area-inset-bottom, 0px);

  /* Largura máxima das telas "cheias" (Home, Avatar) — a mesma em
     ambas, para que nenhuma pareça mais larga que a outra no desktop. */
  --shell-max-width: 430px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--background);
  color: var(--text);
  font-family: var(--font-body);
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: contain;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  justify-content: center;
}

h1, h2, h3 { font-family: var(--font-display); margin: 0; }
p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }
button { font-family: inherit; cursor: pointer; }

/* Foco visível para acessibilidade */
button:focus-visible,
[role="button"]:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 2px;
}

/* =========================================================
   LAYOUT GERAL — mobile first, centralizado em telas maiores
   ========================================================= */
.app {
  width: 100%;
  max-width: 520px;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--background);
  display: flex;
  flex-direction: column;
  position: relative;
}

@media (min-width: 560px) {
  body { background: linear-gradient(160deg, #E3DFFF 0%, #D3F0E4 100%); padding: 24px 0; }
  .app {
    min-height: calc(100vh - 48px);
    min-height: calc(100dvh - 48px);
    border-radius: 28px;
    box-shadow: 0 24px 60px rgba(60, 40, 140, 0.18);
    overflow: hidden;
  }
}

/* =========================================================
   TOPO / LOGO
   ========================================================= */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  flex-shrink: 0;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}
.logo-mark { font-size: 1.4rem; line-height: 1; }
.logo-text {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  color: var(--primary-dark);
}

.icon-btn {
  width: 42px;
  height: 42px;
  min-width: 42px;
  min-height: 42px;
  border-radius: var(--radius-pill);
  border: none;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  font-size: 1.15rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease;
}
.icon-btn:active { transform: scale(0.9); }

/* =========================================================
   MAIN / TELAS
   ========================================================= */
main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding-bottom: calc(20px + var(--safe-bottom));
}

.screen {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 8px 20px 20px;
  animation: screen-in 0.35s ease both;
}

@keyframes screen-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* =========================================================
   TELA HOME — capa vertical única (mobile first, SEMPRE em retrato)
   O fundo (fundo.webp) já traz a cena inteira pronta — crianças, mesa,
   caderno de pistas. Por isso ele é a PELE do próprio shell
   (background-image, não uma <img> separada): o shell tem a MESMA
   proporção nativa da imagem (aspect-ratio), então "cover" nunca
   precisa cortar nada — encaixe perfeito. Logo, banner e botão ficam
   sobrepostos na mesma peça (position:absolute, em % do shell), como
   uma única composição integrada — sem card, sem moldura, sem um
   fundo "brigando" com a arte. O shell mantém sempre esse formato
   retrato (largura controlada, altura = largura / proporção da
   imagem), em qualquer tela: desktop e celular na horizontal apenas
   centralizam a mesma peça vertical, nunca a reorganizam — e se ela
   não couber na altura da viewport, a página rola verticalmente.
   ========================================================= */
#screen-home.screen-home {
  padding: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  /* Sem background próprio: a cor vem de .app.is-home, para existir
     uma ÚNICA camada de fundo atrás do shell — nunca duas competindo. */
}

/* Quando a home ou o avatar estão ativos, a topbar padrão (logo em
   texto + som) some, pois cada uma dessas telas já traz seu próprio
   cabeçalho integrado à composição. */
.app.is-home .topbar,
.app.is-avatar .topbar,
.app.is-difficulty .topbar,
.app.is-game .topbar {
  display: none;
}
.app.is-home #main,
.app.is-avatar #main,
.app.is-difficulty #main,
.app.is-game #main {
  padding-bottom: 0;
}

/* ÚNICA cor de fundo para tudo que envolve o shell — dentro do .app
   (atrás do shell, quando ele é mais estreito/baixo que a caixa) e
   fora dele (a faixa da página em telas largas). Mesmo valor exato
   nos seletores: cor sólida, não gradiente proporcional ao tamanho do
   elemento — assim nunca existe costura entre "fundo da página" e
   "fundo da tela", é uma coisa só. Vale para Home e Avatar, que
   compartilham a mesma paleta e a mesma lógica de shell único. */
body:has(.app.is-home),
body:has(.app.is-avatar),
body:has(.app.is-difficulty),
body:has(.app.is-game),
.app.is-home,
.app.is-avatar,
.app.is-difficulty,
.app.is-game {
  background: #0c1330;
}

/* Em telas largas, Home e Avatar não devem ler como um "card": sem
   cantos arredondados, sem sombra, sem o respiro que o body dá às
   outras telas — o shell precisa encostar no topo da viewport.
   (Sobrescreve o tratamento de card/centralização que .app recebe em
   telas largas, só quando uma dessas telas está ativa.) */
.app.is-home,
.app.is-avatar,
.app.is-difficulty,
.app.is-game {
  border-radius: 0;
  box-shadow: none;
}
@media (min-width: 560px) {
  body:has(.app.is-home),
  body:has(.app.is-avatar),
  body:has(.app.is-difficulty),
  body:has(.app.is-game) {
    padding: 0;
  }
  .app.is-home,
  .app.is-avatar,
  .app.is-difficulty,
  .app.is-game {
    min-height: 100vh;
    min-height: 100dvh;
  }
}

/* O shell tem a proporção NATIVA do fundo.webp (941 × 1672) — por
   isso "cover" preenche a peça inteira sem sobrar nem cortar um
   pixel. Como a proporção é fixa, o shell nunca vira "landscape":
   ele só encolhe, sempre em pé. Sem margin/centralização vertical:
   ele fica sempre encostado no topo da viewport, como uma tela
   mobile de verdade — só centralizado na horizontal (align-items do
   pai). Se for mais alto que a viewport (paisagem), a página rola. */
.home-shell {
  position: relative;
  width: min(100%, var(--shell-max-width));
  aspect-ratio: 941 / 1672;
  flex-shrink: 0;
  overflow: hidden;
  background-image: url("assets/images/tela-inicio/fundo.webp");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

/* Sempre que há altura de sobra, a caixa deixa de seguir a proporção
   nativa da imagem e passa a ocupar a viewport inteira (topo à
   base). O "cover" então cropa as LATERAIS (nunca sobra faixa
   embaixo) — é a troca certa aqui: preferimos um corte lateral
   discreto a deixar a cor de fundo do shell aparecendo depois do fim
   da arte. Fica de fora APENAS o celular na horizontal (largura
   grande, mas altura curta, tipicamente <700px) — aí sim mantemos a
   proporção nativa e deixamos a página rolar, em vez de espremer a
   arte numa faixa baixa e larga. */

/* Mobile em retrato: a largura já é a própria viewport (o teto de
   --shell-max-width nunca chega a valer aqui). Como a altura precisa
   cobrir 100dvh, o "cover" amplia a imagem e corta bastante das
   laterais. Para aliviar esse corte SEM distorcer nada (nada de
   scaleX): deixamos a caixa "sangrar" um pouco além da largura da
   viewport (108vw) — isso dá mais imagem para o cover trabalhar,
   reduzindo o quanto precisa ampliar para cobrir a altura, logo
   corta menos das pontas. align-items:center do pai já centraliza
   esse excesso simetricamente para fora dos dois lados; overflow-x
   escondido no wrapper garante que essa sangria nunca vire scroll
   horizontal. */
@media (max-width: 480px) and (orientation: portrait) {
  #screen-home.screen-home {
    overflow-x: hidden;
  }
  .home-shell {
    width: 108vw;
    aspect-ratio: unset;
    height: 100vh;
    height: 100dvh;
  }
}

/* Desktop e tablets com altura generosa: mesma troca de altura, mas
   SEM tocar na largura — ela continua travada em --shell-max-width
   (a mesma largura da tela de Avatar), só ganha mais altura. */
@media (min-width: 480px) and (min-height: 700px) {
  .home-shell {
    aspect-ratio: unset;
    height: 100vh;
    height: 100dvh;
  }
}

.home-shell img {
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
}

.home-top {
  position: absolute;
  top: 3.5%;
  left: 50%;
  transform: translateX(-50%);
  width: 86%;
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 1;
}

.home-logo-glow {
  position: relative;
  width: 46%;
  display: flex;
  justify-content: center;
  align-items: center;
  animation: home-fade-up 0.5s ease both;
}
.home-logo-glow::before {
  content: "";
  position: absolute;
  inset: -45%;
  border-radius: 50%;
  background: radial-gradient(ellipse 60% 60% at center, rgba(255, 250, 235, 0.55), rgba(255, 232, 178, 0.16) 55%, rgba(255, 232, 178, 0) 78%);
  z-index: -1;
}
.home-logo {
  width: 100%;
  height: auto;
  display: block;
  filter: drop-shadow(0 0 3px rgba(255, 255, 255, 0.85)) drop-shadow(0 0 9px rgba(255, 255, 255, 0.5));
}

.home-banner {
  width: 100%;
  height: auto;
  display: block;
  margin-top: 2%;
  filter: drop-shadow(0 4px 14px rgba(0, 0, 0, 0.35));
  animation: home-fade-in 0.55s ease 0.1s both;
}

.home-play-button {
  position: absolute;
  left: 50%;
  bottom: 5%;
  transform: translateX(-50%);
  width: 54%;
  z-index: 1;
  border: none;
  background: none;
  padding: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.15s ease;
  animation: home-pop-in 0.5s cubic-bezier(0.2, 0.9, 0.3, 1.3) 0.34s both;
}
.home-play-button img {
  width: 100%;
  height: auto;
  display: block;
  filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.45));
}
@media (hover: hover) {
  .home-play-button:hover { transform: translateX(-50%) scale(1.03); }
}
.home-play-button:active { transform: translateX(-50%) scale(0.97); }

@keyframes home-fade-up {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes home-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes home-pop-in {
  from { opacity: 0; transform: translateX(-50%) scale(0.88); }
  to { opacity: 1; transform: translateX(-50%) scale(1); }
}

/* =========================================================
   TELA AVATAR — identificação do jogador
   Mesma filosofia da Home: uma peça única e vertical, mesmo shell
   (mesma largura máxima), mesmo fundo já pronto como pele do shell.
   Mas aqui o conteúdo (card de formulário) é naturalmente mais alto
   que uma tela — diferente da Home, o shell NÃO trava a proporção da
   imagem: ele cresce com o conteúdo (min-height:100dvh como piso) e
   o "cover" do fundo acompanha, sem nunca deixar uma faixa vazia.
   Sempre retrato: paisagem e desktop só centralizam a mesma largura
   controlada, nunca reorganizam — se não couber, a página rola.
   ========================================================= */
#screen-avatar.screen-avatar {
  padding: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.avatar-shell {
  position: relative;
  width: min(100%, var(--shell-max-width));
  min-height: 100vh;
  min-height: 100dvh;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  background-image: url("assets/images/tela-avatar/fundo.webp");
  background-size: cover;
  background-position: center top;
  background-repeat: no-repeat;
  padding: max(14px, env(safe-area-inset-top)) 20px max(28px, env(safe-area-inset-bottom));
}

.avatar-shell img { user-select: none; -webkit-user-drag: none; }

.avatar-topbar {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.avatar-icon-btn {
  width: clamp(38px, 10vw, 50px);
  height: clamp(38px, 10vw, 50px);
  border: none;
  background: none;
  padding: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.15s ease;
}
.avatar-icon-btn img {
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
  filter: drop-shadow(0 3px 8px rgba(0, 0, 0, 0.45));
}
.avatar-icon-btn:active { transform: scale(0.9); }
@media (hover: hover) {
  .avatar-icon-btn:hover { transform: scale(1.06); }
}

.avatar-banner {
  width: 100%;
  max-width: 320px;
  height: auto;
  display: block;
  margin-top: 8px;
  flex-shrink: 0;
  filter: drop-shadow(0 4px 14px rgba(0, 0, 0, 0.35));
  animation: home-fade-in 0.5s ease both;
}

/* Card claro — "pergaminho" de exploração, contraste com o cenário
   escuro atrás, igual à referência do Corpo em Ação adaptada à Forca. */
.avatar-card {
  width: min(88vw, 340px);
  margin-top: 18px;
  margin-bottom: 12px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: rgba(255, 248, 224, 0.96);
  border: 3px solid rgba(196, 155, 84, 0.55);
  border-radius: 22px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
  padding: 18px 16px 20px;
  animation: home-fade-in 0.55s ease 0.08s both;
}

.avatar-card-title {
  width: 100%;
  max-width: 280px;
  height: auto;
  display: block;
}

.avatar-field { width: 100%; margin-top: 14px; }
.avatar-field-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 5px;
}
.avatar-label {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.78rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--text);
}
.avatar-name-count {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-soft);
}
.avatar-name-input {
  width: 100%;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 16px; /* evita zoom automático no iOS */
  color: var(--text);
  background: #fffdf6;
  border: 2px solid rgba(196, 155, 84, 0.55);
  border-radius: 12px;
  padding: 12px 14px;
  outline: none;
  transition: border-color 0.15s ease;
}
.avatar-name-input:focus { border-color: var(--secondary); }
.avatar-name-input::placeholder { color: var(--text-soft); font-weight: 600; }

.avatar-form-msg {
  width: 100%;
  min-height: 1.1em;
  margin-top: 5px;
  font-size: 0.76rem;
  font-weight: 800;
  color: var(--danger-dark);
  text-align: left;
}

.avatar-section-label {
  width: 100%;
  margin-top: 16px;
  margin-bottom: 8px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.92rem;
  color: var(--text);
  text-align: left;
}

.avatar-grid {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: clamp(5px, 1.8vw, 9px);
}

.avatar-option {
  position: relative;
  aspect-ratio: 1;
  border: 3px solid rgba(196, 155, 84, 0.4);
  border-radius: 14px;
  background: #fff6dd;
  padding: 3px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.avatar-option img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}
.avatar-option:active { transform: scale(0.94); }
@media (hover: hover) {
  .avatar-option:hover { border-color: var(--secondary); }
}
.avatar-option.selected {
  border-color: var(--secondary);
  box-shadow: 0 0 0 3px rgba(255, 138, 61, 0.35), 0 4px 10px rgba(0, 0, 0, 0.25);
  transform: scale(1.06);
}
.avatar-option-check {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: var(--success);
  color: #fff;
  font-size: 10px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  opacity: 0;
  transform: scale(0.5);
  transition: opacity 0.15s ease, transform 0.15s ease;
}
.avatar-option.selected .avatar-option-check { opacity: 1; transform: scale(1); }

.avatar-custom-btn {
  width: 100%;
  margin-top: 12px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 2px dashed rgba(196, 155, 84, 0.6);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.35);
  color: var(--text);
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.avatar-custom-btn:active { background: rgba(255, 255, 255, 0.7); }
.avatar-custom-btn.has-image {
  border-style: solid;
  border-color: var(--success);
  background: rgba(47, 191, 113, 0.12);
}
.avatar-custom-thumb {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  flex-shrink: 0;
}

.avatar-continue-button {
  border: none;
  background: none;
  padding: 0;
  margin-top: 18px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.15s ease, opacity 0.2s ease;
}
.avatar-continue-button img {
  width: clamp(170px, 46vw, 220px);
  height: auto;
  display: block;
  pointer-events: none;
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.35));
}
.avatar-continue-button.is-inactive {
  opacity: 0.42;
  filter: grayscale(0.4);
}
@media (hover: hover) {
  .avatar-continue-button:not(.is-inactive):hover { transform: scale(1.03); }
}
.avatar-continue-button:not(.is-inactive):active { transform: scale(0.97); }

/* =========================================================
   BOTÕES
   ========================================================= */
.btn {
  border: none;
  border-radius: var(--radius-pill);
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 16px 24px;
  min-height: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.btn:active { transform: translateY(3px); }

.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: var(--shadow-btn);
}
.btn-primary:active { box-shadow: 0 3px 0 var(--primary-dark); }

.btn-secondary {
  background: var(--surface);
  color: var(--primary-dark);
  box-shadow: 0 6px 0 var(--border);
  border: 2px solid var(--border);
}
.btn-secondary:active { box-shadow: 0 3px 0 var(--border); }

.btn-large { font-size: 1.15rem; width: 100%; }
.btn-arrow { font-size: 1.2rem; }

/* =========================================================
   TELA DIFICULDADE — escolha de desafio
   Mesma filosofia da tela de Avatar: shell único e vertical (mesma
   largura máxima), fundo.webp como pele, topbar + banner sobrepostos.
   Os três cards de dificuldade já trazem a identidade visual pronta
   nos PNGs (facil/medio/dificil) — aqui só entra a camada de seleção
   (glow dourado + selo), sem recriar o conteúdo dos cards em HTML.
   ========================================================= */
#screen-difficulty.screen-difficulty {
  padding: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.difficulty-shell {
  position: relative;
  width: min(100%, var(--shell-max-width));
  min-height: 100vh;
  min-height: 100dvh;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  background-image: url("assets/images/tela-escolha-desafio/fundo.webp");
  background-size: cover;
  background-position: center top;
  background-repeat: no-repeat;
  padding: max(14px, env(safe-area-inset-top)) 20px max(28px, env(safe-area-inset-bottom));
}

.difficulty-shell img { user-select: none; -webkit-user-drag: none; }

.difficulty-topbar {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.difficulty-icon-btn {
  width: clamp(38px, 10vw, 50px);
  height: clamp(38px, 10vw, 50px);
  border: none;
  background: none;
  padding: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.15s ease;
}
.difficulty-icon-btn img {
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
  filter: drop-shadow(0 3px 8px rgba(0, 0, 0, 0.45));
}
.difficulty-icon-btn:active { transform: scale(0.9); }
@media (hover: hover) {
  .difficulty-icon-btn:hover { transform: scale(1.06); }
}

.difficulty-banner {
  width: 100%;
  max-width: 340px;
  height: auto;
  display: block;
  margin-top: 10px;
  flex-shrink: 0;
  filter: drop-shadow(0 4px 14px rgba(0, 0, 0, 0.35));
  animation: home-fade-in 0.5s ease both;
}

.difficulty-cards {
  width: min(90vw, 380px);
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex-shrink: 0;
  animation: home-fade-in 0.55s ease 0.06s both;
}

.difficulty-card {
  position: relative;
  display: block;
  width: 100%;
  border: none;
  background: none;
  padding: 0;
  border-radius: 20px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.18s cubic-bezier(0.2, 0.9, 0.3, 1.3);
}
.difficulty-card img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 20px;
  pointer-events: none;
  transition: box-shadow 0.18s ease, filter 0.18s ease;
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.4));
}
.difficulty-card:active { transform: scale(0.97); }
@media (hover: hover) {
  .difficulty-card:not(.selected):hover img {
    filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.4)) brightness(1.05);
  }
}
.difficulty-card.selected {
  transform: scale(1.04);
}
.difficulty-card.selected img {
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.4)) brightness(1.04);
  box-shadow:
    0 0 0 3px rgba(255, 210, 100, 0.95),
    0 0 0 7px rgba(255, 176, 40, 0.35),
    0 0 26px 8px rgba(255, 189, 56, 0.6);
}

.difficulty-card-badge {
  position: absolute;
  top: -9px;
  right: 12px;
  background: linear-gradient(135deg, #ffe9a8, #f5a623);
  color: #4a2e00;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.66rem;
  letter-spacing: 0.02em;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.4);
  opacity: 0;
  transform: translateY(-4px) scale(0.8);
  transition: opacity 0.18s ease, transform 0.18s ease;
  pointer-events: none;
  white-space: nowrap;
}
.difficulty-card.selected .difficulty-card-badge {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.difficulty-select-msg {
  width: 100%;
  min-height: 1.1em;
  margin-top: 10px;
  font-size: 0.8rem;
  font-weight: 800;
  color: #ffdca6;
  text-align: center;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.55);
}

.difficulty-continue-button {
  border: none;
  background: none;
  padding: 0;
  margin-top: 16px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.15s ease;
  flex-shrink: 0;
}
.difficulty-continue-button img {
  width: clamp(190px, 52vw, 240px);
  height: auto;
  display: block;
  pointer-events: none;
  filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.45));
}
@media (hover: hover) {
  .difficulty-continue-button:hover { transform: scale(1.03); }
}
.difficulty-continue-button:active { transform: scale(0.97); }

/* Passaporte do explorador — overlay posicionado em % por cima do PNG.
   O container trava o aspect-ratio NATIVO do asset (855 × 169), então
   o PNG nunca é esticado/deformado; as posições em % foram medidas
   diretamente sobre os slots desenhados na arte (círculo do avatar e
   caixa do nome — as três estatísticas não têm mais caixa própria no
   asset atual, então o número fica centralizado logo abaixo do
   ícone/rótulo de cada coluna). `container-type` permite usar `cqw`
   para o texto escalar junto com a largura real do passaporte, em
   qualquer tamanho de tela.
   A largura "vaza" 10px para dentro do padding lateral de 20px do
   .difficulty-shell (margin negativa), em vez de herdar o mesmo
   respiro dos cards/banner — assim o passaporte fica visualmente mais
   largo e presente, chegando a ~10px da borda real da tela em vez de
   20px, sem nunca ultrapassar o shell (a margem negativa nunca é maior
   que o padding que está compensando). */
.explorer-passport {
  position: relative;
  width: calc(100% + 20px);
  margin: 22px -10px 0;
  flex-shrink: 0;
  aspect-ratio: 855 / 169;
  container-type: inline-size;
  animation: home-fade-in 0.55s ease 0.1s both;
}
.explorer-passport-bg {
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
  filter: drop-shadow(0 10px 22px rgba(0, 0, 0, 0.4));
}

.passport-avatar {
  position: absolute;
  left: 4.4%;
  top: 15.3%;
  width: 14.8%;
  height: 75.5%;
  border-radius: 50%;
  overflow: hidden;
  background: #fdf1cf;
  display: flex;
  align-items: center;
  justify-content: center;
}
.passport-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
#passport-avatar-fallback { font-size: 7cqw; line-height: 1; }

.passport-name-box {
  position: absolute;
  left: 21.3%;
  top: 47.5%;
  width: 17%;
  height: 21%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 1.5%;
}
#passport-name-value {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 3cqw;
  color: #4a3416;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  text-align: center;
}

/* O asset atual não desenha mais uma caixa própria para cada valor —
   o número fica centralizado no espaço livre logo abaixo do rótulo
   ("Melhor pontuação", "Sequência", "Descobertas"), dentro da mesma
   coluna do ícone. */
.passport-stat {
  position: absolute;
  top: 60%;
  height: 24%;
  width: 15%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.passport-stat-score { left: 36.5%; }
.passport-stat-streak { left: 57%; }
.passport-stat-discovered { left: 75.5%; }
.passport-stat-value {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 4.4cqw;
  color: #4a3416;
}

/* =========================================================
   TELA DE JOGO
   Mesma filosofia das telas de Avatar/Dificuldade: shell único e
   vertical, fundo.webp como pele, topbar (retornar/configurações)
   sobreposta. Os dois grandes painéis (status e forca/dica) usam os
   PNGs reais como base — os dados dinâmicos entram por cima em
   posições relativas (%), medidas sobre a arte, sem nunca deformar
   os assets (mesmo container-type/cqw da tela de Dificuldade, para o
   texto escalar junto com a largura real do painel).
   ========================================================= */
#screen-game.screen-game {
  padding: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.game-shell {
  position: relative;
  width: min(100%, var(--shell-max-width));
  min-height: 100vh;
  min-height: 100dvh;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  background-image: url("assets/images/tela-jogo/fundo.webp");
  background-size: cover;
  background-position: center top;
  background-repeat: no-repeat;
  padding: max(14px, env(safe-area-inset-top)) 20px max(28px, env(safe-area-inset-bottom));
}

.game-shell img { user-select: none; -webkit-user-drag: none; }

.game-topbar {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.game-icon-btn {
  width: clamp(38px, 10vw, 50px);
  height: clamp(38px, 10vw, 50px);
  border: none;
  background: none;
  padding: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.15s ease;
}
.game-icon-btn img {
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
  filter: drop-shadow(0 3px 8px rgba(0, 0, 0, 0.45));
}
.game-icon-btn:active { transform: scale(0.9); }
@media (hover: hover) {
  .game-icon-btn:hover { transform: scale(1.06); }
}

/* Painel de status: pontuação / sequência / nível, sobreposto ao PNG
   (proporção nativa 1048×202). Os rótulos já vêm desenhados na arte —
   aqui só entram os valores dinâmicos, centralizados sob cada coluna. */
.status-panel {
  position: relative;
  width: 100%;
  max-width: 380px;
  margin-top: 10px;
  flex-shrink: 0;
  aspect-ratio: 1048 / 202;
  container-type: inline-size;
  animation: home-fade-in 0.5s ease both;
}
.status-panel-bg {
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
  filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.4));
}
.status-value {
  position: absolute;
  top: 54%;
  height: 32%;
  width: 24%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 5.4cqw;
  color: #4a3416;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.status-value.bump { animation: bump 0.35s ease; }
@keyframes bump { 0% { transform: scale(1); } 40% { transform: scale(1.25); color: var(--success-dark); } 100% { transform: scale(1); } }
.status-value-score { left: 8%; }
.status-value-streak { left: 38%; }
.status-value-level { left: 68%; font-size: 4.3cqw; }

.category-badge {
  align-self: center;
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.82rem;
  letter-spacing: 0.02em;
  color: #4a3416;
  background: linear-gradient(135deg, #ffe9a8, #f5a623);
  padding: 6px 16px;
  border-radius: var(--radius-pill);
  margin-top: 14px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.35);
  flex-shrink: 0;
}
/* Ícone real da categoria — mesma linguagem visual do Mapa de
   Descobertas (stats-row-icon): sem círculo, sem fundo próprio. */
.category-badge-icon {
  width: 16px;
  height: 16px;
  object-fit: contain;
  display: block;
  flex-shrink: 0;
  background: transparent;
}

/* Painel forca + dica: proporção nativa 420×525 (asset com caixa de
   dica maior). A haste, a barra superior e a caixa "DICA" já vêm
   desenhadas na arte — o SVG cobre só a corda e a figura (7 etapas:
   corda, cabeça, tronco, braço esquerdo, braço direito, perna
   esquerda, perna direita), presas ao gancho pintado na ponta direita
   da barra. */
.hangman-hint-panel {
  position: relative;
  width: 100%;
  max-width: 300px;
  margin-top: 14px;
  flex-shrink: 0;
  aspect-ratio: 420 / 525;
  container-type: inline-size;
  animation: home-fade-in 0.55s ease 0.05s both;
}
.hangman-hint-bg {
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
  filter: drop-shadow(0 10px 22px rgba(0, 0, 0, 0.4));
}
.hangman-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.hangman-part {
  stroke: #4a3416;
  stroke-width: 6;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  opacity: 0;
  transform-origin: 293px 147px;
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.hangman-part.visible {
  opacity: 1;
  animation: part-in 0.4s ease;
}
@keyframes part-in {
  0% { opacity: 0; transform: scale(0.6); }
  60% { opacity: 1; transform: scale(1.12); }
  100% { opacity: 1; transform: scale(1); }
}
#part-2 circle:first-child { fill: #FFD9A0; stroke: #4a3416; stroke-width: 5; }
#part-2 .eye { fill: #4a3416; stroke: none; }
#part-2 .mouth { stroke: #4a3416; stroke-width: 3; fill: none; }

.hint-content {
  position: absolute;
  left: 16%;
  top: 73%;
  width: 68%;
  height: 19%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}
#hint-text {
  width: 100%;
  box-sizing: border-box;
  padding: 4% 6%;
  font-weight: 700;
  /* tamanho ajustado dinamicamente por fitHintText() conforme o texto
     e o espaço disponível — este valor é só o estado inicial/fallback */
  font-size: 16px;
  line-height: 1.25;
  color: #4a3416;
}

.hint-extra-text {
  width: min(90%, 320px);
  margin-top: 10px;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  background: rgba(255, 248, 224, 0.94);
  border: 2px solid rgba(196, 155, 84, 0.55);
  color: #4a3416;
  font-weight: 600;
  font-size: 0.82rem;
  line-height: 1.4;
  text-align: center;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.3);
  animation: fade-in 0.4s ease;
  flex-shrink: 0;
}

.word-display {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  padding: 10px 0 2px;
  flex-shrink: 0;
}
.letter-box {
  width: 26px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.15rem;
  color: #fff6dd;
  text-shadow: 0 2px 5px rgba(0, 0, 0, 0.6);
  border-bottom: 4px solid #e8b84b;
  animation: letter-in 0.25s ease both;
}
.letter-box.space { border-bottom-color: transparent; width: 14px; }
@keyframes letter-in {
  from { opacity: 0; transform: translateY(6px) scale(0.8); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.attempts-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
  font-size: 0.8rem;
  font-weight: 700;
  color: #d8cfae;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
  flex-shrink: 0;
}
.attempts-text strong { color: #ffe9b8; }
.feedback-msg {
  min-height: 1.1em;
  font-size: 0.82rem;
  font-weight: 800;
  color: #8CFFB8;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.6);
}
.feedback-msg.error { color: #FF9AAE; }

.btn-hint-extra {
  margin-top: 10px;
  border: none;
  border-radius: var(--radius-pill);
  background: linear-gradient(135deg, #ffe9a8, #f5a623);
  color: #4a2e00;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.82rem;
  letter-spacing: 0.01em;
  padding: 10px 20px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 5px 0 rgba(150, 100, 10, 0.55), 0 6px 14px rgba(0, 0, 0, 0.3);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  flex-shrink: 0;
}
.btn-hint-extra:active { transform: translateY(3px); box-shadow: 0 2px 0 rgba(150, 100, 10, 0.55); }
.btn-hint-extra:disabled {
  background: rgba(210, 205, 190, 0.5);
  color: rgba(74, 52, 22, 0.55);
  box-shadow: none;
  cursor: not-allowed;
}

/* =========================================================
   TECLADO VIRTUAL — cada tecla usa tecla-teclado.png como moldura
   ========================================================= */
.keyboard {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin-top: 16px;
  width: 100%;
}
.keyboard-row { display: flex; gap: 5px; justify-content: center; width: 100%; }

.key {
  position: relative;
  flex: 1;
  max-width: 42px;
  min-width: 28px;
  aspect-ratio: 1;
  appearance: none;
  -webkit-appearance: none;
  border: none;
  border-radius: 0;
  padding: 0;
  background-color: transparent;
  background-image: url("assets/images/tela-jogo/tecla-teclado.png");
  background-size: 100% 100%;
  background-repeat: no-repeat;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1rem;
  color: #4a3416;
  display: flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.35));
  transition: transform 0.1s ease, filter 0.15s ease, opacity 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}
.key:active { transform: scale(0.92); }

.key.correct {
  filter: drop-shadow(0 0 6px rgba(47, 191, 113, 0.9));
}
.key.correct::before {
  content: "";
  position: absolute;
  inset: 14%;
  border-radius: 8px;
  background: rgba(47, 191, 113, 0.32);
}
.key.wrong {
  filter: grayscale(0.5) brightness(0.85);
}
.key.wrong::before {
  content: "";
  position: absolute;
  inset: 14%;
  border-radius: 8px;
  background: rgba(255, 92, 122, 0.32);
}
.key .key-letter { position: relative; z-index: 1; }
.key.correct::after, .key.wrong::after {
  content: "✓";
  position: absolute;
  top: -4px;
  right: -4px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--success);
  color: #fff;
  font-size: 9px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
  animation: key-pop 0.3s ease;
}
.key.wrong::after {
  content: "×";
  background: var(--danger);
}
.key:disabled { cursor: not-allowed; opacity: 0.55; }
.key.correct:disabled, .key.wrong:disabled { opacity: 1; }

@keyframes key-pop {
  0% { transform: scale(0.4); } 60% { transform: scale(1.2); } 100% { transform: scale(1); }
}

/* =========================================================
   MODAIS
   ========================================================= */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 15, 10, 0.55);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  display: flex;
  overflow-y: auto;
  padding: 20px;
  z-index: 100;
  animation: fade-in 0.25s ease;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

@keyframes modal-in {
  from { opacity: 0; transform: scale(0.85) translateY(20px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-icon { font-size: 2.6rem; display: block; margin-bottom: 6px; }

/* =========================================================
   MODAL DE BOAS-VINDAS / NOVA MISSÃO — usa o PNG real
   (popup-bem-vindo) como moldura; selo, faixa "NOVA MISSÃO" e
   ilustração+instrução (texto-boas-vindas.webp) já vêm prontos.
   Só o nome do jogador é renderizado dinamicamente.
   ========================================================= */
.welcome-modal {
  position: relative;
  margin: auto;
  width: min(92vw, 420px);
  animation: modal-in 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.3);
}

.welcome-modal-frame-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 392 / 558;
  container-type: inline-size;
}
.welcome-modal-frame {
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
  filter: drop-shadow(0 16px 32px rgba(20, 15, 10, 0.45));
}

.welcome-modal-content {
  position: absolute;
  left: 8%;
  right: 8%;
  top: 22%;
  bottom: 6%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 2.4cqw;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 2px;
  scrollbar-width: thin;
  scrollbar-color: rgba(74, 52, 22, 0.3) transparent;
}
.welcome-modal-content::-webkit-scrollbar { width: 5px; }
.welcome-modal-content::-webkit-scrollbar-track { background: transparent; }
.welcome-modal-content::-webkit-scrollbar-thumb {
  background: rgba(74, 52, 22, 0.3);
  border-radius: 3px;
}

.welcome-message {
  flex-shrink: 0;
  margin: 0;
  text-align: center;
  text-transform: uppercase;
  font-family: var(--font-display);
  font-weight: 800;
  line-height: 1.05;
  color: #0d4f52;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.45);
}
.welcome-prefix {
  display: block;
  font-size: clamp(14px, 5.4cqw, 22px);
  letter-spacing: 0.05em;
}
.welcome-name {
  display: block;
  font-size: clamp(22px, 9cqw, 40px);
  line-height: 1;
  word-break: break-word;
}

.welcome-illustration {
  flex-shrink: 0;
  width: 88%;
  height: auto;
  display: block;
  pointer-events: none;
}

.welcome-ok-btn {
  flex-shrink: 0;
  display: block;
  width: min(68%, 220px);
  appearance: none;
  -webkit-appearance: none;
  border: none;
  padding: 0;
  background: transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.12s ease;
}
.welcome-ok-btn img {
  display: block;
  width: 100%;
  height: auto;
  pointer-events: none;
  filter: drop-shadow(0 6px 14px rgba(20, 15, 10, 0.35));
  transition: filter 0.12s ease;
}
.welcome-ok-btn:active { transform: scale(0.96); }
.welcome-ok-btn:active img { filter: drop-shadow(0 2px 6px rgba(20, 15, 10, 0.3)) brightness(0.96); }
@media (hover: hover) {
  .welcome-ok-btn:hover img { filter: drop-shadow(0 8px 18px rgba(20, 15, 10, 0.4)) brightness(1.05); }
}

/* =========================================================
   MODAL DE RESULTADO — usa os PNGs reais (popup-muito-bem /
   popup-quase / voce-sabia / botões) como base visual; só os
   textos dinâmicos e os botões entram sobrepostos.
   ========================================================= */
.result-modal {
  position: relative;
  margin: auto;
  width: min(92vw, 420px);
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: modal-in 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.3);
}

#result-icon { display: none; }

.result-modal-frame-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 360 / 540;
  container-type: inline-size;
  flex-shrink: 0;
}
.result-modal-frame {
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
  filter: drop-shadow(0 16px 32px rgba(20, 15, 10, 0.45));
}

/* Tudo — inclusive os botões — vive dentro dessa camada, encaixada na
   área em branco do pergaminho (medida em % sobre o PNG real). Nada
   fica solto fora da moldura. */
.result-modal-content {
  position: absolute;
  left: 9%;
  right: 9%;
  top: 39%;
  bottom: 4%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 0.9cqw;
  overflow-y: auto;
  /* Rede de segurança para um caso raro extremo — na prática o layout
     abaixo já foi calibrado para não precisar disto. Se precisar, fica
     discreto em vez do scrollbar padrão do navegador. */
  scrollbar-width: thin;
  scrollbar-color: rgba(74, 52, 22, 0.3) transparent;
}
.result-modal-content::-webkit-scrollbar { width: 5px; }
.result-modal-content::-webkit-scrollbar-track { background: transparent; }
.result-modal-content::-webkit-scrollbar-thumb {
  background: rgba(74, 52, 22, 0.3);
  border-radius: 3px;
}

.result-word {
  flex-shrink: 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 6.6cqw;
  line-height: 1.15;
  color: #4a3416;
  text-align: center;
  letter-spacing: 0.01em;
  word-break: break-word;
}
.result-points {
  flex-shrink: 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 4.2cqw;
  color: var(--success-dark);
  background: #E4FBEF;
  padding: 1.4cqw 4.4cqw;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(31, 155, 88, 0.3);
  white-space: nowrap;
}

.curiosity-box {
  position: relative;
  flex-shrink: 0;
  width: 88%;
}
.curiosity-box-bg {
  display: block;
  width: 100%;
  height: auto;
  pointer-events: none;
}
.curiosity-box-text {
  position: absolute;
  left: 5%;
  right: 4%;
  top: 30%;
  bottom: 6%;
  overflow-y: auto;
  font-weight: 600;
  font-size: 3.7cqw;
  line-height: 1.28;
  color: #4a3416;
  text-align: left;
  /* Último recurso: se um texto raro ainda não couber, o scroll interno
     fica discreto (fino, sem trilho chapado) em vez do scrollbar padrão. */
  scrollbar-width: thin;
  scrollbar-color: rgba(74, 52, 22, 0.35) transparent;
}
.curiosity-box-text::-webkit-scrollbar { width: 5px; }
.curiosity-box-text::-webkit-scrollbar-track { background: transparent; }
.curiosity-box-text::-webkit-scrollbar-thumb {
  background: rgba(74, 52, 22, 0.3);
  border-radius: 3px;
}

.result-streak {
  flex-shrink: 0;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 3.4cqw;
  color: #4a3416;
  opacity: 0.85;
}

/* Botões — parte da composição do pop-up, não um bloco solto embaixo.
   Sem "margin-top: auto": eles ficam logo após o conteúdo (só o gap
   padrão do bloco os separa), em vez de grudados no fundo da moldura. */
.modal-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1cqw;
  width: 100%;
  flex-shrink: 0;
  margin-top: 0.3cqw;
}

.result-action-btn {
  display: block;
  appearance: none;
  -webkit-appearance: none;
  border: none;
  border-radius: 0;
  padding: 0;
  background-color: transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.12s ease;
}
.result-action-btn.is-primary { width: min(78%, 200px); }
.result-action-btn.is-secondary { width: min(66%, 172px); }
.result-action-btn img {
  display: block;
  width: 100%;
  height: auto;
  pointer-events: none;
  filter: drop-shadow(0 6px 14px rgba(20, 15, 10, 0.35));
  transition: filter 0.12s ease;
}
.result-action-btn:active { transform: scale(0.96); }
.result-action-btn:active img { filter: drop-shadow(0 2px 6px rgba(20, 15, 10, 0.3)) brightness(0.96); }
@media (hover: hover) {
  .result-action-btn:hover img { filter: drop-shadow(0 8px 18px rgba(20, 15, 10, 0.4)) brightness(1.05); }
}

.confetti-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 2;
}
.confetti-piece {
  position: absolute;
  top: -10px;
  width: 8px;
  height: 14px;
  opacity: 0.9;
  animation: confetti-fall linear forwards;
}
@keyframes confetti-fall {
  to { transform: translateY(420px) rotate(540deg); opacity: 0; }
}

/* =========================================================
   MODAL DE CONFIGURAÇÕES — usa o PNG real (configuracoes-popup)
   como moldura; título e selo já vêm desenhados na arte, então só
   o botão fechar e os controles dinâmicos entram sobrepostos.
   ========================================================= */
.settings-modal {
  position: relative;
  margin: auto;
  width: min(92vw, 360px);
  animation: modal-in 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.3);
}

.settings-modal-frame-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 390 / 612;
  container-type: inline-size;
}
.settings-modal-frame {
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
  filter: drop-shadow(0 16px 32px rgba(20, 15, 10, 0.45));
}

.settings-close-btn {
  position: absolute;
  top: 9%;
  right: 5%;
  width: 9cqw;
  height: 9cqw;
  min-width: 30px;
  min-height: 30px;
  border: none;
  appearance: none;
  -webkit-appearance: none;
  padding: 0;
  background: transparent;
  cursor: pointer;
  transition: transform 0.12s ease;
  z-index: 3;
  -webkit-tap-highlight-color: transparent;
}
.settings-close-btn img {
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
  filter: drop-shadow(0 3px 8px rgba(0, 0, 0, 0.3));
  transition: filter 0.12s ease;
}
.settings-close-btn:active { transform: scale(0.9); }
@media (hover: hover) {
  .settings-close-btn:hover img { filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.35)) brightness(1.08); }
}

.settings-modal-content {
  position: absolute;
  left: 10%;
  right: 10%;
  top: 20.5%;
  bottom: 6%;
  display: flex;
  flex-direction: column;
  gap: 3.2cqw;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 2px;
  scrollbar-width: thin;
  scrollbar-color: rgba(74, 52, 22, 0.3) transparent;
}
.settings-modal-content::-webkit-scrollbar { width: 5px; }
.settings-modal-content::-webkit-scrollbar-track { background: transparent; }
.settings-modal-content::-webkit-scrollbar-thumb {
  background: rgba(74, 52, 22, 0.3);
  border-radius: 3px;
}

.settings-section-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 4cqw;
  letter-spacing: 0.04em;
  color: var(--primary-dark);
}
.settings-divider {
  height: 2px;
  margin: 4px 0 8px;
  background: linear-gradient(90deg, transparent, rgba(196, 155, 84, 0.7), transparent);
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 5px 0;
}
.settings-row-column { flex-direction: column; align-items: stretch; gap: 4px; }
.settings-row-header { display: flex; align-items: center; justify-content: space-between; }
.settings-row-label {
  font-weight: 700;
  font-size: 3.6cqw;
  color: #4a3416;
}
.settings-volume-value {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 3.6cqw;
  color: var(--primary-dark);
  min-width: 2.4ch;
  text-align: right;
}

/* Toggle custom — sem o checkbox padrão do navegador */
.settings-toggle {
  position: relative;
  display: inline-flex;
  width: 46px;
  height: 25px;
  flex-shrink: 0;
  cursor: pointer;
}
.settings-toggle input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.settings-toggle-track {
  position: absolute;
  inset: 0;
  background: #d8cfae;
  border: 1px solid rgba(74, 52, 22, 0.3);
  border-radius: 999px;
  transition: background 0.2s ease, border-color 0.2s ease;
}
.settings-toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 19px;
  height: 19px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
  transition: transform 0.2s ease;
}
.settings-toggle input:checked ~ .settings-toggle-track {
  background: var(--success);
  border-color: var(--success-dark);
}
.settings-toggle input:checked ~ .settings-toggle-track .settings-toggle-thumb {
  transform: translateX(21px);
}
.settings-toggle input:focus-visible ~ .settings-toggle-track {
  outline: 3px solid var(--primary);
  outline-offset: 2px;
}

/* Slider de volume */
.settings-slider {
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  height: 6px;
  border-radius: 999px;
  background: #e2dcc4;
  outline: none;
  cursor: pointer;
}
.settings-slider::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--primary);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
  cursor: pointer;
}
.settings-slider::-moz-range-track { height: 6px; border-radius: 999px; background: #e2dcc4; }
.settings-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--primary);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
  cursor: pointer;
}
.settings-slider:focus-visible { outline: 3px solid var(--primary); outline-offset: 3px; }

.settings-profile-name {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 4.4cqw;
  color: #4a3416;
  margin: 2px 0 8px;
}

.settings-btn {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 9px 14px;
  border-radius: var(--radius-pill);
  border: 1.5px solid rgba(74, 52, 22, 0.25);
  background: #fffaf0;
  color: #2b2340;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 3.4cqw;
  letter-spacing: 0.02em;
  text-align: center;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  transition: transform 0.12s ease, background 0.12s ease;
  -webkit-tap-highlight-color: transparent;
}
.settings-btn:active { transform: scale(0.98); }
@media (hover: hover) {
  .settings-btn:hover { background: #fff; }
}
.settings-btn-danger {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger-dark);
}
@media (hover: hover) {
  .settings-btn-danger:hover { background: var(--danger-dark); }
}

.settings-reset-confirm {
  margin-top: 10px;
  padding: 10px 12px;
  background: rgba(255, 92, 122, 0.08);
  border: 1px solid rgba(226, 63, 95, 0.35);
  border-radius: var(--radius-md);
}
.settings-reset-question {
  font-weight: 800;
  color: #8a1f36;
  font-size: 3.5cqw;
  margin-bottom: 4px;
}
.settings-reset-detail {
  font-size: 3.1cqw;
  color: #4a3416;
  line-height: 1.35;
  margin-bottom: 8px;
}
.settings-reset-actions { display: flex; gap: 8px; }
.settings-reset-actions .settings-btn { margin-top: 0; }

.settings-warning {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin-top: 14px;
  padding: 10px 12px;
  background: #FFF3E0;
  border: 1.5px solid #E3A542;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 3.1cqw;
  line-height: 1.4;
  color: #6b3f0a;
  text-align: left;
}
.settings-warning-icon {
  flex-shrink: 0;
  font-size: 3.6cqw;
  line-height: 1.4;
}

/* =========================================================
   MODAL DE ESTATÍSTICAS — "Diário de Exploração". Usa o PNG real
   (popup-estatistica) como moldura; título e faixa já vêm desenhados
   na arte. Todo número aqui dentro é calculado em tempo real por
   calculateExplorerStats() (script.js) a partir do banco de palavras
   e do progresso salvo — nada é fixo, para o painel continuar certo
   se o banco crescer.
   ========================================================= */
.stats-modal {
  position: relative;
  margin: auto;
  width: min(94vw, 430px);
  animation: modal-in 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.3);
}

.stats-modal-frame-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 375 / 666;
  container-type: inline-size;
}
.stats-modal-frame {
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
  filter: drop-shadow(0 16px 32px rgba(20, 15, 10, 0.45));
}

.stats-back-btn {
  position: absolute;
  top: 8%;
  left: 5%;
  width: 11cqw;
  height: 11cqw;
  min-width: 34px;
  min-height: 34px;
  border: none;
  padding: 0;
  background: transparent;
  cursor: pointer;
  z-index: 3;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.12s ease;
}
.stats-back-btn img {
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
  filter: drop-shadow(0 3px 8px rgba(0, 0, 0, 0.3));
  transition: filter 0.12s ease;
}
.stats-back-btn:active { transform: scale(0.9); }
@media (hover: hover) {
  .stats-back-btn:hover img { filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.35)) brightness(1.08); }
}

.stats-modal-content {
  position: absolute;
  left: 9%;
  right: 9%;
  top: 19%;
  bottom: 6.5%;
  display: flex;
  flex-direction: column;
  gap: 3.6cqw;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 2px;
  scrollbar-width: thin;
  scrollbar-color: rgba(74, 52, 22, 0.3) transparent;
}
.stats-modal-content::-webkit-scrollbar { width: 5px; }
.stats-modal-content::-webkit-scrollbar-track { background: transparent; }
.stats-modal-content::-webkit-scrollbar-thumb {
  background: rgba(74, 52, 22, 0.3);
  border-radius: 3px;
}

.stats-section { flex-shrink: 0; }

/* Perfil do explorador */
.stats-profile-row {
  display: flex;
  align-items: center;
  gap: 3cqw;
  flex-shrink: 0;
}
.stats-profile-avatar {
  width: 16cqw;
  height: 16cqw;
  min-width: 50px;
  min-height: 50px;
  flex-shrink: 0;
  border-radius: 50%;
  background: #fffaf0;
  border: 2px solid rgba(74, 52, 22, 0.3);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.stats-profile-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.stats-profile-avatar span { font-size: 7cqw; }
.stats-profile-info { min-width: 0; }
.stats-profile-name {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 4.6cqw;
  color: #2b2340;
  margin: 0;
  line-height: 1.15;
  word-break: break-word;
}
.stats-profile-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 2.7cqw;
  letter-spacing: 0.08em;
  color: var(--primary-dark);
  margin: 1px 0 3px;
}
.stats-profile-message {
  font-size: 2.9cqw;
  color: #4a3416;
  line-height: 1.3;
  margin: 0;
}

/* Resumo da jornada */
.stats-summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2.5cqw;
}
.stats-summary-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  background: rgba(255, 248, 224, 0.6);
  border: 1px solid rgba(196, 155, 84, 0.35);
  border-radius: var(--radius-md);
  padding: 2.8cqw 1.5cqw;
}
.stats-summary-icon {
  width: 9cqw;
  height: 9cqw;
  min-width: 26px;
  min-height: 26px;
  object-fit: contain;
  margin-bottom: 1cqw;
}
.stats-summary-value {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 5cqw;
  color: var(--primary-dark);
  line-height: 1;
}
.stats-summary-label {
  font-size: 2.6cqw;
  color: #4a3416;
  margin-top: 2px;
}

/* Progresso da expedição */
.stats-progress-line {
  margin: 0;
  text-align: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 3.3cqw;
  color: #4a3416;
  letter-spacing: 0.03em;
}
.stats-progress-line strong { color: var(--primary-dark); font-size: 1.2em; }
.stats-progress-percent {
  margin: 1px 0 6px;
  text-align: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 5.4cqw;
  color: #0d4f52;
}
.stats-progress-bar-wrap { position: relative; width: 100%; flex-shrink: 0; }
.stats-progress-bar-frame { display: block; width: 100%; height: auto; pointer-events: none; }
/* Posição medida a partir dos pixels reais de barra-progresso.png
   (920×169): a calha de pergaminho entre os dois trilhos dourados vai de
   y=91 a y=141 (91/169=53.8% a 141/169=83.4% da altura) e de x=115 a
   x=820 (12.5% a 89.1% da largura, depois da bússola e antes da
   bandeira). O preenchimento fica só dentro dessa calha — nunca sobre a
   bússola, a bandeira ou os trilhos de metal. */
.stats-progress-bar-fill {
  position: absolute;
  left: 12.5%;
  top: 54%;
  height: 29.5%;
  width: 0%;
  max-width: 76.6%;
  border-radius: 999px;
  background: linear-gradient(90deg, #8fcaa2, #3d7d78);
  opacity: 0.82;
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.4), inset 0 -1px 2px rgba(13, 60, 55, 0.35);
  transition: width 0.4s ease;
}

/* Listas de nível e categoria — cartões compactos e reutilizáveis */
.stats-level-list, .stats-category-list {
  display: flex;
  flex-direction: column;
  gap: 2.8cqw;
}
.stats-row-card {
  display: flex;
  align-items: center;
  gap: 2.4cqw;
}
/* Ícone solto direto sobre o pergaminho — sem círculo, sem fundo, sem
   borda. A transparência real do PNG deve revelar o papel por trás. */
.stats-row-icon {
  display: block;
  width: 9cqw;
  height: 9cqw;
  min-width: 26px;
  min-height: 26px;
  max-width: 34px;
  max-height: 34px;
  flex-shrink: 0;
  object-fit: contain;
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
  padding: 0;
}
.stats-row-body { flex: 1; min-width: 0; }
.stats-row-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 6px;
}
.stats-row-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 3.3cqw;
  color: #2b2340;
}
.stats-row-count {
  font-size: 3cqw;
  font-weight: 700;
  color: var(--primary-dark);
  white-space: nowrap;
}
.stats-row-track {
  margin-top: 4px;
  height: 9px;
  border-radius: 999px;
  background: rgba(196, 155, 84, 0.16);
  border: 1px solid rgba(196, 155, 84, 0.3);
  box-shadow: inset 0 1px 2px rgba(74, 52, 22, 0.18);
  overflow: hidden;
}
.stats-row-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #d3b787, #4a8583);
  opacity: 0.85;
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.35);
  width: 0%;
  transition: width 0.4s ease;
}
/* Trilha/Expedição/Mistério — mesma paleta suave usada nas dificuldades
   do resto do jogo (verde/azul/roxo), só que dessaturada para não
   competir com a arte do pergaminho. */
.stats-row-fill--facil { background: linear-gradient(90deg, #a3d9ab, #5a9c68); }
.stats-row-fill--medio { background: linear-gradient(90deg, #a0c8e6, #4f7fac); }
.stats-row-fill--dificil { background: linear-gradient(90deg, #c9aee0, #82609e); }

/* =========================================================
   RESPONSIVIDADE — telas maiores
   ========================================================= */
@media (min-width: 380px) {
  .letter-box { width: 30px; height: 38px; font-size: 1.3rem; }
  .key { max-width: 46px; }
}

/* =========================================================
   ACESSIBILIDADE — reduzir movimento
   ========================================================= */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* Utilitário */
[hidden] { display: none !important; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
