@font-face {
  font-family: 'Citroen Regular';
  src:
    url('CitroenType-Regular.woff2') format('woff2'),
    url('CitroenType-Regular.woff') format('woff');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --game-font-family: 'Citroen Regular', system-ui, -apple-system, sans-serif;
  --game-touch-font: clamp(1.75rem, 2.8vw, 3.5rem);
}

html,
body.game-body {
  height: 100%;
  margin: 0;
}

.game-body {
  min-height: 100vh;
  min-height: 100dvh;
  background: #b20911;
  color: #fff;
  overflow-x: hidden;
  font-family: var(--game-font-family);
}

/* Faixa transparente no topo (50px) — toque para screen1 com ?reset=1 */
.game-exit-strip {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 50px;
  z-index: 10040;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  display: block;
  text-decoration: none;
}

.game-screen {
  display: block;
  box-sizing: border-box;
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
  background-position: center center;
  background-size: cover;
  background-repeat: no-repeat;
  cursor: pointer;
}

.game-screen--tap-next::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
}

.game-stage {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  background-position: center center;
  background-size: cover;
  background-repeat: no-repeat;
}

.game-hud {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: clamp(1rem, 3vh, 3rem);
  display: flex;
  gap: clamp(1rem, 3vw, 3rem);
  z-index: 5;
  font-size: var(--game-touch-font);
  font-weight: 700;
  text-shadow: 0 2px 8px rgb(0 0 0 / 35%);
  pointer-events: none;
}

.game-board-wrap {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  /* Espaço no topo (logótipo) + deslocamento extra do tabuleiro (+300px vs área do logo) */
  padding: calc(clamp(160px, 11vh, 220px) + 300px) clamp(1rem, 3vw, 4rem) clamp(1rem, 3vw, 4rem);
  z-index: 2;
}

.memory-grid {
  display: grid;
  gap: clamp(24px, 2vw, 48px);
  justify-content: center;
  align-content: center;
  justify-items: center;
  align-items: center;
}

.memory-grid.cols-2 {
  grid-template-columns: repeat(2, minmax(260px, 22vw));
}

.memory-grid.cols-4 {
  grid-template-columns: repeat(4, minmax(260px, 15vw));
}

.memory-grid.cols-8 {
  grid-template-columns: repeat(8, minmax(0, 1fr));
  grid-auto-flow: row;
  max-width: min(100%, 3920px);
  margin-inline: auto;
}

.memory-grid.rows-2 {
  grid-template-rows: repeat(2, auto);
}

.memory-grid.rows-2 > .memory-card {
  min-height: clamp(280px, 36vh, 420px);
}

/* Nível 3 (8×2): cartas um pouco maiores — usa mais a largura disponível */
.memory-grid.cols-8.rows-2 {
  gap: clamp(22px, 1.85vw, 44px);
}

.memory-grid.cols-8.rows-2 > .memory-card {
  min-height: clamp(312px, 42vh, 485px);
}

.memory-grid.cols-8 .memory-card {
  min-width: 0;
  max-width: none;
  justify-self: center;
  align-self: center;
}

.memory-card {
  width: 100%;
  max-width: min(420px, 100%);
  justify-self: center;
  aspect-ratio: 260 / 360;
  min-width: 260px;
  min-height: 280px;
  perspective: 1200px;
  cursor: pointer;
  border: none;
  padding: 0;
  background: transparent;
}

.memory-card:focus-visible {
  outline: 4px solid #fff;
  outline-offset: 4px;
}

.memory-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.45s ease;
  transform-style: preserve-3d;
}

.memory-card.is-flipped .memory-card-inner {
  transform: rotateY(180deg);
}

.memory-card.is-matched .memory-card-inner {
  transform: rotateY(180deg);
}

.memory-card-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  border-radius: clamp(12px, 1vw, 24px);
  overflow: hidden;
  box-shadow: 0 12px 28px rgb(0 0 0 / 35%);
}

.memory-card-face img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.memory-card-front {
  transform: rotateY(180deg);
}

.memory-modal img { 
  max-width: min(92vw, 1400px);
  width: auto;
  height: auto;
  border-radius: clamp(12px, 1.5vw, 28px);
  cursor: pointer;
}

.game-form-overlay {
  position: absolute;
  left: 50%;
  top: 54%;
  transform: translate(-50%, calc(-50% + 350px));
  width: min(92vw, 1400px);
  z-index: 10;
}

