/* ============================================================
   GAMECA — styles.css
   Sistema: preto + creme + acento ferrugem
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }

body {
  background-color: #0F0D0B;
  color: #F2EDE4;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }

/* ---------- Utilitários ---------- */
.line-clamp-2 { display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; }
.line-clamp-3 { display:-webkit-box; -webkit-line-clamp:3; -webkit-box-orient:vertical; overflow:hidden; }

.scrollbar-thin { scrollbar-width: thin; scrollbar-color: rgba(242,237,228,.2) transparent; }

/* ============================================================
   TEXTURA — grão sutil
   ============================================================ */
.hero-grain {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: .14;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='140' height='140'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.92' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}

/* ============================================================
   HEADER
   ============================================================ */
#app-header {
  background: linear-gradient(to bottom, rgba(8,7,6,.94), rgba(8,7,6,.5) 60%, transparent);
}
#app-header.is-scrolled {
  background: #080706;
  border-bottom: 1px solid #252220;
}

.header-rule {
  height: 3px;
  background: #C13524;
}

.nav-link {
  position: relative;
  padding: 8px 14px;
  border-radius: 2px;
  color: #8A8375;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  transition: color .2s, background .2s;
}
.nav-link:hover { color: #F2EDE4; background: rgba(242,237,228,.05); }
.nav-link.active { color: #F2EDE4; }
.nav-link.active::after {
  content: '';
  position: absolute;
  left: 14px; right: 14px; bottom: 0;
  height: 2px;
  background: #C13524;
}

/* ============================================================
   HERO
   ============================================================ */
#hero-backdrop { transition: opacity .7s ease; will-change: opacity; }

#hero-dots button {
  height: 3px;
  transition: width .3s, background .3s, transform .2s;
}
#hero-dots button:hover { transform: scaleY(1.5); }

/* ============================================================
   TÍTULOS DE FILEIRA
   ============================================================ */
.row-title {
  font-family: 'Anton', Impact, sans-serif;
  font-size: 1.5rem;
  letter-spacing: 0.02em;
  line-height: 1;
  padding: 0 1rem;
  color: #F2EDE4;
  text-transform: uppercase;
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
}
@media (min-width: 768px) {
  .row-title { font-size: 1.9rem; padding: 0 2.5rem; }
}

/* ============================================================
   CARROSSÉIS
   ============================================================ */
.row-track {
  display: flex;
  gap: 0.6rem;
  padding: 0.5rem 1rem 1.5rem;
  overflow-x: auto;
  overflow-y: visible;
  scroll-snap-type: x proximity;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: rgba(242,237,228,.15) transparent;
}
@media (min-width: 768px) {
  .row-track { gap: 0.85rem; padding: 0.5rem 2.5rem 1.75rem; }
}
.row-track::-webkit-scrollbar { height: 6px; }
.row-track::-webkit-scrollbar-track { background: transparent; }
.row-track::-webkit-scrollbar-thumb { background: rgba(242,237,228,.15); border-radius: 3px; }
.row-track::-webkit-scrollbar-thumb:hover { background: rgba(242,237,228,.35); }

.row-prev, .row-next { font-size: 1.15rem; line-height: 1; transition: transform .15s, border-color .2s, background .2s; }
.row-prev:hover, .row-next:hover { transform: scale(1.06); }

/* ============================================================
   CARDS
   ============================================================ */
.card {
  cursor: pointer;
  will-change: transform;
  border: 1px solid #252220;
  transition:
    transform .22s cubic-bezier(.22,1,.36,1),
    border-color .25s,
    box-shadow .25s;
}
.card:hover {
  border-color: rgba(193,53,36,.7);
  box-shadow: 0 20px 40px rgba(0,0,0,.7);
}
.card:active { transform: scale(1.01); }

.card-cover { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; background: #1A1715; }

.card-fallback {
  width: 100%;
  aspect-ratio: 3 / 4;
}

.card-fav {
  filter: drop-shadow(0 1px 2px rgba(0,0,0,.85));
  color: #C13524;
  font-size: 1rem;
  transition: opacity .2s;
}

/* ============================================================
   MODAL DE DETALHES
   ============================================================ */
#detail-modal { align-items: center; justify-content: center; }

#detail-box::-webkit-scrollbar { width: 8px; }
#detail-box::-webkit-scrollbar-track { background: transparent; }
#detail-box::-webkit-scrollbar-thumb { background: rgba(242,237,228,.15); border-radius: 4px; }
#detail-box::-webkit-scrollbar-thumb:hover { background: rgba(242,237,228,.3); }

#detail-ficha dt { font-weight: 500; color: #5A554D; }
#detail-ficha dd { word-break: break-word; color: #D9D2C3; }

#detail-fav { transition: background-color .2s, border-color .2s, transform .15s; }
#detail-fav:hover  { transform: scale(1.05); border-color: #C13524; }
#detail-fav:active { transform: scale(.95); }
#detail-fav[aria-pressed="true"] {
  background: rgba(193,53,36,.18);
  border-color: #C13524;
  color: #C13524;
}

/* ============================================================
   EMULADOR
   ============================================================ */
#emulator-overlay { background: #000; animation: fade-in .25s ease-out; }

#emulator-stage { position: relative; width: 100%; height: 100%; overflow: hidden; }

#game {
  width: 100% !important;
  height: 100% !important;
  display: flex;
  align-items: center;
  justify-content: center;
}
#game canvas, #game > div { max-width: 100% !important; max-height: 100% !important; margin: 0 auto; }

#emulator-bar { transition: opacity .3s; }
#emulator-save-status { transition: opacity .35s ease; }

/* ============================================================
   SKELETON
   ============================================================ */
@keyframes pulse-soft {
  0%, 100% { opacity: .5; }
  50%      { opacity: .2; }
}
.animate-pulse { animation: pulse-soft 1.6s ease-in-out infinite; }

/* ============================================================
   FOCUS
   ============================================================ */
:focus-visible { outline: 2px solid #C13524; outline-offset: 2px; border-radius: 2px; }
.card:focus:not(:focus-visible) { outline: none; }

/* ============================================================
   SELEÇÃO / SCROLLBAR GLOBAL
   ============================================================ */
::selection { background: #C13524; color: #F2EDE4; }

body::-webkit-scrollbar { width: 10px; }
body::-webkit-scrollbar-track { background: #080706; }
body::-webkit-scrollbar-thumb { background: #252220; border-radius: 5px; }
body::-webkit-scrollbar-thumb:hover { background: #3A3532; }

/* ============================================================
   MOBILE
   ============================================================ */
@media (max-width: 640px) {
  .row-title { font-size: 1.25rem; }
  #detail-box { border-radius: 0; }
}

/* ============================================================
   REDUCED MOTION
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ============================================================
   ESPAÇOS DE ANÚNCIO
   ============================================================ */
.ad-slot {
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(242, 237, 228, .03);
  border: 1px dashed rgba(242, 237, 228, .15);
  border-radius: 2px;
  color: #8A8375;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  min-height: 90px;
}

.ad-slot::before {
  content: '· publicidade ·';
  opacity: 0.5;
}

.ad-slot-horizontal {
  max-width: 970px;
  margin-left: auto;
  margin-right: auto;
}

@media (max-width: 640px) {
  .ad-slot { min-height: 100px; font-size: 9px; }
}

/* ============================================================
   IMPRESSÃO
   ============================================================ */
@media print {
  #app-header, #emulator-overlay, #detail-modal, #toast-container, .ad-slot, footer { display: none !important; }
  body { background: #fff; color: #000; }
}