.game-form-overlay form .mb-3 {
  margin-bottom: clamp(2rem, 3.5vh, 3.5rem) !important;
}

.game-form-overlay .form-check.mb-4 {
  margin-bottom: clamp(2rem, 3vh, 3rem) !important;
  margin-top: clamp(0.5rem, 1vh, 1rem);
}

.game-form-overlay #formError.game-form-error {
  font-size: clamp(1.75rem, 3vw, 2.75rem);
  font-weight: 700;
  line-height: 1.3;
  color: #fff !important;
  text-shadow: 0 2px 14px rgb(0 0 0 / 55%);
  max-width: 46rem;
  margin-inline: auto;
  padding: 0.5rem 0.75rem;
}

.game-form-overlay .form-check-label {
  font-size: clamp(1.25rem, 2vw, 2rem);
}

.game-form-overlay .form-control {
  min-height: 120px;
  padding: 1rem 1.5rem;
  border: none;
  border-radius: clamp(28px, 2.5vw, 44px);
  box-shadow: 0 4px 16px rgb(0 0 0 / 15%);
  font-size: clamp(2rem, 3.2vw, 3.75rem);
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #1a1a1a;
}

.game-form-overlay .form-control::placeholder {
  color: #e30613;
  font-weight: 700;
  opacity: 1;
}

.game-form-overlay .form-control::-webkit-input-placeholder {
  color: #e30613;
  font-weight: 700;
}

.game-form-overlay .form-control::-moz-placeholder {
  color: #e30613;
  font-weight: 700;
  opacity: 1;
}

.game-form-overlay .form-check {
  display: flex;
  align-items: flex-start;
  gap: clamp(1rem, 2vw, 1.5rem);
}

.game-form-overlay .form-check-input {
  width: 50px !important;
  height: 50px !important;
  min-width: 50px !important;
  min-height: 50px !important;
  margin-top: 0.35rem !important;
  margin-left: 0 !important;
  flex-shrink: 0;
  border-radius: 12px;
  cursor: pointer;
}

.game-form-overlay .form-check-label {
  line-height: 1.35;
  padding-top: 0.25rem;
}

.game-form-overlay .form-check-label a {
  color: #fff;
  text-decoration: underline;
}

.game-form-overlay .btn-send {
  min-width: min(92vw, 520px);
  min-height: 120px;
  padding: 1.35rem clamp(2.5rem, 6vw, 5rem);
  font-size: clamp(2rem, 3.2vw, 3.75rem);
  font-weight: 700;
  letter-spacing: 0.04em;
  border: none;
  border-radius: 999px;
  background: #fff;
  color: #e30613;
  box-shadow: 0 8px 28px rgb(0 0 0 / 22%);
}

.game-form-overlay .btn-send:hover {
  background: #f5f5f5;
  color: #c50511;
}

.game-form-overlay .btn-send:active {
  transform: scale(0.98);
}

/* Screen5 — modal informação legal (dimensões + fontes para TV / 4K) */
.game-privacy-modal .modal-dialog {
  --bs-modal-width: min(94vw, 2200px);
  max-width: min(94vw, 2200px);
  width: min(94vw, 2200px);
  max-height: min(88vh, 1700px);
  margin-inline: auto;
}

.game-privacy-modal .modal-content {
  max-height: min(88vh, 1700px);
}

.game-privacy-modal .modal-header {
  padding: clamp(1.35rem, 2.8vw, 2.25rem) clamp(1.75rem, 3.5vw, 3rem);
}

.game-privacy-modal .modal-title {
  font-size: clamp(2.25rem, 4vw, 3.75rem);
  line-height: 1.2;
  font-weight: 700;
}

.game-privacy-modal .modal-body {
  font-size: clamp(1.7rem, 3vw, 3rem);
  line-height: 1.5;
  padding: clamp(1.35rem, 2.8vw, 2.25rem) clamp(1.75rem, 3.5vw, 3rem);
}

.game-privacy-modal .modal-body p {
  margin-bottom: 1.35em;
}

.game-privacy-modal .modal-body p:last-child {
  margin-bottom: 0;
}

.game-privacy-modal .modal-header .btn-close {
  transform: scale(1.75);
  transform-origin: center center;
}

/* position absolute + top/bottom/left: !important vence .position-* do Bootstrap (usa !important) */
.screen6-table-wrap {
  position: absolute !important;
  left: 50% !important;
  right: auto;
  top: auto !important;
  bottom: clamp(5vh, 12vw, 160px) !important;
  transform: translateX(-50%) !important;
  width: min(94vw, 1600px);
  z-index: 10;
  max-height: none;
}

/* Mostra ~10 linhas de dados; o restante faz scroll */
.screen6-table-scroll {
  max-height: min(
    calc(10 * clamp(3.25rem, 4.2vh, 5rem) + clamp(3.5rem, 5vh, 4.5rem)),
    52vh
  );
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  pointer-events: auto;
  overscroll-behavior: contain;
}

.screen6-name-masked {
  filter: blur(8px);
  user-select: none;
  pointer-events: none;
  display: inline-block;
  min-width: min(10ch, 36vw);
}

.screen6-name-me {
  filter: none;
  user-select: none;
}

.screen6-table-wrap table {
  font-size: clamp(1.6rem, 2.75vw, 3rem);
}

/* Tabela ranking: fundo transparente, texto branco, só linhas horizontais */
.screen6-ranking-table {
  --bs-table-bg: transparent;
  --bs-table-color: #fff;
  color: #fff;
  background-color: transparent !important;
  border-collapse: collapse;
}

.screen6-ranking-table > :not(caption) > * > * {
  background-color: transparent !important;
  color: #fff;
  box-shadow: none;
}

.screen6-ranking-table th,
.screen6-ranking-table td {
  border-left: none !important;
  border-right: none !important;
}

.screen6-ranking-table thead th {
  font-weight: 700;
  border-top: none !important;
  border-bottom: 2px solid rgb(255 255 255 / 65%) !important;
}

.screen6-ranking-table tbody td {
  border-top: none !important;
  border-bottom: 1px solid rgb(255 255 255 / 38%) !important;
}

.screen6-ranking-table tbody tr:hover > * {
  background-color: rgb(255 255 255 / 8%) !important;
}

.screen6-table-wrap th,
.screen6-table-wrap td {
  padding: 1rem 1.25rem;
}

.screen6-reset-layer {
  position: absolute;
  inset: 0;
  z-index: 5;
  cursor: pointer;
}

/* --- Modo debug (GAME_DEBUG no .env) — remover overlay em produção desativando GAME_DEBUG --- */
.game-debug-nav {
  position: fixed;
  right: clamp(0.5rem, 2vw, 1rem);
  bottom: clamp(0.5rem, 2vw, 1rem);
  z-index: 99999;
  max-width: min(92vw, 320px);
  font-family: system-ui, -apple-system, sans-serif;
  font-size: clamp(12px, 1.4vw, 15px);
  line-height: 1.35;
  pointer-events: auto;
  box-shadow: 0 8px 32px rgb(0 0 0 / 45%);
}

.game-debug-nav__toggle {
  display: block;
  width: 100%;
  padding: 0.45rem 0.65rem;
  margin: 0;
  border: none;
  border-radius: 8px 8px 0 0;
  background: #111;
  color: #9f9;
  font-weight: 700;
  font-size: inherit;
  cursor: pointer;
  text-align: left;
}

.game-debug-nav__panel {
  background: rgb(20 20 24 / 94%);
  color: #e8e8ea;
  border-radius: 0 0 10px 10px;
  padding: 0.65rem 0.75rem 0.75rem;
  backdrop-filter: blur(8px);
}

.game-debug-nav__title {
  font-weight: 700;
  margin-bottom: 0.45rem;
  color: #fff;
}

.game-debug-nav__links {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.game-debug-nav__link {
  display: block;
  padding: 0.35rem 0.5rem;
  border-radius: 6px;
  background: rgb(255 255 255 / 8%);
  color: #aef;
  text-decoration: none;
}

.game-debug-nav__link:hover {
  background: rgb(255 255 255 / 18%);
  color: #fff;
}

.game-debug-nav__link--muted {
  color: #bbb;
  font-size: 0.92em;
}

.game-debug-nav__hint {
  margin: 0.55rem 0 0;
  font-size: 0.85em;
  color: #9898a0;
}

.game-debug-nav__hint code {
  font-size: 0.92em;
  color: #dcb;
}
